1 # Copyright 1999-2014 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
5 inherit eutils db flag-o-matic java-pkg-opt-2 autotools multilib
7 #Number of official patches
8 #PATCHNO=`echo ${PV}|sed -e "s,\(.*_p\)\([0-9]*\),\2,"`
10 if [[ ${PATCHNO} == "${PV}" ]] ; then
15 MY_PV=${PV/_p${PATCHNO}}
19 S="${WORKDIR}/${MY_P}/build_unix"
20 DESCRIPTION="Oracle Berkeley DB"
21 HOMEPAGE="http://www.oracle.com/technology/software/products/berkeley-db/index.html"
22 SRC_URI="http://download.oracle.com/berkeley-db/${MY_P}.tar.gz"
23 for (( i=1 ; i<=${PATCHNO} ; i++ )) ; do
24 export SRC_URI="${SRC_URI} http://www.oracle.com/technology/products/berkeley-db/db/update/${MY_PV}/patch.${MY_PV}.${i}"
29 KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ppc ppc64 s390 sh sparc x86 ~sparc-fbsd ~x86-fbsd"
30 IUSE="doc java cxx tcl test rpc"
32 # the entire testsuite needs the TCL functionality
33 DEPEND="tcl? ( >=dev-lang/tcl-8.4 )
34 test? ( >=dev-lang/tcl-8.4 )
35 java? ( >=virtual/jdk-1.5 )
36 >=sys-devel/binutils-2.16.1"
37 RDEPEND="tcl? ( dev-lang/tcl )
38 java? ( >=virtual/jre-1.5 )"
41 unpack "${MY_P}".tar.gz
42 cd "${WORKDIR}"/"${MY_P}"
43 for (( i=1 ; i<=${PATCHNO} ; i++ ))
45 epatch "${DISTDIR}"/patch."${MY_PV}"."${i}"
47 epatch "${FILESDIR}"/"${PN}"-4.6-libtool.patch
49 # use the includes from the prefix
50 epatch "${FILESDIR}"/"${PN}"-4.6-jni-check-prefix-first.patch
51 epatch "${FILESDIR}"/"${PN}"-4.3-listen-to-java-options.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
62 rm -f aclocal/libtool.m4
64 -e '/AC_PROG_LIBTOOL$/aLT_OUTPUT' \
67 -e '/^AC_PATH_TOOL/s/ sh, none/ bash, none/' \
69 AT_M4DIR="aclocal aclocal_java" eautoreconf
70 # Upstream sucks - they do autoconf and THEN replace the version variables.
73 -e "s/__EDIT_DB_VERSION_MAJOR__/$DB_VERSION_MAJOR/g" \
74 -e "s/__EDIT_DB_VERSION_MINOR__/$DB_VERSION_MINOR/g" \
75 -e "s/__EDIT_DB_VERSION_PATCH__/$DB_VERSION_PATCH/g" \
76 -e "s/__EDIT_DB_VERSION_STRING__/$DB_VERSION_STRING/g" \
77 -e "s/__EDIT_DB_VERSION_UNIQUE_NAME__/$DB_VERSION_UNIQUE_NAME/g" \
78 -e "s/__EDIT_DB_VERSION__/$DB_VERSION/g" configure
84 # compilation with -O0 fails on amd64, see bug #171231
87 is-flagq -O[s123] || append-flags -O2
90 # use `set` here since the java opts will contain whitespace
94 --with-java-prefix="${JAVA_HOME}" \
95 --with-javac-flags="$(java-pkg_javac-args)"
98 # Add linker versions to the symbols. Easier to do, and safer than header file
100 if use userland_GNU ; then
101 append-ldflags -Wl,--default-symver
104 # Bug #270851: test needs TCL support
105 if use tcl || use test ; then
106 myconf="${myconf} --enable-tcl"
107 myconf="${myconf} --with-tcl=/usr/$(get_libdir)"
109 myconf="${myconf} --disable-tcl"
113 ECONF_SOURCE="${S}"/../dist \
118 --without-uniquename \
120 $(use arm && echo --with-mutex=ARM/gcc-assembly) \
121 $(use amd64 && echo --with-mutex=x86/gcc-assembly) \
128 emake || die "make failed"
132 emake install DESTDIR="${D}" || die
134 db_src_install_usrbinslot
136 db_src_install_headerslot
140 db_src_install_usrlibcleanup
143 # This file is not always built, and no longer exists as of db-4.8
144 [[ -f "${D}"/usr/bin/berkeley_db_svc ]] && \
145 mv "${D}"/usr/bin/berkeley_db_svc "${D}"/usr/sbin/berkeley_db"${SLOT/./}"_svc
148 java-pkg_regso "${D}"/usr/"$(get_libdir)"/libdb_java*.so
149 java-pkg_dojar "${D}"/usr/"$(get_libdir)"/*.jar
150 rm -f "${D}"/usr/"$(get_libdir)"/*.jar