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

# Note: this version is for backward compatibility, remove after dependents are updated
name                        xmlsec-1.2
version                     1.2.42
revision                    0

categories                  security textproc devel
license                     MIT
maintainers                 {mps @Schamschula} openmaintainer
description                 XML Security Library is a C library based on LibXML2.
long_description            {*}${description}. The library supports major XML security \
                            standards. XML Signature, XML Encryption, Canonical XML and \
                            Exclusive Canonical XML.
homepage                    https://www.aleksey.com/xmlsec/
master_sites                ${homepage}download/ \
                            ftp://ftp.xmlsoft.org/xmlsec/releases/
distname                    xmlsec1-${version}

checksums                   rmd160  946eded6de36eac59ef3262b90c8b7313cdeaa80 \
                            sha256  5359e3c19016ab164b505c1222ef5a2d87b34f50f85ff91d765f4aaa0df42db2 \
                            size    2071216

depends_build               path:bin/pkg-config:pkgconfig

depends_lib                 port:libgcrypt \
                            path:lib/pkgconfig/gnutls.pc:gnutls \
                            port:icu \
                            port:libtool \
                            port:libxml2 \
                            port:libxslt \
                            port:nspr \
                            port:nss \
                            path:lib/libssl.dylib:openssl

patchfiles                  patch-src-dl.c.diff

post-patch {
    reinplace "s|@PREFIX@|${prefix}/lib/${name}|g" ${worksrcpath}/src/dl.c
}

configure.args              --disable-silent-rules \
                            --prefix=${prefix}/lib/${name}

# nss is not universal.
universal_variant           no

test.run                    yes
test.target                 check

livecheck.type              regex
livecheck.url               ${homepage}download/
livecheck.regex             {xmlsec1-(1\.2\.[0-9.]+)\.}
