logo

overlay

My own overlay for experimentations, use with caution, no support is provided git clone https://hacktivis.me/git/overlay.git

db-5.3.28-r3.ebuild (7227B)


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