# -*- 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.85 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  bf86fc7160de1b7592aa3dc2063bd6246575e327 \
                    sha256  2747a3ee87c7fb1ed0a13242816752a94603adb6ae0d9f507b019ac582c394eb \
                    size    647997

depends_lib         path:lib/libssl.dylib:openssl

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

configure.ldflags-delete    -L${prefix}/lib
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}
}
