aboutsummaryrefslogtreecommitdiffstats
path: root/community/afl/APKBUILD
blob: 5f36e9aaa558e6392f53dc2cb0bf9fabfa524664 (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
# Contributor: Marian <marian.buschsieweke@ovgu.de>
# Maintainer: Marian <marian.buschsieweke@ovgu.de>
pkgname=afl
pkgver=2.56b
pkgrel=0
pkgdesc="Fuzzer relying on genetic algorithms instead of brute force"
url="http://lcamtuf.coredump.cx/afl/"
arch="all !x86"
license="Apache-2.0"
options="!check" # no tests provided
depends="clang llvm"
makedepends="clang-dev llvm-dev"
subpackages="$pkgname-doc $pkgname-clang:_clang $pkgname-gcc:_gcc"
source="$pkgname-$pkgver.tar.gz::https://github.com/google/AFL/archive/v$pkgver.tar.gz"
builddir="$srcdir/AFL-$pkgver"

CC=clang

build() {
	make AFL_NO_X86=1 PREFIX=/usr
	make -C llvm_mode AFL_NO_X86=1 PREFIX=/usr
}

package() {
	make AFL_NO_X86=1 PREFIX=/usr DESTDIR="$pkgdir" install
	install -Dm644 llvm_mode/README.llvm \
		"$pkgdir"/usr/share/doc/$pkgname/README.llvm_mode

	# small_exec.elf is an Intel binary which causes an error during
	# the strip() process on non Intel plattforms.
	case "$CARCH" in
		x86*) ;;
		*) rm -f "$pkgdir"/usr/share/afl/testcases/others/elf/small_exec.elf ;;
	esac
}

_clang() {
	description="$pkgdesc - CLang instrumention support"
	depends="clang"

	mkdir -p "$subpkgdir"/usr/bin
	mv "$pkgdir"/usr/bin/afl-clang \
		"$pkgdir"/usr/bin/afl-clang++ \
		"$subpkgdir"/usr/bin
}

_gcc() {
	description="$pkgdesc - GCC instrumention support"
	depends="gcc"

	mkdir -p "$subpkgdir"/usr/bin
	mv "$pkgdir"/usr/bin/afl-gcc \
		"$pkgdir"/usr/bin/afl-g++ \
		"$subpkgdir"/usr/bin
}

sha512sums="4e76fc503fe615aac4d0bbd8e3632d5cfbb7a3ac107be03c399afc024a8ad364dba933875d50a9b65083159faf6ebef5e13c39b25db977b01bd29b6340cad162  afl-2.56b.tar.gz"