[M120 Migration][VD] Enable direct rendering for TVPlus
[platform/framework/web/chromium-efl.git] / chrome / BUILD.gn
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.
4
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")
33
34 if (is_android) {
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")
39 } else if (is_mac) {
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")
55 }
56
57 declare_args() {
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
62
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
68 }
69
70 assert(!is_ios, "Chromium/iOS shouldn't use anything in //chrome")
71
72 if (is_win && enable_resource_allowlist_generation) {
73   _chrome_resource_allowlist = "$target_gen_dir/chrome_resource_allowlist.txt"
74 }
75
76 if (is_win) {
77   action("reorder_imports") {
78     script = "//build/win/reorder-imports.py"
79
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" ]
83     outputs = [
84       "$root_out_dir/chrome.exe",
85       "$root_out_dir/chrome.exe.pdb",
86     ]
87     args = [
88       "-i",
89       rebase_path("$root_out_dir/initialexe", root_build_dir),
90       "-o",
91       rebase_path("$root_out_dir", root_build_dir),
92       "-a",
93       current_cpu,
94     ]
95     deps = [ ":chrome_initial" ]
96   }
97 }
98
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") {
105   deps = []
106
107   if (is_android) {
108     deps += [ "//chrome/android:chrome_public_apk" ]
109   } else if (!is_tizen) {
110     deps += [ ":chrome" ]
111   }
112
113   if (is_win) {
114     deps += [ ":chrome_dll" ]
115   }
116
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" ]
121
122   if (is_fuchsia) {
123     assert_no_deps += [
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",
128     ]
129   }
130 }
131 if (!is_android && !is_mac) {
132   group("chrome") {
133     public_deps = [ ":chrome_initial" ]
134     data_deps = [ ":chrome_initial" ]
135
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.
144     if (is_win) {
145       public_deps += [ ":reorder_imports" ]
146       data_deps += [ ":reorder_imports" ]
147     }
148   }
149
150   template("_chrome_exe") {
151     if (invoker.collect_inputs_only) {
152       _type = "shared_library"
153     } else {
154       _type = "executable"
155     }
156     target(_type, target_name) {
157       configs -= [ "//build/config/compiler:thinlto_optimize_default" ]
158       configs += [ "//build/config/compiler:thinlto_optimize_max" ]
159       if (is_win) {
160         output_name = "initialexe/chrome"
161       } else {
162         output_name = "chrome"
163       }
164
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" ]
169       defines = []
170       public_deps = []
171       deps = [
172         "//build:chromeos_buildflags",
173         "//printing/buildflags",
174       ]
175       data = [ "$root_out_dir/resources.pak" ]
176       data_deps = []
177
178       if (is_chromeos_ash) {
179         data_deps += [
180           "//components/variations/cros_evaluate_seed:evaluate_seed",
181           "//sandbox/linux:chrome_sandbox",
182         ]
183         deps += [ "//components/exo/wayland:ui_controls_protocol_stub" ]
184       }
185
186       if (also_build_lacros_chrome_for_architecture != "") {
187         data_deps += [ "//chrome:chrome(//build/toolchain/cros:lacros_clang)" ]
188       }
189
190       if (is_win) {
191         sources += [
192           "app/chrome_exe.rc",
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",
200         ]
201
202         deps += [
203           ":chrome_dll",
204           ":chrome_exe_version",
205           ":copy_first_run",
206           ":packed_resources_integrity",
207           ":visual_elements_resources",
208           "//base",
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",
230           "//crypto",
231           "//gpu/command_buffer/service",
232           "//sandbox",
233           "//sandbox/policy",
234           "//sandbox/policy/mojom",
235           "//third_party/breakpad:breakpad_handler",
236           "//third_party/breakpad:breakpad_sender",
237           "//third_party/crashpad/crashpad/util",
238           "//ui/gl",
239         ]
240         data_deps = [
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",
246         ]
247
248         defines += [ "CHROME_EXE_MAIN" ]
249
250         if (win_console_app) {
251           defines += [ "WIN_CONSOLE_APP" ]
252         } else {
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" ]
257         }
258
259         configs += [
260           "//build/config/win:delayloads",
261           "//build/config/win:delayloads_not_for_child_dll",
262         ]
263
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" ]
272         } else {
273           # Increase the initial stack size. The default is 1MB, this is 8MB.
274           ldflags = [ "/STACK:0x800000" ]
275         }
276       } else if (use_aura) {
277         # Non-Windows aura entrypoint.
278         sources += [ "app/chrome_exe_main_aura.cc" ]
279       }
280
281       if (is_linux || is_chromeos || is_fuchsia || is_tizen) {
282         sources += [
283           "app/chrome_dll_resource.h",
284           "app/chrome_main.cc",
285           "app/chrome_main_delegate.cc",
286           "app/chrome_main_delegate.h",
287         ]
288
289         deps += [
290           # On Linux, link the dependencies (libraries) that make up actual
291           # Chromium functionality directly into the executable.
292           ":dependencies",
293           "//chrome/common:version_header",
294
295           # For the sampling profiler.
296           "//chrome/common/profiler",
297
298           # Needed to use the master_preferences functions
299           "//chrome/installer/util:with_no_strings",
300           "//content/public/app",
301
302           # For headless mode.
303           "//headless:headless_shell_lib",
304         ]
305
306         public_deps = [ "//chrome/common:buildflags" ]
307
308         if (!is_fuchsia) {
309           public_deps += [
310             ":xdg_mime",  # Needs to be public for installer to consume files.
311           ]
312
313           data_deps += [ "//components/crash/core/app:chrome_crashpad_handler" ]
314         }
315
316         ldflags = []
317
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) ]
323         }
324
325         # On Chrome OS builds (for both ash-chrome and lacros-chrome), put
326         # a metadata.json file in root directory containing Chrome version.
327         if (is_chromeos) {
328           deps += [ "//ui/gfx/linux:gbm" ]
329           data_deps += [ "//build:version_metadata" ]
330         }
331
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" ]
336         }
337
338         if ((is_linux || is_chromeos_lacros) && !is_component_build &&
339             !using_sanitizer) {
340           version_script = "//build/linux/chrome.map"
341           inputs = [ version_script ]
342           ldflags += [ "-Wl,--version-script=" +
343                        rebase_path(version_script, root_build_dir) ]
344         }
345
346         if (is_chromeos_ash) {
347           public_deps += [ "//ui/lottie" ]
348         }
349
350         if (is_chromeos_lacros) {
351           deps += [
352             "//chromeos/crosapi/cpp:crosapi_constants",
353             "//chromeos/crosapi/mojom",
354             "//chromeos/lacros:lacros_paths",
355             "//chromeos/startup",
356             "//ui/base",
357           ]
358         }
359       }
360
361       if (is_chromeos_ash || is_win) {
362         data_deps += [ "//mojo/core:shared_library" ]
363       }
364
365       if (is_chromeos_ash) {
366         data_deps += [ "//mojo/core:shared_libraries_for_arc" ]
367       }
368
369       # These files are used by the installer so we need a public dep.
370       public_deps += [ ":packed_resources" ]
371
372       # The step's output are needed at runtime, so we also need a data_dep.
373       data_deps += [ ":packed_resources" ]
374
375       # ChromeOS by design is safe to have rpath=$ORIGIN. This simplifies shared
376       # library usage.
377       if (is_chromeos_ash && !is_component_build) {
378         configs += [ "//build/config/gcc:rpath_for_built_shared_libraries" ]
379       }
380
381       if (is_chromeos_lacros && is_chromeos_device) {
382         configs += [ "//build/lacros:optional_shared_libgcc" ]
383       }
384
385       data_deps += [
386         "//chrome/browser/resources/media/mei_preload:component",
387         "//third_party/widevine/cdm",
388       ]
389       if (invoker.collect_inputs_only) {
390         output_name = target_name
391         data_deps = []
392         ldflags += [ "--collect-inputs-only" ]
393       }
394
395       if (is_linux || is_tizen) {
396         sources += [
397           "app/chrome_main_linux.cc",
398           "app/chrome_main_linux.h",
399         ]
400       }
401     }
402   }
403   _chrome_exe("chrome_initial") {
404     collect_inputs_only = false
405   }
406   if (current_toolchain == default_toolchain && is_linux) {
407     _chrome_exe("chrome_inputs") {
408       collect_inputs_only = true
409     }
410     private_code_test("chrome_private_code_test") {
411       linker_inputs_dep = ":chrome_inputs"
412     }
413   }
414 }  # !is_android && !is_mac
415
416 if (is_win) {
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" ]
421
422     defines = []
423
424     sources = [
425       "//base/win/dllmain.cc",
426       "app/chrome_main.cc",
427       "app/chrome_main_delegate.cc",
428       "app/chrome_main_delegate.h",
429     ]
430
431     output_name = "chrome"
432
433     deps = [
434       ":chrome_dll_manifest",
435       ":chrome_dll_version",
436       ":dependencies",
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",
450       "//crypto",
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",
457       "//third_party/wtl",
458       "//ui/views",
459     ]
460
461     configs += [ "//build/config/win:delayloads" ]
462
463     if (use_aura) {
464       deps += [ "//ui/compositor" ]
465     }
466   }
467
468   copy("copy_first_run") {
469     sources = [ "app/FirstRun" ]
470     outputs = [ "$root_out_dir/First Run" ]
471   }
472 } else if (is_mac) {
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
476
477   verify_dynamic_libraries = !is_component_build && !is_asan
478   if (host_os == "mac") {
479     objdump_path = mac_bin_path
480   } else {
481     objdump_path = rebase_path("$clang_base_path/bin/", root_build_dir)
482   }
483
484   group("chrome") {
485     deps = [ ":chrome_app" ]
486
487     data_deps = [ ":chrome_app" ]
488
489     if (verify_dynamic_libraries) {
490       deps += [ ":verify_libraries_chrome_app" ]
491     }
492
493     if (is_chrome_branded && is_official_build) {
494       deps += [
495         ":chrome_dsym_archive",
496         ":chrome_dump_syms",
497       ]
498     }
499   }
500
501   tweak_info_plist("chrome_app_plist") {
502     info_plist = "app/app-Info.plist"
503     args = [
504       "--breakpad=0",
505       "--scm=1",
506       "--bundle_id=$chrome_mac_bundle_id",
507     ]
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" ]
514         }
515       } else {
516         args += [ "--keystone=0" ]
517       }
518     } else {
519       args += [ "--keystone=0" ]
520     }
521   }
522
523   mac_app_bundle("chrome_app") {
524     output_name = chrome_product_full_name
525
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",
531     ]
532
533     sources = [ "app/chrome_exe_main_mac.cc" ]
534
535     configs += [ "//build/config/compiler:wexit_time_destructors" ]
536
537     deps = [
538       ":chrome_app_strings_bundle_data",
539       ":chrome_resources",
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",
545     ]
546
547     if (enable_updater) {
548       deps += [ ":chromium_updater_privileged_helper" ]
549     }
550
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) ]
558     }
559
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" ]
566
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" ]
574     }
575   }
576
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" ]
582       args = [
583         "--stamp",
584         rebase_path(outputs[0], root_out_dir),
585         "-B",
586         objdump_path,
587         "--image",
588         rebase_path(inputs[0], root_out_dir),
589         "--allow",
590         "/usr/lib/libSystem.B.dylib",
591       ]
592       deps = [ ":chrome_app" ]
593     }
594   }
595
596   compiled_action("chrome_app_strings") {
597     tool = "//chrome/tools/build/mac:infoplist_strings_util"
598
599     inputs = []
600
601     outputs = []
602
603     foreach(locale, platform_pak_locales) {
604       _strings_file = "${branding_path_product}_strings"
605
606       inputs += [ "$root_gen_dir/chrome/${_strings_file}_${locale}.pak" ]
607     }
608
609     foreach(locale, locales_as_apple_outputs) {
610       outputs += [
611         "$target_gen_dir/app_infoplist_strings/$locale.lproj/InfoPlist.strings",
612       ]
613     }
614
615     args =
616         [
617           "-b",
618           "${branding_path_product}_strings",
619           "-v",
620           chrome_version_full,
621           "-g",
622           rebase_path("$root_gen_dir/chrome", root_build_dir),
623           "-o",
624           rebase_path("$target_gen_dir/app_infoplist_strings", root_build_dir),
625           "-t",
626           "main",
627         ] + platform_pak_locales
628
629     deps = [ "//chrome/app:branded_strings" ]
630   }
631
632   foreach(locale, locales_as_apple_outputs) {
633     bundle_data("chrome_app_strings_${locale}_bundle_data") {
634       sources = [
635         "$target_gen_dir/app_infoplist_strings/$locale.lproj/InfoPlist.strings",
636       ]
637       outputs =
638           [ "{{bundle_resources_dir}}/$locale.lproj/{{source_file_part}}" ]
639       public_deps = [ ":chrome_app_strings" ]
640     }
641   }
642   group("chrome_app_strings_bundle_data") {
643     public_deps = []
644     foreach(locale, locales_as_apple_outputs) {
645       public_deps += [ ":chrome_app_strings_${locale}_bundle_data" ]
646     }
647   }
648
649   bundle_data("chrome_app_icon") {
650     sources = [ "app/theme/$branding_path_component/mac/app.icns" ]
651     outputs = [ "{{bundle_resources_dir}}/{{source_file_part}}" ]
652   }
653
654   bundle_data("chrome_resources") {
655     sources = [
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",
659     ]
660     outputs = [ "{{bundle_resources_dir}}/{{source_file_part}}" ]
661     public_deps = [
662       ":chrome_app_icon",
663       ":chrome_app_strings",
664       "//components/policy:chrome_manifest_bundle",
665     ]
666   }
667
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}}" ]
671     public_deps = [
672       # Before bundling the versioned app components, delete any existing
673       # versions.
674       ":clean_up_old_versions",
675
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",
679     ]
680
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" ]
688     }
689   }
690
691   if (enable_updater) {
692     bundle_data("chromium_updater_privileged_helper") {
693       sources = [ "$root_out_dir/$privileged_helper_name" ]
694       outputs = [
695         "{{bundle_contents_dir}}/Library/LaunchServices/{{source_file_part}}",
696       ]
697
698       public_deps = [ "//chrome/updater/mac:privileged_helper" ]
699     }
700   }
701
702   action("clean_up_old_versions") {
703     script = "//chrome/tools/build/mac/clean_up_old_versions.py"
704
705     _stamp_file = "$root_gen_dir/run_$target_name.stamp"
706
707     outputs = [ _stamp_file ]
708
709     _versions_dir = "$root_out_dir/$chrome_product_full_name.app/Contents/Frameworks/$chrome_framework_name.framework/Versions"
710
711     args = [
712       "--versions-dir",
713       rebase_path(_versions_dir, root_build_dir),
714       "--stamp",
715       rebase_path(_stamp_file, root_build_dir),
716       "--keep",
717       chrome_version_full,
718       "--keep",
719       "Current",
720     ]
721   }
722
723   tweak_info_plist("chrome_helper_plist") {
724     info_plist = "app/helper-Info.plist"
725     args = [
726       "--breakpad=0",
727       "--keystone=0",
728       "--scm=0",
729     ]
730   }
731
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" ]
738     }
739     output_name = "$target_gen_dir/app-entitlements.plist"
740     substitutions = [
741       "CHROMIUM_BUNDLE_ID=$chrome_mac_bundle_id",
742       "CHROMIUM_TEAM_ID=$chrome_mac_team_id",
743     ]
744     visibility = [ "//chrome/installer/mac:copies" ]
745   }
746
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))
751
752       output_name = chrome_helper_name + invoker.helper_name_suffix
753
754       if (defined(invoker.info_plist_target)) {
755         info_plist_target = invoker.info_plist_target
756       } else {
757         info_plist_target = ":chrome_helper_plist"
758       }
759
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}",
765       ]
766
767       sources = [ "app/chrome_exe_main_mac.cc" ]
768
769       configs += [ "//build/config/compiler:wexit_time_destructors" ]
770
771       defines = [ "HELPER_EXECUTABLE" ]
772
773       deps = [
774         "//base/allocator:early_zone_registration_apple",
775         "//build:branding_buildflags",
776         "//chrome/common:version_header",
777         "//sandbox/mac:seatbelt",
778       ]
779
780       if (defined(invoker.deps)) {
781         deps += invoker.deps
782       }
783
784       ldflags = []
785
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" ]
791
792         ldflags += [
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/../../../../../../../../../..",
796
797           # ... and up to Contents/Frameworks.
798           "-Wl,-rpath,@executable_path/../../../../../../..",
799         ]
800       }
801
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) ]
809       }
810     }
811   }
812
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
819   #                 helper variant.
820   #   bundle ID suffix - A string fragment to append to the CFBundleIdentifier of
821   #                      the helper.
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.
825
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 = [
830     "alerts",
831     ".alerts",
832     " (Alerts)",
833   ]
834
835   # Merge all helper apps needed by //content and //chrome.
836   chrome_mac_helpers = content_mac_helpers + [ alert_helper_params ]
837
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]
843     }
844   }
845
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" ]
852   }
853
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") {
857     format = "binary1"
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"
861   }
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" ]
866   }
867
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"
872     deps = [
873       ":chrome_app_icon",
874       ":chrome_helper_app_alerts_resources",
875     ]
876   }
877
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]
883
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" ]
888         args = [
889           "--stamp",
890           rebase_path(outputs[0], root_out_dir),
891           "-B",
892           objdump_path,
893           "--image",
894           rebase_path(inputs[0], root_out_dir),
895
896           # Do not --allow more libraries here without consulting with the
897           # security team (security-dev@chromium.org).
898           "--allow",
899           "/usr/lib/libsandbox.1.dylib",
900           "--allow",
901           "/usr/lib/libSystem.B.dylib",
902         ]
903         deps = [ ":chrome_helper_app_${_helper_target}" ]
904       }
905     }
906   }
907
908   bundle_data("chrome_framework_helpers") {
909     sources = [
910       "$root_out_dir/app_mode_loader",
911       "$root_out_dir/chrome_crashpad_handler",
912     ]
913
914     outputs = [ "{{bundle_contents_dir}}/Helpers/{{source_file_part}}" ]
915
916     public_deps = [
917       "//chrome/app_shim:app_mode_loader",
918       "//components/crash/core/app:chrome_crashpad_handler",
919     ]
920
921     foreach(helper_params, chrome_mac_helpers) {
922       sources +=
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) {
926         public_deps +=
927             [ ":verify_libraries_chrome_helper_app_${helper_params[0]}" ]
928       }
929     }
930
931     if (enable_updater) {
932       if (is_chrome_branded) {
933         sources += [ "//third_party/updater/chrome_mac_universal_prod/${updater_product_full_name}.app" ]
934       } else {
935         sources += [ "$root_out_dir/${updater_product_full_name}.app" ]
936
937         public_deps += [
938           "//chrome/updater/mac:browser_install_script",
939           "//chrome/updater/mac:updater_bundle",
940           "//chrome/updater/mac:updater_install_script",
941         ]
942       }
943     }
944   }
945
946   bundle_data("chrome_framework_resources") {
947     sources = [
948       "//ui/gl/resources/angle-metal/gpu_shader_cache.bin",
949
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",
959     ]
960
961     outputs = [ "{{bundle_resources_dir}}/{{source_file_part}}" ]
962
963     public_deps = [
964       ":packed_resources",
965       "//chrome/app_shim:app_mode_loader_plist_bundle_data",
966     ]
967
968     if (is_chrome_branded) {
969       sources += [
970         "browser/mac/keystone_promote_postflight.sh",
971         "browser/mac/keystone_promote_preflight.sh",
972       ]
973     }
974
975     if (icu_use_data_file) {
976       sources += [ "$root_out_dir/icudtl.dat" ]
977       public_deps += [ "//third_party/icu:icudata" ]
978     }
979
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" ]
985       } else {
986         sources += [ "$root_out_dir/snapshot_blob.bin" ]
987       }
988     }
989   }
990
991   if (enable_nacl) {
992     bundle_data("chrome_framework_plugins") {
993       sources = []
994       outputs =
995           [ "{{bundle_contents_dir}}/Internet Plug-Ins/{{source_file_part}}" ]
996       public_deps = []
997
998       if (enable_nacl) {
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" ]
1003         }
1004         public_deps += [ "//ppapi/native_client:irt" ]
1005       }
1006     }
1007   } else {
1008     group("chrome_framework_plugins") {
1009     }
1010   }
1011
1012   # EGL on MacOS ships with official chrome
1013   bundle_egl_libraries = use_egl
1014
1015   if (bundle_egl_libraries) {
1016     # Add the ANGLE .dylibs in the MODULE_DIR of Chromium.app
1017     bundle_data("angle_binaries") {
1018       sources = [
1019         "$root_out_dir/egl_intermediates/libEGL.dylib",
1020         "$root_out_dir/egl_intermediates/libGLESv2.dylib",
1021       ]
1022       outputs = [ "{{bundle_contents_dir}}/Libraries/{{source_file_part}}" ]
1023       public_deps = [ "//ui/gl:angle_library_copy" ]
1024     }
1025
1026     # Add the SwiftShader .dylibs in the MODULE_DIR of Chromium.app
1027     bundle_data("swiftshader_binaries") {
1028       sources = [
1029         "$root_out_dir/vk_intermediates/libvk_swiftshader.dylib",
1030         "$root_out_dir/vk_intermediates/vk_swiftshader_icd.json",
1031       ]
1032       outputs = [ "{{bundle_contents_dir}}/Libraries/{{source_file_part}}" ]
1033       public_deps = [ "//ui/gl:swiftshader_vk_library_copy" ]
1034     }
1035   }
1036
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" ]
1042     }
1043   }
1044
1045   group("angle_library") {
1046     if (bundle_egl_libraries) {
1047       deps = [ ":angle_binaries" ]
1048     }
1049   }
1050
1051   group("swiftshader_library") {
1052     if (bundle_egl_libraries) {
1053       deps = [ ":swiftshader_binaries" ]
1054     }
1055   }
1056
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) {
1061         sources +=
1062             [ "$root_out_dir/$widevine_cdm_path/libwidevinecdm.dylib.sig" ]
1063       }
1064       outputs = [ "{{bundle_contents_dir}}/Libraries/$widevine_cdm_path/{{source_file_part}}" ]
1065       public_deps = [ "//third_party/widevine/cdm" ]
1066     }
1067
1068     bundle_data("widevine_cdm_library_manifest_and_license_files") {
1069       sources = [
1070         "$root_out_dir/WidevineCdm/LICENSE",
1071         "$root_out_dir/WidevineCdm/manifest.json",
1072       ]
1073       outputs = [
1074         "{{bundle_contents_dir}}/Libraries/WidevineCdm/{{source_file_part}}",
1075       ]
1076       public_deps = [ "//third_party/widevine/cdm" ]
1077     }
1078   }
1079
1080   group("widevine_cdm_library") {
1081     if (bundle_widevine_cdm) {
1082       deps = [
1083         ":widevine_cdm_library_binaries",
1084         ":widevine_cdm_library_manifest_and_license_files",
1085       ]
1086     }
1087   }
1088
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"
1092       flags = 1
1093       signature_file = "$root_out_dir/$chrome_framework_name.sig"
1094       deps = [ ":chrome_framework" ]
1095     }
1096
1097     copy("chrome_framework_widevine_signature") {
1098       deps = [ ":sign_chrome_framework_for_widevine" ]
1099
1100       sources = [ "$root_out_dir/$chrome_framework_name.sig" ]
1101
1102       outputs = [ "$root_out_dir/$chrome_framework_name.framework/Resources/{{source_file_part}}" ]
1103     }
1104   }
1105
1106   if (is_chrome_branded && enable_keystone_registration_framework) {
1107     bundle_data("keystone_registration_framework") {
1108       sources = [ "//third_party/googlemac/Releases/Keystone/KeystoneRegistration.framework" ]
1109
1110       outputs = [ "{{bundle_contents_dir}}/Frameworks/{{source_file_part}}" ]
1111     }
1112   } else {
1113     group("keystone_registration_framework") {
1114     }
1115   }
1116
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") {
1120       sources = [
1121         "$root_out_dir/og_intermediates/liboptimization_guide_internal.dylib",
1122       ]
1123       outputs = [ "{{bundle_contents_dir}}/Libraries/{{source_file_part}}" ]
1124       public_deps = [ "//components/optimization_guide/core:optimization_guide_internal_library_copy" ]
1125     }
1126   } else {
1127     group("optimization_guide_library") {
1128     }
1129   }
1130
1131   tweak_info_plist("chrome_framework_plist") {
1132     info_plist = "app/framework-Info.plist"
1133     args = [
1134       "--breakpad=0",
1135       "--keystone=0",
1136       "--scm=1",
1137       "--branding",
1138       chrome_product_short_name,
1139     ]
1140   }
1141
1142   # Limit the exported symbols of the framework library.
1143   config("chrome_dll_symbol_exports") {
1144     inputs = [ rebase_path("app/framework.exports") ]
1145     ldflags = [
1146       "-Wl,-exported_symbols_list",
1147       "-Wl," + rebase_path("app/framework.exports", root_build_dir),
1148     ]
1149   }
1150
1151   # Control the order of exported symbols in the framework library.
1152   config("chrome_dll_symbol_order") {
1153     inputs = [ rebase_path("app/framework.order") ]
1154     ldflags = [
1155       "-Wl,-order_file",
1156       "-Wl," + rebase_path("app/framework.order", root_build_dir),
1157     ]
1158   }
1159
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"
1166   } else {
1167     _dll_target_type = "source_set"
1168   }
1169   target(_dll_target_type, "chrome_dll") {
1170     visibility = [
1171       ":chrome_framework",
1172       ":chrome_framework_create_bundle",
1173       ":chrome_framework_shared_library",
1174     ]
1175
1176     sources = [
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",
1186     ]
1187
1188     deps = [
1189       ":dependencies",
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",
1202     ]
1203
1204     if (is_component_build) {
1205       frameworks = [ "Carbon.framework" ]
1206     }
1207
1208     ldflags = [ "-ObjC" ]
1209
1210     configs += [
1211       ":chrome_dll_symbol_order",
1212       "//build/config/compiler:wexit_time_destructors",
1213     ]
1214     if (!is_component_build && !using_sanitizer) {
1215       configs += [ ":chrome_dll_symbol_exports" ]
1216     }
1217   }
1218
1219   mac_framework_bundle("chrome_framework") {
1220     output_name = chrome_framework_name
1221
1222     framework_version = chrome_framework_version
1223     framework_contents = [
1224       "Helpers",
1225       "Libraries",
1226       "Resources",
1227     ]
1228
1229     if (is_chrome_branded) {
1230       framework_contents += [ "Default Apps" ]
1231       if (enable_keystone_registration_framework) {
1232         # For KeystoneRegistration.framework.
1233         framework_contents += [ "Frameworks" ]
1234       }
1235     }
1236
1237     if (enable_nacl) {
1238       framework_contents += [ "Internet Plug-Ins" ]
1239     }
1240
1241     configs += [ "//build/config/compiler:wexit_time_destructors" ]
1242     configs -= [ "//build/config/compiler:thinlto_optimize_default" ]
1243     configs += [ "//build/config/compiler:thinlto_optimize_max" ]
1244
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",
1249     ]
1250
1251     public_deps = [ ":chrome_dll" ]
1252
1253     bundle_deps = [
1254       ":angle_library",
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",
1263     ]
1264
1265     if (enable_ml_internal) {
1266       bundle_deps += [ ":chrome_ml_library" ]
1267     }
1268
1269     if (is_chrome_branded) {
1270       bundle_deps += [ ":preinstalled_apps" ]
1271     }
1272
1273     configs += [ ":chrome_dll_symbol_order" ]
1274     if (!is_component_build && !using_sanitizer) {
1275       configs += [ ":chrome_dll_symbol_exports" ]
1276     }
1277
1278     ldflags = [
1279       "-compatibility_version",
1280       chrome_dylib_version,
1281       "-current_version",
1282       chrome_dylib_version,
1283     ]
1284
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" ]
1289     } else {
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.
1294       ldflags += [
1295         "-Wl,-install_name,@rpath/$chrome_framework_name.framework/$chrome_framework_name",
1296         "-Wl,-rpath,@loader_path/../../../../../..",
1297         "-Wl,-reexport_library,libchrome_dll.dylib",
1298       ]
1299
1300       data_deps = [ ":chrome_dll" ]
1301     }
1302   }
1303
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")
1307
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"
1314       inputs = [ script ]
1315       args = [
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),
1319       ]
1320       if (host_os == "mac") {
1321         args += [ "--nm-path=$mac_bin_path/nm" ]
1322       } else {
1323         args += [ "--nm-path=" +
1324                   rebase_path("$clang_base_path/bin/llvm-nm", root_build_dir) ]
1325       }
1326       outputs = [ stamp_file ]
1327       public_deps = [ ":chrome_framework" ]
1328     }
1329   } else {
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" ]
1336       } else {
1337         public_deps = [ ":chrome_framework" ]
1338       }
1339     }
1340   }
1341
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.
1348
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,
1358     ]
1359     if (build_with_internal_optimization_guide) {
1360       _chrome_symbols_sources +=
1361           [ "$root_out_dir/liboptimization_guide_internal.dylib" ]
1362     }
1363
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]}" ]
1366     }
1367
1368     action_foreach("chrome_dump_syms") {
1369       script = "//build/redirect_stdout.py"
1370
1371       sources = _chrome_symbols_sources
1372
1373       outputs =
1374           [ "$root_out_dir/{{source_file_part}}-$chrome_version_full.breakpad" ]
1375
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"),
1380                            root_build_dir),
1381                "-d",
1382                "-m",
1383                "-g",
1384                rebase_path(
1385                    "$root_out_dir/{{source_file_part}}.dSYM/Contents/Resources/DWARF/{{source_file_part}}",
1386                    root_build_dir),
1387                "{{source}}",
1388              ]
1389
1390       deps = [
1391         ":chrome_app",
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",
1397         dump_syms,
1398       ]
1399       if (build_with_internal_optimization_guide) {
1400         deps += [ "//components/optimization_guide/internal:optimization_guide_internal" ]
1401       }
1402
1403       foreach(helper_params, chrome_mac_helpers) {
1404         deps += [ ":chrome_helper_app_${helper_params[0]}" ]
1405       }
1406     }
1407
1408     action("chrome_dsym_archive") {
1409       script = "//chrome/tools/build/mac/archive_symbols.py"
1410
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.
1415       _dsyms = [
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",
1422       ]
1423       if (build_with_internal_optimization_guide) {
1424         _dsyms += [ "$root_out_dir/liboptimization_guide_internal.dylib.dSYM" ]
1425       }
1426
1427       deps = [
1428         ":chrome_app",
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",
1434       ]
1435       if (build_with_internal_optimization_guide) {
1436         deps += [ "//components/optimization_guide/internal:optimization_guide_internal" ]
1437       }
1438
1439       foreach(helper_params, chrome_mac_helpers) {
1440         _dsyms +=
1441             [ "$root_out_dir/${chrome_helper_name}${helper_params[2]}.dSYM" ]
1442         deps += [ ":chrome_helper_app_${helper_params[0]}" ]
1443       }
1444
1445       sources = _chrome_symbols_sources
1446
1447       _output = "$root_out_dir/$chrome_product_full_name.dSYM.tar.bz2"
1448
1449       outputs = [ _output ]
1450
1451       args = [ rebase_path(_output, root_out_dir) ] +
1452              rebase_path(_dsyms, root_out_dir)
1453     }
1454   } else {
1455     group("chrome_dump_syms") {
1456     }
1457     group("chrome_dsym_archive") {
1458     }
1459   }
1460 } else if (is_tizen) {
1461   executable("chrome_tizen") {
1462     testonly = true
1463     deps = [ "//tizen_src/ewk/efl_integration:libchromium-ewk" ]
1464     sources = [
1465       "app/chrome_exe_main_aura.cc",
1466       "app/chrome_exe_resource.h",
1467     ]
1468     ldflags = [
1469       "-pie",
1470       "-Wl,--export-dynamic",
1471     ]
1472     cflags = [ "-fPIC" ]
1473     configs += [ "//tizen_src/build/config/tizen:executable_config" ]
1474   }
1475
1476   static_library("chrome_lib") {
1477     sources = [ "app/chrome_exe_resource.h" ]
1478     defines = []
1479     public_deps = []
1480     deps = [
1481       "//build:chromeos_buildflags",
1482       "//printing/buildflags",
1483     ]
1484     data = [ "$root_out_dir/resources.pak" ]
1485     data_deps = []
1486
1487     sources += [
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",
1494     ]
1495
1496     deps += [
1497       # On Linux, link the dependencies (libraries) that make up actual
1498       # Chromium functionality directly into the executable.
1499       ":dependencies",
1500
1501       # For configuring PartitionAlloc
1502       "//base/allocator:buildflags",
1503
1504       # For the sampling profiler.
1505       "//chrome/common/profiler",
1506
1507       # Needed to use the master_preferences functions
1508       "//chrome/installer/util:with_no_strings",
1509       "//content/public/app",
1510
1511       # For headless mode.
1512       "//headless:headless_shell_lib",
1513     ]
1514
1515     public_deps = [ "//chrome/common:buildflags" ]
1516
1517     if (!is_fuchsia) {
1518       public_deps += [
1519         ":xdg_mime",  # Needs to be public for installer to consume files.
1520       ]
1521
1522       data_deps += [ "//components/crash/core/app:chrome_crashpad_handler" ]
1523     }
1524
1525     ldflags = []
1526
1527     if ((is_linux || is_chromeos_lacros) && !is_component_build &&
1528         !using_sanitizer) {
1529       version_script = "//build/linux/chrome.map"
1530       inputs = [ version_script ]
1531       ldflags += [ "-Wl,--version-script=" +
1532                    rebase_path(version_script, root_build_dir) ]
1533     }
1534
1535     # These files are used by the installer so we need a public dep.
1536     public_deps += [ ":packed_resources" ]
1537
1538     # The step's output are needed at runtime, so we also need a data_dep.
1539     data_deps += [ ":packed_resources" ]
1540
1541     data_deps += [
1542       "//chrome/browser/resources/media/mei_preload:component",
1543       "//third_party/widevine/cdm",
1544     ]
1545   }
1546 }
1547
1548 group("dependencies") {
1549   public_deps = [
1550     "//build:branding_buildflags",
1551     "//build:chromeos_buildflags",
1552     "//chrome/browser",
1553     "//chrome/browser:buildflags",
1554     "//chrome/browser/policy:path_parser",
1555     "//chrome/child",
1556     "//chrome/common",
1557     "//chrome/gpu",
1558     "//chrome/renderer",
1559     "//chrome/utility",
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",
1567     "//pdf",
1568     "//services/tracing/public/cpp",
1569     "//third_party/blink/public:blink_devtools_frontend_resources",
1570     "//third_party/blink/public:blink_devtools_inspector_resources",
1571     "//v8:v8_headers",
1572   ]
1573
1574   if (enable_ppapi) {
1575     public_deps += [ "//ppapi/host" ]
1576   }
1577
1578   if (enable_printing) {
1579     public_deps += [ "//printing" ]
1580   }
1581
1582   if (enable_nacl) {
1583     public_deps += [
1584       "//components/nacl/browser",
1585       "//components/nacl/renderer/plugin:nacl_trusted_plugin",
1586     ]
1587   }
1588
1589   if (is_chromeos) {
1590     public_deps += [ "//chromeos/dbus/constants" ]
1591   }
1592
1593   if (is_chromeos_lacros) {
1594     public_deps += [
1595       "//chromeos/lacros",
1596       "//chromeos/lacros/dbus",
1597     ]
1598   }
1599
1600   if (is_chromeos_ash) {
1601     public_deps += [
1602       "//ash/constants",
1603       "//chrome/browser/ash",
1604       "//chromeos",
1605       "//chromeos/ash/components/memory",
1606     ]
1607   }
1608
1609   if (!is_fuchsia) {
1610     public_deps += [ "//components/crash/core/app" ]
1611   }
1612 }
1613
1614 if (is_win) {
1615   process_version_rc_template("chrome_exe_version") {
1616     sources = [ "app/chrome_exe.ver" ]
1617     output = "$target_gen_dir/chrome_exe_version.rc"
1618   }
1619
1620   process_version_rc_template("chrome_dll_version") {
1621     sources = [ "app/chrome_dll.ver" ]
1622     output = "$target_gen_dir/chrome_dll_version.rc"
1623   }
1624
1625   # This manifest matches what GYP produced. It may not even be necessary.
1626   windows_manifest("chrome_dll_manifest") {
1627     sources = [
1628       as_invoker_manifest,
1629       common_controls_manifest,
1630     ]
1631   }
1632
1633   process_version_rc_template("other_version") {
1634     sources = [ "app/other.ver" ]
1635     output = "$target_gen_dir/other_version.rc"
1636   }
1637 }
1638
1639 copy("visual_elements_resources") {
1640   sources = [
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",
1644   ]
1645
1646   if (is_chrome_branded) {
1647     sources += [
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",
1654     ]
1655   }
1656
1657   outputs = [ "$root_out_dir/{{source_file_part}}" ]
1658 }
1659
1660 group("resources") {
1661   public_deps = [
1662     "//chrome/browser:resources",
1663     "//chrome/common:resources",
1664     "//chrome/renderer:resources",
1665   ]
1666 }
1667
1668 group("extra_resources") {
1669   # Deps should be same as those in chrome_extra_paks() within chrome_paks.gni.
1670   public_deps = [
1671     "//chrome/browser/resources:resources",
1672     "//components/autofill/core/browser:autofill_address_rewriter_resources",
1673   ]
1674 }
1675
1676 if (is_chrome_branded && !is_android) {
1677   if (!is_mac) {
1678     _preinstalled_apps_target_type = "copy"
1679   } else {
1680     _preinstalled_apps_target_type = "bundle_data"
1681   }
1682
1683   target(_preinstalled_apps_target_type, "preinstalled_apps") {
1684     visibility = [ ":packed_resources" ]
1685     if (is_mac) {
1686       visibility += [
1687         ":chrome_framework",
1688         ":chrome_framework_shared_library",
1689       ]
1690     }
1691
1692     sources = [ "browser/resources/default_apps/external_extensions.json" ]
1693
1694     if (!is_mac) {
1695       outputs = [ "$root_out_dir/default_apps/{{source_file_part}}" ]
1696     } else {
1697       outputs = [ "{{bundle_contents_dir}}/Default Apps/{{source_file_part}}" ]
1698     }
1699
1700     # Force anybody that depends on this to get the default apps as data files.
1701     data = process_file_template(sources, outputs)
1702   }
1703 }
1704
1705 if (!is_android) {
1706   chrome_paks("packed_resources") {
1707     if (is_mac) {
1708       output_dir = "$root_gen_dir/repack"
1709       copy_data_to_bundle = true
1710     } else {
1711       output_dir = root_out_dir
1712       mark_as_data = true
1713     }
1714
1715     if (enable_resource_allowlist_generation) {
1716       repack_allowlist = _chrome_resource_allowlist
1717       deps = [ ":resource_allowlist" ]
1718     }
1719
1720     if (is_chrome_branded && !is_mac) {
1721       public_deps = [ ":preinstalled_apps" ]
1722     }
1723
1724     files_to_hash = [
1725       "resources.pak",
1726       "chrome_100_percent.pak",
1727     ]
1728     if (enable_hidpi) {
1729       files_to_hash += [ "chrome_200_percent.pak" ]
1730     }
1731   }
1732 }
1733
1734 if (!is_android) {
1735   repack("browser_tests_pak") {
1736     testonly = true
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" ]
1740   }
1741 }
1742
1743 group("strings") {
1744   public_deps = [
1745     "//chrome/app:branded_strings",
1746     "//chrome/app:generated_resources",
1747     "//chrome/app/resources:locale_settings",
1748   ]
1749 }
1750
1751 if (is_android) {
1752   java_cpp_enum("partner_bookmarks_javagen") {
1753     sources = [ "browser/android/bookmarks/partner_bookmarks_reader.h" ]
1754   }
1755
1756   java_cpp_enum("offline_pages_enum_javagen") {
1757     sources = [ "browser/offline_pages/offline_page_utils.h" ]
1758   }
1759
1760   java_cpp_enum("download_enum_javagen") {
1761     sources = [
1762       "browser/download/android/download_open_source.h",
1763       "browser/download/download_dialog_types.h",
1764       "browser/download/download_prompt_status.h",
1765     ]
1766   }
1767
1768   java_cpp_enum("context_menu_image_format_enum_javagen") {
1769     sources =
1770         [ "browser/android/context_menu/context_menu_native_delegate_impl.h" ]
1771   }
1772
1773   source_set("chrome_android_core") {
1774     sources = [
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",
1781     ]
1782
1783     libs = [
1784       "android",
1785       "jnigraphics",
1786     ]
1787
1788     public_deps = [
1789       "//chrome/browser",
1790       "//chrome/utility",
1791     ]
1792
1793     deps = [
1794       ":dependencies",
1795       "//chrome/browser/ui",
1796       "//chrome/child",
1797       "//chrome/common",
1798       "//chrome/common:version_header",
1799       "//chrome/common/profiler",
1800       "//chrome/gpu",
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",
1807     ]
1808
1809     # Explicit dependency required for JNI registration to be able to
1810     # find the native side functions.
1811     if (is_android && is_component_build) {
1812       deps += [
1813         "//components/viz/service",
1814         "//device/gamepad",
1815         "//ui/events/devices",
1816       ]
1817     }
1818
1819     if (is_android) {
1820       deps += [
1821         "//chrome/browser/flags:flags_android",
1822         "//components/crash/android:crash_android",
1823       ]
1824     }
1825
1826     if (is_chromeos_ash) {
1827       public_deps += [ "//ui/lottie" ]
1828     }
1829
1830     if (enable_vr) {
1831       deps += [ "//third_party/gvr-android-sdk:gvr_shim" ]
1832     }
1833   }
1834 }
1835
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
1843   }
1844 }
1845
1846 if (is_linux || is_chromeos || is_tizen) {
1847   if (is_official_build) {
1848     group("linux_symbols") {
1849       deps = [
1850         ":angle_egl_symbols",
1851         ":angle_gles_symbols",
1852         ":chrome_crashpad_symbols",
1853         ":chrome_symbols",
1854       ]
1855       if (is_linux) {
1856         deps += [ ":swiftshader_vk_symbols" ]
1857       }
1858       if (!is_chromeos && !is_tizen) {
1859         deps += [ ":angle_libvulkan_symbols" ]
1860       }
1861       if (build_with_internal_optimization_guide) {
1862         deps += [ ":optimization_guide_symbols" ]
1863       }
1864     }
1865     extract_symbols("chrome_symbols") {
1866       binary = "$root_out_dir/chrome"
1867
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"
1871       } else {
1872         symbol_file = "$root_out_dir/chrome.breakpad.$current_cpu"
1873       }
1874
1875       deps = [ ":chrome" ]
1876     }
1877     extract_symbols("chrome_crashpad_symbols") {
1878       binary = "$root_out_dir/chrome_crashpad_handler"
1879
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"
1883       } else {
1884         symbol_file = "$root_out_dir/crashpad.breakpad.$current_cpu"
1885       }
1886
1887       deps = [ "//components/crash/core/app:chrome_crashpad_handler" ]
1888     }
1889     extract_symbols("swiftshader_vk_symbols") {
1890       binary = "$root_out_dir/libvk_swiftshader.so"
1891
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"
1895       } else {
1896         symbol_file = "$root_out_dir/libvk_swiftshader.breakpad.$current_cpu"
1897       }
1898
1899       deps = [ "//third_party/swiftshader/src/Vulkan:swiftshader_libvulkan" ]
1900     }
1901     extract_symbols("angle_egl_symbols") {
1902       binary = "$root_out_dir/libEGL.so"
1903
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"
1907       } else {
1908         symbol_file = "$root_out_dir/angle_libegl.breakpad.$current_cpu"
1909       }
1910
1911       deps = [ "//third_party/angle:libEGL" ]
1912     }
1913     extract_symbols("angle_gles_symbols") {
1914       binary = "$root_out_dir/libGLESv2.so"
1915
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"
1919       } else {
1920         symbol_file = "$root_out_dir/angle_libgles.breakpad.$current_cpu"
1921       }
1922
1923       deps = [ "//third_party/angle:libGLESv2" ]
1924     }
1925     if (!is_chromeos && !is_tizen) {
1926       extract_symbols("angle_libvulkan_symbols") {
1927         binary = "$root_out_dir/libvulkan.so.1"
1928
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"
1932         } else {
1933           symbol_file = "$root_out_dir/angle_libvulkan.breakpad.$current_cpu"
1934         }
1935
1936         deps = [ "//third_party/vulkan-deps/vulkan-loader/src:libvulkan" ]
1937       }
1938     }
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.
1944           symbol_file =
1945               "$root_out_dir/optimization_guide_internal.breakpad.ia32"
1946         } else {
1947           symbol_file =
1948               "$root_out_dir/optimization_guide_internal.breakpad.$current_cpu"
1949         }
1950
1951         deps = [ "//components/optimization_guide/internal:optimization_guide_internal" ]
1952       }
1953     }
1954   }
1955
1956   # Copies some scripts and resources that are used for desktop integration.
1957   copy("xdg_mime") {
1958     sources = [
1959       "//chrome/tools/build/linux/chrome-wrapper",
1960       "//third_party/xdg-utils/scripts/xdg-mime",
1961       "//third_party/xdg-utils/scripts/xdg-settings",
1962     ]
1963     if (is_linux) {
1964       sources +=
1965           [ "//chrome/app/theme/$branding_path_component/product_logo_48.png" ]
1966     } else {
1967       sources += [
1968         "//chrome/app/theme/$branding_path_component/linux/product_logo_48.png",
1969       ]
1970     }
1971     outputs = [ "$root_out_dir/{{source_file_part}}" ]
1972   }
1973 }
1974
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") {
1980     deps = [
1981       ":strip_chrome_binary",
1982       ":strip_chrome_crashpad_handler",
1983       ":strip_libegl_so",
1984       ":strip_libglesv2_so",
1985       ":strip_nacl_helper",
1986     ]
1987     if (target_cpu == "arm" || target_cpu == "arm64") {
1988       deps += [ ":strip_nacl_helper_bootstrap" ]
1989     }
1990   }
1991
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" ]
1998   }
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" ]
2004   }
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" ]
2010   }
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" ]
2016   }
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" ]
2022   }
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" ]
2030       } else {
2031         deps = [ "//components/nacl/loader:nacl_helper_bootstrap" ]
2032       }
2033     }
2034   }
2035 }