db-4.8.30-r2.ebuild 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  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 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="${WORKDIR}/${MY_P}/build_unix"
  17. DESCRIPTION="Oracle Berkeley DB"
  18. HOMEPAGE="http://www.oracle.com/technetwork/database/database-technologies/berkeleydb/overview/index.html"
  19. SRC_URI="http://download.oracle.com/berkeley-db/${MY_P}.tar.gz"
  20. for (( i=1 ; i<=${PATCHNO} ; i++ )) ; do
  21. export SRC_URI="${SRC_URI} http://www.oracle.com/technology/products/berkeley-db/db/update/${MY_PV}/patch.${MY_PV}.${i}"
  22. done
  23. LICENSE="Sleepycat"
  24. SLOT="4.8"
  25. KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd"
  26. IUSE="doc java cxx tcl test"
  27. REQUIRED_USE="test? ( tcl )"
  28. # the entire testsuite needs the TCL functionality
  29. DEPEND="tcl? ( >=dev-lang/tcl-8.5.15-r1:0=[${MULTILIB_USEDEP}] )
  30. test? ( >=dev-lang/tcl-8.5.15-r1:0=[${MULTILIB_USEDEP}] )
  31. java? ( >=virtual/jdk-1.5 )
  32. >=sys-devel/binutils-2.16.1"
  33. RDEPEND="tcl? ( >=dev-lang/tcl-8.5.15-r1:0=[${MULTILIB_USEDEP}] )
  34. java? ( >=virtual/jre-1.5 )
  35. abi_x86_32? (
  36. !<=app-emulation/emul-linux-x86-baselibs-20140508-r2
  37. !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)]
  38. )"
  39. src_prepare() {
  40. cd "${WORKDIR}"/"${MY_P}" || die
  41. for (( i=1 ; i<=${PATCHNO} ; i++ ))
  42. do
  43. epatch "${DISTDIR}"/patch."${MY_PV}"."${i}"
  44. done
  45. epatch "${FILESDIR}"/${PN}-4.8-libtool.patch
  46. epatch "${FILESDIR}"/${PN}-4.8.24-java-manifest-location.patch
  47. epatch "${FILESDIR}"/${PN}-4.8.30-rename-atomic-compare-exchange.patch
  48. # use the includes from the prefix
  49. epatch "${FILESDIR}"/${PN}-4.6-jni-check-prefix-first.patch
  50. epatch "${FILESDIR}"/${PN}-4.3-listen-to-java-options.patch
  51. sed -e "/^DB_RELEASE_DATE=/s/%B %e, %Y/%Y-%m-%d/" -i dist/RELEASE \
  52. || die
  53. # Include the SLOT for Java JAR files
  54. # This supersedes the unused jarlocation patches.
  55. sed -r -i \
  56. -e '/jarfile=.*\.jar$/s,(.jar$),-$(LIBVERSION)\1,g' \
  57. "${S}"/../dist/Makefile.in || die
  58. cd "${S}"/../dist || die
  59. rm -f aclocal/libtool.m4
  60. sed -i \
  61. -e '/AC_PROG_LIBTOOL$/aLT_OUTPUT' \
  62. configure.ac || die
  63. sed -i \
  64. -e '/^AC_PATH_TOOL/s/ sh, none/ bash, none/' \
  65. aclocal/programs.m4 || die
  66. AT_M4DIR="aclocal aclocal_java" eautoreconf
  67. # Upstream sucks - they do autoconf and THEN replace the version variables.
  68. . ./RELEASE
  69. sed -i \
  70. -e "s/__EDIT_DB_VERSION_MAJOR__/$DB_VERSION_MAJOR/g" \
  71. -e "s/__EDIT_DB_VERSION_MINOR__/$DB_VERSION_MINOR/g" \
  72. -e "s/__EDIT_DB_VERSION_PATCH__/$DB_VERSION_PATCH/g" \
  73. -e "s/__EDIT_DB_VERSION_STRING__/$DB_VERSION_STRING/g" \
  74. -e "s/__EDIT_DB_VERSION_UNIQUE_NAME__/$DB_VERSION_UNIQUE_NAME/g" \
  75. -e "s/__EDIT_DB_VERSION__/$DB_VERSION/g" configure || die
  76. }
  77. multilib_src_configure() {
  78. local myconf=()
  79. tc-ld-disable-gold #470634
  80. # compilation with -O0 fails on amd64, see bug #171231
  81. if [[ ${ABI} == amd64 ]]; then
  82. local CFLAGS=${CFLAGS} CXXFLAGS=${CXXFLAGS}
  83. replace-flags -O0 -O2
  84. is-flagq -O[s123] || append-flags -O2
  85. fi
  86. # Add linker versions to the symbols. Easier to do, and safer than header file
  87. # mumbo jumbo.
  88. if use userland_GNU ; then
  89. append-ldflags -Wl,--default-symver
  90. fi
  91. # use `set` here since the java opts will contain whitespace
  92. if multilib_is_native_abi && use java ; then
  93. myconf+=(
  94. --with-java-prefix="${JAVA_HOME}"
  95. --with-javac-flags="$(java-pkg_javac-args)"
  96. )
  97. fi
  98. # Bug #270851: test needs TCL support
  99. if use tcl || use test ; then
  100. myconf+=(
  101. --enable-tcl
  102. --with-tcl="${EPREFIX}/usr/$(get_libdir)"
  103. )
  104. else
  105. myconf+=(--disable-tcl )
  106. fi
  107. ECONF_SOURCE="${S}"/../dist \
  108. STRIP="true" \
  109. econf \
  110. --enable-compat185 \
  111. --enable-o_direct \
  112. --without-uniquename \
  113. $([[ ${ABI} == arm ]] && echo --with-mutex=ARM/gcc-assembly) \
  114. $([[ ${ABI} == amd64 ]] && echo --with-mutex=x86/gcc-assembly) \
  115. $(use_enable cxx) \
  116. $(use_enable cxx stl) \
  117. $(multilib_native_use_enable java) \
  118. "${myconf[@]}" \
  119. $(use_enable test)
  120. }
  121. multilib_src_test() {
  122. multilib_is_native_abi || return
  123. S=${BUILD_DIR} db_src_test
  124. }
  125. multilib_src_install() {
  126. emake install DESTDIR="${D}"
  127. db_src_install_headerslot
  128. db_src_install_usrlibcleanup
  129. if multilib_is_native_abi && use java; then
  130. java-pkg_regso "${ED}"/usr/"$(get_libdir)"/libdb_java*.so
  131. java-pkg_dojar "${ED}"/usr/"$(get_libdir)"/*.jar
  132. rm -f "${ED}"/usr/"$(get_libdir)"/*.jar
  133. fi
  134. }
  135. multilib_src_install_all() {
  136. db_src_install_usrbinslot
  137. db_src_install_doc
  138. dodir /usr/sbin
  139. # This file is not always built, and no longer exists as of db-4.8
  140. if [[ -f "${ED}"/usr/bin/berkeley_db_svc ]] ; then
  141. mv "${ED}"/usr/bin/berkeley_db_svc \
  142. "${ED}"/usr/sbin/berkeley_db"${SLOT/./}"_svc || die
  143. fi
  144. }
  145. pkg_postinst() {
  146. multilib_foreach_abi db_fix_so
  147. }
  148. pkg_postrm() {
  149. multilib_foreach_abi db_fix_so
  150. }