# $Id: Portfile 63956 2010-02-19 04:58:37Z rmsfisher@macports.org $

PortSystem          1.0
name                qca
version             2.0.2
set branch          [join [lrange [split ${version} .] 0 1] .]
set major           [lindex [split ${version} .] 0]
categories          devel crypto security
maintainers         rowue openmaintainer
license             LGPLv2.1
description         Qt Cryptographic Architecture
long_description \
    This library provides an easy API for the following features: SSL/TLS, \
    X509, SASL, RSA, Hashing (SHA1, MD5), Ciphers (BlowFish, 3DES, AES), \
    Functionality is supplied via plugins.

platforms            darwin

homepage             http://delta.affinix.com/qca/
master_sites         http://delta.affinix.com/download/qca/${branch}/
use_bzip2            yes

checksums            md5     27ebdfbd9869d90dae078a6decd029f4 \
                     sha1    5a414c3296cd37d1ec34182be0d089c5073f55a8 \
                     rmd160  18b0f497709f9700227644977946735d2ec3c623

depends_lib          path:bin/qmake-mac:qt4-mac

configure.args       --qtdir=${prefix}/libexec/qt4-mac \
                     --no-framework

post-build {
    system "install_name_tool -id ${prefix}/lib/libqca.${major}.dylib \
        ${worksrcpath}/lib/libqca.${version}.dylib"
}

destroot {
    xinstall -m 755 -d ${destroot}${prefix}/lib ${destroot}${prefix}/include \
        ${destroot}${prefix}/share/qt4/mkspecs/features \
        ${destroot}${prefix}/lib/pkgconfig \
        ${destroot}${prefix}/share/doc/${name} \
        ${destroot}${prefix}/share/examples/${name} \
        ${destroot}${prefix}/include/QtCrypto
        
    xinstall -m 644 -W ${worksrcpath}/lib libqca.${version}.dylib \
                ${destroot}${prefix}/lib
    ln -s libqca.${version}.dylib ${destroot}${prefix}/lib/libqca.dylib
    ln -s libqca.${version}.dylib ${destroot}${prefix}/lib/libqca.${major}.dylib
    ln -s libqca.${version}.dylib ${destroot}${prefix}/lib/libqca.${branch}.dylib

    foreach f [glob ${worksrcpath}/include/QtCrypto/*] {
        xinstall -m 644 $f ${destroot}${prefix}/include/QtCrypto
    }

    xinstall -m 644 -W ${worksrcpath} crypto.prf \
        ${destroot}${prefix}/share/qt4/mkspecs/features
    xinstall -m 644 -W ${worksrcpath}/lib/pkgconfig qca2.pc \
        ${destroot}${prefix}/lib/pkgconfig
    xinstall -m 644 -W ${worksrcpath} COPYING README TODO \
        ${destroot}${prefix}/share/doc/${name}
    eval file copy [glob ${worksrcpath}/examples/*] \
        ${destroot}${prefix}/share/examples/${name}
}

livecheck.type  regex
livecheck.url   ${homepage}
livecheck.regex "${name}-(\\d+(?:\\.\\d+)*)${extract.suffix}"
