Fetching contributors…
Cannot retrieve contributors at this time
196 lines (171 sloc) 7.92 KB
PortSystem 1.0
PortGroup muniversal 1.0
name db46
version 4.6.21
#subport db46-java revision has been bumped, reset it on next version update
revision 10
set branch [join [lrange [split ${version} .] 0 1] {}]
categories databases
license Sleepycat
maintainers {blair @blair} openmaintainer
platforms darwin
description The Berkeley DB package, version 4.6
long_description \
Version 4.6 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.
patchfiles patch.${version}.1 \
patch.${version}.2 \
patch.${version}.3 \
distname db-${version}
dist_subdir db4/${version}_6
checksums ${distname}${extract.suffix} \
md5 718082e7e35fc48478a2334b0bc4cd11 \
sha1 5be3beb82e42a78ff671a3f5a4c30e5652972119 \
rmd160 ccf9a4b85cc0464b2f3c2f2da29d99328fd4978e \
patch.${version}.1 \
md5 4878872edfc53c6ecb871b1062a4bdaf \
sha1 c7c155705687e4de03d06c2ea86940f573fdac0b \
rmd160 8c11e9b991ac6559f22ece2d93617b16126049e8 \
patch.${version}.2 \
md5 55074e53d3acae2dcbeae8322f96e522 \
sha1 a694b71088ba99b74042e7568f395fe467bb6590 \
rmd160 f8abf554552db668037e046dea54700ce3340bf8 \
patch.${version}.3 \
md5 7a6e11b54712caf752f9c4a52babe60c \
sha1 d52aa498943cfaa339ad6bf2cf7b836a40627701 \
rmd160 4e6b7ed1e1c69cba54351d76a0b8543107a655b8 \
patch.${version}.4 \
md5 ae7d3d587355fe85b512ef09b9a77d19 \
sha1 e2190185c667edb97e800495ce6eb4f95f43eb87 \
rmd160 f1d18e59c311fb4e1f00a3b6220269fca17df312
# Generate libtool that understands -stdlib.
use_autoreconf yes
autoreconf.dir ${worksrcpath}/dist
autoreconf.cmd ${autoreconf.dir}/s_config
autoreconf.args --force --verbose --install \
--include=${prefix}/share/aclocal \
--include=${autoreconf.dir}/aclocal \
--include=${autoreconf.dir}/aclocal_java \
patchfiles-append autoreconf-fix.patch
depends_build-append port:autoconf port:automake port:libtool
configure.dir ${worksrcpath}/build_unix
build.dir ${configure.dir}
configure.cmd ${worksrcpath}/dist/configure
configure.args --enable-cxx \
--includedir=\\\${prefix}/include/db${branch} \
--libdir=\\\${prefix}/lib/db${branch} \
set cxx_stdlibflags {}
if {[string match *clang* ${configure.cxx}]} {
set cxx_stdlibflags -stdlib=${configure.cxx_stdlib}
configure.cxx ${configure.cxx} ${cxx_stdlibflags}
destroot.args-append \
pre-extract {
if {[file exists "/usr/local/include/db.h"]} {
ui_error "You have a conflicting install of Berkeley DB in /usr/local, please move it aside before building ${name}"
return -code error "Berkeley DB in /usr/local is in the way"
subport ${name}-java {
revision 10
depends_lib-append port:${name}
# Compile BerkeleyDB's Java bindings with Java 1.5 as this is the
# oldest version of Java that the bindings are known to compile
# with. This is done because ports that depend upon db46-java may
# be compiled with Apache Ant and Ant explicitly sets JAVA_HOME to
# /System/Library/Frameworks/JavaVM.framework/Home if JAVA_HOME is
# not already set. If Oracle's JDK 7 is installed on the Mac and
# is set as the default Java version, then when BerkeleyDB's Java
# bindings are compiled the *.class files will be a newer format
# then the older Java in $JAVA_HOME can read. So just compile
# BerkeleyDB with the oldest version of Java that can compile it.
# There is no harm in doing so as at application run time newer
# JVMs can read older class files and optimize them as if they
# were compiled with a newer version of Java. The only
# performance loss may be a slightly longer class loading time,
# which is optimized in newer versions of Java.
configure.env JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/1.5/Home
configure.args-append --enable-java
build.env JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/1.5/Home
platform macosx {
pre-configure {
if {![file isfile "/System/Library/Frameworks/JavaVM.framework/Headers/jni.h"]} {
ui_error "${subport} requires the Java for Mac OS X development headers."
if {${os.major} == 10} {
ui_error "Download the Java Developer Package from: <>"
} elseif {${os.major} == 9} {
ui_error "Download the Java Developer Package from: <>"
} else {
ui_error "Make sure your Xcode installation is complete."
return -code error "missing Java headers"
if {$subport == $name} {
post-destroot {
foreach bin [glob -tails -directory ${destroot}${prefix}/bin/ db_*] {
set newbin [regsub {^db_} ${bin} "db${branch}_"]
move ${destroot}${prefix}/bin/${bin} \
delete ${destroot}${prefix}/share/doc/${name}/java
# Delete this variant on or after 2013-10-08.
variant java description "Java API - moved to ${name}-java port" {
notes "${name}'s +java variant has been replaced with the ${name}-java port."
variant tcl description {build Tcl API} {
depends_lib-append port:tcl
configure.args-append --enable-tcl --with-tcl=${prefix}/lib
variant compat185 description {build with db185 compatibility mode} {
configure.args-append --enable-compat185
} else {
# There is no Java specific install target, so delete everything
# but the Java related files.
post-destroot {
set p ${destroot}${prefix}
delete ${p}/bin
delete ${p}/include
# Install the docs into the main ports's doc directory so that
# the link in index.html to java/index.html works.
foreach f [lsort [glob -tails -directory ${p}/share/doc/${name} *]] {
if {${f} != {java}} {
delete ${p}/share/doc/${name}/${f}
ln -s ${name} ${p}/share/doc/${subport}
foreach f [lsort [glob -tails -directory ${p}/lib/${name} *]] {
if { ${f} != {db.jar}
&& [string compare -length 10 {libdb_java} ${f}]} {
delete ${p}/lib/${name}/${f}
if { [variant_isset universal] } {
if {${os.arch} eq "i386"} {
if { ${os.major} >= 10 } {
set merger_configure_args(ppc) --with-mutex=Darwin/_spin_lock_try
set merger_configure_args(ppc64) --with-mutex=Darwin/_spin_lock_try
} else {
set merger_configure_args(i386) --with-mutex=x86/gcc-assembly
set merger_configure_args(x86_64) --with-mutex=x86_64/gcc-assembly
livecheck.type regex
livecheck.regex {(4\.6(?:\.\d+)*)\.tar\.gz}