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