# -*- 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                popt
version             1.19
revision            0
checksums           rmd160  448d402932afb26b581a796a76027d0b93d08e09 \
                    sha256  c25a4838fc8e4c1c8aacb8bd620edb3084a3d63bf8987fdad3ca2758c63240f9 \
                    size    596676

categories          devel
platforms           darwin freebsd
license             X11

maintainers         nomaintainer

description         A getopt(3) like library with a number of enhancements
long_description    popt is a command line parsing library. It contains a number of \
                    enhancements over getopt(3), including being fully reentrant, allowing users to \
                    alias command line arguments, providing convience functions for parsing strings \
                    into argv[] style arrays and popt can parse arbitrary argv[] style arrays.

homepage            https://www.openhub.net/p/${name}/
master_sites        https://ftp.osuosl.org/pub/rpm/popt/releases/popt-1.x/

depends_build       port:gettext
depends_lib         port:gettext-runtime \
                    port:libiconv

# NOTE: No longer necessary, as of 2021-07-31.
# needs C11 for alignof(x)
#compiler.c_standard 2011

# Clang versions prior to 5 have issues with alignof(x)
compiler.blacklist-append \
                    { clang < 500 }

post-destroot {
    if {[file exists ${destroot}${prefix}/share/locale/locale.alias]} {
        delete ${destroot}${prefix}/share/locale/locale.alias
    }

    if {[file exists ${destroot}${prefix}/lib/charset.alias]} {
        delete ${destroot}${prefix}/lib/charset.alias
    }

    set docdir ${prefix}/share/doc/${name}
    xinstall -d ${destroot}${docdir}
    xinstall -m 0644 -W ${worksrcpath} ABOUT-NLS COPYING CREDITS README \
        ${destroot}${docdir}
}

# NOTE: Tests broken, as of 2021-07-31. (Regardless whether compiled with C11 or not.)
test.run            yes
test.target         check

livecheck.type      regex
livecheck.url       [lindex ${master_sites} 0]
livecheck.regex     ${name}-(\\d+(?:\\.\\d+)*)${extract.suffix}
