1 # Copyright 2014 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
5 import("//build/config/chrome_build.gni")
6 import("//build/config/features.gni")
7 import("//build/config/locales.gni")
8 import("//build/config/ui.gni")
9 import("//build/config/win/manifest.gni")
10 import("//chrome/chrome_repack_locales.gni")
11 import("//chrome/version.gni")
14 import("//build/config/android/rules.gni")
18 # TODO(GYP) bug 512599: for Windows need to the the reorder-imports step
19 # which probably means adding another target and renaming this to
20 # chrome_initial like in GYP.
21 executable("chrome") {
22 # Because the sources list varies so significantly per-platform, generally
23 # each platform lists its own files rather than relying on filtering or
24 # removing unused files.
26 "app/chrome_exe_resource.h",
31 "//build/config/sanitizers:deps",
35 "$root_out_dir/resources.pak",
37 if (is_linux || is_win) {
39 "$root_out_dir/chrome_100_percent.pak",
40 "$root_out_dir/locales/en-US.pak",
41 "$root_out_dir/locales/fr.pak",
45 if (is_win || (is_linux && target_cpu == "x64")) {
47 # TODO(GYP): Enable this when the IRT is in the right location.
48 # "$root_out_dir/nacl_irt_x86_64.nexe"
50 } else if (is_linux && target_cpu == "arm") {
52 # TODO(GYP): same comment
53 # "$root_out_dir/nacl_irt_arm.nexe"
60 # TODO(GYP) mac_bundle_resources, xcode_settings
64 "//content/public/common/content_switches.cc",
65 "//content/public/common/content_switches.h",
66 "app/chrome_crash_reporter_client.cc",
67 "app/chrome_crash_reporter_client.h",
69 "app/chrome_exe_load_config_win.cc",
70 "app/chrome_exe_main_win.cc",
71 "app/chrome_watcher_client_win.cc",
72 "app/chrome_watcher_client_win.h",
73 "app/chrome_watcher_command_line_win.cc",
74 "app/chrome_watcher_command_line_win.h",
77 "app/kasko_client.cc",
79 "app/signature_validator_win.cc",
80 "app/signature_validator_win.h",
81 "common/crash_keys.cc",
82 "common/crash_keys.h",
85 if (is_component_build) {
86 # This is necessary to make content_switches compile without DLL
87 # linkage errors in a component build.
88 defines += [ "COMPILE_CONTENT_STATICALLY" ]
92 ":chrome_exe_version",
96 # 'chrome_nacl_win64" TODO(GYP) bug 512869
97 # '../win8/delegate_execute/delegate_execute.gyp:*', TODO(GYP) bug 512867
98 # '../win8/metro_driver/metro_driver.gyp:metro_driver', TODO(GYP) bug 512864
100 "//breakpad:breakpad_handler",
101 "//breakpad:breakpad_sender",
102 "//chrome/app/version_assembly:chrome_exe_manifest",
103 "//chrome/browser:chrome_process_finder",
104 "//chrome/chrome_watcher",
105 "//chrome/chrome_watcher:client",
106 "//chrome/installer/util",
108 "//components/browser_watcher:browser_watcher_client",
109 "//components/crash/content/app",
110 "//components/crash/core/common",
111 "//content:startup_helper_win",
116 data_deps = [ "//chrome/app/version_assembly:version_assembly_manifest" ]
122 configs -= [ "//build/config/win:console" ]
123 configs += [ "//build/config/win:windowed" ]
124 } else if (use_aura) {
125 # Non-Windows aura entrypoint.
126 sources += [ "app/chrome_exe_main_aura.cc" ]
131 "app/chrome_dll_resource.h",
132 "app/chrome_main.cc",
133 "app/chrome_main_delegate.cc",
134 "app/chrome_main_delegate.h",
138 # On Linux, link the dependencies (libraries) that make up actual
139 # Chromium functionality directly into the executable.
140 ":browser_dependencies",
141 ":child_dependencies",
145 # Needed to use the master_preferences functions
146 "//chrome/installer/util",
147 "//content/public/app:both",
150 ":xdg_mime", # Needs to be public for installer to consume files.
153 # Needed for chrome_main.cc initialization of libraries.
154 configs += [ "//build/config/linux:pangocairo" ]
156 # GYP has this in a 'profiling==0 and linux_disable_pie==0' condition.
157 # but GN doesn't have either of these flags.
162 "//build/config/linux:x11",
163 "//build/config/linux:xext",
169 sources += [ "app/chrome_exe_main_mac.cc" ]
170 # TODO(GYP) lots more stuff in the is_mac block.
172 # These files are used by the installer so we need a public dep.
174 ":packed_extra_resources",
178 "//components/startup_metric_utils",
180 # Precompiled plugins that need to get copied to the output directory.
181 # On Mac, internal plugins go inside the framework, so these
182 # dependencies are on chrome.dll.
183 "//third_party/adobe/flash:flapper_binaries",
184 "//third_party/widevine/cdm:widevinecdmadapter",
188 if (is_linux && enable_plugins) {
192 if (is_multi_dll_chrome) {
193 defines += [ "CHROME_MULTIPLE_DLL" ]
194 data_deps += [ ":chrome_child" ]
199 shared_library("main_dll") {
200 configs += [ "//build/config/compiler:wexit_time_destructors" ]
204 ":browser_dependencies",
206 "//build/config/sanitizers:deps",
209 output_name = "chrome"
212 "//base/win/dllmain.cc",
213 "app/chrome_command_ids.h",
215 "app/chrome_dll_resource.h",
216 "app/chrome_main.cc",
217 "app/chrome_main_delegate.cc",
218 "app/chrome_main_delegate.h",
219 "app/close_handle_hook_win.cc",
220 "app/close_handle_hook_win.h",
221 "app/delay_load_hook_win.cc",
222 "app/delay_load_hook_win.h",
226 ":chrome_dll_manifest",
227 ":chrome_dll_version",
228 "//base/trace_event/etw_manifest:chrome_events_win",
229 "//chrome/app/theme:chrome_unscaled_resources",
231 "//content/app/resources",
233 "//net:net_resources",
237 if (enable_configuration_policy) {
238 deps += [ "//components/policy" ]
240 if (current_cpu == "x86") {
241 # TODO(GYP) bug 512861: Lots of VCLinkerTool stuff on Windows.
242 #deps += [ 'chrome_user32_delay_imports' ] TODO(GYP)
245 # This is a large module that can't do incremental linking in some cases.
246 configs -= [ "//build/config/win:default_incremental_linking" ]
247 configs += [ "//build/config/win:default_large_module_incremental_linking" ]
249 # TODO(GYP) bug 512851: PGO.
253 deps += [ "//ui/compositor" ]
256 if (is_multi_dll_chrome) {
257 defines += [ "CHROME_MULTIPLE_DLL_BROWSER" ]
258 deps += [ "//content/public/app:browser" ]
261 ":child_dependencies",
262 "//content/public/app:both",
266 if (cld_version == 2) {
267 deps += [ "//third_party/cld_2" ]
271 #['OS=="mac" and component!="shared_library"', { TODO(GYP)
272 # 'includes': [ 'chrome_dll_bundle.gypi' ],
274 # TODO(GYP) Lots of other stuff in the OS=="mac" block.
277 if (enable_plugins && !is_multi_dll_chrome) {
282 if (is_multi_dll_chrome) {
283 # This manifest matches what GYP produces. It may not even be necessary.
284 windows_manifest("chrome_child_manifest") {
291 shared_library("chrome_child") {
293 "app/chrome_main.cc",
294 "app/chrome_main_delegate.cc",
295 "app/chrome_main_delegate.h",
296 "app/close_handle_hook_win.cc",
297 "app/close_handle_hook_win.h",
300 configs += [ "//build/config/compiler:wexit_time_destructors" ]
301 defines = [ "CHROME_MULTIPLE_DLL_CHILD" ]
304 ":child_dependencies",
305 ":chrome_child_manifest",
306 ":chrome_dll_version",
308 "//build/config/sanitizers:deps",
309 "//chrome/browser/policy:path_parser",
310 "//content/public/app:child",
314 # TODO(GYP) bug 512851: PGO on Windows.
315 # ['chrome_pgo_phase==1', {
318 # 'LinkTimeCodeGeneration': '2',
322 # ['chrome_pgo_phase==2', {
325 # 'LinkTimeCodeGeneration': '3',
330 if (enable_plugins) {
336 # GYP version: chromium_browser_dependencies variable in chrome.gyp
337 group("browser_dependencies") {
344 public_deps += [ "//ppapi/host" ]
347 if (enable_basic_printing || enable_print_preview) {
348 public_deps += [ "//printing" ]
349 if (enable_print_preview) {
350 public_deps += [ "//chrome/service" ]
355 # GYP version: chromium_child_dependencies variable in chrome.gyp
356 group("child_dependencies") {
363 "//chrome/browser/devtools",
368 "//content/public/child",
369 "//third_party/WebKit/public:blink_devtools_frontend_resources",
372 if (cld_version == 2) {
373 public_deps += [ "//third_party/cld_2:cld2_platform_impl" ]
377 public_deps += [ "//components/nacl/renderer/plugin:nacl_trusted_plugin" ]
382 # TODO(brettw) this duplicates "//chrome/common:version" which applies to
384 process_version("version_header") {
385 # TODO(brettW) this should have more reduced visibility, but chrome/browser
386 # currently depends on this.
387 #visibility = [ ":*" ]
389 # This one just uses the custom template and no separate sources.
391 template_file = "version.h.in"
393 # TODO(brettw) this should move to $target_gen_dir/version.h and
394 # source files including it should reference it via "chrome/version.h"
395 output = "$root_gen_dir/version.h"
398 process_version("chrome_exe_version") {
399 template_file = chrome_version_rc_template
401 "app/chrome_exe.ver",
403 output = "$target_gen_dir/chrome_exe_version.rc"
406 process_version("chrome_dll_version") {
407 template_file = chrome_version_rc_template
409 "app/chrome_dll.ver",
411 output = "$target_gen_dir/chrome_dll_version.rc"
414 # This manifest matches what GYP produces. It may not even be necessary.
415 windows_manifest("chrome_dll_manifest") {
418 common_controls_manifest,
423 process_version("nacl64_exe_version") {
424 template_file = chrome_version_rc_template
426 "app/nacl64_exe.ver",
428 output = "$target_gen_dir/nacl64_exe_version.rc"
431 process_version("other_version") {
432 template_file = chrome_version_rc_template
436 output = "$target_gen_dir/other_version.rc"
439 source_set("image_pre_reader") {
441 "app/image_pre_reader_win.cc",
442 "app/image_pre_reader_win.h",
450 # GYP version: chrome/chrome_resources.gyp:chrome_resources
453 # Note: GYP lists some dependencies in addition to these actions. However,
454 # these are just dependencies for the actions themselves, which our actions
455 # list individually when needed.
456 "//chrome/browser:resources",
457 "//chrome/common:resources",
458 "//chrome/renderer:resources",
461 if (enable_extensions) {
462 public_deps += [ "//chrome/common:extensions_api_resources" ]
466 # GYP version: chrome/chrome_resources.gyp:chrome_extra_resources
467 group("extra_resources") {
469 "//chrome/browser/resources:invalidations_resources",
470 "//chrome/browser/resources:memory_internals_resources",
471 "//chrome/browser/resources:net_internals_resources",
472 "//chrome/browser/resources:password_manager_internals_resources",
473 "//chrome/browser/resources:signin_internals_resources",
474 "//chrome/browser/resources:translate_internals_resources",
478 "//chrome/browser/resources:component_extension_resources",
479 "//chrome/browser/resources:options_resources",
480 "//chrome/browser/resources:settings_resources",
485 public_deps += [ "//chrome/browser/resources/chromeos/chromevox" ]
488 if (enable_extensions) {
490 "//chrome/browser/resources:quota_internals_resources",
491 "//chrome/browser/resources:sync_file_system_internals_resources",
496 if (is_chrome_branded) {
497 copy("default_apps") {
498 visibility = [ ":packed_resources" ]
500 "browser/resources/default_apps/docs.crx",
501 "browser/resources/default_apps/drive.crx",
502 "browser/resources/default_apps/external_extensions.json",
503 "browser/resources/default_apps/gmail.crx",
504 "browser/resources/default_apps/search.crx",
505 "browser/resources/default_apps/youtube.crx",
508 "$root_out_dir/default_apps/{{source_file_part}}",
511 # Force anybody that depends on this to get the default apps as data files.
512 data = process_file_template(sources, outputs)
516 group("packed_resources") {
518 ":repack_locales_pack",
519 ":repack_pseudo_locales_pack",
520 ":repack_chrome_100_percent",
523 if (is_chrome_branded) {
524 public_deps += [ ":default_apps" ]
528 public_deps += [ ":repack_chrome_200_percent" ]
531 if (enable_topchrome_md) {
532 public_deps += [ ":repack_chrome_material_100_percent" ]
535 public_deps += [ ":repack_chrome_material_200_percent" ]
540 repack("packed_extra_resources") {
541 visibility = [ "./*" ]
543 "$root_gen_dir/chrome/browser_resources.pak",
544 "$root_gen_dir/chrome/chrome_unscaled_resources.pak",
545 "$root_gen_dir/chrome/common_resources.pak",
546 "$root_gen_dir/chrome/invalidations_resources.pak",
547 "$root_gen_dir/chrome/memory_internals_resources.pak",
548 "$root_gen_dir/chrome/net_internals_resources.pak",
549 "$root_gen_dir/chrome/password_manager_internals_resources.pak",
550 "$root_gen_dir/chrome/signin_internals_resources.pak",
551 "$root_gen_dir/chrome/translate_internals_resources.pak",
552 "$root_gen_dir/components/components_resources.pak",
553 "$root_gen_dir/net/net_resources.pak",
554 "$root_gen_dir/ui/resources/webui_resources.pak",
557 "//chrome/browser:resources",
558 "//chrome/app/theme:chrome_unscaled_resources",
559 "//chrome/common:resources",
560 "//chrome/browser/resources:invalidations_resources",
561 "//chrome/browser/resources:memory_internals_resources",
562 "//chrome/browser/resources:net_internals_resources",
563 "//chrome/browser/resources:password_manager_internals_resources",
564 "//chrome/browser/resources:signin_internals_resources",
565 "//chrome/browser/resources:translate_internals_resources",
566 "//components/resources",
567 "//net:net_resources",
571 if (!is_ios && !is_android) {
572 # New paks should be added here by default.
574 "$root_gen_dir/blink/devtools_resources.pak",
575 "$root_gen_dir/chrome/component_extension_resources.pak",
576 "$root_gen_dir/chrome/options_resources.pak",
577 "$root_gen_dir/chrome/quota_internals_resources.pak",
578 "$root_gen_dir/chrome/settings_resources.pak",
579 "$root_gen_dir/chrome/sync_file_system_internals_resources.pak",
580 "$root_gen_dir/chrome/webrtc_device_provider_resources.pak",
583 "//chrome/browser/devtools:webrtc_device_provider_resources",
584 "//chrome/browser/resources:component_extension_resources",
585 "//chrome/browser/resources:options_resources",
586 "//chrome/browser/resources:settings_resources",
587 "//chrome/browser/resources:quota_internals_resources",
588 "//chrome/browser/resources:sync_file_system_internals_resources",
589 "//content/browser/devtools:devtools_resources",
594 "$root_gen_dir/blink/public/resources/blink_resources.pak",
595 "$root_gen_dir/content/browser/tracing/tracing_resources.pak",
596 "$root_gen_dir/content/content_resources.pak",
599 "//content:resources",
600 "//content/browser/tracing:resources",
601 "//third_party/WebKit/public:resources",
605 sources += [ "$root_gen_dir/ui/file_manager/file_manager_resources.pak" ]
606 deps += [ "//ui/file_manager:resources" ]
608 if (enable_extensions) {
610 "$root_gen_dir/chrome/extensions_api_resources.pak",
611 "$root_gen_dir/extensions/extensions_renderer_resources.pak",
612 "$root_gen_dir/extensions/extensions_resources.pak",
615 "//chrome/common:extensions_api_resources",
616 "//extensions:extensions_resources",
620 # GYP outputs the file in the gen/repack directory. On non-Mac/iOS platforms
621 # it them copies it. This skipes the copy step and writes it to the final
623 if (is_mac || is_ios) {
624 output = "$root_gen_dir/repack/resources.pak"
626 output = "$root_out_dir/resources.pak"
630 # GYP version: chrome/chrome_resources.gyp:browser_tests_pak
631 repack("browser_tests_pak") {
633 "$root_gen_dir/chrome/options_test_resources.pak",
634 "$root_gen_dir/chrome/webui_test_resources.pak",
636 output = "$root_out_dir/browser_tests.pak"
638 "//chrome/browser/resources:options_test_resources",
639 "//chrome/test/data:webui_test_resources",
643 # Collects per-locale grit files from many sources into global per-locale files.
644 chrome_repack_locales("repack_locales_pack") {
645 visibility = [ ":*" ]
647 input_locales = locales
650 output_locales = locales_as_mac_outputs
652 output_locales = locales
656 chrome_repack_locales("repack_pseudo_locales_pack") {
657 visibility = [ ":*" ]
659 input_locales = [ "fake-bidi" ]
662 output_locales = [ "fake_bidi" ] # Mac uses underscores.
664 output_locales = [ "fake-bidi" ]
668 # Generates a rule to repack a set of resources, substituting a given string
669 # in for the percentage (e.g. "100", "200"). It generates the repacked files in
670 # the "gen" directory, and then introduces a copy rule to copy it to the root
673 # It's not clear why this two-step dance is necessary as opposed to just
674 # generating the file in the destination. However, this is what the GYP build
675 # does, and for maintenance purposes, this keeps the same files in the same
676 # place between the two builds when possible.
680 # String to substitute for the percentage.
681 template("chrome_repack_percent") {
682 percent = invoker.percent
684 repack_name = "${target_name}_repack"
685 repack_output_file = "$root_gen_dir/repack/chrome_${percent}_percent.pak"
687 copy_name = target_name
689 repack(repack_name) {
690 visibility = [ ":$copy_name" ]
692 # All sources should also have deps for completeness.
694 "$root_gen_dir/chrome/renderer_resources_${percent}_percent.pak",
695 "$root_gen_dir/chrome/theme_resources_${percent}_percent.pak",
696 "$root_gen_dir/components/components_resources_${percent}_percent.pak",
697 "$root_gen_dir/ui/resources/ui_resources_${percent}_percent.pak",
701 "//chrome/app/theme:theme_resources",
702 "//chrome/renderer:resources",
703 "//components/resources",
704 "//components/strings",
705 "//net:net_resources",
711 "$root_gen_dir/blink/public/resources/blink_image_resources_${percent}_percent.pak",
712 "$root_gen_dir/content/app/resources/content_resources_${percent}_percent.pak",
715 "//content/app/resources",
716 "//third_party/WebKit/public:image_resources",
721 [ "$root_gen_dir/ash/resources/ash_resources_${percent}_percent.pak" ]
722 deps += [ "//ash/resources" ]
725 sources += [ "$root_gen_dir/ui/views/resources/views_resources_${percent}_percent.pak" ]
726 deps += [ "//ui/views/resources" ]
729 sources += [ "$root_gen_dir/ui/chromeos/resources/ui_chromeos_resources_${percent}_percent.pak" ]
730 deps += [ "//ui/chromeos/resources" ]
732 if (enable_extensions) {
733 sources += [ "$root_gen_dir/extensions/extensions_browser_resources_${percent}_percent.pak" ]
734 deps += [ "//extensions:extensions_browser_resources" ]
736 if (enable_app_list) {
737 sources += [ "$root_gen_dir/ui/app_list/resources/app_list_resources_${percent}_percent.pak" ]
738 deps += [ "//ui/app_list/resources" ]
741 output = repack_output_file
745 visibility = [ ":*" ]
753 "$root_build_dir/chrome_${percent}_percent.pak",
758 chrome_repack_percent("repack_chrome_100_percent") {
763 chrome_repack_percent("repack_chrome_200_percent") {
768 # Generates a rule to repack a set of material design resources for the browser
769 # top chrome, substituting a given string in for the percentage (e.g. "100",
771 template("chrome_repack_material_percent") {
772 percent = invoker.percent
774 repack_name = "${target_name}_repack"
776 "$root_gen_dir/repack/chrome_material_${percent}_percent.pak"
778 copy_name = target_name
780 repack(repack_name) {
781 visibility = [ ":$copy_name" ]
783 # All sources should also have deps for completeness.
785 "$root_gen_dir/chrome/theme_resources_material_${percent}_percent.pak",
786 "$root_gen_dir/components/components_resources_material_${percent}_percent.pak",
790 "//chrome/app/theme:theme_resources",
791 "//components/resources",
794 output = repack_output_file
798 visibility = [ ":*" ]
806 "$root_build_dir/chrome_material_${percent}_percent.pak",
811 if (enable_topchrome_md) {
812 chrome_repack_material_percent("repack_chrome_material_100_percent") {
817 chrome_repack_material_percent("repack_chrome_material_200_percent") {
823 # GYP version: chrome/chrome_resources.gyp:chrome_strings
826 "//chrome/app:chromium_strings",
827 "//chrome/app:generated_resources",
828 "//chrome/app:google_chrome_strings",
829 "//chrome/app/resources:locale_settings",
834 # GYP: //chrome/chrome.gyp:content_setting_java
835 java_cpp_enum("content_setting_javagen") {
837 "../components/content_settings/core/common/content_settings.h",
840 "org/chromium/chrome/browser/ContentSetting.java",
844 # GYP: //chrome/chrome.gyp:content_settings_type_java
845 java_cpp_enum("content_settings_type_javagen") {
847 "../components/content_settings/core/common/content_settings_types.h",
850 "org/chromium/chrome/browser/ContentSettingsType.java",
854 # GYP: //chrome/chrome.gyp:page_info_connection_type_java
855 java_cpp_enum("page_info_connection_type_javagen") {
857 "browser/ui/android/website_settings_popup_android.h",
860 "org/chromium/chrome/browser/PageInfoConnectionType.java",
864 # GYP: //chrome/chrome_android.gypi:chrome_android_core
865 static_library("chrome_android_core") {
867 "app/android/chrome_android_initializer.cc",
868 "app/android/chrome_android_initializer.h",
869 "app/android/chrome_jni_onload.cc",
870 "app/android/chrome_jni_onload.h",
871 "app/android/chrome_main_delegate_android.cc",
872 "app/android/chrome_main_delegate_android.h",
873 "app/chrome_main_delegate.cc",
874 "app/chrome_main_delegate.h",
877 include_dirs = [ android_ndk_include_dir ]
886 "//chrome/browser/ui",
891 "//components/enhanced_bookmarks",
892 "//content/public/app:both",
899 if (is_chrome_branded) {
900 name = "Google Chrome"
901 filename = "google-chrome"
902 confdir = "google-chrome"
905 filename = "chromium-browser"
909 script = "//chrome/tools/build/linux/sed.py"
910 infile = "app/resources/manpage.1.in"
915 outfile = "$root_out_dir/chrome.1"
921 rebase_path(infile, root_build_dir),
922 rebase_path(outfile, root_build_dir),
923 "-e s/@@NAME@@/$name/",
924 "-e s/@@FILENAME@@/$filename/",
925 "-e s/@@CONFDIR@@/$confdir/",
929 action("linux_symbols") {
930 script = "//build/linux/dump_app_syms.py"
932 dump_syms_label = "//breakpad:dump_syms($host_toolchain)"
934 get_label_info(dump_syms_label, "root_out_dir") + "/" + "dump_syms"
936 chrome_binary = "$root_out_dir/chrome"
937 if (current_cpu == "x86") {
938 # Use "ia32" instead of "x86" for GYP compat.
939 symbol_file = "$root_out_dir/chrome.breakpad.ia32"
941 symbol_file = "$root_out_dir/chrome.breakpad.$current_cpu"
953 "./" + rebase_path(dump_syms_binary, root_build_dir),
954 "0", # TODO(GYP) This is linux_strip_binary if it is needed.
955 rebase_path(chrome_binary, root_build_dir),
956 rebase_path(symbol_file, root_build_dir),
965 # Copies some scripts and resources that are used for desktop integration.
968 "//chrome/app/theme/$branding_path_component/product_logo_48.png",
969 "//chrome/tools/build/linux/chrome-wrapper",
970 "//third_party/xdg-utils/scripts/xdg-mime",
971 "//third_party/xdg-utils/scripts/xdg-settings",
974 "$root_out_dir/{{source_file_part}}",