aports/community/afl++/APKBUILD
2024-07-18 23:41:09 +02:00

94 lines
1.9 KiB
Plaintext

# Contributor: Marian <marian.buschsieweke@posteo.net>
# Maintainer: Marian <marian.buschsieweke@posteo.net>
pkgname=afl++
pkgver=4.21c
pkgrel=0
pkgdesc="Fuzzer relying on genetic algorithms instead of brute force"
url="https://aflplus.plus/"
# x86: test failures
# s390x: blocked by lld
arch="all !x86 !s390x"
license="Apache-2.0"
# afl-cmin requires stat
_llvmver=18
# 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
}