db-6.2.23.ebuild 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236
  1. # Copyright 1999-2016 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI=5
  4. inherit eutils db flag-o-matic java-pkg-opt-2 autotools multilib multilib-minimal versionator toolchain-funcs
  5. #Number of official patches
  6. #PATCHNO=`echo ${PV}|sed -e "s,\(.*_p\)\([0-9]*\),\2,"`
  7. PATCHNO=${PV/*.*.*_p}
  8. if [[ ${PATCHNO} == "${PV}" ]] ; then
  9. MY_PV=${PV}
  10. MY_P=${P}
  11. PATCHNO=0
  12. else
  13. MY_PV=${PV/_p${PATCHNO}}
  14. MY_P=${PN}-${MY_PV}
  15. fi
  16. S_BASE="${WORKDIR}/${MY_P}"
  17. S="${S_BASE}/build_unix"
  18. DESCRIPTION="Oracle Berkeley DB"
  19. HOMEPAGE="http://www.oracle.com/technetwork/database/database-technologies/berkeleydb/overview/index.html"
  20. SRC_URI="http://download.oracle.com/berkeley-db/${MY_P}.tar.gz"
  21. for (( i=1 ; i<=${PATCHNO} ; i++ )) ; do
  22. export SRC_URI="${SRC_URI} http://www.oracle.com/technology/products/berkeley-db/db/update/${MY_PV}/patch.${MY_PV}.${i}"
  23. done
  24. LICENSE="AGPL-3"
  25. SLOT="$(get_version_component_range 1-2)"
  26. KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~sparc-fbsd ~x86-fbsd"
  27. IUSE="doc java cxx tcl test"
  28. REQUIRED_USE="test? ( tcl )"
  29. # the entire testsuite needs the TCL functionality
  30. DEPEND="tcl? ( >=dev-lang/tcl-8.5.15-r1:0=[${MULTILIB_USEDEP}] )
  31. test? ( >=dev-lang/tcl-8.5.15-r1:0=[${MULTILIB_USEDEP}] )
  32. java? ( >=virtual/jdk-1.5 )
  33. >=sys-devel/binutils-2.16.1"
  34. RDEPEND="tcl? ( >=dev-lang/tcl-8.5.15-r1:0=[${MULTILIB_USEDEP}] )
  35. java? ( >=virtual/jre-1.5 )"
  36. MULTILIB_WRAPPED_HEADERS=(
  37. /usr/include/db$(get_version_component_range 1-2)/db.h
  38. )
  39. PATCHES=(
  40. # bug #510506
  41. "${FILESDIR}"/${PN}-4.8.24-java-manifest-location.patch
  42. # use the includes from the prefix
  43. "${FILESDIR}"/${PN}-6.2-jni-check-prefix-first.patch
  44. "${FILESDIR}"/${PN}-4.3-listen-to-java-options.patch
  45. # sqlite configure call has an extra leading ..
  46. # upstreamed:5.2.36, missing in 5.3.x/6.x
  47. # still needs to be patched in 6.0.20
  48. "${FILESDIR}"/${PN}-6.1.19-sqlite-configure-path.patch
  49. # The upstream testsuite copies .lib and the binaries for each parallel test
  50. # core, ~300MB each. This patch uses links instead, saves a lot of space.
  51. "${FILESDIR}"/${PN}-6.0.20-test-link.patch
  52. )
  53. src_prepare() {
  54. cd "${WORKDIR}"/"${MY_P}"
  55. for (( i=1 ; i<=${PATCHNO} ; i++ ))
  56. do
  57. epatch "${DISTDIR}"/patch."${MY_PV}"."${i}"
  58. done
  59. epatch "${PATCHES[@]}"
  60. epatch_user
  61. # Upstream release script grabs the dates when the script was run, so lets
  62. # end-run them to keep the date the same.
  63. export REAL_DB_RELEASE_DATE="$(awk \
  64. '/^DB_VERSION_STRING=/{ gsub(".*\\(|\\).*","",$0); print $0; }' \
  65. "${S_BASE}"/dist/configure)"
  66. sed -r -i \
  67. -e "/^DB_RELEASE_DATE=/s~=.*~='${REAL_DB_RELEASE_DATE}'~g" \
  68. "${S_BASE}"/dist/RELEASE || die
  69. # Include the SLOT for Java JAR files
  70. # This supersedes the unused jarlocation patches.
  71. sed -r -i \
  72. -e '/jarfile=.*\.jar$/s,(.jar$),-$(LIBVERSION)\1,g' \
  73. "${S_BASE}"/dist/Makefile.in || die
  74. cd "${S_BASE}"/dist || die
  75. rm -f aclocal/libtool.m4
  76. sed -i \
  77. -e '/AC_PROG_LIBTOOL$/aLT_OUTPUT' \
  78. configure.ac || die
  79. sed -i \
  80. -e '/^AC_PATH_TOOL/s/ sh, none/ bash, none/' \
  81. aclocal/programs.m4 || die
  82. AT_M4DIR="aclocal aclocal_java" eautoreconf
  83. # Upstream sucks - they do autoconf and THEN replace the version variables.
  84. . ./RELEASE
  85. for v in \
  86. DB_VERSION_{FAMILY,LETTER,RELEASE,MAJOR,MINOR} \
  87. DB_VERSION_{PATCH,FULL,UNIQUE_NAME,STRING,FULL_STRING} \
  88. DB_VERSION \
  89. DB_RELEASE_DATE ; do
  90. local ev="__EDIT_${v}__"
  91. sed -i -e "s/${ev}/${!v}/g" configure || die
  92. done
  93. }
  94. multilib_src_configure() {
  95. local myconf=()
  96. tc-ld-disable-gold #470634
  97. # compilation with -O0 fails on amd64, see bug #171231
  98. if [[ ${ABI} == amd64 ]]; then
  99. local CFLAGS=${CFLAGS} CXXFLAGS=${CXXFLAGS}
  100. replace-flags -O0 -O2
  101. is-flagq -O[s123] || append-flags -O2
  102. fi
  103. # Add linker versions to the symbols. Easier to do, and safer than header file
  104. # mumbo jumbo.
  105. if use userland_GNU ; then
  106. append-ldflags -Wl,--default-symver
  107. fi
  108. # use `set` here since the java opts will contain whitespace
  109. if multilib_is_native_abi && use java ; then
  110. myconf+=(
  111. --with-java-prefix="${JAVA_HOME}"
  112. --with-javac-flags="$(java-pkg_javac-args)"
  113. )
  114. fi
  115. # Bug #270851: test needs TCL support
  116. if use tcl || use test ; then
  117. myconf+=(
  118. --enable-tcl
  119. --with-tcl="${EPREFIX}/usr/$(get_libdir)"
  120. )
  121. else
  122. myconf+=(--disable-tcl )
  123. fi
  124. # sql_compat will cause a collision with sqlite3
  125. # --enable-sql_compat
  126. ECONF_SOURCE="${S_BASE}"/dist \
  127. STRIP="true" \
  128. econf \
  129. --enable-compat185 \
  130. --enable-dbm \
  131. --enable-o_direct \
  132. --without-uniquename \
  133. --enable-sql \
  134. --enable-sql_codegen \
  135. --disable-sql_compat \
  136. $([[ ${ABI} == arm ]] && echo --with-mutex=ARM/gcc-assembly) \
  137. $([[ ${ABI} == amd64 ]] && echo --with-mutex=x86/gcc-assembly) \
  138. $(use_enable cxx) \
  139. $(use_enable cxx stl) \
  140. $(multilib_native_use_enable java) \
  141. "${myconf[@]}" \
  142. $(use_enable test)
  143. }
  144. multilib_src_install() {
  145. emake install DESTDIR="${D}"
  146. db_src_install_headerslot
  147. db_src_install_usrlibcleanup
  148. if multilib_is_native_abi && use java; then
  149. java-pkg_regso "${ED}"/usr/"$(get_libdir)"/libdb_java*.so
  150. java-pkg_dojar "${ED}"/usr/"$(get_libdir)"/*.jar
  151. rm -f "${ED}"/usr/"$(get_libdir)"/*.jar
  152. fi
  153. }
  154. multilib_src_install_all() {
  155. db_src_install_usrbinslot
  156. db_src_install_doc
  157. dodir /usr/sbin
  158. # This file is not always built, and no longer exists as of db-4.8
  159. if [[ -f "${ED}"/usr/bin/berkeley_db_svc ]] ; then
  160. mv "${ED}"/usr/bin/berkeley_db_svc \
  161. "${ED}"/usr/sbin/berkeley_db"${SLOT/./}"_svc || die
  162. fi
  163. }
  164. pkg_postinst() {
  165. multilib_foreach_abi db_fix_so
  166. }
  167. pkg_postrm() {
  168. multilib_foreach_abi db_fix_so
  169. }
  170. src_test() {
  171. # db_repsite is impossible to build, as upstream strips those sources.
  172. # db_repsite is used directly in the setup_site_prog,
  173. # setup_site_prog is called from open_site_prog
  174. # which is called only from tests in the multi_repmgr group.
  175. #sed -ri \
  176. # -e '/set subs/s,multi_repmgr,,g' \
  177. # "${S_BASE}/test/testparams.tcl"
  178. sed -ri \
  179. -e '/multi_repmgr/d' \
  180. "${S_BASE}/test/tcl/test.tcl" || die
  181. # This is the only failure in 5.2.28 so far, and looks like a false positive.
  182. # Repmgr018 (btree): Test of repmgr stats.
  183. # Repmgr018.a: Start a master.
  184. # Repmgr018.b: Start a client.
  185. # Repmgr018.c: Run some transactions at master.
  186. # Rep_test: btree 20 key/data pairs starting at 0
  187. # Rep_test.a: put/get loop
  188. # FAIL:07:05:59 (00:00:00) perm_no_failed_stat: expected 0, got 1
  189. sed -ri \
  190. -e '/set parms.*repmgr018/d' \
  191. -e 's/repmgr018//g' \
  192. "${S_BASE}/test/tcl/test.tcl" || die
  193. multilib-minimal_src_test
  194. }
  195. multilib_src_test() {
  196. multilib_is_native_abi || return
  197. S=${BUILD_DIR} db_src_test
  198. }