blob: 4477a86dbdb41e9ab4544d1d20ae843bda640a45 [file] [log] [blame]
Hidehiko Abe6ddb2e02018-12-02 23:24:50 +09001# Copyright 2018 The Chromium OS Authors. All rights reserved.
2# Use of this source code is governed by a BSD-style license that can be
3# found in the LICENSE file.
4
Hidehiko Abee925d022019-01-17 19:29:55 +09005import("//common-mk/mojom_bindings_generator.gni")
Hidehiko Abe6ddb2e02018-12-02 23:24:50 +09006import("//common-mk/pkg_config.gni")
7
8group("all") {
9 deps = [
10 ":libchrome",
11 ":libchrome-test",
12 ]
Hidehiko Abec1e45432019-02-06 16:44:29 +090013 if (use.mojo) {
Hidehiko Abee925d022019-01-17 19:29:55 +090014 deps += [ ":libmojo" ]
15 }
Hidehiko Abe6ddb2e02018-12-02 23:24:50 +090016}
17
Hidehiko Abee925d022019-01-17 19:29:55 +090018config("libchrome_config") {
19 # TODO(hidehiko): Consolidate with build_config.h.
20 defines = [
21 "OS_CHROMEOS",
22 "USE_NSS_CERTS",
23 "USE_SYSTEM_LIBEVENT",
24 "NO_TCMALLOC",
25 "MOJO_EDK_LEGACY_PROTOCOL",
26 ]
Hidehiko Abe9887bc92019-06-03 00:31:12 +090027 if (use.asan) {
28 defines += [ "LEAK_SANITIZER" ]
29 }
30
Hidehiko Abee925d022019-01-17 19:29:55 +090031 include_dirs = [ "." ]
32 cflags = [
33 "-Wno-deprecated-register",
34 "-Wno-narrowing",
35 "-Wno-unused-local-typedefs",
36 "-Xclang-only=-Wno-char-subscripts",
37 ]
Manoj Gupta084fa8e2019-04-03 16:49:12 -070038 # Address sanitizer + coverage builds do not support -z,defs.
39 if (!(use.asan || use.coverage)) {
Hidehiko Abee925d022019-01-17 19:29:55 +090040 ldflags = [ "-Wl,-z,defs" ]
41 }
42}
43
Hidehiko Abe6ddb2e02018-12-02 23:24:50 +090044config("base_core_config") {
Hidehiko Abe49419512018-12-15 00:36:33 +090045 cflags = [
Hidehiko Abee925d022019-01-17 19:29:55 +090046 # Suppressing warning in base/strings/stringprintf.cc.
Hidehiko Abe49419512018-12-15 00:36:33 +090047 "-Wno-format-nonliteral",
48 # This is for _exit(1) in base/debug/debugger_posix.cc.
49 "-Wno-unreachable-code",
50 ]
Hidehiko Abe6ddb2e02018-12-02 23:24:50 +090051}
52
53libbase_sublibs = [
54 {
55 name = "base-core"
56 output_name = name + "-${libbase_ver}"
57 libs = [ "pthread", "rt", "modp_b64" ]
58 pkg_deps = [ "glib-2.0", "libevent" ]
59 configs = [ ":base_core_config" ]
60 sources = [
61 "base/allocator/allocator_extension.cc",
62 "base/allocator/allocator_shim.cc",
63 "base/allocator/allocator_shim_default_dispatch_to_glibc.cc",
64 "base/at_exit.cc",
65 "base/base64.cc",
66 "base/base64url.cc",
Hidehiko Abe780c6a92018-12-21 19:27:08 +090067 "base/base_paths.cc",
68 "base/base_paths_posix.cc",
Hidehiko Abe6ddb2e02018-12-02 23:24:50 +090069 "base/base_switches.cc",
70 "base/bind_helpers.cc",
71 "base/build_time.cc",
72 "base/callback_helpers.cc",
73 "base/callback_internal.cc",
74 "base/command_line.cc",
75 "base/cpu.cc",
76 "base/debug/activity_tracker.cc",
77 "base/debug/alias.cc",
Hidehiko Abe6ddb2e02018-12-02 23:24:50 +090078 "base/debug/debugger.cc",
79 "base/debug/debugger_posix.cc",
80 "base/debug/dump_without_crashing.cc",
81 "base/debug/stack_trace.cc",
82 "base/debug/stack_trace_posix.cc",
83 "base/debug/task_annotator.cc",
84 "base/environment.cc",
85 "base/feature_list.cc",
86 "base/files/file.cc",
87 "base/files/file_descriptor_watcher_posix.cc",
88 "base/files/file_enumerator.cc",
89 "base/files/file_enumerator_posix.cc",
90 "base/files/file_path.cc",
91 "base/files/file_path_constants.cc",
92 "base/files/file_path_watcher.cc",
93 "base/files/file_path_watcher_linux.cc",
94 "base/files/file_posix.cc",
95 "base/files/file_tracing.cc",
96 "base/files/file_util.cc",
97 "base/files/file_util_linux.cc",
98 "base/files/file_util_posix.cc",
99 "base/files/important_file_writer.cc",
100 "base/files/memory_mapped_file.cc",
101 "base/files/memory_mapped_file_posix.cc",
102 "base/files/scoped_file.cc",
103 "base/files/scoped_temp_dir.cc",
104 "base/guid.cc",
105 "base/hash.cc",
106 "base/json/json_file_value_serializer.cc",
107 "base/json/json_parser.cc",
108 "base/json/json_reader.cc",
109 "base/json/json_string_value_serializer.cc",
110 "base/json/json_value_converter.cc",
111 "base/json/json_writer.cc",
112 "base/json/string_escape.cc",
113 "base/lazy_instance.cc",
114 "base/location.cc",
115 "base/logging.cc",
116 "base/md5.cc",
117 "base/memory/aligned_memory.cc",
118 "base/memory/ref_counted.cc",
119 "base/memory/ref_counted_memory.cc",
120 "base/memory/shared_memory_helper.cc",
121 "base/memory/shared_memory_posix.cc",
122 "base/memory/shared_memory_tracker.cc",
123 "base/memory/singleton.cc",
124 "base/memory/weak_ptr.cc",
125 "base/message_loop/incoming_task_queue.cc",
126 "base/message_loop/message_loop.cc",
127 "base/message_loop/message_loop_task_runner.cc",
128 "base/message_loop/message_pump.cc",
129 "base/message_loop/message_pump_default.cc",
130 "base/message_loop/message_pump_glib.cc",
131 "base/message_loop/message_pump_libevent.cc",
132 "base/metrics/bucket_ranges.cc",
133 "base/metrics/field_trial.cc",
134 "base/metrics/field_trial_param_associator.cc",
135 "base/metrics/metrics_hashes.cc",
136 "base/metrics/histogram_base.cc",
137 "base/metrics/histogram.cc",
138 "base/metrics/histogram_samples.cc",
139 "base/metrics/histogram_snapshot_manager.cc",
140 "base/metrics/persistent_histogram_allocator.cc",
141 "base/metrics/persistent_memory_allocator.cc",
142 "base/metrics/persistent_sample_map.cc",
143 "base/metrics/sample_map.cc",
144 "base/metrics/sample_vector.cc",
145 "base/metrics/sparse_histogram.cc",
146 "base/metrics/statistics_recorder.cc",
Hidehiko Abe780c6a92018-12-21 19:27:08 +0900147 "base/path_service.cc",
Hidehiko Abe6ddb2e02018-12-02 23:24:50 +0900148 "base/pending_task.cc",
149 "base/pickle.cc",
150 "base/posix/file_descriptor_shuffle.cc",
151 "base/posix/global_descriptors.cc",
152 "base/posix/safe_strerror.cc",
153 "base/posix/unix_domain_socket_linux.cc",
154 "base/process/internal_linux.cc",
155 "base/process/kill.cc",
156 "base/process/kill_posix.cc",
157 "base/process/launch.cc",
158 "base/process/launch_posix.cc",
159 "base/process/memory.cc",
160 "base/process/memory_linux.cc",
161 "base/process/process_handle.cc",
162 "base/process/process_handle_linux.cc",
Hidehiko Abe780c6a92018-12-21 19:27:08 +0900163 "base/process/process_handle_posix.cc",
164 "base/process/process_info_linux.cc",
Hidehiko Abe6ddb2e02018-12-02 23:24:50 +0900165 "base/process/process_iterator.cc",
166 "base/process/process_iterator_linux.cc",
Hidehiko Abe6ddb2e02018-12-02 23:24:50 +0900167 "base/process/process_metrics.cc",
168 "base/process/process_metrics_linux.cc",
169 "base/process/process_metrics_posix.cc",
170 "base/process/process_posix.cc",
171 "base/profiler/scoped_profile.cc",
172 "base/profiler/scoped_tracker.cc",
173 "base/profiler/tracked_time.cc",
174 "base/rand_util.cc",
175 "base/rand_util_posix.cc",
176 "base/run_loop.cc",
177 "base/sequence_checker_impl.cc",
178 "base/sequenced_task_runner.cc",
179 "base/sequence_token.cc",
180 "base/sha1.cc",
181 "base/strings/pattern.cc",
182 "base/strings/safe_sprintf.cc",
183 "base/strings/string16.cc",
184 "base/strings/string_number_conversions.cc",
185 "base/strings/string_piece.cc",
186 "base/strings/stringprintf.cc",
187 "base/strings/string_split.cc",
188 "base/strings/string_util.cc",
189 "base/strings/string_util_constants.cc",
190 "base/strings/sys_string_conversions_posix.cc",
191 "base/strings/utf_string_conversions.cc",
192 "base/strings/utf_string_conversion_utils.cc",
193 "base/synchronization/atomic_flag.cc",
194 "base/synchronization/condition_variable_posix.cc",
195 "base/synchronization/lock.cc",
196 "base/synchronization/lock_impl_posix.cc",
197 "base/synchronization/read_write_lock_posix.cc",
198 "base/synchronization/waitable_event_posix.cc",
199 "base/synchronization/waitable_event_watcher_posix.cc",
200 "base/sync_socket_posix.cc",
201 "base/sys_info.cc",
202 "base/sys_info_chromeos.cc",
203 "base/sys_info_linux.cc",
204 "base/sys_info_posix.cc",
205 "base/task_runner.cc",
206 "base/task/cancelable_task_tracker.cc",
207 "base/task_scheduler/scheduler_lock_impl.cc",
208 "base/task_scheduler/scoped_set_task_priority_for_current_thread.cc",
209 "base/task_scheduler/sequence.cc",
210 "base/task_scheduler/sequence_sort_key.cc",
211 "base/task_scheduler/task.cc",
212 "base/task_scheduler/task_traits.cc",
213 "base/third_party/dynamic_annotations/dynamic_annotations.c",
214 "base/third_party/icu/icu_utf.cc",
215 "base/third_party/nspr/prtime.cc",
216 "base/threading/non_thread_safe_impl.cc",
217 "base/threading/platform_thread_internal_posix.cc",
218 "base/threading/platform_thread_linux.cc",
219 "base/threading/platform_thread_posix.cc",
220 "base/threading/post_task_and_reply_impl.cc",
221 "base/threading/sequenced_task_runner_handle.cc",
222 "base/threading/sequenced_worker_pool.cc",
223 "base/threading/simple_thread.cc",
224 "base/threading/thread.cc",
225 "base/threading/thread_checker_impl.cc",
226 "base/threading/thread_collision_warner.cc",
227 "base/threading/thread_id_name_manager.cc",
228 "base/threading/thread_local_storage.cc",
229 "base/threading/thread_local_storage_posix.cc",
230 "base/threading/thread_restrictions.cc",
231 "base/threading/thread_task_runner_handle.cc",
232 "base/threading/worker_pool.cc",
233 "base/threading/worker_pool_posix.cc",
234 "base/timer/elapsed_timer.cc",
235 "base/timer/timer.cc",
236 "base/time/clock.cc",
237 "base/time/default_clock.cc",
238 "base/time/default_tick_clock.cc",
239 "base/time/tick_clock.cc",
240 "base/time/time.cc",
241 "base/time/time_posix.cc",
242 "base/trace_event/category_registry.cc",
243 "base/trace_event/event_name_filter.cc",
244 "base/trace_event/malloc_dump_provider.cc",
245 "base/trace_event/heap_profiler_allocation_context.cc",
246 "base/trace_event/heap_profiler_allocation_context_tracker.cc",
247 "base/trace_event/heap_profiler_allocation_register.cc",
248 "base/trace_event/heap_profiler_allocation_register_posix.cc",
249 "base/trace_event/heap_profiler_event_filter.cc",
250 "base/trace_event/heap_profiler_heap_dump_writer.cc",
251 "base/trace_event/heap_profiler_stack_frame_deduplicator.cc",
252 "base/trace_event/heap_profiler_type_name_deduplicator.cc",
253 "base/trace_event/memory_allocator_dump.cc",
254 "base/trace_event/memory_allocator_dump_guid.cc",
255 "base/trace_event/memory_dump_manager.cc",
Hidehiko Abe780c6a92018-12-21 19:27:08 +0900256 "base/trace_event/memory_dump_provider_info.cc",
Hidehiko Abe6ddb2e02018-12-02 23:24:50 +0900257 "base/trace_event/memory_dump_request_args.cc",
258 "base/trace_event/memory_dump_scheduler.cc",
259 "base/trace_event/memory_dump_session_state.cc",
260 "base/trace_event/memory_infra_background_whitelist.cc",
261 "base/trace_event/process_memory_dump.cc",
262 "base/trace_event/process_memory_maps.cc",
263 "base/trace_event/process_memory_totals.cc",
264 "base/trace_event/trace_buffer.cc",
265 "base/trace_event/trace_config.cc",
Hidehiko Abe780c6a92018-12-21 19:27:08 +0900266 "base/trace_event/trace_config_category_filter.cc",
Hidehiko Abe6ddb2e02018-12-02 23:24:50 +0900267 "base/trace_event/trace_event_argument.cc",
268 "base/trace_event/trace_event_filter.cc",
269 "base/trace_event/trace_event_impl.cc",
270 "base/trace_event/trace_event_memory_overhead.cc",
271 "base/trace_event/trace_event_synthetic_delay.cc",
272 "base/trace_event/trace_log.cc",
273 "base/trace_event/trace_log_constants.cc",
274 "base/tracked_objects.cc",
275 "base/tracking_info.cc",
Hidehiko Abe780c6a92018-12-21 19:27:08 +0900276 "base/unguessable_token.cc",
Hidehiko Abe6ddb2e02018-12-02 23:24:50 +0900277 "base/values.cc",
278 "base/version.cc",
279 "base/vlog.cc",
280 ]
281 },
282
283 {
284 name = "base-dl"
285 output_name = name + "-${libbase_ver}"
286 deps = [ ":base-core" ]
287 libs = [ "dl" ]
288 sources = [ "base/native_library_posix.cc" ]
289 },
290
291 {
292 name = "base-policy"
293 output_name = name + "-${libbase_ver}"
294 deps = [ ":base-core" ]
295 sources = [
296 "components/policy/core/common/policy_load_status.cc",
297 "components/policy/core/common/registry_dict.cc",
298 ]
299 },
300
301 {
302 name = "base-base_test_support"
303 output_name = name + "-${libbase_ver}"
304 testonly = true
305 sources = [
Hidehiko Abe6ddb2e02018-12-02 23:24:50 +0900306 "base/test/simple_test_clock.cc",
307 "base/test/simple_test_tick_clock.cc",
308 "base/test/test_file_util.cc",
309 "base/test/test_file_util_linux.cc",
Hidehiko Abeba151bd2019-01-15 04:03:08 +0900310 "base/test/test_mock_time_task_runner.cc",
311 "base/test/test_pending_task.cc",
Hidehiko Abe6ddb2e02018-12-02 23:24:50 +0900312 "base/test/test_switches.cc",
313 "base/test/test_timeouts.cc",
314 ]
315 }
316]
317
318if (use.crypto) {
319 libbase_sublibs += [
320 {
321 name = "base-crypto"
322 output_name = name + "-${libbase_ver}"
323 deps = [ ":base-core", ":base-dl" ]
324 pkg_deps = [ "nss", "openssl" ]
325 sources = [
326 "crypto/hmac.cc",
327 "crypto/hmac_nss.cc",
328 "crypto/nss_key_util.cc",
329 "crypto/nss_util.cc",
330 "crypto/openssl_util.cc",
331 "crypto/p224.cc",
332 "crypto/p224_spake.cc",
333 "crypto/random.cc",
334 "crypto/rsa_private_key.cc",
335 "crypto/rsa_private_key_nss.cc",
336 "crypto/scoped_test_nss_db.cc",
337 "crypto/secure_hash.cc",
338 "crypto/secure_util.cc",
339 "crypto/sha2.cc",
340 "crypto/signature_creator_nss.cc",
341 "crypto/signature_verifier_nss.cc",
342 "crypto/symmetric_key_nss.cc",
343 "crypto/third_party/nss/rsawrapr.c",
344 "crypto/third_party/nss/sha512.cc",
Daniel Kurtz57fb3f32017-06-29 19:34:04 +0800345 # Added to libchrome only (not upstream) to support OpenSSL 1.1 API
346 "crypto/libcrypto-compat.c",
Hidehiko Abe6ddb2e02018-12-02 23:24:50 +0900347 ]
348 }
349 ]
350}
351
352if (use.dbus) {
353 libbase_sublibs += [
354 {
355 name = "base-dbus"
356 output_name = name + "-${libbase_ver}"
357 deps = [ ":base-core" ]
Stephen Barberfd0c4e32019-10-15 22:06:42 -0700358 pkg_deps = [ "dbus-1" ]
359 if (use.fuzzer) {
360 pkg_deps += [ "protobuf" ]
361 } else {
362 pkg_deps += [ "protobuf-lite" ]
363 }
Hidehiko Abe6ddb2e02018-12-02 23:24:50 +0900364 sources = [
365 "dbus/bus.cc",
366 "dbus/dbus_statistics.cc",
367 "dbus/exported_object.cc",
368 "dbus/message.cc",
369 "dbus/object_manager.cc",
370 "dbus/object_path.cc",
371 "dbus/object_proxy.cc",
372 "dbus/property.cc",
373 "dbus/scoped_dbus_error.cc",
374 "dbus/string_util.cc",
375 "dbus/util.cc",
376 "dbus/values_util.cc",
377 ]
378 },
379
380 {
381 name = "base-dbus_test_support"
382 output_name = name + "-${libbase_ver}"
383 testonly = true
Stephen Barberfd0c4e32019-10-15 22:06:42 -0700384 pkg_deps = [ "dbus-1" ]
385 if (use.fuzzer) {
386 pkg_deps += [ "protobuf" ]
387 } else {
388 pkg_deps += [ "protobuf-lite" ]
389 }
Hidehiko Abe6ddb2e02018-12-02 23:24:50 +0900390 sources = [
391 "dbus/mock_bus.cc",
392 "dbus/mock_exported_object.cc",
393 "dbus/mock_object_manager.cc",
394 "dbus/mock_object_proxy.cc",
395 ]
396 },
397 ]
398}
399
400if (use.timers) {
401 libbase_sublibs += [
402 {
403 name = "base-timers"
404 output_name = name + "-${libbase_ver}"
405 deps = [ ":base-core" ]
406 sources = [ "components/timers/alarm_timer_chromeos.cc" ]
407 },
408
409 {
410 name = "base-timer_test_support"
411 output_name = name + "-${libbase_ver}"
412 testonly = true
413 sources = [ "base/timer/mock_timer.cc" ]
414 },
415 ]
416}
417
418# Generate static/shared libraries.
419foreach(attr, libbase_sublibs) {
420 if (defined(attr.pkg_deps)) {
421 # If it depends on external packages, introduces -pkg-config config.
422 pkg_config(attr.name + "-pkg-config") {
423 pkg_deps = attr.pkg_deps
424 }
425 }
426
427 if (defined(attr.testonly) && attr.testonly) {
428 buildtype = "static_library"
429 } else {
430 buildtype = "shared_library"
431 }
432 target(buildtype, attr.name) {
433 output_name = attr.output_name
434 sources = attr.sources
435 if (defined(attr.deps)) {
436 deps = attr.deps
437 }
438
Hidehiko Abe6ddb2e02018-12-02 23:24:50 +0900439 if (defined(attr.libs)) {
440 libs = attr.libs
441 }
442
443 if (defined(attr.pkg_deps)) {
444 configs += [ ":" + attr.name + "-pkg-config" ]
445 }
Hidehiko Abee925d022019-01-17 19:29:55 +0900446 configs += [
447 ":libchrome_config",
448 "//common-mk:visibility_default"
449 ]
Hidehiko Abe6fea5a42018-12-18 04:26:55 +0900450 if (buildtype == "static_library") {
451 configs -= [ "//common-mk:use_thin_archive" ]
452 configs += [ "//common-mk:nouse_thin_archive" ]
453 }
Hidehiko Abe6ddb2e02018-12-02 23:24:50 +0900454 if (defined(attr.configs)) {
455 configs += attr.configs
456 }
457 }
458}
459
460action("base") {
461 deps = []
462 foreach(attr, libbase_sublibs) {
463 if (!defined(attr.testonly) || !attr.testonly) {
464 deps += [ ":" + attr.name ]
465 }
466 }
467
468 script = "//common-mk/write_args.py"
469 outputs = [ "${root_out_dir}/lib/lib${target_name}-${libbase_ver}.so" ]
470 args = [ "--output" ] + outputs + [ "--" ] + [
471 "GROUP", "(", "AS_NEEDED", "(",
472 ]
473 foreach(attr, libbase_sublibs) {
474 if (!defined(attr.testonly) || !attr.testonly) {
475 args += [ "-l" + attr.output_name ]
476 }
477 }
478 args += [ ")", ")" ]
479}
480
481libchrome_exported_cflags = [
482 "-I/usr/include/base-${libbase_ver}",
483 "-Wno-unused-local-typedefs",
484 "-DBASE_VER=${libbase_ver}",
485]
486
Hidehiko Abe9887bc92019-06-03 00:31:12 +0900487if (use.asan) {
488 libchrome_exported_cflags += [ "-DLEAK_SANITIZER" ]
489}
490
Hidehiko Abe6ddb2e02018-12-02 23:24:50 +0900491generate_pkg_config("libchrome") {
492 deps = [ ":base" ]
493 output_name = "libchrome-${libbase_ver}"
494 description = "chrome base library"
495 version = "${libbase_ver}"
496 requires_private = []
497 foreach(attr, libbase_sublibs) {
498 if ((!defined(attr.testonly) || !attr.testonly)
499 && defined(attr.pkg_deps)) {
500 requires_private += attr.pkg_deps
501 }
502 }
Hidehiko Abee1f598f2019-01-15 01:32:39 +0900503 libs = [ "-lbase-${libbase_ver}" ]
Hidehiko Abe6ddb2e02018-12-02 23:24:50 +0900504 libs_private = []
505 foreach(attr, libbase_sublibs) {
506 if (!defined(attr.testonly) || !attr.testonly) {
Hidehiko Abee1f598f2019-01-15 01:32:39 +0900507 libs_private += [ "-l" + attr.output_name ]
508 if (defined(attr.libs)) {
509 foreach(lib, attr.libs) {
510 libs_private += [ "-l" + lib ]
511 }
512 }
Hidehiko Abe6ddb2e02018-12-02 23:24:50 +0900513 }
514 }
515 cflags = libchrome_exported_cflags
516}
517
518action("base-test") {
519 deps = []
520 foreach(attr, libbase_sublibs) {
521 if (defined(attr.testonly) && attr.testonly) {
522 deps += [ ":" + attr.name ]
523 }
524 }
525
526 script = "//common-mk/write_args.py"
527 outputs = [ "${root_out_dir}/lib${target_name}-${libbase_ver}.a" ]
528 args = [ "--output" ] + outputs + [ "--" ] + [
529 "GROUP", "(", "AS_NEEDED", "(",
530 ]
531 foreach(attr, libbase_sublibs) {
532 if (defined(attr.testonly) && attr.testonly) {
533 args += [ "-l" + attr.output_name ]
534 }
535 }
536 args += [ ")", ")" ]
537}
538
539generate_pkg_config("libchrome-test") {
540 deps = [ ":base-test" ]
541 output_name = "libchrome-test-${libbase_ver}"
542 description = "chrome base test library"
543 version = "${libbase_ver}"
544 requires_private = []
545 foreach(attr, libbase_sublibs) {
546 if (defined(attr.testonly) && attr.testonly && defined(attr.pkg_deps)) {
547 requires_private += attr.pkg_deps
548 }
549 }
Hidehiko Abee1f598f2019-01-15 01:32:39 +0900550 libs = [ "-lbase-test-${libbase_ver}" ]
Hidehiko Abe6ddb2e02018-12-02 23:24:50 +0900551 libs_private = []
552 foreach(attr, libbase_sublibs) {
553 if (defined(attr.testonly) && attr.testonly) {
Hidehiko Abee1f598f2019-01-15 01:32:39 +0900554 libs_private += [ "-l" + attr.output_name ]
555 if (defined(attr.libs)) {
556 libs_private += [ "-l" + lib ]
557 }
Hidehiko Abe6ddb2e02018-12-02 23:24:50 +0900558 }
559 }
560 cflags = libchrome_exported_cflags
561}
Hidehiko Abee925d022019-01-17 19:29:55 +0900562
Hidehiko Abec1e45432019-02-06 16:44:29 +0900563if (use.mojo) {
Hidehiko Abee925d022019-01-17 19:29:55 +0900564 generate_mojom_bindings_gen("mojom_bindings_gen") {
565 mojom_bindings_generator = "mojo/public/tools/bindings/mojom_bindings_generator.py"
566 sources = [
567 "ipc/ipc.mojom",
568 "mojo/common/file.mojom",
569 "mojo/common/file_path.mojom",
570 "mojo/common/string16.mojom",
571 "mojo/common/text_direction.mojom",
572 "mojo/common/time.mojom",
573 "mojo/common/unguessable_token.mojom",
574 "mojo/common/values.mojom",
575 "mojo/common/version.mojom",
576 "mojo/public/interfaces/bindings/pipe_control_messages.mojom",
577 "mojo/public/interfaces/bindings/interface_control_messages.mojom",
578 ]
579 }
580
581 # Probably we should consider build libmojo as a part of libchrome.
582 # crbug.com/924035.
583 static_library("mojo") {
584 output_name = "mojo-${libbase_ver}"
585 deps = [ ":base-core", ":base-crypto", ":mojom_bindings_gen" ]
586 # TODO(hidehiko): Consolidate with build_config.h.
587 configs -= [
588 "//common-mk:use_thin_archive",
589 "//common-mk:pie",
590 ]
591 configs += [
592 ":libchrome_config",
593 "//common-mk:visibility_default",
594 "//common-mk:nouse_thin_archive",
595 "//common-mk:pic",
596 ]
597 sources = [
598 "ipc/ipc_message.cc",
599 "ipc/ipc_message_attachment.cc",
600 "ipc/ipc_message_attachment_set.cc",
601 "ipc/ipc_message_utils.cc",
602 "ipc/ipc_mojo_handle_attachment.cc",
603 "ipc/ipc_mojo_message_helper.cc",
604 "ipc/ipc_mojo_param_traits.cc",
605 "ipc/ipc_platform_file_attachment_posix.cc",
606 "mojo/common/common_custom_types_struct_traits.cc",
607 "mojo/common/data_pipe_drainer.cc",
608 "mojo/common/data_pipe_utils.cc",
609 "mojo/common/values_struct_traits.cc",
610 "mojo/edk/embedder/connection_params.cc",
611 "mojo/edk/embedder/embedder.cc",
612 "mojo/edk/embedder/entrypoints.cc",
613 "mojo/edk/embedder/named_platform_handle_utils_posix.cc",
614 "mojo/edk/embedder/pending_process_connection.cc",
615 "mojo/edk/embedder/platform_channel_pair.cc",
616 "mojo/edk/embedder/platform_channel_pair_posix.cc",
617 "mojo/edk/embedder/platform_channel_utils_posix.cc",
618 "mojo/edk/embedder/platform_handle.cc",
619 "mojo/edk/embedder/platform_handle_utils_posix.cc",
620 "mojo/edk/embedder/platform_shared_buffer.cc",
621 "mojo/edk/embedder/scoped_ipc_support.cc",
622 "mojo/edk/embedder/test_embedder.cc",
623 "mojo/edk/system/broker_host.cc",
624 "mojo/edk/system/broker_posix.cc",
625 "mojo/edk/system/channel.cc",
626 "mojo/edk/system/channel_posix.cc",
627 "mojo/edk/system/configuration.cc",
628 "mojo/edk/system/core.cc",
629 "mojo/edk/system/data_pipe_consumer_dispatcher.cc",
630 "mojo/edk/system/data_pipe_control_message.cc",
631 "mojo/edk/system/data_pipe_producer_dispatcher.cc",
632 "mojo/edk/system/dispatcher.cc",
633 "mojo/edk/system/handle_table.cc",
634 "mojo/edk/system/mapping_table.cc",
635 "mojo/edk/system/message_for_transit.cc",
636 "mojo/edk/system/message_pipe_dispatcher.cc",
637 "mojo/edk/system/node_channel.cc",
638 "mojo/edk/system/node_controller.cc",
639 "mojo/edk/system/platform_handle_dispatcher.cc",
640 "mojo/edk/system/ports/event.cc",
641 "mojo/edk/system/ports/message.cc",
642 "mojo/edk/system/ports/message_queue.cc",
643 "mojo/edk/system/ports/name.cc",
644 "mojo/edk/system/ports/node.cc",
645 "mojo/edk/system/ports/port.cc",
646 "mojo/edk/system/ports/port_ref.cc",
647 "mojo/edk/system/ports_message.cc",
648 "mojo/edk/system/request_context.cc",
649 "mojo/edk/system/shared_buffer_dispatcher.cc",
650 "mojo/edk/system/watch.cc",
651 "mojo/edk/system/watcher_dispatcher.cc",
652 "mojo/edk/system/watcher_set.cc",
653 "mojo/public/c/system/set_thunks_for_app.cc",
654 "mojo/public/c/system/thunks.cc",
655 "mojo/public/cpp/bindings/lib/array_internal.cc",
656 "mojo/public/cpp/bindings/lib/associated_binding.cc",
657 "mojo/public/cpp/bindings/lib/associated_group.cc",
658 "mojo/public/cpp/bindings/lib/associated_group_controller.cc",
659 "mojo/public/cpp/bindings/lib/associated_interface_ptr.cc",
660 "mojo/public/cpp/bindings/lib/binding_state.cc",
661 "mojo/public/cpp/bindings/lib/connector.cc",
662 "mojo/public/cpp/bindings/lib/control_message_handler.cc",
663 "mojo/public/cpp/bindings/lib/control_message_proxy.cc",
664 "mojo/public/cpp/bindings/lib/filter_chain.cc",
665 "mojo/public/cpp/bindings/lib/fixed_buffer.cc",
666 "mojo/public/cpp/bindings/lib/interface_endpoint_client.cc",
667 "mojo/public/cpp/bindings/lib/message.cc",
668 "mojo/public/cpp/bindings/lib/message_buffer.cc",
669 "mojo/public/cpp/bindings/lib/message_builder.cc",
670 "mojo/public/cpp/bindings/lib/message_header_validator.cc",
671 "mojo/public/cpp/bindings/lib/multiplex_router.cc",
672 "mojo/public/cpp/bindings/lib/native_struct.cc",
673 "mojo/public/cpp/bindings/lib/native_struct_data.cc",
674 "mojo/public/cpp/bindings/lib/native_struct_serialization.cc",
675 "mojo/public/cpp/bindings/lib/pipe_control_message_handler.cc",
676 "mojo/public/cpp/bindings/lib/pipe_control_message_proxy.cc",
677 "mojo/public/cpp/bindings/lib/scoped_interface_endpoint_handle.cc",
678 "mojo/public/cpp/bindings/lib/serialization_context.cc",
679 "mojo/public/cpp/bindings/lib/string_traits_string16.cc",
680 "mojo/public/cpp/bindings/lib/sync_call_restrictions.cc",
681 "mojo/public/cpp/bindings/lib/sync_event_watcher.cc",
682 "mojo/public/cpp/bindings/lib/sync_handle_registry.cc",
683 "mojo/public/cpp/bindings/lib/sync_handle_watcher.cc",
684 "mojo/public/cpp/bindings/lib/validation_context.cc",
685 "mojo/public/cpp/bindings/lib/validation_errors.cc",
686 "mojo/public/cpp/bindings/lib/validation_util.cc",
687 "mojo/public/cpp/system/buffer.cc",
688 "mojo/public/cpp/system/platform_handle.cc",
689 "mojo/public/cpp/system/simple_watcher.cc",
690 "mojo/public/cpp/system/wait.cc",
691 "mojo/public/cpp/system/wait_set.cc",
692 "mojo/public/cpp/system/watcher.cc",
693 ] + get_target_outputs(":mojom_bindings_gen")
694 }
695
696 generate_pkg_config("libmojo") {
697 deps = [ ":mojo" ]
698 output_name = "libmojo-${libbase_ver}"
699 description = "Chrome Mojo IPC library"
700 version = "${libbase_ver}"
701 libs = [ "-lmojo-${libbase_ver}" ]
702 cflags = [
703 "-I/usr/lib/base-${libbase_ver}",
704 "-Wno-cast-qual",
705 "-Wno-cast-align",
706 ]
707 }
708}