Skip to content

Commit

Permalink
capstone.pc.in: re-add capstone include subdirectory via Cflags.
Browse files Browse the repository at this point in the history
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:

  0a39b785
  02e33f8b

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

  php/php-src@ffc2a53a

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

  6656bcb6

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

Closes: #1982
  • Loading branch information
orlitzky committed Jun 16, 2023
1 parent e9fd6f4 commit ac1d85e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions capstone.pc.in
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
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
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@

0 comments on commit ac1d85e

Please sign in to comment.