addpkg: zydis 4.0.0.rc.1-1

This commit is contained in:
George Rawlinson 2022-10-10 10:08:09 +13:00
parent a7c485d83b
commit 0f539617d9
Signed by: grawlinson
GPG Key ID: E0959FEA8B550539
1 changed files with 70 additions and 0 deletions

70
zydis/PKGBUILD Normal file
View File

@ -0,0 +1,70 @@
# Maintainer: George Rawlinson <grawlinson@archlinux.org>
# Contributor: Thibaut Pérami <thibaut.perami@cl.cam.ac.uk>
pkgname=zydis
pkgver=4.0.0.rc.1
pkgrel=1
pkgdesc='Fast and lightweight x86/x86-64 disassembler and code generation library'
arch=('x86_64')
url='https://zydis.re'
license=('MIT')
depends=('gcc-libs' 'zycore-c')
makedepends=('git' 'cmake' 'ruby-ronn-ng' 'doxygen')
checkdepends=('python')
_commit='2a9f9c66775a4ac3d56bb163c85563df3cea7547'
source=("git+https://github.com/zyantific/zydis.git#commit=$_commit")
b2sums=('SKIP')
pkgver() {
cd "$pkgname"
git describe --tags | sed -e 's/^v//' -e 's/-/./g'
}
build() {
# https://archlinux.org/todo/lto-fat-objects/
export CFLAGS+=" -ffat-lto-objects"
cmake \
-S "$pkgname" \
-B build \
-Wno-dev \
-DCMAKE_BUILD_TYPE='None' \
-DCMAKE_INSTALL_PREFIX=/usr \
-DZYDIS_BUILD_SHARED_LIB=ON \
-DZYAN_SYSTEM_ZYCORE=ON \
-DZYDIS_BUILD_MAN=ON
cmake --build build
}
check() {
# test suite extracted from .github/workflows/main.yml
cd "$pkgname/tests"
# regression tests (decoder)
python regression.py test "$srcdir/build/ZydisInfo"
# regression tests (encoder)
python regression_encoder.py \
"$srcdir/build/ZydisFuzzReEncoding" \
"$srcdir/build/ZydisFuzzEncoder" \
"$srcdir/build/ZydisTestEncoderAbsolute"
}
package() {
DESTDIR="$pkgdir" cmake --install build
cd "$pkgname"
# documentation
install -vDm644 -t "$pkgdir/usr/share/doc/Zydis" README.md
cp -vr examples "$pkgdir/usr/share/doc/Zydis"
# move man pages to correct directory
install -vd "$pkgdir/usr/share/man/man1"
mv "$pkgdir/usr/share/man/"*.1 "$pkgdir/usr/share/man/man1"
# license
install -vDm644 -t "$pkgdir/usr/share/licenses/$pkgname" LICENSE
}