mongodb-2.6.12.ebuild 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  1. # Copyright 1999-2016 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI=5
  4. SCONS_MIN_VERSION="1.2.0"
  5. CHECKREQS_DISK_BUILD="2400M"
  6. CHECKREQS_DISK_USR="512M"
  7. CHECKREQS_MEMORY="1024M"
  8. inherit eutils flag-o-matic multilib pax-utils scons-utils systemd user versionator check-reqs
  9. MY_P=${PN}-src-r${PV/_rc/-rc}
  10. DESCRIPTION="A high-performance, open source, schema-free document-oriented database"
  11. HOMEPAGE="http://www.mongodb.org"
  12. SRC_URI="http://downloads.mongodb.org/src/${MY_P}.tar.gz
  13. mms-agent? ( https://dev.gentoo.org/~ultrabug/20140409-mms-monitoring-agent.zip )"
  14. LICENSE="AGPL-3 Apache-2.0"
  15. SLOT="0"
  16. KEYWORDS="amd64 x86"
  17. IUSE="debug kerberos mms-agent ssl static-libs"
  18. PDEPEND="mms-agent? ( dev-python/pymongo app-arch/unzip )"
  19. RDEPEND="
  20. app-arch/snappy
  21. >=dev-cpp/yaml-cpp-0.5.1
  22. >=dev-libs/boost-1.50[threads(+)]
  23. >=dev-libs/libpcre-8.37[cxx]
  24. dev-libs/snowball-stemmer
  25. dev-util/google-perftools[-minimal]
  26. net-libs/libpcap
  27. ssl? ( >=dev-libs/openssl-1.0.1g )"
  28. DEPEND="${RDEPEND}
  29. sys-libs/ncurses
  30. sys-libs/readline
  31. kerberos? ( dev-libs/cyrus-sasl[kerberos] )"
  32. S=${WORKDIR}/${MY_P}
  33. pkg_setup() {
  34. enewgroup mongodb
  35. enewuser mongodb -1 -1 /var/lib/${PN} mongodb
  36. scons_opts="--variant-dir=build --cc=$(tc-getCC) --cxx=$(tc-getCXX)"
  37. scons_opts+=" --disable-warnings-as-errors"
  38. scons_opts+=" --use-system-boost"
  39. scons_opts+=" --use-system-pcre"
  40. scons_opts+=" --use-system-snappy"
  41. scons_opts+=" --use-system-stemmer"
  42. scons_opts+=" --use-system-tcmalloc"
  43. scons_opts+=" --use-system-yaml"
  44. scons_opts+=" --usev8"
  45. if use debug; then
  46. scons_opts+=" --dbg=on"
  47. fi
  48. if use prefix; then
  49. scons_opts+=" --cpppath=${EPREFIX}/usr/include"
  50. scons_opts+=" --libpath=${EPREFIX}/usr/$(get_libdir)"
  51. fi
  52. if use kerberos; then
  53. scons_opts+=" --use-sasl-client"
  54. fi
  55. if use ssl; then
  56. scons_opts+=" --ssl"
  57. fi
  58. }
  59. src_prepare() {
  60. epatch "${FILESDIR}/${PN}-2.6.2-fix-scons.patch"
  61. epatch "${FILESDIR}/${PN}-2.4-fix-v8-pythonpath.patch"
  62. epatch "${FILESDIR}/${PN}-2.6.10-fix-boost-1.57.patch"
  63. # fix yaml-cpp detection
  64. sed -i -e "s/\[\"yaml\"\]/\[\"yaml-cpp\"\]/" SConstruct || die
  65. # bug #462606
  66. sed -i -e "s@\$INSTALL_DIR/lib@\$INSTALL_DIR/$(get_libdir)@g" src/SConscript.client || die
  67. # bug #482576
  68. sed -i -e "/-Werror/d" src/third_party/v8/SConscript || die
  69. }
  70. src_configure() {
  71. # filter some problematic flags
  72. filter-flags "-march=*"
  73. filter-flags -O?
  74. }
  75. src_compile() {
  76. escons ${scons_opts} all
  77. }
  78. src_install() {
  79. escons ${scons_opts} --full --nostrip install --prefix="${ED}"/usr
  80. use static-libs || find "${ED}"/usr/ -type f -name "*.a" -delete
  81. for x in /var/{lib,log}/${PN}; do
  82. keepdir "${x}"
  83. fowners mongodb:mongodb "${x}"
  84. done
  85. doman debian/mongo*.1
  86. dodoc README docs/building.md
  87. newinitd "${FILESDIR}/${PN}.initd-r2" ${PN}
  88. newconfd "${FILESDIR}/${PN}.confd-r2" ${PN}
  89. newinitd "${FILESDIR}/${PN/db/s}.initd-r2" ${PN/db/s}
  90. newconfd "${FILESDIR}/${PN/db/s}.confd-r2" ${PN/db/s}
  91. insinto /etc
  92. newins "${FILESDIR}/${PN}.conf-r2" ${PN}.conf
  93. newins "${FILESDIR}/${PN/db/s}.conf-r2" ${PN/db/s}.conf
  94. systemd_dounit "${FILESDIR}/${PN}.service"
  95. insinto /etc/logrotate.d/
  96. newins "${FILESDIR}/${PN}.logrotate" ${PN}
  97. # see bug #526114
  98. pax-mark emr "${ED}"/usr/bin/{mongo,mongod,mongos}
  99. if use mms-agent; then
  100. local MY_PN="mms-agent"
  101. local MY_D="/opt/${MY_PN}"
  102. insinto /etc
  103. newins "${WORKDIR}/${MY_PN}/settings.py" mms-agent.conf
  104. rm "${WORKDIR}/${MY_PN}/settings.py"
  105. insinto ${MY_D}
  106. doins "${WORKDIR}/${MY_PN}/"*
  107. dosym /etc/mms-agent.conf ${MY_D}/settings.py
  108. fowners -R mongodb:mongodb ${MY_D}
  109. newinitd "${FILESDIR}/${MY_PN}.initd-r2" ${MY_PN}
  110. fi
  111. }
  112. pkg_preinst() {
  113. # wrt bug #461466
  114. if [[ "$(get_libdir)" == "lib64" ]]; then
  115. rmdir "${ED}"/usr/lib/ &>/dev/null
  116. fi
  117. }
  118. src_test() {
  119. escons ${scons_opts} test
  120. "${S}"/test --dbpath=unittest || die
  121. }
  122. pkg_postinst() {
  123. local v
  124. for v in ${REPLACING_VERSIONS}; do
  125. if ! version_is_at_least 2.6 ${v}; then
  126. ewarn "!! IMPORTANT !!"
  127. ewarn " "
  128. ewarn "${PN} configuration files have changed !"
  129. ewarn " "
  130. ewarn "Make sure you migrate from /etc/conf.d/${PN} to the new YAML standard in /etc/${PN}.conf"
  131. ewarn " http://docs.mongodb.org/manual/reference/configuration-options/"
  132. ewarn " "
  133. ewarn "Make sure you also follow the upgrading process :"
  134. ewarn " http://docs.mongodb.org/master/release-notes/2.6-upgrade/"
  135. ewarn " "
  136. if use mms-agent; then
  137. ewarn "MMS Agent configuration file has been moved to :"
  138. ewarn " /etc/mms-agent.conf"
  139. fi
  140. break
  141. else
  142. if use mms-agent; then
  143. elog "Edit your MMS Agent configuration file :"
  144. elog " /etc/mms-agent.conf"
  145. fi
  146. fi
  147. done
  148. }