1 # Copyright 2014 The Chromium Authors
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
5 import("//build/config/chrome_build.gni")
6 import("//build/config/chromeos/ui_mode.gni")
7 import("//build/config/compiler/compiler.gni")
8 import("//build/config/compiler/pgo/pgo.gni")
9 import("//build/config/features.gni")
10 import("//build/config/locales.gni")
11 import("//build/config/python.gni")
12 import("//build/config/sanitizers/sanitizers.gni")
13 import("//build/config/ui.gni")
14 import("//build/config/win/console_app.gni")
15 import("//build/config/win/manifest.gni")
16 import("//build/private_code_test/private_code_test.gni")
17 import("//build/toolchain/toolchain.gni")
18 import("//chrome/browser/buildflags.gni")
19 import("//chrome/chrome_paks.gni")
20 import("//chrome/common/features.gni")
21 import("//chrome/process_version_rc_template.gni")
22 import("//components/nacl/features.gni")
23 import("//components/optimization_guide/features.gni")
24 import("//extensions/buildflags/buildflags.gni")
25 import("//media/media_options.gni")
26 import("//ppapi/buildflags/buildflags.gni")
27 import("//third_party/blink/public/public_features.gni")
28 import("//third_party/widevine/cdm/widevine.gni")
29 import("//tools/resources/generate_resource_allowlist.gni")
30 import("//tools/v8_context_snapshot/v8_context_snapshot.gni")
31 import("//ui/gl/features.gni")
32 import("//v8/gni/v8.gni")
35 import("//build/config/android/rules.gni")
36 } else if (is_linux || is_chromeos || is_tizen) {
37 import("//build/linux/extract_symbols.gni")
38 import("//build/linux/strip_binary.gni")
40 import("//build/apple/compile_entitlements.gni")
41 import("//build/apple/compile_plist.gni")
42 import("//build/apple/tweak_info_plist.gni")
43 import("//build/compiled_action.gni")
44 import("//build/config/apple/symbols.gni")
45 import("//build/config/mac/mac_sdk.gni")
46 import("//build/config/mac/rules.gni")
47 import("//build/util/branding.gni")
48 import("//chrome/browser/buildflags.gni")
49 import("//chrome/updater/branding.gni")
50 import("//chrome/version.gni")
51 import("//content/public/app/mac_helpers.gni")
52 import("//media/cdm/library_cdm/cdm_paths.gni")
53 import("//services/on_device_model/on_device_model.gni")
54 import("//third_party/icu/config.gni")
58 # Indicates whether keystone registration framework should be enabled (see
59 # action("keystone_registration_framework") below). There are some tests
60 # where we'd like for it to be disabled. (https://crbug.com/909080)
61 enable_keystone_registration_framework = true
63 # On macOS, `is_chrome_branded` builds that have been signed locally will not
64 # launch because certain entitlements are tied to the official Google code
65 # signing identity. If `include_branded_entitlements` is set to false, these
66 # entitlements will be skipped.
67 include_branded_entitlements = true
70 assert(!is_ios, "Chromium/iOS shouldn't use anything in //chrome")
72 if (is_win && enable_resource_allowlist_generation) {
73 _chrome_resource_allowlist = "$target_gen_dir/chrome_resource_allowlist.txt"
77 action("reorder_imports") {
78 script = "//build/win/reorder-imports.py"
80 # See comment in chrome_dll.gypi in the hardlink_to_output
81 # target for why this cannot be 'initial' like the DLL.
82 inputs = [ "$root_out_dir/initialexe/chrome.exe" ]
84 "$root_out_dir/chrome.exe",
85 "$root_out_dir/chrome.exe.pdb",
89 rebase_path("$root_out_dir/initialexe", root_build_dir),
91 rebase_path("$root_out_dir", root_build_dir),
95 deps = [ ":chrome_initial" ]
99 # This does not currently work. See crbug.com/1311822.
100 # This target exists above chrome and it's main components in the dependency
101 # tree as a central place to put assert_no_deps annotations. Since this depends
102 # on Chrome and the main DLLs it uses, it will transitively assert that those
103 # targets also have no deps on disallowed things.
104 group("assert_no_deps") {
108 deps += [ "//chrome/android:chrome_public_apk" ]
109 } else if (!is_tizen) {
110 deps += [ ":chrome" ]
114 deps += [ ":chrome_dll" ]
117 # This should not pull in installer strings. This is will bloat the binary
118 # for no reason and is easy to mess up. See the comment at the top of
119 # //chrome/installer/util/BUILD.gn.
120 assert_no_deps = [ "//chrome/installer/util:strings" ]
124 # Chrome should use Perfetto instead of libtrace. Vulkan depends on
125 # trace-engine, but there should be no dependencies on trace-provider.
126 "//third_party/fuchsia-sdk/sdk/pkg/trace",
127 "//third_party/fuchsia-sdk/sdk/pkg/trace-provider-so",
131 if (!is_android && !is_mac) {
133 public_deps = [ ":chrome_initial" ]
134 data_deps = [ ":chrome_initial" ]
136 # Do not add any more deps or data_deps to group("chrome").
137 # Because chrome_initial sets its output name to "chrome", running commands
138 # such as `ninja chrome` causes chrome_initial to be built instead. All
139 # deps and data_deps should be added to the chrome_initial target instead.
140 # Targets added here can only be built by explicitly using //chrome:chrome.
141 # Windows-only deps are OK because chrome_initial uses initialexe/chrome as
142 # the output name for that platform.
143 # See crbug.com/1146571.
145 public_deps += [ ":reorder_imports" ]
146 data_deps += [ ":reorder_imports" ]
150 template("_chrome_exe") {
151 if (invoker.collect_inputs_only) {
152 _type = "shared_library"
156 target(_type, target_name) {
157 configs -= [ "//build/config/compiler:thinlto_optimize_default" ]
158 configs += [ "//build/config/compiler:thinlto_optimize_max" ]
160 output_name = "initialexe/chrome"
162 output_name = "chrome"
165 # Because the sources list varies so significantly per-platform, generally
166 # each platform lists its own files rather than relying on filtering or
167 # removing unused files.
168 sources = [ "app/chrome_exe_resource.h" ]
172 "//build:chromeos_buildflags",
173 "//printing/buildflags",
175 data = [ "$root_out_dir/resources.pak" ]
178 if (is_chromeos_ash) {
180 "//components/variations/cros_evaluate_seed:evaluate_seed",
181 "//sandbox/linux:chrome_sandbox",
183 deps += [ "//components/exo/wayland:ui_controls_protocol_stub" ]
186 if (also_build_lacros_chrome_for_architecture != "") {
187 data_deps += [ "//chrome:chrome(//build/toolchain/cros:lacros_clang)" ]
193 "app/chrome_exe_main_win.cc",
194 "app/delay_load_failure_hook_win.cc",
195 "app/delay_load_failure_hook_win.h",
196 "app/main_dll_loader_win.cc",
197 "app/main_dll_loader_win.h",
198 "common/crash_keys.cc",
199 "common/crash_keys.h",
204 ":chrome_exe_version",
206 ":packed_resources_integrity",
207 ":visual_elements_resources",
209 "//build:branding_buildflags",
210 "//chrome/app:chrome_exe_main_exports",
211 "//chrome/app:exit_code_watcher",
212 "//chrome/app/version_assembly:chrome_exe_manifest",
213 "//chrome/browser:active_use_util",
214 "//chrome/browser:chrome_process_finder",
215 "//chrome/browser/policy:path_parser",
216 "//chrome/chrome_elf",
217 "//chrome/common:constants",
218 "//chrome/common/win:delay_load_failure_support",
219 "//chrome/install_static:install_static_util",
220 "//chrome/install_static:secondary_module",
221 "//chrome/installer/util:constants",
222 "//chrome/installer/util:did_run_support",
223 "//components/crash/core/app",
224 "//components/crash/core/app:run_as_crashpad_handler",
225 "//components/crash/core/common",
226 "//components/crash/win:chrome_wer",
227 "//components/flags_ui:switches",
228 "//content:sandbox_helper_win",
229 "//content/public/common:static_switches",
231 "//gpu/command_buffer/service",
234 "//sandbox/policy/mojom",
235 "//third_party/breakpad:breakpad_handler",
236 "//third_party/breakpad:breakpad_sender",
237 "//third_party/crashpad/crashpad/util",
241 "//chrome/app/version_assembly:version_assembly_manifest",
242 "//chrome/browser/web_applications/chrome_pwa_launcher",
243 "//chrome/chrome_proxy",
244 "//chrome/elevation_service",
245 "//chrome/notification_helper",
248 defines += [ "CHROME_EXE_MAIN" ]
250 if (win_console_app) {
251 defines += [ "WIN_CONSOLE_APP" ]
253 # Set /SUBSYSTEM:WINDOWS for chrome.exe itself, unless a console build
254 # has been requested.
255 configs -= [ "//build/config/win:console" ]
256 configs += [ "//build/config/win:windowed" ]
260 "//build/config/win:delayloads",
261 "//build/config/win:delayloads_not_for_child_dll",
264 if (current_cpu == "x86") {
265 # Set the initial stack size to 0.5MiB, instead of the 1.5MiB needed by
266 # Chrome's main thread. This saves significant memory on threads (like
267 # those in the Windows thread pool, and others) whose stack size we can
268 # only control through this setting. Because Chrome's main thread needs
269 # a minimum 1.5 MiB stack, the main thread (in 32-bit builds only) uses
270 # fibers to switch to a 1.5 MiB stack before running any other code.
271 ldflags = [ "/STACK:0x80000" ]
273 # Increase the initial stack size. The default is 1MB, this is 8MB.
274 ldflags = [ "/STACK:0x800000" ]
276 } else if (use_aura) {
277 # Non-Windows aura entrypoint.
278 sources += [ "app/chrome_exe_main_aura.cc" ]
281 if (is_linux || is_chromeos || is_fuchsia || is_tizen) {
283 "app/chrome_dll_resource.h",
284 "app/chrome_main.cc",
285 "app/chrome_main_delegate.cc",
286 "app/chrome_main_delegate.h",
290 # On Linux, link the dependencies (libraries) that make up actual
291 # Chromium functionality directly into the executable.
293 "//chrome/common:version_header",
295 # For the sampling profiler.
296 "//chrome/common/profiler",
298 # Needed to use the master_preferences functions
299 "//chrome/installer/util:with_no_strings",
300 "//content/public/app",
303 "//headless:headless_shell_lib",
306 public_deps = [ "//chrome/common:buildflags" ]
310 ":xdg_mime", # Needs to be public for installer to consume files.
313 data_deps += [ "//components/crash/core/app:chrome_crashpad_handler" ]
318 # On Chrome OS builds (for both ash-chrome and lacros-chrome), put
319 # priority to the library in the installed directory.
320 # This will avoid conflicting of exposed symbols.
321 if (is_chromeos_device) {
322 ldflags += [ "-L" + rebase_path(root_out_dir) ]
325 # On Chrome OS builds (for both ash-chrome and lacros-chrome), put
326 # a metadata.json file in root directory containing Chrome version.
328 deps += [ "//ui/gfx/linux:gbm" ]
329 data_deps += [ "//build:version_metadata" ]
332 # Chrome OS debug builds for arm need to pass --long-plt to the linker.
333 # See https://bugs.chromium.org/p/chromium/issues/detail?id=583532
334 if (is_chromeos_ash && is_debug && target_cpu == "arm") {
335 ldflags += [ "-Wl,--long-plt" ]
338 if ((is_linux || is_chromeos_lacros) && !is_component_build &&
340 version_script = "//build/linux/chrome.map"
341 inputs = [ version_script ]
342 ldflags += [ "-Wl,--version-script=" +
343 rebase_path(version_script, root_build_dir) ]
346 if (is_chromeos_ash) {
347 public_deps += [ "//ui/lottie" ]
350 if (is_chromeos_lacros) {
352 "//chromeos/crosapi/cpp:crosapi_constants",
353 "//chromeos/crosapi/mojom",
354 "//chromeos/lacros:lacros_paths",
355 "//chromeos/startup",
361 if (is_chromeos_ash || is_win) {
362 data_deps += [ "//mojo/core:shared_library" ]
365 if (is_chromeos_ash) {
366 data_deps += [ "//mojo/core:shared_libraries_for_arc" ]
369 # These files are used by the installer so we need a public dep.
370 public_deps += [ ":packed_resources" ]
372 # The step's output are needed at runtime, so we also need a data_dep.
373 data_deps += [ ":packed_resources" ]
375 # ChromeOS by design is safe to have rpath=$ORIGIN. This simplifies shared
377 if (is_chromeos_ash && !is_component_build) {
378 configs += [ "//build/config/gcc:rpath_for_built_shared_libraries" ]
381 if (is_chromeos_lacros && is_chromeos_device) {
382 configs += [ "//build/lacros:optional_shared_libgcc" ]
386 "//chrome/browser/resources/media/mei_preload:component",
387 "//third_party/widevine/cdm",
389 if (invoker.collect_inputs_only) {
390 output_name = target_name
392 ldflags += [ "--collect-inputs-only" ]
395 if (is_linux || is_tizen) {
397 "app/chrome_main_linux.cc",
398 "app/chrome_main_linux.h",
403 _chrome_exe("chrome_initial") {
404 collect_inputs_only = false
406 if (current_toolchain == default_toolchain && is_linux) {
407 _chrome_exe("chrome_inputs") {
408 collect_inputs_only = true
410 private_code_test("chrome_private_code_test") {
411 linker_inputs_dep = ":chrome_inputs"
414 } # !is_android && !is_mac
417 shared_library("chrome_dll") {
418 configs += [ "//build/config/compiler:wexit_time_destructors" ]
419 configs -= [ "//build/config/compiler:thinlto_optimize_default" ]
420 configs += [ "//build/config/compiler:thinlto_optimize_max" ]
425 "//base/win/dllmain.cc",
426 "app/chrome_main.cc",
427 "app/chrome_main_delegate.cc",
428 "app/chrome_main_delegate.h",
431 output_name = "chrome"
434 ":chrome_dll_manifest",
435 ":chrome_dll_version",
437 "//chrome/app:chrome_dll_resources",
438 "//chrome/app:command_ids",
439 "//chrome/app/theme:chrome_unscaled_resources",
440 "//chrome/chrome_elf",
441 "//chrome/common:buildflags",
442 "//chrome/common:version_header",
443 "//chrome/common/profiler",
444 "//chrome/install_static:install_static_util",
445 "//chrome/install_static:secondary_module",
446 "//components/crash/core/app",
447 "//components/memory_system",
448 "//components/policy:generated",
449 "//content/public/app",
451 "//headless:headless_non_renderer",
452 "//headless:headless_shell_browser_lib",
453 "//net:net_resources",
454 "//ppapi/buildflags",
455 "//sandbox/win:sandbox",
456 "//third_party/cld_3/src/src:cld_3",
461 configs += [ "//build/config/win:delayloads" ]
464 deps += [ "//ui/compositor" ]
468 copy("copy_first_run") {
469 sources = [ "app/FirstRun" ]
470 outputs = [ "$root_out_dir/First Run" ]
473 chrome_helper_name = chrome_product_full_name + " Helper"
474 chrome_framework_name = chrome_product_full_name + " Framework"
475 chrome_framework_version = chrome_version_full
477 verify_dynamic_libraries = !is_component_build && !is_asan
478 if (host_os == "mac") {
479 objdump_path = mac_bin_path
481 objdump_path = rebase_path("$clang_base_path/bin/", root_build_dir)
485 deps = [ ":chrome_app" ]
487 data_deps = [ ":chrome_app" ]
489 if (verify_dynamic_libraries) {
490 deps += [ ":verify_libraries_chrome_app" ]
493 if (is_chrome_branded && is_official_build) {
495 ":chrome_dsym_archive",
501 tweak_info_plist("chrome_app_plist") {
502 info_plist = "app/app-Info.plist"
506 "--bundle_id=$chrome_mac_bundle_id",
508 if (enable_updater) {
509 args += [ "--privileged_helper_id=$privileged_helper_name" ]
510 if (is_chrome_branded) {
511 args += [ "--keystone=1" ]
512 if (current_cpu == "arm64") {
513 args += [ "--keystone-base-tag=arm64" ]
516 args += [ "--keystone=0" ]
519 args += [ "--keystone=0" ]
523 mac_app_bundle("chrome_app") {
524 output_name = chrome_product_full_name
526 info_plist_target = ":chrome_app_plist"
527 extra_substitutions = [
528 "CHROMIUM_BUNDLE_ID=$chrome_mac_bundle_id",
529 "CHROMIUM_SHORT_NAME=$chrome_product_short_name",
530 "CHROMIUM_CREATOR=$chrome_mac_creator_code",
533 sources = [ "app/chrome_exe_main_mac.cc" ]
535 configs += [ "//build/config/compiler:wexit_time_destructors" ]
538 ":chrome_app_strings_bundle_data",
540 ":chrome_versioned_bundle_data",
541 "//base/allocator:early_zone_registration_apple",
542 "//build:branding_buildflags",
543 "//chrome/common:buildflags",
544 "//chrome/common:version_header",
547 if (enable_updater) {
548 deps += [ ":chromium_updater_privileged_helper" ]
551 if (enable_stripping) {
552 # At link time, preserve the global symbols specified in the .exports
553 # file. All other global symbols will be marked as private. The default
554 # //build/config/apple:strip_all config will then remove the remaining
555 # local and debug symbols.
556 ldflags = [ "-Wl,-exported_symbols_list," +
557 rebase_path("app/app.exports", root_build_dir) ]
560 if (is_component_build) {
561 # In a component build, the framework is directly linked to the
562 # executable because dlopen() and loading all the dependent dylibs
563 # is time-consuming, see https://crbug.com/1197495.
564 deps += [ ":chrome_framework+link" ]
565 ldflags = [ "-Wl,-rpath,@executable_path/../Frameworks" ]
567 # The Framework is packaged inside the .app bundle. But when using the
568 # component build, all the dependent shared libraries of :chrome_dll are
569 # not packaged within the framework. This data_deps line makes all of
570 # those dependent libraries runtime dependencies of the .app bundle.
571 # This is a bit of a hack, since GN deliberately terminates its search
572 # for runtime_deps at create_bundle nodes (https://crbug.com/1010347).
573 data_deps = [ ":chrome_framework" ]
577 if (verify_dynamic_libraries) {
578 action("verify_libraries_chrome_app") {
579 script = "//chrome/tools/build/mac/verify_dynamic_libraries.py"
580 inputs = [ "${root_out_dir}/${chrome_product_full_name}.app/Contents/MacOS/${chrome_product_full_name}" ]
581 outputs = [ "$target_out_dir/run_$target_name.stamp" ]
584 rebase_path(outputs[0], root_out_dir),
588 rebase_path(inputs[0], root_out_dir),
590 "/usr/lib/libSystem.B.dylib",
592 deps = [ ":chrome_app" ]
596 compiled_action("chrome_app_strings") {
597 tool = "//chrome/tools/build/mac:infoplist_strings_util"
603 foreach(locale, platform_pak_locales) {
604 _strings_file = "${branding_path_product}_strings"
606 inputs += [ "$root_gen_dir/chrome/${_strings_file}_${locale}.pak" ]
609 foreach(locale, locales_as_apple_outputs) {
611 "$target_gen_dir/app_infoplist_strings/$locale.lproj/InfoPlist.strings",
618 "${branding_path_product}_strings",
622 rebase_path("$root_gen_dir/chrome", root_build_dir),
624 rebase_path("$target_gen_dir/app_infoplist_strings", root_build_dir),
627 ] + platform_pak_locales
629 deps = [ "//chrome/app:branded_strings" ]
632 foreach(locale, locales_as_apple_outputs) {
633 bundle_data("chrome_app_strings_${locale}_bundle_data") {
635 "$target_gen_dir/app_infoplist_strings/$locale.lproj/InfoPlist.strings",
638 [ "{{bundle_resources_dir}}/$locale.lproj/{{source_file_part}}" ]
639 public_deps = [ ":chrome_app_strings" ]
642 group("chrome_app_strings_bundle_data") {
644 foreach(locale, locales_as_apple_outputs) {
645 public_deps += [ ":chrome_app_strings_${locale}_bundle_data" ]
649 bundle_data("chrome_app_icon") {
650 sources = [ "app/theme/$branding_path_component/mac/app.icns" ]
651 outputs = [ "{{bundle_resources_dir}}/{{source_file_part}}" ]
654 bundle_data("chrome_resources") {
656 "$root_out_dir/$chrome_mac_bundle_id.manifest",
657 "app/theme/$branding_path_component/mac/document.icns",
658 "browser/ui/cocoa/applescript/scripting.sdef",
660 outputs = [ "{{bundle_resources_dir}}/{{source_file_part}}" ]
663 ":chrome_app_strings",
664 "//components/policy:chrome_manifest_bundle",
668 bundle_data("chrome_versioned_bundle_data") {
669 sources = [ "$root_out_dir/$chrome_framework_name.framework" ]
670 outputs = [ "{{bundle_contents_dir}}/Frameworks/{{source_file_part}}" ]
672 # Before bundling the versioned app components, delete any existing
674 ":clean_up_old_versions",
676 # verify_chrome_framework_order depends on :chrome_framework and, for
677 # non-component builds, will ensure the export symbol table is correct.
678 ":verify_chrome_framework_order",
681 if (enable_widevine_cdm_host_verification) {
682 # The :chrome_framework_widevine_signature target copies into the
683 # :chrome_framework bundle. But because the signing file depends on the
684 # framework itself, that would cause a cyclical dependency. Instead,
685 # this dependency directly copies the file into the framework's
686 # resources directory.
687 public_deps += [ ":chrome_framework_widevine_signature" ]
691 if (enable_updater) {
692 bundle_data("chromium_updater_privileged_helper") {
693 sources = [ "$root_out_dir/$privileged_helper_name" ]
695 "{{bundle_contents_dir}}/Library/LaunchServices/{{source_file_part}}",
698 public_deps = [ "//chrome/updater/mac:privileged_helper" ]
702 action("clean_up_old_versions") {
703 script = "//chrome/tools/build/mac/clean_up_old_versions.py"
705 _stamp_file = "$root_gen_dir/run_$target_name.stamp"
707 outputs = [ _stamp_file ]
709 _versions_dir = "$root_out_dir/$chrome_product_full_name.app/Contents/Frameworks/$chrome_framework_name.framework/Versions"
713 rebase_path(_versions_dir, root_build_dir),
715 rebase_path(_stamp_file, root_build_dir),
723 tweak_info_plist("chrome_helper_plist") {
724 info_plist = "app/helper-Info.plist"
732 compile_entitlements("entitlements") {
733 entitlements_templates = [ "app/app-entitlements.plist" ]
734 if (is_chrome_branded && include_branded_entitlements) {
735 # These entitlements are bound to the official Google Chrome signing
736 # certificate and will not necessarily work in any other build.
737 entitlements_templates += [ "app/app-entitlements-chrome.plist" ]
739 output_name = "$target_gen_dir/app-entitlements.plist"
741 "CHROMIUM_BUNDLE_ID=$chrome_mac_bundle_id",
742 "CHROMIUM_TEAM_ID=$chrome_mac_team_id",
744 visibility = [ "//chrome/installer/mac:copies" ]
747 template("chrome_helper_app") {
748 mac_app_bundle(target_name) {
749 assert(defined(invoker.helper_name_suffix))
750 assert(defined(invoker.helper_bundle_id_suffix))
752 output_name = chrome_helper_name + invoker.helper_name_suffix
754 if (defined(invoker.info_plist_target)) {
755 info_plist_target = invoker.info_plist_target
757 info_plist_target = ":chrome_helper_plist"
760 extra_substitutions = [
761 "CHROMIUM_BUNDLE_ID=$chrome_mac_bundle_id",
762 "CHROMIUM_SHORT_NAME=$chrome_product_short_name",
763 "CHROMIUM_HELPER_SUFFIX=${invoker.helper_name_suffix}",
764 "CHROMIUM_HELPER_BUNDLE_ID_SUFFIX=${invoker.helper_bundle_id_suffix}",
767 sources = [ "app/chrome_exe_main_mac.cc" ]
769 configs += [ "//build/config/compiler:wexit_time_destructors" ]
771 defines = [ "HELPER_EXECUTABLE" ]
774 "//base/allocator:early_zone_registration_apple",
775 "//build:branding_buildflags",
776 "//chrome/common:version_header",
777 "//sandbox/mac:seatbelt",
780 if (defined(invoker.deps)) {
786 if (is_component_build) {
787 # In a component build, the framework is directly linked to the
788 # executable because dlopen() and loading all the dependent dylibs
789 # is time-consuming, see https://crbug.com/1197495.
790 deps += [ ":chrome_framework+link_nested" ]
793 # The helper is in Chromium.app/Contents/Frameworks/Chromium Framework.framework/Versions/X/Helpers/Chromium Helper.app/Contents/MacOS
794 # so set rpath up to the base.
795 "-Wl,-rpath,@loader_path/../../../../../../../../../..",
797 # ... and up to Contents/Frameworks.
798 "-Wl,-rpath,@executable_path/../../../../../../..",
802 if (enable_stripping) {
803 # At link time, preserve the global symbols specified in the .exports
804 # file. All other global symbols will be marked as private. The default
805 # //build/config/apple:strip_all config will then remove the remaining
806 # local and debug symbols.
807 ldflags += [ "-Wl,-exported_symbols_list," +
808 rebase_path("app/app.exports", root_build_dir) ]
813 # The following *_helper_params are added to the ones provided by //content
814 # listed in content_mac_helpers (see //content/public/app/mac_helpers.gni).
815 # These allow //chrome to add custom helper apps in addition to the ones
816 # provided by //content. The params here have the same form as the content
817 # helpers and are defined as a tuple of these elements:
818 # target name - A short name to be used when defining the target for that
820 # bundle ID suffix - A string fragment to append to the CFBundleIdentifier of
822 # app name suffix - A string fragment to append to the outer bundle name as
823 # well as the inner executable. This should be reflected in
824 # the target's output_name.
826 # Helper app to display alert notifications. This is necessary as an app can
827 # only display either banner or alert style notifications and the main app
828 # will display banners.
829 alert_helper_params = [
835 # Merge all helper apps needed by //content and //chrome.
836 chrome_mac_helpers = content_mac_helpers + [ alert_helper_params ]
838 # Create all helper apps required by //content.
839 foreach(helper_params, content_mac_helpers) {
840 chrome_helper_app("chrome_helper_app_${helper_params[0]}") {
841 helper_name_suffix = helper_params[2]
842 helper_bundle_id_suffix = helper_params[1]
846 # Create app for the alert helper manually here as we want to modify the plist
847 # to set the alert style and add the app icon to its resources.
848 tweak_info_plist("chrome_helper_app_alerts_plist") {
849 deps = [ ":chrome_helper_plist" ]
850 info_plists = get_target_outputs(":chrome_helper_plist") +
851 [ "app/helper-alerts-Info.plist" ]
854 # Create and bundle an InfoPlist.strings for the alert helper app.
855 # TODO(crbug.com/1182393): Disambiguate and localize alert helper app name.
856 compile_plist("chrome_helper_app_alerts_plist_strings") {
858 plist_templates = [ "app/helper-alerts-InfoPlist.strings" ]
859 substitutions = [ "CHROMIUM_FULL_NAME=$chrome_product_full_name" ]
860 output_name = "$target_gen_dir/helper_alerts_infoplist_strings/base.lproj/InfoPlist.strings"
862 bundle_data("chrome_helper_app_alerts_resources") {
863 sources = get_target_outputs(":chrome_helper_app_alerts_plist_strings")
864 outputs = [ "{{bundle_resources_dir}}/base.lproj/{{source_file_part}}" ]
865 public_deps = [ ":chrome_helper_app_alerts_plist_strings" ]
868 chrome_helper_app("chrome_helper_app_${alert_helper_params[0]}") {
869 helper_name_suffix = alert_helper_params[2]
870 helper_bundle_id_suffix = alert_helper_params[1]
871 info_plist_target = ":chrome_helper_app_alerts_plist"
874 ":chrome_helper_app_alerts_resources",
878 if (verify_dynamic_libraries) {
879 foreach(helper_params, chrome_mac_helpers) {
880 _helper_target = helper_params[0]
881 _helper_bundle_id = helper_params[1]
882 _helper_suffix = helper_params[2]
884 action("verify_libraries_chrome_helper_app_${_helper_target}") {
885 script = "//chrome/tools/build/mac/verify_dynamic_libraries.py"
886 inputs = [ "${root_out_dir}/${chrome_helper_name}${_helper_suffix}.app/Contents/MacOS/${chrome_helper_name}${_helper_suffix}" ]
887 outputs = [ "$target_out_dir/run_$target_name.stamp" ]
890 rebase_path(outputs[0], root_out_dir),
894 rebase_path(inputs[0], root_out_dir),
896 # Do not --allow more libraries here without consulting with the
897 # security team (security-dev@chromium.org).
899 "/usr/lib/libsandbox.1.dylib",
901 "/usr/lib/libSystem.B.dylib",
903 deps = [ ":chrome_helper_app_${_helper_target}" ]
908 bundle_data("chrome_framework_helpers") {
910 "$root_out_dir/app_mode_loader",
911 "$root_out_dir/chrome_crashpad_handler",
914 outputs = [ "{{bundle_contents_dir}}/Helpers/{{source_file_part}}" ]
917 "//chrome/app_shim:app_mode_loader",
918 "//components/crash/core/app:chrome_crashpad_handler",
921 foreach(helper_params, chrome_mac_helpers) {
923 [ "$root_out_dir/${chrome_helper_name}${helper_params[2]}.app" ]
924 public_deps += [ ":chrome_helper_app_${helper_params[0]}" ]
925 if (verify_dynamic_libraries) {
927 [ ":verify_libraries_chrome_helper_app_${helper_params[0]}" ]
931 if (enable_updater) {
932 if (is_chrome_branded) {
933 sources += [ "//third_party/updater/chrome_mac_universal_prod/${updater_product_full_name}.app" ]
935 sources += [ "$root_out_dir/${updater_product_full_name}.app" ]
938 "//chrome/updater/mac:browser_install_script",
939 "//chrome/updater/mac:updater_bundle",
940 "//chrome/updater/mac:updater_install_script",
946 bundle_data("chrome_framework_resources") {
948 "//ui/gl/resources/angle-metal/gpu_shader_cache.bin",
950 # This image is used to badge the lock icon in the
951 # authentication dialogs, such as those used for installation
952 # from disk image and Keystone promotion (if so enabled). It
953 # needs to exist as a file on disk and not just something in a
954 # resource bundle because that's the interface that
955 # Authorization Services uses. Also, Authorization Services
956 # can't deal with .icns files.
957 "app/theme/default_100_percent/$branding_path_component/product_logo_32.png",
958 "browser/mac/install.sh",
961 outputs = [ "{{bundle_resources_dir}}/{{source_file_part}}" ]
965 "//chrome/app_shim:app_mode_loader_plist_bundle_data",
968 if (is_chrome_branded) {
970 "browser/mac/keystone_promote_postflight.sh",
971 "browser/mac/keystone_promote_preflight.sh",
975 if (icu_use_data_file) {
976 sources += [ "$root_out_dir/icudtl.dat" ]
977 public_deps += [ "//third_party/icu:icudata" ]
980 if (v8_use_external_startup_data) {
981 public_deps += [ "//v8" ]
982 if (use_v8_context_snapshot) {
983 sources += [ "$root_out_dir/$v8_context_snapshot_filename" ]
984 public_deps += [ "//tools/v8_context_snapshot" ]
986 sources += [ "$root_out_dir/snapshot_blob.bin" ]
992 bundle_data("chrome_framework_plugins") {
995 [ "{{bundle_contents_dir}}/Internet Plug-Ins/{{source_file_part}}" ]
999 if (current_cpu == "x86") {
1000 sources += [ "$root_out_dir/nacl_irt_x86_32.nexe" ]
1001 } else if (current_cpu == "x64") {
1002 sources += [ "$root_out_dir/nacl_irt_x86_64.nexe" ]
1004 public_deps += [ "//ppapi/native_client:irt" ]
1008 group("chrome_framework_plugins") {
1012 # EGL on MacOS ships with official chrome
1013 bundle_egl_libraries = use_egl
1015 if (bundle_egl_libraries) {
1016 # Add the ANGLE .dylibs in the MODULE_DIR of Chromium.app
1017 bundle_data("angle_binaries") {
1019 "$root_out_dir/egl_intermediates/libEGL.dylib",
1020 "$root_out_dir/egl_intermediates/libGLESv2.dylib",
1022 outputs = [ "{{bundle_contents_dir}}/Libraries/{{source_file_part}}" ]
1023 public_deps = [ "//ui/gl:angle_library_copy" ]
1026 # Add the SwiftShader .dylibs in the MODULE_DIR of Chromium.app
1027 bundle_data("swiftshader_binaries") {
1029 "$root_out_dir/vk_intermediates/libvk_swiftshader.dylib",
1030 "$root_out_dir/vk_intermediates/vk_swiftshader_icd.json",
1032 outputs = [ "{{bundle_contents_dir}}/Libraries/{{source_file_part}}" ]
1033 public_deps = [ "//ui/gl:swiftshader_vk_library_copy" ]
1037 if (enable_ml_internal) {
1038 bundle_data("chrome_ml_library") {
1039 sources = [ "$root_out_dir/libchrome_ml.dylib" ]
1040 outputs = [ "{{bundle_contents_dir}}/Libraries/{{source_file_part}}" ]
1041 public_deps = [ "//third_party/ml:chrome_ml_library_copy" ]
1045 group("angle_library") {
1046 if (bundle_egl_libraries) {
1047 deps = [ ":angle_binaries" ]
1051 group("swiftshader_library") {
1052 if (bundle_egl_libraries) {
1053 deps = [ ":swiftshader_binaries" ]
1057 if (bundle_widevine_cdm) {
1058 bundle_data("widevine_cdm_library_binaries") {
1059 sources = [ "$root_out_dir/$widevine_cdm_path/libwidevinecdm.dylib" ]
1060 if (enable_widevine_cdm_host_verification) {
1062 [ "$root_out_dir/$widevine_cdm_path/libwidevinecdm.dylib.sig" ]
1064 outputs = [ "{{bundle_contents_dir}}/Libraries/$widevine_cdm_path/{{source_file_part}}" ]
1065 public_deps = [ "//third_party/widevine/cdm" ]
1068 bundle_data("widevine_cdm_library_manifest_and_license_files") {
1070 "$root_out_dir/WidevineCdm/LICENSE",
1071 "$root_out_dir/WidevineCdm/manifest.json",
1074 "{{bundle_contents_dir}}/Libraries/WidevineCdm/{{source_file_part}}",
1076 public_deps = [ "//third_party/widevine/cdm" ]
1080 group("widevine_cdm_library") {
1081 if (bundle_widevine_cdm) {
1083 ":widevine_cdm_library_binaries",
1084 ":widevine_cdm_library_manifest_and_license_files",
1089 if (enable_widevine_cdm_host_verification) {
1090 widevine_sign_file("sign_chrome_framework_for_widevine") {
1091 file = "$root_out_dir/$chrome_framework_name.framework/Versions/$chrome_framework_version/$chrome_framework_name"
1093 signature_file = "$root_out_dir/$chrome_framework_name.sig"
1094 deps = [ ":chrome_framework" ]
1097 copy("chrome_framework_widevine_signature") {
1098 deps = [ ":sign_chrome_framework_for_widevine" ]
1100 sources = [ "$root_out_dir/$chrome_framework_name.sig" ]
1102 outputs = [ "$root_out_dir/$chrome_framework_name.framework/Resources/{{source_file_part}}" ]
1106 if (is_chrome_branded && enable_keystone_registration_framework) {
1107 bundle_data("keystone_registration_framework") {
1108 sources = [ "//third_party/googlemac/Releases/Keystone/KeystoneRegistration.framework" ]
1110 outputs = [ "{{bundle_contents_dir}}/Frameworks/{{source_file_part}}" ]
1113 group("keystone_registration_framework") {
1117 if (build_with_internal_optimization_guide) {
1118 # Add the optimization guide .dylib in the MODULE_DIR of Chromium.app
1119 bundle_data("optimization_guide_library") {
1121 "$root_out_dir/og_intermediates/liboptimization_guide_internal.dylib",
1123 outputs = [ "{{bundle_contents_dir}}/Libraries/{{source_file_part}}" ]
1124 public_deps = [ "//components/optimization_guide/core:optimization_guide_internal_library_copy" ]
1127 group("optimization_guide_library") {
1131 tweak_info_plist("chrome_framework_plist") {
1132 info_plist = "app/framework-Info.plist"
1138 chrome_product_short_name,
1142 # Limit the exported symbols of the framework library.
1143 config("chrome_dll_symbol_exports") {
1144 inputs = [ rebase_path("app/framework.exports") ]
1146 "-Wl,-exported_symbols_list",
1147 "-Wl," + rebase_path("app/framework.exports", root_build_dir),
1151 # Control the order of exported symbols in the framework library.
1152 config("chrome_dll_symbol_order") {
1153 inputs = [ rebase_path("app/framework.order") ]
1156 "-Wl," + rebase_path("app/framework.order", root_build_dir),
1160 # On Mac, speed up the component build by not re-bundling the framework
1161 # every time it changes. Instead, place all the sources and their deps in
1162 # a library that the bundled framework links (and re-exports). That way
1163 # only the library needs to be re-linked when it changes.
1164 if (is_component_build) {
1165 _dll_target_type = "shared_library"
1167 _dll_target_type = "source_set"
1169 target(_dll_target_type, "chrome_dll") {
1171 ":chrome_framework",
1172 ":chrome_framework_create_bundle",
1173 ":chrome_framework_shared_library",
1177 "app/chrome_crash_reporter_client.cc",
1178 "app/chrome_crash_reporter_client.h",
1179 "app/chrome_crash_reporter_client_mac.mm",
1180 "app/chrome_dll_resource.h",
1181 "app/chrome_main.cc",
1182 "app/chrome_main_delegate.cc",
1183 "app/chrome_main_delegate.h",
1184 "app/chrome_main_mac.h",
1185 "app/chrome_main_mac.mm",
1190 "//build:chromeos_buildflags",
1191 "//chrome/app:command_ids",
1192 "//chrome/app:notification_metrics",
1193 "//chrome/common:buildflags",
1194 "//chrome/common:version_header",
1195 "//chrome/common/profiler",
1196 "//components/crash/core/app",
1197 "//components/memory_system",
1198 "//components/policy:generated",
1199 "//content/public/app",
1200 "//headless:headless_shell_lib",
1201 "//third_party/cld_3/src/src:cld_3",
1204 if (is_component_build) {
1205 frameworks = [ "Carbon.framework" ]
1208 ldflags = [ "-ObjC" ]
1211 ":chrome_dll_symbol_order",
1212 "//build/config/compiler:wexit_time_destructors",
1214 if (!is_component_build && !using_sanitizer) {
1215 configs += [ ":chrome_dll_symbol_exports" ]
1219 mac_framework_bundle("chrome_framework") {
1220 output_name = chrome_framework_name
1222 framework_version = chrome_framework_version
1223 framework_contents = [
1229 if (is_chrome_branded) {
1230 framework_contents += [ "Default Apps" ]
1231 if (enable_keystone_registration_framework) {
1232 # For KeystoneRegistration.framework.
1233 framework_contents += [ "Frameworks" ]
1238 framework_contents += [ "Internet Plug-Ins" ]
1241 configs += [ "//build/config/compiler:wexit_time_destructors" ]
1242 configs -= [ "//build/config/compiler:thinlto_optimize_default" ]
1243 configs += [ "//build/config/compiler:thinlto_optimize_max" ]
1245 info_plist_target = ":chrome_framework_plist"
1246 extra_substitutions = [
1247 "CHROMIUM_BUNDLE_ID=$chrome_mac_bundle_id",
1248 "CHROMIUM_SHORT_NAME=$chrome_product_short_name",
1251 public_deps = [ ":chrome_dll" ]
1255 ":chrome_framework_helpers",
1256 ":chrome_framework_plugins",
1257 ":chrome_framework_resources",
1258 ":keystone_registration_framework",
1259 ":optimization_guide_library",
1260 ":swiftshader_library",
1261 ":widevine_cdm_library",
1262 "//chrome/browser/resources/media/mei_preload:component_bundle",
1265 if (enable_ml_internal) {
1266 bundle_deps += [ ":chrome_ml_library" ]
1269 if (is_chrome_branded) {
1270 bundle_deps += [ ":preinstalled_apps" ]
1273 configs += [ ":chrome_dll_symbol_order" ]
1274 if (!is_component_build && !using_sanitizer) {
1275 configs += [ ":chrome_dll_symbol_exports" ]
1279 "-compatibility_version",
1280 chrome_dylib_version,
1282 chrome_dylib_version,
1285 if (!is_component_build) {
1286 # Specify a sensible install_name for static builds. The library is
1287 # dlopen()ed so this is not used to resolve the module.
1288 ldflags += [ "-Wl,-install_name,@executable_path/../Frameworks/$chrome_framework_name.framework/Versions/$chrome_version_full/$chrome_framework_name" ]
1290 # In the component build, both the :chrome_app and various
1291 # :chrome_helper* targets directly link to the Framework target. Use
1292 # @rpath-based loading so that the dylib ID does not have to be changed
1293 # with install_name_tool.
1295 "-Wl,-install_name,@rpath/$chrome_framework_name.framework/$chrome_framework_name",
1296 "-Wl,-rpath,@loader_path/../../../../../..",
1297 "-Wl,-reexport_library,libchrome_dll.dylib",
1300 data_deps = [ ":chrome_dll" ]
1304 _framework_binary_path = "$root_out_dir/$chrome_framework_name.framework/Versions/$chrome_framework_version/$chrome_framework_name"
1305 assert(_framework_binary_path != "",
1306 "Ignore configuration-dependent unused variable warning")
1308 # TOOD(crbug/1163903#c8) - thakis@ look into why profile and coverage
1309 # instrumentation adds these symbols in different orders
1310 if (!is_component_build && chrome_pgo_phase != 1 && !using_sanitizer) {
1311 action("verify_chrome_framework_order") {
1312 script = "//chrome/tools/build/mac/verify_order.py"
1313 stamp_file = "$target_out_dir/run_$target_name.stamp"
1316 "--stamp=" + rebase_path(stamp_file, root_out_dir),
1317 "--binary=" + rebase_path(_framework_binary_path, root_out_dir),
1318 "--symbol-file=" + rebase_path("app/framework.order", root_build_dir),
1320 if (host_os == "mac") {
1321 args += [ "--nm-path=$mac_bin_path/nm" ]
1323 args += [ "--nm-path=" +
1324 rebase_path("$clang_base_path/bin/llvm-nm", root_build_dir) ]
1326 outputs = [ stamp_file ]
1327 public_deps = [ ":chrome_framework" ]
1330 group("verify_chrome_framework_order") {
1331 if (is_component_build) {
1332 # In a component build, the framework is directly linked to the
1333 # executable because dlopen() and loading all the dependent dylibs
1334 # is time-consuming, see https://crbug.com/1197495.
1335 public_deps = [ ":chrome_framework+link" ]
1337 public_deps = [ ":chrome_framework" ]
1342 if (enable_dsyms && !is_component_build) {
1343 # It is possible to run dump_syms on unstripped products without dSYMs, but
1344 # doing so isn't logical and won't happen in practice. It's also pointless
1345 # to run dump_syms or archive dSYMs in a component build, where all of the
1346 # interesting symbols and debug info are tucked away in other libraries
1347 # beyond the set explicitly listed here.
1349 # This list must be updated with the two targets' deps list below, and
1350 # the list of _dsyms in :chrome_dsym_archive.
1351 _chrome_symbols_sources = [
1352 "$root_out_dir/$chrome_product_full_name.app/Contents/MacOS/$chrome_product_full_name",
1353 "$root_out_dir/chrome_crashpad_handler",
1354 "$root_out_dir/libEGL.dylib",
1355 "$root_out_dir/libGLESv2.dylib",
1356 "$root_out_dir/libvk_swiftshader.dylib",
1357 _framework_binary_path,
1359 if (build_with_internal_optimization_guide) {
1360 _chrome_symbols_sources +=
1361 [ "$root_out_dir/liboptimization_guide_internal.dylib" ]
1364 foreach(helper_params, chrome_mac_helpers) {
1365 _chrome_symbols_sources += [ "$root_out_dir/${chrome_helper_name}${helper_params[2]}.app/Contents/MacOS/${chrome_helper_name}${helper_params[2]}" ]
1368 action_foreach("chrome_dump_syms") {
1369 script = "//build/redirect_stdout.py"
1371 sources = _chrome_symbols_sources
1374 [ "$root_out_dir/{{source_file_part}}-$chrome_version_full.breakpad" ]
1376 dump_syms = "//third_party/breakpad:dump_syms($host_toolchain)"
1377 args = rebase_path(outputs, root_build_dir) + [
1378 rebase_path(get_label_info(dump_syms, "root_out_dir") + "/" +
1379 get_label_info(dump_syms, "name"),
1385 "$root_out_dir/{{source_file_part}}.dSYM/Contents/Resources/DWARF/{{source_file_part}}",
1392 ":chrome_framework",
1393 "//components/crash/core/app:chrome_crashpad_handler",
1394 "//third_party/angle:libEGL",
1395 "//third_party/angle:libGLESv2",
1396 "//third_party/swiftshader/src/Vulkan:swiftshader_libvulkan",
1399 if (build_with_internal_optimization_guide) {
1400 deps += [ "//components/optimization_guide/internal:optimization_guide_internal" ]
1403 foreach(helper_params, chrome_mac_helpers) {
1404 deps += [ ":chrome_helper_app_${helper_params[0]}" ]
1408 action("chrome_dsym_archive") {
1409 script = "//chrome/tools/build/mac/archive_symbols.py"
1411 # These are the dSYMs that will be archived. The sources list must be
1412 # the target outputs that correspond to the dSYMs (since a dSYM is a
1413 # directory it cannot be listed as a source file). The targets that
1414 # generate both the dSYM and binary image are listed in deps.
1416 "$root_out_dir/$chrome_framework_name.dSYM",
1417 "$root_out_dir/$chrome_product_full_name.dSYM",
1418 "$root_out_dir/chrome_crashpad_handler.dSYM",
1419 "$root_out_dir/libEGL.dylib.dSYM",
1420 "$root_out_dir/libGLESv2.dylib.dSYM",
1421 "$root_out_dir/libvk_swiftshader.dylib.dSYM",
1423 if (build_with_internal_optimization_guide) {
1424 _dsyms += [ "$root_out_dir/liboptimization_guide_internal.dylib.dSYM" ]
1429 ":chrome_framework",
1430 "//components/crash/core/app:chrome_crashpad_handler",
1431 "//third_party/angle:libEGL",
1432 "//third_party/angle:libGLESv2",
1433 "//third_party/swiftshader/src/Vulkan:swiftshader_libvulkan",
1435 if (build_with_internal_optimization_guide) {
1436 deps += [ "//components/optimization_guide/internal:optimization_guide_internal" ]
1439 foreach(helper_params, chrome_mac_helpers) {
1441 [ "$root_out_dir/${chrome_helper_name}${helper_params[2]}.dSYM" ]
1442 deps += [ ":chrome_helper_app_${helper_params[0]}" ]
1445 sources = _chrome_symbols_sources
1447 _output = "$root_out_dir/$chrome_product_full_name.dSYM.tar.bz2"
1449 outputs = [ _output ]
1451 args = [ rebase_path(_output, root_out_dir) ] +
1452 rebase_path(_dsyms, root_out_dir)
1455 group("chrome_dump_syms") {
1457 group("chrome_dsym_archive") {
1460 } else if (is_tizen) {
1461 executable("chrome_tizen") {
1463 deps = [ "//tizen_src/ewk/efl_integration:libchromium-ewk" ]
1465 "app/chrome_exe_main_aura.cc",
1466 "app/chrome_exe_resource.h",
1470 "-Wl,--export-dynamic",
1472 cflags = [ "-fPIC" ]
1473 configs += [ "//tizen_src/build/config/tizen:executable_config" ]
1476 static_library("chrome_lib") {
1477 sources = [ "app/chrome_exe_resource.h" ]
1481 "//build:chromeos_buildflags",
1482 "//printing/buildflags",
1484 data = [ "$root_out_dir/resources.pak" ]
1488 "app/chrome_dll_resource.h",
1489 "app/chrome_main.cc",
1490 "app/chrome_main_delegate.cc",
1491 "app/chrome_main_delegate.h",
1492 "app/chrome_main_linux.cc",
1493 "app/chrome_main_linux.h",
1497 # On Linux, link the dependencies (libraries) that make up actual
1498 # Chromium functionality directly into the executable.
1501 # For configuring PartitionAlloc
1502 "//base/allocator:buildflags",
1504 # For the sampling profiler.
1505 "//chrome/common/profiler",
1507 # Needed to use the master_preferences functions
1508 "//chrome/installer/util:with_no_strings",
1509 "//content/public/app",
1511 # For headless mode.
1512 "//headless:headless_shell_lib",
1515 public_deps = [ "//chrome/common:buildflags" ]
1519 ":xdg_mime", # Needs to be public for installer to consume files.
1522 data_deps += [ "//components/crash/core/app:chrome_crashpad_handler" ]
1527 if ((is_linux || is_chromeos_lacros) && !is_component_build &&
1529 version_script = "//build/linux/chrome.map"
1530 inputs = [ version_script ]
1531 ldflags += [ "-Wl,--version-script=" +
1532 rebase_path(version_script, root_build_dir) ]
1535 # These files are used by the installer so we need a public dep.
1536 public_deps += [ ":packed_resources" ]
1538 # The step's output are needed at runtime, so we also need a data_dep.
1539 data_deps += [ ":packed_resources" ]
1542 "//chrome/browser/resources/media/mei_preload:component",
1543 "//third_party/widevine/cdm",
1548 group("dependencies") {
1550 "//build:branding_buildflags",
1551 "//build:chromeos_buildflags",
1553 "//chrome/browser:buildflags",
1554 "//chrome/browser/policy:path_parser",
1558 "//chrome/renderer",
1560 "//components/about_ui",
1561 "//components/devtools/devtools_pipe",
1562 "//components/memory_system",
1563 "//components/startup_metric_utils",
1564 "//components/sync",
1565 "//components/upload_list:upload_list",
1566 "//content/public/child",
1568 "//services/tracing/public/cpp",
1569 "//third_party/blink/public:blink_devtools_frontend_resources",
1570 "//third_party/blink/public:blink_devtools_inspector_resources",
1575 public_deps += [ "//ppapi/host" ]
1578 if (enable_printing) {
1579 public_deps += [ "//printing" ]
1584 "//components/nacl/browser",
1585 "//components/nacl/renderer/plugin:nacl_trusted_plugin",
1590 public_deps += [ "//chromeos/dbus/constants" ]
1593 if (is_chromeos_lacros) {
1595 "//chromeos/lacros",
1596 "//chromeos/lacros/dbus",
1600 if (is_chromeos_ash) {
1603 "//chrome/browser/ash",
1605 "//chromeos/ash/components/memory",
1610 public_deps += [ "//components/crash/core/app" ]
1615 process_version_rc_template("chrome_exe_version") {
1616 sources = [ "app/chrome_exe.ver" ]
1617 output = "$target_gen_dir/chrome_exe_version.rc"
1620 process_version_rc_template("chrome_dll_version") {
1621 sources = [ "app/chrome_dll.ver" ]
1622 output = "$target_gen_dir/chrome_dll_version.rc"
1625 # This manifest matches what GYP produced. It may not even be necessary.
1626 windows_manifest("chrome_dll_manifest") {
1628 as_invoker_manifest,
1629 common_controls_manifest,
1633 process_version_rc_template("other_version") {
1634 sources = [ "app/other.ver" ]
1635 output = "$target_gen_dir/other_version.rc"
1639 copy("visual_elements_resources") {
1641 "//chrome/app/theme/$branding_path_component/win/tiles/Logo.png",
1642 "//chrome/app/theme/$branding_path_component/win/tiles/SmallLogo.png",
1643 "app/visual_elements_resources/chrome.VisualElementsManifest.xml",
1646 if (is_chrome_branded) {
1648 "//chrome/app/theme/$branding_path_component/win/tiles/LogoBeta.png",
1649 "//chrome/app/theme/$branding_path_component/win/tiles/LogoCanary.png",
1650 "//chrome/app/theme/$branding_path_component/win/tiles/LogoDev.png",
1651 "//chrome/app/theme/$branding_path_component/win/tiles/SmallLogoBeta.png",
1652 "//chrome/app/theme/$branding_path_component/win/tiles/SmallLogoCanary.png",
1653 "//chrome/app/theme/$branding_path_component/win/tiles/SmallLogoDev.png",
1657 outputs = [ "$root_out_dir/{{source_file_part}}" ]
1660 group("resources") {
1662 "//chrome/browser:resources",
1663 "//chrome/common:resources",
1664 "//chrome/renderer:resources",
1668 group("extra_resources") {
1669 # Deps should be same as those in chrome_extra_paks() within chrome_paks.gni.
1671 "//chrome/browser/resources:resources",
1672 "//components/autofill/core/browser:autofill_address_rewriter_resources",
1676 if (is_chrome_branded && !is_android) {
1678 _preinstalled_apps_target_type = "copy"
1680 _preinstalled_apps_target_type = "bundle_data"
1683 target(_preinstalled_apps_target_type, "preinstalled_apps") {
1684 visibility = [ ":packed_resources" ]
1687 ":chrome_framework",
1688 ":chrome_framework_shared_library",
1692 sources = [ "browser/resources/default_apps/external_extensions.json" ]
1695 outputs = [ "$root_out_dir/default_apps/{{source_file_part}}" ]
1697 outputs = [ "{{bundle_contents_dir}}/Default Apps/{{source_file_part}}" ]
1700 # Force anybody that depends on this to get the default apps as data files.
1701 data = process_file_template(sources, outputs)
1706 chrome_paks("packed_resources") {
1708 output_dir = "$root_gen_dir/repack"
1709 copy_data_to_bundle = true
1711 output_dir = root_out_dir
1715 if (enable_resource_allowlist_generation) {
1716 repack_allowlist = _chrome_resource_allowlist
1717 deps = [ ":resource_allowlist" ]
1720 if (is_chrome_branded && !is_mac) {
1721 public_deps = [ ":preinstalled_apps" ]
1726 "chrome_100_percent.pak",
1729 files_to_hash += [ "chrome_200_percent.pak" ]
1735 repack("browser_tests_pak") {
1737 sources = [ "$root_gen_dir/chrome/webui_test_resources.pak" ]
1738 output = "$root_out_dir/browser_tests.pak"
1739 deps = [ "//chrome/test/data/webui:resources" ]
1745 "//chrome/app:branded_strings",
1746 "//chrome/app:generated_resources",
1747 "//chrome/app/resources:locale_settings",
1752 java_cpp_enum("partner_bookmarks_javagen") {
1753 sources = [ "browser/android/bookmarks/partner_bookmarks_reader.h" ]
1756 java_cpp_enum("offline_pages_enum_javagen") {
1757 sources = [ "browser/offline_pages/offline_page_utils.h" ]
1760 java_cpp_enum("download_enum_javagen") {
1762 "browser/download/android/download_open_source.h",
1763 "browser/download/download_dialog_types.h",
1764 "browser/download/download_prompt_status.h",
1768 java_cpp_enum("context_menu_image_format_enum_javagen") {
1770 [ "browser/android/context_menu/context_menu_native_delegate_impl.h" ]
1773 source_set("chrome_android_core") {
1775 "app/android/chrome_jni_onload.cc",
1776 "app/android/chrome_jni_onload.h",
1777 "app/android/chrome_main_delegate_android.cc",
1778 "app/android/chrome_main_delegate_android.h",
1779 "app/chrome_main_delegate.cc",
1780 "app/chrome_main_delegate.h",
1795 "//chrome/browser/ui",
1798 "//chrome/common:version_header",
1799 "//chrome/common/profiler",
1801 "//chrome/renderer",
1802 "//components/minidump_uploader",
1803 "//components/safe_browsing:buildflags",
1804 "//components/safe_browsing/android:safe_browsing_api_handler",
1805 "//components/safe_browsing/android:safe_browsing_mobile",
1806 "//content/public/app",
1809 # Explicit dependency required for JNI registration to be able to
1810 # find the native side functions.
1811 if (is_android && is_component_build) {
1813 "//components/viz/service",
1815 "//ui/events/devices",
1821 "//chrome/browser/flags:flags_android",
1822 "//components/crash/android:crash_android",
1826 if (is_chromeos_ash) {
1827 public_deps += [ "//ui/lottie" ]
1831 deps += [ "//third_party/gvr-android-sdk:gvr_shim" ]
1836 # Android also supports this, but uses
1837 # //chrome/android:${_variant}_resource_allowlist.
1838 if (is_win && enable_resource_allowlist_generation) {
1839 generate_resource_allowlist("resource_allowlist") {
1840 deps = [ ":chrome_dll" ]
1841 inputs = [ "$root_out_dir/chrome.dll.pdb" ]
1842 output = _chrome_resource_allowlist
1846 if (is_linux || is_chromeos || is_tizen) {
1847 if (is_official_build) {
1848 group("linux_symbols") {
1850 ":angle_egl_symbols",
1851 ":angle_gles_symbols",
1852 ":chrome_crashpad_symbols",
1856 deps += [ ":swiftshader_vk_symbols" ]
1858 if (!is_chromeos && !is_tizen) {
1859 deps += [ ":angle_libvulkan_symbols" ]
1861 if (build_with_internal_optimization_guide) {
1862 deps += [ ":optimization_guide_symbols" ]
1865 extract_symbols("chrome_symbols") {
1866 binary = "$root_out_dir/chrome"
1868 if (current_cpu == "x86") {
1869 # GYP used "ia32" so keep that naming for back-compat.
1870 symbol_file = "$root_out_dir/chrome.breakpad.ia32"
1872 symbol_file = "$root_out_dir/chrome.breakpad.$current_cpu"
1875 deps = [ ":chrome" ]
1877 extract_symbols("chrome_crashpad_symbols") {
1878 binary = "$root_out_dir/chrome_crashpad_handler"
1880 if (current_cpu == "x86") {
1881 # GYP used "ia32" so keep that naming for back-compat.
1882 symbol_file = "$root_out_dir/crashpad.breakpad.ia32"
1884 symbol_file = "$root_out_dir/crashpad.breakpad.$current_cpu"
1887 deps = [ "//components/crash/core/app:chrome_crashpad_handler" ]
1889 extract_symbols("swiftshader_vk_symbols") {
1890 binary = "$root_out_dir/libvk_swiftshader.so"
1892 if (current_cpu == "x86") {
1893 # GYP used "ia32" so keep that naming for back-compat.
1894 symbol_file = "$root_out_dir/libvk_swiftshader.breakpad.ia32"
1896 symbol_file = "$root_out_dir/libvk_swiftshader.breakpad.$current_cpu"
1899 deps = [ "//third_party/swiftshader/src/Vulkan:swiftshader_libvulkan" ]
1901 extract_symbols("angle_egl_symbols") {
1902 binary = "$root_out_dir/libEGL.so"
1904 if (current_cpu == "x86") {
1905 # GYP used "ia32" so keep that naming for back-compat.
1906 symbol_file = "$root_out_dir/angle_libegl.breakpad.ia32"
1908 symbol_file = "$root_out_dir/angle_libegl.breakpad.$current_cpu"
1911 deps = [ "//third_party/angle:libEGL" ]
1913 extract_symbols("angle_gles_symbols") {
1914 binary = "$root_out_dir/libGLESv2.so"
1916 if (current_cpu == "x86") {
1917 # GYP used "ia32" so keep that naming for back-compat.
1918 symbol_file = "$root_out_dir/angle_libgles.breakpad.ia32"
1920 symbol_file = "$root_out_dir/angle_libgles.breakpad.$current_cpu"
1923 deps = [ "//third_party/angle:libGLESv2" ]
1925 if (!is_chromeos && !is_tizen) {
1926 extract_symbols("angle_libvulkan_symbols") {
1927 binary = "$root_out_dir/libvulkan.so.1"
1929 if (current_cpu == "x86") {
1930 # GYP used "ia32" so keep that naming for back-compat.
1931 symbol_file = "$root_out_dir/angle_libvulkan.breakpad.ia32"
1933 symbol_file = "$root_out_dir/angle_libvulkan.breakpad.$current_cpu"
1936 deps = [ "//third_party/vulkan-deps/vulkan-loader/src:libvulkan" ]
1939 if (build_with_internal_optimization_guide) {
1940 extract_symbols("optimization_guide_symbols") {
1941 binary = "$root_out_dir/liboptimization_guide_internal.so"
1942 if (current_cpu == "x86") {
1943 # GYP used "ia32" so keep that naming for back-compat.
1945 "$root_out_dir/optimization_guide_internal.breakpad.ia32"
1948 "$root_out_dir/optimization_guide_internal.breakpad.$current_cpu"
1951 deps = [ "//components/optimization_guide/internal:optimization_guide_internal" ]
1956 # Copies some scripts and resources that are used for desktop integration.
1959 "//chrome/tools/build/linux/chrome-wrapper",
1960 "//third_party/xdg-utils/scripts/xdg-mime",
1961 "//third_party/xdg-utils/scripts/xdg-settings",
1965 [ "//chrome/app/theme/$branding_path_component/product_logo_48.png" ]
1968 "//chrome/app/theme/$branding_path_component/linux/product_logo_48.png",
1971 outputs = [ "$root_out_dir/{{source_file_part}}" ]
1975 if (is_chromeos_lacros && is_official_build) {
1976 # This target is responsible for stripping symbols out of lacros files.
1977 # Adding/removing targets here, you also need a corresponding change
1978 # in src-internal for the release builder.
1979 group("strip_lacros_files") {
1981 ":strip_chrome_binary",
1982 ":strip_chrome_crashpad_handler",
1984 ":strip_libglesv2_so",
1985 ":strip_nacl_helper",
1987 if (target_cpu == "arm" || target_cpu == "arm64") {
1988 deps += [ ":strip_nacl_helper_bootstrap" ]
1992 # This will strip chrome binary and produce chrome.debug with symbols.
1993 strip_binary("strip_chrome_binary") {
1994 binary_input = "$root_out_dir/chrome"
1995 symbol_output = "$root_out_dir/chrome.debug"
1996 stripped_binary_output = "$root_out_dir/chrome.stripped"
1997 deps = [ ":chrome" ]
1999 strip_binary("strip_chrome_crashpad_handler") {
2000 binary_input = "$root_out_dir/chrome_crashpad_handler"
2001 symbol_output = "$root_out_dir/chrome_crashpad_handler.debug"
2002 stripped_binary_output = "$root_out_dir/chrome_crashpad_handler.stripped"
2003 deps = [ "//components/crash/core/app:chrome_crashpad_handler" ]
2005 strip_binary("strip_libegl_so") {
2006 binary_input = "$root_out_dir/libEGL.so"
2007 symbol_output = "$root_out_dir/libEGL.so.debug"
2008 stripped_binary_output = "$root_out_dir/libEGL.so.stripped"
2009 deps = [ "//third_party/angle:libEGL" ]
2011 strip_binary("strip_libglesv2_so") {
2012 binary_input = "$root_out_dir/libGLESv2.so"
2013 symbol_output = "$root_out_dir/libGLESv2.so.debug"
2014 stripped_binary_output = "$root_out_dir/libGLESv2.so.stripped"
2015 deps = [ "//third_party/angle:libGLESv2" ]
2017 strip_binary("strip_nacl_helper") {
2018 binary_input = "$root_out_dir/nacl_helper"
2019 symbol_output = "$root_out_dir/nacl_helper.debug"
2020 stripped_binary_output = "$root_out_dir/nacl_helper.stripped"
2021 deps = [ "//components/nacl/loader:nacl_helper" ]
2023 if (target_cpu == "arm" || target_cpu == "arm64") {
2024 strip_binary("strip_nacl_helper_bootstrap") {
2025 binary_input = "$root_out_dir/nacl_helper_bootstrap"
2026 symbol_output = "$root_out_dir/nacl_helper_bootstrap.debug"
2027 stripped_binary_output = "$root_out_dir/nacl_helper_bootstrap.stripped"
2028 if (target_cpu == "arm") {
2029 deps = [ "//native_client/src/trusted/service_runtime/linux:bootstrap" ]
2031 deps = [ "//components/nacl/loader:nacl_helper_bootstrap" ]