# -*- 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               cmake 1.1
PortGroup               github 1.0

github.setup            paolostivanin libcotp 4.2.2 v
github.tarball_from     archive
revision                0

categories              security devel crypto
license                 Apache-2
maintainers             {sethm.id.au:dev @McDaMastR} \
                        openmaintainer

description             C library for generating one-time passwords
long_description        A {*}${description}, supporting TOTP, HOTP, YAOTP, and \
                        Steam Guard.

checksums               rmd160  26179f2a15a66cd9699477fb6cdfa0a1ab9e2191 \
                        sha256  52baa968de23be3d54465f214ba2733f848702b211711ba625db2535e14433b7 \
                        size    58112

depends_build-append    path:bin/pkg-config:pkgconfig
depends_lib-append      port:libgcrypt

compiler.c_standard     2011

# TODO: tests require criterion, which is not yet in Macports: https://github.com/Snaipe/Criterion
configure.args-append   -DBUILD_SHARED_LIBS=ON \
                        -DBUILD_TESTS=OFF \
                        -DCOTP_ENABLE_VALIDATION=ON

post-destroot {
    set destdocdir  ${destroot}${prefix}/share/doc/${name}

    xinstall -d ${destdocdir}
    xinstall -W ${cmake.source_dir} -m 644 \
        LICENSE \
        README.md \
        SECURITY.md \
        ${destdocdir}
}
