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

name                softhsm
version             2.6.1
revision            2
categories          security
platforms           darwin
license             BSD
maintainers         {iay.org.uk:ian @iay} {NLnetLabs.nl:jaap @Jakker} openmaintainer

description         Software implementation of a Hardware Security Module (HSM)
long_description    SoftHSM is an implementation of a cryptographic store accessible \
                    through a PKCS #11 interface. You can use it to explore PKCS #11 \
                    without having a Hardware Security Module. SoftHSM Version 2 is using \
                    openssl for its cryptographic operations.

homepage            https://www.opendnssec.org/softhsm
master_sites        http://dist.opendnssec.org/source/

checksums           rmd160  73b116b9513d1afcd241431e967a582de1cb737f \
                    sha256  61249473054bcd1811519ef9a989a880a7bdcc36d317c9c25457fc614df475f2 \
                    size 1066766

patchfiles          0001-Issue-548-Don-t-clean-up-engines-after-OpenSSL-has-a.patch \
                    0002-Fix-OPENSSL_cleanup-detection-without-using-our-own-.patch \
                    0003-mouse07410-OSSLCryptoFactory.patch

depends_build       port:libtool port:pkgconfig port:cppunit
depends_lib         path:lib/libssl.dylib:openssl \
                    port:sqlite3

compiler.cxx_standard 2011

configure.args      --with-sqlite3=${prefix} \
                    --with-objectstore-backend-db \
                    --with-openssl=${prefix}

build.type          gnu

destroot.keepdirs   ${destroot}${prefix}/var/lib/softhsm/tokens

test.run            yes
test.target         check

livecheck.type      regex
livecheck.url       [lindex ${master_sites} 0]
livecheck.regex     ${name}-(2.\[0-9.\]+)${extract.suffix}