# -*- 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           github 1.0
PortGroup           legacysupport 1.1
PortGroup           makefile 1.0

# _strndup, _memmem
legacysupport.newest_darwin_requires_legacy 10

github.setup        mentebinaria readpe 0.84 v
github.tarball_from archive
revision            0
categories          sysutils devel
license             GPL-2+
maintainers         {makr @mohd-akram} openmaintainer

description         toolkit to analyze PE (Portable Executable) binaries

long_description    Open source, full-featured, multiplatform command line \
                    toolkit to work with and analyze PE (Portable Executable) \
                    binaries.

checksums           rmd160  fc31a223b974c58358cd5b9da26031f9661c6dd5 \
                    sha256  2d0dc383735802db62234297ae1703ccbf4b6d2f2754e284eb90d6f0a57aa670 \
                    size    642372

depends_lib         path:lib/libssl.dylib:openssl

patchfiles          patch-lib-libpe-makefile.diff

# cc1: error: unrecognized command line option "-Wno-implicit-fallthrough"
if {[string match *gcc-4.* ${configure.compiler}]} {
    post-patch {
        reinplace "s|-Wno-implicit-fallthrough||" ${worksrcpath}/src/Makefile
    }
}

build.args          prefix=${prefix}
destroot.args       prefix=${prefix}

post-destroot {
    set bash_dir ${prefix}/share/bash-completion/completions
    set zsh_dir ${prefix}/share/zsh/site-functions
    xinstall -d ${destroot}${bash_dir} ${destroot}${zsh_dir}
    copy ${worksrcpath}/completion/bash/${name} ${destroot}${bash_dir}
    copy ${worksrcpath}/completion/zsh/_${name} ${destroot}${zsh_dir}
}
