You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

196 lines
3.6 KiB

  1. # Copyright 1999-2021 Gentoo Authors
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI="7"
  4. USE_RUBY="ruby25 ruby26 ruby27 ruby30"
  5. RUBY_OPTIONAL="yes"
  6. inherit autotools flag-o-matic java-pkg-opt-2 perl-functions ruby-ng
  7. DESCRIPTION="Quick Database Manager"
  8. HOMEPAGE="https://fallabs.com/qdbm/"
  9. SRC_URI="https://fallabs.com/${PN}/${P}.tar.gz"
  10. LICENSE="LGPL-2.1"
  11. SLOT="0"
  12. KEYWORDS="~alpha amd64 arm arm64 ~hppa ~ia64 ppc ppc64 ~riscv ~s390 sparc x86"
  13. IUSE="bzip2 cxx debug java lzo perl ruby static-libs zlib"
  14. RDEPEND="bzip2? ( app-arch/bzip2 )
  15. java? ( >=virtual/jre-1.8:* )
  16. lzo? ( dev-libs/lzo )
  17. perl? ( dev-lang/perl )
  18. ruby? ( $(ruby_implementations_depend) )
  19. zlib? ( sys-libs/zlib )"
  20. DEPEND="${RDEPEND}
  21. java? ( >=virtual/jdk-1.8:* )"
  22. S="${WORKDIR}/all/${P}"
  23. RUBY_S="${P}/ruby"
  24. PATCHES=(
  25. "${FILESDIR}"/${PN}-configure.patch
  26. "${FILESDIR}"/${PN}-perl.patch
  27. "${FILESDIR}"/${PN}-ruby19.patch
  28. "${FILESDIR}"/${PN}-runpath.patch
  29. "${FILESDIR}"/${PN}-darwin.patch
  30. )
  31. HTML_DOCS=( doc/. )
  32. AT_NOELIBTOOLIZE="yes"
  33. pkg_setup() {
  34. java-pkg-opt-2_pkg_setup
  35. use ruby && ruby-ng_pkg_setup
  36. }
  37. qdbm_foreach_api() {
  38. local u
  39. for u in cxx java perl ruby; do
  40. if ! use "${u}"; then
  41. continue
  42. fi
  43. einfo "${EBUILD_PHASE} ${u}"
  44. if [[ "${u}" == "cxx" ]]; then
  45. u="plus"
  46. fi
  47. if [[ "${u}" != "ruby" ]]; then
  48. cd "${u}"
  49. case "${EBUILD_PHASE}" in
  50. prepare)
  51. mv configure.{in,ac}
  52. eautoreconf
  53. ;;
  54. configure)
  55. case "${u}" in
  56. cgi|java|plus)
  57. econf $(use_enable debug)
  58. ;;
  59. *)
  60. econf
  61. ;;
  62. esac
  63. ;;
  64. compile)
  65. emake
  66. ;;
  67. test)
  68. emake check
  69. ;;
  70. install)
  71. emake DESTDIR="${D}" MYDATADIR=/usr/share/doc/${P}/html install
  72. esac
  73. cd - >/dev/null
  74. else
  75. PATCHES= ruby-ng_src_${EBUILD_PHASE}
  76. fi
  77. done
  78. }
  79. src_prepare() {
  80. default
  81. java-pkg-opt-2_src_prepare
  82. # fix build with >=sys-devel/gcc-7, bug #638878
  83. append-cflags $(test-flags-CC -fno-tree-vrp)
  84. sed -i \
  85. -e "/^CFLAGS/s|$| ${CFLAGS}|" \
  86. -e "/^OPTIMIZE/s|$| ${CFLAGS}|" \
  87. -e "/^CXXFLAGS/s|$| ${CXXFLAGS}|" \
  88. -e "/^JAVACFLAGS/s|$| ${JAVACFLAGS}|" \
  89. -e 's/make\( \|$\)/$(MAKE)\1/g' \
  90. -e '/^debug/,/^$/s/LDFLAGS="[^"]*" //' \
  91. Makefile.in {cgi,java,perl,plus,ruby}/Makefile.in || die
  92. find -name "*~" -delete || die
  93. mv configure.{in,ac} || die
  94. eautoreconf
  95. qdbm_foreach_api
  96. }
  97. each_ruby_prepare() {
  98. sed -i \
  99. -e "s|ruby |${RUBY} |" \
  100. -e "s|\.\./\.\.|${WORKDIR}/all/${P}|" \
  101. {Makefile,configure}.in {curia,depot,villa}/extconf.rb || die
  102. mv configure.{in,ac} || die
  103. eautoreconf
  104. }
  105. src_configure() {
  106. econf \
  107. $(use_enable bzip2 bzip) \
  108. $(use_enable debug) \
  109. $(use_enable lzo) \
  110. $(use_enable zlib) \
  111. --enable-iconv \
  112. --enable-pthread
  113. qdbm_foreach_api
  114. }
  115. each_ruby_configure() {
  116. econf
  117. }
  118. src_compile() {
  119. if [[ ${CHOST} == *darwin* ]] ; then
  120. emake mac
  121. else
  122. default
  123. qdbm_foreach_api
  124. fi
  125. }
  126. each_ruby_compile() {
  127. emake
  128. }
  129. src_test() {
  130. if [[ ${CHOST} == *darwin* ]] ; then
  131. emake check-mac
  132. else
  133. default
  134. qdbm_foreach_api
  135. fi
  136. }
  137. each_ruby_test() {
  138. emake check
  139. }
  140. src_install() {
  141. if [[ ${CHOST} == *darwin* ]] ; then
  142. emake install-mac
  143. else
  144. default
  145. fi
  146. qdbm_foreach_api
  147. use static-libs || find "${ED}" -name '*.a' -delete || die
  148. rm -rf "${ED}"/usr/share/${PN}
  149. if use java; then
  150. java-pkg_dojar "${ED}"/usr/$(get_libdir)/*.jar
  151. rm -f "${ED}"/usr/$(get_libdir)/*.jar
  152. fi
  153. if use perl; then
  154. perl_delete_module_manpages
  155. perl_fix_packlist
  156. fi
  157. rm -f "${ED}"/usr/bin/*test
  158. rm -f "${ED}"/usr/share/man/man1/*test.1*
  159. }
  160. each_ruby_install() {
  161. local m
  162. for m in curia depot villa; do
  163. emake -C "${m}" DESTDIR="${D}" install
  164. done
  165. }
  166. all_ruby_install() {
  167. dodoc -r rb*.html rbapidoc
  168. }