Commit Graph

11 Commits

Author SHA1 Message Date
chayleaf
2f81f7bef8 allow absolute CMAKE_INSTALL_*DIR (#2134)
This patch fixes Capstone 5 build on NixOS.

NixOS's build infrastructure sets CMAKE_INSTALL_{LIB,INCLUDE}DIR to
absolute paths. If you append it to ${prefix}, you get the wrong path.
NixOS automatically detects it and links this issue:
https://github.com/NixOS/nixpkgs/issues/144170
2023-08-09 23:05:06 +08:00
Michael Orlitzky
1b78d029ee capstone.pc.in: use https in the URL. 2023-06-16 10:02:51 -04:00
Michael Orlitzky
d6c1e0df08 capstone.pc.in: re-add capstone include subdirectory via Cflags.
CMake installs the "common headers" for Capstone into a capstone/
subdirectory of the system's includedir:

  install(
    FILES ${HEADERS_COMMON}
    DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/capstone
  )

The pkg-config file, on the other hand, omits the subdirectory:

    includedir=${prefix}/include
    Cflags: -I${includedir}

This means that consumers of the library would need to include the
"capstone/" prefix when including those headers. For example,

  #include <capstone/capstone.h>

rather than

  #include <capstone.h>

Neither is "wrong" -- it's a design choice, but one that breaks the
public API when it changes. This has happened before:

  https://github.com/capstone-engine/capstone/commit/0a39b785
  https://github.com/capstone-engine/capstone/commit/02e33f8b

And (for example) PHP was updated to reflect that, i.e. to work with
capstone-4.x:

  https://github.com/php/php-src/commit/ffc2a53a

But now in the 5.x series of Capstone, the path (or the -I flag,
relative to that path) has reverted,

  https://github.com/capstone-engine/capstone/commit/6656bcb6

breaking PHP once again. This commit re-fixes it by updating the
directory passed via Cflags.

Closes: https://github.com/capstone-engine/capstone/issues/1982
2023-06-16 10:02:51 -04:00
Mario Haustein
8479233b64 Fix pkg-config template 2022-04-30 13:06:30 +02:00
Nguyen Anh Quynh
972d46f3f2 revert #1276 2022-01-26 12:34:43 +08:00
pancake
c803ce4751 Add the archs variable in the pkg-config file (#1828)
Usage:
 $ pkg-config --variable=archs capstone
 arm aarch64 m68k mips powerpc sparc systemz x86
 xcore tms320c64x m680x evm riscv mos65xx wasm bpf

Co-authored-by: pancake <pancake@nopcode.org>
2022-01-25 09:15:59 +08:00
Sergei Trofimovich
6e89663fd6 capstone.pc.in: use CMAKE_INSTALL_LIBDIR for libdir (#1659)
On x86_64-linux gentoo system capstone was installing
it's files to 'lib64' libdir, but was referring 'lib' libdir:

```
$ cat /usr/lib64/pkgconfig/capstone.pc
...
libdir=${prefix}/lib
...
```

On radare2 built it means injecting -L/usr/lib into a 64-build
and pulling in 32-bit libraries. 'ld.lld' is not able to resolve
the ambiguity.

It happens because @LIBSUFFIX@ is not present in cmake-3.17.3.

Let's fix the paths by using @CMAKE_INSTALL_LIBDIR@.
This variable is already used in capstone's build system,
thus should be safe to rely on.

Reported-by: Agostino Sarubbo
Bug: https://bugs.gentoo.org/730722
Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
2020-07-19 17:08:47 +08:00
ael
24354089cb fix include path in pkg-config template (#1276) 2018-10-23 19:42:01 -03:00
Fernie
4470bd824f fixed hardcoded paths with variables. (#1018)
* fixed hardcoded paths with variables.

cmake pkg-config file fixed hardcoded paths with variables. CMakeLists.txt line 394 needs to be modified
> configure_file("capstone.pc.in" "capstone.pc" @ONLY)

* forgot to add 64bit support variable.
2017-09-27 09:31:42 +08:00
Nguyen Anh Quynh
36d222b494 CMake: fix pkgconfig file 2017-04-30 23:20:08 +08:00
Gabor Buella
f25f105d1a cmake: install pkg config file 2017-04-30 23:19:54 +08:00