blob: 95e0cf7a8843dc47e03718a2add1cab2363acc0c [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
William A. Kennington IIIb95905d2021-06-02 12:40:56 -070014PV = "4.4.6"
15#v4.4.6
16SRCREV = "72e66213c2c3eab37d9358d5e78ad7f5c1d0d0d7"
Andrew Geisslerd688a012020-09-18 13:36:00 -050017SRC_URI = "git://github.com/mongodb/mongo.git;branch=v4.4 \
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 \
William A. Kennington IIIb95905d2021-06-02 12:40:56 -070032 file://0001-Do-not-use-MINSIGSTKSZ.patch \
33 file://0001-Use-explicit-typecast-to-size_t.patch \
Andrew Geissler82c905d2020-04-13 13:39:40 -050034 "
35SRC_URI_append_libc-musl ="\
36 file://0001-Mark-one-of-strerror_r-implementation-glibc-specific.patch \
37 file://0002-Fix-default-stack-size-to-256K.patch \
38 file://0004-wiredtiger-Disable-strtouq-on-musl.patch \
39 "
40
41SRC_URI_append_toolchain-clang = "\
42 file://0001-asio-Dont-use-experimental-with-clang.patch \
43 "
44
Andrew Geisslerd688a012020-09-18 13:36:00 -050045
Andrew Geissler82c905d2020-04-13 13:39:40 -050046S = "${WORKDIR}/git"
47
48COMPATIBLE_HOST ?= '(x86_64|i.86|powerpc64|arm|aarch64).*-linux'
49
50PACKAGECONFIG ??= "tcmalloc system-pcre"
51# gperftools compilation fails for arm below v7 because of missing support of
52# dmb operation. So we use system-allocator instead of tcmalloc
53PACKAGECONFIG_remove_armv6 = "tcmalloc"
54PACKAGECONFIG_remove_libc-musl = "tcmalloc"
55PACKAGECONFIG_remove_riscv64 = "tcmalloc"
56PACKAGECONFIG_remove_riscv32 = "tcmalloc"
57
58PACKAGECONFIG[tcmalloc] = "--use-system-tcmalloc,--allocator=system,gperftools,"
59PACKAGECONFIG[shell] = ",--js-engine=none,,"
60PACKAGECONFIG[system-pcre] = "--use-system-pcre,,libpcre,"
61
Andrew Geissler32b11992021-03-31 13:37:05 -050062MONGO_ARCH ?= "${HOST_ARCH}"
63MONGO_ARCH_powerpc64le = "ppc64le"
64
Andrew Geisslerd688a012020-09-18 13:36:00 -050065EXTRA_OESCONS = "PREFIX=${prefix} \
66 DESTDIR=${D} \
Andrew Geissler82c905d2020-04-13 13:39:40 -050067 LIBPATH=${STAGING_LIBDIR} \
68 LINKFLAGS='${LDFLAGS}' \
69 CXXFLAGS='${CXXFLAGS}' \
Andrew Geissler32b11992021-03-31 13:37:05 -050070 TARGET_ARCH=${MONGO_ARCH} \
Andrew Geisslerd688a012020-09-18 13:36:00 -050071 MONGO_VERSION=${PV} \
72 OBJCOPY=${OBJCOPY} \
Andrew Geissler82c905d2020-04-13 13:39:40 -050073 --ssl \
74 --disable-warnings-as-errors \
75 --use-system-zlib \
76 --nostrip \
77 --endian=${@oe.utils.conditional('SITEINFO_ENDIANNESS', 'le', 'little', 'big', d)} \
78 --wiredtiger=${@['off','on'][d.getVar('SITEINFO_BITS') != '32']} \
Andrew Geisslerd688a012020-09-18 13:36:00 -050079 --separate-debug \
80 ${PACKAGECONFIG_CONFARGS}"
81
82
83USERADD_PACKAGES = "${PN}"
84USERADD_PARAM_${PN} = "--system --no-create-home --home-dir /var/run/${BPN} --shell /bin/false --user-group ${BPN}"
85
Andrew Geissler82c905d2020-04-13 13:39:40 -050086
87scons_do_compile() {
Andrew Geisslerd688a012020-09-18 13:36:00 -050088 ${STAGING_BINDIR_NATIVE}/scons ${PARALLEL_MAKE} ${EXTRA_OESCONS} install-core || \
Andrew Geissler82c905d2020-04-13 13:39:40 -050089 die "scons build execution failed."
90}
91
92scons_do_install() {
Andrew Geisslerd688a012020-09-18 13:36:00 -050093 # install binaries
94 install -d ${D}${bindir}
95 for i in mongod mongos mongo
96 do
97 if [ -f ${B}/build/opt/mongo/${i} ]
98 then
99 install -m 0755 ${B}/build/opt/mongo/${i} ${D}${bindir}/${i}
100 else
101 bbnote "${i} does not exist"
102 fi
103 done
104
105 # install config
106 install -d ${D}${sysconfdir}
107 install -m 0644 ${S}/debian/mongod.conf ${D}${sysconfdir}/
108
109 # install systemd service
110 install -d ${D}${systemd_system_unitdir}
111 install -m 0644 ${S}/debian/mongod.service ${D}${systemd_system_unitdir}
112
113 # install mongo data folder
114 install -m 755 -d ${D}${localstatedir}/lib/${BPN}
115 chown ${PN}:${PN} ${D}${localstatedir}/lib/${BPN}
116
117 # Log files
118 install -m 755 -d ${D}${localstatedir}/log/${BPN}
119 chown ${PN}:${PN} ${D}${localstatedir}/log/${BPN}
Andrew Geissler82c905d2020-04-13 13:39:40 -0500120}
Andrew Geisslerd688a012020-09-18 13:36:00 -0500121
122CONFFILES_${PN} = "${sysconfdir}/mongod.conf"
123
124SYSTEMD_SERVICE_${PN} = "mongod.service"