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
This commit is contained in:
Michael Orlitzky 2023-06-16 09:16:54 -04:00
parent b98189dce9
commit d6c1e0df08

View File

@ -1,7 +1,7 @@
prefix=@CMAKE_INSTALL_PREFIX@
exec_prefix=${prefix}
libdir=${prefix}/@CMAKE_INSTALL_LIBDIR@
includedir=${prefix}/include
includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@
Name: capstone
Description: Capstone disassembly engine
@ -9,5 +9,5 @@ Version: @PROJECT_VERSION_MAJOR@.@PROJECT_VERSION_MINOR@.@PROJECT_VERSION_PATCH@
URL: http://www.capstone-engine.org
archive=${libdir}/libcapstone.a
Libs: -L${libdir} -lcapstone
Cflags: -I${includedir}
Cflags: -I${includedir}/capstone
archs=@CAPSTONE_ARCHITECTURES@