1 # Copyright 1999-2018 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
6 inherit eutils db flag-o-matic java-pkg-opt-2 autotools multilib
8 #Number of official patches
9 #PATCHNO=`echo ${PV}|sed -e "s,\(.*_p\)\([0-9]*\),\2,"`
11 if [[ ${PATCHNO} == "${PV}" ]] ; then
16 MY_PV=${PV/_p${PATCHNO}}
20 S="${WORKDIR}/${MY_P}/build_unix"
21 DESCRIPTION="Oracle Berkeley DB"
22 HOMEPAGE="http://www.oracle.com/technetwork/database/database-technologies/berkeleydb/overview/index.html"
23 SRC_URI="http://download.oracle.com/berkeley-db/${MY_P}.tar.gz"
24 for (( i=1 ; i<=${PATCHNO} ; i++ )) ; do
25 export SRC_URI="${SRC_URI} http://www.oracle.com/technology/products/berkeley-db/db/update/${MY_PV}/patch.${MY_PV}.${i}"
30 KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~x86-fbsd"
31 IUSE="tcl java doc cxx rpc"
33 DEPEND="tcl? ( >=dev-lang/tcl-8.4 )
34 java? ( >=virtual/jdk-1.4 )"
35 RDEPEND="tcl? ( dev-lang/tcl )
36 java? ( >=virtual/jre-1.4 )"
39 unpack "${MY_P}".tar.gz
40 cd "${WORKDIR}"/"${MY_P}"
41 for (( i=1 ; i<=${PATCHNO} ; i++ ))
43 epatch "${DISTDIR}"/patch."${MY_PV}"."${i}"
45 epatch "${FILESDIR}"/"${PN}"-4.2.52_p2-TXN.patch
46 epatch "${FILESDIR}"/"${PN}"-"${SLOT}"-libtool.patch
48 # use the includes from the prefix
49 epatch "${FILESDIR}"/"${PN}"-"${SLOT}"-jni-check-prefix-first.patch
50 epatch "${FILESDIR}"/"${PN}"-"${SLOT}"-listen-to-java-options.patch
51 epatch "${FILESDIR}"/"${PN}"-4.0.14-fix-dep-link.patch
53 sed -e "/^DB_RELEASE_DATE=/s/%B %e, %Y/%Y-%m-%d/" -i dist/RELEASE
55 # Include the SLOT for Java JAR files
56 # This supersedes the unused jarlocation patches.
58 -e '/jarfile=.*\.jar$/s,(.jar$),-$(LIBVERSION)\1,g' \
59 "${S}"/../dist/Makefile.in
61 # START of 4.5+earlier specific
62 # Upstream sucks, they normally concat these
63 cd "${S}"/../dist/aclocal
64 for i in *; do ln -s $i ${i%.ac}.m4 ; done ;
65 cd "${S}"/../dist/aclocal_java
66 for i in *; do ln -s $i ${i%.ac}.m4 ; done ;
67 # END of 4.5+earlier specific
69 rm -f aclocal/libtool.{m4,ac} aclocal.m4
71 -e '/AC_PROG_LIBTOOL$/aLT_OUTPUT' \
74 -e '/^AC_PATH_TOOL/s/ sh, missing_sh/ bash, missing_sh/' \
76 AT_M4DIR="aclocal aclocal_java" eautoreconf
77 # Upstream sucks - they do autoconf and THEN replace the version variables.
80 -e "s/__EDIT_DB_VERSION_MAJOR__/$DB_VERSION_MAJOR/g" \
81 -e "s/__EDIT_DB_VERSION_MINOR__/$DB_VERSION_MINOR/g" \
82 -e "s/__EDIT_DB_VERSION_PATCH__/$DB_VERSION_PATCH/g" \
83 -e "s/__EDIT_DB_VERSION_STRING__/$DB_VERSION_STRING/g" \
84 -e "s/__EDIT_DB_VERSION_UNIQUE_NAME__/$DB_VERSION_UNIQUE_NAME/g" \
85 -e "s/__EDIT_DB_VERSION__/$DB_VERSION/g" configure
91 use amd64 && myconf="${myconf} --with-mutex=x86/gcc-assembly"
93 myconf="${myconf} $(use_enable cxx)"
96 && myconf="${myconf} --enable-tcl --with-tcl=${EPREFIX}/usr/$(get_libdir)" \
97 || myconf="${myconf} --disable-tcl"
99 myconf="${myconf} $(use_enable java)"
101 myconf="${myconf} --with-java-prefix=${JAVA_HOME}"
102 # Can't get this working any other way, since it returns spaces, and
103 # bash doesn't seem to want to pass correctly in any way i try
104 local javaconf="-with-javac-flags=$(java-pkg_javac-args)"
107 [[ -n ${CBUILD} ]] && myconf="${myconf} --build=${CBUILD}"
109 # the entire testsuite needs the TCL functionality
110 if use tcl && use test; then
111 myconf="${myconf} --enable-test"
113 myconf="${myconf} --disable-test"
116 cd "${S}" && ECONF_SOURCE="${S}"/../dist econf \
117 --prefix="${EPREFIX}"/usr \
118 --mandir="${EPREFIX}"/usr/share/man \
119 --infodir="${EPREFIX}"/usr/share/info \
120 --datadir="${EPREFIX}"/usr/share \
121 --sysconfdir="${EPREFIX}"/etc \
122 --localstatedir="${EPREFIX}"/var/lib \
123 --libdir="${EPREFIX}"/usr/"$(get_libdir)" \
128 ${myconf} "${javaconf}" || die "configure failed"
130 # This isn't safe for prefix (Darwin should be .jnilib), but I can't get the
131 # build system to behave itself, it generates libtool too late.
133 -e 's/-shrext $(SOFLAGS)/-shrext .so $(SOFLAGS)/g' \
135 emake || die "make failed"
139 einstall libdir="${ED}/usr/$(get_libdir)" strip="${ED}/bin/strip" || die
141 db_src_install_usrbinslot
143 db_src_install_headerslot
147 db_src_install_usrlibcleanup
150 # This file is not always built, and no longer exists as of db-4.8
151 [[ -f "${ED}"/usr/bin/berkeley_db_svc ]] && \
152 mv "${ED}"/usr/bin/berkeley_db_svc "${ED}"/usr/sbin/berkeley_db"${SLOT/./}"_svc
155 java-pkg_regso "${ED}"/usr/"$(get_libdir)"/libdb_java*.so
156 java-pkg_dojar "${ED}"/usr/"$(get_libdir)"/*.jar
157 rm -f "${ED}"/usr/"$(get_libdir)"/*.jar