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

github.setup        airtower-luna mod_gnutls 0.13.0 mod_gnutls/
github.tarball_from archive
revision            0

categories          www security crypto
license             Apache-2
maintainers         {mps @Schamschula} openmaintainer

description         \
    mod_gnutls is an extension for Apache's httpd uses the GnuTLS library to \
    provide HTTPS.

long_description    \
    mod_gnutls uses the GnuTLS library to provide SSL 3.0, TLS 1.0 and TLS 1.1 \
    encryption for Apache HTTPD. It is similar to mod_ssl in purpose, but does \
    not use OpenSSL.

homepage            https://github.com/airtower-luna/mod_gnutls/

checksums           rmd160  cd873c3892b0018e8798e396c0ee9ffb4759cf1a \
                    sha256  a49d1ed4b242028f1e5eb0f14369ee2b073efafb5d27d5adfdf1153efe3a1752 \
                    size    168071

set python.version  314
set python.branch   [string index ${python.version} 0].[string range ${python.version} 1 end]
configure.python    ${prefix}/bin/python${python.branch}

depends_build       port:pandoc \
                    port:pkgconfig \
                    port:python${python.version} \
                    port:py${python.version}-yaml

depends_lib         port:apache2 \
                    path:lib/pkgconfig/gnutls.pc:gnutls

patchfiles          patch-meson.build.diff \
                    patch-src-gnutls_sni.c.diff

# the patch-meson.build.diff patch and below reinplace should not be needed
# after the next update: https://github.com/airtower-luna/mod_gnutls/pull/57
post-patch {
    reinplace "s|%PREFIX%|${prefix}|g" ${worksrcpath}/meson.build
}

set httpd_conf      ${prefix}/etc/apache2/httpd.conf
set mdir            ${destroot}${prefix}/lib/apache2/modules/

configure.args      -Dc_args=-Wno-error=format

compiler.blacklist-append {clang < 800}

pre-destroot {
    xinstall -m 755 -d ${mdir}
}

post-destroot {
    xinstall -m 755 -d ${destroot}${prefix}/share/doc/${name}
    xinstall -m 644 -W ${worksrcpath} LICENSE NOTICE README.md \
        ${destroot}${prefix}/share/doc/${name}
}

variant memcache description {Distributed SSL Session Cache support} {
    depends_lib-append      port:apr_memcache
    configure.args-append   --with-apr-memcache-prefix=${prefix}
}

notes "
To enable ${name}, add
    LoadModule gnutls_module modules/mod_gnutls.so
to your ${httpd_conf} file.
"

github.livecheck.regex  {(\d\.\d+(\.\d+))}
