db-4.5.20_p2-r1.ebuild 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  1. # Copyright 1999-2016 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. inherit eutils db flag-o-matic java-pkg-opt-2 autotools multilib
  4. #Number of official patches
  5. #PATCHNO=`echo ${PV}|sed -e "s,\(.*_p\)\([0-9]*\),\2,"`
  6. PATCHNO=${PV/*.*.*_p}
  7. if [[ ${PATCHNO} == "${PV}" ]] ; then
  8. MY_PV=${PV}
  9. MY_P=${P}
  10. PATCHNO=0
  11. else
  12. MY_PV=${PV/_p${PATCHNO}}
  13. MY_P=${PN}-${MY_PV}
  14. fi
  15. S="${WORKDIR}/${MY_P}/build_unix"
  16. DESCRIPTION="Oracle Berkeley DB"
  17. HOMEPAGE="http://www.oracle.com/technetwork/database/database-technologies/berkeleydb/overview/index.html"
  18. SRC_URI="http://download.oracle.com/berkeley-db/${MY_P}.tar.gz"
  19. for (( i=1 ; i<=${PATCHNO} ; i++ )) ; do
  20. export SRC_URI="${SRC_URI} http://www.oracle.com/technology/products/berkeley-db/db/update/${MY_PV}/patch.${MY_PV}.${i}"
  21. done
  22. LICENSE="Sleepycat"
  23. SLOT="4.5"
  24. KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~sparc-fbsd ~x86-fbsd"
  25. IUSE="tcl java doc cxx rpc"
  26. DEPEND="tcl? ( >=dev-lang/tcl-8.4 )
  27. java? ( >=virtual/jdk-1.4 )
  28. >=sys-devel/binutils-2.16.1"
  29. RDEPEND="tcl? ( dev-lang/tcl )
  30. java? ( >=virtual/jre-1.4 )"
  31. src_unpack() {
  32. unpack "${MY_P}".tar.gz
  33. cd "${WORKDIR}"/"${MY_P}"
  34. for (( i=1 ; i<=${PATCHNO} ; i++ ))
  35. do
  36. epatch "${DISTDIR}"/patch."${MY_PV}"."${i}"
  37. done
  38. epatch "${FILESDIR}"/"${PN}"-"${SLOT}"-libtool.patch
  39. # use the includes from the prefix
  40. epatch "${FILESDIR}"/"${PN}"-4.3-jni-check-prefix-first.patch
  41. epatch "${FILESDIR}"/"${PN}"-4.3-listen-to-java-options.patch
  42. sed -e "/^DB_RELEASE_DATE=/s/%B %e, %Y/%Y-%m-%d/" -i dist/RELEASE
  43. # Include the SLOT for Java JAR files
  44. # This supersedes the unused jarlocation patches.
  45. sed -r -i \
  46. -e '/jarfile=.*\.jar$/s,(.jar$),-$(LIBVERSION)\1,g' \
  47. "${S}"/../dist/Makefile.in
  48. # START of 4.5+earlier specific
  49. # Upstream sucks, they normally concat these
  50. cd "${S}"/../dist/aclocal
  51. for i in *; do ln -s $i ${i%.ac}.m4 ; done ;
  52. cd "${S}"/../dist/aclocal_java
  53. for i in *; do ln -s $i ${i%.ac}.m4 ; done ;
  54. # END of 4.5+earlier specific
  55. cd "${S}"/../dist
  56. rm -f aclocal/libtool.{m4,ac} aclocal.m4
  57. sed -i \
  58. -e '/AC_PROG_LIBTOOL$/aLT_OUTPUT' \
  59. configure.ac
  60. sed -i \
  61. -e '/^AC_PATH_TOOL/s/ sh, none/ bash, none/' \
  62. aclocal/programs.m4
  63. AT_M4DIR="aclocal aclocal_java" eautoreconf
  64. # Upstream sucks - they do autoconf and THEN replace the version variables.
  65. . ./RELEASE
  66. sed -i \
  67. -e "s/__EDIT_DB_VERSION_MAJOR__/$DB_VERSION_MAJOR/g" \
  68. -e "s/__EDIT_DB_VERSION_MINOR__/$DB_VERSION_MINOR/g" \
  69. -e "s/__EDIT_DB_VERSION_PATCH__/$DB_VERSION_PATCH/g" \
  70. -e "s/__EDIT_DB_VERSION_STRING__/$DB_VERSION_STRING/g" \
  71. -e "s/__EDIT_DB_VERSION_UNIQUE_NAME__/$DB_VERSION_UNIQUE_NAME/g" \
  72. -e "s/__EDIT_DB_VERSION__/$DB_VERSION/g" configure
  73. }
  74. src_compile() {
  75. # compilation with -O0 fails on amd64, see bug #171231
  76. if use amd64; then
  77. replace-flags -O0 -O2
  78. is-flagq -O[s123] || append-flags -O2
  79. fi
  80. local myconf=""
  81. use amd64 && myconf="${myconf} --with-mutex=x86/gcc-assembly"
  82. myconf="${myconf} $(use_enable cxx)"
  83. use tcl \
  84. && myconf="${myconf} --enable-tcl --with-tcl=${EPREFIX}/usr/$(get_libdir)" \
  85. || myconf="${myconf} --disable-tcl"
  86. myconf="${myconf} $(use_enable java)"
  87. if use java; then
  88. myconf="${myconf} --with-java-prefix=${JAVA_HOME}"
  89. # Can't get this working any other way, since it returns spaces, and
  90. # bash doesn't seem to want to pass correctly in any way i try
  91. local javaconf="-with-javac-flags=$(java-pkg_javac-args)"
  92. fi
  93. [[ -n ${CBUILD} ]] && myconf="${myconf} --build=${CBUILD}"
  94. # the entire testsuite needs the TCL functionality
  95. if use tcl && use test ; then
  96. myconf="${myconf} --enable-test"
  97. else
  98. myconf="${myconf} --disable-test"
  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. cd "${S}" && ECONF_SOURCE="${S}"/../dist econf \
  106. --prefix="${EPREFIX}"/usr \
  107. --mandir="${EPREFIX}"/usr/share/man \
  108. --infodir="${EPREFIX}"/usr/share/info \
  109. --datadir="${EPREFIX}"/usr/share \
  110. --sysconfdir="${EPREFIX}"/etc \
  111. --localstatedir="${EPREFIX}"/var/lib \
  112. --libdir="${EPREFIX}"/usr/"$(get_libdir)" \
  113. --enable-compat185 \
  114. --enable-o_direct \
  115. --without-uniquename \
  116. $(use_enable rpc) \
  117. --host="${CHOST}" \
  118. ${myconf} "${javaconf}" || die "configure failed"
  119. sed -e "s,\(^STRIP *=\).*,\1\"true\"," Makefile > Makefile.cpy \
  120. && mv Makefile.cpy Makefile
  121. emake || die "make failed"
  122. }
  123. src_install() {
  124. einstall libdir="${ED}/usr/$(get_libdir)" STRIP="true" || die
  125. db_src_install_usrbinslot
  126. db_src_install_headerslot
  127. db_src_install_doc
  128. db_src_install_usrlibcleanup
  129. dodir /usr/sbin
  130. # This file is not always built, and no longer exists as of db-4.8
  131. [[ -f "${ED}"/usr/bin/berkeley_db_svc ]] && \
  132. mv "${ED}"/usr/bin/berkeley_db_svc "${ED}"/usr/sbin/berkeley_db"${SLOT/./}"_svc
  133. if use java; then
  134. java-pkg_regso "${ED}"/usr/"$(get_libdir)"/libdb_java*.so
  135. java-pkg_dojar "${ED}"/usr/"$(get_libdir)"/*.jar
  136. rm -f "${ED}"/usr/"$(get_libdir)"/*.jar
  137. fi
  138. }
  139. pkg_postinst() {
  140. db_fix_so
  141. }
  142. pkg_postrm() {
  143. db_fix_so
  144. }