blob: ee5c77a85db68980c371e5840db7697d9f6c05e9 [file] [log] [blame]
Andrew Geissler82c905d2020-04-13 13:39:40 -05001SUMMARY = "mongodb"
2LICENSE = "SSPL-1 & Apache-2.0 & Zlib"
3LIC_FILES_CHKSUM = "file://LICENSE-Community.txt;md5=3a865f27f11f43ecbe542d9ea387dcf1 \
4 file://APACHE-2.0.txt;md5=3b83ef96387f14655fc854ddc3c6bd57"
5
6DEPENDS = "openssl libpcap zlib boost curl python3 \
7 python3-setuptools-native \
8 python3-pyyaml-native python3-cheetah-native \
9 python3-psutil-native python3-regex-native \
10 "
11
Andrew Geisslerd688a012020-09-18 13:36:00 -050012inherit scons dos2unix siteinfo python3native systemd useradd
Andrew Geissler82c905d2020-04-13 13:39:40 -050013
Andrew Geissler220dafd2023-10-04 10:18:08 -050014PV = "4.4.24"
15#v4.4.24
16SRCREV = "0b86b9b7b42ad9970c5f818c527dd86c0634243a"
Andrew Geissler595f6302022-01-24 19:11:47 +000017SRC_URI = "git://github.com/mongodb/mongo.git;branch=v4.4;protocol=https \
Andrew Geissler82c905d2020-04-13 13:39:40 -050018 file://0001-Tell-scons-to-use-build-settings-from-environment-va.patch \
19 file://0001-Use-long-long-instead-of-int64_t.patch \
20 file://0001-Use-__GLIBC__-to-control-use-of-gnu_get_libc_version.patch \
21 file://0002-Add-a-definition-for-the-macro-__ELF_NATIVE_CLASS.patch \
22 file://arm64-support.patch \
23 file://0001-IntelRDFPMathLib20U1-Check-for-__DEFINED_wchar_t.patch \
24 file://0001-Support-deprecated-resolver-functions.patch \
25 file://0003-Fix-unknown-prefix-env.patch \
26 file://1296.patch \
Andrew Geisslerd688a012020-09-18 13:36:00 -050027 file://0001-Fix-compilation-with-fno-common.patch \
28 file://0001-stacktrace-Define-ARCH_BITS-for-x86.patch \
Andrew Geissler97771a32021-03-05 15:23:11 -060029 file://0001-include-needed-c-header.patch \
Andrew Geissler32b11992021-03-31 13:37:05 -050030 file://disable_runtime_check.patch \
31 file://ppc64_ARCH_BITS.patch \
Patrick Williams03907ee2022-05-01 06:28:52 -050032 file://0001-add-explict-static_cast-size_t-to-maxMemoryUsageByte.patch \
33 file://0001-server-Adjust-the-cache-alignment-assumptions.patch \
Patrick Williams92b42cb2022-09-03 06:53:57 -050034 file://0001-The-std-lib-unary-binary_function-base-classes-are-d.patch \
Patrick Williams864cc432023-02-09 14:54:44 -060035 file://0001-free_mon-Include-missing-cstdint.patch \
Andrew Geisslerfc113ea2023-03-31 09:59:46 -050036 file://0001-apply-msvc-workaround-for-clang-16.patch \
37 file://0001-Fix-type-mismatch-on-32bit-arches.patch \
Andrew Geissler220dafd2023-10-04 10:18:08 -050038 file://0001-Fix-build-on-32bit.patch \
Andrew Geissler82c905d2020-04-13 13:39:40 -050039 "
Patrick Williams213cb262021-08-07 19:21:33 -050040SRC_URI:append:libc-musl ="\
Andrew Geissler82c905d2020-04-13 13:39:40 -050041 file://0001-Mark-one-of-strerror_r-implementation-glibc-specific.patch \
42 file://0002-Fix-default-stack-size-to-256K.patch \
43 file://0004-wiredtiger-Disable-strtouq-on-musl.patch \
Andrew Geissler517393d2023-01-13 08:55:19 -060044 file://0001-wiredtiger-Avoid-using-off64_t.patch \
Andrew Geissler82c905d2020-04-13 13:39:40 -050045 "
46
Patrick Williams213cb262021-08-07 19:21:33 -050047SRC_URI:append:toolchain-clang = "\
Andrew Geissler82c905d2020-04-13 13:39:40 -050048 file://0001-asio-Dont-use-experimental-with-clang.patch \
49 "
50
51S = "${WORKDIR}/git"
52
Patrick Williams2a254922023-08-11 09:48:11 -050053CVE_STATUS[CVE-2014-8180] = "not-applicable-config: Not affecting our configuration so it can be safely ignored."
54CVE_STATUS[CVE-2017-2665] = "not-applicable-config: Not affecting our configuration so it can be safely ignored."
Patrick Williamsdb4c27e2022-08-05 08:10:29 -050055
Andrew Geissler82c905d2020-04-13 13:39:40 -050056COMPATIBLE_HOST ?= '(x86_64|i.86|powerpc64|arm|aarch64).*-linux'
57
58PACKAGECONFIG ??= "tcmalloc system-pcre"
59# gperftools compilation fails for arm below v7 because of missing support of
60# dmb operation. So we use system-allocator instead of tcmalloc
Patrick Williams213cb262021-08-07 19:21:33 -050061PACKAGECONFIG:remove:armv6 = "tcmalloc"
62PACKAGECONFIG:remove:libc-musl = "tcmalloc"
63PACKAGECONFIG:remove:riscv64 = "tcmalloc"
64PACKAGECONFIG:remove:riscv32 = "tcmalloc"
Andrew Geissler82c905d2020-04-13 13:39:40 -050065
66PACKAGECONFIG[tcmalloc] = "--use-system-tcmalloc,--allocator=system,gperftools,"
67PACKAGECONFIG[shell] = ",--js-engine=none,,"
68PACKAGECONFIG[system-pcre] = "--use-system-pcre,,libpcre,"
69
Andrew Geissler32b11992021-03-31 13:37:05 -050070MONGO_ARCH ?= "${HOST_ARCH}"
Patrick Williams213cb262021-08-07 19:21:33 -050071MONGO_ARCH:powerpc64le = "ppc64le"
Andrew Geissler69721092021-07-23 12:57:00 -040072WIREDTIGER ?= "off"
Patrick Williams213cb262021-08-07 19:21:33 -050073WIREDTIGER:x86-64 = "on"
74WIREDTIGER:aarch64 = "on"
Andrew Geissler32b11992021-03-31 13:37:05 -050075
Patrick Williams864cc432023-02-09 14:54:44 -060076# ld.gold: fatal error: build/59f4f0dd/mongo/mongod: Structure needs cleaning
77LDFLAGS:append:x86:libc-musl = " -fuse-ld=bfd"
78LDFLAGS:remove:toolchain-clang = "-fuse-ld=bfd"
79
Andrew Geisslerd688a012020-09-18 13:36:00 -050080EXTRA_OESCONS = "PREFIX=${prefix} \
81 DESTDIR=${D} \
Patrick Williams864cc432023-02-09 14:54:44 -060082 MAXLINELENGTH='2097152' \
Andrew Geissler82c905d2020-04-13 13:39:40 -050083 LIBPATH=${STAGING_LIBDIR} \
84 LINKFLAGS='${LDFLAGS}' \
85 CXXFLAGS='${CXXFLAGS}' \
Andrew Geissler32b11992021-03-31 13:37:05 -050086 TARGET_ARCH=${MONGO_ARCH} \
Andrew Geisslerd688a012020-09-18 13:36:00 -050087 MONGO_VERSION=${PV} \
88 OBJCOPY=${OBJCOPY} \
Andrew Geissler82c905d2020-04-13 13:39:40 -050089 --ssl \
90 --disable-warnings-as-errors \
91 --use-system-zlib \
92 --nostrip \
93 --endian=${@oe.utils.conditional('SITEINFO_ENDIANNESS', 'le', 'little', 'big', d)} \
Andrew Geissler5082cc72023-09-11 08:41:39 -040094 --use-hardware-crc32=${@bb.utils.contains('TUNE_FEATURES', 'crc', 'on', 'off', d)} \
Andrew Geissler69721092021-07-23 12:57:00 -040095 --wiredtiger='${WIREDTIGER}' \
Andrew Geisslerd688a012020-09-18 13:36:00 -050096 --separate-debug \
97 ${PACKAGECONFIG_CONFARGS}"
98
Andrew Geisslerd688a012020-09-18 13:36:00 -050099USERADD_PACKAGES = "${PN}"
Patrick Williams213cb262021-08-07 19:21:33 -0500100USERADD_PARAM:${PN} = "--system --no-create-home --home-dir /var/run/${BPN} --shell /bin/false --user-group ${BPN}"
Andrew Geisslerd688a012020-09-18 13:36:00 -0500101
Andrew Geissler82c905d2020-04-13 13:39:40 -0500102scons_do_compile() {
Andrew Geissler595f6302022-01-24 19:11:47 +0000103 ${STAGING_BINDIR_NATIVE}/scons ${PARALLEL_MAKE} ${EXTRA_OESCONS} install-core ||
Andrew Geissler82c905d2020-04-13 13:39:40 -0500104 die "scons build execution failed."
105}
106
107scons_do_install() {
Andrew Geissler595f6302022-01-24 19:11:47 +0000108 # install binaries
109 install -d ${D}${bindir}
110 for i in mongod mongos mongo; do
Patrick Williams864cc432023-02-09 14:54:44 -0600111 if [ -f ${B}/build/*/mongo/$i ]; then
112 install -m 0755 ${B}/build/*/mongo/$i ${D}${bindir}
Andrew Geissler595f6302022-01-24 19:11:47 +0000113 else
114 bbnote "$i does not exist"
115 fi
116 done
Andrew Geisslerd688a012020-09-18 13:36:00 -0500117
Andrew Geissler595f6302022-01-24 19:11:47 +0000118 # install config
119 install -d ${D}${sysconfdir}
120 install -m 0644 ${S}/debian/mongod.conf ${D}${sysconfdir}
Andrew Geisslerd688a012020-09-18 13:36:00 -0500121
Andrew Geissler595f6302022-01-24 19:11:47 +0000122 # install systemd service
123 install -d ${D}${systemd_system_unitdir}
124 install -m 0644 ${S}/debian/mongod.service ${D}${systemd_system_unitdir}
Andrew Geisslerd688a012020-09-18 13:36:00 -0500125
Andrew Geissler595f6302022-01-24 19:11:47 +0000126 # install mongo data folder
127 install -m 755 -d ${D}${localstatedir}/lib/${BPN}
Patrick Williams8e7b46e2023-05-01 14:19:06 -0500128 chown ${BPN}:${BPN} ${D}${localstatedir}/lib/${BPN}
Andrew Geisslerd688a012020-09-18 13:36:00 -0500129
Andrew Geissler595f6302022-01-24 19:11:47 +0000130 # Create /var/log/mongodb in runtime.
131 if [ "${@bb.utils.filter('DISTRO_FEATURES', 'systemd', d)}" ]; then
132 install -d ${D}${nonarch_libdir}/tmpfiles.d
133 echo "d ${localstatedir}/log/${BPN} 0755 ${BPN} ${BPN} -" > ${D}${nonarch_libdir}/tmpfiles.d/${BPN}.conf
134 fi
135 if [ "${@bb.utils.filter('DISTRO_FEATURES', 'sysvinit', d)}" ]; then
136 install -d ${D}${sysconfdir}/default/volatiles
137 echo "d ${BPN} ${BPN} 0755 ${localstatedir}/log/${BPN} none" > ${D}${sysconfdir}/default/volatiles/99_${BPN}
138 fi
Andrew Geissler82c905d2020-04-13 13:39:40 -0500139}
Andrew Geisslerd688a012020-09-18 13:36:00 -0500140
Patrick Williams213cb262021-08-07 19:21:33 -0500141CONFFILES:${PN} = "${sysconfdir}/mongod.conf"
Andrew Geisslerd688a012020-09-18 13:36:00 -0500142
Patrick Williams213cb262021-08-07 19:21:33 -0500143SYSTEMD_SERVICE:${PN} = "mongod.service"
Andrew Geissler595f6302022-01-24 19:11:47 +0000144
145FILES:${PN} += "${nonarch_libdir}/tmpfiles.d"
Andrew Geissler220dafd2023-10-04 10:18:08 -0500146
147RDEPENDS:${PN} += "tzdata-core"
Patrick Williams705982a2024-01-12 09:51:57 -0600148
149SKIP_RECIPE[mongodb] ?= "Needs porting to python 3.12"