Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 1 | SUMMARY = "mongodb" |
| 2 | LICENSE = "SSPL-1 & Apache-2.0 & Zlib" |
| 3 | LIC_FILES_CHKSUM = "file://LICENSE-Community.txt;md5=3a865f27f11f43ecbe542d9ea387dcf1 \ |
| 4 | file://APACHE-2.0.txt;md5=3b83ef96387f14655fc854ddc3c6bd57" |
| 5 | |
| 6 | DEPENDS = "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 Geissler | d688a01 | 2020-09-18 13:36:00 -0500 | [diff] [blame] | 12 | inherit scons dos2unix siteinfo python3native systemd useradd |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 13 | |
Andrew Geissler | 220dafd | 2023-10-04 10:18:08 -0500 | [diff] [blame] | 14 | PV = "4.4.24" |
| 15 | #v4.4.24 |
| 16 | SRCREV = "0b86b9b7b42ad9970c5f818c527dd86c0634243a" |
Andrew Geissler | 595f630 | 2022-01-24 19:11:47 +0000 | [diff] [blame] | 17 | SRC_URI = "git://github.com/mongodb/mongo.git;branch=v4.4;protocol=https \ |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 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 \ |
Andrew Geissler | d688a01 | 2020-09-18 13:36:00 -0500 | [diff] [blame] | 27 | file://0001-Fix-compilation-with-fno-common.patch \ |
| 28 | file://0001-stacktrace-Define-ARCH_BITS-for-x86.patch \ |
Andrew Geissler | 97771a3 | 2021-03-05 15:23:11 -0600 | [diff] [blame] | 29 | file://0001-include-needed-c-header.patch \ |
Andrew Geissler | 32b1199 | 2021-03-31 13:37:05 -0500 | [diff] [blame] | 30 | file://disable_runtime_check.patch \ |
| 31 | file://ppc64_ARCH_BITS.patch \ |
Patrick Williams | 03907ee | 2022-05-01 06:28:52 -0500 | [diff] [blame] | 32 | file://0001-add-explict-static_cast-size_t-to-maxMemoryUsageByte.patch \ |
| 33 | file://0001-server-Adjust-the-cache-alignment-assumptions.patch \ |
Patrick Williams | 92b42cb | 2022-09-03 06:53:57 -0500 | [diff] [blame] | 34 | file://0001-The-std-lib-unary-binary_function-base-classes-are-d.patch \ |
Patrick Williams | 864cc43 | 2023-02-09 14:54:44 -0600 | [diff] [blame] | 35 | file://0001-free_mon-Include-missing-cstdint.patch \ |
Andrew Geissler | fc113ea | 2023-03-31 09:59:46 -0500 | [diff] [blame] | 36 | file://0001-apply-msvc-workaround-for-clang-16.patch \ |
| 37 | file://0001-Fix-type-mismatch-on-32bit-arches.patch \ |
Andrew Geissler | 220dafd | 2023-10-04 10:18:08 -0500 | [diff] [blame] | 38 | file://0001-Fix-build-on-32bit.patch \ |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 39 | " |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 40 | SRC_URI:append:libc-musl ="\ |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 41 | file://0001-Mark-one-of-strerror_r-implementation-glibc-specific.patch \ |
| 42 | file://0002-Fix-default-stack-size-to-256K.patch \ |
| 43 | file://0004-wiredtiger-Disable-strtouq-on-musl.patch \ |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 44 | file://0001-wiredtiger-Avoid-using-off64_t.patch \ |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 45 | " |
| 46 | |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 47 | SRC_URI:append:toolchain-clang = "\ |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 48 | file://0001-asio-Dont-use-experimental-with-clang.patch \ |
| 49 | " |
| 50 | |
| 51 | S = "${WORKDIR}/git" |
| 52 | |
Patrick Williams | 2a25492 | 2023-08-11 09:48:11 -0500 | [diff] [blame] | 53 | CVE_STATUS[CVE-2014-8180] = "not-applicable-config: Not affecting our configuration so it can be safely ignored." |
| 54 | CVE_STATUS[CVE-2017-2665] = "not-applicable-config: Not affecting our configuration so it can be safely ignored." |
Patrick Williams | db4c27e | 2022-08-05 08:10:29 -0500 | [diff] [blame] | 55 | |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 56 | COMPATIBLE_HOST ?= '(x86_64|i.86|powerpc64|arm|aarch64).*-linux' |
| 57 | |
| 58 | PACKAGECONFIG ??= "tcmalloc system-pcre" |
| 59 | # gperftools compilation fails for arm below v7 because of missing support of |
| 60 | # dmb operation. So we use system-allocator instead of tcmalloc |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 61 | PACKAGECONFIG:remove:armv6 = "tcmalloc" |
| 62 | PACKAGECONFIG:remove:libc-musl = "tcmalloc" |
| 63 | PACKAGECONFIG:remove:riscv64 = "tcmalloc" |
| 64 | PACKAGECONFIG:remove:riscv32 = "tcmalloc" |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 65 | |
| 66 | PACKAGECONFIG[tcmalloc] = "--use-system-tcmalloc,--allocator=system,gperftools," |
| 67 | PACKAGECONFIG[shell] = ",--js-engine=none,," |
| 68 | PACKAGECONFIG[system-pcre] = "--use-system-pcre,,libpcre," |
| 69 | |
Andrew Geissler | 32b1199 | 2021-03-31 13:37:05 -0500 | [diff] [blame] | 70 | MONGO_ARCH ?= "${HOST_ARCH}" |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 71 | MONGO_ARCH:powerpc64le = "ppc64le" |
Andrew Geissler | 6972109 | 2021-07-23 12:57:00 -0400 | [diff] [blame] | 72 | WIREDTIGER ?= "off" |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 73 | WIREDTIGER:x86-64 = "on" |
| 74 | WIREDTIGER:aarch64 = "on" |
Andrew Geissler | 32b1199 | 2021-03-31 13:37:05 -0500 | [diff] [blame] | 75 | |
Patrick Williams | 864cc43 | 2023-02-09 14:54:44 -0600 | [diff] [blame] | 76 | # ld.gold: fatal error: build/59f4f0dd/mongo/mongod: Structure needs cleaning |
| 77 | LDFLAGS:append:x86:libc-musl = " -fuse-ld=bfd" |
| 78 | LDFLAGS:remove:toolchain-clang = "-fuse-ld=bfd" |
| 79 | |
Andrew Geissler | d688a01 | 2020-09-18 13:36:00 -0500 | [diff] [blame] | 80 | EXTRA_OESCONS = "PREFIX=${prefix} \ |
| 81 | DESTDIR=${D} \ |
Patrick Williams | 864cc43 | 2023-02-09 14:54:44 -0600 | [diff] [blame] | 82 | MAXLINELENGTH='2097152' \ |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 83 | LIBPATH=${STAGING_LIBDIR} \ |
| 84 | LINKFLAGS='${LDFLAGS}' \ |
| 85 | CXXFLAGS='${CXXFLAGS}' \ |
Andrew Geissler | 32b1199 | 2021-03-31 13:37:05 -0500 | [diff] [blame] | 86 | TARGET_ARCH=${MONGO_ARCH} \ |
Andrew Geissler | d688a01 | 2020-09-18 13:36:00 -0500 | [diff] [blame] | 87 | MONGO_VERSION=${PV} \ |
| 88 | OBJCOPY=${OBJCOPY} \ |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 89 | --ssl \ |
| 90 | --disable-warnings-as-errors \ |
| 91 | --use-system-zlib \ |
| 92 | --nostrip \ |
| 93 | --endian=${@oe.utils.conditional('SITEINFO_ENDIANNESS', 'le', 'little', 'big', d)} \ |
Andrew Geissler | 5082cc7 | 2023-09-11 08:41:39 -0400 | [diff] [blame] | 94 | --use-hardware-crc32=${@bb.utils.contains('TUNE_FEATURES', 'crc', 'on', 'off', d)} \ |
Andrew Geissler | 6972109 | 2021-07-23 12:57:00 -0400 | [diff] [blame] | 95 | --wiredtiger='${WIREDTIGER}' \ |
Andrew Geissler | d688a01 | 2020-09-18 13:36:00 -0500 | [diff] [blame] | 96 | --separate-debug \ |
| 97 | ${PACKAGECONFIG_CONFARGS}" |
| 98 | |
Andrew Geissler | d688a01 | 2020-09-18 13:36:00 -0500 | [diff] [blame] | 99 | USERADD_PACKAGES = "${PN}" |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 100 | USERADD_PARAM:${PN} = "--system --no-create-home --home-dir /var/run/${BPN} --shell /bin/false --user-group ${BPN}" |
Andrew Geissler | d688a01 | 2020-09-18 13:36:00 -0500 | [diff] [blame] | 101 | |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 102 | scons_do_compile() { |
Andrew Geissler | 595f630 | 2022-01-24 19:11:47 +0000 | [diff] [blame] | 103 | ${STAGING_BINDIR_NATIVE}/scons ${PARALLEL_MAKE} ${EXTRA_OESCONS} install-core || |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 104 | die "scons build execution failed." |
| 105 | } |
| 106 | |
| 107 | scons_do_install() { |
Andrew Geissler | 595f630 | 2022-01-24 19:11:47 +0000 | [diff] [blame] | 108 | # install binaries |
| 109 | install -d ${D}${bindir} |
| 110 | for i in mongod mongos mongo; do |
Patrick Williams | 864cc43 | 2023-02-09 14:54:44 -0600 | [diff] [blame] | 111 | if [ -f ${B}/build/*/mongo/$i ]; then |
| 112 | install -m 0755 ${B}/build/*/mongo/$i ${D}${bindir} |
Andrew Geissler | 595f630 | 2022-01-24 19:11:47 +0000 | [diff] [blame] | 113 | else |
| 114 | bbnote "$i does not exist" |
| 115 | fi |
| 116 | done |
Andrew Geissler | d688a01 | 2020-09-18 13:36:00 -0500 | [diff] [blame] | 117 | |
Andrew Geissler | 595f630 | 2022-01-24 19:11:47 +0000 | [diff] [blame] | 118 | # install config |
| 119 | install -d ${D}${sysconfdir} |
| 120 | install -m 0644 ${S}/debian/mongod.conf ${D}${sysconfdir} |
Andrew Geissler | d688a01 | 2020-09-18 13:36:00 -0500 | [diff] [blame] | 121 | |
Andrew Geissler | 595f630 | 2022-01-24 19:11:47 +0000 | [diff] [blame] | 122 | # install systemd service |
| 123 | install -d ${D}${systemd_system_unitdir} |
| 124 | install -m 0644 ${S}/debian/mongod.service ${D}${systemd_system_unitdir} |
Andrew Geissler | d688a01 | 2020-09-18 13:36:00 -0500 | [diff] [blame] | 125 | |
Andrew Geissler | 595f630 | 2022-01-24 19:11:47 +0000 | [diff] [blame] | 126 | # install mongo data folder |
| 127 | install -m 755 -d ${D}${localstatedir}/lib/${BPN} |
Patrick Williams | 8e7b46e | 2023-05-01 14:19:06 -0500 | [diff] [blame] | 128 | chown ${BPN}:${BPN} ${D}${localstatedir}/lib/${BPN} |
Andrew Geissler | d688a01 | 2020-09-18 13:36:00 -0500 | [diff] [blame] | 129 | |
Andrew Geissler | 595f630 | 2022-01-24 19:11:47 +0000 | [diff] [blame] | 130 | # Create /var/log/mongodb in runtime. |
| 131 | if [ "${@bb.utils.filter('DISTRO_FEATURES', 'systemd', d)}" ]; then |
| 132 | install -d ${D}${nonarch_libdir}/tmpfiles.d |
| 133 | echo "d ${localstatedir}/log/${BPN} 0755 ${BPN} ${BPN} -" > ${D}${nonarch_libdir}/tmpfiles.d/${BPN}.conf |
| 134 | fi |
| 135 | if [ "${@bb.utils.filter('DISTRO_FEATURES', 'sysvinit', d)}" ]; then |
| 136 | install -d ${D}${sysconfdir}/default/volatiles |
| 137 | echo "d ${BPN} ${BPN} 0755 ${localstatedir}/log/${BPN} none" > ${D}${sysconfdir}/default/volatiles/99_${BPN} |
| 138 | fi |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 139 | } |
Andrew Geissler | d688a01 | 2020-09-18 13:36:00 -0500 | [diff] [blame] | 140 | |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 141 | CONFFILES:${PN} = "${sysconfdir}/mongod.conf" |
Andrew Geissler | d688a01 | 2020-09-18 13:36:00 -0500 | [diff] [blame] | 142 | |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 143 | SYSTEMD_SERVICE:${PN} = "mongod.service" |
Andrew Geissler | 595f630 | 2022-01-24 19:11:47 +0000 | [diff] [blame] | 144 | |
| 145 | FILES:${PN} += "${nonarch_libdir}/tmpfiles.d" |
Andrew Geissler | 220dafd | 2023-10-04 10:18:08 -0500 | [diff] [blame] | 146 | |
| 147 | RDEPENDS:${PN} += "tzdata-core" |