# -*- 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.1 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  5b0b574012a90ccf83bfd8d5fde89f32fc54ad28 \
                    sha256  3218099d94c81488a4b042d86f64a4076835e1f2f2aff8ed4d58f01c20567507 \
                    size    648014

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