mirror of
https://github.com/klzgrad/naiveproxy.git
synced 2024-11-24 06:16:30 +03:00
build: Trim libevent usage
Use system libevent on Linux. Remove extra libs on other platforms.
This commit is contained in:
parent
95ac1a17b7
commit
0e4433c105
@ -1101,6 +1101,7 @@ component("base") {
|
|||||||
all_dependent_configs = []
|
all_dependent_configs = []
|
||||||
defines = []
|
defines = []
|
||||||
data = []
|
data = []
|
||||||
|
libs = []
|
||||||
|
|
||||||
configs += [
|
configs += [
|
||||||
":base_flags",
|
":base_flags",
|
||||||
@ -1470,6 +1471,8 @@ component("base") {
|
|||||||
":base_win_linker_flags",
|
":base_win_linker_flags",
|
||||||
"//tools/win/DebugVisualizers:chrome",
|
"//tools/win/DebugVisualizers:chrome",
|
||||||
]
|
]
|
||||||
|
} else if (is_linux) {
|
||||||
|
libs += [ "event_core" ]
|
||||||
} else if ((!is_nacl && !is_fuchsia) || is_nacl_nonsfi) {
|
} else if ((!is_nacl && !is_fuchsia) || is_nacl_nonsfi) {
|
||||||
# Non-Windows.
|
# Non-Windows.
|
||||||
deps += [ "//base/third_party/libevent" ]
|
deps += [ "//base/third_party/libevent" ]
|
||||||
@ -2256,6 +2259,7 @@ test("base_unittests") {
|
|||||||
]
|
]
|
||||||
|
|
||||||
defines = []
|
defines = []
|
||||||
|
libs = []
|
||||||
|
|
||||||
deps = [
|
deps = [
|
||||||
":base",
|
":base",
|
||||||
@ -2370,7 +2374,11 @@ test("base_unittests") {
|
|||||||
|
|
||||||
if (is_posix && !is_ios && !is_fuchsia) {
|
if (is_posix && !is_ios && !is_fuchsia) {
|
||||||
sources += [ "message_loop/message_pump_libevent_unittest.cc" ]
|
sources += [ "message_loop/message_pump_libevent_unittest.cc" ]
|
||||||
deps += [ "//base/third_party/libevent" ]
|
if (is_linux) {
|
||||||
|
libs += [ "event_core" ]
|
||||||
|
} else {
|
||||||
|
deps += [ "//base/third_party/libevent" ]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_fuchsia) {
|
if (is_fuchsia) {
|
||||||
|
@ -14,7 +14,6 @@
|
|||||||
#include "base/files/file_util.h"
|
#include "base/files/file_util.h"
|
||||||
#include "base/logging.h"
|
#include "base/logging.h"
|
||||||
#include "base/posix/eintr_wrapper.h"
|
#include "base/posix/eintr_wrapper.h"
|
||||||
#include "base/third_party/libevent/event.h"
|
|
||||||
#include "base/time/time.h"
|
#include "base/time/time.h"
|
||||||
#include "base/trace_event/trace_event.h"
|
#include "base/trace_event/trace_event.h"
|
||||||
#include "build/build_config.h"
|
#include "build/build_config.h"
|
||||||
@ -23,6 +22,12 @@
|
|||||||
#include "base/mac/scoped_nsautorelease_pool.h"
|
#include "base/mac/scoped_nsautorelease_pool.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(OS_LINUX)
|
||||||
|
#include <event.h>
|
||||||
|
#else
|
||||||
|
#include "base/third_party/libevent/event.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
// Lifecycle of struct event
|
// Lifecycle of struct event
|
||||||
// Libevent uses two main data structures:
|
// Libevent uses two main data structures:
|
||||||
// struct event_base (of which there is one per message pump), and
|
// struct event_base (of which there is one per message pump), and
|
||||||
|
@ -612,16 +612,13 @@ def write_gn_ninja(path, root_gen_dir, options):
|
|||||||
'base/time/time_conversion_posix.cc',
|
'base/time/time_conversion_posix.cc',
|
||||||
'base/trace_event/heap_profiler_allocation_register_posix.cc',
|
'base/trace_event/heap_profiler_allocation_register_posix.cc',
|
||||||
])
|
])
|
||||||
|
if not is_linux:
|
||||||
static_libraries['libevent'] = {
|
static_libraries['libevent'] = {
|
||||||
'sources': [
|
'sources': [
|
||||||
'base/third_party/libevent/buffer.c',
|
'base/third_party/libevent/buffer.c',
|
||||||
'base/third_party/libevent/evbuffer.c',
|
'base/third_party/libevent/evbuffer.c',
|
||||||
'base/third_party/libevent/evdns.c',
|
|
||||||
'base/third_party/libevent/event.c',
|
'base/third_party/libevent/event.c',
|
||||||
'base/third_party/libevent/event_tagging.c',
|
|
||||||
'base/third_party/libevent/evrpc.c',
|
|
||||||
'base/third_party/libevent/evutil.c',
|
'base/third_party/libevent/evutil.c',
|
||||||
'base/third_party/libevent/http.c',
|
|
||||||
'base/third_party/libevent/log.c',
|
'base/third_party/libevent/log.c',
|
||||||
'base/third_party/libevent/poll.c',
|
'base/third_party/libevent/poll.c',
|
||||||
'base/third_party/libevent/select.c',
|
'base/third_party/libevent/select.c',
|
||||||
@ -665,13 +662,7 @@ def write_gn_ninja(path, root_gen_dir, options):
|
|||||||
'base/allocator/allocator_shim.cc',
|
'base/allocator/allocator_shim.cc',
|
||||||
'base/allocator/allocator_shim_default_dispatch_to_glibc.cc',
|
'base/allocator/allocator_shim_default_dispatch_to_glibc.cc',
|
||||||
])
|
])
|
||||||
libs.extend(['-lrt', '-latomic'])
|
libs.extend(['-lrt', '-latomic', '-levent_core'])
|
||||||
static_libraries['libevent']['include_dirs'].extend([
|
|
||||||
os.path.join(SRC_ROOT, 'base', 'third_party', 'libevent', 'linux')
|
|
||||||
])
|
|
||||||
static_libraries['libevent']['sources'].extend([
|
|
||||||
'base/third_party/libevent/epoll.c',
|
|
||||||
])
|
|
||||||
else:
|
else:
|
||||||
libs.extend(['-lrt'])
|
libs.extend(['-lrt'])
|
||||||
static_libraries['base']['sources'].extend([
|
static_libraries['base']['sources'].extend([
|
||||||
|
Loading…
Reference in New Issue
Block a user