On MSYS2, CMake is used to build Capstone,
On ArchLinux, GNU Make is used to build Capstone.
Packaging in ArchLinux shows proper version in the pkgconf.
Packaging in MSYS2 shows bogus version in the pkgconf.
Why?
ArchLinux case
When built with GNU Make it uses pkconfig.mk to generate capstone.pc
# Package version of Capstone for Makefile.
# To be used to generate capstone.pc for pkg-config
# version major & minor
PKG_MAJOR = 5
PKG_MINOR = 0
# version bugfix level. Example: PKG_EXTRA = 1
PKG_EXTRA = 1
# version tag. Examples: rc1, b2, post1 - or just comment out for no tag
PKG_TAG =
PREFACE
Bug report stacktrace (blame me)
https://github.com/xmake-io/xmake/issues/4940 https://github.com/msys2/MINGW-packages/issues/20581
What happens?
On MSYS2, CMake is used to build Capstone, On ArchLinux, GNU Make is used to build Capstone.
Packaging in ArchLinux shows proper version in the pkgconf. Packaging in MSYS2 shows bogus version in the pkgconf.
Why?
ArchLinux case
When built with GNU Make it uses
pkconfig.mk
to generatecapstone.pc
If we grab out built package: https://archlinux.org/packages/extra/x86_64/capstone/download/ It will show proper version (Extracted for convenience):
Version: 5.0.1
No problem for ArchLinux so far.BUT...
MSYS case
When built with CMake it uses CMakeLists
project
version definition to generatecapstone.pc
Here are the relevant bits:Hmm... CMake says
5.0
... It should be5.0.1
Why?Let's look at the generated
capstone.pc
!If we grab out built package (CLANG64 variant, which is the one I found first and later confirmed it's across all MSYS2 Environments): https://mirror.msys2.org/mingw/clang64/mingw-w64-clang-x86_64-capstone-5.0.1-1-any.pkg.tar.zst And see the contents of the
capstone.pc
:Oh noes! It is
5.0
! But even worse, it's bogus because it's5.0.
, caused by that missing variable... in CMake.PROJECT_VERSION_PATCH wasn't defined.
It's required to use the PATCH version!