Daniel Erat | 65f5398 | 2015-08-25 09:21:05 -0600 | [diff] [blame] | 1 | # -*- python -*- |
| 2 | |
| 3 | # Copyright 2014 The Chromium OS Authors. All rights reserved. |
| 4 | # Use of this source code is governed by a BSD-style license that can be |
| 5 | # found in the LICENSE file. |
| 6 | |
| 7 | # This file is used to build the libchrome package for Chrome OS: |
| 8 | # https://www.chromium.org/chromium-os/packages/libchrome |
| 9 | |
| 10 | import os |
| 11 | |
| 12 | env = Environment() |
| 13 | |
| 14 | BASE_VER = os.environ.get('BASE_VER', '0') |
| 15 | PKG_CONFIG = os.environ.get('PKG_CONFIG', 'pkg-config') |
| 16 | CHROME_INCLUDE_PATH = os.environ.get('CHROME_INCLUDE_PATH', '.') |
| 17 | |
| 18 | # This block will need updating whenever libchrome gets updated. The order of |
| 19 | # the libs below doesn't matter (as scons will take care of building things in |
| 20 | # the required order). The split between them is purely to reduce excess |
| 21 | # linking of third-party libraries, i.e. 'core' should require only a minimal |
| 22 | # set of libraries, and other third-party libraries should get a unique 'xxx' |
| 23 | # name. |
| 24 | base_name = 'base' |
| 25 | base_libs = [ |
| 26 | { |
| 27 | 'name' : 'core', |
| 28 | 'sources' : """ |
Daniel Erat | 65f5398 | 2015-08-25 09:21:05 -0600 | [diff] [blame] | 29 | at_exit.cc |
Alex Vakulenko | 42b71bb | 2016-01-20 16:24:55 -0800 | [diff] [blame^] | 30 | base64.cc |
| 31 | base64url.cc |
Daniel Erat | 65f5398 | 2015-08-25 09:21:05 -0600 | [diff] [blame] | 32 | base_switches.cc |
| 33 | bind_helpers.cc |
| 34 | build_time.cc |
| 35 | callback_helpers.cc |
| 36 | callback_internal.cc |
| 37 | command_line.cc |
| 38 | cpu.cc |
| 39 | debug/alias.cc |
| 40 | debug/debugger.cc |
| 41 | debug/debugger_posix.cc |
| 42 | debug/stack_trace.cc |
| 43 | debug/stack_trace_posix.cc |
| 44 | debug/task_annotator.cc |
| 45 | environment.cc |
| 46 | files/file.cc |
| 47 | files/file_enumerator.cc |
| 48 | files/file_enumerator_posix.cc |
| 49 | files/file_path.cc |
| 50 | files/file_path_constants.cc |
| 51 | files/file_path_watcher.cc |
| 52 | files/file_path_watcher_linux.cc |
| 53 | files/file_posix.cc |
| 54 | files/file_tracing.cc |
| 55 | files/file_util.cc |
| 56 | files/file_util_linux.cc |
| 57 | files/file_util_posix.cc |
| 58 | files/important_file_writer.cc |
| 59 | files/scoped_file.cc |
| 60 | files/scoped_temp_dir.cc |
| 61 | guid.cc |
| 62 | guid_posix.cc |
Alex Vakulenko | 42b71bb | 2016-01-20 16:24:55 -0800 | [diff] [blame^] | 63 | json/json_file_value_serializer.cc |
Daniel Erat | 65f5398 | 2015-08-25 09:21:05 -0600 | [diff] [blame] | 64 | json/json_parser.cc |
| 65 | json/json_reader.cc |
| 66 | json/json_string_value_serializer.cc |
Alex Vakulenko | 42b71bb | 2016-01-20 16:24:55 -0800 | [diff] [blame^] | 67 | json/json_value_converter.cc |
Daniel Erat | 65f5398 | 2015-08-25 09:21:05 -0600 | [diff] [blame] | 68 | json/json_writer.cc |
| 69 | json/string_escape.cc |
| 70 | lazy_instance.cc |
| 71 | location.cc |
| 72 | logging.cc |
| 73 | md5.cc |
| 74 | memory/ref_counted.cc |
| 75 | memory/ref_counted_memory.cc |
| 76 | memory/singleton.cc |
| 77 | memory/weak_ptr.cc |
| 78 | message_loop/incoming_task_queue.cc |
| 79 | message_loop/message_loop.cc |
Alex Vakulenko | 42b71bb | 2016-01-20 16:24:55 -0800 | [diff] [blame^] | 80 | message_loop/message_loop_task_runner.cc |
Daniel Erat | 65f5398 | 2015-08-25 09:21:05 -0600 | [diff] [blame] | 81 | message_loop/message_pump.cc |
| 82 | message_loop/message_pump_default.cc |
| 83 | message_loop/message_pump_glib.cc |
| 84 | message_loop/message_pump_libevent.cc |
| 85 | metrics/bucket_ranges.cc |
| 86 | metrics/field_trial.cc |
Alex Vakulenko | 42b71bb | 2016-01-20 16:24:55 -0800 | [diff] [blame^] | 87 | metrics/metrics_hashes.cc |
Daniel Erat | 65f5398 | 2015-08-25 09:21:05 -0600 | [diff] [blame] | 88 | metrics/histogram_base.cc |
| 89 | metrics/histogram.cc |
| 90 | metrics/histogram_samples.cc |
| 91 | metrics/histogram_snapshot_manager.cc |
| 92 | metrics/sample_map.cc |
| 93 | metrics/sample_vector.cc |
| 94 | metrics/sparse_histogram.cc |
| 95 | metrics/statistics_recorder.cc |
| 96 | pending_task.cc |
| 97 | pickle.cc |
| 98 | posix/file_descriptor_shuffle.cc |
| 99 | posix/safe_strerror.cc |
| 100 | posix/unix_domain_socket_linux.cc |
| 101 | process/internal_linux.cc |
| 102 | process/kill.cc |
| 103 | process/kill_posix.cc |
| 104 | process/launch.cc |
| 105 | process/launch_posix.cc |
| 106 | process/process_handle_linux.cc |
| 107 | process/process_iterator.cc |
| 108 | process/process_iterator_linux.cc |
| 109 | process/process_handle_posix.cc |
| 110 | process/process_metrics.cc |
| 111 | process/process_metrics_linux.cc |
| 112 | process/process_metrics_posix.cc |
| 113 | process/process_posix.cc |
| 114 | profiler/alternate_timer.cc |
| 115 | profiler/scoped_profile.cc |
| 116 | profiler/scoped_tracker.cc |
| 117 | profiler/tracked_time.cc |
| 118 | rand_util.cc |
| 119 | rand_util_posix.cc |
| 120 | run_loop.cc |
| 121 | sequence_checker_impl.cc |
| 122 | sequenced_task_runner.cc |
| 123 | sha1_portable.cc |
Alex Vakulenko | 42b71bb | 2016-01-20 16:24:55 -0800 | [diff] [blame^] | 124 | strings/pattern.cc |
Daniel Erat | 65f5398 | 2015-08-25 09:21:05 -0600 | [diff] [blame] | 125 | strings/safe_sprintf.cc |
| 126 | strings/string16.cc |
| 127 | strings/string_number_conversions.cc |
| 128 | strings/string_piece.cc |
| 129 | strings/stringprintf.cc |
| 130 | strings/string_split.cc |
| 131 | strings/string_util.cc |
| 132 | strings/string_util_constants.cc |
| 133 | strings/sys_string_conversions_posix.cc |
| 134 | strings/utf_string_conversions.cc |
| 135 | strings/utf_string_conversion_utils.cc |
| 136 | synchronization/cancellation_flag.cc |
| 137 | synchronization/condition_variable_posix.cc |
| 138 | synchronization/lock.cc |
| 139 | synchronization/lock_impl_posix.cc |
| 140 | synchronization/waitable_event_posix.cc |
| 141 | sync_socket_posix.cc |
| 142 | sys_info.cc |
| 143 | sys_info_chromeos.cc |
| 144 | sys_info_linux.cc |
| 145 | sys_info_posix.cc |
| 146 | task_runner.cc |
| 147 | task/cancelable_task_tracker.cc |
Daniel Erat | 65f5398 | 2015-08-25 09:21:05 -0600 | [diff] [blame] | 148 | third_party/icu/icu_utf.cc |
| 149 | third_party/nspr/prtime.cc |
Daniel Erat | 65f5398 | 2015-08-25 09:21:05 -0600 | [diff] [blame] | 150 | threading/non_thread_safe_impl.cc |
| 151 | threading/platform_thread_internal_posix.cc |
| 152 | threading/platform_thread_linux.cc |
| 153 | threading/platform_thread_posix.cc |
| 154 | threading/post_task_and_reply_impl.cc |
| 155 | threading/sequenced_worker_pool.cc |
| 156 | threading/simple_thread.cc |
| 157 | threading/thread.cc |
| 158 | threading/thread_checker_impl.cc |
| 159 | threading/thread_collision_warner.cc |
| 160 | threading/thread_id_name_manager.cc |
| 161 | threading/thread_local_posix.cc |
| 162 | threading/thread_local_storage.cc |
| 163 | threading/thread_local_storage_posix.cc |
| 164 | threading/thread_restrictions.cc |
| 165 | threading/worker_pool.cc |
| 166 | threading/worker_pool_posix.cc |
| 167 | thread_task_runner_handle.cc |
| 168 | timer/elapsed_timer.cc |
| 169 | timer/timer.cc |
| 170 | time/clock.cc |
| 171 | time/default_clock.cc |
| 172 | time/default_tick_clock.cc |
| 173 | time/tick_clock.cc |
| 174 | time/time.cc |
| 175 | time/time_posix.cc |
Alex Vakulenko | 42b71bb | 2016-01-20 16:24:55 -0800 | [diff] [blame^] | 176 | trace_event/heap_profiler_allocation_context.cc
|
| 177 | trace_event/heap_profiler_allocation_context_tracker.cc
|
| 178 | trace_event/heap_profiler_stack_frame_deduplicator.cc
|
| 179 | trace_event/heap_profiler_type_name_deduplicator.cc
|
Daniel Erat | 65f5398 | 2015-08-25 09:21:05 -0600 | [diff] [blame] | 180 | trace_event/malloc_dump_provider.cc |
| 181 | trace_event/memory_allocator_dump.cc |
| 182 | trace_event/memory_allocator_dump_guid.cc |
| 183 | trace_event/memory_dump_manager.cc |
Alex Vakulenko | 42b71bb | 2016-01-20 16:24:55 -0800 | [diff] [blame^] | 184 | trace_event/memory_dump_request_args.cc |
Daniel Erat | 65f5398 | 2015-08-25 09:21:05 -0600 | [diff] [blame] | 185 | trace_event/memory_dump_session_state.cc |
| 186 | trace_event/process_memory_dump.cc |
| 187 | trace_event/process_memory_maps.cc |
| 188 | trace_event/process_memory_maps_dump_provider.cc |
| 189 | trace_event/process_memory_totals.cc |
| 190 | trace_event/process_memory_totals_dump_provider.cc |
Alex Vakulenko | 42b71bb | 2016-01-20 16:24:55 -0800 | [diff] [blame^] | 191 | trace_event/trace_buffer.cc |
Daniel Erat | 65f5398 | 2015-08-25 09:21:05 -0600 | [diff] [blame] | 192 | trace_event/trace_config.cc |
| 193 | trace_event/trace_event_argument.cc |
| 194 | trace_event/trace_event_impl.cc |
Daniel Erat | 65f5398 | 2015-08-25 09:21:05 -0600 | [diff] [blame] | 195 | trace_event/trace_event_memory_overhead.cc |
| 196 | trace_event/trace_event_synthetic_delay.cc |
Alex Vakulenko | 42b71bb | 2016-01-20 16:24:55 -0800 | [diff] [blame^] | 197 | trace_event/trace_log.cc
|
| 198 | trace_event/trace_log_constants.cc
|
| 199 | trace_event/trace_sampling_thread.cc
|
Daniel Erat | 65f5398 | 2015-08-25 09:21:05 -0600 | [diff] [blame] | 200 | tracked_objects.cc |
| 201 | tracking_info.cc |
| 202 | values.cc |
| 203 | vlog.cc |
| 204 | """, |
| 205 | 'prefix' : 'base', |
| 206 | 'libs' : 'pthread rt', |
| 207 | 'pc_libs' : 'glib-2.0 libevent', |
| 208 | }, |
| 209 | { |
| 210 | 'name' : 'dl', |
| 211 | 'sources' : """ |
| 212 | native_library_posix.cc |
| 213 | """, |
| 214 | 'prefix' : 'base', |
| 215 | 'libs' : 'dl', |
| 216 | 'pc_libs' : '', |
| 217 | }, |
| 218 | { |
| 219 | 'name' : 'dbus', |
| 220 | 'sources' : """ |
| 221 | bus.cc |
| 222 | dbus_statistics.cc |
| 223 | exported_object.cc |
| 224 | file_descriptor.cc |
| 225 | message.cc |
| 226 | object_manager.cc |
| 227 | object_path.cc |
| 228 | object_proxy.cc |
| 229 | property.cc |
| 230 | scoped_dbus_error.cc |
| 231 | string_util.cc |
| 232 | util.cc |
| 233 | values_util.cc |
| 234 | """, |
| 235 | 'prefix' : 'dbus', |
| 236 | 'libs' : '', |
| 237 | 'pc_libs' : 'dbus-1 protobuf-lite', |
| 238 | }, |
| 239 | { |
| 240 | 'name' : 'timers', |
| 241 | 'sources' : """ |
| 242 | alarm_timer_chromeos.cc |
| 243 | """, |
| 244 | 'prefix' : 'components/timers', |
| 245 | 'libs' : '', |
| 246 | 'pc_libs' : '', |
| 247 | }, |
| 248 | { |
| 249 | 'name' : 'crypto', |
| 250 | 'sources' : """ |
| 251 | hmac.cc |
| 252 | hmac_nss.cc |
| 253 | nss_key_util.cc |
| 254 | nss_util.cc |
| 255 | p224.cc |
| 256 | p224_spake.cc |
| 257 | random.cc |
| 258 | rsa_private_key.cc |
| 259 | rsa_private_key_nss.cc |
| 260 | scoped_test_nss_db.cc |
| 261 | secure_hash_default.cc |
| 262 | secure_util.cc |
| 263 | sha2.cc |
| 264 | signature_creator_nss.cc |
| 265 | signature_verifier_nss.cc |
| 266 | symmetric_key_nss.cc |
| 267 | third_party/nss/rsawrapr.c |
| 268 | third_party/nss/sha512.cc |
| 269 | """, |
| 270 | 'prefix' : 'crypto', |
| 271 | 'libs' : '%s-dl-%s' % (base_name, BASE_VER), |
| 272 | 'pc_libs' : 'nss', |
| 273 | }, |
| 274 | { |
| 275 | 'name' : 'sandbox', |
| 276 | 'sources' : """ |
| 277 | linux/bpf_dsl/bpf_dsl.cc |
| 278 | linux/bpf_dsl/codegen.cc |
| 279 | linux/bpf_dsl/dump_bpf.cc |
| 280 | linux/bpf_dsl/policy.cc |
| 281 | linux/bpf_dsl/policy_compiler.cc |
| 282 | linux/bpf_dsl/syscall_set.cc |
| 283 | linux/bpf_dsl/verifier.cc |
| 284 | linux/seccomp-bpf/die.cc |
| 285 | linux/seccomp-bpf/errorcode.cc |
| 286 | linux/seccomp-bpf/sandbox_bpf.cc |
| 287 | linux/seccomp-bpf/syscall.cc |
| 288 | linux/seccomp-bpf/trap.cc |
| 289 | |
| 290 | linux/seccomp-bpf-helpers/baseline_policy.cc |
| 291 | linux/seccomp-bpf-helpers/sigsys_handlers.cc |
| 292 | linux/seccomp-bpf-helpers/syscall_parameters_restrictions.cc |
| 293 | linux/seccomp-bpf-helpers/syscall_sets.cc |
| 294 | |
| 295 | linux/services/init_process_reaper.cc |
| 296 | linux/services/proc_util.cc |
| 297 | linux/services/resource_limits.cc |
| 298 | linux/services/scoped_process.cc |
| 299 | linux/services/syscall_wrappers.cc |
| 300 | linux/services/thread_helpers.cc |
| 301 | linux/services/yama.cc |
| 302 | linux/syscall_broker/broker_channel.cc |
| 303 | linux/syscall_broker/broker_client.cc |
| 304 | linux/syscall_broker/broker_file_permission.cc |
| 305 | linux/syscall_broker/broker_host.cc |
| 306 | linux/syscall_broker/broker_policy.cc |
| 307 | linux/syscall_broker/broker_process.cc |
| 308 | |
| 309 | linux/services/credentials.cc |
| 310 | linux/services/namespace_sandbox.cc |
| 311 | linux/services/namespace_utils.cc |
| 312 | """, |
| 313 | 'prefix' : 'sandbox', |
| 314 | 'libs' : '', |
| 315 | 'pc_libs' : '', |
| 316 | }, |
| 317 | ] |
| 318 | |
| 319 | env.Append( |
| 320 | CPPPATH=['files'], |
| 321 | CCFLAGS=['-g'] |
| 322 | ) |
| 323 | for key in Split('CC CXX AR RANLIB LD NM CFLAGS CXXFLAGS LDFLAGS'): |
| 324 | value = os.environ.get(key) |
| 325 | if value: |
| 326 | env[key] = Split(value) |
| 327 | if os.environ.has_key('CPPFLAGS'): |
| 328 | env['CCFLAGS'] += Split(os.environ['CPPFLAGS']) |
| 329 | |
| 330 | env['CCFLAGS'] += ['-DOS_CHROMEOS', |
| 331 | '-DUSE_NSS_CERTS', |
| 332 | '-DUSE_SYSTEM_LIBEVENT', |
| 333 | '-fPIC', |
| 334 | '-fno-exceptions', |
| 335 | '-Wall', |
| 336 | '-Werror', |
| 337 | '-Wno-deprecated-register', |
| 338 | '-Wno-narrowing', |
| 339 | '-Wno-psabi', |
| 340 | '-Wno-unused-local-typedefs', |
| 341 | # Various #defines are hardcoded near the top of |
| 342 | # build_config.h to ensure that they'll be set both when |
| 343 | # libchrome is built and when other packages include |
| 344 | # libchrome's headers. |
| 345 | '-I%s' % CHROME_INCLUDE_PATH] |
| 346 | |
| 347 | env.Append( |
| 348 | CXXFLAGS=['-std=c++11'] |
| 349 | ) |
| 350 | |
| 351 | # Flags for clang taken from build/common.gypi in the clang==1 section. |
| 352 | CLANG_FLAGS = ( |
| 353 | '-Wno-char-subscripts', |
| 354 | ) |
| 355 | |
| 356 | env['CCFLAGS'] += ['-Xclang-only=%s' % x for x in CLANG_FLAGS] |
| 357 | |
| 358 | # Fix issue with scons not passing some vars through the environment. |
| 359 | for key in Split('PKG_CONFIG SYSROOT'): |
| 360 | if os.environ.has_key(key): |
| 361 | env['ENV'][key] = os.environ[key] |
| 362 | |
| 363 | all_base_libs = [] |
| 364 | all_pc_libs = '' |
| 365 | all_libs = [] |
| 366 | all_scons_libs = [] |
| 367 | |
| 368 | # Build all the shared libraries. |
| 369 | for lib in base_libs: |
| 370 | pc_libs = lib['pc_libs'].replace('${bslot}', BASE_VER) |
| 371 | all_pc_libs += ' ' + pc_libs |
| 372 | |
| 373 | libs = Split(lib['libs'].replace('${bslot}', BASE_VER)) |
| 374 | all_libs += libs |
| 375 | |
| 376 | name = '%s-%s-%s' % (base_name, lib['name'], BASE_VER) |
| 377 | all_base_libs += [name] |
| 378 | corename = '%s-core-%s' % (base_name, BASE_VER) |
| 379 | # Automatically link the sub-libs against the main core lib. |
| 380 | # This is to keep from having to explicitly mention it in the |
| 381 | # table above (i.e. lazy). |
| 382 | if name != corename: |
| 383 | libs += [corename] |
| 384 | |
| 385 | e = env.Clone() |
| 386 | e.Append( |
| 387 | LIBS = Split(libs), |
| 388 | LIBPATH = ['.'], |
| 389 | LINKFLAGS = ['-Wl,--as-needed', '-Wl,-z,defs', |
| 390 | '-Wl,-soname,lib%s.so' % name], |
| 391 | ) |
| 392 | if pc_libs: |
| 393 | e.ParseConfig(PKG_CONFIG + ' --cflags --libs %s' % pc_libs) |
| 394 | |
| 395 | # Prepend prefix to source filenames. |
| 396 | sources = [os.path.join(lib['prefix'], x) for x in Split(lib['sources'])] |
| 397 | |
| 398 | all_scons_libs += [ e.SharedLibrary(name, sources) ] |
| 399 | |
| 400 | |
| 401 | # Build a static library of mocks for unittests to link against. |
| 402 | # Being static allows us to mask this library out of the image. |
| 403 | |
| 404 | all_base_test_libs = [] |
| 405 | all_test_pc_libs = '' |
| 406 | all_test_libs = [] |
| 407 | |
| 408 | test_libs = [ |
| 409 | { |
| 410 | 'name': 'base_test_support', |
| 411 | 'sources': """ |
| 412 | simple_test_clock.cc |
| 413 | simple_test_tick_clock.cc |
| 414 | test_file_util.cc |
| 415 | test_file_util_linux.cc |
| 416 | test_switches.cc |
| 417 | test_timeouts.cc |
| 418 | """, |
| 419 | 'prefix': 'base/test', |
| 420 | 'libs': '', |
| 421 | 'pc_libs': '', |
| 422 | }, |
| 423 | { |
| 424 | 'name': 'dbus_test_support', |
| 425 | 'sources': """ |
| 426 | mock_bus.cc |
| 427 | mock_exported_object.cc |
| 428 | mock_object_manager.cc |
| 429 | mock_object_proxy.cc |
| 430 | """, |
| 431 | 'prefix': 'dbus', |
| 432 | 'libs': '', # TODO(wiley) what should go here? |
| 433 | 'pc_libs': 'dbus-1 protobuf-lite', |
| 434 | }, |
| 435 | { |
| 436 | 'name': 'timer_test_support', |
| 437 | 'sources': """ |
| 438 | mock_timer.cc |
| 439 | """, |
| 440 | 'prefix': 'base/timer', |
| 441 | 'libs': '', |
| 442 | 'pc_libs': '', |
| 443 | }, |
| 444 | ] |
| 445 | |
| 446 | for lib in test_libs: |
| 447 | pc_libs = lib['pc_libs'].replace('${bslot}', BASE_VER) |
| 448 | all_test_pc_libs += ' ' + pc_libs |
| 449 | |
| 450 | libs = Split(lib['libs'].replace('${bslot}', BASE_VER)) |
| 451 | all_test_libs += libs |
| 452 | |
| 453 | name = '%s-%s-%s' % (base_name, lib['name'], BASE_VER) |
| 454 | all_base_test_libs += [name] |
| 455 | |
| 456 | static_env = env.Clone() |
| 457 | if pc_libs: |
| 458 | static_env.ParseConfig(PKG_CONFIG + ' --cflags --libs %s' % pc_libs) |
| 459 | sources = [os.path.join(lib['prefix'], x) |
| 460 | for x in Split(lib['sources'])] |
| 461 | static_env.StaticLibrary(name, sources) |
| 462 | |
| 463 | # Build the random text files (pkg-config and linker script). |
| 464 | |
| 465 | def lib_list(libs): |
| 466 | return ' '.join(['-l' + l for l in libs]) |
| 467 | |
| 468 | prod_subst_dict = { |
| 469 | '@BSLOT@': BASE_VER, |
| 470 | '@PRIVATE_PC@': all_pc_libs, |
| 471 | '@BASE_LIBS@': lib_list(all_base_libs), |
| 472 | '@LIBS@': lib_list(all_libs), |
| 473 | '@NAME@': 'libchrome', |
| 474 | '@PKG_CFG_NAME@': 'libchrome-%s.pc' % BASE_VER, |
| 475 | '@LIB_NAME@': 'libbase-%s.so' % BASE_VER, |
| 476 | '@DESCRIPTION@': 'chrome base library', |
| 477 | # scons, in its infinite wisdom sees fit to expand this string if |
| 478 | # if we don't escape the $. |
| 479 | '@TARGET_LIB@': 'base-$${bslot}', |
| 480 | } |
| 481 | |
| 482 | # Similarly, build text files related to the test libraries. |
| 483 | test_subst_dict = { |
| 484 | '@BSLOT@': BASE_VER, |
| 485 | '@PRIVATE_PC@': all_test_pc_libs, |
| 486 | '@BASE_LIBS@': lib_list(all_base_test_libs), |
| 487 | '@LIBS@': lib_list(all_test_libs), |
| 488 | '@NAME@': 'libchrome-test', |
| 489 | '@PKG_CFG_NAME@': 'libchrome-test-%s.pc' % BASE_VER, |
| 490 | '@LIB_NAME@': 'libbase-test-%s.a' % BASE_VER, |
| 491 | '@DESCRIPTION@': 'chrome base test library', |
| 492 | # scons, in its infinite wisdom sees fit to expand this string if |
| 493 | # if we don't escape the $. |
| 494 | '@TARGET_LIB@': 'base-test-$${bslot}', |
| 495 | } |
| 496 | |
| 497 | pc_file_contents = """ |
| 498 | prefix=/usr |
| 499 | includedir=${prefix}/include |
| 500 | bslot=@BSLOT@ |
| 501 | |
| 502 | Name: @NAME@ |
| 503 | Description: @DESCRIPTION@ |
| 504 | Version: ${bslot} |
| 505 | Requires: |
| 506 | Requires.private: @PRIVATE_PC@ |
| 507 | Libs: -l@TARGET_LIB@ |
| 508 | Libs.private: @BASE_LIBS@ @LIBS@ |
| 509 | Cflags: -I${includedir}/@TARGET_LIB@ -Wno-c++11-extensions -Wno-unused-local-typedefs -DBASE_VER=${bslot} |
| 510 | """ |
| 511 | |
| 512 | # https://sourceware.org/binutils/docs/ld/Scripts.html |
| 513 | so_file_contents = """GROUP ( AS_NEEDED ( @BASE_LIBS@ ) )""" |
| 514 | |
| 515 | for subst_dict in (test_subst_dict, prod_subst_dict): |
| 516 | env = Environment(tools=['textfile'], SUBST_DICT=subst_dict) |
| 517 | env.Substfile(subst_dict['@LIB_NAME@'], [Value(so_file_contents)]) |
| 518 | env.Substfile(subst_dict['@PKG_CFG_NAME@'], [Value(pc_file_contents)]) |