# -*- 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           compiler_blacklist_versions 1.0
PortGroup           legacysupport 1.1

# O_CLOEXEC
legacysupport.newest_darwin_requires_legacy 10

name                pam-u2f
version             1.3.0
revision            0
categories          security
maintainers         {l2dy @l2dy} openmaintainer
license             BSD

description         Pluggable Authentication Module (PAM) for U2F

long_description    The PAM U2F module provides an easy way to integrate \
                    the Yubikey (or other U2F-compliant authenticators) into \
                    your existing user authentication infrastructure. PAM is \
                    used by GNU/Linux, Solaris and Mac OS X for user authentication.

homepage            https://developers.yubico.com/pam-u2f/
master_sites        https://developers.yubico.com/pam-u2f/Releases/
distname            pam_u2f-${version}

checksums           rmd160  ac31b7a2b55cd0bfed354b6cc5fb7bab9562b468 \
                    sha256  72360c6875485eb4df409da8f8f52b17893f05e4d998529c238814480e115220 \
                    size    456281

depends_build       port:asciidoc port:autoconf port:automake port:gengetopt port:libtool port:pkgconfig
depends_lib-append  port:libfido2

# cc1: error: unrecognized command line option "-Wno-sign-conversion"
compiler.blacklist-append \
                    *gcc-4.* {clang < 421}

configure.args      --with-pam-dir=${prefix}/lib/pam

notes "
Create a file for a new service in /etc/pam.d/ or edit
an already existing one by adding a line similar to this:

auth sufficient ${prefix}/lib/pam/pam_u2f.so debug

See https://developers.yubico.com/pam-u2f/#_installation for details
"

test.run            yes
test.target         check

livecheck.type      regex
livecheck.url       ${master_sites}
livecheck.regex     pam_u2f-(\\d+\\.\\d+\\.\\d+)${extract.suffix}