# -*- 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
# $Id: Portfile 85405 2011-10-13 10:46:32Z jmr@macports.org $

PortSystem                  1.0

name                        xmlsec
version                     1.2.18
categories                  security textproc devel
license                     MIT
platforms                   darwin
maintainers                 nomaintainer

description                 XML Security Library is a C library based on LibXML2.

long_description            XML Security Library is a C library based on LibXML2. The \
                            library supports major XML security standards. XML Signature, \
                            XML Encryption, Canonical XML and Exclusive Canonical XML.

homepage                    http://www.aleksey.com/xmlsec/
master_sites                ${homepage}download/ \
                            ftp://ftp.xmlsoft.org/xmlsec/releases/
distname                    xmlsec1-${version}

checksums                   sha1    740c3c791be838bf638651a3fe0e80c624c2ae0e \
                            rmd160  da4eb26dc0f9b2bcc7d8da216cbff47fd5fadbe2

depends_build               port:pkgconfig

depends_lib                 port:libxml2 \
                            port:libxslt \
                            port:libiconv \
                            port:libtool \
                            port:zlib

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

configure.args              --with-libxml=${prefix} \
                            --with-libxslt=${prefix}

# Add gcrypt support.
depends_lib-append          port:libgcrypt
configure.args-append       --with-gcrypt=${prefix}

# Add gnutls support.
depends_lib-append          port:gnutls
# Do not specify the path to gnutls or it will fail to find it, because
# it looks for the libgnutls-config script that gnutls no longer provides.
# Do not remove the equals sign or it will fail trying to find the
# libraries and headers in a directory called "yes".
configure.args-append       --with-gnutls=

# Add nss and nspr support.
depends_lib-append          port:nss port:nspr
configure.args-append       --with-nss=${prefix} --with-nspr=${prefix}
configure.ldflags-append    -L${prefix}/lib/nss -L${prefix}/lib/nspr
# nss is not universal.
universal_variant           no

# Add openssl support.
depends_lib-append          port:openssl
# Do not specify the path to openssl or it will try to link with the
# static library instead of the dynamic one, and it will fail when
# openssl is installed universal.
# Do not remove the equals sign or it will fail trying to find the
# libraries and headers in a directory called "yes".
configure.args-append       --with-openssl=

test.run                    yes
test.target                 check

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