# Template file for 'db'
pkgname=db
version=5.3.21
revision=1
wrksrc="db-${version}"
short_desc="The Berkeley DB embedded database system"
maintainer="Juan RP <xtraeme@gmail.com>"
homepage="http://www.oracle.com/technetwork/products/berkeleydb/overview/index.html"
license="BSD"
distfiles="http://download.oracle.com/berkeley-db/db-${version}.tar.gz"
checksum=ddd92a930317df92021054c03992392db9ea5cddba43bef8920d392a82114fb8

do_configure() {
	cd build_unix
	../dist/configure ${configure_args} --enable-compat185 \
		--enable-cxx --enable-static --enable-dbm
}

do_build() {
	cd build_unix
	make LIBSO_LIBS=-lpthread ${makejobs}
}

do_install() {
	cd build_unix
	make DESTDIR=${DESTDIR} install

	chmod 755 ${DESTDIR}/usr/bin/*
	vmkdir usr/share/doc/${pkgname}-${version}
	mv ${DESTDIR}/usr/docs/* ${DESTDIR}/usr/share/doc/${pkgname}-${version}
	rmdir ${DESTDIR}/usr/docs
}

db-devel_package() {
	depends="libdb>=${version} libdb-cxx>=${version}"
	short_desc+=" - development files"
	pkg_install() {
		vmove usr/include
		vmove "usr/lib/*.a"
	}
}

db-docs_package() {
	short_desc+=" - documentation files"
	noarch=yes
	pkg_install() {
		vmove usr/share/doc
	}
}

libdb-cxx_package() {
	short_desc+=" - C++ shared libraries"
	pkg_install() {
		vmove "usr/lib/libdb_cxx*.so*"
	}
}

libdb_package() {
	short_desc+=" - C shared libraries"
	pkg_install() {
		vmove "usr/lib/libdb.so*"
		vmove "usr/lib/libdb-*.so*"
	}
}

db_package() {
	pkg_install() {
		vmove all
	}
}
