1#
2#  Copyright (C) 2015 Google, Inc.
3#
4#  Licensed under the Apache License, Version 2.0 (the "License");
5#  you may not use this file except in compliance with the License.
6#  You may obtain a copy of the License at:
7#
8#  http://www.apache.org/licenses/LICENSE-2.0
9#
10#  Unless required by applicable law or agreed to in writing, software
11#  distributed under the License is distributed on an "AS IS" BASIS,
12#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13#  See the License for the specific language governing permissions and
14#  limitations under the License.
15#
16
17source_set("base_sources") {
18  sources = [
19    "base/at_exit.cc",
20    "base/atomic_ref_count.h",
21    "base/atomic_sequence_num.h",
22    "base/atomicops.h",
23    "base/base64.cc",
24    "base/base64.h",
25    "base/base_export.h",
26    "base/base_switches.cc",
27    "base/bind_helpers.cc",
28    "base/build_time.cc",
29    "base/callback_helpers.cc",
30    "base/callback_internal.cc",
31    "base/command_line.cc",
32    "base/cpu.cc",
33    "base/debug/alias.cc",
34    "base/debug/debugger.cc",
35    "base/debug/debugger_posix.cc",
36    "base/debug/stack_trace.cc",
37    "base/debug/stack_trace_posix.cc",
38    "base/debug/task_annotator.cc",
39    "base/environment.cc",
40    "base/files/file.cc",
41    "base/files/file_enumerator.cc",
42    "base/files/file_enumerator_posix.cc",
43    "base/files/file_path.cc",
44    "base/files/file_path_constants.cc",
45    "base/files/file_path_watcher.cc",
46    "base/files/file_path_watcher_linux.cc",
47    "base/files/file_posix.cc",
48    "base/files/file_tracing.cc",
49    "base/files/file_util.cc",
50    "base/files/file_util_linux.cc",
51    "base/files/file_util_posix.cc",
52    "base/files/important_file_writer.cc",
53    "base/files/scoped_file.cc",
54    "base/files/scoped_temp_dir.cc",
55    "base/guid.cc",
56    "base/json/json_parser.cc",
57    "base/json/json_reader.cc",
58    "base/json/json_string_value_serializer.cc",
59    "base/json/json_writer.cc",
60    "base/json/string_escape.cc",
61    "base/lazy_instance.cc",
62    "base/location.cc",
63    "base/logging.cc",
64    "base/md5.cc",
65    "base/memory/ref_counted.cc",
66    "base/memory/ref_counted_memory.cc",
67    "base/memory/singleton.cc",
68    "base/memory/weak_ptr.cc",
69    "base/message_loop/incoming_task_queue.cc",
70    "base/message_loop/message_loop.cc",
71    "base/message_loop/message_loop_task_runner.cc",
72    "base/message_loop/message_pump.cc",
73    "base/message_loop/message_pump_default.cc",
74
75    # we don't want any glib dependencies.
76    #   "base/message_loop/message_pump_glib.cc",
77    "base/message_loop/message_pump_libevent.cc",
78    "base/metrics/bucket_ranges.cc",
79    "base/metrics/field_trial.cc",
80    "base/metrics/metrics_hashes.cc",
81    "base/metrics/histogram_base.cc",
82    "base/metrics/histogram.cc",
83    "base/metrics/histogram_samples.cc",
84    "base/metrics/histogram_snapshot_manager.cc",
85    "base/metrics/persistent_histogram_allocator.cc",
86    "base/metrics/persistent_memory_allocator.cc",
87    "base/metrics/persistent_sample_map.cc",
88    "base/metrics/sample_map.cc",
89    "base/metrics/sample_vector.cc",
90    "base/metrics/sparse_histogram.cc",
91    "base/metrics/statistics_recorder.cc",
92    "base/pending_task.cc",
93    "base/pickle.cc",
94    "base/posix/file_descriptor_shuffle.cc",
95    "base/posix/safe_strerror.cc",
96    "base/posix/unix_domain_socket_linux.cc",
97    "base/process/internal_linux.cc",
98    "base/process/kill.cc",
99    "base/process/kill_posix.cc",
100    "base/process/launch.cc",
101    "base/process/launch_posix.cc",
102    "base/process/process_handle_linux.cc",
103    "base/process/process_handle_posix.cc",
104    "base/process/process_iterator.cc",
105    "base/process/process_iterator_linux.cc",
106    "base/process/process_metrics.cc",
107    "base/process/process_metrics_linux.cc",
108    "base/process/process_metrics_posix.cc",
109    "base/process/process_posix.cc",
110    "base/profiler/scoped_profile.cc",
111    "base/profiler/scoped_tracker.cc",
112    "base/profiler/tracked_time.cc",
113    "base/rand_util.cc",
114    "base/rand_util_posix.cc",
115    "base/run_loop.cc",
116    "base/sequence_checker_impl.cc",
117    "base/sequenced_task_runner.cc",
118    "base/sha1_portable.cc",
119    "base/strings/pattern.cc",
120    "base/strings/safe_sprintf.cc",
121    "base/strings/string16.cc",
122    "base/strings/string_number_conversions.cc",
123    "base/strings/string_piece.cc",
124    "base/strings/stringprintf.cc",
125    "base/strings/string_split.cc",
126    "base/strings/string_util.cc",
127    "base/strings/string_util_constants.cc",
128    "base/strings/sys_string_conversions_posix.cc",
129    "base/strings/utf_string_conversions.cc",
130    "base/strings/utf_string_conversion_utils.cc",
131    "base/synchronization/cancellation_flag.cc",
132    "base/synchronization/condition_variable_posix.cc",
133    "base/synchronization/lock.cc",
134    "base/synchronization/lock_impl_posix.cc",
135    "base/synchronization/read_write_lock_posix.cc",
136    "base/synchronization/waitable_event_posix.cc",
137    "base/sync_socket_posix.cc",
138    "base/sys_info.cc",
139
140    # TODO(armansito): For our GN builds these platform-specific implementations
141    # don't really make that much sense but instead of removing the line I'm
142    # commenting it out in case we want to re-add it later (it's included in the
143    # libchrome Android.mk).
144    #"sys_info_chromeos.cc",
145    "base/sys_info_linux.cc",
146    "base/sys_info_posix.cc",
147    "base/task/cancelable_task_tracker.cc",
148    "base/task_runner.cc",
149    "base/third_party/icu/icu_utf.cc",
150    "base/third_party/nspr/prtime.cc",
151    "base/threading/non_thread_safe_impl.cc",
152    "base/threading/platform_thread_internal_posix.cc",
153    "base/threading/platform_thread_linux.cc",
154    "base/threading/platform_thread_posix.cc",
155    "base/threading/post_task_and_reply_impl.cc",
156    "base/threading/sequenced_task_runner_handle.cc",
157    "base/threading/sequenced_worker_pool.cc",
158    "base/threading/simple_thread.cc",
159    "base/threading/thread.cc",
160    "base/threading/thread_checker_impl.cc",
161    "base/threading/thread_collision_warner.cc",
162    "base/threading/thread_id_name_manager.cc",
163    "base/threading/thread_local_posix.cc",
164    "base/threading/thread_local_storage.cc",
165    "base/threading/thread_local_storage_posix.cc",
166    "base/threading/thread_restrictions.cc",
167    "base/threading/worker_pool.cc",
168    "base/threading/worker_pool_posix.cc",
169    "base/threading/thread_task_runner_handle.cc",
170    "base/time/clock.cc",
171    "base/time/default_clock.cc",
172    "base/time/default_tick_clock.cc",
173    "base/timer/elapsed_timer.cc",
174    "base/timer/timer.cc",
175    "base/time/tick_clock.cc",
176    "base/time/time.cc",
177    "base/time/time_posix.cc",
178    "base/trace_event/heap_profiler_allocation_context.cc",
179    "base/trace_event/heap_profiler_allocation_context_tracker.cc",
180    "base/trace_event/heap_profiler_stack_frame_deduplicator.cc",
181    "base/trace_event/heap_profiler_type_name_deduplicator.cc",
182    "base/trace_event/malloc_dump_provider.cc",
183    "base/trace_event/memory_allocator_dump.cc",
184    "base/trace_event/memory_allocator_dump_guid.cc",
185    "base/trace_event/memory_dump_manager.cc",
186    "base/trace_event/memory_dump_session_state.cc",
187    "base/trace_event/memory_infra_background_whitelist.cc",
188    "base/trace_event/process_memory_dump.cc",
189    "base/trace_event/process_memory_maps.cc",
190    "base/trace_event/process_memory_totals.cc",
191    "base/trace_event/trace_buffer.cc",
192    "base/trace_event/trace_config.cc",
193    "base/trace_event/trace_event_argument.cc",
194    "base/trace_event/trace_event_impl.cc",
195    "base/trace_event/trace_event_memory_overhead.cc",
196    "base/trace_event/trace_event_synthetic_delay.cc",
197    "base/trace_event/trace_log.cc",
198    "base/trace_event/trace_log_constants.cc",
199    "base/trace_event/trace_sampling_thread.cc",
200    "base/tracked_objects.cc",
201    "base/tracking_info.cc",
202    "base/values.cc",
203    "base/vlog.cc",
204  ]
205
206  defines = [
207    "BASE_IMPLEMENTATION",
208
209    # trick libchrome to think we're building host code within an Android checkout
210    # thanks to it no glib dependency
211    "__ANDROID_HOST__=1",
212    "OS_LINUX=1",
213  ]
214
215  include_dirs = [
216    "//",
217    "//third_party/googletest/googletest/include",
218    "//third_party/libchrome",
219    "//third_party/libevent",
220    "//third_party/libevent/include",
221    "//third_party/libchrome/base",
222    "//third_party/modp_b64",
223  ]
224}
225
226config("libchrome_config") {
227  # libchrome headers need to be able to find themselves.
228  include_dirs = [
229    "//third_party/googletest/googletest/include",
230    "//third_party/libchrome",
231 ]
232}
233
234static_library("base") {
235  deps = [
236    ":base_sources",
237  ]
238
239  cflags = [
240    "-Wno-char-subscripts",
241    "-Wno-missing-field-initializers",
242    "-Wno-unused-function",
243    "-Wno-unused_parameter",
244  ]
245  cflags_cc = [
246    "-Wno-deprecated-register",
247    "-Wno-non-virtual-dtor",
248    "-Wno-sign-promo",
249  ]
250
251  libs = [
252    "-levent",
253    "-levent_core",
254    "-lpthread",
255  ]
256
257  public_configs = [ ":libchrome_config" ]
258}
259