1 # Copyright 1999-2016 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
6 SCONS_MIN_VERSION="2.3.0"
7 CHECKREQS_DISK_BUILD="2400M"
8 CHECKREQS_DISK_USR="512M"
9 CHECKREQS_MEMORY="1024M"
11 inherit eutils flag-o-matic multilib pax-utils scons-utils systemd toolchain-funcs user versionator check-reqs
13 MY_P=${PN}-src-r${PV/_rc/-rc}
15 DESCRIPTION="A high-performance, open source, schema-free document-oriented database"
16 HOMEPAGE="http://www.mongodb.org"
17 SRC_URI="https://fastdl.mongodb.org/src/${MY_P}.tar.gz"
19 LICENSE="AGPL-3 Apache-2.0"
21 KEYWORDS="~amd64 ~x86"
22 IUSE="debug kerberos libressl mms-agent ssl test +tools"
24 RDEPEND=">=app-arch/snappy-1.1.2
25 || ( =dev-cpp/yaml-cpp-0.5.1 >dev-cpp/yaml-cpp-0.5.2 )
26 >=dev-libs/boost-1.57[threads(+)]
27 >=dev-libs/libpcre-8.37[cxx]
28 dev-libs/snowball-stemmer
31 mms-agent? ( app-admin/mms-agent )
33 !libressl? ( >=dev-libs/openssl-1.0.1g:0= )
34 libressl? ( dev-libs/libressl:= )
37 >=sys-devel/gcc-4.8.2:*
40 debug? ( dev-util/valgrind )
41 kerberos? ( dev-libs/cyrus-sasl[kerberos] )
46 PDEPEND="tools? ( >=app-admin/mongo-tools-${PV} )"
51 if [[ ${REPLACING_VERSIONS} < 3.0 ]]; then
52 ewarn "To upgrade an existing MongoDB deployment to 3.2, you must be"
53 ewarn "running a 3.0-series release. Please update to the latest 3.0"
54 ewarn "release before continuing if wish to keep your data."
60 enewuser mongodb -1 -1 /var/lib/${PN} mongodb
64 # --use-system-tcmalloc is strongly NOT recommended:
65 # https://www.mongodb.org/about/contributors/tutorial/build-mongodb-from-source/
71 --disable-warnings-as-errors
80 # wiredtiger not supported on 32bit platforms #572166
81 use x86 && scons_opts+=( --wiredtiger=off )
84 scons_opts+=( --dbg=on )
89 --cpppath="${EPREFIX}/usr/include"
90 --libpath="${EPREFIX}/usr/$(get_libdir)"
95 scons_opts+=( --use-sasl-client )
104 epatch "${FILESDIR}/${PN}-3.2.0-fix-scons.patch" \
105 "${FILESDIR}/${PN}-3.2.4-boost-1.60.patch"
110 # respect mongoDB upstream's basic recommendations
111 # see bug #536688 and #526114
116 escons "${scons_opts[@]}" core tools
120 escons "${scons_opts[@]}" --nostrip install --prefix="${ED}"/usr
122 for x in /var/{lib,log}/${PN}; do
124 fowners mongodb:mongodb "${x}"
127 doman debian/mongo*.1
128 dodoc README docs/building.md
130 newinitd "${FILESDIR}/${PN}.initd-r2" ${PN}
131 newconfd "${FILESDIR}/${PN}.confd-r2" ${PN}
132 newinitd "${FILESDIR}/${PN/db/s}.initd-r2" ${PN/db/s}
133 newconfd "${FILESDIR}/${PN/db/s}.confd-r2" ${PN/db/s}
136 newins "${FILESDIR}/${PN}.conf-r3" ${PN}.conf
137 newins "${FILESDIR}/${PN/db/s}.conf-r2" ${PN/db/s}.conf
139 systemd_dounit "${FILESDIR}/${PN}.service"
141 insinto /etc/logrotate.d/
142 newins "${FILESDIR}/${PN}.logrotate" ${PN}
145 pax-mark emr "${ED}"/usr/bin/{mongo,mongod,mongos}
150 if [[ "$(get_libdir)" == "lib64" ]]; then
151 rmdir "${ED}"/usr/lib/ &>/dev/null
156 # this one test fails
157 rm jstests/core/repl_write_threads_start_param.js
159 ./buildscripts/resmoke.py --dbpathPrefix=test --suites core || die "Tests failed"
164 for v in ${REPLACING_VERSIONS}; do
165 if ! version_is_at_least 3.0 ${v}; then
166 ewarn "!! IMPORTANT !!"
168 ewarn "${PN} configuration files have changed !"
170 ewarn "Make sure you migrate from /etc/conf.d/${PN} to the new YAML standard in /etc/${PN}.conf"
171 ewarn " http://docs.mongodb.org/manual/reference/configuration-options/"
173 ewarn "Make sure you also follow the upgrading process :"
174 ewarn " http://docs.mongodb.org/master/release-notes/3.0-upgrade/"
176 ewarn "MongoDB 3.0 introduces the WiredTiger storage engine."
177 ewarn "WiredTiger is incompatible with MMAPv1 and you need to dump/reload your data if you want to use it."
178 ewarn "Once you have your data dumped, you need to set storage.engine: wiredTiger in /etc/${PN}.conf"
179 ewarn " http://docs.mongodb.org/master/release-notes/3.0-upgrade/#change-storage-engine-to-wiredtiger"
184 ewarn "Make sure to read the release notes and follow the upgrade process:"
185 ewarn " https://docs.mongodb.org/manual/release-notes/3.2/"
186 ewarn " https://docs.mongodb.org/master/release-notes/3.2-upgrade/"
188 ewarn " Starting in 3.2, MongoDB uses the WiredTiger as the default storage engine."