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

github.setup        archiecobbs mod-authn-otp 1.1.5
# Change github.tarball_from to 'releases' or 'archive' next update
github.tarball_from tarball
revision            2
name                mod_authn_otp

categories          www
maintainers         nomaintainer
license             GPL-2

description         module for one-time password authentication
long_description    mod_authn_otp is an Apache web server module for two-factor \
                    authentication using one-time passwords (OTP) generated via \
                    the HOTP/OATH algorithm defined in RFC 4226. This creates a \
                    simple way to protect a web site with one-time passwords, \
                    using any RFC 4226-compliant token device, including software \
                    tokens that run on cell phones such as OATH Token. \
                    mod_authn_otp also supports the Mobile-OTP algorithm.

checksums           rmd160  dcb2a74554d4cc7665302b9c903d61b6a21ac7e3 \
                    sha256  a11d44cb3a52215a0a5ee320b361d26ca66cc9f5d789d37f8fedb78e4b3ff18d

depends_build       port:gsed
depends_lib         port:apache2 path:lib/libssl.dylib:openssl

patchfiles          otptool.h.patch \
                    patch-Makefile.am.diff

use_autoreconf      yes

configure.args      --mandir=${prefix}/share/man
configure.env       APXS=${prefix}/bin/apxs

set mdir            ${destroot}${prefix}/lib/apache2/modules/

post-configure {
   # sed doesn't know about option "-r", gsed does
   reinplace "s| sed| ${prefix}/bin/gsed|g" ${worksrcpath}/Makefile
   # when stripping .so, option "-x" has to be specified
   reinplace "s| \$(STRIP) \$(DESTDIR)\`| \$(STRIP) -x \$(DESTDIR)\`|" ${worksrcpath}/Makefile
}

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

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