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

# clock_gettime
legacysupport.newest_darwin_requires_legacy 15

codeberg.setup          jengelh libhx 5.6 v
revision                0

categories              devel
license                 LGPL-2.1+
homepage                https://inai.de/projects/libhx
maintainers             {sethm.id.au:dev @McDaMastR} \
                        openmaintainer

description             Common structures and low-level operations library
long_description        libHX is a C library (with some C++ bindings \
                        available) that provides data structures and functions \
                        commonly needed, such as maps, deques, linked lists, \
                        string formatting and autoresizing, option and config \
                        file parsing, type checking casts and more.  libHX \
                        aids in quickly writing up C and C++ data processing \
                        programs, by consolidating tasks that often happen to \
                        be open-coded, such as (simple) config file reading, \
                        option parsing, directory traversal, and others, into \
                        a library.  The focus is on reducing the amount of \
                        time (and secondarily, the amount of code) a developer \
                        has to spend for otherwise implementing such.

depends_extract-append  bin:zstd:zstd

# codeberg PortGroup doesn't yet support release tarballs
master_sites            ${codeberg.homepage}/releases/download/${git.branch}
distname                libHX-${version}

checksums               rmd160  9f6fe8fa4a4c4c31c063a4123afe48e56813b1a7 \
                        sha256  0e86fedea7552f61cfdc8281f51fa696f4978ee35011780521b9cfd8130b40c8 \
                        size    387664

extract.suffix          .tar.zst
extract.cmd             zstd

compiler.c_standard     1999

configure.args-append   --enable-shared \
                        --disable-silent-rules \
                        --disable-static

configure.checks.implicit_int \
                        no
# <https://trac.macports.org/wiki/WimplicitFunctionDeclaration>
configure.checks.implicit_function_declaration.whitelist-append \
                        alignof

test.run                yes
test.target             check

post-destroot {
    set destdocdir  ${destroot}${prefix}/share/doc/${name}

    xinstall -d ${destdocdir}
    xinstall -W ${worksrcpath} -m 644 \
        COPYING \
        {*}[glob -directory ${worksrcpath}/doc *.rst] \
        {*}[glob -directory ${worksrcpath}/doc *.txt] \
        ${destdocdir}
}
