diff --git a/databases/mongodb80/Makefile b/databases/mongodb80/Makefile index 54bc6fa6aede..3c016916a285 100644 --- a/databases/mongodb80/Makefile +++ b/databases/mongodb80/Makefile @@ -1,186 +1,215 @@ PORTNAME= mongodb DISTVERSIONPREFIX= r -DISTVERSION= 8.0.12 -PORTREVISION= 12 +DISTVERSION= 8.0.29 CATEGORIES= databases net +MASTER_SITES+= LOCAL/ronald:mongodb_bazel \ + https://codeload.github.com/bazelbuild/bazel-central-registry/tar.gz/${BAZEL_REGISTRY_COMMIT}?dummy=/:bazel_registry \ + https://codeload.github.com/mongodb-forks/rules_poetry/tar.gz/${RULES_POETRY_COMMIT}?dummy=/:rules_poetry PKGNAMESUFFIX= ${DISTVERSION:R:S/.//} - -PATCH_SITES= https://github.com/${GH_ACCOUNT}/${GH_PROJECT}/commit/ -# https://github.com/mongodb/mongo/pull/1619/ -# "Modernize dynamic module loading to work with Python3.12" -PATCHFILES+= 0877732109589e441cbf234dce17ec0e7b614902.patch:-p1 +BAZEL_CACHE_DISTFILE= ${PORTNAME}-${DISTVERSIONFULL}-bazel-repository-cache.tar.gz +BAZEL_REGISTRY_DISTFILE= bazelbuild-bazel-central-registry-${BAZEL_REGISTRY_COMMIT}_GH0.tar.gz +RULES_POETRY_DISTFILE= mongodb-forks-rules_poetry-${RULES_POETRY_COMMIT}_GH0.tar.gz +DISTFILES+= ${BAZEL_CACHE_DISTFILE}:mongodb_bazel \ + ${BAZEL_REGISTRY_DISTFILE}:bazel_registry \ + ${RULES_POETRY_DISTFILE}:rules_poetry MAINTAINER= ronald@FreeBSD.org COMMENT= MongoDB Community Edition (8.0.x Branch) WWW= https://www.mongodb.com/docs/v8.0/ LICENSE= APACHE20 SSPLv1 # mongodb is SSPLv1, C++ driver is APACHE20 LICENSE_COMB= multi LICENSE_NAME_SSPLv1= Server Side Public License Version 1 LICENSE_FILE_SSPLv1= ${WRKSRC}/LICENSE-Community.txt LICENSE_PERMS_SSPLv1= dist-mirror dist-sell pkg-mirror pkg-sell auto-accept -BROKEN_FreeBSD_16= integral_wrapper.hpp:62:51: error: in-class initializer for static data member is not a constant expression +BROKEN_FreeBSD_16= src/third_party/boost/boost/mpl/aux_/integral_wrapper.hpp:71:51: error: in-class initializer for static data member is not a constant expression ONLY_FOR_ARCHS= aarch64 amd64 powerpc64le ONLY_FOR_ARCHS_REASON= only ported to amd64, aarch64, and powerpc64le on FreeBSD; upstream supports arm64, ppc64le, s390x, and x86-64 -BUILD_DEPENDS= ${PY_SETUPTOOLS} \ +BUILD_DEPENDS= bazel:devel/bazel7 \ + bash:shells/bash \ + ${PY_SETUPTOOLS} \ ${PYTHON_PKGNAMEPREFIX}cheetah3>0:devel/py-cheetah3@${PY_FLAVOR} \ ${PYTHON_PKGNAMEPREFIX}distro>0:sysutils/py-distro@${PY_FLAVOR} \ ${PYTHON_PKGNAMEPREFIX}gitpython>0:devel/py-gitpython@${PY_FLAVOR} \ ${PYTHON_PKGNAMEPREFIX}packaging>0:devel/py-packaging@${PY_FLAVOR} \ ${PYTHON_PKGNAMEPREFIX}psutil>0:sysutils/py-psutil@${PY_FLAVOR} \ ${PYTHON_PKGNAMEPREFIX}pymongo>0:databases/py-pymongo@${PY_FLAVOR} \ ${PYTHON_PKGNAMEPREFIX}pyyaml>=3.11:devel/py-pyyaml@${PY_FLAVOR} \ ${PYTHON_PKGNAMEPREFIX}requests>0:www/py-requests@${PY_FLAVOR} \ ${PYTHON_PKGNAMEPREFIX}retry2>0:devel/py-retry2@${PY_FLAVOR} \ git:devel/git@tiny \ - rust-cbindgen>0:devel/rust-cbindgen -# build depends used while running ${WRKSRC}/src/third_party/mozjs/gen-config.sh + rust-cbindgen>0:devel/rust-cbindgen \ + yq:textproc/go-yq +# build depends used while running ${WRKSRC}/src/third_party/mozjs/scripts/gen-config.sh BUILD_DEPENDS+= gm4:devel/m4 \ gsed:textproc/gsed -LIB_DEPENDS= libcurl.so:ftp/curl \ - libsnappy.so:archivers/snappy \ - libstemmer.so:textproc/snowballstemmer \ - libunwind.so:devel/libunwind \ - libyaml-cpp.so:devel/yaml-cpp \ - libzstd.so:archivers/zstd +LIB_DEPENDS= libcurl.so:ftp/curl FLAVORS= default armv80a armv80a_PKGNAMESUFFIX= ${DISTVERSION:R:S/.//}-armv80a -USES= compiler:c++20-lang cpe python:build scons shebangfix ssl -# gmake is used while running ${WRKSRC}/src/third_party/mozjs/gen-config.sh -USES+= gmake pkgconfig +# gmake is used while running ${WRKSRC}/src/third_party/mozjs/scripts/gen-config.sh +USES= compiler:c++20-lang cpe gmake pkgconfig python:build shebangfix ssl CPE_PRODUCT= mongodb -# mozjs tag comes from ${WRKSRC}/src/third_party/mozjs/get-sources.sh -MOZJS_TAG= 5acd3be6c9563ad3e7ca6182285c69a38de47bab +# mozjs tag comes from ${WRKSRC}/src/third_party/mozjs/scripts/import.sh +MOZJS_TAG= 7aeaf7a44d420360bde75db8453636092c3e2f56 +BAZEL_REGISTRY_COMMIT= 5df17720d4367282afb8e5ca27a35199ab7620e4 +RULES_POETRY_COMMIT= 917630033c736c188605cf0f558c34afc1eca540 USE_GITHUB= yes GH_ACCOUNT= mongodb mongodb-forks:mozjs GH_PROJECT= mongo spidermonkey:mozjs GH_TAGNAME= ${MOZJS_TAG}:mozjs USE_RC_SUBR= mongod -SHEBANG_FILES= buildscripts/scons.py -python_OLD_CMD= @python_interpreter@ +SHEBANG_FILES= src/third_party/mozjs/scripts/gen-config.sh HAS_CONFIGURE= yes -CONFIGURE_SCRIPT= gen-config.sh +CONFIGURE_SCRIPT= scripts/gen-config.sh CONFIGURE_ARGS= ${MOZJS_ARCH} \ freebsd CONFIGURE_ENV+= PYTHON3="${PYTHON_CMD}" -MAKE_ARGS= --allocator=system \ - --cxx-std=20 \ - --disable-warnings-as-errors \ - --libc++ \ - --runtime-hardening=on \ - --ssl \ - --use-system-libunwind \ - --use-system-snappy \ - --use-system-stemmer \ - --use-system-yaml \ - --use-system-zlib \ - --use-system-zstd \ - -j${MAKE_JOBS_NUMBER} \ - AR=llvm-ar \ - MONGO_VERSION=${DISTVERSION} \ - VERBOSE=on -ALL_TARGET= install-servers - -CFLAGS+= -DBOOST_NO_CXX98_FUNCTION_BASE +BAZEL= ${LOCALBASE}/bin/bazel +BAZEL_OUTPUT_USER_ROOT= ${WRKDIR}/bazel +BAZEL_REPOSITORY_CACHE=${WRKDIR}/bazel-repository-cache +BAZEL_STARTUP_ARGS= --output_user_root=${BAZEL_OUTPUT_USER_ROOT} +BAZEL_ENV= BAZEL_SH=${LOCALBASE}/bin/bash \ + CC="${CC}" \ + CXX="${CXX}" \ + HOME=${WRKDIR} \ + MONGO_USE_SYSTEM_PYTHON=1 \ + PYTHON_CMD=${PYTHON_CMD} \ + TMPDIR=${WRKDIR} +BAZEL_ARGS= --repository_cache=${BAZEL_REPOSITORY_CACHE} \ + --distdir=${DISTDIR} \ + --registry=file://${BAZEL_REGISTRY_WRKSRC} \ + --repository_disable_download \ + --lockfile_mode=off \ + --//bazel/config:running_through_bazelisk=True \ + --config=local \ + --config=opt \ + --verbose_failures \ + --jobs=${MAKE_JOBS_NUMBER} \ + --action_env=AR=llvm-ar \ + --action_env=CC=${CC} \ + --action_env=CXX=${CXX} \ + --action_env=PATH=${LOCALBASE}/bin:/bin:/usr/bin \ + --repo_env=CC=${CC} \ + --repo_env=CXX=${CXX} \ + --repo_env=LOCALBASE=${LOCALBASE} \ + --repo_env=MONGO_USE_SYSTEM_PYTHON=1 \ + --repo_env=PATH=${LOCALBASE}/bin:/bin:/usr/bin \ + --repo_env=PYTHON_CMD=${PYTHON_CMD} \ + --build_enterprise=False \ + --enterprise_feature_all=False \ + --allocator=system \ + --libunwind=off \ + --ssl=True \ + --disable_warnings_as_errors=True \ + --create_dwp=False \ + --copt=-isystem${LOCALBASE}/include \ + --define=GIT_COMMIT_HASH=freebsd-${PORTVERSION} \ + --define=MONGO_DISTMOD=freebsd \ + --define=MONGO_VERSION=${DISTVERSION} \ + --cxxopt=-isystem${LOCALBASE}/include \ + --cxxopt=-DBOOST_NO_CXX98_FUNCTION_BASE \ + --linkopt=-L${LOCALBASE}/lib \ + --linkopt=-lm \ + --linkopt=-pthread \ + --linkopt=-lexecinfo \ + --linkopt=-lkvm \ + --noexperimental_collect_system_network_usage +ALL_TARGET= install-core CONFLICTS_INSTALL= mongodb[0-9][0-9] -EXTRACT_AFTER_ARGS= --exclude src/third_party/snappy-* \ - --exclude src/third_party/libstemmer_c \ - --exclude src/third_party/unwind \ - --exclude src/third_party/yaml-cpp \ - --exclude src/third_party/zlib-* \ - --exclude src/third_party/zstandard \ - --no-same-owner --no-same-permissions +BINARY_ALIAS= python3=${PYTHON_CMD} +EXTRACT_AFTER_ARGS= --no-same-owner --no-same-permissions # This ports is only following the Major Release. # https://docs.mongodb.com/manual/reference/versioning/ PORTSCOUT= limit:^8\.0\. CONFIGURE_WRKSRC= ${MOZJS_WRKSRC} USERS= mongodb GROUPS= mongodb -OPTIONS_DEFINE= LTO NOAVX SASL +OPTIONS_DEFINE= LTO NOAVX OPTIONS_DEFINE_aarch64= ARMV80A -OPTIONS_DEFAULT= NOAVX SASL +OPTIONS_DEFAULT= NOAVX # MongoDB on non-LSE ARM cpu like Raspberry Pi can work but is unsupported upstream. # Can give corruption on high concurrency. # Please read https://jira.mongodb.org/browse/SERVER-71772. ARMV80A_DESC= Enable non-LSE ARM64 CPUs like RPI4. NOAVX_DESC= "Disable AVX instructions on amd64 (Sandybridge+)" -ARMV80A_EXTRA_PATCHES= ${FILESDIR}/extrapatch-SConstruct - -LTO_MAKE_ARGS= --lto=on +ARMV80A_VARS= BAZEL_ARGS+="--copt=-march=armv8-a --cxxopt=-march=armv8-a" -NOAVX_MAKE_ARGS= --experimental-optimization="-sandybridge" -NOAVX_EXTRA_PATCHES= ${FILESDIR}/extrapatch-src_third__party_mozjs_SConscript \ - ${FILESDIR}/extrapatch-src_third__party_mozjs_extract_mozglue_misc_SIMD.cpp +LTO_VARS= BAZEL_ARGS+=--thin_lto=True -SASL_LIB_DEPENDS= libsasl2.so:security/cyrus-sasl2 -SASL_MAKE_ARGS= --use-sasl-client +NOAVX_EXTRA_PATCHES= ${FILESDIR}/extrapatch-src_third__party_mozjs_extract_mozglue_misc_SIMD.cpp MOZJS_WRKSRC= ${WRKSRC}/src/third_party/mozjs +BAZEL_REGISTRY_WRKSRC= ${WRKDIR}/bazel-central-registry-${BAZEL_REGISTRY_COMMIT} +RULES_POETRY_WRKSRC= ${WRKDIR}/rules_poetry-${RULES_POETRY_COMMIT} +BAZEL_INSTALL_WRKSRC= ${WRKSRC}/bazel-bin/${ALL_TARGET} .if ${FLAVOR:U} == armv80a OPTIONS_SET+= ARMV80A .endif .include .if ${FLAVOR:U} == armv80a && ${ARCH} != aarch64 IGNORE= flavor armv80a is only valid on aarch64 .endif .if ${ARCH} == amd64 MOZJS_ARCH= x86_64 .elif ${ARCH} == powerpc64le MOZJS_ARCH= ppc64le .elif ${ARCH} == aarch64 MOZJS_ARCH= ${ARCH} .endif post-extract: # Verify we downloaded the proper mozjs git tag. - ${SH} -xc "test \"X`grep -E '^LIB_GIT_REVISION=' ${MOZJS_WRKSRC}/get-sources.sh`\" = \"XLIB_GIT_REVISION=${MOZJS_TAG}\"" - ${PATCH} -d ${WRKDIR}/spidermonkey-${MOZJS_TAG} -p1 < ${PATCHDIR}/d497aa4f770ca02f6083e93b94996a8fe32c2ff4.patch + ${SH} -xc "test \"X`grep -E '^LIB_GIT_REVISION=' ${MOZJS_WRKSRC}/scripts/import.sh`\" = \"XLIB_GIT_REVISION=${MOZJS_TAG}\"" pre-configure: -# Replacement of ${WRKSRC}/src/third_party/mozjs/get-sources.sh +# Replacement of ${WRKSRC}/src/third_party/mozjs/scripts/import.sh ${LN} -sF ${WRKDIR}/spidermonkey-${MOZJS_TAG} ${MOZJS_WRKSRC}/mozilla-release +post-patch: + ${PATCH} -d ${RULES_POETRY_WRKSRC} -p0 < ${WRKSRC}/bazel/rules_poetry/rules_poetry.patch + do-build: - ${WRKSRC}/buildscripts/scons.py -C ${WRKSRC} ${MAKE_ARGS} + ${MKDIR} ${BAZEL_REPOSITORY_CACHE} + cd ${WRKSRC} && ${SETENV} ${BAZEL_ENV} ${BAZEL} ${BAZEL_STARTUP_ARGS} build ${BAZEL_ARGS} ${ALL_TARGET} do-install: -.for f in mongod mongos - ${STRIP_CMD} ${STAGEDIR}${PREFIX}/bin/${f} -.endfor + ${INSTALL_PROGRAM} ${BAZEL_INSTALL_WRKSRC}/bin/mongod ${STAGEDIR}${PREFIX}/bin/ + ${INSTALL_PROGRAM} ${BAZEL_INSTALL_WRKSRC}/bin/mongos ${STAGEDIR}${PREFIX}/bin/ + ${STRIP_CMD} ${STAGEDIR}${PREFIX}/bin/mongod + ${STRIP_CMD} ${STAGEDIR}${PREFIX}/bin/mongos ${INSTALL_DATA} ${WRKSRC}/rpm/mongod.conf ${STAGEDIR}${PREFIX}/etc/mongodb.conf.sample ${MKDIR} ${STAGEDIR}${DOCSDIR} -.for doc in LICENSE-Community.txt MPL-2 README THIRD-PARTY-NOTICES - ${MV} ${STAGEDIR}${PREFIX}/${doc} ${STAGEDIR}${DOCSDIR}/ +.for doc in LICENSE-Community.txt distsrc/MPL-2 distsrc/README distsrc/THIRD-PARTY-NOTICES + ${INSTALL_DATA} ${WRKSRC}/${doc} ${STAGEDIR}${DOCSDIR}/ .endfor ${INSTALL_MAN} ${WRKSRC}/debian/mongod.1 ${STAGEDIR}${PREFIX}/share/man/man1/ ${INSTALL_MAN} ${WRKSRC}/debian/mongos.1 ${STAGEDIR}${PREFIX}/share/man/man1/ ${INSTALL_MAN} ${WRKSRC}/debian/mongodb-parameters.5 ${STAGEDIR}${PREFIX}/share/man/man5/ - ${RM} ${STAGEDIR}${PREFIX}/bin/resmoke.py do-test: ${SH} ${FILESDIR}/make.test.sh "${STAGEDIR}${PREFIX}/bin" .include diff --git a/databases/mongodb80/distinfo b/databases/mongodb80/distinfo index 8c7c6fe893ec..ade903469b6b 100644 --- a/databases/mongodb80/distinfo +++ b/databases/mongodb80/distinfo @@ -1,7 +1,11 @@ -TIMESTAMP = 1782994633 -SHA256 (mongodb-mongo-r8.0.12_GH0.tar.gz) = 0e9000bd8674e8b7c4f48906f6799f9604a1d61f79220cbb099b231a50ac05ea -SIZE (mongodb-mongo-r8.0.12_GH0.tar.gz) = 98534080 -SHA256 (mongodb-forks-spidermonkey-5acd3be6c9563ad3e7ca6182285c69a38de47bab_GH0.tar.gz) = 1420533e23970171ff7a420e3ded1ea493e1976fb8896a5fd6f35e5b2d75733b -SIZE (mongodb-forks-spidermonkey-5acd3be6c9563ad3e7ca6182285c69a38de47bab_GH0.tar.gz) = 280439685 -SHA256 (0877732109589e441cbf234dce17ec0e7b614902.patch) = 96bcf70f8ee66424b5601632fb91dbcbb6b14df0553f59f36cd10325bfce7105 -SIZE (0877732109589e441cbf234dce17ec0e7b614902.patch) = 1770 +TIMESTAMP = 1790747755 +SHA256 (mongodb-r8.0.29-bazel-repository-cache.tar.gz) = f1301200c6d28c3f86a91e5de63fa5e12737074def30db9567006b326483c984 +SIZE (mongodb-r8.0.29-bazel-repository-cache.tar.gz) = 39982114 +SHA256 (bazelbuild-bazel-central-registry-5df17720d4367282afb8e5ca27a35199ab7620e4_GH0.tar.gz) = 8e50f26b47e345a32aaff54d8477b4d9a277cab1cb7d4db6b7aa361191d55be4 +SIZE (bazelbuild-bazel-central-registry-5df17720d4367282afb8e5ca27a35199ab7620e4_GH0.tar.gz) = 14273558 +SHA256 (mongodb-forks-rules_poetry-917630033c736c188605cf0f558c34afc1eca540_GH0.tar.gz) = 48001b928488e78f03a47bcc712c56432a471fc6cdd90fe57c884efbfcd13696 +SIZE (mongodb-forks-rules_poetry-917630033c736c188605cf0f558c34afc1eca540_GH0.tar.gz) = 339587 +SHA256 (mongodb-mongo-r8.0.29_GH0.tar.gz) = a45686998d5bc29c97f6d2fbc5a6dc5a1260a10c9d830e42080dffb74649124b +SIZE (mongodb-mongo-r8.0.29_GH0.tar.gz) = 88788792 +SHA256 (mongodb-forks-spidermonkey-7aeaf7a44d420360bde75db8453636092c3e2f56_GH0.tar.gz) = 8ec7aa1399b6fb15b859c448ae6f361ab28cf48bd8fc4f0de2fb3776582e202f +SIZE (mongodb-forks-spidermonkey-7aeaf7a44d420360bde75db8453636092c3e2f56_GH0.tar.gz) = 392664341 diff --git a/databases/mongodb80/files/d497aa4f770ca02f6083e93b94996a8fe32c2ff4.patch b/databases/mongodb80/files/d497aa4f770ca02f6083e93b94996a8fe32c2ff4.patch deleted file mode 100644 index 62a81a051d65..000000000000 --- a/databases/mongodb80/files/d497aa4f770ca02f6083e93b94996a8fe32c2ff4.patch +++ /dev/null @@ -1,81 +0,0 @@ -!!! This patch is a modified version of the phabricator mention !!! -!!! You can diff them to see the difference !!! - -From d497aa4f770ca02f6083e93b94996a8fe32c2ff4 Mon Sep 17 00:00:00 2001 -From: Mike Hommey -Date: Tue, 19 Aug 2025 05:09:09 +0000 -Subject: [PATCH] Bug 1969769 - Change uses of ast.Str with ast.Constant. - r=firefox-build-system-reviewers,ahochheiden - -ast.Str was deprecated in python 3.12 and removed in 3.14. It inherited -from ast.Constant, `Str.s` was equivalent to `Constant.value`, so we can -use the latter on both old and newer python versions. - -Differential Revision: https://phabricator.services.mozilla.com/D261512 ---- - python/mozbuild/mozbuild/frontend/reader.py | 14 +++++++------- - .../mozbuild/mozbuild/vendor/rewrite_mozbuild.py | 6 ++---- - 2 files changed, 9 insertions(+), 11 deletions(-) - -diff --git a/python/mozbuild/mozbuild/frontend/reader.py b/python/mozbuild/mozbuild/frontend/reader.py -index 9f6292cb909de..89bf9995c1768 100644 ---- a/python/mozbuild/mozbuild/frontend/reader.py -+++ b/python/mozbuild/mozbuild/frontend/reader.py -@@ -470,7 +470,7 @@ - return c( - ast.Subscript( - value=c(ast.Name(id=self._global_name, ctx=ast.Load())), -- slice=c(ast.Index(value=c(ast.Str(s=node.id)))), -+ slice=c(ast.Index(value=c(ast.Constant(value=node.id)))), - ctx=node.ctx, - ) - ) -@@ -1035,8 +1035,8 @@ - else: - # Others - assert isinstance(target.slice, ast.Index) -- assert isinstance(target.slice.value, ast.Str) -- key = target.slice.value.s -+ assert isinstance(target.slice.value, ast.Constant) -+ key = target.slice.value.value - - return name, key - -@@ -1044,11 +1044,11 @@ - value = node.value - if isinstance(value, ast.List): - for v in value.elts: -- assert isinstance(v, ast.Str) -- yield v.s -+ assert isinstance(v, ast.Constant) -+ yield v.value - else: -- assert isinstance(value, ast.Str) -- yield value.s -+ assert isinstance(value, ast.Constant) -+ yield value.value - - assignments = [] - -diff --git a/python/mozbuild/mozbuild/vendor/rewrite_mozbuild.py b/python/mozbuild/mozbuild/vendor/rewrite_mozbuild.py -index cfcc0f18b9a9a..de06b58819b6a 100644 ---- a/python/mozbuild/mozbuild/vendor/rewrite_mozbuild.py 2026-04-26 13:55:23.117672000 -0500 -+++ a/python/mozbuild/mozbuild/vendor/rewrite_mozbuild.py 2026-04-26 13:55:54.618049000 -0500 -@@ -327,15 +327,13 @@ - """ - if isinstance(node.value, ast.List) and "elts" in node.value._fields: - for f in node.value.elts: -- if not isinstance(f, ast.Constant) and not isinstance(f, ast.Str): -+ if not isinstance(f, ast.Constant): - log( - "Found non-constant source file name in list: ", - ast_get_source_segment(code, f), - ) - return [] -- return [ -- f.value if isinstance(f, ast.Constant) else f.s for f in node.value.elts -- ] -+ return [f.value for f in node.value.elts] - elif isinstance(node.value, ast.ListComp): - # SOURCES += [f for f in foo if blah] - log("Could not find the files for " + ast_get_source_segment(code, node.value)) diff --git a/databases/mongodb80/files/extrapatch-SConstruct b/databases/mongodb80/files/extrapatch-SConstruct deleted file mode 100644 index 05946bd82cdc..000000000000 --- a/databases/mongodb80/files/extrapatch-SConstruct +++ /dev/null @@ -1,16 +0,0 @@ ---- SConstruct.orig 2023-06-07 17:07:38 UTC -+++ SConstruct -@@ -3217,8 +3205,12 @@ if not env.TargetOSIs('windows', 'macOS') and (env.Too - # setting it for both C and C++ by setting both of CFLAGS and - # CXXFLAGS. - -+ arm_march_flag = "armv8-a" -+ if get_option('use-hardware-crc32') == "on": -+ arm_march_flag += "+crc" -+ - default_targeting_flags_for_architecture = { -- "aarch64": {"-march=": "armv8.2-a", "-mtune=": "generic"}, -+ "aarch64": {"-march=": arm_march_flag, "-mtune=": "generic"}, - "i386": {"-march=": "nocona", "-mtune=": "generic"}, - "ppc64le": {"-mcpu=": "power8", "-mtune=": "power8", "-mcmodel=": "medium"}, - "s390x": {"-march=": "z196", "-mtune=": "zEC12"}, diff --git a/databases/mongodb80/files/extrapatch-src_third__party_mozjs_SConscript b/databases/mongodb80/files/extrapatch-src_third__party_mozjs_SConscript deleted file mode 100644 index 4370f13323a4..000000000000 --- a/databases/mongodb80/files/extrapatch-src_third__party_mozjs_SConscript +++ /dev/null @@ -1,11 +0,0 @@ ---- src/third_party/mozjs/SConscript.orig 2024-08-14 20:38:09 UTC -+++ src/third_party/mozjs/SConscript -@@ -144,7 +145,7 @@ sources = [ - "extract/js/src/wasm/WasmCode-platform.cpp", - ] - --if env['TARGET_ARCH'] == 'x86_64' and not env.TargetOSIs('windows'): -+if False and env['TARGET_ARCH'] == 'x86_64' and not env.TargetOSIs('windows'): - env.Append(CCFLAGS=['-mavx2']) - sources.extend(["extract/mozglue/misc/SIMD_avx2.cpp", "extract/mozglue/misc/SSE.cpp"]) - diff --git a/databases/mongodb80/files/patch-MODULE.bazel b/databases/mongodb80/files/patch-MODULE.bazel new file mode 100644 index 000000000000..c5c44e5b0532 --- /dev/null +++ b/databases/mongodb80/files/patch-MODULE.bazel @@ -0,0 +1,35 @@ +--- MODULE.bazel.orig ++++ MODULE.bazel +@@ -78,11 +78,9 @@ single_version_override( + ) + + bazel_dep(name = "rules_poetry", version = "") +-git_override( ++local_path_override( + module_name = "rules_poetry", +- commit = "917630033c736c188605cf0f558c34afc1eca540", +- patches = ["//bazel/rules_poetry:rules_poetry.patch"], +- remote = "https://github.com/mongodb-forks/rules_poetry", ++ path = "../rules_poetry-917630033c736c188605cf0f558c34afc1eca540", + ) + + # +@@ -164,5 +164,8 @@ use_repo( + setup_mongo_python_toolchains, + "py_host", ++ "py_freebsd_arm64", ++ "py_freebsd_ppc64le", ++ "py_freebsd_x86_64", + "py_linux_arm64", + "py_linux_ppc64le", + "py_linux_s390x", +@@ -176,6 +179,9 @@ use_repo( + ) + + register_toolchains( ++ "@py_freebsd_arm64//:python_toolchain", ++ "@py_freebsd_ppc64le//:python_toolchain", ++ "@py_freebsd_x86_64//:python_toolchain", + "@py_linux_arm64//:python_toolchain", + "@py_linux_ppc64le//:python_toolchain", + "@py_linux_s390x//:python_toolchain", diff --git a/databases/mongodb80/files/patch-SConstruct b/databases/mongodb80/files/patch-SConstruct deleted file mode 100644 index 6e039812b1a2..000000000000 --- a/databases/mongodb80/files/patch-SConstruct +++ /dev/null @@ -1,11 +0,0 @@ ---- SConstruct.orig 2025-07-07 23:12:17 UTC -+++ SConstruct -@@ -1848,7 +1848,7 @@ if unknown_vars: - - unknown_vars = env_vars.UnknownVariables() - if unknown_vars: -- env.FatalError("Unknown variables specified: {0}", ", ".join(list(unknown_vars.keys()))) -+ print("Unknown variables specified: {0}", ", ".join(list(unknown_vars.keys()))) - - install_actions.setup(env, get_option('install-action')) - diff --git a/databases/mongodb80/files/patch-WORKSPACE.bazel b/databases/mongodb80/files/patch-WORKSPACE.bazel new file mode 100644 index 000000000000..804f36c0a38a --- /dev/null +++ b/databases/mongodb80/files/patch-WORKSPACE.bazel @@ -0,0 +1,23 @@ +--- WORKSPACE.bazel.orig ++++ WORKSPACE.bazel +@@ -127,6 +127,20 @@ load("@aspect_rules_js//js:toolchains.bzl", "DEFAULT_N + + rules_js_register_toolchains(node_version = DEFAULT_NODE_VERSION) + ++load("//bazel:freebsd_repositories.bzl", "freebsd_system_yq_repo") ++ ++freebsd_system_yq_repo( ++ name = "yq_freebsd_amd64", ++) ++ ++freebsd_system_yq_repo( ++ name = "yq_freebsd_arm64", ++) ++ ++freebsd_system_yq_repo( ++ name = "yq_freebsd_ppc64le", ++) ++ + load("@aspect_rules_js//npm:repositories.bzl", "npm_translate_lock") + + npm_translate_lock( diff --git a/databases/mongodb80/files/patch-bazel_config_BUILD.bazel b/databases/mongodb80/files/patch-bazel_config_BUILD.bazel new file mode 100644 index 000000000000..56e046ec7420 --- /dev/null +++ b/databases/mongodb80/files/patch-bazel_config_BUILD.bazel @@ -0,0 +1,105 @@ +--- bazel/config/BUILD.bazel.orig 2026-08-11 19:14:56 UTC ++++ bazel/config/BUILD.bazel +@@ -234,6 +234,30 @@ config_setting( + ], + ) + ++config_setting( ++ name = "freebsd_aarch64", ++ constraint_values = [ ++ "@platforms//os:freebsd", ++ "@platforms//cpu:aarch64", ++ ], ++) ++ ++config_setting( ++ name = "freebsd_x86_64", ++ constraint_values = [ ++ "@platforms//os:freebsd", ++ "@platforms//cpu:x86_64", ++ ], ++) ++ ++config_setting( ++ name = "freebsd_ppc64le", ++ constraint_values = [ ++ "@platforms//os:freebsd", ++ "@platforms//cpu:ppc", ++ ], ++) ++ + config_setting( + name = "rhel10", + constraint_values = [ +@@ -268,6 +292,7 @@ selects.config_setting_group( + match_any = [ + "@platforms//os:macos", + "@platforms//os:linux", ++ "@platforms//os:freebsd", + ], + ) + +@@ -276,6 +301,7 @@ selects.config_setting_group( + match_any = [ + "@platforms//os:macos", + "@platforms//os:windows", ++ "@platforms//os:freebsd", + ], + ) + +@@ -284,6 +310,7 @@ selects.config_setting_group( + match_any = [ + "@platforms//os:linux", + "@platforms//os:windows", ++ "@platforms//os:freebsd", + ], + ) + +@@ -309,6 +336,7 @@ selects.config_setting_group( + match_any = [ + "@platforms//os:macos", + "@platforms//os:linux", ++ "@platforms//os:freebsd", + ], + ) + +@@ -2177,6 +2205,22 @@ selects.config_setting_group( + ], + ) + ++selects.config_setting_group( ++ name = "ssl_enabled_freebsd", ++ match_all = [ ++ "@platforms//os:freebsd", ++ ":ssl_enabled", ++ ], ++) ++ ++selects.config_setting_group( ++ name = "ssl_disabled_freebsd", ++ match_all = [ ++ "@platforms//os:freebsd", ++ ":ssl_disabled", ++ ], ++) ++ + selects.config_setting_group( + name = "ssl_enabled_build_enterprise_disabled", + match_all = [ +@@ -2263,13 +2307,15 @@ + selects.config_setting_group( + name = "mongo_crypto_openssl", +- match_all = [ ++ match_any = [ + ":ssl_enabled_linux", ++ ":ssl_enabled_freebsd", + ], + ) + + selects.config_setting_group( + name = "mongo_crypto_tom", + match_any = [ + ":ssl_disabled_linux", ++ ":ssl_disabled_freebsd", + ], + ) diff --git a/databases/mongodb80/files/patch-bazel_freebsd__repositories.bzl b/databases/mongodb80/files/patch-bazel_freebsd__repositories.bzl new file mode 100644 index 000000000000..035d168b4799 --- /dev/null +++ b/databases/mongodb80/files/patch-bazel_freebsd__repositories.bzl @@ -0,0 +1,18 @@ +--- /dev/null ++++ bazel/freebsd_repositories.bzl +@@ -0,0 +1,15 @@ ++def _freebsd_system_yq_repo_impl(rctx): ++ localbase = rctx.os.environ.get("LOCALBASE", "/usr/local") ++ rctx.symlink("{}/bin/yq".format(localbase), "yq") ++ rctx.file( ++ "BUILD.bazel", ++ """ ++package(default_visibility = ["//visibility:public"]) ++exports_files(["yq"]) ++""", ++ ) ++ ++freebsd_system_yq_repo = repository_rule( ++ implementation = _freebsd_system_yq_repo_impl, ++ environ = ["LOCALBASE"], ++) diff --git a/databases/mongodb80/files/patch-bazel_install__rules_install__rules.bzl b/databases/mongodb80/files/patch-bazel_install__rules_install__rules.bzl new file mode 100644 index 000000000000..f1cb2884d5be --- /dev/null +++ b/databases/mongodb80/files/patch-bazel_install__rules_install__rules.bzl @@ -0,0 +1,46 @@ +--- bazel/install_rules/install_rules.bzl.orig 2026-08-11 19:14:56 UTC ++++ bazel/install_rules/install_rules.bzl +@@ -103,7 +103,8 @@ def get_constraints(ctx): + """ + linux_constraint = ctx.attr._linux_constraint[platform_common.ConstraintValueInfo] + macos_constraint = ctx.attr._macos_constraint[platform_common.ConstraintValueInfo] + windows_constraint = ctx.attr._windows_constraint[platform_common.ConstraintValueInfo] +- return linux_constraint, macos_constraint, windows_constraint ++ freebsd_constraint = ctx.attr._freebsd_constraint[platform_common.ConstraintValueInfo] ++ return linux_constraint, macos_constraint, windows_constraint, freebsd_constraint + + def is_binary_file(ctx, basename): +@@ -117,7 +118,7 @@ def is_binary_file(ctx, basename): + True if it looks like a binary, False otherwise + """ +- linux_constraint, macos_constraint, windows_constraint = get_constraints(ctx) +- if ctx.target_platform_has_constraint(linux_constraint): ++ linux_constraint, macos_constraint, windows_constraint, freebsd_constraint = get_constraints(ctx) ++ if ctx.target_platform_has_constraint(linux_constraint) or ctx.target_platform_has_constraint(freebsd_constraint): + return not (basename.startswith("lib") or basename.startswith("mongo_crypt_v") or basename.startswith("stitch_support.so")) + elif ctx.target_platform_has_constraint(macos_constraint): + return not (basename.startswith("lib") or basename.startswith("mongo_crypt_v") or basename.startswith("stitch_support.dylib")) +@@ -138,7 +139,7 @@ def is_debug_file(ctx, basename): + True if it looks like a debug file, False otherwise + """ +- linux_constraint, macos_constraint, windows_constraint = get_constraints(ctx) +- if ctx.target_platform_has_constraint(linux_constraint): ++ linux_constraint, macos_constraint, windows_constraint, freebsd_constraint = get_constraints(ctx) ++ if ctx.target_platform_has_constraint(linux_constraint) or ctx.target_platform_has_constraint(freebsd_constraint): + return basename.endswith(".debug") or basename.endswith(".dwp") + elif ctx.target_platform_has_constraint(macos_constraint): + return basename.endswith(".dSYM") +@@ -176,5 +177,5 @@ def sort_file(ctx, file, install_dir, file_map, is_directory): + + """ +- _, macos_constraint, _ = get_constraints(ctx) ++ _, macos_constraint, _, _ = get_constraints(ctx) + basename = paths.basename(file) + bin_install = install_dir + "/bin/" + basename +@@ -410,5 +411,6 @@ mongo_install_rule = rule( + "_linux_constraint": attr.label(default = "@platforms//os:linux"), + "_macos_constraint": attr.label(default = "@platforms//os:macos"), + "_windows_constraint": attr.label(default = "@platforms//os:windows"), ++ "_freebsd_constraint": attr.label(default = "@platforms//os:freebsd"), + }, + doc = "Install targets", diff --git a/databases/mongodb80/files/patch-bazel_mongo__src__rules.bzl b/databases/mongodb80/files/patch-bazel_mongo__src__rules.bzl new file mode 100644 index 000000000000..7f5de2127329 --- /dev/null +++ b/databases/mongodb80/files/patch-bazel_mongo__src__rules.bzl @@ -0,0 +1,32 @@ +--- bazel/mongo_src_rules.bzl.orig 2026-08-11 19:14:56 UTC ++++ bazel/mongo_src_rules.bzl +@@ -269,6 +269,9 @@ def force_includes_hdr(package_name, name): + "//bazel/config:linux_ppc64le": ["//src/third_party/mozjs:platform/ppc64le/linux/build/js-config.h"], + "//bazel/config:linux_s390x": ["//src/third_party/mozjs:platform/s390x/linux/build/js-config.h"], + "//bazel/config:linux_x86_64": ["//src/third_party/mozjs:platform/x86_64/linux/build/js-config.h"], ++ "//bazel/config:freebsd_aarch64": ["//src/third_party/mozjs:platform/aarch64/freebsd/build/js-config.h"], ++ "//bazel/config:freebsd_ppc64le": ["//src/third_party/mozjs:platform/ppc64le/freebsd/build/js-config.h"], ++ "//bazel/config:freebsd_x86_64": ["//src/third_party/mozjs:platform/x86_64/freebsd/build/js-config.h"], + "//bazel/config:macos_aarch64": ["//src/third_party/mozjs:platform/aarch64/macOS/build/js-config.h"], + "//bazel/config:macos_x86_64": ["//src/third_party/mozjs:platform/x86_64/macOS/build/js-config.h"], + "//bazel/config:windows_x86_64": ["//src/third_party/mozjs:/platform/x86_64/windows/build/js-config.h"], +@@ -473,6 +476,9 @@ def mongo_cc_shared_library( + "//bazel/config:linux_ppc64le": linux_rpath_flags, + "//bazel/config:linux_s390x": linux_rpath_flags, + "//bazel/config:linux_x86_64": linux_rpath_flags, ++ "//bazel/config:freebsd_aarch64": linux_rpath_flags, ++ "//bazel/config:freebsd_ppc64le": linux_rpath_flags, ++ "//bazel/config:freebsd_x86_64": linux_rpath_flags, + "//bazel/config:macos_aarch64": macos_rpath_flags, + "//bazel/config:macos_x86_64": macos_rpath_flags, + "//bazel/config:windows_x86_64": [], +@@ -716,6 +722,9 @@ def mongo_cc_binary( + "//bazel/config:linux_ppc64le": linux_rpath_flags, + "//bazel/config:linux_s390x": linux_rpath_flags, + "//bazel/config:linux_x86_64": linux_rpath_flags, ++ "//bazel/config:freebsd_aarch64": linux_rpath_flags, ++ "//bazel/config:freebsd_ppc64le": linux_rpath_flags, ++ "//bazel/config:freebsd_x86_64": linux_rpath_flags, + "//bazel/config:macos_aarch64": macos_rpath_flags, + "//bazel/config:macos_x86_64": macos_rpath_flags, + "//bazel/config:windows_x86_64": [], diff --git a/databases/mongodb80/files/patch-bazel_platforms_local__config__platform.bzl b/databases/mongodb80/files/patch-bazel_platforms_local__config__platform.bzl new file mode 100644 index 000000000000..a5d082d77186 --- /dev/null +++ b/databases/mongodb80/files/patch-bazel_platforms_local__config__platform.bzl @@ -0,0 +1,25 @@ +--- bazel/platforms/local_config_platform.bzl.orig 2026-08-11 19:14:56 UTC ++++ bazel/platforms/local_config_platform.bzl +@@ -18,8 +18,10 @@ def _setup_local_config_platform(ctx): + os = "windows" + elif "mac" in ctx.os.name: + os = "macos" +- else: ++ elif "linux" in ctx.os.name: + os = "linux" ++ elif "freebsd" in ctx.os.name: ++ os = "freebsd" + + arch = ctx.os.arch + +@@ -31,7 +33,9 @@ def _setup_local_config_platform(ctx): + # So Starlark doesn't throw an indentation error when this gets injected. + constraints_str = ",\n ".join(['"%s"' % c for c in constraints]) + +- distro = get_host_distro_major_version(ctx) ++ distro = None ++ if os == "linux": ++ distro = get_host_distro_major_version(ctx) + if arch == "x86_64": + arch = "amd64" + elif arch == "aarch64": diff --git a/databases/mongodb80/files/patch-bazel_platforms_normalize.bzl b/databases/mongodb80/files/patch-bazel_platforms_normalize.bzl new file mode 100644 index 000000000000..f7281f7b5ca8 --- /dev/null +++ b/databases/mongodb80/files/patch-bazel_platforms_normalize.bzl @@ -0,0 +1,8 @@ +--- bazel/platforms/normalize.bzl.orig 2026-08-11 19:14:56 UTC ++++ bazel/platforms/normalize.bzl +@@ -18,4 +18,5 @@ OS_TO_PLATFORM_MAP = { + "macos": "@platforms//os:osx", + "linux": "@platforms//os:linux", + "windows": "@platforms//os:windows", ++ "freebsd": "@platforms//os:freebsd", + } diff --git a/databases/mongodb80/files/patch-bazel_rules__poetry_rules__poetry.patch b/databases/mongodb80/files/patch-bazel_rules__poetry_rules__poetry.patch new file mode 100644 index 000000000000..4913e3550cd9 --- /dev/null +++ b/databases/mongodb80/files/patch-bazel_rules__poetry_rules__poetry.patch @@ -0,0 +1,170 @@ +--- bazel/rules_poetry/rules_poetry.patch.orig ++++ bazel/rules_poetry/rules_poetry.patch +@@ -10,3 +10,167 @@ index 0000000..c09945f + + + +bazel_dep(name = "bazel_skylib", version = "1.5.0") + +bazel_dep(name = "platforms", version = "0.0.8") ++diff --git rules_poetry/defs.bzl rules_poetry/defs.bzl ++index b3c070b..564e159 100644 ++--- rules_poetry/defs.bzl +++++ rules_poetry/defs.bzl ++@@ -88,43 +88,18 @@ COMMON_ARGS = [ ++ "--isolated", ++ ] ++ ++-def _download(ctx, requirements): ++- ++- toolchain = ctx.toolchains["@bazel_tools//tools/python:toolchain_type"] ++- runtime = toolchain.py3_runtime ++- inputs = depset([requirements], transitive = [runtime.files]) ++- tools = depset(direct = [runtime.interpreter], transitive = [runtime.files]) ++- ++- python = ctx.toolchains["@bazel_tools//tools/python:toolchain_type"].py3_runtime ++- destination = ctx.actions.declare_directory("wheels/%s" % ctx.attr.name) ++- args = ctx.actions.args() ++- args.add("-m") ++- args.add("pip") ++- args.add("wheel") ++- args.add_all(COMMON_ARGS) ++- args.add("--require-hashes") ++- args.add("--wheel-dir") ++- args.add(destination.path) ++- args.add("-r") ++- args.add(requirements) ++- if ctx.attr.source_url != "": ++- args.add("-i") ++- args.add(ctx.attr.source_url) ++- ++- ctx.actions.run( ++- executable = python.interpreter.path, ++- inputs = inputs, ++- outputs = [destination], ++- arguments = [args], ++- env = deterministic_env(), ++- mnemonic = "DownloadWheel", ++- progress_message = "Collecting %s wheel from pypi" % ctx.attr.pkg, ++- execution_requirements = { ++- "requires-network": "", ++- }, ++- tools = tools, +++def _empty_directory(ctx, output, mnemonic, progress_message): +++ ctx.actions.run_shell( +++ outputs = [output], +++ command = "mkdir -p \"$1\"", +++ arguments = [output.path], +++ mnemonic = mnemonic, +++ progress_message = progress_message, ++ ) ++ +++def _download(ctx, requirements): +++ destination = ctx.actions.declare_directory("wheels/%s" % ctx.attr.name) +++ _empty_directory(ctx, destination, "DownloadWheel", "Using system Python package for %s" % ctx.attr.pkg) ++ return destination ++ ++ def _download_wheel_impl(ctx): ++@@ -161,33 +136,7 @@ download_wheel = rule( ++ def _install(ctx, wheel_info): ++ ++ installed_wheel = ctx.actions.declare_directory(wheel_info.pkg) ++- python = ctx.toolchains["@bazel_tools//tools/python:toolchain_type"].py3_runtime ++- ++- args = [ ++- "-m", ++- "pip", ++- 'install', ++- '--force-reinstall', ++- '--upgrade', ++- ] + COMMON_ARGS + [ ++- "--no-compile", ++- "--no-index", ++- "--find-links", ++- ctx.files.wheel[0].path, ++- "--target="+installed_wheel.path, ++- wheel_info.pkg + " ; " + str(wheel_info.marker) ++- ] ++- ++- ctx.actions.run( ++- executable = python.interpreter.path, ++- outputs = [installed_wheel], ++- inputs = depset(ctx.files.wheel, transitive = [python.files]), ++- arguments = args, ++- env = deterministic_env(), ++- progress_message = "Installing %s wheel" % wheel_info.pkg, ++- mnemonic = "CopyWheel", ++- ) ++- +++ _empty_directory(ctx, installed_wheel, "CopyWheel", "Using system Python package for %s" % wheel_info.pkg) ++ return installed_wheel ++ ++ def _pip_install_impl(ctx): ++diff --git rules_poetry/poetry.bzl rules_poetry/poetry.bzl ++index 32991e2..3e27600 100644 ++--- rules_poetry/poetry.bzl +++++ rules_poetry/poetry.bzl ++@@ -20,6 +20,26 @@ SUPPORTED_PLATFORMS = [ ++ "win32!x86_64", ++ ] ++ +++def _toml_to_json_args(path): +++ return [ +++ "-c", +++ """ +++import json +++import sys +++ +++try: +++ import tomllib +++except ModuleNotFoundError: +++ import tomli as tomllib +++ +++with open(sys.argv[1], "rb") as handle: +++ data = tomllib.load(handle) +++ +++json.dump(data, sys.stdout, default=str) +++""", +++ path, +++ ] +++ ++ def _clean_name(name): ++ return name.lower().replace("-", "_").replace(".", "_") ++ ++@@ -68,18 +88,7 @@ def _resolve_python_interpreter(rctx): ++ def _mapping(repository_ctx): ++ python_interpreter = _resolve_python_interpreter(repository_ctx) ++ result = repository_ctx.execute( ++- [ ++- python_interpreter, ++- repository_ctx.path(repository_ctx.attr._script), ++- "-i", ++- repository_ctx.path(repository_ctx.attr.pyproject), ++- "-o", ++- "-", ++- "--if", ++- "toml", ++- "--of", ++- "json", ++- ], +++ [python_interpreter] + _toml_to_json_args(repository_ctx.path(repository_ctx.attr.pyproject)), ++ ) ++ ++ if result.return_code: ++@@ -159,18 +168,7 @@ def _impl(repository_ctx): ++ mapping = _mapping(repository_ctx) ++ ++ result = repository_ctx.execute( ++- [ ++- python_interpreter, ++- repository_ctx.path(repository_ctx.attr._script), ++- "-i", ++- repository_ctx.path(repository_ctx.attr.lockfile), ++- "-o", ++- "-", ++- "--if", ++- "toml", ++- "--of", ++- "json", ++- ], +++ [python_interpreter] + _toml_to_json_args(repository_ctx.path(repository_ctx.attr.lockfile)), ++ ) ++ ++ if result.return_code: diff --git a/databases/mongodb80/files/patch-bazel_separate__debug.bzl b/databases/mongodb80/files/patch-bazel_separate__debug.bzl new file mode 100644 index 000000000000..87d8941959cb --- /dev/null +++ b/databases/mongodb80/files/patch-bazel_separate__debug.bzl @@ -0,0 +1,38 @@ +--- bazel/separate_debug.bzl.orig ++++ bazel/separate_debug.bzl +@@ -561,9 +561,10 @@ def extract_debuginfo_impl(ctx): + + linux_constraint = ctx.attr._linux_constraint[platform_common.ConstraintValueInfo] + macos_constraint = ctx.attr._macos_constraint[platform_common.ConstraintValueInfo] + windows_constraint = ctx.attr._windows_constraint[platform_common.ConstraintValueInfo] ++ freebsd_constraint = ctx.attr._freebsd_constraint[platform_common.ConstraintValueInfo] + +- if ctx.target_platform_has_constraint(linux_constraint): ++ if ctx.target_platform_has_constraint(linux_constraint) or ctx.target_platform_has_constraint(freebsd_constraint): + # When skipping the archives we have to skip modifying debug info + # for the intermediates because we end up taking a dependency + # on the _with_debug .a files +@@ -609,6 +610,7 @@ extract_debuginfo = rule( + "_linux_constraint": attr.label(default = "@platforms//os:linux"), + "_macos_constraint": attr.label(default = "@platforms//os:macos"), + "_windows_constraint": attr.label(default = "@platforms//os:windows"), ++ "_freebsd_constraint": attr.label(default = "@platforms//os:freebsd"), + }, + doc = "Extract debuginfo into a separate file", + toolchains = ["@bazel_tools//tools/cpp:toolchain_type"], +@@ -641,6 +643,7 @@ extract_debuginfo_binary = rule( + "_linux_constraint": attr.label(default = "@platforms//os:linux"), + "_macos_constraint": attr.label(default = "@platforms//os:macos"), + "_windows_constraint": attr.label(default = "@platforms//os:windows"), ++ "_freebsd_constraint": attr.label(default = "@platforms//os:freebsd"), + }, + doc = "Extract debuginfo into a separate file", + toolchains = ["@bazel_tools//tools/cpp:toolchain_type"], +@@ -674,6 +677,7 @@ extract_debuginfo_test = rule( + "_linux_constraint": attr.label(default = "@platforms//os:linux"), + "_macos_constraint": attr.label(default = "@platforms//os:macos"), + "_windows_constraint": attr.label(default = "@platforms//os:windows"), ++ "_freebsd_constraint": attr.label(default = "@platforms//os:freebsd"), + }, + doc = "Extract debuginfo into a separate file", + toolchains = ["@bazel_tools//tools/cpp:toolchain_type"], diff --git a/databases/mongodb80/files/patch-bazel_toolchains_cc_mongo__compiler__flags.bzl b/databases/mongodb80/files/patch-bazel_toolchains_cc_mongo__compiler__flags.bzl new file mode 100644 index 000000000000..c1b327c9bba2 --- /dev/null +++ b/databases/mongodb80/files/patch-bazel_toolchains_cc_mongo__compiler__flags.bzl @@ -0,0 +1,20 @@ +--- bazel/toolchains/cc/mongo_compiler_flags.bzl.orig 2026-09-29 00:00:00 UTC ++++ bazel/toolchains/cc/mongo_compiler_flags.bzl +@@ -77,9 +77,18 @@ def package_specific_linkflag(package_name): + + MONGO_GLOBAL_COPTS = MONGO_LINUX_CC_COPTS + MONGO_WIN_CC_COPTS + ++def freebsd_cxx_standard_copt(package_name): ++ if package_name.startswith("src/mongo"): ++ return select({ ++ "@platforms//os:freebsd": ["-std=c++20"], ++ "//conditions:default": [], ++ }) ++ return [] ++ + def get_copts(name, package_name, copts = [], skip_windows_crt_flags = False): + copts = MONGO_GLOBAL_COPTS + \ ++ freebsd_cxx_standard_copt(package_name) + \ + package_specific_copt(package_name) + \ + copts + \ + force_includes_copt(package_name, name) diff --git a/databases/mongodb80/files/patch-bazel_toolchains_python_python__toolchain.bzl b/databases/mongodb80/files/patch-bazel_toolchains_python_python__toolchain.bzl new file mode 100644 index 000000000000..cc3c19f2f4b1 --- /dev/null +++ b/databases/mongodb80/files/patch-bazel_toolchains_python_python__toolchain.bzl @@ -0,0 +1,208 @@ +--- bazel/toolchains/python/python_toolchain.bzl.orig ++++ bazel/toolchains/python/python_toolchain.bzl +@@ -55,82 +55,89 @@ + os = "windows" + elif "mac" in ctx.os.name: + os = "macos" +- else: ++ elif "linux" in ctx.os.name: + os = "linux" ++ elif "freebsd" in ctx.os.name: ++ os = "freebsd" + + if ctx.attr.arch: + arch = ctx.attr.arch + else: + arch = ctx.os.arch + +- if ctx.attr.urls: +- urls = ctx.attr.urls +- sha = ctx.attr.sha256 ++ if ctx.os.environ.get("MONGO_USE_SYSTEM_PYTHON"): ++ ctx.file("dist/bin/.keep", "") ++ ctx.symlink(ctx.os.environ.get("PYTHON_CMD", "python3"), "dist/bin/python3") + interpreter_path = ctx.attr.interpreter_path + else: +- platform_info = URLS_MAP["{os}_{arch}".format(os = os, arch = arch)] +- urls = platform_info["url"] +- sha = platform_info["sha"] +- interpreter_path = platform_info["interpreter_path"] ++ if ctx.attr.urls: ++ urls = ctx.attr.urls ++ sha = ctx.attr.sha256 ++ interpreter_path = ctx.attr.interpreter_path ++ else: ++ platform_info = URLS_MAP["{os}_{arch}".format(os = os, arch = arch)] ++ urls = platform_info["url"] ++ sha = platform_info["sha"] ++ interpreter_path = platform_info["interpreter_path"] + +- ctx.report_progress("downloading python") +- retry_download_and_extract( +- ctx = ctx, +- output = "dist", +- tries = 5, +- url = urls, +- sha256 = sha, +- stripPrefix = "python", +- ) ++ ctx.report_progress("downloading python") ++ retry_download_and_extract( ++ ctx = ctx, ++ output = "dist", ++ tries = 5, ++ url = urls, ++ sha256 = sha, ++ stripPrefix = "python", ++ ) + +- windows_python = False +- for name in ctx.path("dist").readdir(): +- if name.basename == "python.exe": +- windows_python = True +- break ++ windows_python = False ++ for name in ctx.path("dist").readdir(): ++ if name.basename == "python.exe": ++ windows_python = True ++ break + +- if windows_python: +- # windows does not have python version specific dir +- usercustomize_file = "dist/Lib/site-packages/usercustomize.py" +- else: +- # detect python version without execution +- # this looks for the `python#.#` binary on macos and linux +- # and extracts the version information at the end of the binary, +- # starlark doesn't have regex support so had to roll our own +- # parsing. +- python_base_dir = ctx.path("dist/bin") +- bin_files = python_base_dir.readdir() +- python_major_version = -1 +- python_minor_version = -1 +- for bin_file in bin_files: +- basename = bin_file.basename +- if basename.startswith("python"): +- numeric = basename.replace("python", "") +- versions = numeric.split(".") +- if len(versions) == 2: +- numbers_only = True +- for version in versions: +- if not version.isdigit(): +- numbers_only = False +- if numbers_only: +- python_major_version = versions[0] +- python_minor_version = versions[1] +- break ++ if windows_python: ++ # windows does not have python version specific dir ++ usercustomize_file = "dist/Lib/site-packages/usercustomize.py" ++ else: ++ # detect python version without execution ++ # this looks for the `python#.#` binary on macos and linux ++ # and extracts the version information at the end of the binary, ++ # starlark doesn't have regex support so had to roll our own ++ # parsing. ++ python_base_dir = ctx.path("dist/bin") ++ bin_files = python_base_dir.readdir() ++ python_major_version = -1 ++ python_minor_version = -1 ++ for bin_file in bin_files: ++ basename = bin_file.basename ++ if basename.startswith("python"): ++ numeric = basename.replace("python", "") ++ versions = numeric.split(".") ++ if len(versions) == 2: ++ numbers_only = True ++ for version in versions: ++ if not version.isdigit(): ++ numbers_only = False ++ if numbers_only: ++ python_major_version = versions[0] ++ python_minor_version = versions[1] ++ break + +- if python_major_version == -1 or python_minor_version == -1: +- ctx.fail("Could not detect python versions") ++ if python_major_version == -1 or python_minor_version == -1: ++ ctx.fail("Could not detect python versions") + +- usercustomize_file = "dist/lib/python" + python_major_version + "." + python_minor_version + "/site-packages/usercustomize.py" ++ usercustomize_file = "dist/lib/python" + python_major_version + "." + python_minor_version + "/site-packages/usercustomize.py" + +- ctx.file( +- usercustomize_file, +- """ ++ ctx.file( ++ usercustomize_file, ++ """ + import sys + import os + import tempfile + sys.pycache_prefix = os.path.join(tempfile.gettempdir(), "bazel_pycache") + """, +- ) ++ ) + + ctx.report_progress("generating build file") + os_constraint = OS_TO_PLATFORM_MAP[os] +@@ -152,7 +159,7 @@ + #ctx.execute(['icacls', 'dist', '/inheritance:r', '/grant:r', 'Everyone:R', '/T']) + #ctx.execute(['icacls', 'dist', '/inheritance:r', '/grant:r', 'Administrators:R', '/T']) + pass +- else: ++ elif not ctx.os.environ.get("MONGO_USE_SYSTEM_PYTHON"): + ctx.execute(["chmod", "-R", "544", "dist"]) + + ctx.template( +@@ -173,7 +180,7 @@ + doc = "Expected SHA-256 sum of the archive.", + ), + "os": attr.string( +- values = ["macos", "linux", "windows"], ++ values = ["macos", "linux", "windows", "freebsd"], + doc = "Host operating system.", + ), + "arch": attr.string( +@@ -189,6 +196,7 @@ + doc = "Label denoting the BUILD file template that get's installed in the repo.", + ), + }, ++ environ = ["MONGO_USE_SYSTEM_PYTHON", "PYTHON_CMD"], + ) + + def setup_mongo_python_toolchains(): +@@ -231,6 +239,24 @@ def setup_mongo_python_toolchains(): + urls = [URLS_MAP["linux_s390x"]["url"]], + ) + ++ py_download( ++ name = "py_freebsd_arm64", ++ arch = "aarch64", ++ os = "freebsd", ++ ) ++ ++ py_download( ++ name = "py_freebsd_x86_64", ++ arch = "amd64", ++ os = "freebsd", ++ ) ++ ++ py_download( ++ name = "py_freebsd_ppc64le", ++ arch = "ppc64le", ++ os = "freebsd", ++ ) ++ + py_download( + name = "py_windows_x86_64", + arch = "amd64", +@@ -260,5 +286,8 @@ def setup_mongo_python_toolchains(): + + return ( ++ "@py_freebsd_arm64//:python_toolchain", ++ "@py_freebsd_x86_64//:python_toolchain", ++ "@py_freebsd_ppc64le//:python_toolchain", + "@py_linux_arm64//:python_toolchain", + "@py_linux_x86_64//:python_toolchain", + "@py_linux_ppc64le//:python_toolchain", diff --git a/databases/mongodb80/files/patch-buildscripts_scons.py b/databases/mongodb80/files/patch-buildscripts_scons.py deleted file mode 100644 index 5759ae7f71d9..000000000000 --- a/databases/mongodb80/files/patch-buildscripts_scons.py +++ /dev/null @@ -1,18 +0,0 @@ ---- buildscripts/scons.py.orig 2024-07-23 11:11:41 UTC -+++ buildscripts/scons.py -@@ -18,15 +18,6 @@ sys.path = [SCONS_DIR, SITE_TOOLS_DIR] + sys.path - - sys.path = [SCONS_DIR, SITE_TOOLS_DIR] + sys.path - --# pylint: disable=C0413 --from mongo.pip_requirements import verify_requirements, MissingRequirements -- --try: -- verify_requirements() --except MissingRequirements as ex: -- print(ex) -- sys.exit(1) -- - try: - import SCons.Script - except ImportError as import_err: diff --git a/databases/mongodb80/files/patch-src_BUILD.bazel b/databases/mongodb80/files/patch-src_BUILD.bazel new file mode 100644 index 000000000000..04c5ced0b6c6 --- /dev/null +++ b/databases/mongodb80/files/patch-src_BUILD.bazel @@ -0,0 +1,21 @@ +--- src/BUILD.bazel.orig ++++ src/BUILD.bazel +@@ -239,6 +239,8 @@ mongo_cc_library( + "//src/mongo/db/matcher:matcher_global_hdrs", + "//src/mongo/db/matcher/schema:encrypt_schema_idl_gen", + "//src/mongo/db/matcher/schema:schema_global_hdrs", ++ ] + select({ ++ "//bazel/config:build_enterprise_enabled": [ + "//src/mongo/db/modules/enterprise:enterprise_global_hdrs", + "//src/mongo/db/modules/enterprise/docs:docs_global_hdrs", + "//src/mongo/db/modules/enterprise/docs/fle:fle_global_hdrs", +@@ -328,6 +330,9 @@ mongo_cc_library( + "//src/mongo/db/modules/enterprise/src/util:util_global_hdrs", + "//src/mongo/db/modules/enterprise/src/workloads:workloads_global_hdrs", + "//src/mongo/db/modules/enterprise/src/workloads/streams:streams_global_hdrs", ++ ], ++ "//conditions:default": [], ++ }) + [ + "//src/mongo/db/op_observer:op_observer_global_hdrs", + "//src/mongo/db/ops:delete_request_idl_gen", + "//src/mongo/db/ops:ops_global_hdrs", diff --git a/databases/mongodb80/files/patch-src_mongo_BUILD.bazel b/databases/mongodb80/files/patch-src_mongo_BUILD.bazel new file mode 100644 index 000000000000..1dc13403e361 --- /dev/null +++ b/databases/mongodb80/files/patch-src_mongo_BUILD.bazel @@ -0,0 +1,12 @@ +--- src/mongo/BUILD.bazel.orig 2026-09-29 00:00:00 UTC ++++ src/mongo/BUILD.bazel +@@ -76,6 +76,9 @@ config_header( + "//bazel/config:ssl_enabled_linux": { + "MONGO_CONFIG_SSL_PROVIDER": "MONGO_CONFIG_SSL_PROVIDER_OPENSSL", + }, ++ "//bazel/config:ssl_enabled_freebsd": { ++ "MONGO_CONFIG_SSL_PROVIDER": "MONGO_CONFIG_SSL_PROVIDER_OPENSSL", ++ }, + "//conditions:default": {}, + }) | select({ + "//bazel/config:use_ocsp_stapling_enabled": { diff --git a/databases/mongodb80/files/patch-src_mongo_BUILD.bazel_stack__locator__freebsd b/databases/mongodb80/files/patch-src_mongo_BUILD.bazel_stack__locator__freebsd new file mode 100644 index 000000000000..f7fd35ee315a --- /dev/null +++ b/databases/mongodb80/files/patch-src_mongo_BUILD.bazel_stack__locator__freebsd @@ -0,0 +1,10 @@ +--- src/mongo/BUILD.bazel.orig 2026-09-29 00:00:00 UTC ++++ src/mongo/BUILD.bazel +@@ -233,6 +233,7 @@ mongo_cc_library( + "//conditions:default": [], + }) + select({ + "@platforms//os:linux": ["//src/mongo/platform:stack_locator_linux.cpp"], ++ "@platforms//os:freebsd": ["//src/mongo/platform:stack_locator_freebsd.cpp"], + "@platforms//os:macos": ["//src/mongo/platform:stack_locator_osx.cpp"], + "@platforms//os:windows": ["//src/mongo/platform:stack_locator_windows.cpp"], + "//conditions:default": [], diff --git a/databases/mongodb80/files/patch-src_mongo_crypto_crypto__parameters__openssl.idl b/databases/mongodb80/files/patch-src_mongo_crypto_crypto__parameters__openssl.idl new file mode 100644 index 000000000000..6f7a33f6608c --- /dev/null +++ b/databases/mongodb80/files/patch-src_mongo_crypto_crypto__parameters__openssl.idl @@ -0,0 +1,17 @@ +--- src/mongo/crypto/crypto_parameters_openssl.idl.orig 2026-09-29 00:00:00 UTC ++++ src/mongo/crypto/crypto_parameters_openssl.idl +@@ -38,7 +38,7 @@ server_parameters: + default: 256 # Matches OpenSSL default + redact: false + condition: +- preprocessor: "defined(__linux__)" ++ preprocessor: "defined(__linux__) || defined(__FreeBSD__)" + + opensslPrimaryDRBGReseedMaxTime: + description: Max amount of time that can pass before the primary DRBG must reseed +@@ -49,4 +49,4 @@ server_parameters: + default: 3600 # 1 hour, matches OpenSSL default + redact: false + condition: +- preprocessor: "defined(__linux__)" ++ preprocessor: "defined(__linux__) || defined(__FreeBSD__)" diff --git a/databases/mongodb80/files/patch-src_mongo_db_ftdc_BUILD.bazel b/databases/mongodb80/files/patch-src_mongo_db_ftdc_BUILD.bazel new file mode 100644 index 000000000000..2f3e720fd948 --- /dev/null +++ b/databases/mongodb80/files/patch-src_mongo_db_ftdc_BUILD.bazel @@ -0,0 +1,10 @@ +--- src/mongo/db/ftdc/BUILD.bazel.orig ++++ src/mongo/db/ftdc/BUILD.bazel +@@ -143,6 +143,7 @@ mongo_cc_library( + "@platforms//os:windows": "windows", + "@platforms//os:linux": "linux", + "@platforms//os:macos": "osx", ++ "@platforms//os:freebsd": "osx", + }.items() + }), + hdrs = [ diff --git a/databases/mongodb80/files/patch-src_mongo_platform_stack__locator__freebsd.cpp b/databases/mongodb80/files/patch-src_mongo_platform_stack__locator__freebsd.cpp new file mode 100644 index 000000000000..bf1f610504ee --- /dev/null +++ b/databases/mongodb80/files/patch-src_mongo_platform_stack__locator__freebsd.cpp @@ -0,0 +1,65 @@ +--- /dev/null 2026-09-29 00:00:00 UTC ++++ src/mongo/platform/stack_locator_freebsd.cpp +@@ -0,0 +1,62 @@ ++/** ++ * Copyright (C) 2018-present MongoDB, Inc. ++ * ++ * This program is free software: you can redistribute it and/or modify ++ * it under the terms of the Server Side Public License, version 1, ++ * as published by MongoDB, Inc. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * Server Side Public License for more details. ++ * ++ * You should have received a copy of the Server Side Public License ++ * along with this program. If not, see ++ * . ++ * ++ * As a special exception, the copyright holders give permission to link the ++ * code of portions of this program with the OpenSSL library under certain ++ * conditions as described in each individual source file and distribute ++ * linked combinations including the program with the OpenSSL library. You ++ * must comply with the Server Side Public License in all respects for ++ * all of the code used other than as permitted herein. If you modify file(s) ++ * with this exception, you may extend this exception to your version of the ++ * file(s), but you are not obligated to do so. If you do not wish to do so, ++ * delete this exception statement from your version. If you delete this ++ * exception statement from all source files in the program, then also delete ++ * it in the license file. ++ */ ++ ++#include "mongo/platform/basic.h" ++ ++#include "mongo/platform/stack_locator.h" ++ ++#include ++#include ++ ++#include "mongo/util/assert_util.h" ++#include "mongo/util/scopeguard.h" ++ ++namespace mongo { ++ ++StackLocator::StackLocator() { ++ pthread_attr_t selfAttrs; ++ invariant(pthread_attr_get_np(pthread_self(), &selfAttrs) == 0); ++ ON_BLOCK_EXIT([&] { pthread_attr_destroy(&selfAttrs); }); ++ ++ void* base = nullptr; ++ size_t size = 0; ++ ++ auto result = pthread_attr_getstack(&selfAttrs, &base, &size); ++ ++ invariant(result == 0); ++ invariant(base != nullptr); ++ invariant(size != 0); ++ ++ // TODO: Assumes a downward growing stack. getstack returns the stack base, ++ // so add the size to get the top of the current thread's stack. ++ _end = base; ++ _begin = static_cast(_end) + size; ++} ++ ++} // namespace mongo diff --git a/databases/mongodb80/files/patch-src_mongo_transport_asio_asio__session__impl.cpp b/databases/mongodb80/files/patch-src_mongo_transport_asio_asio__session__impl.cpp new file mode 100644 index 000000000000..dc332d440b5c --- /dev/null +++ b/databases/mongodb80/files/patch-src_mongo_transport_asio_asio__session__impl.cpp @@ -0,0 +1,11 @@ +--- src/mongo/transport/asio/asio_session_impl.cpp.orig 2026-09-29 00:00:00 UTC ++++ src/mongo/transport/asio/asio_session_impl.cpp +@@ -270,7 +270,7 @@ CommonAsioSession::CommonAsioSession(GenericSocket soc + #endif + } + +-#ifdef __APPLE__ ++#if defined(__APPLE__) || defined(__FreeBSD__) + StatusWith getPeerGid(AsioSession::GenericSocket::native_handle_type handle) { + [[maybe_unused]] uid_t remoteUid; + gid_t remoteGid; diff --git a/databases/mongodb80/files/patch-src_third__party_IntelRDFPMathLib20U1_BUILD.bazel b/databases/mongodb80/files/patch-src_third__party_IntelRDFPMathLib20U1_BUILD.bazel new file mode 100644 index 000000000000..39c7e56d423f --- /dev/null +++ b/databases/mongodb80/files/patch-src_third__party_IntelRDFPMathLib20U1_BUILD.bazel @@ -0,0 +1,13 @@ +--- src/third_party/IntelRDFPMathLib20U1/BUILD.bazel.orig ++++ src/third_party/IntelRDFPMathLib20U1/BUILD.bazel +@@ -31,6 +31,10 @@ INTEL_RDFP_MATHLIB_DEFINES = [ + "LINUX=1", + "linux=1", + ], ++ "@platforms//os:freebsd": [ ++ "LINUX=1", ++ "linux=1", ++ ], + "@platforms//os:macos": [ + "LINUX=1", + "mach=1", diff --git a/databases/mongodb80/files/patch-src_third__party_asio-master_asio_include_asio_detail_config.hpp b/databases/mongodb80/files/patch-src_third__party_asio-master_asio_include_asio_detail_config.hpp new file mode 100644 index 000000000000..3a7379cc0c28 --- /dev/null +++ b/databases/mongodb80/files/patch-src_third__party_asio-master_asio_include_asio_detail_config.hpp @@ -0,0 +1,18 @@ +--- src/third_party/asio-master/asio/include/asio/detail/config.hpp.orig 2026-09-29 00:00:00 UTC ++++ src/third_party/asio-master/asio/include/asio/detail/config.hpp +@@ -881,12 +881,15 @@ + #if !defined(ASIO_HAS_STD_INVOKE_RESULT) + # if !defined(ASIO_DISABLE_STD_INVOKE_RESULT) ++# if defined(__FreeBSD__) && (__cplusplus >= 201703) ++# define ASIO_HAS_STD_INVOKE_RESULT 1 ++# endif // defined(__FreeBSD__) && (__cplusplus >= 201703) + # if defined(ASIO_MSVC) + # if (_MSC_VER >= 1911 && _MSVC_LANG >= 201703) + # define ASIO_HAS_STD_INVOKE_RESULT 1 + # endif // (_MSC_VER >= 1911 && _MSVC_LANG >= 201703) + # endif // defined(ASIO_MSVC) + # endif // !defined(ASIO_DISABLE_STD_INVOKE_RESULT) + #endif // !defined(ASIO_HAS_STD_INVOKE_RESULT) + + // Windows App target. Windows but with a limited API. + #if !defined(ASIO_WINDOWS_APP) diff --git a/databases/mongodb80/files/patch-src_third__party_boost_BUILD.bazel b/databases/mongodb80/files/patch-src_third__party_boost_BUILD.bazel new file mode 100644 index 000000000000..7cd5d172b26d --- /dev/null +++ b/databases/mongodb80/files/patch-src_third__party_boost_BUILD.bazel @@ -0,0 +1,33 @@ +--- src/third_party/boost/BUILD.bazel.orig ++++ src/third_party/boost/BUILD.bazel +@@ -126,6 +126,10 @@ mongo_cc_library( + "libs/thread/src/pthread/once.cpp", + "libs/thread/src/pthread/thread.cpp", + ], ++ "@platforms//os:freebsd": [ ++ "libs/thread/src/pthread/once.cpp", ++ "libs/thread/src/pthread/thread.cpp", ++ ], + "@platforms//os:windows": [ + "libs/thread/src/win32/thread.cpp", + "libs/thread/src/win32/thread_primitives.cpp", +@@ -140,6 +144,9 @@ mongo_cc_library( + "@platforms//os:macos": [ + "libs/thread/src/pthread/once_atomic.cpp", + ], ++ "@platforms//os:freebsd": [ ++ "libs/thread/src/pthread/once_atomic.cpp", ++ ], + "//conditions:default": [], + }), + copts = BOOST_COPTS, +@@ -151,6 +158,9 @@ mongo_cc_library( + "@platforms//os:macos": [ + "BOOST_THREAD_PTHREAD", + ], ++ "@platforms//os:freebsd": [ ++ "BOOST_THREAD_PTHREAD", ++ ], + "@platforms//os:windows": [ + "BOOST_THREAD_WIN32", + ], diff --git a/databases/mongodb80/files/patch-src_third__party_boost_boost_thread_future.hpp b/databases/mongodb80/files/patch-src_third__party_boost_boost_thread_future.hpp deleted file mode 100644 index cf4ad80ef93d..000000000000 --- a/databases/mongodb80/files/patch-src_third__party_boost_boost_thread_future.hpp +++ /dev/null @@ -1,18 +0,0 @@ -https://github.com/boostorg/thread/issues/402 - -In file included from src/third_party/boost/libs/thread/src/pthread/thread.cpp:19: -src/third_party/boost/boost/thread/future.hpp:4672:19: error: no member named 'that' in 'run_it'; did you mean 'that_'? - 4672 | that_=x.that; - | ^~~~ - ---- src/third_party/boost/boost/thread/future.hpp.orig 2024-12-12 08:36:29 UTC -+++ src/third_party/boost/boost/thread/future.hpp -@@ -4669,7 +4669,7 @@ namespace detail - } - run_it& operator=(BOOST_THREAD_RV_REF(run_it) x) BOOST_NOEXCEPT { - if (this != &x) { -- that_=x.that; -+ that_=x.that_; - x.that_.reset(); - } - return *this; diff --git a/databases/mongodb80/files/patch-src_third__party_libbson_BUILD.bazel b/databases/mongodb80/files/patch-src_third__party_libbson_BUILD.bazel new file mode 100644 index 000000000000..3f50ccc5af5d --- /dev/null +++ b/databases/mongodb80/files/patch-src_third__party_libbson_BUILD.bazel @@ -0,0 +1,32 @@ +--- src/third_party/libbson/BUILD.bazel.orig ++++ src/third_party/libbson/BUILD.bazel +@@ -37,6 +37,7 @@ mongo_cc_library( + "@platforms//os:windows": glob(["build_windows/**/*.h"]), + "@platforms//os:macos": glob(["build_osx/**/*.h"]), + "@platforms//os:linux": glob(["build_linux/**/*.h"]), ++ "@platforms//os:freebsd": glob(["build_osx/**/*.h"]), + "//bazel/config:linux_s390x": glob(["build_linux_s390x/**/*.h"]), + "//conditions:default": [], + }), +@@ -54,6 +55,10 @@ mongo_cc_library( + "-Wno-unguarded-availability-new", + "-Wno-implicit-fallthrough", + ], ++ "@platforms//os:freebsd": [ ++ "-Wno-sign-compare", ++ "-Wno-implicit-fallthrough", ++ ], + "@platforms//os:linux": [ + "-Wno-sign-compare", + "-Wno-implicit-fallthrough", +@@ -76,6 +81,10 @@ mongo_cc_library( + "build_osx", + "build_osx/bson", + ], ++ "@platforms//os:freebsd": [ ++ "build_osx", ++ "build_osx/bson", ++ ], + "@platforms//os:linux": [ + "build_linux", + "build_linux/bson", diff --git a/databases/mongodb80/files/patch-src_third__party_libmongocrypt_BUILD.bazel b/databases/mongodb80/files/patch-src_third__party_libmongocrypt_BUILD.bazel new file mode 100644 index 000000000000..e36bb6ff665b --- /dev/null +++ b/databases/mongodb80/files/patch-src_third__party_libmongocrypt_BUILD.bazel @@ -0,0 +1,33 @@ +--- src/third_party/libmongocrypt/BUILD.bazel.orig ++++ src/third_party/libmongocrypt/BUILD.bazel +@@ -35,6 +35,14 @@ CRYPTO_CONFIGS = { + "dist/src/crypto/libcrypto.c", + ], + }, ++ "//bazel/config:ssl_enabled_freebsd": { ++ "local_defines": ["KMS_MESSAGE_ENABLE_CRYPTO_LIBCRYPTO"], ++ "includes": ["build_libcrypto"], ++ "srcs": [ ++ "dist/kms-message/src/kms_crypto_libcrypto.c", ++ "dist/src/crypto/libcrypto.c", ++ ], ++ }, + } + + CRYPTO_SRCS = select({ +@@ -142,6 +150,7 @@ mongo_cc_library( + "linux", + ] + } | { ++ "@platforms//os:freebsd": ["build_linux/mongocrypt-export.h"], + "//conditions:default": ["//conditions:incompatible"], + }), + copts = [ +@@ -174,6 +183,7 @@ mongo_cc_library( + "linux", + ] + } | { ++ "@platforms//os:freebsd": ["build_linux"], + "//conditions:default": ["//conditions:incompatible"], + }) + CRYPTO_INCLUDES, + linkopts = select({ diff --git a/databases/mongodb80/files/patch-src_third__party_mozjs_BUILD.bazel b/databases/mongodb80/files/patch-src_third__party_mozjs_BUILD.bazel new file mode 100644 index 000000000000..3e22fe45ba8b --- /dev/null +++ b/databases/mongodb80/files/patch-src_third__party_mozjs_BUILD.bazel @@ -0,0 +1,23 @@ +--- src/third_party/mozjs/BUILD.bazel.orig ++++ src/third_party/mozjs/BUILD.bazel +@@ -7,6 +7,9 @@ PLATFORMS = { + "//bazel/config:linux_ppc64le": ("ppc64le", "linux"), + "//bazel/config:linux_s390x": ("s390x", "linux"), + "//bazel/config:windows_x86_64": ("x86_64", "windows"), ++ "//bazel/config:freebsd_aarch64": ("aarch64", "freebsd"), ++ "//bazel/config:freebsd_ppc64le": ("ppc64le", "freebsd"), ++ "//bazel/config:freebsd_x86_64": ("x86_64", "freebsd"), + "//bazel/config:macos_x86_64": ("x86_64", "macOS"), + "//bazel/config:macos_aarch64": ("aarch64", "macOS"), + } +@@ -281,6 +284,10 @@ mongo_cc_library( + ], + "//conditions:default": [], + }), ++ cxxopts = select({ ++ "@platforms//os:freebsd": ["-std=c++20"], ++ "//conditions:default": [], ++ }), + defines = [ + "JS_USE_CUSTOM_ALLOCATOR=1", + "STATIC_JS_API=1", diff --git a/databases/mongodb80/files/patch-src_third__party_mozjs_gen-config.sh b/databases/mongodb80/files/patch-src_third__party_mozjs_scripts_gen-config.sh similarity index 62% rename from databases/mongodb80/files/patch-src_third__party_mozjs_gen-config.sh rename to databases/mongodb80/files/patch-src_third__party_mozjs_scripts_gen-config.sh index c8e25c733ec9..0f98b5bde367 100644 --- a/databases/mongodb80/files/patch-src_third__party_mozjs_gen-config.sh +++ b/databases/mongodb80/files/patch-src_third__party_mozjs_scripts_gen-config.sh @@ -1,45 +1,48 @@ ---- src/third_party/mozjs/gen-config.sh.orig 2025-07-07 23:12:17 UTC -+++ src/third_party/mozjs/gen-config.sh -@@ -1,4 +1,4 @@ --#!/bin/bash -+#!/bin/sh - - set -e - set -v -@@ -7,7 +7,7 @@ then +--- src/third_party/mozjs/scripts/gen-config.sh.orig ++++ src/third_party/mozjs/scripts/gen-config.sh +@@ -7,7 +7,7 @@ if [ $# -ne 2 ] then echo "Please supply an arch: x86_64, i386, etc and a platform: osx, linux, windows, etc" - exit 0; + exit 1; fi _BuiltPathPrefix="mozilla-release/js/src/_build/js/src" -@@ -29,6 +29,9 @@ case "$_Path" in +@@ -29,6 +29,9 @@ } case "$_Path" in + "platform/aarch64/freebsd") + _CONFIG_OPTS="--host=aarch64-freebsd" -+ ;; ++ ;; "platform/aarch64/linux") _CONFIG_OPTS="--host=aarch64-linux" ;; -@@ -111,7 +114,7 @@ CFLAGS="$CFLAGS -D__STDC_FORMAT_MACROS" \ +@@ -98,7 +101,7 @@ + + echo "Run configure" + # The 'ppc64le/linux' platform requires the additional 'CXXFLAGS' and 'CFLAGS' flags to compile +-CXXFLAGS="$CXXFLAGS -D__STDC_FORMAT_MACROS"\ ++CXXFLAGS="$CXXFLAGS -D__STDC_FORMAT_MACROS" \ + CFLAGS="$CFLAGS -D__STDC_FORMAT_MACROS" \ + ../configure \ + --disable-jemalloc \ +@@ -111,7 +114,7 @@ --disable-wasm-moz-intgemm \ "$_CONFIG_OPTS" -make recurse_export +gmake recurse_export cd ../../../.. -@@ -166,7 +169,7 @@ find "$_Path/build" -name '*.cpp' | +@@ -166,7 +169,7 @@ find "$_Path/build" -name '*.cpp' | while read unified_file ; do echo "Processing $unified_file" - sed $SEDOPTION \ + gsed $SEDOPTION \ -e 's|#include ".*/js/src/|#include "|' \ -e 's|#error ".*/js/src/|#error "|' \ "$unified_file" diff --git a/databases/mongodb80/files/patch-src_third__party_s2_BUILD.bazel b/databases/mongodb80/files/patch-src_third__party_s2_BUILD.bazel new file mode 100644 index 000000000000..ee51d13694ff --- /dev/null +++ b/databases/mongodb80/files/patch-src_third__party_s2_BUILD.bazel @@ -0,0 +1,13 @@ +--- src/third_party/s2/BUILD.bazel.orig ++++ src/third_party/s2/BUILD.bazel +@@ -41,6 +41,10 @@ mongo_cc_library( + ], + "//conditions:default": [], + }), ++ cxxopts = select({ ++ "@platforms//os:freebsd": ["-std=c++20"], ++ "//conditions:default": [], ++ }), + includes = ["."], + local_defines = [ + "DEBUG_MODE=false", diff --git a/databases/mongodb80/files/patch-src_third__party_snappy_platform_build__posix_config.h b/databases/mongodb80/files/patch-src_third__party_snappy_platform_build__posix_config.h new file mode 100644 index 000000000000..7a6167c052d3 --- /dev/null +++ b/databases/mongodb80/files/patch-src_third__party_snappy_platform_build__posix_config.h @@ -0,0 +1,11 @@ +--- src/third_party/snappy/platform/build_posix/config.h.orig ++++ src/third_party/snappy/platform/build_posix/config.h +@@ -44,7 +44,7 @@ + #define HAVE_WINDOWS_H 0 + + /* Define to 1 if you target processors with SSSE3+ and have . */ +-#define SNAPPY_HAVE_SSSE3 1 ++#define SNAPPY_HAVE_SSSE3 0 + + /* Define to 1 if you target processors with SSE4.2 and have . */ + #define SNAPPY_HAVE_X86_CRC32 0 diff --git a/databases/mongodb80/files/patch-src_third__party_wiredtiger_BUILD.bazel b/databases/mongodb80/files/patch-src_third__party_wiredtiger_BUILD.bazel new file mode 100644 index 000000000000..48a97d7b3883 --- /dev/null +++ b/databases/mongodb80/files/patch-src_third__party_wiredtiger_BUILD.bazel @@ -0,0 +1,18 @@ +--- src/third_party/wiredtiger/BUILD.bazel.orig ++++ src/third_party/wiredtiger/BUILD.bazel +@@ -54,6 +54,7 @@ WT_CCFLAGS = [ + "//conditions:default": ["-Wno-implicit-fallthrough"], + }) + select({ + "@platforms//os:linux": ["-Isrc/third_party/wiredtiger/build_linux"], ++ "@platforms//os:freebsd": ["-Isrc/third_party/wiredtiger/build_freebsd"], + "@platforms//os:windows": ["-Isrc/third_party/wiredtiger/build_win"], + "@platforms//os:macos": ["-Isrc/third_party/wiredtiger/build_darwin"], + }) + select({ +@@ -80,6 +81,7 @@ generate_config_header( + output = "wiredtiger_config.h", + template = select({ + "@platforms//os:linux": "build_linux/wiredtiger_config.h.in", ++ "@platforms//os:freebsd": "build_freebsd/wiredtiger_config.h", + "@platforms//os:windows": "build_win/wiredtiger_config.h.in", + "@platforms//os:macos": "build_darwin/wiredtiger_config.h.in", + }),