blob: b78255a0499ff33038a5e22bd9c771935d57721b [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 Geissler32b11992021-03-31 13:37:05 -050014PV = "4.4.4"
15#v4.4.4
16SRCREV = "8db30a63db1a9d84bdcad0c83369623f708e0397"
Andrew Geisslerd688a012020-09-18 13:36:00 -050017SRC_URI = "git://github.com/mongodb/mongo.git;branch=v4.4 \
18 file://0001-kms-message-bump-libmongocrypto-to-v1.0.4.patch \
Andrew Geissler82c905d2020-04-13 13:39:40 -050019 file://0001-Tell-scons-to-use-build-settings-from-environment-va.patch \
20 file://0001-Use-long-long-instead-of-int64_t.patch \
21 file://0001-Use-__GLIBC__-to-control-use-of-gnu_get_libc_version.patch \
22 file://0002-Add-a-definition-for-the-macro-__ELF_NATIVE_CLASS.patch \
23 file://arm64-support.patch \
24 file://0001-IntelRDFPMathLib20U1-Check-for-__DEFINED_wchar_t.patch \
25 file://0001-Support-deprecated-resolver-functions.patch \
26 file://0003-Fix-unknown-prefix-env.patch \
27 file://1296.patch \
Andrew Geisslerd688a012020-09-18 13:36:00 -050028 file://0001-Fix-compilation-with-fno-common.patch \
29 file://0001-stacktrace-Define-ARCH_BITS-for-x86.patch \
Andrew Geissler97771a32021-03-05 15:23:11 -060030 file://0001-include-needed-c-header.patch \
Andrew Geissler32b11992021-03-31 13:37:05 -050031 file://disable_runtime_check.patch \
32 file://ppc64_ARCH_BITS.patch \
Andrew Geissler82c905d2020-04-13 13:39:40 -050033 "
34SRC_URI_append_libc-musl ="\
35 file://0001-Mark-one-of-strerror_r-implementation-glibc-specific.patch \
36 file://0002-Fix-default-stack-size-to-256K.patch \
37 file://0004-wiredtiger-Disable-strtouq-on-musl.patch \
38 "
39
40SRC_URI_append_toolchain-clang = "\
41 file://0001-asio-Dont-use-experimental-with-clang.patch \
42 "
43
Andrew Geisslerd688a012020-09-18 13:36:00 -050044
Andrew Geissler82c905d2020-04-13 13:39:40 -050045S = "${WORKDIR}/git"
46
47COMPATIBLE_HOST ?= '(x86_64|i.86|powerpc64|arm|aarch64).*-linux'
48
49PACKAGECONFIG ??= "tcmalloc system-pcre"
50# gperftools compilation fails for arm below v7 because of missing support of
51# dmb operation. So we use system-allocator instead of tcmalloc
52PACKAGECONFIG_remove_armv6 = "tcmalloc"
53PACKAGECONFIG_remove_libc-musl = "tcmalloc"
54PACKAGECONFIG_remove_riscv64 = "tcmalloc"
55PACKAGECONFIG_remove_riscv32 = "tcmalloc"
56
57PACKAGECONFIG[tcmalloc] = "--use-system-tcmalloc,--allocator=system,gperftools,"
58PACKAGECONFIG[shell] = ",--js-engine=none,,"
59PACKAGECONFIG[system-pcre] = "--use-system-pcre,,libpcre,"
60
Andrew Geissler32b11992021-03-31 13:37:05 -050061MONGO_ARCH ?= "${HOST_ARCH}"
62MONGO_ARCH_powerpc64le = "ppc64le"
63
Andrew Geisslerd688a012020-09-18 13:36:00 -050064EXTRA_OESCONS = "PREFIX=${prefix} \
65 DESTDIR=${D} \
Andrew Geissler82c905d2020-04-13 13:39:40 -050066 LIBPATH=${STAGING_LIBDIR} \
67 LINKFLAGS='${LDFLAGS}' \
68 CXXFLAGS='${CXXFLAGS}' \
Andrew Geissler32b11992021-03-31 13:37:05 -050069 TARGET_ARCH=${MONGO_ARCH} \
Andrew Geisslerd688a012020-09-18 13:36:00 -050070 MONGO_VERSION=${PV} \
71 OBJCOPY=${OBJCOPY} \
Andrew Geissler82c905d2020-04-13 13:39:40 -050072 --ssl \
73 --disable-warnings-as-errors \
74 --use-system-zlib \
75 --nostrip \
76 --endian=${@oe.utils.conditional('SITEINFO_ENDIANNESS', 'le', 'little', 'big', d)} \
77 --wiredtiger=${@['off','on'][d.getVar('SITEINFO_BITS') != '32']} \
Andrew Geisslerd688a012020-09-18 13:36:00 -050078 --separate-debug \
79 ${PACKAGECONFIG_CONFARGS}"
80
81
82USERADD_PACKAGES = "${PN}"
83USERADD_PARAM_${PN} = "--system --no-create-home --home-dir /var/run/${BPN} --shell /bin/false --user-group ${BPN}"
84
Andrew Geissler82c905d2020-04-13 13:39:40 -050085
86scons_do_compile() {
Andrew Geisslerd688a012020-09-18 13:36:00 -050087 ${STAGING_BINDIR_NATIVE}/scons ${PARALLEL_MAKE} ${EXTRA_OESCONS} install-core || \
Andrew Geissler82c905d2020-04-13 13:39:40 -050088 die "scons build execution failed."
89}
90
91scons_do_install() {
Andrew Geisslerd688a012020-09-18 13:36:00 -050092 # install binaries
93 install -d ${D}${bindir}
94 for i in mongod mongos mongo
95 do
96 if [ -f ${B}/build/opt/mongo/${i} ]
97 then
98 install -m 0755 ${B}/build/opt/mongo/${i} ${D}${bindir}/${i}
99 else
100 bbnote "${i} does not exist"
101 fi
102 done
103
104 # install config
105 install -d ${D}${sysconfdir}
106 install -m 0644 ${S}/debian/mongod.conf ${D}${sysconfdir}/
107
108 # install systemd service
109 install -d ${D}${systemd_system_unitdir}
110 install -m 0644 ${S}/debian/mongod.service ${D}${systemd_system_unitdir}
111
112 # install mongo data folder
113 install -m 755 -d ${D}${localstatedir}/lib/${BPN}
114 chown ${PN}:${PN} ${D}${localstatedir}/lib/${BPN}
115
116 # Log files
117 install -m 755 -d ${D}${localstatedir}/log/${BPN}
118 chown ${PN}:${PN} ${D}${localstatedir}/log/${BPN}
Andrew Geissler82c905d2020-04-13 13:39:40 -0500119}
Andrew Geisslerd688a012020-09-18 13:36:00 -0500120
121CONFFILES_${PN} = "${sysconfdir}/mongod.conf"
122
123SYSTEMD_SERVICE_${PN} = "mongod.service"