# -*- 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.0

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  19a8f10cbd6ec309aa1bc3b0fda249a2acf43862 \
                    sha256  f39b9631b3d369a21259ea4654f8875c0ec6995ce9551c0eb5d423e4c011f911 \
                    size    7822832

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