$OpenBSD: patch-base_BUILD_gn,v 1.8 2018/06/06 07:50:54 robert Exp $

Index: base/BUILD.gn
--- base/BUILD.gn.orig
+++ base/BUILD.gn
@@ -1194,7 +1194,7 @@ jumbo_component("base") {
   # Needed for <atomic> if using newer C++ library than sysroot, except if
   # building inside the cros_sdk environment - use host_toolchain as a
   # more robust check for this.
-  if (!use_sysroot && (is_android || (is_linux && !is_chromecast)) &&
+  if (!use_sysroot && (is_android || (is_linux && !is_chromecast) && !is_clang) &&
       host_toolchain != "//build/toolchain/cros:host") {
     libs = [ "atomic" ]
   }
@@ -1220,7 +1220,7 @@ jumbo_component("base") {
         "allocator/allocator_shim_override_glibc_weak_symbols.h",
       ]
       deps += [ "//base/allocator:tcmalloc" ]
-    } else if (is_linux && use_allocator == "none") {
+    } else if ((is_linux && !is_openbsd) && use_allocator == "none") {
       sources += [ "allocator/allocator_shim_default_dispatch_to_glibc.cc" ]
     } else if (is_android && use_allocator == "none") {
       sources += [
@@ -1601,6 +1601,29 @@ jumbo_component("base") {
     }
   }
 
+  if (is_openbsd) {
+    sources -= [
+      "files/file_path_watcher_linux.cc",
+      "files/file_util_linux.cc",
+      "process/memory_linux.cc",
+      "process/process_linux.cc",
+      "sys_info_linux.cc",
+      "process/process_iterator_linux.cc",
+      "process/process_metrics_linux.cc",
+      "process/process_handle_linux.cc"
+    ]
+    sources += [
+      "process/memory_stubs.cc",
+      "process/process_handle_openbsd.cc",
+      "process/process_iterator_openbsd.cc",
+      "process/process_metrics_openbsd.cc",
+      "sys_info_openbsd.cc",
+      "files/file_path_watcher_kqueue.cc",
+      "files/file_path_watcher_kqueue.h",
+      "files/file_path_watcher_stub.cc",
+    ]
+  }
+
   # iOS
   if (is_ios) {
     set_sources_assignment_filter([])
@@ -2558,6 +2581,8 @@ test("base_unittests") {
       # data += [ "$root_out_dir/base_unittests.dSYM/" ]
     }
   }
+
+  libs = [ "execinfo" ]
 }
 
 action("build_date") {
