# -*- 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

name                afl
version             2.52b
categories          devel security
platforms           darwin
maintainers         {stevenmyint.com:git @myint} openmaintainer
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

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}

destroot.env        PREFIX=${prefix}

pre-fetch {
    if {${os.subplatform} eq "macosx" && [vercmp ${macosx_version} 10.7] < 0} {
        ui_error "${name} ${version} requires memmem(3), only available on OS X 10.7 or greater."
        return -code error "incompatible macOS version"
    }
}

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.
"
