# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:filetype=tcl:et:sw=4:ts=4:sts=4

PortSystem          1.0
PortGroup           github 1.0
PortGroup           legacysupport 1.1

github.setup        p11-glue p11-kit 0.26.4
revision            0
categories          security
license             Permissive
description         PKCS#11 module discovery and loading
long_description    Provides a way to load and enumerate PKCS#11 modules and a standard \
                    configuration setup for installing PKCS#11 modules in such a way that \
                    they are discoverable.
maintainers         nomaintainer

github.tarball_from releases
use_xz              yes

checksums           rmd160  2298630cbc3630a24c995726c365867ab40eaac5 \
                    sha256  89c3ffb10e076ee036e14732bf6547a1e1c4fb48699a5dee7ceb5ce4f7c0c462 \
                    size    1081912

set py_ver          3.14
set py_ver_nodot    [string map {. {}} ${py_ver}]

depends_build       port:gettext \
                    path:bin/pkg-config:pkgconfig \
                    port:python${py_ver_nodot}

depends_lib         port:gettext-runtime \
                    port:libffi \
                    port:libtasn1 \
                    port:libxslt

depends_run         path:share/curl/curl-ca-bundle.crt:curl-ca-bundle

# pkcs11x.h:102: error: redefinition of typedef 'CK_TRUST'
compiler.c_standard 2011

configure.args      --disable-doc \
                    --disable-silent-rules \
                    --with-trust-paths=${prefix}/share/curl/curl-ca-bundle.crt:${prefix}/etc/openssl

# /usr/bin/python is Python 2.7 for older systems, and
# /usr/bin/python3 is too old (< 3.6) on older systems
# https://trac.macports.org/ticket/68739
configure.env       PYTHON=${prefix}/bin/python${py_ver}

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

variant doc description "Build man pages and documentation" {
    depends_build-append    port:gtk-doc
    configure.args-replace  --disable-doc --enable-doc
}

test.run            yes
test.target         check
