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

# clock_gettime
legacysupport.newest_darwin_requires_legacy 15

name                    libhx
version                 5.4

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

master_sites            https://inai.de/files/libhx/
distname                libHX-${version}

checksums               rmd160  fdabbc5d182454f153dbf14e65a6450926a63d73 \
                        sha256  3b169f4b0d3ddd888033b5816f54e7438b991c465197640c37d9f9dd5d926595 \
                        size    382462

extract.suffix          .tar.zst
extract.cmd             zstd

# no known conversion from 'const unsigned int' to 'clockid_t'
patchfiles              fix-clockid_t-conversion.diff

compiler.c_standard     1999

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

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

livecheck.type          regex
livecheck.url           https://inai.de/files/libhx/
livecheck.regex         "libHX-(\[0-9]+(\\.\[0-9]+)*)\\.tar\\.zst"
