capstone: update to 5.0

Changes:

 * Use Ninja instead of make.
 * Follow PKGBUILD template.
 * Rebase patch.
This commit is contained in:
Biswapriyo Nath
2023-07-15 18:43:18 +05:30
parent 3729a3ef32
commit 6844e8e23e
2 changed files with 34 additions and 28 deletions

View File

@@ -4,22 +4,23 @@ _realname=capstone
pkgbase=mingw-w64-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-capstone"
"${MINGW_PACKAGE_PREFIX}-python-capstone")
_pkgver=4.0.2
_pkgver=5.0
pkgver=${_pkgver//-/}
pkgrel=3
pkgdesc='Lightweight multi-platform, multi-architecture disassembly framework'
pkgrel=1
pkgdesc='Lightweight multi-platform, multi-architecture disassembly framework (mingw-w64)'
url='https://www.capstone-engine.org/index.html'
arch=('any')
mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64' 'clang32' 'clangarm64')
license=('BSD')
license=('spdx:BSD-3-Clause')
depends=("${MINGW_PACKAGE_PREFIX}-gcc-libs")
makedepends=("${MINGW_PACKAGE_PREFIX}-cmake"
"${MINGW_PACKAGE_PREFIX}-cc"
"${MINGW_PACKAGE_PREFIX}-ninja"
"${MINGW_PACKAGE_PREFIX}-python-setuptools")
source=("${_realname}-${_pkgver}.tar.gz::https://github.com/aquynh/capstone/archive/${_pkgver}.tar.gz"
source=("${_realname}-${_pkgver}.tar.gz::https://github.com/capstone-engine/capstone/archive/refs/tags/${pkgver}.tar.gz"
"mingw_python.patch")
sha512sums=('7f93534517307b737422a8825b66b2a1f3e1cca2049465d60ab12595940154aaf843ba40ed348fce58de58b990c19a0caef289060eb72898cb008a88c470970e'
'c86d1e9b14e848db1451a9f9422b3e6522b4a021f21a8bdd4b90d398f0e35423f019ec15ff7a0a6f8047c954e8651f57474112ce1afc8dc3f178221e51553e33')
sha512sums=('e6794a9a06ed93edff9ae0b2c085d34010dd415e128ce4018b584fe35fa81182431f8fd6549d6a3c7a8a3bcca0691157c7a1c96971b7f51774960fd9afef9b8f'
'dddeb10567a8d7d583c3eb40b04185898a7250df04e53f54f6e00038284ede665101500605de86e0801daf88c79042e76e327368a575a0ee6f50c437fc6b8596')
prepare() {
cd ${_realname}-${pkgver}
@@ -27,23 +28,30 @@ prepare() {
}
build() {
mkdir -p build-${MINGW_CHOST}
cd build-${MINGW_CHOST}
declare -a extra_config
if check_option "debug" "n"; then
extra_config+=("-DCMAKE_BUILD_TYPE=Release")
else
extra_config+=("-DCMAKE_BUILD_TYPE=Debug")
fi
mkdir -p "${srcdir}/build-${MSYSTEM}" && cd "${srcdir}/build-${MSYSTEM}"
MSYS2_ARG_CONV_EXCL="-DCMAKE_INSTALL_PREFIX=" \
${MINGW_PREFIX}/bin/cmake \
-G"MSYS Makefiles" \
-DCMAKE_INSTALL_PREFIX="${MINGW_PREFIX}" \
-DCMAKE_BUILD_TYPE=Release \
../${_realname}-${_pkgver}
"${MINGW_PREFIX}"/bin/cmake.exe \
-GNinja \
-DCMAKE_INSTALL_PREFIX="${MINGW_PREFIX}" \
"${extra_config[@]}" \
-DBUILD_SHARED_LIBS=ON \
../${_realname}-${_pkgver}
make
"${MINGW_PREFIX}"/bin/cmake.exe --build .
}
package_capstone() {
cd build-${MINGW_CHOST}
cd "${srcdir}/build-${MSYSTEM}"
DESTDIR="${pkgdir}" "${MINGW_PREFIX}"/bin/cmake.exe --install .
make DESTDIR="${pkgdir}" install
install -Dm644 "${srcdir}/${_realname}-${_pkgver}/docs/README" -t "${pkgdir}/${MINGW_PREFIX}/share/doc/${_realname}"
install -Dm644 "${srcdir}/${_realname}-${_pkgver}/LICENSE.TXT" -t "${pkgdir}/${MINGW_PREFIX}/share/licenses/${_realname}"
}
@@ -57,7 +65,7 @@ package_python-capstone() {
cd ${_realname}-${_pkgver}/bindings/python
MSYS2_ARG_CONV_EXCL="--prefix=;--install-scripts=;--install-platlib=" \
LIBCAPSTONE_PATH="${srcdir}/build-${MINGW_CHOST}/libcapstone.dll" \
LIBCAPSTONE_PATH="${srcdir}/build-${MSYSTEM}/libcapstone.dll" \
${MINGW_PREFIX}/bin/python setup.py install -O1 --root="${pkgdir}" --prefix="${MINGW_PREFIX}"
install -Dm644 "${srcdir}/${_realname}-${_pkgver}/LICENSE.TXT" -t "${pkgdir}/${MINGW_PREFIX}/share/licenses/python-${_realname}"

View File

@@ -1,7 +1,6 @@
diff -rupN a/bindings/python/capstone/__init__.py b/bindings/python/capstone/__init__.py
--- a/bindings/python/capstone/__init__.py 2018-07-18 09:17:10.000000000 -0700
+++ b/bindings/python/capstone/__init__.py 2018-08-17 15:09:28.988353900 -0700
@@ -207,7 +207,7 @@ if not hasattr(sys.modules[__name__], '_
--- a/bindings/python/capstone/__init__.py
+++ b/bindings/python/capstone/__init__.py
@@ -333,7 +333,7 @@
if sys.platform == 'darwin':
_lib = "libcapstone.dylib"
elif sys.platform in ('win32', 'cygwin'):
@@ -10,10 +9,9 @@ diff -rupN a/bindings/python/capstone/__init__.py b/bindings/python/capstone/__i
else:
_lib = "libcapstone.so"
diff -rupN a/bindings/python/setup.py b/bindings/python/setup.py
--- a/bindings/python/setup.py 2018-07-18 09:17:10.000000000 -0700
+++ b/bindings/python/setup.py 2018-08-17 16:11:44.551487800 -0700
@@ -60,8 +60,8 @@ if SYSTEM == 'darwin':
--- a/bindings/python/setup.py
+++ b/bindings/python/setup.py
@@ -65,8 +65,8 @@
LIBRARY_FILE = "libcapstone.dylib"
STATIC_LIBRARY_FILE = 'libcapstone.a'
elif SYSTEM in ('win32', 'cygwin'):
@@ -23,8 +21,8 @@ diff -rupN a/bindings/python/setup.py b/bindings/python/setup.py
+ LIBRARY_FILE = "libcapstone.dll"
STATIC_LIBRARY_FILE = None
else:
VERSIONED_LIBRARY_FILE = "libcapstone.so.4"
@@ -157,7 +157,10 @@ class custom_sdist(sdist):
VERSIONED_LIBRARY_FILE = "libcapstone.so.{PKG_MAJOR}".format(**VERSION_DATA)
@@ -165,7 +165,10 @@
class custom_build(build):
def run(self):
if 'LIBCAPSTONE_PATH' in os.environ: