git: cc91f92841b5 - main - databases/mongodb90: 9.0.4

From: Ronald Klop <ronald_at_FreeBSD.org>
Date: Sat, 17 Oct 2026 19:29:56 UTC
The branch main has been updated by ronald:

URL: https://cgit.FreeBSD.org/ports/commit/?id=cc91f92841b5673811cd4d549b5ca897dad3b8ec

commit cc91f92841b5673811cd4d549b5ca897dad3b8ec
Author:     Ronald Klop <ronald@FreeBSD.org>
AuthorDate: 2026-10-16 09:26:52 +0000
Commit:     Ronald Klop <ronald@FreeBSD.org>
CommitDate: 2026-10-17 19:29:42 +0000

    databases/mongodb90: 9.0.4
    
    - Version bump.
    - Cleaned up patches.
    - Add patch to detect number of CPUs. This is adjusted code from mongodb80. (Unfortunately upstreams seems to remove FreeBSD code from the code base.)
    - Make sure Bazel does not detect Java from LOCALBASE/bin/java and sets JAVA_HOME=LOCALBASE.
    
    Announcement:
    https://www.mongodb.com/community/forums/t/mongodb-9-0-4-is-released/344302?u=r_k
    
    Release Notes:
    https://www.mongodb.com/docs/manual/release-notes/9.0/#904---oct-13-2026
    
    Security:       yes, see release notes for CVEs
---
 databases/mongodb90/Makefile                       |   8 +-
 databases/mongodb90/distinfo                       |   6 +-
 databases/mongodb90/files/patch-bazel_crates.lock  | 190 ++++++++-------------
 ...tch-bazel_platforms_local__config__platform.bzl |   8 +-
 .../files/patch-bazel_separate__debug.bzl          |   7 +-
 .../files/patch-src_mongo_db_ftdc_BUILD.bazel      |   8 +-
 .../patch-src_mongo_platform_waitable__atomic.cpp  |   8 +-
 .../files/patch-src_mongo_util_BUILD.bazel         |  10 ++
 .../patch-src_mongo_util_processinfo__freebsd.cpp  | 165 ++++++++++++++++++
 ...c_third__party_IntelRDFPMathLib20U1_BUILD.bazel |   6 +-
 .../files/patch-src_third__party_boost_BUILD.bazel |  20 +--
 11 files changed, 287 insertions(+), 149 deletions(-)

diff --git a/databases/mongodb90/Makefile b/databases/mongodb90/Makefile
index a9959ddb50eb..f7589c28d87e 100644
--- a/databases/mongodb90/Makefile
+++ b/databases/mongodb90/Makefile
@@ -1,7 +1,6 @@
 PORTNAME=	mongodb
 DISTVERSIONPREFIX=	r
-DISTVERSION=	9.0.0-alpha1
-PORTREVISION=	2
+DISTVERSION=	9.0.4
 CATEGORIES=	databases net
 MASTER_SITES+=	https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-${WASI_SDK_VERSION:R}/:wasi_sdk \
 		https://codeload.github.com/bazelbuild/bazel-central-registry/tar.gz/${BAZEL_REGISTRY_COMMIT}?dummy=/:bazel_registry \
@@ -203,6 +202,11 @@ BAZEL_ARGS=		--repository_cache=${BAZEL_REPOSITORY_CACHE} \
 			--linkopt=-lexecinfo \
 			--linkopt=-lkvm \
 			--noexperimental_collect_system_network_usage
+# rules_java registers the @local_jdk toolchains, which Bazel loads even though
+# the build does not use Java. Without JAVA_HOME, @local_jdk takes the java home
+# from "which javac", which for the javavm wrapper is ${LOCALBASE}, and globs all
+# of it. A JAVA_HOME without bin/java gives stub toolchains instead.
+BAZEL_ARGS+=		--repo_env=JAVA_HOME=/nonexistent
 ALL_TARGET=		install-core
 
 CONFLICTS_INSTALL=	mongodb[0-9][0-9]
diff --git a/databases/mongodb90/distinfo b/databases/mongodb90/distinfo
index a7299d452886..a9982ae67b88 100644
--- a/databases/mongodb90/distinfo
+++ b/databases/mongodb90/distinfo
@@ -1,4 +1,4 @@
-TIMESTAMP = 1792065294
+TIMESTAMP = 1792141438
 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-092d43107d13e711ac4ac92050d8b570bcc8ef43_GH0.tar.gz) = 533a0178767be4d79a67ae43890970485217f031adf090ef28c5c18e8fd337d8
@@ -1401,7 +1401,7 @@ SHA256 (rust/crates/zstd-safe-7.0.0.crate) = 43747c7422e2924c11144d5229878b98180
 SIZE (rust/crates/zstd-safe-7.0.0.crate) = 20463
 SHA256 (rust/crates/zstd-sys-2.0.9+zstd.1.5.5.crate) = 9e16efa8a874a0481a574084d34cc26fdb3b99627480f785888deb6386506656
 SIZE (rust/crates/zstd-sys-2.0.9+zstd.1.5.5.crate) = 728791
-SHA256 (mongodb-mongo-r9.0.0-alpha1_GH0.tar.gz) = 7aadc37373fc88954ae1f358ae2ac05a14a430d2fb1cec1f5823a6618631359a
-SIZE (mongodb-mongo-r9.0.0-alpha1_GH0.tar.gz) = 116678568
+SHA256 (mongodb-mongo-r9.0.4_GH0.tar.gz) = 788aa3b71287edc5f77a51aab381b1a962629db6305aa0a4962f9caf1163de80
+SIZE (mongodb-mongo-r9.0.4_GH0.tar.gz) = 116516190
 SHA256 (mongodb-forks-spidermonkey-7aeaf7a44d420360bde75db8453636092c3e2f56_GH0.tar.gz) = 8ec7aa1399b6fb15b859c448ae6f361ab28cf48bd8fc4f0de2fb3776582e202f
 SIZE (mongodb-forks-spidermonkey-7aeaf7a44d420360bde75db8453636092c3e2f56_GH0.tar.gz) = 392664341
diff --git a/databases/mongodb90/files/patch-bazel_crates.lock b/databases/mongodb90/files/patch-bazel_crates.lock
index b40e82206471..ab77b04e5086 100644
--- a/databases/mongodb90/files/patch-bazel_crates.lock
+++ b/databases/mongodb90/files/patch-bazel_crates.lock
@@ -1,31 +1,31 @@
---- bazel/crates.lock.orig
+--- bazel/crates.lock.orig	2026-10-14 17:59:44 UTC
 +++ bazel/crates.lock
-@@ -1587,6 +1587,12 @@
-           ],
-           "selects": {
-             "aarch64-apple-darwin": [
+@@ -1592,6 +1592,12 @@
+                 "target": "libc"
+               }
+             ],
++            "aarch64-unknown-freebsd": [
 +              {
 +                "id": "libc 0.2.184",
 +                "target": "libc"
 +              }
 +            ],
-+            "aarch64-unknown-freebsd": [
+             "aarch64-unknown-linux-gnu": [
                {
                  "id": "libc 0.2.184",
+@@ -1616,6 +1622,12 @@
                  "target": "libc"
-@@ -1611,6 +1617,12 @@
                }
              ],
-             "x86_64-apple-darwin": [
++            "x86_64-unknown-freebsd": [
 +              {
 +                "id": "libc 0.2.184",
 +                "target": "libc"
 +              }
 +            ],
-+            "x86_64-unknown-freebsd": [
+             "x86_64-unknown-linux-gnu": [
                {
                  "id": "libc 0.2.184",
-                 "target": "libc"
 @@ -4248,6 +4260,9 @@
              "aarch64-apple-darwin": [
                "default"
@@ -36,49 +36,49 @@
              "aarch64-unknown-linux-gnu": [
                "default"
              ],
-@@ -4258,6 +4273,9 @@
+@@ -4260,6 +4275,9 @@
+             "x86_64-apple-darwin": [
                "default"
              ],
-             "x86_64-apple-darwin": [
++            "x86_64-unknown-freebsd": [
 +              "default"
 +            ],
-+            "x86_64-unknown-freebsd": [
-               "default"
-             ],
              "x86_64-unknown-linux-gnu": [
-@@ -8575,6 +8593,9 @@
-           ],
-           "selects": {
+               "default"
+             ]
+@@ -8577,6 +8595,9 @@
              "aarch64-apple-darwin": [
-+              "extra_traits"
-+            ],
-+            "aarch64-unknown-freebsd": [
                "extra_traits"
              ],
++            "aarch64-unknown-freebsd": [
++              "extra_traits"
++            ],
              "powerpc64le-unknown-linux-gnu": [
-@@ -8584,6 +8605,9 @@
                "extra_traits"
              ],
+@@ -8585,6 +8606,9 @@
+             ],
              "x86_64-apple-darwin": [
-+              "extra_traits"
+               "extra_traits"
 +            ],
 +            "x86_64-unknown-freebsd": [
-               "extra_traits"
++              "extra_traits"
              ]
            }
-@@ -11015,6 +11039,12 @@
-           ],
-           "selects": {
-             "aarch64-apple-darwin": [
+         },
+@@ -11020,6 +11044,12 @@
+                 "target": "libc"
+               }
+             ],
++            "aarch64-unknown-freebsd": [
 +              {
 +                "id": "libc 0.2.184",
 +                "target": "libc"
 +              }
 +            ],
-+            "aarch64-unknown-freebsd": [
+             "aarch64-unknown-linux-gnu": [
                {
                  "id": "libc 0.2.184",
-                 "target": "libc"
 @@ -11044,6 +11074,12 @@
                  "target": "libc"
                }
@@ -92,10 +92,11 @@
              "x86_64-unknown-linux-gnu": [
                {
                  "id": "libc 0.2.184",
-@@ -11918,6 +11954,17 @@
-           ],
-           "selects": {
-             "aarch64-apple-darwin": [
+@@ -11928,6 +11964,17 @@
+                 "target": "libc"
+               }
+             ],
++            "aarch64-unknown-freebsd": [
 +              {
 +                "id": "errno 0.3.14",
 +                "target": "errno",
@@ -106,10 +107,9 @@
 +                "target": "libc"
 +              }
 +            ],
-+            "aarch64-unknown-freebsd": [
+             "cfg(all(any(target_os = \"android\", target_os = \"linux\"), any(rustix_use_libc, miri, not(all(target_os = \"linux\", any(target_endian = \"little\", target_arch = \"s390x\"), any(target_arch = \"arm\", all(target_arch = \"aarch64\", target_pointer_width = \"64\"), target_arch = \"riscv64\", all(rustix_use_experimental_asm, target_arch = \"powerpc64\"), all(rustix_use_experimental_asm, target_arch = \"s390x\"), all(rustix_use_experimental_asm, target_arch = \"mips\"), all(rustix_use_experimental_asm, target_arch = \"mips32r6\"), all(rustix_use_experimental_asm, target_arch = \"mips64\"), all(rustix_use_experimental_asm, target_arch = \"mips64r6\"), target_arch = \"x86\", all(target_arch = \"x86_64\", target_pointer_width = \"64\")))))))": [
                {
-                 "id": "errno 0.3.14",
-                 "target": "errno",
+                 "id": "linux-raw-sys 0.4.15",
 @@ -11994,6 +12041,17 @@
                  "id": "libc 0.2.184",
                  "target": "libc"
@@ -196,30 +196,27 @@
              ]
            }
          },
-@@ -14498,7 +14596,17 @@
-           ],
-           "selects": {
-             "aarch64-apple-darwin": [
+@@ -14507,6 +14605,16 @@
+                 "target": "signal_hook_registry"
+               }
+             ],
++            "aarch64-unknown-freebsd": [
 +              {
 +                "id": "libc 0.2.184",
 +                "target": "libc"
 +              },
-               {
++              {
 +                "id": "signal-hook-registry 1.4.8",
 +                "target": "signal_hook_registry"
 +              }
 +            ],
-+            "aarch64-unknown-freebsd": [
-+              {
-                 "id": "libc 0.2.184",
-                 "target": "libc"
-               },
-@@ -14551,6 +14659,16 @@
+             "aarch64-unknown-linux-gnu": [
                {
-                 "id": "windows-sys 0.61.2",
+                 "id": "libc 0.2.184",
+@@ -14553,6 +14661,16 @@
                  "target": "windows_sys"
-+              }
-+            ],
+               }
+             ],
 +            "x86_64-unknown-freebsd": [
 +              {
 +                "id": "libc 0.2.184",
@@ -228,68 +225,38 @@
 +              {
 +                "id": "signal-hook-registry 1.4.8",
 +                "target": "signal_hook_registry"
++              }
++            ],
+             "x86_64-unknown-linux-gnu": [
+               {
+                 "id": "libc 0.2.184",
+@@ -17404,6 +17522,12 @@
+                 "target": "rustix"
                }
              ],
-             "x86_64-unknown-linux-gnu": [
-@@ -17149,13 +17267,13 @@
-         "Http": {
-           "url": "https://static.crates.io/crates/wasmtime/44.0.1/download",
-           "sha256": "372db8bbad8ec962038101f75ab2c3ffcd18797d7d3ae877a58ab9873cd0c4bd",
-+          "patch_args": [
-+            "-p1"
-+          ],
-           "patches": [
-             "@@//bazel/wasmtime:val_bytes_fast_path.patch",
-             "@@//bazel/wasmtime:val_bytes_lift_fast_path.patch",
-             "@@//bazel/wasmtime:val_bytes_wave_fast_path.patch"
--          ],
--          "patch_args": [
--            "-p1"
-           ]
-         }
-       },
-@@ -17398,6 +17516,12 @@
-                 "id": "mach2 0.4.3",
-                 "target": "mach2"
-               },
++            "aarch64-unknown-freebsd": [
 +              {
 +                "id": "rustix 1.1.4",
 +                "target": "rustix"
 +              }
 +            ],
-+            "aarch64-unknown-freebsd": [
-               {
-                 "id": "rustix 1.1.4",
-                 "target": "rustix"
-@@ -17455,6 +17579,12 @@
+             "aarch64-unknown-linux-gnu": [
                {
-                 "id": "windows-sys 0.61.2",
+                 "id": "memfd 0.6.5",
+@@ -17458,6 +17582,12 @@
                  "target": "windows_sys"
-+              }
-+            ],
+               }
+             ],
 +            "x86_64-unknown-freebsd": [
 +              {
 +                "id": "rustix 1.1.4",
 +                "target": "rustix"
-               }
-             ],
++              }
++            ],
              "x86_64-unknown-linux-gnu": [
-@@ -20196,11 +20326,11 @@
-         "Http": {
-           "url": "https://static.crates.io/crates/wasmtime-wast/44.0.1/download",
-           "sha256": "5db969fb0fbd4c3e4acfa73f768b2530b6cec43180902934599b1668480094c2",
--          "patches": [
--            "@@//bazel/wasmtime:val_bytes_wast_fast_path.patch"
--          ],
-           "patch_args": [
-             "-p1"
-+          ],
-+          "patches": [
-+            "@@//bazel/wasmtime:val_bytes_wast_fast_path.patch"
-           ]
-         }
-       },
-@@ -24479,6 +24609,9 @@
+               {
+                 "id": "ittapi 0.4.0",
+@@ -24486,6 +24616,9 @@
      ],
      "aarch64-linux-android": [],
      "aarch64-pc-windows-gnullvm": [],
@@ -299,7 +266,7 @@
      "aarch64-unknown-linux-gnu": [
        "aarch64-unknown-linux-gnu"
      ],
-@@ -24516,15 +24649,19 @@
+@@ -24523,15 +24656,19 @@
      ],
      "cfg(all(not(windows), any(rustix_use_libc, miri, not(all(target_os = \"linux\", any(target_endian = \"little\", any(target_arch = \"s390x\", target_arch = \"powerpc\")), any(target_arch = \"arm\", all(target_arch = \"aarch64\", target_pointer_width = \"64\"), target_arch = \"riscv64\", all(rustix_use_experimental_asm, target_arch = \"powerpc\"), all(rustix_use_experimental_asm, target_arch = \"powerpc64\"), all(rustix_use_experimental_asm, target_arch = \"s390x\"), all(rustix_use_experimental_asm, target_arch = \"mips\"), all(rustix_use_experimental_asm, target_arch = \"mips32r6\"), all(rustix_use_experimental_asm, target_arch = \"mips64\"), all(rustix_use_experimental_asm, target_arch = \"mips64r6\"), target_arch = \"x86\", all(target_arch = \"x86_64\", target_pointer_width = \"64\")))))))": [
        "aarch64-apple-darwin",
@@ -321,7 +288,7 @@
      ],
      "cfg(all(target_arch = \"aarch64\", target_env = \"msvc\", not(windows_raw_dylib)))": [],
      "cfg(all(target_arch = \"aarch64\", target_os = \"linux\"))": [
-@@ -24546,9 +24683,11 @@
+@@ -24553,9 +24690,11 @@
      "cfg(any())": [],
      "cfg(any(target_arch = \"aarch64\", target_arch = \"x86_64\", target_arch = \"x86\"))": [
        "aarch64-apple-darwin",
@@ -333,7 +300,7 @@
        "x86_64-unknown-linux-gnu"
      ],
      "cfg(any(target_os = \"android\", target_os = \"linux\"))": [
-@@ -24557,15 +24696,20 @@
+@@ -24564,15 +24703,20 @@
        "s390x-unknown-linux-gnu",
        "x86_64-unknown-linux-gnu"
      ],
@@ -355,7 +322,7 @@
        "x86_64-unknown-linux-gnu"
      ],
      "cfg(any(target_os = \"macos\", target_os = \"ios\"))": [
-@@ -24578,35 +24722,43 @@
+@@ -24585,35 +24729,43 @@
      ],
      "cfg(any(unix, target_os = \"hermit\", target_os = \"wasi\"))": [
        "aarch64-apple-darwin",
@@ -399,7 +366,7 @@
        "x86_64-unknown-linux-gnu"
      ],
      "cfg(target_arch = \"riscv64\")": [],
-@@ -24627,10 +24779,12 @@
+@@ -24634,10 +24786,12 @@
      ],
      "cfg(unix)": [
        "aarch64-apple-darwin",
@@ -412,20 +379,13 @@
        "x86_64-unknown-linux-gnu"
      ],
      "cfg(windows)": [
-@@ -24652,6 +24806,9 @@
+@@ -24658,6 +24812,9 @@
+     "x86_64-pc-windows-gnullvm": [],
      "x86_64-pc-windows-msvc": [
        "x86_64-pc-windows-msvc"
-     ],
++    ],
 +    "x86_64-unknown-freebsd": [
 +      "x86_64-unknown-freebsd"
-+    ],
+     ],
      "x86_64-unknown-linux-gnu": [
        "x86_64-unknown-linux-gnu"
-     ]
-@@ -24664,4 +24821,4 @@
-   ],
-   "direct_dev_deps": [],
-   "unused_patches": []
--}
-\ No newline at end of file
-+}
diff --git a/databases/mongodb90/files/patch-bazel_platforms_local__config__platform.bzl b/databases/mongodb90/files/patch-bazel_platforms_local__config__platform.bzl
index 2d4601e2e9d8..23b52a4d112b 100644
--- a/databases/mongodb90/files/patch-bazel_platforms_local__config__platform.bzl
+++ b/databases/mongodb90/files/patch-bazel_platforms_local__config__platform.bzl
@@ -1,6 +1,6 @@
---- bazel/platforms/local_config_platform.bzl.orig	2026-08-11 19:14:56 UTC
+--- bazel/platforms/local_config_platform.bzl.orig	2026-10-14 17:59:44 UTC
 +++ bazel/platforms/local_config_platform.bzl
-@@ -18,8 +18,10 @@ def _setup_local_config_platform(ctx):
+@@ -15,8 +15,10 @@ def _setup_local_config_platform(ctx):
          os = "windows"
      elif "mac" in ctx.os.name:
          os = "macos"
@@ -10,8 +10,8 @@
 +    elif "freebsd" in ctx.os.name:
 +        os = "freebsd"
  
-     arch = ctx.os.arch
- 
+     raw_arch = ctx.os.arch
+     toolchain_arch = ARCH_NORMALIZE_MAP[raw_arch]
 @@ -29,7 +31,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])
diff --git a/databases/mongodb90/files/patch-bazel_separate__debug.bzl b/databases/mongodb90/files/patch-bazel_separate__debug.bzl
index b7fe43aef151..5b61a56adae0 100644
--- a/databases/mongodb90/files/patch-bazel_separate__debug.bzl
+++ b/databases/mongodb90/files/patch-bazel_separate__debug.bzl
@@ -1,4 +1,4 @@
---- bazel/separate_debug.bzl.orig
+--- bazel/separate_debug.bzl.orig	2026-10-14 17:59:44 UTC
 +++ bazel/separate_debug.bzl
 @@ -633,6 +633,7 @@ def extract_debuginfo_impl(ctx):
      linux_constraint = ctx.attr._linux_constraint[platform_common.ConstraintValueInfo]
@@ -8,8 +8,7 @@
      wasi_constraint = ctx.attr._wasi_constraint[platform_common.ConstraintValueInfo]
  
      dynamic_libraries = 0
-@@ -650,8 +651,8 @@ def extract_debuginfo_impl(ctx):
-         return_info = [ctx.attr.binary_with_debug[CcInfo]]
+@@ -647,7 +648,7 @@ def extract_debuginfo_impl(ctx):
      elif ctx.attr.type == "library" and dynamic_libraries == 0 and ctx.attr.cc_shared_library == None and ctx.attr.skip_archive == True:
          # On dynamic builds we skip separating debug if there are no dynamic libraries
          return_info = [ctx.attr.binary_with_debug[CcInfo]]
@@ -34,7 +33,7 @@
          "_wasi_constraint": attr.label(default = "@platforms//cpu:wasm32"),
      },
      doc = "Extract debuginfo into a separate file",
-@@ -763,7 +766,8 @@ extract_debuginfo_test = rule(
+@@ -763,6 +766,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"),
diff --git a/databases/mongodb90/files/patch-src_mongo_db_ftdc_BUILD.bazel b/databases/mongodb90/files/patch-src_mongo_db_ftdc_BUILD.bazel
index 2f3e720fd948..7cf60a5a0627 100644
--- a/databases/mongodb90/files/patch-src_mongo_db_ftdc_BUILD.bazel
+++ b/databases/mongodb90/files/patch-src_mongo_db_ftdc_BUILD.bazel
@@ -1,10 +1,10 @@
---- src/mongo/db/ftdc/BUILD.bazel.orig
+--- src/mongo/db/ftdc/BUILD.bazel.orig	2026-10-14 17:59:44 UTC
 +++ src/mongo/db/ftdc/BUILD.bazel
-@@ -143,6 +143,7 @@ mongo_cc_library(
+@@ -95,6 +95,7 @@ mongo_cc_library(
              "@platforms//os:windows": "windows",
              "@platforms//os:linux": "linux",
              "@platforms//os:macos": "osx",
 +            "@platforms//os:freebsd": "osx",
          }.items()
-     }),
-     hdrs = [
+     }],
+     deps = [
diff --git a/databases/mongodb90/files/patch-src_mongo_platform_waitable__atomic.cpp b/databases/mongodb90/files/patch-src_mongo_platform_waitable__atomic.cpp
index 5640a3a60991..a94bca8f5d3c 100644
--- a/databases/mongodb90/files/patch-src_mongo_platform_waitable__atomic.cpp
+++ b/databases/mongodb90/files/patch-src_mongo_platform_waitable__atomic.cpp
@@ -4,9 +4,9 @@
 #   https://github.com/mongodb/mongo/pull/1607
 #   https://jira.mongodb.org/browse/SERVER-99225
 #
---- src/mongo/platform/waitable_atomic.cpp.orig	2024-11-20 23:53:48 UTC
+--- src/mongo/platform/waitable_atomic.cpp.orig	2026-10-14 17:59:44 UTC
 +++ src/mongo/platform/waitable_atomic.cpp
-@@ -34,6 +34,9 @@
+@@ -8,6 +8,9 @@
  #ifdef __linux__
  #include <linux/futex.h>
  #include <sys/syscall.h>
@@ -16,7 +16,7 @@
  #elif defined(_WIN32)
  #include <synchapi.h>
  #endif
-@@ -233,6 +236,45 @@ bool waitUntil(const void* uaddr,
+@@ -207,6 +210,45 @@ bool waitUntil(const void* uaddr,
      // There isn't a good list of possible errors, so assuming that anything other than a timeout
      // error is a possible spurious wakeup.
      return timeoutOverflow || errno != ETIMEDOUT;
@@ -61,4 +61,4 @@
 +    return true;
  }
  
- #else
+ #elif defined(__wasi__)
diff --git a/databases/mongodb90/files/patch-src_mongo_util_BUILD.bazel b/databases/mongodb90/files/patch-src_mongo_util_BUILD.bazel
new file mode 100644
index 000000000000..576202dbbf9a
--- /dev/null
+++ b/databases/mongodb90/files/patch-src_mongo_util_BUILD.bazel
@@ -0,0 +1,10 @@
+--- src/mongo/util/BUILD.bazel.orig	2026-10-14 17:59:44 UTC
++++ src/mongo/util/BUILD.bazel
+@@ -510,6 +510,7 @@
+     srcs_select = [{
+         "@platforms//os:{}".format(os): ["processinfo_{}.cpp".format(os)]
+         for os in [
++            "freebsd",
+             "linux",
+             "osx",
+             "windows",
diff --git a/databases/mongodb90/files/patch-src_mongo_util_processinfo__freebsd.cpp b/databases/mongodb90/files/patch-src_mongo_util_processinfo__freebsd.cpp
new file mode 100644
index 000000000000..f5b46c200270
--- /dev/null
+++ b/databases/mongodb90/files/patch-src_mongo_util_processinfo__freebsd.cpp
@@ -0,0 +1,165 @@
+--- /dev/null	2026-10-16 00:00:00 UTC
++++ src/mongo/util/processinfo_freebsd.cpp
+@@ -0,0 +1,162 @@
++// Copyright (c) MongoDB, Inc.
++// SPDX-License-Identifier: SSPL-1.0
++
++#include "mongo/bson/bsonobjbuilder.h"
++#include "mongo/logv2/log.h"
++#include "mongo/util/processinfo.h"
++
++#include <cerrno>
++#include <cstring>
++#include <string>
++
++#include <boost/none.hpp>
++#include <boost/optional.hpp>
++#include <sys/param.h>
++#include <sys/cpuset.h>
++#include <sys/socket.h>
++#include <sys/sysctl.h>
++#include <sys/types.h>
++#include <sys/user.h>
++#include <unistd.h>
++
++#define MONGO_LOGV2_DEFAULT_COMPONENT ::mongo::logv2::LogComponent::kControl
++
++namespace mongo {
++
++namespace {
++
++/**
++ * Get a sysctl value by name, or defaultValue on failure. Returns 0 or an errno value.
++ */
++template <typename T>
++int getSysctlByNameWithDefault(const char* sysctlName, const T& defaultValue, T* result) {
++    T value{};
++    size_t len = sizeof(value);
++    if (sysctlbyname(sysctlName, &value, &len, nullptr, 0) == -1) {
++        *result = defaultValue;
++        return errno;
++    }
++    if (len != sizeof(value)) {
++        *result = defaultValue;
++        return EINVAL;
++    }
++    *result = value;
++    return 0;
++}
++
++template <>
++int getSysctlByNameWithDefault<std::string>(const char* sysctlName,
++                                            const std::string& defaultValue,
++                                            std::string* result) {
++    char value[256] = {0};
++    size_t len = sizeof(value) - 1;
++    if (sysctlbyname(sysctlName, value, &len, nullptr, 0) == -1) {
++        *result = defaultValue;
++        return errno;
++    }
++    *result = value;
++    return 0;
++}
++
++bool getKinfoProc(pid_t pid, struct kinfo_proc* kp) {
++    int mib[4] = {CTL_KERN, KERN_PROC, KERN_PROC_PID, pid};
++    size_t len = sizeof(*kp);
++    return sysctl(mib, 4, kp, &len, nullptr, 0) == 0 && len == sizeof(*kp);
++}
++
++}  // namespace
++
++ProcessInfo::ProcessInfo(ProcessId pid) : _pid(pid) {}
++
++ProcessInfo::~ProcessInfo() {}
++
++bool ProcessInfo::supported() {
++    return true;
++}
++
++// The number of CPUs in the cpuset of this process.
++boost::optional<uint64_t> ProcessInfo::getNumCoresForProcess() {
++    cpuset_t mask;
++    CPU_ZERO(&mask);
++    if (cpuset_getaffinity(CPU_LEVEL_WHICH, CPU_WHICH_PID, -1, sizeof(mask), &mask) == 0) {
++        int count = CPU_COUNT(&mask);
++        if (count > 0)
++            return static_cast<uint64_t>(count);
++    }
++    long nprocs = sysconf(_SC_NPROCESSORS_ONLN);
++    if (nprocs > 0)
++        return static_cast<uint64_t>(nprocs);
++    return boost::none;
++}
++
++int ProcessInfo::getVirtualMemorySize() {
++    struct kinfo_proc kp;
++    if (!getKinfoProc(_pid.toNative(), &kp))
++        return -1;
++    return kp.ki_size / 1024 / 1024;  // convert from bytes to MB
++}
++
++int ProcessInfo::getResidentSize() {
++    struct kinfo_proc kp;
++    if (!getKinfoProc(_pid.toNative(), &kp))
++        return -1;
++    return static_cast<long long>(kp.ki_rssize) * sysconf(_SC_PAGESIZE) / 1024 /
++        1024;  // convert from pages to MB
++}
++
++void ProcessInfo::getExtraInfo(BSONObjBuilder& info) {}
++
++void ProcessInfo::SystemInfo::collectSystemInfo() {
++    osType = "BSD";
++    osName = "FreeBSD";
++
++    int status = getSysctlByNameWithDefault("kern.osrelease", std::string("unknown"), &osVersion);
++    if (status != 0)
++        LOGV2(23332,
++              "Unable to collect OS Version.",
++              "errno"_attr = status,
++              "msg"_attr = strerror(status));
++
++    status = getSysctlByNameWithDefault("hw.machine_arch", std::string("unknown"), &cpuArch);
++    if (status != 0)
++        LOGV2(23333,
++              "Unable to collect Machine Architecture.",
++              "errno"_attr = status,
++              "msg"_attr = strerror(status));
++    addrSize = cpuArch.find("64") != std::string::npos ? 64 : 32;
++
++    u_long physmem;
++    status = getSysctlByNameWithDefault("hw.physmem", u_long{0}, &physmem);
++    memSize = physmem;
++    memLimit = memSize;
++    if (status != 0)
++        LOGV2(23334,
++              "Unable to collect Physical Memory.",
++              "errno"_attr = status,
++              "msg"_attr = strerror(status));
++
++    int ncpu;
++    status = getSysctlByNameWithDefault("hw.ncpu", 1, &ncpu);
++    numCores = ncpu;
++    if (status != 0)
++        LOGV2(23335,
++              "Unable to collect Number of CPUs.",
++              "errno"_attr = status,
++              "msg"_attr = strerror(status));
++
++    int cores;
++    if (getSysctlByNameWithDefault("kern.smp.cores", ncpu, &cores) == 0 && cores > 0)
++        numPhysicalCores = cores;
++    else
++        numPhysicalCores = numCores;
++
++    pageSize = static_cast<unsigned long long>(sysconf(_SC_PAGESIZE));
++
++    hasNuma = false;
++
++    // The appropriate system parameter is "kern.ipc.soacceptqueue", but to
++    // simplify testing we hardcode to `SOMAXCONN`.
++    defaultListenBacklog = SOMAXCONN;
++}
++
++}  // namespace mongo
diff --git a/databases/mongodb90/files/patch-src_third__party_IntelRDFPMathLib20U1_BUILD.bazel b/databases/mongodb90/files/patch-src_third__party_IntelRDFPMathLib20U1_BUILD.bazel
index 39c7e56d423f..8bbe3c061af3 100644
--- a/databases/mongodb90/files/patch-src_third__party_IntelRDFPMathLib20U1_BUILD.bazel
+++ b/databases/mongodb90/files/patch-src_third__party_IntelRDFPMathLib20U1_BUILD.bazel
@@ -1,8 +1,8 @@
---- src/third_party/IntelRDFPMathLib20U1/BUILD.bazel.orig
+--- src/third_party/IntelRDFPMathLib20U1/BUILD.bazel.orig	2026-10-14 17:59:44 UTC
 +++ src/third_party/IntelRDFPMathLib20U1/BUILD.bazel
-@@ -31,6 +31,10 @@ INTEL_RDFP_MATHLIB_DEFINES = [
-         "LINUX=1",
+@@ -38,6 +38,10 @@ INTEL_RDFP_MATHLIB_DEFINES = [
          "linux=1",
+         "UNCHANGED_BINARY_STATUS_FLAGS=0",
      ],
 +    "@platforms//os:freebsd": [
 +        "LINUX=1",
diff --git a/databases/mongodb90/files/patch-src_third__party_boost_BUILD.bazel b/databases/mongodb90/files/patch-src_third__party_boost_BUILD.bazel
index cbc3d34815c6..69e3e3471b20 100644
--- a/databases/mongodb90/files/patch-src_third__party_boost_BUILD.bazel
+++ b/databases/mongodb90/files/patch-src_third__party_boost_BUILD.bazel
@@ -1,6 +1,6 @@
---- src/third_party/boost/BUILD.bazel.orig
+--- src/third_party/boost/BUILD.bazel.orig	2026-10-14 17:59:44 UTC
 +++ src/third_party/boost/BUILD.bazel
-@@ -100,6 +100,7 @@ BOOST_LIB_HEADERS = glob([
+@@ -113,6 +113,7 @@ BOOST_DEFINES = [
  
  BOOST_DEFINES = [
      "BOOST_BIND_GLOBAL_PLACEHOLDERS",
@@ -8,7 +8,7 @@
  ]
  
  BOOST_LIB_INCLUDES = ["."] + glob(
-@@ -126,6 +126,10 @@ mongo_cc_library(
+@@ -221,6 +222,10 @@ mongo_cc_library(
              "libs/thread/src/pthread/once.cpp",
              "libs/thread/src/pthread/thread.cpp",
          ],
@@ -19,8 +19,8 @@
          "@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": [
+@@ -238,6 +243,9 @@ mongo_cc_library(
+         "@platforms//os:wasi": [
              "libs/thread/src/pthread/once_atomic.cpp",
          ],
 +        "@platforms//os:freebsd": [
@@ -29,13 +29,13 @@
          "//conditions:default": [],
      }),
      copts = BOOST_COPTS,
-@@ -151,6 +158,9 @@ mongo_cc_library(
-         "@platforms//os:macos": [
+@@ -250,6 +258,9 @@ mongo_cc_library(
              "BOOST_THREAD_PTHREAD",
          ],
-+        "@platforms//os:freebsd": [
+         "@platforms//os:wasi": [
 +            "BOOST_THREAD_PTHREAD",
 +        ],
-         "@platforms//os:windows": [
-             "BOOST_THREAD_WIN32",
++        "@platforms//os:freebsd": [
+             "BOOST_THREAD_PTHREAD",
          ],
+         "@platforms//os:windows": [