1 # Copyright 1999-2015 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
7 inherit eutils db flag-o-matic java-pkg-opt-2 autotools multilib multilib-minimal
9 #Number of official patches
10 #PATCHNO=`echo ${PV}|sed -e "s,\(.*_p\)\([0-9]*\),\2,"`
12 if [[ ${PATCHNO} == "${PV}" ]] ; then
17 MY_PV=${PV/_p${PATCHNO}}
21 S="${WORKDIR}/${MY_P}/build_unix"
22 DESCRIPTION="Oracle Berkeley DB"
23 HOMEPAGE="http://www.oracle.com/technology/software/products/berkeley-db/index.html"
24 SRC_URI="http://download.oracle.com/berkeley-db/${MY_P}.tar.gz"
25 for (( i=1 ; i<=${PATCHNO} ; i++ )) ; do
26 export SRC_URI="${SRC_URI} http://www.oracle.com/technology/products/berkeley-db/db/update/${MY_PV}/patch.${MY_PV}.${i}"
31 KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd"
32 IUSE="doc java cxx tcl test"
34 # the entire testsuite needs the TCL functionality
35 DEPEND="tcl? ( >=dev-lang/tcl-8.5.15-r1:0[${MULTILIB_USEDEP}] )
36 test? ( >=dev-lang/tcl-8.5.15-r1:0[${MULTILIB_USEDEP}] )
37 java? ( >=virtual/jdk-1.5 )
38 >=sys-devel/binutils-2.16.1"
39 RDEPEND="tcl? ( >=dev-lang/tcl-8.5.15-r1:0[${MULTILIB_USEDEP}] )
40 java? ( >=virtual/jre-1.5 )
42 !<=app-emulation/emul-linux-x86-baselibs-20140508-r2
43 !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)]
47 unpack "${MY_P}".tar.gz
51 cd "${WORKDIR}"/"${MY_P}" || die
52 for (( i=1 ; i<=${PATCHNO} ; i++ ))
54 epatch "${DISTDIR}"/patch."${MY_PV}"."${i}"
56 epatch "${FILESDIR}"/${PN}-4.8-libtool.patch
57 epatch "${FILESDIR}"/${PN}-4.8.24-java-manifest-location.patch
58 epatch "${FILESDIR}"/${PN}-4.8.30-rename-atomic-compare-exchange.patch
60 # use the includes from the prefix
61 epatch "${FILESDIR}"/${PN}-4.6-jni-check-prefix-first.patch
62 epatch "${FILESDIR}"/${PN}-4.3-listen-to-java-options.patch
64 sed -e "/^DB_RELEASE_DATE=/s/%B %e, %Y/%Y-%m-%d/" -i dist/RELEASE \
67 # Include the SLOT for Java JAR files
68 # This supersedes the unused jarlocation patches.
70 -e '/jarfile=.*\.jar$/s,(.jar$),-$(LIBVERSION)\1,g' \
71 "${S}"/../dist/Makefile.in || die
73 cd "${S}"/../dist || die
74 rm -f aclocal/libtool.m4
76 -e '/AC_PROG_LIBTOOL$/aLT_OUTPUT' \
79 -e '/^AC_PATH_TOOL/s/ sh, none/ bash, none/' \
80 aclocal/programs.m4 || die
81 AT_M4DIR="aclocal aclocal_java" eautoreconf
82 # Upstream sucks - they do autoconf and THEN replace the version variables.
85 -e "s/__EDIT_DB_VERSION_MAJOR__/$DB_VERSION_MAJOR/g" \
86 -e "s/__EDIT_DB_VERSION_MINOR__/$DB_VERSION_MINOR/g" \
87 -e "s/__EDIT_DB_VERSION_PATCH__/$DB_VERSION_PATCH/g" \
88 -e "s/__EDIT_DB_VERSION_STRING__/$DB_VERSION_STRING/g" \
89 -e "s/__EDIT_DB_VERSION_UNIQUE_NAME__/$DB_VERSION_UNIQUE_NAME/g" \
90 -e "s/__EDIT_DB_VERSION__/$DB_VERSION/g" configure || die
94 # Add linker versions to the symbols. Easier to do, and safer than header file
96 if use userland_GNU ; then
97 append-ldflags -Wl,--default-symver
100 multilib-minimal_src_configure
103 multilib_src_configure() {
106 # compilation with -O0 fails on amd64, see bug #171231
107 if [[ ${ABI} == amd64 ]]; then
108 local CFLAGS=${CFLAGS} CXXFLAGS=${CXXFLAGS}
109 replace-flags -O0 -O2
110 is-flagq -O[s123] || append-flags -O2
113 # use `set` here since the java opts will contain whitespace
114 if multilib_is_native_abi && use java ; then
116 --with-java-prefix="${JAVA_HOME}"
117 --with-javac-flags="$(java-pkg_javac-args)"
121 # Bug #270851: test needs TCL support
122 if use tcl || use test ; then
125 --with-tcl=/usr/$(get_libdir)
128 myconf+=(--disable-tcl )
131 ECONF_SOURCE="${S}"/../dist \
136 --without-uniquename \
137 $([[ ${ABI} == arm ]] && echo --with-mutex=ARM/gcc-assembly) \
138 $([[ ${ABI} == amd64 ]] && echo --with-mutex=x86/gcc-assembly) \
140 $(use_enable cxx stl) \
141 $(multilib_native_use_enable java) \
146 multilib_src_test() {
147 multilib_is_native_abi || return
149 S=${BUILD_DIR} db_src_test
152 multilib_src_install() {
153 emake install DESTDIR="${D}"
155 db_src_install_headerslot
157 db_src_install_usrlibcleanup
159 if multilib_is_native_abi && use java; then
160 java-pkg_regso "${D}"/usr/"$(get_libdir)"/libdb_java*.so
161 java-pkg_dojar "${D}"/usr/"$(get_libdir)"/*.jar
162 rm -f "${D}"/usr/"$(get_libdir)"/*.jar
166 multilib_src_install_all() {
167 db_src_install_usrbinslot
172 # This file is not always built, and no longer exists as of db-4.8
173 if [[ -f "${D}"/usr/bin/berkeley_db_svc ]] ; then
174 mv "${D}"/usr/bin/berkeley_db_svc \
175 "${D}"/usr/sbin/berkeley_db"${SLOT/./}"_svc || die
180 multilib_foreach_abi db_fix_so
184 multilib_foreach_abi db_fix_so