# -*- 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           clang_dependency 1.0

epoch               1
github.setup        rockdaboot libpsl 0.23.1

license             MIT
description         A C library and utility to handle the Public Suffix List
long_description    {*}${description}
maintainers         nomaintainer
categories          net

github.tarball_from releases

checksums           rmd160  422fc5f83902badf623d2b277e924b0830e31524 \
                    sha256  8fbb03054556498ba9c4cc48fcaa36a4483748c6504a65bdb9ba348f555b0e56 \
                    size    7821902

# Please note this port is (indirectly, via cmake) a dependency of the
# various clang-X ports. When updating the port versions
# used here make sure to ensure that the new port being used uses the
# clang_dependency PortGroup to avoid circular dependencies whilst building.
# See e.g. https://trac.macports.org/ticket/60419

depends_build-append \
                    port:gettext \
                    path:bin/pkg-config:pkgconfig

depends_lib-append  \
                    port:gettext-runtime \
                    port:libiconv \
                    port:libidn2 \
                    port:libunistring

configure.args      --enable-builtin \
                    --enable-runtime=libidn2 \
                    --disable-silent-rules

if {${subport} eq ${name}} {
    revision            0

    configure.args-append \
        --disable-gtk-doc \
        --disable-gtk-doc-html \
        --disable-gtk-doc-pdf

    notes "${name} API documentation is provided by the ${name}-docs port."
}

subport ${name}-docs {
    revision            0

    description         GTK docs for libpsl.
    long_description    {*}${description}
    platforms           any
    supported_archs     noarch

    depends_build-append \
        port:gtk-doc

    depends_lib-append \
        port:libpsl

    configure.args-append \
        --enable-gtk-doc

    post-destroot {
        delete ${destroot}${prefix}/bin \
            ${destroot}${prefix}/include \
            ${destroot}${prefix}/lib \
            ${destroot}${prefix}/share/man
    }
}
