1 # Maintainer: Levente Polyak <anthraxx[at]archlinux[dot]org>
2 # Maintainer: Andreas 'Segaja' Schleifer <segaja at archlinux dot org>
5 pkgname=('unicorn' 'python-unicorn' 'ruby-unicorn-engine')
8 pkgdesc='Lightweight, multi-platform, multi-architecture CPU emulator framework based on QEMU'
9 url='https://www.unicorn-engine.org'
12 makedepends=('cmake' 'python' 'python-setuptools' 'ruby' 'ruby-rdoc')
13 checkdepends=('cmocka')
14 options=('!emptydirs')
15 source=(https://github.com/unicorn-engine/unicorn/archive/${pkgver}/${pkgbase}-${pkgver}.tar.gz)
16 sha512sums=('4249d33d38614ea1ca51e38c7838cb276306100aa44c65ad1b3e39304e4b856ac643a9c6f9d13678fc07bea58989a08b64653d17afe9e62bcef2936ba63e1b1f')
17 b2sums=('4ab8f92367e7df5762d29ed58dfff524f59053e28548b170b982d16988eea16df46851d2ea559d8beabb4f1315e5ee627f9ded755a4f3b1cfd6d863a50c633b6')
20 cd ${pkgbase}-${pkgver}
21 export UNICORN_CFLAGS="${CFLAGS} -ffat-lto-objects"
22 export UNICORN_QEMU_FLAGS="--extra-ldflags=\"$LDFLAGS\""
23 export QEMU_CXXFLAGS="${CXXFLAGS}"
24 export QEMU_LDFLAGS="${LDFLAGS}"
26 -DCMAKE_BUILD_TYPE=None \
27 -DCMAKE_INSTALL_PREFIX=/usr \
31 python const_generator.py python
32 python const_generator.py ruby
37 (cd bindings/ruby/unicorn_gem
38 gem build unicorn-engine.gemspec
43 cd ${pkgbase}-${pkgver}
44 ctest --test-dir build --output-on-failure
49 provides=('libunicorn.so')
50 cd ${pkgbase}-${pkgver}
51 DESTDIR="${pkgdir}" cmake --install build
52 install -Dm 644 samples/*.c -t "${pkgdir}/usr/share/doc/${pkgname}/samples"
55 package_python-unicorn() {
56 depends=('python' 'unicorn' 'python-setuptools')
57 cd ${pkgbase}-${pkgver}/bindings/python
58 python setup.py install --root="${pkgdir}" -O1 --skip-build
59 rm -r "${pkgdir}"/usr/lib/python*/site-packages/unicorn/lib
60 install -Dm 644 sample* shellcode.py -t "${pkgdir}/usr/share/doc/${pkgname}/samples"
63 package_ruby-unicorn-engine() {
64 depends=('ruby' 'unicorn')
65 replaces=('ruby-unicorn')
66 cd ${pkgbase}-${pkgver}/bindings/ruby/unicorn_gem
68 local _gemdir="$(gem env gemdir)"
72 --ignore-dependencies \
74 --install-dir "${pkgdir}${_gemdir}" \
75 --bindir "${pkgdir}/usr/bin" \
77 --with-opt-include="${srcdir}/${pkgbase}-${pkgver}/include" \
78 --with-opt-lib="${srcdir}/${pkgbase}-${pkgver}/build"
80 install -Dm 644 ../sample* -t "${pkgdir}/usr/share/doc/${pkgname}/samples"
82 # remove unrepreducible files
83 rm --force --recursive --verbose \
84 "${pkgdir}/${_gemdir}/cache/" \
85 "${pkgdir}/${_gemdir}/gems/${_gemname}-${pkgver}/vendor/" \
86 "${pkgdir}/${_gemdir}/doc/${_gemname}-${pkgver}/ri/ext/"
88 find "${pkgdir}/${_gemdir}/gems/" \
95 -iname "gem.build_complete" -o \
100 find "${pkgdir}/${_gemdir}/extensions/" \
103 -iname "mkmf.log" -o \
104 -iname "gem_make.out" \