1#
2#  Copyright 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    "dbus/bus.cc",
206    "dbus/dbus_statistics.cc",
207    "dbus/exported_object.cc",
208    "dbus/file_descriptor.cc",
209    "dbus/message.cc",
210    "dbus/object_manager.cc",
211    "dbus/object_path.cc",
212    "dbus/object_proxy.cc",
213    "dbus/property.cc",
214    "dbus/scoped_dbus_error.cc",
215    "dbus/string_util.cc",
216    "dbus/util.cc",
217    "dbus/values_util.cc"
218  ]
219
220  defines = [
221    "BASE_IMPLEMENTATION",
222
223    # trick libchrome to think we're building host code within an Android checkout
224    # thanks to it no glib dependency
225    "__ANDROID_HOST__=1",
226    "OS_LINUX=1",
227  ]
228
229  include_dirs = [
230    "//",
231    "//third_party/googletest/googletest/include",
232    "//third_party/libchrome",
233    "//third_party/libevent",
234    "//third_party/libevent/include",
235    "//third_party/libchrome/base",
236    "//third_party/libchrome/dbus",
237    "//third_party/modp_b64",
238
239    # paths to dbus headers, can be obtained by "pkg-config --cflags dbus-1"
240    #TODO(jpawlowski) use pkg-config script like build/config/linux/pkg_config.gni
241    "/usr/include/dbus-1.0/",
242    "/usr/lib/x86_64-linux-gnu/dbus-1.0/include",
243  ]
244}
245
246config("libchrome_config") {
247  # libchrome headers need to be able to find themselves.
248  include_dirs = [
249    "//third_party/googletest/googletest/include",
250    "//third_party/libchrome",
251
252    # paths to dbus headers, can be obtained by "pkg-config --cflags dbus-1"
253    #TODO(jpawlowski) use pkg-config script like build/config/linux/pkg_config.gni
254    "/usr/include/dbus-1.0/",
255    "/usr/lib/x86_64-linux-gnu/dbus-1.0/include",
256 ]
257}
258
259static_library("base") {
260  deps = [
261    ":base_sources",
262  ]
263
264  cflags = [
265    "-Wno-char-subscripts",
266    "-Wno-missing-field-initializers",
267    "-Wno-unused-function",
268    "-Wno-unused_parameter",
269  ]
270  cflags_cc = [
271    "-Wno-deprecated-register",
272    "-Wno-non-virtual-dtor",
273    "-Wno-sign-promo",
274  ]
275
276  libs = [
277    "-levent",
278    "-levent_core",
279    "-lpthread",
280    "-ldbus-1",
281  ]
282
283  public_configs = [ ":libchrome_config" ]
284}
285