blob: d0c4eba7ee32b67119ed38e980fdf0cef87cdd86 [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 Geisslerd688a012020-09-18 13:36:00 -050014PV = "4.4.1"
15#v4.4.1
16SRCREV = "ad91a93a5a31e175f5cbf8c69561e788bbc55ce1"
17SRC_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 Geissler82c905d2020-04-13 13:39:40 -050031 "
32SRC_URI_append_libc-musl ="\
33 file://0001-Mark-one-of-strerror_r-implementation-glibc-specific.patch \
34 file://0002-Fix-default-stack-size-to-256K.patch \
35 file://0004-wiredtiger-Disable-strtouq-on-musl.patch \
36 "
37
38SRC_URI_append_toolchain-clang = "\
39 file://0001-asio-Dont-use-experimental-with-clang.patch \
40 "
41
Andrew Geisslerd688a012020-09-18 13:36:00 -050042
Andrew Geissler82c905d2020-04-13 13:39:40 -050043S = "${WORKDIR}/git"
44
45COMPATIBLE_HOST ?= '(x86_64|i.86|powerpc64|arm|aarch64).*-linux'
46
47PACKAGECONFIG ??= "tcmalloc system-pcre"
48# gperftools compilation fails for arm below v7 because of missing support of
49# dmb operation. So we use system-allocator instead of tcmalloc
50PACKAGECONFIG_remove_armv6 = "tcmalloc"
51PACKAGECONFIG_remove_libc-musl = "tcmalloc"
52PACKAGECONFIG_remove_riscv64 = "tcmalloc"
53PACKAGECONFIG_remove_riscv32 = "tcmalloc"
54
55PACKAGECONFIG[tcmalloc] = "--use-system-tcmalloc,--allocator=system,gperftools,"
56PACKAGECONFIG[shell] = ",--js-engine=none,,"
57PACKAGECONFIG[system-pcre] = "--use-system-pcre,,libpcre,"
58
Andrew Geisslerd688a012020-09-18 13:36:00 -050059EXTRA_OESCONS = "PREFIX=${prefix} \
60 DESTDIR=${D} \
Andrew Geissler82c905d2020-04-13 13:39:40 -050061 LIBPATH=${STAGING_LIBDIR} \
62 LINKFLAGS='${LDFLAGS}' \
63 CXXFLAGS='${CXXFLAGS}' \
64 TARGET_ARCH=${TARGET_ARCH} \
Andrew Geisslerd688a012020-09-18 13:36:00 -050065 MONGO_VERSION=${PV} \
66 OBJCOPY=${OBJCOPY} \
Andrew Geissler82c905d2020-04-13 13:39:40 -050067 --ssl \
68 --disable-warnings-as-errors \
69 --use-system-zlib \
70 --nostrip \
71 --endian=${@oe.utils.conditional('SITEINFO_ENDIANNESS', 'le', 'little', 'big', d)} \
72 --wiredtiger=${@['off','on'][d.getVar('SITEINFO_BITS') != '32']} \
Andrew Geisslerd688a012020-09-18 13:36:00 -050073 --separate-debug \
74 ${PACKAGECONFIG_CONFARGS}"
75
76
77USERADD_PACKAGES = "${PN}"
78USERADD_PARAM_${PN} = "--system --no-create-home --home-dir /var/run/${BPN} --shell /bin/false --user-group ${BPN}"
79
Andrew Geissler82c905d2020-04-13 13:39:40 -050080
81scons_do_compile() {
Andrew Geisslerd688a012020-09-18 13:36:00 -050082 ${STAGING_BINDIR_NATIVE}/scons ${PARALLEL_MAKE} ${EXTRA_OESCONS} install-core || \
Andrew Geissler82c905d2020-04-13 13:39:40 -050083 die "scons build execution failed."
84}
85
86scons_do_install() {
Andrew Geisslerd688a012020-09-18 13:36:00 -050087 # install binaries
88 install -d ${D}${bindir}
89 for i in mongod mongos mongo
90 do
91 if [ -f ${B}/build/opt/mongo/${i} ]
92 then
93 install -m 0755 ${B}/build/opt/mongo/${i} ${D}${bindir}/${i}
94 else
95 bbnote "${i} does not exist"
96 fi
97 done
98
99 # install config
100 install -d ${D}${sysconfdir}
101 install -m 0644 ${S}/debian/mongod.conf ${D}${sysconfdir}/
102
103 # install systemd service
104 install -d ${D}${systemd_system_unitdir}
105 install -m 0644 ${S}/debian/mongod.service ${D}${systemd_system_unitdir}
106
107 # install mongo data folder
108 install -m 755 -d ${D}${localstatedir}/lib/${BPN}
109 chown ${PN}:${PN} ${D}${localstatedir}/lib/${BPN}
110
111 # Log files
112 install -m 755 -d ${D}${localstatedir}/log/${BPN}
113 chown ${PN}:${PN} ${D}${localstatedir}/log/${BPN}
Andrew Geissler82c905d2020-04-13 13:39:40 -0500114}
Andrew Geisslerd688a012020-09-18 13:36:00 -0500115
116CONFFILES_${PN} = "${sysconfdir}/mongod.conf"
117
118SYSTEMD_SERVICE_${PN} = "mongod.service"
119
120