--- base/BUILD.gn.orig 2017-07-25 21:04:48.000000000 +0200 +++ base/BUILD.gn 2017-08-02 22:12:25.442369000 +0200 @@ -1106,7 +1106,7 @@ "base_paths_win.h", ] - if (is_linux) { + if (is_linux || is_bsd) { sources += [ "base_paths_posix.cc" ] } } @@ -1142,7 +1142,7 @@ # Needed for 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" ] } @@ -1168,7 +1168,7 @@ "allocator/allocator_shim_override_glibc_weak_symbols.h", ] deps += [ "//base/allocator:tcmalloc" ] - } else if (is_linux && use_allocator == "none") { + } else if (is_linux && !is_bsd && use_allocator == "none") { sources += [ "allocator/allocator_shim_default_dispatch_to_glibc.cc" ] } else if (is_android && use_allocator == "none") { sources += [ @@ -1185,6 +1185,31 @@ } } + if (is_bsd) { + sources -= [ + "files/file_util_linux.cc", + "files/file_path_watcher_linux.cc", + "process/process_linux.cc", + "process/process_iterator_linux.cc", + "process/process_metrics_linux.cc", + "process/process_handle_linux.cc", + "sys_info_linux.cc", + ] + sources += [ + "files/file_path_watcher_stub.cc", + "process/process_handle_freebsd.cc", + "process/process_iterator_freebsd.cc", + "process/process_metrics_freebsd.cc", + "sys_info_freebsd.cc", + ] + libs = [ + "execinfo", # logging.cc + "kvm" # process_metrics_freebsd + ] + } + + + # Allow more direct string conversions on platforms with native utf8 # strings if (is_mac || is_ios || is_chromeos || is_chromecast) { @@ -1520,7 +1545,7 @@ } # Linux. - if (is_linux) { + if (is_linux || is_bsd) { if (is_asan || is_lsan || is_msan || is_tsan) { # For llvm-sanitizer. data += [ "//third_party/llvm-build/Release+Asserts/lib/libstdc++.so.6" ] @@ -1545,7 +1570,7 @@ "//base/third_party/xdg_user_dirs", ] } else { - # Non-Linux. + # Non-Linux/BSD. sources -= [ "nix/mime_util_xdg.cc", "nix/mime_util_xdg.h", @@ -2392,6 +2417,12 @@ "trace_event/trace_event_android_unittest.cc", ] set_sources_assignment_filter(sources_assignment_filter) + } + + if (is_bsd) { + sources -= [ + "debug/proc_maps_linux_unittest.cc", + ] } if (is_win) {