# $Id: Portfile 98555 2012-10-08 17:26:37Z blair@macports.org $

PortSystem 1.0

name            db44
version         4.4.20
revision        1
set branch      [join [lrange [split ${version} .] 0 1] {}]
categories      databases
license         Sleepycat
maintainers     nomaintainer
platforms       darwin
description     The Berkeley DB package, version 4.4

long_description \
    Version 4.4 of the Berkeley Data Base library which \
    offers (key/value) storage with optional concurrent \
    access or transactions interface.  This port will \
    install the AES (American Encryption Standard) \
    enabled version.

homepage        http://www.oracle.com/us/products/database/berkeley-db/db/overview/index.html
master_sites    http://download.oracle.com/berkeley-db/
patch_sites     http://download.oracle.com/berkeley-db/patches/db/${version}/

patchfiles      patch.${version}.1 \
                patch.${version}.2 \
                patch.${version}.3 \
                patch.${version}.4

distname        db-${version}
patch.dir       ${workpath}/${distname}

checksums       ${distname}${extract.suffix} \
                md5     d84dff288a19186b136b0daf7067ade3 \
                sha1    bb4c68a4afc14712eb2954b7991f5dc9fe93bf7b \
                rmd160  5940d9244b4df4897f66f1b67d3c967081c18b85 \
                patch.${version}.1 \
                md5     66584d621355df055b6e05b4a02e9c3e \
                sha1    5843380b67561134432f46dce53b67a133ef7962 \
                rmd160  57ecff5ecb934e1eb771c49e4e67246d579702b2 \
                patch.${version}.2 \
                md5     85df93a0867f6cace3501671cdeb6ed1 \
                sha1    75f0ae6ef06a23a690e5ebe6460552a11448ef32 \
                rmd160  e560b07cc20dbd6865d8aad91941515f8fb031c1 \
                patch.${version}.3 \
                md5     88ee91889ebf5498b22b2e7bed945d41 \
                sha1    580265cdccc394ed988a6334f6c9a7d2bb15d141 \
                rmd160  668c8e88f6fde2c028a9a3ad1d6917a28e7b3e85 \
                patch.${version}.4 \
                md5     c2ef7b3e59460c35950fab5f2faa3fc0 \
                sha1    8875add3312fdc0548fbd4dedb71b4f8637dc6c9 \
                rmd160  46cf2177aee1ce00c0044817610231541722c4d3

worksrcdir      ${distname}/build_unix

configure.cmd   ../dist/configure
configure.args  --enable-cxx --enable-compat185 --enable-dump185 \
                --includedir=\\\${prefix}/include/db${branch} \
                --libdir=\\\${prefix}/lib/db${branch}

destroot.destdir \
    prefix=${destroot}${prefix} \
    docdir=${destroot}${prefix}/share/${name}-${version}/

post-destroot {
    foreach bin [glob -tails -directory ${destroot}${prefix}/bin/ db_*] {
        set newbin [regsub {^db_} ${bin} "db${branch}_"]
        move ${destroot}${prefix}/bin/${bin} \
            ${destroot}${prefix}/bin/${newbin}
    }
}

variant java description {Build the Java API} {
    configure.args-append   --enable-java
}

variant tcl description {build Tcl API} {
    depends_lib-append      port:tcl
    configure.args-append   --enable-tcl --with-tcl=${prefix}/lib
}

livecheck.type  regex
livecheck.url   http://www.oracle.com/technetwork/database/berkeleydb/downloads/index-082944.html
livecheck.regex {(4\.4(?:\.\d+)*)\.tar\.gz}
