db-5.1.29-r1.ebuild 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  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 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="Sleepycat"
  25. SLOT="5.1"
  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.4:0 )
  31. test? ( >=dev-lang/tcl-8.4:0 )
  32. java? ( >=virtual/jdk-1.5 )
  33. >=sys-devel/binutils-2.16.1"
  34. RDEPEND="tcl? ( dev-lang/tcl:0 )
  35. java? ( >=virtual/jre-1.5 )"
  36. src_prepare() {
  37. cd "${WORKDIR}"/"${MY_P}"
  38. for (( i=1 ; i<=${PATCHNO} ; i++ ))
  39. do
  40. epatch "${DISTDIR}"/patch."${MY_PV}"."${i}"
  41. done
  42. epatch "${FILESDIR}"/${PN}-4.8-libtool.patch
  43. epatch "${FILESDIR}"/${PN}-4.8.24-java-manifest-location.patch
  44. # use the includes from the prefix
  45. epatch "${FILESDIR}"/${PN}-4.6-jni-check-prefix-first.patch
  46. epatch "${FILESDIR}"/${PN}-4.3-listen-to-java-options.patch
  47. # upstream autoconf fails to build DBM when it's supposed to
  48. # merged upstream in 5.0.26
  49. #epatch "${FILESDIR}"/${PN}-5.0.21-enable-dbm-autoconf.patch
  50. # Needed when compiling with clang
  51. epatch "${FILESDIR}"/${P}-rename-atomic-compare-exchange.patch
  52. # Upstream release script grabs the dates when the script was run, so lets
  53. # end-run them to keep the date the same.
  54. export REAL_DB_RELEASE_DATE="$(awk \
  55. '/^DB_VERSION_STRING=/{ gsub(".*\\(|\\).*","",$0); print $0; }' \
  56. "${S_BASE}"/dist/configure)"
  57. sed -r -i \
  58. -e "/^DB_RELEASE_DATE=/s~=.*~='${REAL_DB_RELEASE_DATE}'~g" \
  59. "${S_BASE}"/dist/RELEASE
  60. # Include the SLOT for Java JAR files
  61. # This supersedes the unused jarlocation patches.
  62. sed -r -i \
  63. -e '/jarfile=.*\.jar$/s,(.jar$),-$(LIBVERSION)\1,g' \
  64. "${S_BASE}"/dist/Makefile.in
  65. cd "${S_BASE}"/dist
  66. rm -f aclocal/libtool.m4
  67. sed -i \
  68. -e '/AC_PROG_LIBTOOL$/aLT_OUTPUT' \
  69. configure.ac
  70. sed -i \
  71. -e '/^AC_PATH_TOOL/s/ sh, none/ bash, none/' \
  72. aclocal/programs.m4
  73. AT_M4DIR="aclocal aclocal_java" eautoreconf
  74. # Upstream sucks - they do autoconf and THEN replace the version variables.
  75. . ./RELEASE
  76. for v in \
  77. DB_VERSION_{FAMILY,LETTER,RELEASE,MAJOR,MINOR} \
  78. DB_VERSION_{PATCH,FULL,UNIQUE_NAME,STRING,FULL_STRING} \
  79. DB_VERSION \
  80. DB_RELEASE_DATE ; do
  81. local ev="__EDIT_${v}__"
  82. sed -i -e "s/${ev}/${!v}/g" configure
  83. done
  84. }
  85. src_configure() {
  86. local myconf=''
  87. tc-ld-disable-gold #470634
  88. # compilation with -O0 fails on amd64, see bug #171231
  89. if use amd64; then
  90. replace-flags -O0 -O2
  91. is-flagq -O[s123] || append-flags -O2
  92. fi
  93. # use `set` here since the java opts will contain whitespace
  94. set --
  95. if use java ; then
  96. set -- "$@" \
  97. --with-java-prefix="${JAVA_HOME}" \
  98. --with-javac-flags="$(java-pkg_javac-args)"
  99. fi
  100. # Add linker versions to the symbols. Easier to do, and safer than header file
  101. # mumbo jumbo.
  102. if use userland_GNU ; then
  103. append-ldflags -Wl,--default-symver
  104. fi
  105. # Bug #270851: test needs TCL support
  106. if use tcl || use test ; then
  107. myconf="${myconf} --enable-tcl"
  108. myconf="${myconf} --with-tcl=${EPREFIX}/usr/$(get_libdir)"
  109. else
  110. myconf="${myconf} --disable-tcl"
  111. fi
  112. # sql_compat will cause a collision with sqlite3
  113. # --enable-sql_compat
  114. cd "${S}"
  115. ECONF_SOURCE="${S_BASE}"/dist \
  116. STRIP="true" \
  117. econf \
  118. --enable-compat185 \
  119. --enable-dbm \
  120. --enable-o_direct \
  121. --without-uniquename \
  122. --enable-sql \
  123. --enable-sql_codegen \
  124. --disable-sql_compat \
  125. $(use arm && echo --with-mutex=ARM/gcc-assembly) \
  126. $(use amd64 && echo --with-mutex=x86/gcc-assembly) \
  127. $(use_enable cxx) \
  128. $(use_enable cxx stl) \
  129. $(use_enable java) \
  130. ${myconf} \
  131. $(use_enable test) \
  132. "$@"
  133. }
  134. src_compile() {
  135. emake || die "make failed"
  136. }
  137. src_install() {
  138. emake install DESTDIR="${D}" || die
  139. db_src_install_usrbinslot
  140. db_src_install_headerslot
  141. db_src_install_doc
  142. db_src_install_usrlibcleanup
  143. dodir /usr/sbin
  144. # This file is not always built, and no longer exists as of db-4.8
  145. [[ -f "${ED}"/usr/bin/berkeley_db_svc ]] && \
  146. mv "${ED}"/usr/bin/berkeley_db_svc "${ED}"/usr/sbin/berkeley_db"${SLOT/./}"_svc
  147. if use java; then
  148. java-pkg_regso "${ED}"/usr/"$(get_libdir)"/libdb_java*.so
  149. java-pkg_dojar "${ED}"/usr/"$(get_libdir)"/*.jar
  150. rm -f "${ED}"/usr/"$(get_libdir)"/*.jar
  151. fi
  152. }
  153. pkg_postinst() {
  154. db_fix_so
  155. }
  156. pkg_postrm() {
  157. db_fix_so
  158. }
  159. src_test() {
  160. # db_repsite is impossible to build, as upstream strips those sources.
  161. # db_repsite is used directly in the setup_site_prog,
  162. # setup_site_prog is called from open_site_prog
  163. # which is called only from tests in the multi_repmgr group.
  164. #sed -ri \
  165. # -e '/set subs/s,multi_repmgr,,g' \
  166. # "${S_BASE}/test/testparams.tcl"
  167. sed -ri \
  168. -e '/multi_repmgr/d' \
  169. "${S_BASE}/test/tcl/test.tcl"
  170. db_src_test
  171. }