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

name                    libgsasl
gitlab.setup            gsasl gsasl 2.2.4 v
revision                0
checksums               rmd160  ee68fb789e997add97866848201080977217cd7e \
                        sha256  bc001fe4b5947cc5152b40637e3c921ce73db1f0f4693cd34a9e61c680b9ea33 \
                        size    721145

maintainers             {ryandesign @ryandesign} openmaintainer
categories              security net
license                 LGPL-2.1+
homepage                https://www.gnu.org/software/gsasl/

description             GNU SASL: an authentication library.

long_description        GNU SASL is an implementation of the Simple \
                        Authentication and Security Layer framework and \
                        a few common SASL mechanisms. SASL is used by \
                        network servers (e.g., IMAP, SMTP) to request \
                        authentication from clients, and in clients to \
                        authenticate against servers.

patchfiles              remove-solaris-patch.patch

use_autoreconf          yes
autoreconf.cmd          ./bootstrap
autoreconf.args

depends_build           port:autoconf \
                        port:automake \
                        port:gengetopt \
                        bin:git:git \
                        bin:tar:gnutar \
                        bin:gperf:gperf \
                        bin:gzip:gzip \
                        port:help2man \
                        port:libtool \
                        bin:perl:perl5 \
                        port:texinfo \
                        bin:wget:wget

depends_lib             port:gettext \
                        port:libgcrypt \
                        port:libiconv \
                        port:readline

configure.args          --disable-silent-rules \
                        --disable-gtk-doc \
                        --disable-ntlm \
                        --disable-valgrind-tests \
                        --without-gnutls \
                        --without-gssapi-impl \
                        --with-libgcrypt \
                        --without-openssl \
                        --without-stringprep \
                        --with-packager=MacPorts

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

default_variants        +idn \
                        +starttls

# GSS framework was added in macOS 10.7
if {${os.platform} eq "darwin" && ${os.major} >= 11} {
    default_variants-append +gssapi_native
} else {
    default_variants-append +gssapi_gss
}

variant doc description {Install HTML documentation} {
    depends_build-append    port:gtk-doc
    configure.args-replace  --disable-gtk-doc --enable-gtk-doc
}

variant gssapi_gss description {Use GNU GSSAPI implementation} conflicts gssapi_mit gssapi_native {
    depends_lib-append      port:gss
    configure.args-replace  --without-gssapi-impl --with-gssapi-impl=gss
}

variant gssapi_mit description {Use MIT GSSAPI implementation} conflicts gssapi_gss gssapi_native {
    configure.args-replace  --without-gssapi-impl --with-gssapi-impl=mit
}

variant gssapi_native description {Use native GSSAPI implementation} conflicts gssapi_gss gssapi_mit {
    configure.args-replace  --without-gssapi-impl --with-gssapi-impl=framework
}

variant idn description {Add non-ASCII support} {
    depends_lib-append      port:libidn
    configure.args-replace  --without-stringprep --with-stringprep
}

variant ntlm description {Add NTLM support} {
    depends_lib-append      port:libntlm
    configure.args-replace  --disable-ntlm --enable-ntlm
}

variant starttls description {Add STARTTLS support} {
    depends_lib-append      port:gnutls
    configure.args-replace  --without-gnutls --with-gnutls
}
