aboutsummaryrefslogtreecommitdiffstats
path: root/community/capstone/APKBUILD
blob: 96775073bb624c9deb122325c910f0cbc9a8c81b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# Contributor: Valery Kartel <valery.kartel@gmail.com>
# Maintainer: Valery Kartel <valery.kartel@gmail.com>
pkgname=capstone
pkgver=3.0.4
pkgrel=3
pkgdesc="The Ultimate Disassembler"
url="http://www.capstone-engine.org"
arch="all"
license="BSD-3-Clause-Clear"
depends=""
depends_dev="$pkgname"
makedepends="cmake python2-dev python3-dev py-setuptools"
install=""
subpackages="$pkgname-dev py2-${pkgname}:_py2:noarch py3-${pkgname}:_py3:noarch"
source="$pkgname-$pkgver.tar.gz::https://github.com/aquynh/$pkgname/archive/$pkgver.tar.gz
	$pkgname.pc"
builddir="$srcdir"/$pkgname-$pkgver

build() {
	cd "$builddir"
	cmake \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-DBUILD_SHARED_LIBS=True \
		-DCMAKE_BUILD_TYPE=Release \
		-DCMAKE_CXX_FLAGS="$CXXFLAGS" \
		-DCMAKE_C_FLAGS="$CFLAGS" \
		-DCAPSTONE_BUILD_STATIC=OFF
	make
}

package() {
	cd "$builddir"
	make DESTDIR="$pkgdir" install
	install -Dm644 "$srcdir"/$pkgname.pc \
		"$pkgdir"/usr/lib/pkgconfig/$pkgname.pc

	sed -i \
		-e "s/#pkgname/$pkgname/" \
		-e "s/#pkgdesc/$pkgdesc/" \
		-e "s/#pkgver/$pkgver/" \
		"$pkgdir"/usr/lib/pkgconfig/$pkgname.pc
}

_py2() {
	_py python2
}

_py3() {
	_py python3
}

_py() {
	local python="$1"
	pkgdesc="$pkgdesc (for $python)"
	install_if="$pkgname=$pkgver-r$pkgrel $python"

	cd "$builddir/bindings/python"
	$python setup.py install --prefix=/usr --root="$subpkgdir"
}

sha512sums="a5c29e7c559b5391d6a4ec9a7f766699ea6d321aa2f1fc57fdcec893107fa3ef2f5f6323629971c1129f1ca087df4f3ad03d0a8234d2eae368c8ccfec04dbf4d  capstone-3.0.4.tar.gz
87eacef80df36be18fe86f540a452b7e290c9dfc85d01c7926d263f2e5060f6d5fd6a6c68c350caf532f4926902a77fba24e59cb5e9b606be9706980ae4c8235  capstone.pc"