db-3.2.9_p2.ebuild 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. # Copyright 1999-2016 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. inherit eutils db 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. DESCRIPTION="Berkeley DB for transaction support in MySQL"
  16. HOMEPAGE="http://www.oracle.com/technetwork/database/database-technologies/berkeleydb/overview/index.html"
  17. SRC_URI="http://download.oracle.com/berkeley-db/${MY_P}.tar.gz"
  18. for (( i=1 ; i<=${PATCHNO} ; i++ )) ; do
  19. export SRC_URI="${SRC_URI} http://www.oracle.com/technology/products/berkeley-db/db/update/${MY_PV}/patch.${MY_PV}.${i}"
  20. done
  21. LICENSE="Sleepycat"
  22. SLOT="3"
  23. # This ebuild is to be the compatibility ebuild for when db4 is put
  24. # in the tree.
  25. KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86"
  26. IUSE="doc"
  27. DEPEND="${RDEPEND}
  28. =sys-libs/db-1.85*"
  29. S="${WORKDIR}/${MY_P}"
  30. src_unpack() {
  31. # This doesn't build without exceptions
  32. export CXXFLAGS="${CXXFLAGS/-fno-exceptions/-fexceptions}"
  33. unpack "${MY_P}".tar.gz
  34. chmod -R ug+w *
  35. cd "${WORKDIR}"/"${MY_P}"
  36. for (( i=1 ; i<=${PATCHNO} ; i++ ))
  37. do
  38. epatch "${DISTDIR}"/patch."${MY_PV}"."${i}"
  39. done
  40. # Get db to link libdb* to correct dependencies ... for example if we use
  41. # NPTL or NGPT, db detects usable mutexes, and should link against
  42. # libpthread, but does not do so ...
  43. # <azarah@gentoo.org> (23 Feb 2003)
  44. epatch "${FILESDIR}"/${MY_P}-fix-dep-link.patch
  45. # We should get dump185 to link against system db1 ..
  46. # <azarah@gentoo.org> (23 Feb 2003)
  47. mv "${S}"/dist/Makefile.in "${S}"/dist/Makefile.in.orig
  48. sed -e 's:DB185INC=:DB185INC= -I/usr/include/db1:' \
  49. -e 's:DB185LIB=:DB185LIB= -ldb1:' \
  50. "${S}"/dist/Makefile.in.orig > "${S}"/dist/Makefile.in || die "Failed to sed"
  51. epatch "${FILESDIR}"/${MY_P}-gcc43.patch
  52. # Fix invalid .la files
  53. cd "${WORKDIR}"/${MY_P}/dist
  54. rm -f ltversion.sh
  55. # remove config.guess else we have problems with gcc-3.2
  56. rm -f config.guess
  57. sed -i "s,\(-D_GNU_SOURCE\),\1 ${CFLAGS}," configure
  58. }
  59. src_compile() {
  60. local conf=
  61. local conf_shared=
  62. local conf_static=
  63. conf="${conf}
  64. --host=${CHOST} \
  65. --build=${CHOST} \
  66. --enable-cxx \
  67. --enable-compat185 \
  68. --enable-dump185 \
  69. --prefix=${EPREFIX}/usr"
  70. # --enable-rpc DOES NOT BUILD
  71. # Robin H. Johnson <robbat2@gentoo.org> (18 Oct 2003)
  72. conf_shared="${conf_shared}
  73. --enable-dynamic"
  74. # TCL support is also broken
  75. # Robin H. Johnson <robbat2@gentoo.org> (18 Oct 2003)
  76. # conf_shared="${conf_shared}
  77. # `use_enable tcl tcl`
  78. # `use_with tcl tcl /usr/$(get_libdir)`"
  79. # NOTE: we should not build both shared and static versions
  80. # of the libraries in the same build root!
  81. einfo "Configuring ${P} (static)..."
  82. mkdir -p "${S}"/build-static
  83. cd "${S}"/build-static
  84. strip=/bin/true \
  85. ECONF_SOURCE="${S}"/dist econf \
  86. ${conf} ${conf_static} \
  87. --libdir="${EPREFIX}"/usr/$(get_libdir) \
  88. --disable-shared \
  89. --enable-static || die
  90. einfo "Configuring ${P} (shared)..."
  91. mkdir -p "${S}"/build-shared
  92. cd "${S}"/build-shared
  93. strip="${ED}"/bin/true \
  94. ECONF_SOURCE="${S}"/dist econf \
  95. ${conf} ${conf_shared} \
  96. --libdir="${EPREFIX}"/usr/$(get_libdir) \
  97. --disable-static \
  98. --enable-shared || die
  99. # Parallel make does not work
  100. MAKEOPTS="${MAKEOPTS} -j1"
  101. einfo "Building ${P} (static)..."
  102. cd "${S}"/build-static
  103. emake strip="${EPREFIX}"/bin/true || die "Static build failed"
  104. einfo "Building ${P} (shared)..."
  105. cd "${S}"/build-shared
  106. emake strip="${EPREFIX}"/bin/true || die "Shared build failed"
  107. }
  108. src_install () {
  109. cd "${S}"/build-shared
  110. make libdb=libdb-3.2.a \
  111. libcxx=libcxx_3.2.a \
  112. prefix="${EPREFIX}"/usr \
  113. libdir="${EPREFIX}"/usr/$(get_libdir) \
  114. strip="${EPREFIX}"/bin/true \
  115. install || die
  116. cd "${S}"/build-static
  117. newlib.a libdb.a libdb-3.2.a || die "failed to package static libraries!"
  118. newlib.a libdb_cxx.a libdb_cxx-3.2.a || die "failed to package static libraries!"
  119. db_src_install_headerslot || die "db_src_install_headerslot failed!"
  120. # this is now done in the db eclass, function db_fix_so and db_src_install_usrlibcleanup
  121. #cd "${D}"/usr/lib
  122. #ln -s libdb-3.2.so libdb.so.3
  123. # For some reason, db.so's are *not* readable by group or others,
  124. # resulting in no one but root being able to use them!!!
  125. # This fixes it -- DR 15 Jun 2001
  126. cd "${ED}"/usr/$(get_libdir)
  127. chmod go+rx *.so
  128. # The .la's aren't readable either
  129. chmod go+r *.la
  130. cd "${S}"
  131. dodoc README
  132. db_src_install_doc || die "db_src_install_doc failed!"
  133. db_src_install_usrbinslot || die "db_src_install_usrbinslot failed!"
  134. db_src_install_usrlibcleanup || die "db_src_install_usrlibcleanup failed!"
  135. }
  136. pkg_postinst () {
  137. db_fix_so
  138. }
  139. pkg_postrm () {
  140. db_fix_so
  141. }
  142. src_test() {
  143. if use test; then
  144. eerror "We'd love to be able to test, but the testsuite is broken in the 3.2.9 series"
  145. fi
  146. }