1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
6 PYTHON_COMPAT=( python3_{6,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 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.6.2:=
31 >=dev-libs/boost-1.70:=[threads(+)]
32 >=dev-libs/libpcre-8.42[cxx]
34 dev-libs/snowball-stemmer
36 >=sys-libs/zlib-1.2.11:=
37 kerberos? ( dev-libs/cyrus-sasl[kerberos] )
39 !libressl? ( >=dev-libs/openssl-1.0.1g:0= )
40 libressl? ( dev-libs/libressl:0= )
44 $(python_gen_any_dep '
45 dev-python/cheetah3[${PYTHON_USEDEP}]
46 dev-python/psutil[${PYTHON_USEDEP}]
47 dev-python/pyyaml[${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}-4.2.0-fix-scons.patch"
59 "${FILESDIR}/${PN}-4.0.0-no-compass.patch"
62 S="${WORKDIR}/${MY_P}"
65 if [[ -n ${REPLACING_VERSIONS} ]]; then
66 if ver_test "$REPLACING_VERSIONS" -lt 4.0; then
67 ewarn "To upgrade from a version earlier than the 4.0-series, you must"
68 ewarn "successively upgrade major releases until you have upgraded"
69 ewarn "to 4.0-series. Then upgrade to 4.2 series."
71 ewarn "Be sure to set featureCompatibilityVersion to 4.0 before upgrading."
80 rm -r src/third_party/{boost-*,pcre-*,scons-*,snappy-*,yaml-cpp-*,zlib-*,zstandard-*} || die
83 rm -r src/mongo/installer/compass || die
87 # https://github.com/mongodb/mongo/wiki/Build-Mongodb-From-Source
88 # --use-system-icu fails tests
89 # --use-system-tcmalloc is strongly NOT recommended:
94 --disable-warnings-as-errors
104 use arm64 && scons_opts+=( --use-hardware-crc32=off ) # Bug 701300
105 use debug && scons_opts+=( --dbg=on )
106 use kerberos && scons_opts+=( --use-sasl-client )
107 use lto && scons_opts+=( --lto=on )
108 use ssl && scons_opts+=( --ssl )
110 # respect mongoDB upstream's basic recommendations
111 # see bug #536688 and #526114
121 escons "${scons_opts[@]}" core tools
124 # FEATURES="test -usersandbox" emerge dev-db/mongodb
126 "${EPYTHON}" ./buildscripts/resmoke.py --dbpathPrefix=test --suites core --jobs=$(makeopts_jobs) || die "Tests failed"
130 escons "${scons_opts[@]}" --nostrip install --prefix="${ED}"/usr
132 doman debian/mongo*.1
133 dodoc README docs/building.md
135 newinitd "${FILESDIR}/${PN}.initd-r3" ${PN}
136 newconfd "${FILESDIR}/${PN}.confd-r3" ${PN}
137 newinitd "${FILESDIR}/mongos.initd-r3" mongos
138 newconfd "${FILESDIR}/mongos.confd-r3" mongos
141 newins "${FILESDIR}/${PN}.conf-r3" ${PN}.conf
142 newins "${FILESDIR}/mongos.conf-r2" mongos.conf
144 systemd_dounit "${FILESDIR}/${PN}.service"
146 insinto /etc/logrotate.d/
147 newins "${FILESDIR}/${PN}.logrotate" ${PN}
150 pax-mark emr "${ED}"/usr/bin/{mongo,mongod,mongos}
153 for x in /var/{lib,log}/${PN}; do
154 diropts -m0750 -o mongodb -g mongodb
160 ewarn "Make sure to read the release notes and follow the upgrade process:"
161 ewarn " https://docs.mongodb.com/manual/release-notes/$(ver_cut 1-2)/"
162 ewarn " https://docs.mongodb.com/manual/release-notes/$(ver_cut 1-2)/#upgrade-procedures"