mongo-c-driver-1.3.5.ebuild 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. # Copyright 1999-2016 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI=5
  4. inherit autotools eutils
  5. DESCRIPTION="A high-performance MongoDB driver for C"
  6. HOMEPAGE="https://github.com/mongodb/mongo-c-driver"
  7. SRC_URI="https://github.com/mongodb/${PN}/releases/download/${PV}/${P}.tar.gz"
  8. LICENSE="BSD"
  9. SLOT="0"
  10. KEYWORDS="~amd64 ~hppa ~x86"
  11. IUSE="debug examples libressl sasl ssl static-libs test"
  12. RDEPEND=">=dev-libs/libbson-1.3.5
  13. sasl? ( dev-libs/cyrus-sasl )
  14. ssl? (
  15. !libressl? ( dev-libs/openssl:0= )
  16. libressl? ( dev-libs/libressl:0= )
  17. )"
  18. DEPEND="${RDEPEND}
  19. test? ( dev-db/mongodb )"
  20. DOCS=( NEWS README.rst )
  21. src_prepare() {
  22. rm -r src/libbson || die
  23. sed -i -e '/SUBDIRS/s:src/libbson::g' Makefile.am || die
  24. # https://github.com/mongodb/mongo-c-driver/issues/54
  25. sed -i -e "s/PTHREAD_LIBS/PTHREAD_CFLAGS/g" src/Makefile.am \
  26. tests/Makefile.am || die
  27. eautoreconf
  28. }
  29. src_configure() {
  30. econf --with-libbson=system \
  31. --disable-hardening \
  32. --disable-optimizations \
  33. --disable-examples \
  34. --docdir="${EPREFIX}/usr/share/doc/${P}" \
  35. $(use_enable sasl) \
  36. $(use_enable ssl ssl openssl) \
  37. $(use_enable debug) \
  38. $(use_enable static-libs static)
  39. }
  40. src_install() {
  41. default_src_install
  42. if [[ -f "${D}usr/share/doc/${P}/COPYING" ]] ; then
  43. rm "${D}usr/share/doc/${P}/COPYING" || die
  44. fi
  45. # Only install the mongoc man pages to avoid conflicts of common names
  46. doman doc/man/mongoc_*.3
  47. use static-libs || find "${D}" -name '*.la' -delete
  48. if use examples; then
  49. insinto /usr/share/${PF}/examples
  50. doins -r examples/*.c examples/aggregation examples/bulk
  51. fi
  52. }
  53. src_test() {
  54. # Avoid allocating too much disk space by using server.smallFiles = 1
  55. echo -e "storage:\n smallFiles: true" > "${T}/mongod.conf"
  56. local PORT=27099
  57. mongod --port ${PORT} --bind_ip 127.0.0.1 --nounixsocket --fork \
  58. -f "${T}/mongod.conf" --dbpath="${T}" \
  59. --logpath="${T}/mongod.log" || die
  60. MONGOC_TEST_HOST="127.0.0.1:${PORT}" emake test
  61. kill `cat "${T}/mongod.lock"`
  62. }