1# 2# Copyright (C) 2015 The Android Open Source Project 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{ 17 'target_defaults': { 18 'variables': { 19 'deps': [ 20 'libbrillo-<(libbase_ver)', 21 'libchrome-<(libbase_ver)', 22 ], 23 # The -DUSE_* flags are passed from platform2.py. We use sane defaults 24 # here when these USE flags are not defined. You can set the default value 25 # for the USE flag in the ebuild. 26 'USE_hwid_override%': '0', 27 }, 28 'cflags': [ 29 '-g', 30 '-ffunction-sections', 31 '-Wall', 32 '-Wextra', 33 '-Werror', 34 '-Wno-unused-parameter', 35 ], 36 'cflags_cc': [ 37 '-fno-strict-aliasing', 38 '-Wnon-virtual-dtor', 39 ], 40 'ldflags': [ 41 '-Wl,--gc-sections', 42 ], 43 'defines': [ 44 '__CHROMEOS__', 45 '_FILE_OFFSET_BITS=64', 46 '_POSIX_C_SOURCE=199309L', 47 'USE_BINDER=<(USE_binder)', 48 'USE_DBUS=<(USE_dbus)', 49 'USE_HWID_OVERRIDE=<(USE_hwid_override)', 50 'USE_LIBCROS=<(USE_libcros)', 51 'USE_MTD=<(USE_mtd)', 52 'USE_OMAHA=1', 53 'USE_SHILL=1', 54 ], 55 'include_dirs': [ 56 # We need this include dir because we include all the local code as 57 # "update_engine/...". 58 '<(platform2_root)/../aosp/system', 59 '<(platform2_root)/../aosp/system/update_engine/client_library/include', 60 ], 61 }, 62 'targets': [ 63 # Protobufs. 64 { 65 'target_name': 'update_metadata-protos', 66 'type': 'static_library', 67 'variables': { 68 'proto_in_dir': '.', 69 'proto_out_dir': 'include/update_engine', 70 'exported_deps': [ 71 'protobuf-lite', 72 ], 73 'deps': ['<@(exported_deps)'], 74 }, 75 'all_dependent_settings': { 76 'variables': { 77 'deps': [ 78 '<@(exported_deps)', 79 ], 80 }, 81 }, 82 'sources': [ 83 'update_metadata.proto' 84 ], 85 'includes': ['../../../platform2/common-mk/protoc.gypi'], 86 }, 87 # Chrome D-Bus bindings. 88 { 89 'target_name': 'update_engine-dbus-adaptor', 90 'type': 'none', 91 'variables': { 92 'dbus_adaptors_out_dir': 'include/dbus_bindings', 93 'dbus_xml_extension': 'dbus-xml', 94 }, 95 'sources': [ 96 'dbus_bindings/org.chromium.UpdateEngineInterface.dbus-xml', 97 ], 98 'includes': ['../../../platform2/common-mk/generate-dbus-adaptors.gypi'], 99 }, 100 { 101 'target_name': 'update_engine-other-dbus-proxies', 102 'type': 'none', 103 'actions': [ 104 { 105 'action_name': 'update_engine-dbus-libcros-client', 106 'variables': { 107 'mock_output_file': 'include/libcros/dbus-proxy-mocks.h', 108 'proxy_output_file': 'include/libcros/dbus-proxies.h' 109 }, 110 'sources': [ 111 'dbus_bindings/org.chromium.LibCrosService.dbus-xml', 112 ], 113 'includes': ['../../../platform2/common-mk/generate-dbus-proxies.gypi'], 114 }, 115 { 116 'action_name': 'update_engine-dbus-network_proxy-client', 117 'variables': { 118 'mock_output_file': 'include/network_proxy/dbus-proxy-mocks.h', 119 'proxy_output_file': 'include/network_proxy/dbus-proxies.h' 120 }, 121 'sources': [ 122 'dbus_bindings/org.chromium.NetworkProxyService.dbus-xml', 123 ], 124 'includes': ['../../../platform2/common-mk/generate-dbus-proxies.gypi'], 125 }, 126 ], 127 }, 128 # The payload application component and common dependencies. 129 { 130 'target_name': 'libpayload_consumer', 131 'type': 'static_library', 132 'dependencies': [ 133 'update_metadata-protos', 134 ], 135 #TODO(deymo): Remove unused dependencies once we stop including files 136 # from the root directory. 137 'variables': { 138 'exported_deps': [ 139 'libcrypto', 140 'xz-embedded', 141 ], 142 'deps': ['<@(exported_deps)'], 143 }, 144 'all_dependent_settings': { 145 'variables': { 146 'deps': [ 147 '<@(exported_deps)', 148 ], 149 }, 150 }, 151 'link_settings': { 152 'variables': { 153 'deps': [ 154 '<@(exported_deps)', 155 ], 156 }, 157 'libraries': [ 158 '-lbspatch', 159 '-lbz2', 160 '-lrt', 161 ], 162 }, 163 'sources': [ 164 'common/action_processor.cc', 165 'common/boot_control_stub.cc', 166 'common/clock.cc', 167 'common/constants.cc', 168 'common/cpu_limiter.cc', 169 'common/error_code_utils.cc', 170 'common/hash_calculator.cc', 171 'common/http_common.cc', 172 'common/http_fetcher.cc', 173 'common/hwid_override.cc', 174 'common/multi_range_http_fetcher.cc', 175 'common/platform_constants_chromeos.cc', 176 'common/prefs.cc', 177 'common/subprocess.cc', 178 'common/terminator.cc', 179 'common/utils.cc', 180 'payload_consumer/bzip_extent_writer.cc', 181 'payload_consumer/delta_performer.cc', 182 'payload_consumer/download_action.cc', 183 'payload_consumer/extent_writer.cc', 184 'payload_consumer/file_descriptor.cc', 185 'payload_consumer/file_writer.cc', 186 'payload_consumer/filesystem_verifier_action.cc', 187 'payload_consumer/install_plan.cc', 188 'payload_consumer/payload_constants.cc', 189 'payload_consumer/payload_verifier.cc', 190 'payload_consumer/postinstall_runner_action.cc', 191 'payload_consumer/xz_extent_writer.cc', 192 ], 193 'conditions': [ 194 ['USE_mtd == 1', { 195 'sources': [ 196 'payload_consumer/mtd_file_descriptor.cc', 197 ], 198 'link_settings': { 199 'libraries': [ 200 '-lmtdutils', 201 ], 202 }, 203 }], 204 ], 205 }, 206 # The main daemon static_library with all the code used to check for updates 207 # with Omaha and expose a DBus daemon. 208 { 209 'target_name': 'libupdate_engine', 210 'type': 'static_library', 211 'dependencies': [ 212 'libpayload_consumer', 213 'update_metadata-protos', 214 'update_engine-dbus-adaptor', 215 'update_engine-other-dbus-proxies', 216 ], 217 'variables': { 218 'exported_deps': [ 219 'dbus-1', 220 'expat', 221 'libcurl', 222 'libdebugd-client', 223 'libmetrics-<(libbase_ver)', 224 'libpower_manager-client', 225 'libsession_manager-client', 226 'libshill-client', 227 'libssl', 228 'libupdate_engine-client', 229 ], 230 'deps': ['<@(exported_deps)'], 231 }, 232 'all_dependent_settings': { 233 'variables': { 234 'deps': [ 235 '<@(exported_deps)', 236 ], 237 }, 238 }, 239 'link_settings': { 240 'variables': { 241 'deps': [ 242 '<@(exported_deps)', 243 ], 244 }, 245 'libraries': [ 246 '-lbz2', 247 '-lpolicy-<(libbase_ver)', 248 '-lrootdev', 249 '-lrt', 250 '-lvboot_host', 251 ], 252 }, 253 'sources': [ 254 'boot_control_chromeos.cc', 255 'certificate_checker.cc', 256 'common_service.cc', 257 'connection_manager.cc', 258 'connection_utils.cc', 259 'daemon.cc', 260 'dbus_connection.cc', 261 'dbus_service.cc', 262 'hardware_chromeos.cc', 263 'image_properties_chromeos.cc', 264 'libcurl_http_fetcher.cc', 265 'metrics.cc', 266 'metrics_utils.cc', 267 'omaha_request_action.cc', 268 'omaha_request_params.cc', 269 'omaha_response_handler_action.cc', 270 'omaha_utils.cc', 271 'p2p_manager.cc', 272 'payload_state.cc', 273 'power_manager_chromeos.cc', 274 'proxy_resolver.cc', 275 'real_system_state.cc', 276 'shill_proxy.cc', 277 'update_attempter.cc', 278 'update_manager/boxed_value.cc', 279 'update_manager/chromeos_policy.cc', 280 'update_manager/default_policy.cc', 281 'update_manager/evaluation_context.cc', 282 'update_manager/policy.cc', 283 'update_manager/real_config_provider.cc', 284 'update_manager/real_device_policy_provider.cc', 285 'update_manager/real_random_provider.cc', 286 'update_manager/real_shill_provider.cc', 287 'update_manager/real_system_provider.cc', 288 'update_manager/real_time_provider.cc', 289 'update_manager/real_updater_provider.cc', 290 'update_manager/state_factory.cc', 291 'update_manager/update_manager.cc', 292 'update_status_utils.cc', 293 ], 294 'conditions': [ 295 ['USE_libcros == 1', { 296 'dependencies': [ 297 'update_engine-other-dbus-proxies', 298 ], 299 'sources': [ 300 'chrome_browser_proxy_resolver.cc', 301 ], 302 }], 303 ], 304 }, 305 # update_engine daemon. 306 { 307 'target_name': 'update_engine', 308 'type': 'executable', 309 'dependencies': [ 310 'libupdate_engine', 311 ], 312 'sources': [ 313 'main.cc', 314 ], 315 }, 316 # update_engine client library. 317 { 318 'target_name': 'libupdate_engine_client', 319 'type': 'static_library', 320 'variables': { 321 'deps': [ 322 'dbus-1', 323 'libupdate_engine-client', 324 ], 325 }, 326 'sources': [ 327 'client_library/client.cc', 328 'client_library/client_dbus.cc', 329 'update_status_utils.cc', 330 ], 331 'include_dirs': [ 332 'client_library/include', 333 ], 334 }, 335 # update_engine console client. 336 { 337 'target_name': 'update_engine_client', 338 'type': 'executable', 339 'dependencies': [ 340 'libupdate_engine_client', 341 ], 342 'sources': [ 343 'common/error_code_utils.cc', 344 'omaha_utils.cc', 345 'update_engine_client.cc', 346 ], 347 }, 348 # server-side code. This is used for delta_generator and unittests but not 349 # for any client code. 350 { 351 'target_name': 'libpayload_generator', 352 'type': 'static_library', 353 'dependencies': [ 354 'libpayload_consumer', 355 'update_metadata-protos', 356 ], 357 'variables': { 358 'exported_deps': [ 359 'ext2fs', 360 ], 361 'deps': ['<@(exported_deps)'], 362 }, 363 'all_dependent_settings': { 364 'variables': { 365 'deps': [ 366 '<@(exported_deps)', 367 ], 368 }, 369 }, 370 'link_settings': { 371 'variables': { 372 'deps': [ 373 '<@(exported_deps)', 374 ], 375 }, 376 }, 377 'sources': [ 378 'payload_generator/ab_generator.cc', 379 'payload_generator/annotated_operation.cc', 380 'payload_generator/blob_file_writer.cc', 381 'payload_generator/block_mapping.cc', 382 'payload_generator/bzip.cc', 383 'payload_generator/cycle_breaker.cc', 384 'payload_generator/delta_diff_generator.cc', 385 'payload_generator/delta_diff_utils.cc', 386 'payload_generator/ext2_filesystem.cc', 387 'payload_generator/extent_ranges.cc', 388 'payload_generator/extent_utils.cc', 389 'payload_generator/full_update_generator.cc', 390 'payload_generator/graph_types.cc', 391 'payload_generator/graph_utils.cc', 392 'payload_generator/inplace_generator.cc', 393 'payload_generator/mapfile_filesystem.cc', 394 'payload_generator/payload_file.cc', 395 'payload_generator/payload_generation_config.cc', 396 'payload_generator/payload_signer.cc', 397 'payload_generator/raw_filesystem.cc', 398 'payload_generator/tarjan.cc', 399 'payload_generator/topological_sort.cc', 400 'payload_generator/xz_chromeos.cc', 401 ], 402 }, 403 # server-side delta generator. 404 { 405 'target_name': 'delta_generator', 406 'type': 'executable', 407 'dependencies': [ 408 'libpayload_consumer', 409 'libpayload_generator', 410 ], 411 'link_settings': { 412 'ldflags!': [ 413 '-pie', 414 ], 415 }, 416 'sources': [ 417 'payload_generator/generate_delta_main.cc', 418 ], 419 }, 420 ], 421 'conditions': [ 422 ['USE_test == 1', { 423 'targets': [ 424 # Public keys used for unit testing. 425 { 426 'target_name': 'update_engine-testkeys', 427 'type': 'none', 428 'variables': { 429 'openssl_pem_in_dir': '.', 430 'openssl_pem_out_dir': 'include/update_engine', 431 }, 432 'sources': [ 433 'unittest_key.pem', 434 'unittest_key2.pem', 435 ], 436 'includes': ['../../../platform2/common-mk/openssl_pem.gypi'], 437 }, 438 # Unpacks sample images used for testing. 439 { 440 'target_name': 'update_engine-test_images', 441 'type': 'none', 442 'variables': { 443 'image_out_dir': '.', 444 }, 445 'sources': [ 446 'sample_images/sample_images.tar.bz2', 447 ], 448 'includes': ['tar_bunzip2.gypi'], 449 }, 450 # Test HTTP Server. 451 { 452 'target_name': 'test_http_server', 453 'type': 'executable', 454 'sources': [ 455 'common/http_common.cc', 456 'test_http_server.cc', 457 ], 458 }, 459 # Test subprocess helper. 460 { 461 'target_name': 'test_subprocess', 462 'type': 'executable', 463 'sources': [ 464 'test_subprocess.cc', 465 ], 466 }, 467 # Main unittest file. 468 { 469 'target_name': 'update_engine_unittests', 470 'type': 'executable', 471 'includes': ['../../../platform2/common-mk/common_test.gypi'], 472 'variables': { 473 'deps': [ 474 'libbrillo-test-<(libbase_ver)', 475 'libchrome-test-<(libbase_ver)', 476 'libdebugd-client-test', 477 'libpower_manager-client-test', 478 'libsession_manager-client-test', 479 'libshill-client-test', 480 ], 481 }, 482 'dependencies': [ 483 'libupdate_engine', 484 'libpayload_generator', 485 ], 486 'includes': ['../../../platform2/common-mk/common_test.gypi'], 487 'sources': [ 488 'boot_control_chromeos_unittest.cc', 489 'certificate_checker_unittest.cc', 490 'common/action_pipe_unittest.cc', 491 'common/action_processor_unittest.cc', 492 'common/action_unittest.cc', 493 'common/cpu_limiter_unittest.cc', 494 'common/fake_prefs.cc', 495 'common/file_fetcher.cc', # Only required for tests. 496 'common/hash_calculator_unittest.cc', 497 'common/http_fetcher_unittest.cc', 498 'common/hwid_override_unittest.cc', 499 'common/mock_http_fetcher.cc', 500 'common/prefs_unittest.cc', 501 'common/subprocess_unittest.cc', 502 'common/terminator_unittest.cc', 503 'common/test_utils.cc', 504 'common/utils_unittest.cc', 505 'common_service_unittest.cc', 506 'connection_manager_unittest.cc', 507 'fake_shill_proxy.cc', 508 'fake_system_state.cc', 509 'hardware_chromeos_unittest.cc', 510 'image_properties_chromeos_unittest.cc', 511 'metrics_utils_unittest.cc', 512 'omaha_request_action_unittest.cc', 513 'omaha_request_params_unittest.cc', 514 'omaha_response_handler_action_unittest.cc', 515 'omaha_utils_unittest.cc', 516 'p2p_manager_unittest.cc', 517 'payload_consumer/bzip_extent_writer_unittest.cc', 518 'payload_consumer/delta_performer_integration_test.cc', 519 'payload_consumer/delta_performer_unittest.cc', 520 'payload_consumer/download_action_unittest.cc', 521 'payload_consumer/extent_writer_unittest.cc', 522 'payload_consumer/file_writer_unittest.cc', 523 'payload_consumer/filesystem_verifier_action_unittest.cc', 524 'payload_consumer/postinstall_runner_action_unittest.cc', 525 'payload_consumer/xz_extent_writer_unittest.cc', 526 'payload_generator/ab_generator_unittest.cc', 527 'payload_generator/blob_file_writer_unittest.cc', 528 'payload_generator/block_mapping_unittest.cc', 529 'payload_generator/cycle_breaker_unittest.cc', 530 'payload_generator/delta_diff_utils_unittest.cc', 531 'payload_generator/ext2_filesystem_unittest.cc', 532 'payload_generator/extent_ranges_unittest.cc', 533 'payload_generator/extent_utils_unittest.cc', 534 'payload_generator/fake_filesystem.cc', 535 'payload_generator/full_update_generator_unittest.cc', 536 'payload_generator/graph_utils_unittest.cc', 537 'payload_generator/inplace_generator_unittest.cc', 538 'payload_generator/mapfile_filesystem_unittest.cc', 539 'payload_generator/payload_file_unittest.cc', 540 'payload_generator/payload_generation_config_unittest.cc', 541 'payload_generator/payload_signer_unittest.cc', 542 'payload_generator/tarjan_unittest.cc', 543 'payload_generator/topological_sort_unittest.cc', 544 'payload_generator/zip_unittest.cc', 545 'payload_state_unittest.cc', 546 'proxy_resolver_unittest.cc', 547 'update_attempter_unittest.cc', 548 'update_manager/boxed_value_unittest.cc', 549 'update_manager/chromeos_policy_unittest.cc', 550 'update_manager/evaluation_context_unittest.cc', 551 'update_manager/generic_variables_unittest.cc', 552 'update_manager/prng_unittest.cc', 553 'update_manager/real_device_policy_provider_unittest.cc', 554 'update_manager/real_random_provider_unittest.cc', 555 'update_manager/real_shill_provider_unittest.cc', 556 'update_manager/real_system_provider_unittest.cc', 557 'update_manager/real_time_provider_unittest.cc', 558 'update_manager/real_updater_provider_unittest.cc', 559 'update_manager/umtest_utils.cc', 560 'update_manager/update_manager_unittest.cc', 561 'update_manager/variable_unittest.cc', 562 # Main entry point for runnning tests. 563 'testrunner.cc', 564 ], 565 'conditions': [ 566 ['USE_libcros == 1', { 567 'sources': [ 568 'chrome_browser_proxy_resolver_unittest.cc', 569 ], 570 }], 571 ], 572 }, 573 ], 574 }], 575 ], 576} 577