1 # Copyright 1999-2018 Gentoo Foundation
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 eutils flag-o-matic multilib multiprocessing pax-utils python-single-r1 scons-utils systemd toolchain-funcs user versionator
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="AGPL-3 Apache-2.0"
23 KEYWORDS="~amd64 ~x86"
24 IUSE="debug kerberos libressl mms-agent ssl test +tools"
26 RDEPEND=">=app-arch/snappy-1.1.3
27 >=dev-cpp/yaml-cpp-0.5.3
28 >=dev-libs/boost-1.60:=[threads(+)]
29 >=dev-libs/libpcre-8.41[cxx]
30 dev-libs/snowball-stemmer
32 >=sys-libs/zlib-1.2.8:=
33 mms-agent? ( app-admin/mms-agent )
35 !libressl? ( >=dev-libs/openssl-1.0.1g:0= )
36 libressl? ( dev-libs/libressl:0= )
40 dev-python/cheetah[${PYTHON_USEDEP}]
41 dev-python/pyyaml[${PYTHON_USEDEP}]
42 dev-python/typing[${PYTHON_USEDEP}]
46 debug? ( dev-util/valgrind )
47 kerberos? ( dev-libs/cyrus-sasl[kerberos] )
49 dev-python/pymongo[${PYTHON_USEDEP}]
51 PDEPEND="tools? ( >=app-admin/mongo-tools-${PV} )"
54 "${FILESDIR}/${PN}-3.4.7-no-boost-check.patch"
55 "${FILESDIR}/${PN}-3.6.1-fix-scons.patch"
56 "${FILESDIR}/${PN}-3.6.1-no-compass.patch"
62 if [[ -n ${REPLACING_VERSIONS} ]] && [[ ${REPLACING_VERSIONS} < 3.4 ]]; then
63 ewarn "To upgrade from a version earlier than the 3.4-series, you must"
64 ewarn "successively upgrade major releases until you have upgraded"
65 ewarn "to 3.4-series. Then upgrade to 3.6 series."
71 enewuser mongodb -1 -1 /var/lib/${PN} mongodb
73 python-single-r1_pkg_setup
80 rm -rv src/third_party/{boost-*,pcre-*,scons-*,snappy-*,yaml-cpp-*,zlib-*} || die
83 rm -rv src/mongo/installer/compass || die
87 # --use-system-icu fails tests
88 # --use-system-tcmalloc is strongly NOT recommended:
89 # https://www.mongodb.org/about/contributors/tutorial/build-mongodb-from-source/
94 --disable-warnings-as-errors
103 use debug && scons_opts+=( --dbg=on )
104 use kerberos && scons_opts+=( --use-sasl-client )
105 use ssl && scons_opts+=( --ssl )
107 # wiredtiger not supported on 32bit platforms #572166
108 use x86 && scons_opts+=( --wiredtiger=off )
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
133 for x in /var/{lib,log}/${PN}; do
135 fowners mongodb:mongodb "${x}"
139 doman debian/mongo*.1
140 dodoc README docs/building.md
142 newinitd "${FILESDIR}/${PN}.initd-r3" ${PN}
143 newconfd "${FILESDIR}/${PN}.confd-r3" ${PN}
144 newinitd "${FILESDIR}/${PN/db/s}.initd-r3" ${PN/db/s}
145 newconfd "${FILESDIR}/${PN/db/s}.confd-r3" ${PN/db/s}
148 newins "${FILESDIR}/${PN}.conf-r3" ${PN}.conf
149 newins "${FILESDIR}/${PN/db/s}.conf-r2" ${PN/db/s}.conf
151 systemd_dounit "${FILESDIR}/${PN}.service"
153 insinto /etc/logrotate.d/
154 newins "${FILESDIR}/${PN}.logrotate" ${PN}
157 pax-mark emr "${ED}"/usr/bin/{mongo,mongod,mongos}
162 if [[ "$(get_libdir)" == "lib64" ]]; then
163 rmdir "${ED}"/usr/lib/ &>/dev/null
168 ewarn "Make sure to read the release notes and follow the upgrade process:"
169 ewarn " https://docs.mongodb.com/manual/release-notes/$(get_version_component_range 1-2)/"
170 ewarn " https://docs.mongodb.com/manual/release-notes/$(get_version_component_range 1-2)/#upgrade-procedures"