mongodb_git.bb 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  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. DEPENDS = "openssl libpcap zlib boost curl python3 \
  6. python3-setuptools-native \
  7. python3-pyyaml-native python3-cheetah-native \
  8. python3-psutil-native python3-regex-native \
  9. "
  10. inherit scons dos2unix siteinfo python3native systemd useradd
  11. PV = "4.4.24"
  12. #v4.4.24
  13. SRCREV = "0b86b9b7b42ad9970c5f818c527dd86c0634243a"
  14. SRC_URI = "git://github.com/mongodb/mongo.git;branch=v4.4;protocol=https \
  15. file://0001-Tell-scons-to-use-build-settings-from-environment-va.patch \
  16. file://0001-Use-long-long-instead-of-int64_t.patch \
  17. file://0001-Use-__GLIBC__-to-control-use-of-gnu_get_libc_version.patch \
  18. file://0002-Add-a-definition-for-the-macro-__ELF_NATIVE_CLASS.patch \
  19. file://arm64-support.patch \
  20. file://0001-IntelRDFPMathLib20U1-Check-for-__DEFINED_wchar_t.patch \
  21. file://0001-Support-deprecated-resolver-functions.patch \
  22. file://0003-Fix-unknown-prefix-env.patch \
  23. file://1296.patch \
  24. file://0001-Fix-compilation-with-fno-common.patch \
  25. file://0001-stacktrace-Define-ARCH_BITS-for-x86.patch \
  26. file://0001-include-needed-c-header.patch \
  27. file://disable_runtime_check.patch \
  28. file://ppc64_ARCH_BITS.patch \
  29. file://0001-add-explict-static_cast-size_t-to-maxMemoryUsageByte.patch \
  30. file://0001-server-Adjust-the-cache-alignment-assumptions.patch \
  31. file://0001-The-std-lib-unary-binary_function-base-classes-are-d.patch \
  32. file://0001-free_mon-Include-missing-cstdint.patch \
  33. file://0001-apply-msvc-workaround-for-clang-16.patch \
  34. file://0001-Fix-type-mismatch-on-32bit-arches.patch \
  35. file://0001-Fix-build-on-32bit.patch \
  36. "
  37. SRC_URI:append:libc-musl = "\
  38. file://0001-Mark-one-of-strerror_r-implementation-glibc-specific.patch \
  39. file://0002-Fix-default-stack-size-to-256K.patch \
  40. file://0004-wiredtiger-Disable-strtouq-on-musl.patch \
  41. file://0001-wiredtiger-Avoid-using-off64_t.patch \
  42. "
  43. SRC_URI:append:toolchain-clang = "\
  44. file://0001-asio-Dont-use-experimental-with-clang.patch \
  45. "
  46. S = "${WORKDIR}/git"
  47. CVE_STATUS[CVE-2014-8180] = "not-applicable-config: Not affecting our configuration so it can be safely ignored."
  48. CVE_STATUS[CVE-2017-2665] = "not-applicable-config: Not affecting our configuration so it can be safely ignored."
  49. COMPATIBLE_HOST ?= '(x86_64|i.86|powerpc64|arm|aarch64).*-linux'
  50. PACKAGECONFIG ??= "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
  53. PACKAGECONFIG:remove:armv6 = "tcmalloc"
  54. PACKAGECONFIG:remove:libc-musl = "tcmalloc"
  55. PACKAGECONFIG:remove:riscv64 = "tcmalloc"
  56. PACKAGECONFIG:remove:riscv32 = "tcmalloc"
  57. PACKAGECONFIG[tcmalloc] = "--use-system-tcmalloc,--allocator=system,gperftools,"
  58. PACKAGECONFIG[shell] = ",--js-engine=none,,"
  59. PACKAGECONFIG[system-pcre] = "--use-system-pcre,,libpcre,"
  60. MONGO_ARCH ?= "${HOST_ARCH}"
  61. MONGO_ARCH:powerpc64le = "ppc64le"
  62. WIREDTIGER ?= "off"
  63. WIREDTIGER:x86-64 = "on"
  64. WIREDTIGER:aarch64 = "on"
  65. EXTRA_OESCONS = "PREFIX=${prefix} \
  66. DESTDIR=${D} \
  67. MAXLINELENGTH='2097152' \
  68. LIBPATH=${STAGING_LIBDIR} \
  69. LINKFLAGS='${LDFLAGS}' \
  70. CXXFLAGS='${CXXFLAGS}' \
  71. TARGET_ARCH=${MONGO_ARCH} \
  72. MONGO_VERSION=${PV} \
  73. OBJCOPY=${OBJCOPY} \
  74. --ssl \
  75. --disable-warnings-as-errors \
  76. --use-system-zlib \
  77. --nostrip \
  78. --endian=${@oe.utils.conditional('SITEINFO_ENDIANNESS', 'le', 'little', 'big', d)} \
  79. --use-hardware-crc32=${@bb.utils.contains('TUNE_FEATURES', 'crc', 'on', 'off', d)} \
  80. --wiredtiger='${WIREDTIGER}' \
  81. --separate-debug \
  82. ${PACKAGECONFIG_CONFARGS}"
  83. USERADD_PACKAGES = "${PN}"
  84. USERADD_PARAM:${PN} = "--system --no-create-home --home-dir /var/run/${BPN} --shell /bin/false --user-group ${BPN}"
  85. scons_do_compile() {
  86. ${STAGING_BINDIR_NATIVE}/scons ${PARALLEL_MAKE} ${EXTRA_OESCONS} install-core ||
  87. die "scons build execution failed."
  88. }
  89. scons_do_install() {
  90. # install binaries
  91. install -d ${D}${bindir}
  92. for i in mongod mongos mongo; do
  93. if [ -f ${B}/build/*/mongo/$i ]; then
  94. install -m 0755 ${B}/build/*/mongo/$i ${D}${bindir}
  95. else
  96. bbnote "$i does not exist"
  97. fi
  98. done
  99. # install config
  100. install -d ${D}${sysconfdir}
  101. install -m 0644 ${S}/debian/mongod.conf ${D}${sysconfdir}
  102. # install systemd service
  103. install -d ${D}${systemd_system_unitdir}
  104. install -m 0644 ${S}/debian/mongod.service ${D}${systemd_system_unitdir}
  105. # install mongo data folder
  106. install -m 755 -d ${D}${localstatedir}/lib/${BPN}
  107. chown ${BPN}:${BPN} ${D}${localstatedir}/lib/${BPN}
  108. # Create /var/log/mongodb in runtime.
  109. if [ "${@bb.utils.filter('DISTRO_FEATURES', 'systemd', d)}" ]; then
  110. install -d ${D}${nonarch_libdir}/tmpfiles.d
  111. echo "d ${localstatedir}/log/${BPN} 0755 ${BPN} ${BPN} -" > ${D}${nonarch_libdir}/tmpfiles.d/${BPN}.conf
  112. fi
  113. if [ "${@bb.utils.filter('DISTRO_FEATURES', 'sysvinit', d)}" ]; then
  114. install -d ${D}${sysconfdir}/default/volatiles
  115. echo "d ${BPN} ${BPN} 0755 ${localstatedir}/log/${BPN} none" > ${D}${sysconfdir}/default/volatiles/99_${BPN}
  116. fi
  117. }
  118. CONFFILES:${PN} = "${sysconfdir}/mongod.conf"
  119. SYSTEMD_SERVICE:${PN} = "mongod.service"
  120. FILES:${PN} += "${nonarch_libdir}/tmpfiles.d"
  121. RDEPENDS:${PN} += "tzdata-core"
  122. SKIP_RECIPE[mongodb] ?= "Needs porting to python 3.12"