1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
6 PYTHON_COMPAT=( python2_7 )
8 SCONS_MIN_VERSION="2.5.0"
9 CHECKREQS_DISK_BUILD="2400M"
10 CHECKREQS_DISK_USR="512M"
11 CHECKREQS_MEMORY="1024M"
13 inherit check-reqs flag-o-matic multiprocessing pax-utils python-any-r1 scons-utils systemd toolchain-funcs
15 MY_P=${PN}-src-r${PV/_rc/-rc}
17 DESCRIPTION="A high-performance, open source, schema-free document-oriented database"
18 HOMEPAGE="https://www.mongodb.com"
19 SRC_URI="https://fastdl.mongodb.org/src/${MY_P}.tar.gz"
21 LICENSE="Apache-2.0 SSPL-1"
24 IUSE="debug kerberos libressl lto mms-agent ssl test +tools"
25 RESTRICT="!test? ( test )"
27 RDEPEND="acct-group/mongodb
29 >=app-arch/snappy-1.1.3
30 >=dev-cpp/yaml-cpp-0.5.3:=
31 >=dev-libs/boost-1.60:=[threads(+)]
32 >=dev-libs/libpcre-8.41[cxx]
33 dev-libs/snowball-stemmer
35 >=sys-libs/zlib-1.2.8:=
36 kerberos? ( dev-libs/cyrus-sasl[kerberos] )
37 mms-agent? ( app-admin/mms-agent )
39 !libressl? ( >=dev-libs/openssl-1.0.1g:0= )
40 libressl? ( dev-libs/libressl:0= )
44 $(python_gen_any_dep '
45 dev-python/cheetah[${PYTHON_USEDEP}]
46 dev-python/pyyaml[${PYTHON_USEDEP}]
47 dev-python/typing[${PYTHON_USEDEP}]
51 debug? ( dev-util/valgrind )
53 $(python_gen_any_dep 'dev-python/pymongo[${PYTHON_USEDEP}]')
55 PDEPEND="tools? ( >=app-admin/mongo-tools-${PV} )"
58 "${FILESDIR}/${PN}-3.6.1-fix-scons.patch"
59 "${FILESDIR}/${PN}-3.6.1-no-compass.patch"
60 "${FILESDIR}/${PN}-4.0.12-boost-1.71-cxxabi-include.patch"
63 S="${WORKDIR}/${MY_P}"
66 if [[ -n ${REPLACING_VERSIONS} ]]; then
67 if ver_test "$REPLACING_VERSIONS" -lt 3.4; then
68 ewarn "To upgrade from a version earlier than the 3.4-series, you must"
69 ewarn "successively upgrade major releases until you have upgraded"
70 ewarn "to 3.4-series. Then upgrade to 3.6 series."
72 ewarn "Be sure to set featureCompatibilityVersion to 3.4 before upgrading."
81 rm -r src/third_party/{boost-*,pcre-*,scons-*,snappy-*,yaml-cpp-*,zlib-*} || die
84 rm -r src/mongo/installer/compass || die
88 # https://github.com/mongodb/mongo/wiki/Build-Mongodb-From-Source
89 # --use-system-icu fails tests
90 # --use-system-tcmalloc is strongly NOT recommended:
95 --disable-warnings-as-errors
104 use debug && scons_opts+=( --dbg=on )
105 use kerberos && scons_opts+=( --use-sasl-client )
106 use lto && scons_opts+=( --lto=on )
107 use ssl && scons_opts+=( --ssl )
109 # respect mongoDB upstream's basic recommendations
110 # see bug #536688 and #526114
120 escons "${scons_opts[@]}" core tools
123 # FEATURES="test -usersandbox" emerge dev-db/mongodb
125 "${EPYTHON}" ./buildscripts/resmoke.py --dbpathPrefix=test --suites core --jobs=$(makeopts_jobs) || die "Tests failed"
129 escons "${scons_opts[@]}" --nostrip install --prefix="${ED}"/usr
131 doman debian/mongo*.1
132 dodoc README docs/building.md
134 newinitd "${FILESDIR}/${PN}.initd-r3" ${PN}
135 newconfd "${FILESDIR}/${PN}.confd-r3" ${PN}
136 newinitd "${FILESDIR}/mongos.initd-r3" mongos
137 newconfd "${FILESDIR}/mongos.confd-r3" mongos
140 newins "${FILESDIR}/${PN}.conf-r3" ${PN}.conf
141 newins "${FILESDIR}/mongos.conf-r2" mongos.conf
143 systemd_dounit "${FILESDIR}/${PN}.service"
145 insinto /etc/logrotate.d/
146 newins "${FILESDIR}/${PN}.logrotate" ${PN}
149 pax-mark emr "${ED}"/usr/bin/{mongo,mongod,mongos}
152 for x in /var/{lib,log}/${PN}; do
153 diropts -m0750 -o mongodb -g mongodb
159 ewarn "Make sure to read the release notes and follow the upgrade process:"
160 ewarn " https://docs.mongodb.com/manual/release-notes/$(ver_cut 1-2)/"
161 ewarn " https://docs.mongodb.com/manual/release-notes/$(ver_cut 1-2)/#upgrade-procedures"