# -*- 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.7 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  509c3bc9587f3504811a84754b9ac602e4c5fd09 \
                        sha256  e923f8c07ead0a2f7bf8a97841ac15b455a11e75e8e37d186e3853e4d9af7b41 \
                        size    383622

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] \
        ${destdocdir}
}
