aboutsummaryrefslogtreecommitdiffstats
path: root/community/afl++/APKBUILD
blob: fa8d3a8ece1123069aed72600ea25ae2f4a0a3c0 (plain)
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
# Contributor: Marian <marian.buschsieweke@ovgu.de>
# Maintainer: Marian <marian.buschsieweke@ovgu.de>
pkgname=afl++
pkgver=4.20c
pkgrel=0
pkgdesc="Fuzzer relying on genetic algorithms instead of brute force"
url="https://aflplus.plus/"
# s390x: blocked by missing lld
# x86: basic unit tests fails
# 32-bit: unlikely anyone is doing fuzzing here
arch="all !armhf !armv7 !s390x !x86"
license="Apache-2.0"
# afl-cmin requires stat
_llvmver=17
# llvm LTO test fails on riscv64
# https://github.com/AFLplusplus/AFLplusplus/issues/2064
case "$CARCH" in
	riscv64) options="$options !check";;
esac
depends="
	clang$_llvmver
	compiler-rt
	lld~$_llvmver
	llvm$_llvmver
	python3
	"
# install -T
makedepends="
	clang$_llvmver-dev
	gmp-dev
	grep
	llvm$_llvmver-dev
	python3-dev
	"
checkdepends="
	bash
	cmocka-dev
	coreutils
	grep
	"
subpackages="
	$pkgname-doc
	afl++-tools
	"
provides="
	afl=$pkgver-r$pkgrel
	afl-clang=$pkgver-r$pkgrel
	afl-gcc=$pkgver-r$pkgrel
	"
source="
	$pkgname-$pkgver.tar.gz::https://github.com/AFLplusplus/AFLplusplus/archive/refs/tags/v$pkgver.tar.gz
	"
builddir="$srcdir/AFLplusplus-$pkgver"

build() {
	export PATH="$PATH:/usr/lib/llvm$_llvmver/bin"
	export NO_NYX=1
	export AFL_NO_X86=1
	export LLVM_LTO=1
	make PREFIX=/usr all
}

check() {
	# Unset our CFLAGS/CXXFLAGS for the tests since these may
	# interact in unexpected ways with afl-cc instrumentation.
	CFLAGS= CXXFLAGS= make AFL_NO_X86=1 test
}

package() {
	make AFL_NO_X86=1 PREFIX=/usr DESTDIR="$pkgdir" install

	# Test cases contain x86 binaries that cause trouble with strip on non-x86
	# architectures, so just drop the test cases here.
	rm -rf "$pkgdir"/usr/share/afl/testcases/

	# afl-cmin.bash is the same as afl-cmin, but implemented differently making
	# use of bash features. No need for the same functionality twice.
	rm "$pkgdir"/usr/bin/afl-cmin.bash
}

tools() {
	pkgdesc="AFL++ tools and utilities"
	depends="
		afl++
		coreutils
		grep
		"

	amove usr/bin/afl-cmin
	amove usr/bin/afl-plot
	amove usr/bin/afl-showmap
	amove usr/bin/afl-tmin
}

sha512sums="
b126b65d5a3054d1ea0a28333e81ae47e1bb2fb2f411e9b8edbe547b2962d8e58e1dbede7ea957c0572cc91d2912f3e5465f1e835e1ae072e3ccc31b33e555f5  afl++-4.20c.tar.gz
"