db-4.7.25_p4.ebuild 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  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.7"
  24. KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ppc ppc64 s390 sh sparc x86 ~sparc-fbsd ~x86-fbsd"
  25. IUSE="doc java cxx tcl test rpc"
  26. # the entire testsuite needs the TCL functionality
  27. DEPEND="tcl? ( >=dev-lang/tcl-8.4 )
  28. test? ( >=dev-lang/tcl-8.4 )
  29. java? ( >=virtual/jdk-1.5 )
  30. >=sys-devel/binutils-2.16.1"
  31. RDEPEND="tcl? ( dev-lang/tcl )
  32. java? ( >=virtual/jre-1.5 )"
  33. src_unpack() {
  34. unpack "${MY_P}".tar.gz
  35. cd "${WORKDIR}"/"${MY_P}"
  36. for (( i=1 ; i<=${PATCHNO} ; i++ ))
  37. do
  38. epatch "${DISTDIR}"/patch."${MY_PV}"."${i}"
  39. done
  40. epatch "${FILESDIR}"/"${PN}"-4.6-libtool.patch
  41. # use the includes from the prefix
  42. epatch "${FILESDIR}"/"${PN}"-4.6-jni-check-prefix-first.patch
  43. epatch "${FILESDIR}"/"${PN}"-4.3-listen-to-java-options.patch
  44. sed -e "/^DB_RELEASE_DATE=/s/%B %e, %Y/%Y-%m-%d/" -i dist/RELEASE
  45. # Include the SLOT for Java JAR files
  46. # This supersedes the unused jarlocation patches.
  47. sed -r -i \
  48. -e '/jarfile=.*\.jar$/s,(.jar$),-$(LIBVERSION)\1,g' \
  49. "${S}"/../dist/Makefile.in
  50. cd "${S}"/../dist
  51. rm -f aclocal/libtool.m4
  52. sed -i \
  53. -e '/AC_PROG_LIBTOOL$/aLT_OUTPUT' \
  54. configure.ac
  55. sed -i \
  56. -e '/^AC_PATH_TOOL/s/ sh, none/ bash, none/' \
  57. aclocal/programs.m4
  58. AT_M4DIR="aclocal aclocal_java" eautoreconf
  59. # Upstream sucks - they do autoconf and THEN replace the version variables.
  60. . ./RELEASE
  61. sed -i \
  62. -e "s/__EDIT_DB_VERSION_MAJOR__/$DB_VERSION_MAJOR/g" \
  63. -e "s/__EDIT_DB_VERSION_MINOR__/$DB_VERSION_MINOR/g" \
  64. -e "s/__EDIT_DB_VERSION_PATCH__/$DB_VERSION_PATCH/g" \
  65. -e "s/__EDIT_DB_VERSION_STRING__/$DB_VERSION_STRING/g" \
  66. -e "s/__EDIT_DB_VERSION_UNIQUE_NAME__/$DB_VERSION_UNIQUE_NAME/g" \
  67. -e "s/__EDIT_DB_VERSION__/$DB_VERSION/g" configure
  68. }
  69. src_compile() {
  70. local myconf=''
  71. # compilation with -O0 fails on amd64, see bug #171231
  72. if use amd64; then
  73. replace-flags -O0 -O2
  74. is-flagq -O[s123] || append-flags -O2
  75. fi
  76. # use `set` here since the java opts will contain whitespace
  77. set --
  78. if use java ; then
  79. set -- "$@" \
  80. --with-java-prefix="${JAVA_HOME}" \
  81. --with-javac-flags="$(java-pkg_javac-args)"
  82. fi
  83. # Add linker versions to the symbols. Easier to do, and safer than header file
  84. # mumbo jumbo.
  85. if use userland_GNU ; then
  86. append-ldflags -Wl,--default-symver
  87. fi
  88. # Bug #270851: test needs TCL support
  89. if use tcl || use test ; then
  90. myconf="${myconf} --enable-tcl"
  91. myconf="${myconf} --with-tcl=${EPREFIX}/usr/$(get_libdir)"
  92. else
  93. myconf="${myconf} --disable-tcl"
  94. fi
  95. cd "${S}"
  96. ECONF_SOURCE="${S}"/../dist \
  97. STRIP="true" \
  98. econf \
  99. --enable-compat185 \
  100. --enable-o_direct \
  101. --without-uniquename \
  102. $(use_enable rpc) \
  103. $(use arm && echo --with-mutex=ARM/gcc-assembly) \
  104. $(use amd64 && echo --with-mutex=x86/gcc-assembly) \
  105. $(use_enable cxx) \
  106. $(use_enable java) \
  107. ${myconf} \
  108. $(use_enable test) \
  109. "$@"
  110. emake || die "make failed"
  111. }
  112. src_install() {
  113. emake install DESTDIR="${D}" || die
  114. db_src_install_usrbinslot
  115. db_src_install_headerslot
  116. db_src_install_doc
  117. db_src_install_usrlibcleanup
  118. dodir /usr/sbin
  119. # This file is not always built, and no longer exists as of db-4.8
  120. [[ -f "${ED}"/usr/bin/berkeley_db_svc ]] && \
  121. mv "${ED}"/usr/bin/berkeley_db_svc "${ED}"/usr/sbin/berkeley_db"${SLOT/./}"_svc
  122. if use java; then
  123. java-pkg_regso "${ED}"/usr/"$(get_libdir)"/libdb_java*.so
  124. java-pkg_dojar "${ED}"/usr/"$(get_libdir)"/*.jar
  125. rm -f "${ED}"/usr/"$(get_libdir)"/*.jar
  126. fi
  127. }
  128. pkg_postinst() {
  129. db_fix_so
  130. }
  131. pkg_postrm() {
  132. db_fix_so
  133. }