1 # Copyright 1999-2023 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
6 PYTHON_COMPAT
=( python3_
{9.
.11} )
8 CHECKREQS_DISK_BUILD
="27000M"
9 CHECKREQS_DISK_USR
="512M"
10 CHECKREQS_MEMORY
="4092M"
12 inherit check-reqs multiprocessing pax-utils python-any-r1 systemd toolchain-funcs
14 DESCRIPTION
="A high-performance, open source, schema-free document-oriented database"
15 HOMEPAGE
="https://www.mongodb.com"
16 LICENSE
="Apache-2.0 SSPL-1"
19 CPU_FLAGS
="cpu_flags_x86_avx"
20 IUSE
="debug kerberos lto mongosh ssl gold +tools ocsp-stapling server-js tcmalloc tcmalloc-experimental"
21 IUSE
+=" free-mon http-client runtime-hardening experimental-optimization experimental-runtime-hardening"
23 SRC_URI
="https://github.com/mongodb/mongo/archive/r${PV}.tar.gz"
26 experimental-runtime-hardening? ( runtime-hardening )
27 tcmalloc? ( !tcmalloc-experimental )
30 # https://github.com/mongodb/mongo/wiki/Test-The-Mongodb-Server
31 # resmoke needs python packages not yet present in Gentoo
34 RDEPEND
="acct-group/mongodb
36 >=app-arch/snappy-1.1.3:=
37 >=dev-cpp/yaml-cpp-0.6.2:=
38 >=dev-libs/boost-1.70:=[threads(+),nls]
39 >=dev-libs/libpcre-8.42[cxx]
41 dev-libs/snowball-stemmer:=
43 >=sys-libs/zlib-1.2.11:=
44 kerberos? ( dev-libs/cyrus-sasl[kerberos] )
45 http-client? ( net-misc/curl )
46 gold? ( sys-devel/binutils:=[gold] )
48 >=dev-libs/openssl-1.0.1g:0=
54 $(python_gen_any_dep '
55 >=dev-util/scons-4.3.0[${PYTHON_USEDEP}]
56 dev-python/cheetah3[${PYTHON_USEDEP}]
57 dev-python/psutil[${PYTHON_USEDEP}]
58 dev-python/pyyaml[${PYTHON_USEDEP}]
59 dev-python/packaging[${PYTHON_USEDEP}]
60 dev-python/pymongo[${PYTHON_USEDEP}]
64 debug? ( dev-util/valgrind )
69 mongosh? ( app-admin/mongosh-bin )
70 tools? ( >=app-admin/mongo-tools-100 )
73 PATCHES
=( ${FILESDIR}/mongodb-5.0
.2-skip-reqs-check.
patch )
76 has_version
">=dev-util/scons-4.3.0[${PYTHON_USEDEP}]" &&
77 has_version
"dev-python/cheetah3[${PYTHON_USEDEP}]" &&
78 has_version
"dev-python/psutil[${PYTHON_USEDEP}]" &&
79 has_version
"dev-python/pyyaml[${PYTHON_USEDEP}]" &&
80 has_version
"dev-python/packaging[${PYTHON_USEDEP}]"
83 S
=${WORKDIR}/mongo-r
${PV}
86 if ! use cpu_flags_x86_avx
; then
87 eerror
"MongoDB ${PV} requires use of the AVX instruction set"
88 eerror
"https://docs.mongodb.com/v5.0/administration/production-notes/"
89 die
"MongoDB requires AVX"
92 check-reqs_pkg_pretend
104 CCFLAGS
="-march=native -pipe -DBOOST_LOG_DYN_LINK ${CCFLAGS}"
107 --jobs=$
(makeopts_jobs
)
109 --disable-warnings-as-errors
117 --use-diagnostic-latches=on
118 --use-hardware-crc32=on
125 --visibility-support=on
126 --enable-usdt-probes=off
130 scons_opts
+=( --ssl=on
)
132 scons_opts
+=( --ssl=off
)
135 if use free-mon
; then
136 scons_opts
+=( --enable-free-mon=on
)
138 scons_opts
+=( --enable-free-mon=off
)
142 scons_opts
+=( --linker=gold
)
144 scons_opts
+=( --linker=bfd
)
147 if use http-client
; then
148 scons_opts
+=( --enable-http-client=on
)
150 scons_opts
+=( --enable-http-client=off
)
153 if use ocsp-stapling
; then
154 scons_opts
+=( --ocsp-stapling=on
)
156 scons_opts
+=( --ocsp-stapling=off
)
159 if use kerberos
; then
160 scons_opts
+=( --use-sasl-client )
163 if use tcmalloc
; then
164 scons_opts
+=( --allocator=tcmalloc
)
165 elif use tcmalloc-experimental
; then
166 scons_opts
+=( --allocator=tcmalloc-experimental
)
168 scons_opts
+=( --allocator=system
)
171 if use server-js
; then
184 scons_opts
+=( --lto=on
)
186 scons_opts
+=( --lto=off
)
189 if use experimental-optimization
; then
191 --experimental-optimization="*"
192 --experimental-optimization="-sandybridge"
196 if use runtime-hardening
; then
197 scons_opts
+=( --runtime-hardening=on
)
198 if use experimental-runtime-hardening
; then
199 scons_opts
+=( --experimental-runtime-hardening="*" )
202 scons_opts
+=( --runtime-hardening=off
)
206 scons_opts
+=( --dbg=on
)
208 scons_opts
+=( --dbg=off
)
215 PREFIX
="${EPREFIX}/usr" .
/buildscripts
/scons.py
"${scons_opts[@]}" install-core || die
217 $
(tc-getSTRIP
) "--strip-unneeded" "${S}/build/install/bin/mongo"
218 $
(tc-getSTRIP
) "--strip-unneeded" "${S}/build/install/bin/mongod"
219 $
(tc-getSTRIP
) "--strip-unneeded" "${S}/build/install/bin/mongos"
223 dobin build
/install
/bin
/{mongo
,mongod
,mongos
}
225 doman debian
/mongo
*.1
226 dodoc build
/install
/README docs
/building.md
228 newinitd
"${FILESDIR}/${PN}.initd-r3" ${PN}
229 newconfd "${FILESDIR}/${PN}.confd-r3" ${PN}
230 newinitd
"${FILESDIR}/mongos.initd-r3" mongos
231 newconfd
"${FILESDIR}/mongos.confd-r3" mongos
234 newins
"${FILESDIR}/${PN}.conf-r3" ${PN}.conf
235 newins "${FILESDIR}/mongos.conf-r2
" mongos.conf
237 systemd_dounit "${FILESDIR}/${PN}.service
"
239 insinto /etc/logrotate.d/
240 newins "${FILESDIR}/${PN}.logrotate" ${PN}
243 pax-mark emr
"${ED}"/usr
/bin
/{mongo
,mongod
,mongos
}
246 for x
in /var
/{lib
,log
}/${PN}; do
247 diropts
-m0750 -o mongodb
-g mongodb
253 ewarn
"Make sure to read the release notes and follow the upgrade process:"
254 ewarn
" https://docs.mongodb.com/manual/release-notes/$(ver_cut 1-2)/"
255 ewarn
" https://docs.mongodb.com/manual/release-notes/$(ver_cut 1-2)/#upgrade-procedures"