# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4

PortSystem          1.0
PortGroup           legacysupport 1.1

# memmem
legacysupport.newest_darwin_requires_legacy 10

name                afl
version             2.52b
categories          devel security
maintainers         nomaintainer
license             Apache-2

description         Instrumentation-driven fuzzer

long_description    American fuzzy lop is a security-oriented fuzzer that \
                    employs a novel type of compile-time instrumentation and \
                    genetic algorithms to automatically discover clean, \
                    interesting test cases that trigger new internal states \
                    in the targeted binary.

homepage            http://lcamtuf.coredump.cx/afl
master_sites        ${homepage}/releases
extract.suffix      .tgz

checksums           rmd160  b7c1174111cfc11d14a0982359ef903d5b8d1267 \
                    sha256  43614b4b91c014d39ef086c5cc84ff5f068010c264c2c05bf199df60898ce045 \
                    size    835907

patchfiles-append   patch-allow-32-bit.diff

use_configure       no

build.env           CC=${configure.cc} \
                    CXX=${configure.cxx} \
                    "CFLAGS=${configure.cflags} [get_canonical_archflags cc]" \
                    "CXXFLAGS=${configure.cxxflags} [get_canonical_archflags cxx]" \
                    "LDFLAGS=${configure.ldflags} [get_canonical_archflags ld]" \
                    PREFIX=${prefix}

if {${configure.build_arch} ni [list i386 x86_64]} {
    build.args-append \
                    AFL_NO_X86=1
    destroot.args-append \
                    AFL_NO_X86=1
}

destroot.env        PREFIX=${prefix}

livecheck.type      regex
livecheck.url       ${master_sites}
livecheck.regex     afl-(\\d+(?:\\.\\d+)*b).tgz

notes "
WARNING: Fuzzing on MacOS X is slow because of the unusually high overhead of \
fork() on this OS. Consider using Linux or *BSD. You can also use VirtualBox \
(virtualbox.org) to put AFL inside a Linux or *BSD VM.
"
