1--- src/3rdparty/chromium/base/BUILD.gn.orig	2025-08-15 18:30:00 UTC
2+++ src/3rdparty/chromium/base/BUILD.gn
3@@ -1111,11 +1111,26 @@ jumbo_component("base") {
4   # Needed for <atomic> if using newer C++ library than sysroot, except if
5   # building inside the cros_sdk environment - use host_toolchain as a
6   # more robust check for this.
7-  if (!use_sysroot && (is_android || is_chromeos || (is_linux && !is_castos)) &&
8+  if (!use_sysroot && (is_android || is_chromeos || (is_linux && !is_castos && !is_bsd)) &&
9       host_toolchain != "//build/toolchain/cros:host") {
10     libs += [ "atomic" ]
11   }
12
13+  # *BSD needs libkvm
14+  if (is_bsd) {
15+    libs += [
16+      "kvm",
17+      "epoll-shim",
18+    ]
19+  }
20+
21+  if (is_freebsd) {
22+    libs += [
23+      "execinfo",
24+      "util",
25+    ]
26+  }
27+
28   if (use_allocator_shim) {
29     if (is_apple) {
30       sources += [ "allocator/early_zone_registration_apple.h" ]
31@@ -1135,7 +1150,7 @@ jumbo_component("base") {
32
33   # Allow more direct string conversions on platforms with native utf8
34   # strings
35-  if (is_apple || is_chromeos || is_castos || is_cast_android || is_fuchsia) {
36+  if (is_apple || is_chromeos || is_castos || is_cast_android || is_fuchsia || is_bsd) {
37     defines += [ "SYSTEM_NATIVE_UTF8" ]
38   }
39
40@@ -2153,6 +2168,22 @@ jumbo_component("base") {
41     ]
42   }
43
44+  if (is_openbsd) {
45+    sources += [
46+      "process/process_handle_openbsd.cc",
47+      "process/process_iterator_openbsd.cc",
48+      "process/process_metrics_openbsd.cc",
49+      "system/sys_info_openbsd.cc",
50+    ]
51+  } else if (is_freebsd) {
52+    sources += [
53+      "process/process_handle_freebsd.cc",
54+      "process/process_iterator_freebsd.cc",
55+      "process/process_metrics_freebsd.cc",
56+      "system/sys_info_freebsd.cc",
57+    ]
58+  }
59+
60   # iOS
61   if (is_ios) {
62     sources += [
63@@ -2298,6 +2329,33 @@ jumbo_component("base") {
64     }
65   }
66
67+  if (is_bsd) {
68+    sources -= [
69+      "files/file_path_watcher_inotify.cc",
70+      "files/scoped_file_linux.cc",
71+      "process/set_process_title_linux.cc",
72+      "process/set_process_title_linux.h",
73+      "system/sys_info_linux.cc",
74+      "process/process_iterator_linux.cc",
75+      "process/process_linux.cc",
76+      "process/process_metrics_linux.cc",
77+      "process/process_handle_linux.cc",
78+      "profiler/stack_copier_signal.cc",
79+      "profiler/stack_copier_signal.h",
80+      "profiler/thread_delegate_posix.cc",
81+      "profiler/thread_delegate_posix.h",
82+      "threading/platform_thread_linux.cc",
83+      "stack_canary_linux.cc",
84+      "stack_canary_linux.h",
85+    ]
86+    sources += [
87+      "files/file_path_watcher_kqueue.cc",
88+      "files/file_path_watcher_kqueue.h",
89+      "files/file_path_watcher_bsd.cc",
90+      "threading/platform_thread_bsd.cc",
91+    ]
92+  }
93+
94   if (use_blink) {
95     sources += [
96       "files/file_path_watcher.cc",
97@@ -2650,7 +2708,7 @@ buildflag_header("protected_memory_buildflags") {
98   header = "protected_memory_buildflags.h"
99   header_dir = "base/memory"
100
101-  protected_memory_enabled = !is_component_build && is_clang &&
102+  protected_memory_enabled = !is_openbsd && !is_component_build && is_clang &&
103                              (is_win || is_linux || is_android || is_mac)
104
105   flags = [ "PROTECTED_MEMORY_ENABLED=$protected_memory_enabled" ]
106@@ -3129,7 +3187,7 @@ if (is_apple) {
107   }
108 }
109
110-if (!is_nacl && (is_linux || is_chromeos)) {
111+if (!is_nacl && !is_bsd && (is_linux || is_chromeos)) {
112   # This test must compile with -fstack-protector-all
113   source_set("stack_canary_linux_unittests") {
114     testonly = true
115@@ -3825,7 +3883,7 @@ test("base_unittests") {
116     ]
117   }
118
119-  if (is_linux || is_chromeos) {
120+  if (!is_bsd && (is_linux || is_chromeos)) {
121     sources += [
122       "debug/proc_maps_linux_unittest.cc",
123       "files/scoped_file_linux_unittest.cc",
124@@ -3853,7 +3911,7 @@ test("base_unittests") {
125       "posix/file_descriptor_shuffle_unittest.cc",
126       "posix/unix_domain_socket_unittest.cc",
127     ]
128-    if (!is_nacl && !is_apple) {
129+    if (!is_nacl && !is_apple && !is_bsd) {
130       sources += [
131         "profiler/stack_base_address_posix_unittest.cc",
132         "profiler/stack_copier_signal_unittest.cc",
133@@ -3864,7 +3922,7 @@ test("base_unittests") {
134
135   # Allow more direct string conversions on platforms with native utf8
136   # strings
137-  if (is_apple || is_chromeos || is_castos || is_cast_android || is_fuchsia) {
138+  if (is_apple || is_chromeos || is_castos || is_cast_android || is_fuchsia || is_bsd) {
139     defines += [ "SYSTEM_NATIVE_UTF8" ]
140   }
141
142@@ -4052,7 +4110,7 @@ test("base_unittests") {
143     deps += [ ":base_profiler_test_support_library" ]
144   }
145
146-  if (is_fuchsia || is_linux || is_chromeos) {
147+  if ((is_fuchsia || is_linux || is_chromeos) && !is_bsd) {
148     sources += [
149       "debug/elf_reader_unittest.cc",
150       "debug/test_elf_image_builder.cc",
151