1SUMMARY = "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 12inherit scons dos2unix siteinfo python3native systemd useradd 13 14PV = "4.4.13" 15#v4.4.13 16SRCREV = "df25c71b8674a78e17468f48bcda5285decb9246" 17SRC_URI = "git://github.com/mongodb/mongo.git;branch=v4.4;protocol=https \ 18 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 \ 27 file://0001-Fix-compilation-with-fno-common.patch \ 28 file://0001-stacktrace-Define-ARCH_BITS-for-x86.patch \ 29 file://0001-include-needed-c-header.patch \ 30 file://disable_runtime_check.patch \ 31 file://ppc64_ARCH_BITS.patch \ 32 file://PTHREAD_STACK_MIN.patch \ 33 file://0001-add-explict-static_cast-size_t-to-maxMemoryUsageByte.patch \ 34 file://0001-server-Adjust-the-cache-alignment-assumptions.patch \ 35 " 36SRC_URI:append:libc-musl ="\ 37 file://0001-Mark-one-of-strerror_r-implementation-glibc-specific.patch \ 38 file://0002-Fix-default-stack-size-to-256K.patch \ 39 file://0004-wiredtiger-Disable-strtouq-on-musl.patch \ 40 " 41 42SRC_URI:append:toolchain-clang = "\ 43 file://0001-asio-Dont-use-experimental-with-clang.patch \ 44 " 45 46S = "${WORKDIR}/git" 47 48CVE_CHECK_IGNORE += "\ 49 CVE-2014-8180 \ 50 CVE-2017-18381 \ 51 CVE-2017-2665 \ 52" 53 54COMPATIBLE_HOST ?= '(x86_64|i.86|powerpc64|arm|aarch64).*-linux' 55 56PACKAGECONFIG ??= "tcmalloc system-pcre" 57# gperftools compilation fails for arm below v7 because of missing support of 58# dmb operation. So we use system-allocator instead of tcmalloc 59PACKAGECONFIG:remove:armv6 = "tcmalloc" 60PACKAGECONFIG:remove:libc-musl = "tcmalloc" 61PACKAGECONFIG:remove:riscv64 = "tcmalloc" 62PACKAGECONFIG:remove:riscv32 = "tcmalloc" 63 64PACKAGECONFIG[tcmalloc] = "--use-system-tcmalloc,--allocator=system,gperftools," 65PACKAGECONFIG[shell] = ",--js-engine=none,," 66PACKAGECONFIG[system-pcre] = "--use-system-pcre,,libpcre," 67 68MONGO_ARCH ?= "${HOST_ARCH}" 69MONGO_ARCH:powerpc64le = "ppc64le" 70WIREDTIGER ?= "off" 71WIREDTIGER:x86-64 = "on" 72WIREDTIGER:aarch64 = "on" 73 74EXTRA_OESCONS = "PREFIX=${prefix} \ 75 DESTDIR=${D} \ 76 LIBPATH=${STAGING_LIBDIR} \ 77 LINKFLAGS='${LDFLAGS}' \ 78 CXXFLAGS='${CXXFLAGS}' \ 79 TARGET_ARCH=${MONGO_ARCH} \ 80 MONGO_VERSION=${PV} \ 81 OBJCOPY=${OBJCOPY} \ 82 --ssl \ 83 --disable-warnings-as-errors \ 84 --use-system-zlib \ 85 --nostrip \ 86 --endian=${@oe.utils.conditional('SITEINFO_ENDIANNESS', 'le', 'little', 'big', d)} \ 87 --wiredtiger='${WIREDTIGER}' \ 88 --separate-debug \ 89 ${PACKAGECONFIG_CONFARGS}" 90 91USERADD_PACKAGES = "${PN}" 92USERADD_PARAM:${PN} = "--system --no-create-home --home-dir /var/run/${BPN} --shell /bin/false --user-group ${BPN}" 93 94scons_do_compile() { 95 ${STAGING_BINDIR_NATIVE}/scons ${PARALLEL_MAKE} ${EXTRA_OESCONS} install-core || 96 die "scons build execution failed." 97} 98 99scons_do_install() { 100 # install binaries 101 install -d ${D}${bindir} 102 for i in mongod mongos mongo; do 103 if [ -f ${B}/build/opt/mongo/$i ]; then 104 install -m 0755 ${B}/build/opt/mongo/$i ${D}${bindir} 105 else 106 bbnote "$i does not exist" 107 fi 108 done 109 110 # install config 111 install -d ${D}${sysconfdir} 112 install -m 0644 ${S}/debian/mongod.conf ${D}${sysconfdir} 113 114 # install systemd service 115 install -d ${D}${systemd_system_unitdir} 116 install -m 0644 ${S}/debian/mongod.service ${D}${systemd_system_unitdir} 117 118 # install mongo data folder 119 install -m 755 -d ${D}${localstatedir}/lib/${BPN} 120 chown ${PN}:${PN} ${D}${localstatedir}/lib/${BPN} 121 122 # Create /var/log/mongodb in runtime. 123 if [ "${@bb.utils.filter('DISTRO_FEATURES', 'systemd', d)}" ]; then 124 install -d ${D}${nonarch_libdir}/tmpfiles.d 125 echo "d ${localstatedir}/log/${BPN} 0755 ${BPN} ${BPN} -" > ${D}${nonarch_libdir}/tmpfiles.d/${BPN}.conf 126 fi 127 if [ "${@bb.utils.filter('DISTRO_FEATURES', 'sysvinit', d)}" ]; then 128 install -d ${D}${sysconfdir}/default/volatiles 129 echo "d ${BPN} ${BPN} 0755 ${localstatedir}/log/${BPN} none" > ${D}${sysconfdir}/default/volatiles/99_${BPN} 130 fi 131} 132 133CONFFILES:${PN} = "${sysconfdir}/mongod.conf" 134 135SYSTEMD_SERVICE:${PN} = "mongod.service" 136 137FILES:${PN} += "${nonarch_libdir}/tmpfiles.d" 138