net-im/tencent-qq: bump version to 3.2.15_p241224
[gentoo-zh.git] / dev-db / mongodb / mongodb-5.3.1.ebuild
blobcc23aba2cd7f5d70849441ecab1bb8239b46e35e
1 # Copyright 1999-2023 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
4 EAPI=8
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"
17 SLOT="rapid"
18 KEYWORDS="~amd64"
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"
22 IUSE+=" ${CPU_FLAGS}"
23 SRC_URI="https://github.com/mongodb/mongo/archive/r${PV}.tar.gz"
25 REQUIRED_USE="
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
32 RESTRICT="test"
34 RDEPEND="acct-group/mongodb
35 acct-user/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]
40 app-arch/zstd:=
41 dev-libs/snowball-stemmer:=
42 net-libs/libpcap
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] )
47 ssl? (
48 >=dev-libs/openssl-1.0.1g:0=
52 DEPEND="${RDEPEND}
53 ${PYTHON_DEPS}
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}]
62 sys-libs/ncurses:0=
63 sys-libs/readline:0=
64 debug? ( dev-util/valgrind )
65 !dev-db/mongodb:0
68 PDEPEND="
69 mongosh? ( app-admin/mongosh-bin )
70 tools? ( >=app-admin/mongo-tools-100 )
73 PATCHES=( ${FILESDIR}/mongodb-5.0.2-skip-reqs-check.patch )
75 python_check_deps() {
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}
85 pkg_pretend() {
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
95 src_prepare() {
96 default
99 src_configure() {
100 scons_opts=(
101 AR="ar"
102 CC="gcc"
103 CXX="g++"
104 CCFLAGS="-march=native -pipe -DBOOST_LOG_DYN_LINK ${CCFLAGS}"
105 MONGO_VERSION=${PV}
107 --jobs=$(makeopts_jobs)
108 --release
109 --disable-warnings-as-errors
110 --use-system-boost
111 --use-system-pcre
112 --use-system-snappy
113 --use-system-stemmer
114 --use-system-yaml
115 --use-system-zlib
116 --use-system-zstd
117 --use-diagnostic-latches=on
118 --use-hardware-crc32=on
119 --wiredtiger=on
120 --link-model=auto
121 --opt=on
122 --use-libunwind=auto
123 --build-tools=next
124 --cxx-std=20
125 --visibility-support=on
126 --enable-usdt-probes=off
129 if use ssl; then
130 scons_opts+=( --ssl=on )
131 else
132 scons_opts+=( --ssl=off )
135 if use free-mon; then
136 scons_opts+=( --enable-free-mon=on )
137 else
138 scons_opts+=( --enable-free-mon=off )
141 if use gold; then
142 scons_opts+=( --linker=gold )
143 else
144 scons_opts+=( --linker=bfd )
147 if use http-client; then
148 scons_opts+=( --enable-http-client=on )
149 else
150 scons_opts+=( --enable-http-client=off )
153 if use ocsp-stapling; then
154 scons_opts+=( --ocsp-stapling=on )
155 else
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 )
167 else
168 scons_opts+=( --allocator=system )
171 if use server-js; then
172 scons_opts+=(
173 --js-engine=mozjs
174 --server-js=on
176 else
177 scons_opts+=(
178 --js-engine=none
179 --server-js=off
183 if use lto; then
184 scons_opts+=( --lto=on )
185 else
186 scons_opts+=( --lto=off )
189 if use experimental-optimization; then
190 scons_opts+=(
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="*" )
201 else
202 scons_opts+=( --runtime-hardening=off )
205 if use debug; then
206 scons_opts+=( --dbg=on )
207 else
208 scons_opts+=( --dbg=off )
211 default
214 src_compile() {
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"
222 src_install() {
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
233 insinto /etc
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}
242 # see bug #526114
243 pax-mark emr "${ED}"/usr/bin/{mongo,mongod,mongos}
245 local x
246 for x in /var/{lib,log}/${PN}; do
247 diropts -m0750 -o mongodb -g mongodb
248 keepdir "${x}"
249 done
252 pkg_postinst() {
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"