Index: tools/gn/bootstrap/bootstrap.py |
diff --git a/tools/gn/bootstrap/bootstrap.py b/tools/gn/bootstrap/bootstrap.py |
index 6ac7ac12b74e6461417fa5706322a26f5335699d..f6f2f977fa1bb26f2aa6eb38328b8bb2fb334e67 100755 |
--- a/tools/gn/bootstrap/bootstrap.py |
+++ b/tools/gn/bootstrap/bootstrap.py |
@@ -26,6 +26,8 @@ SRC_ROOT = os.path.dirname(os.path.dirname(GN_ROOT)) |
def is_linux(): |
return sys.platform.startswith('linux') |
+def is_freebsd(): |
+ return sys.platform.startswith('freebsd') |
def check_call(cmd, **kwargs): |
logging.debug('Running: %s', ' '.join(cmd)) |
@@ -202,11 +204,10 @@ def write_ninja(path): |
'base/vlog.cc', |
]) |
- if is_linux(): |
+ if is_linux() or is_freebsd(): |
static_libraries['libevent'] = { |
'sources': [ |
'third_party/libevent/buffer.c', |
- 'third_party/libevent/epoll.c', |
'third_party/libevent/evbuffer.c', |
'third_party/libevent/evdns.c', |
'third_party/libevent/event.c', |
@@ -221,9 +222,7 @@ def write_ninja(path): |
'third_party/libevent/strlcpy.c', |
], |
'tool': 'cc', |
- 'include_dirs': [ |
- os.path.join(SRC_ROOT, 'third_party', 'libevent', 'linux') |
- ], |
+ 'include_dirs': [], |
'cflags': cflags + ['-DHAVE_CONFIG_H'], |
} |
static_libraries['xdg_user_dirs'] = { |
@@ -244,13 +243,8 @@ def write_ninja(path): |
'base/message_loop/message_pump_libevent.cc', |
'base/nix/xdg_util.cc', |
'base/posix/file_descriptor_shuffle.cc', |
- 'base/process/internal_linux.cc', |
'base/process/kill_posix.cc', |
- 'base/process/process_handle_linux.cc', |
'base/process/process_handle_posix.cc', |
- 'base/process/process_iterator_linux.cc', |
- 'base/process/process_linux.cc', |
- 'base/process/process_metrics_linux.cc', |
'base/process/process_metrics_posix.cc', |
'base/process/process_posix.cc', |
'base/safe_strerror_posix.cc', |
@@ -258,14 +252,43 @@ def write_ninja(path): |
'base/synchronization/condition_variable_posix.cc', |
'base/synchronization/lock_impl_posix.cc', |
'base/synchronization/waitable_event_posix.cc', |
- 'base/sys_info_linux.cc', |
'base/sys_info_posix.cc', |
- 'base/threading/platform_thread_linux.cc', |
'base/threading/platform_thread_posix.cc', |
'base/threading/thread_local_posix.cc', |
'base/threading/thread_local_storage_posix.cc', |
'base/time/time_posix.cc', |
]) |
+ if is_linux(): |
+ static_libraries['base']['sources'].extend([ |
+ 'base/process/internal_linux.cc', |
+ 'base/process/process_handle_linux.cc', |
+ 'base/process/process_iterator_linux.cc', |
+ 'base/process/process_linux.cc', |
+ 'base/process/process_metrics_linux.cc', |
+ 'base/sys_info_linux.cc', |
+ 'base/threading/platform_thread_linux.cc', |
+ ]) |
+ static_libraries['libevent']['sources'].extend([ |
+ 'third_party/libevent/epoll.c', |
+ ]) |
+ static_libraries['libevent']['include_dirs'].extend([ |
+ os.path.join(SRC_ROOT, 'third_party', 'libevent', 'linux') |
+ ]) |
+ elif is_freebsd(): |
+ static_libraries['base']['sources'].extend([ |
+ 'base/process/process_handle_freebsd.cc', |
+ 'base/process/process_iterator_freebsd.cc', |
+ 'base/process/process_metrics_freebsd.cc', |
+ 'base/sys_info_freebsd.cc', |
+ 'base/threading/platform_thread_freebsd.cc', |
+ ]) |
+ static_libraries['libevent']['sources'].extend([ |
+ 'third_party/libevent/kqueue.c', |
+ ]) |
+ static_libraries['libevent']['include_dirs'].extend([ |
+ os.path.join(SRC_ROOT, 'third_party', 'libevent', 'freebsd') |
+ ]) |
+ ldflags.extend(['-lexecinfo']) |
cflags.extend(['-O2', '-pthread', '-pipe']) |