blob: d040ab160baad3fb96c678d6870d8e45c66d0259 [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
Patrick Williams03907ee2022-05-01 06:28:52 -050014PV = "4.4.13"
15#v4.4.13
16SRCREV = "df25c71b8674a78e17468f48bcda5285decb9246"
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 Williams213cb262021-08-07 19:21:33 -050032 file://PTHREAD_STACK_MIN.patch \
Patrick Williams03907ee2022-05-01 06:28:52 -050033 file://0001-add-explict-static_cast-size_t-to-maxMemoryUsageByte.patch \
34 file://0001-server-Adjust-the-cache-alignment-assumptions.patch \
Patrick Williams92b42cb2022-09-03 06:53:57 -050035 file://0001-The-std-lib-unary-binary_function-base-classes-are-d.patch \
Andrew Geissler82c905d2020-04-13 13:39:40 -050036 "
Patrick Williams213cb262021-08-07 19:21:33 -050037SRC_URI:append:libc-musl ="\
Andrew Geissler82c905d2020-04-13 13:39:40 -050038 file://0001-Mark-one-of-strerror_r-implementation-glibc-specific.patch \
39 file://0002-Fix-default-stack-size-to-256K.patch \
40 file://0004-wiredtiger-Disable-strtouq-on-musl.patch \
41 "
42
Patrick Williams213cb262021-08-07 19:21:33 -050043SRC_URI:append:toolchain-clang = "\
Andrew Geissler82c905d2020-04-13 13:39:40 -050044 file://0001-asio-Dont-use-experimental-with-clang.patch \
45 "
46
47S = "${WORKDIR}/git"
48
Patrick Williamsdb4c27e2022-08-05 08:10:29 -050049CVE_CHECK_IGNORE += "\
50 CVE-2014-8180 \
51 CVE-2017-18381 \
52 CVE-2017-2665 \
53"
54
Andrew Geissler82c905d2020-04-13 13:39:40 -050055COMPATIBLE_HOST ?= '(x86_64|i.86|powerpc64|arm|aarch64).*-linux'
56
57PACKAGECONFIG ??= "tcmalloc system-pcre"
58# gperftools compilation fails for arm below v7 because of missing support of
59# dmb operation. So we use system-allocator instead of tcmalloc
Patrick Williams213cb262021-08-07 19:21:33 -050060PACKAGECONFIG:remove:armv6 = "tcmalloc"
61PACKAGECONFIG:remove:libc-musl = "tcmalloc"
62PACKAGECONFIG:remove:riscv64 = "tcmalloc"
63PACKAGECONFIG:remove:riscv32 = "tcmalloc"
Andrew Geissler82c905d2020-04-13 13:39:40 -050064
65PACKAGECONFIG[tcmalloc] = "--use-system-tcmalloc,--allocator=system,gperftools,"
66PACKAGECONFIG[shell] = ",--js-engine=none,,"
67PACKAGECONFIG[system-pcre] = "--use-system-pcre,,libpcre,"
68
Andrew Geissler32b11992021-03-31 13:37:05 -050069MONGO_ARCH ?= "${HOST_ARCH}"
Patrick Williams213cb262021-08-07 19:21:33 -050070MONGO_ARCH:powerpc64le = "ppc64le"
Andrew Geissler69721092021-07-23 12:57:00 -040071WIREDTIGER ?= "off"
Patrick Williams213cb262021-08-07 19:21:33 -050072WIREDTIGER:x86-64 = "on"
73WIREDTIGER:aarch64 = "on"
Andrew Geissler32b11992021-03-31 13:37:05 -050074
Andrew Geisslerd688a012020-09-18 13:36:00 -050075EXTRA_OESCONS = "PREFIX=${prefix} \
76 DESTDIR=${D} \
Andrew Geissler82c905d2020-04-13 13:39:40 -050077 LIBPATH=${STAGING_LIBDIR} \
78 LINKFLAGS='${LDFLAGS}' \
79 CXXFLAGS='${CXXFLAGS}' \
Andrew Geissler32b11992021-03-31 13:37:05 -050080 TARGET_ARCH=${MONGO_ARCH} \
Andrew Geisslerd688a012020-09-18 13:36:00 -050081 MONGO_VERSION=${PV} \
82 OBJCOPY=${OBJCOPY} \
Andrew Geissler82c905d2020-04-13 13:39:40 -050083 --ssl \
84 --disable-warnings-as-errors \
85 --use-system-zlib \
86 --nostrip \
87 --endian=${@oe.utils.conditional('SITEINFO_ENDIANNESS', 'le', 'little', 'big', d)} \
Andrew Geissler69721092021-07-23 12:57:00 -040088 --wiredtiger='${WIREDTIGER}' \
Andrew Geisslerd688a012020-09-18 13:36:00 -050089 --separate-debug \
90 ${PACKAGECONFIG_CONFARGS}"
91
Andrew Geisslerd688a012020-09-18 13:36:00 -050092USERADD_PACKAGES = "${PN}"
Patrick Williams213cb262021-08-07 19:21:33 -050093USERADD_PARAM:${PN} = "--system --no-create-home --home-dir /var/run/${BPN} --shell /bin/false --user-group ${BPN}"
Andrew Geisslerd688a012020-09-18 13:36:00 -050094
Andrew Geissler82c905d2020-04-13 13:39:40 -050095scons_do_compile() {
Andrew Geissler595f6302022-01-24 19:11:47 +000096 ${STAGING_BINDIR_NATIVE}/scons ${PARALLEL_MAKE} ${EXTRA_OESCONS} install-core ||
Andrew Geissler82c905d2020-04-13 13:39:40 -050097 die "scons build execution failed."
98}
99
100scons_do_install() {
Andrew Geissler595f6302022-01-24 19:11:47 +0000101 # install binaries
102 install -d ${D}${bindir}
103 for i in mongod mongos mongo; do
104 if [ -f ${B}/build/opt/mongo/$i ]; then
105 install -m 0755 ${B}/build/opt/mongo/$i ${D}${bindir}
106 else
107 bbnote "$i does not exist"
108 fi
109 done
Andrew Geisslerd688a012020-09-18 13:36:00 -0500110
Andrew Geissler595f6302022-01-24 19:11:47 +0000111 # install config
112 install -d ${D}${sysconfdir}
113 install -m 0644 ${S}/debian/mongod.conf ${D}${sysconfdir}
Andrew Geisslerd688a012020-09-18 13:36:00 -0500114
Andrew Geissler595f6302022-01-24 19:11:47 +0000115 # install systemd service
116 install -d ${D}${systemd_system_unitdir}
117 install -m 0644 ${S}/debian/mongod.service ${D}${systemd_system_unitdir}
Andrew Geisslerd688a012020-09-18 13:36:00 -0500118
Andrew Geissler595f6302022-01-24 19:11:47 +0000119 # install mongo data folder
120 install -m 755 -d ${D}${localstatedir}/lib/${BPN}
121 chown ${PN}:${PN} ${D}${localstatedir}/lib/${BPN}
Andrew Geisslerd688a012020-09-18 13:36:00 -0500122
Andrew Geissler595f6302022-01-24 19:11:47 +0000123 # Create /var/log/mongodb in runtime.
124 if [ "${@bb.utils.filter('DISTRO_FEATURES', 'systemd', d)}" ]; then
125 install -d ${D}${nonarch_libdir}/tmpfiles.d
126 echo "d ${localstatedir}/log/${BPN} 0755 ${BPN} ${BPN} -" > ${D}${nonarch_libdir}/tmpfiles.d/${BPN}.conf
127 fi
128 if [ "${@bb.utils.filter('DISTRO_FEATURES', 'sysvinit', d)}" ]; then
129 install -d ${D}${sysconfdir}/default/volatiles
130 echo "d ${BPN} ${BPN} 0755 ${localstatedir}/log/${BPN} none" > ${D}${sysconfdir}/default/volatiles/99_${BPN}
131 fi
Andrew Geissler82c905d2020-04-13 13:39:40 -0500132}
Andrew Geisslerd688a012020-09-18 13:36:00 -0500133
Patrick Williams213cb262021-08-07 19:21:33 -0500134CONFFILES:${PN} = "${sysconfdir}/mongod.conf"
Andrew Geisslerd688a012020-09-18 13:36:00 -0500135
Patrick Williams213cb262021-08-07 19:21:33 -0500136SYSTEMD_SERVICE:${PN} = "mongod.service"
Andrew Geissler595f6302022-01-24 19:11:47 +0000137
138FILES:${PN} += "${nonarch_libdir}/tmpfiles.d"