mongo-c-driver-1.1.10.ebuild 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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.1.10
  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 TUTORIAL.md )
  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. $(use_enable sasl) \
  35. $(use_enable ssl) \
  36. $(use_enable debug) \
  37. $(use_enable static-libs static)
  38. }
  39. src_install() {
  40. emake DESTDIR="${D}" install
  41. doman doc/*.3
  42. use static-libs || find "${D}" -name '*.la' -delete
  43. if use examples; then
  44. insinto /usr/share/${PF}/examples
  45. doins -r examples/*.c examples/aggregation examples/bulk
  46. fi
  47. }
  48. src_test() {
  49. # Avoid allocating too much disk space by using server.smallFiles = 1
  50. echo -e "storage:\n smallFiles: true" > "${T}/mongod.conf"
  51. local PORT=27099
  52. mongod --port ${PORT} --bind_ip 127.0.0.1 --nounixsocket --fork \
  53. -f "${T}/mongod.conf" --dbpath="${T}" \
  54. --logpath="${T}/mongod.log" || die
  55. MONGOC_TEST_HOST="127.0.0.1:${PORT}" emake test
  56. kill `cat "${T}/mongod.lock"`
  57. }