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/build_time.cc",
28    "base/callback_helpers.cc",
29    "base/callback_internal.cc",
30    "base/command_line.cc",
31    "base/cpu.cc",
32    "base/debug/activity_tracker.cc",
33    "base/debug/alias.cc",
34    "base/debug/dump_without_crashing.cc",
35    "base/debug/debugger.cc",
36    "base/debug/debugger_posix.cc",
37    "base/debug/stack_trace.cc",
38    "base/debug/stack_trace_posix.cc",
39    "base/debug/task_annotator.cc",
40    "base/environment.cc",
41    "base/files/file.cc",
42    "base/files/file_descriptor_watcher_posix.cc",
43    "base/files/file_enumerator.cc",
44    "base/files/file_enumerator_posix.cc",
45    "base/files/file_path.cc",
46    "base/files/file_path_constants.cc",
47    "base/files/file_path_watcher.cc",
48    "base/files/file_path_watcher_linux.cc",
49    "base/files/file_posix.cc",
50    "base/files/file_tracing.cc",
51    "base/files/file_util.cc",
52    "base/files/file_util_linux.cc",
53    "base/files/file_util_posix.cc",
54    "base/files/important_file_writer.cc",
55    "base/files/scoped_file.cc",
56    "base/files/scoped_temp_dir.cc",
57    "base/guid.cc",
58    "base/json/json_parser.cc",
59    "base/json/json_reader.cc",
60    "base/json/json_string_value_serializer.cc",
61    "base/json/json_writer.cc",
62    "base/json/string_escape.cc",
63    "base/lazy_instance_helpers.cc",
64    "base/location.cc",
65    "base/logging.cc",
66    "base/md5.cc",
67    "base/memory/ref_counted.cc",
68    "base/memory/ref_counted_memory.cc",
69    "base/memory/weak_ptr.cc",
70    "base/message_loop/incoming_task_queue.cc",
71    "base/message_loop/message_loop.cc",
72    "base/message_loop/message_loop_current.cc",
73    "base/message_loop/message_loop_task_runner.cc",
74    "base/message_loop/message_pump.cc",
75    "base/message_loop/message_pump_default.cc",
76    "base/message_loop/message_pump_libevent.cc",
77    "base/message_loop/watchable_io_message_pump_posix.cc",
78
79    # we don't want any glib dependencies.
80    #   "base/message_loop/message_pump_glib.cc",
81    "base/metrics/bucket_ranges.cc",
82    "base/metrics/dummy_histogram.cc",
83    "base/metrics/field_trial.cc",
84    "base/metrics/field_trial_param_associator.cc",
85    "base/metrics/histogram.cc",
86    "base/metrics/histogram_base.cc",
87    "base/metrics/histogram_functions.cc",
88    "base/metrics/histogram_samples.cc",
89    "base/metrics/histogram_snapshot_manager.cc",
90    "base/metrics/metrics_hashes.cc",
91    "base/metrics/persistent_histogram_allocator.cc",
92    "base/metrics/persistent_memory_allocator.cc",
93    "base/metrics/persistent_sample_map.cc",
94    "base/metrics/sample_map.cc",
95    "base/metrics/sample_vector.cc",
96    "base/metrics/sparse_histogram.cc",
97    "base/metrics/statistics_recorder.cc",
98    "base/native_library.cc",
99    "base/observer_list_threadsafe.cc",
100    "base/path_service.cc",
101    "base/pending_task.cc",
102    "base/pickle.cc",
103    "base/posix/file_descriptor_shuffle.cc",
104    "base/posix/global_descriptors.cc",
105    "base/posix/safe_strerror.cc",
106    "base/process/internal_linux.cc",
107    "base/process/kill.cc",
108    "base/process/kill_posix.cc",
109    "base/process/launch.cc",
110    "base/process/launch_posix.cc",
111    "base/process/memory.cc",
112    "base/process/process_handle.cc",
113    "base/process/process_handle_linux.cc",
114    "base/process/process_handle_posix.cc",
115    "base/process/process_info_linux.cc",
116    "base/process/process_iterator.cc",
117    "base/process/process_iterator_linux.cc",
118    "base/process/process_metrics.cc",
119    "base/process/process_metrics_linux.cc",
120    "base/process/process_metrics_posix.cc",
121    "base/process/process_posix.cc",
122    "base/rand_util.cc",
123    "base/rand_util_posix.cc",
124    "base/run_loop.cc",
125    "base/sequence_checker_impl.cc",
126    "base/sequenced_task_runner.cc",
127    "base/sequence_token.cc",
128    "base/sha1.cc",
129    "base/strings/pattern.cc",
130    "base/strings/safe_sprintf.cc",
131    "base/strings/string16.cc",
132    "base/strings/string_number_conversions.cc",
133    "base/strings/string_piece.cc",
134    "base/strings/stringprintf.cc",
135    "base/strings/string_split.cc",
136    "base/strings/string_util.cc",
137    "base/strings/string_util_constants.cc",
138    "base/strings/sys_string_conversions_posix.cc",
139    "base/strings/utf_string_conversions.cc",
140    "base/strings/utf_string_conversion_utils.cc",
141    "base/synchronization/atomic_flag.cc",
142    "base/synchronization/condition_variable_posix.cc",
143    "base/synchronization/lock.cc",
144    "base/synchronization/lock_impl_posix.cc",
145    "base/synchronization/waitable_event_posix.cc",
146    "base/sync_socket_posix.cc",
147    "base/sys_info.cc",
148
149    # TODO(armansito): For our GN builds these platform-specific implementations
150    # don't really make that much sense but instead of removing the line I'm
151    # commenting it out in case we want to re-add it later (it's included in the
152    # libchrome Android.mk).
153    #"sys_info_chromeos.cc",
154    "base/sys_info_linux.cc",
155    "base/sys_info_posix.cc",
156    "base/task/cancelable_task_tracker.cc",
157    "base/task_runner.cc",
158    "base/third_party/icu/icu_utf.cc",
159    "base/third_party/nspr/prtime.cc",
160    "base/threading/platform_thread_internal_posix.cc",
161    "base/threading/platform_thread_linux.cc",
162    "base/threading/platform_thread_posix.cc",
163    "base/threading/post_task_and_reply_impl.cc",
164    "base/threading/scoped_blocking_call.cc",
165    "base/threading/sequence_local_storage_map.cc",
166    "base/threading/sequence_local_storage_slot.cc",
167    "base/threading/sequenced_task_runner_handle.cc",
168    "base/threading/simple_thread.cc",
169    "base/threading/thread.cc",
170    "base/threading/thread_checker_impl.cc",
171    "base/threading/thread_collision_warner.cc",
172    "base/threading/thread_id_name_manager.cc",
173    "base/threading/thread_local_storage.cc",
174    "base/threading/thread_local_storage_posix.cc",
175    "base/threading/thread_restrictions.cc",
176    "base/threading/thread_task_runner_handle.cc",
177    "base/time/clock.cc",
178    "base/time/default_clock.cc",
179    "base/time/default_tick_clock.cc",
180    "base/time/tick_clock.cc",
181    "base/time/time.cc",
182    "base/time/time_conversion_posix.cc",
183    "base/time/time_exploded_posix.cc",
184    "base/time/time_now_posix.cc",
185    "base/time/time_override.cc",
186    "base/timer/elapsed_timer.cc",
187    "base/timer/timer.cc",
188    "base/unguessable_token.cc",
189    "base/value_iterators.cc",
190    "base/values.cc",
191    "base/version.cc",
192    "base/vlog.cc",
193
194    "dbus/bus.cc",
195    "dbus/dbus_statistics.cc",
196    "dbus/exported_object.cc",
197    "dbus/message.cc",
198    "dbus/object_manager.cc",
199    "dbus/object_path.cc",
200    "dbus/object_proxy.cc",
201    "dbus/property.cc",
202    "dbus/scoped_dbus_error.cc",
203    "dbus/string_util.cc",
204    "dbus/util.cc",
205    "dbus/values_util.cc"
206  ]
207
208  defines = [
209    "BASE_IMPLEMENTATION",
210
211    # trick libchrome to think we're building host code within an Android checkout
212    # thanks to it no glib dependency
213    "__ANDROID_HOST__=1",
214    "OS_LINUX=1",
215  ]
216
217  include_dirs = [
218    "//",
219    "//third_party/googletest/googletest/include",
220    "//third_party/libchrome",
221    "//third_party/libevent",
222    "//third_party/libevent/include",
223    "//third_party/libchrome/base",
224    "//third_party/libchrome/dbus",
225    "//third_party/modp_b64",
226
227    # paths to dbus headers, can be obtained by "pkg-config --cflags dbus-1"
228    #TODO(jpawlowski) use pkg-config script like build/config/linux/pkg_config.gni
229    "/usr/include/dbus-1.0/",
230    "/usr/lib/x86_64-linux-gnu/dbus-1.0/include",
231  ]
232}
233
234config("libchrome_config") {
235  # libchrome headers need to be able to find themselves.
236  include_dirs = [
237    "//third_party/googletest/googletest/include",
238    "//third_party/libchrome",
239
240    # paths to dbus headers, can be obtained by "pkg-config --cflags dbus-1"
241    #TODO(jpawlowski) use pkg-config script like build/config/linux/pkg_config.gni
242    "/usr/include/dbus-1.0/",
243    "/usr/lib/x86_64-linux-gnu/dbus-1.0/include",
244 ]
245}
246
247static_library("base") {
248  deps = [
249    ":base_sources",
250  ]
251
252  cflags = [
253    "-Wno-char-subscripts",
254    "-Wno-missing-field-initializers",
255    "-Wno-unused-function",
256    "-Wno-unused_parameter",
257  ]
258  cflags_cc = [
259    "-Wno-deprecated-register",
260    "-Wno-non-virtual-dtor",
261    "-Wno-sign-promo",
262  ]
263
264  libs = [
265    "-levent",
266    "-levent_core",
267    "-lpthread",
268    "-ldbus-1",
269  ]
270
271  public_configs = [ ":libchrome_config" ]
272}
273