# Template file for 'afl'
pkgname=afl
version=2.57b
revision=1
# x86 only currently
archs="i686* x86_64*"
build_style=gnu-makefile
hostmakedepends="clang llvm which"
short_desc="American fuzzy lop - a brute-force fuzzer"
maintainer="Leah Neukirchen <leah@vuxu.org>"
license="Apache-2.0"
homepage="https://github.com/google/AFL/"
distfiles="https://github.com/google/AFL/archive/v${version}.tar.gz"
checksum=6f05a6515c07abe49f6f292bd13c96004cc1e016bda0c3cc9c2769dd43f163ee

nostrip_files="small_archive.a small_exec.elf"

do_build() {
	make PREFIX=/usr

	CFLAGS="${CFLAGS//-fstack-clash-protection} -fPIC" \
	CXXFLAGS="${CXXFLAGS//-fstack-clash-protection} -fPIC" \
	LDFLAGS="${LDFLAGS} -pie" \
	make PREFIX=/usr CC=clang CXX=clang++ -C llvm_mode
}

post_install() {
	# Test cases contain binary .../testcases/others/elf/small_exec.elf
	# so move them to /usr/lib/afl
	mv ${DESTDIR}/usr/{share,lib}/afl/testcases
}

