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",
33 "$root_out_dir/resources.pak",
35 if (is_linux || is_win) {
37 "$root_out_dir/chrome_100_percent.pak",
38 "$root_out_dir/locales/en-US.pak",
39 "$root_out_dir/locales/fr.pak",
43 if (is_win || (is_linux && target_cpu == "x64")) {
45 # TODO(GYP): Enable this when the IRT is in the right location.
46 # "$root_out_dir/nacl_irt_x86_64.nexe"
48 } else if (is_linux && target_cpu == "arm") {
50 # TODO(GYP): same comment
51 # "$root_out_dir/nacl_irt_arm.nexe"
58 # TODO(GYP) mac_bundle_resources, xcode_settings
62 "//content/public/common/content_switches.cc",
63 "//content/public/common/content_switches.h",
64 "app/chrome_crash_reporter_client.cc",
65 "app/chrome_crash_reporter_client.h",
67 "app/chrome_exe_load_config_win.cc",
68 "app/chrome_exe_main_win.cc",
69 "app/chrome_watcher_client_win.cc",
70 "app/chrome_watcher_client_win.h",
71 "app/chrome_watcher_command_line_win.cc",
72 "app/chrome_watcher_command_line_win.h",
75 "app/kasko_client.cc",
77 "app/signature_validator_win.cc",
78 "app/signature_validator_win.h",
79 "common/crash_keys.cc",
80 "common/crash_keys.h",
83 if (is_component_build) {
84 # This is necessary to make content_switches compile without DLL
85 # linkage errors in a component build.
86 defines += [ "COMPILE_CONTENT_STATICALLY" ]
90 ":chrome_exe_version",
94 # 'chrome_nacl_win64" TODO(GYP) bug 512869
95 # '../win8/delegate_execute/delegate_execute.gyp:*', TODO(GYP) bug 512867
96 # '../win8/metro_driver/metro_driver.gyp:metro_driver', TODO(GYP) bug 512864
98 "//breakpad:breakpad_handler",
99 "//breakpad:breakpad_sender",
100 "//chrome/app/version_assembly:chrome_exe_manifest",
101 "//chrome/browser:chrome_process_finder",
102 "//chrome/chrome_watcher",
103 "//chrome/chrome_watcher:client",
104 "//chrome/installer/util",
106 "//components/browser_watcher:browser_watcher_client",
107 "//components/crash/app",
108 "//components/crash_keys",
109 "//content:startup_helper_win",
114 data_deps = [ "//chrome/app/version_assembly:version_assembly_manifest" ]
120 configs -= [ "//build/config/win:console" ]
121 configs += [ "//build/config/win:windowed" ]
122 } else if (use_aura) {
123 # Non-Windows aura entrypoint.
124 sources += [ "app/chrome_exe_main_aura.cc" ]
129 "app/chrome_dll_resource.h",
130 "app/chrome_main.cc",
131 "app/chrome_main_delegate.cc",
132 "app/chrome_main_delegate.h",
136 # On Linux, link the dependencies (libraries) that make up actual
137 # Chromium functionality directly into the executable.
138 ":browser_dependencies",
139 ":child_dependencies",
143 # Needed to use the master_preferences functions
144 "//chrome/installer/util",
145 "//content/public/app:both",
148 ":xdg_mime", # Needs to be public for installer to consume files.
151 # Needed for chrome_main.cc initialization of libraries.
152 configs += [ "//build/config/linux:pangocairo" ]
154 # GYP has this in a 'profiling==0 and linux_disable_pie==0' condition.
155 # but GN doesn't have either of these flags.
160 "//build/config/linux:x11",
161 "//build/config/linux:xext",
167 sources += [ "app/chrome_exe_main_mac.cc" ]
168 # TODO(GYP) lots more stuff in the is_mac block.
170 # These files are used by the installer so we need a public dep.
172 ":packed_extra_resources",
176 "//components/startup_metric_utils",
178 # Precompiled plugins that need to get copied to the output directory.
179 # On Mac, internal plugins go inside the framework, so these
180 # dependencies are on chrome.dll.
181 "//third_party/adobe/flash:flapper_binaries",
182 "//third_party/widevine/cdm:widevinecdmadapter",
186 if (is_linux && enable_plugins) {
190 if (is_multi_dll_chrome) {
191 defines += [ "CHROME_MULTIPLE_DLL" ]
192 data_deps += [ ":chrome_child" ]
197 shared_library("main_dll") {
198 configs += [ "//build/config/compiler:wexit_time_destructors" ]
202 ":browser_dependencies",
206 output_name = "chrome"
209 "//base/win/dllmain.cc",
210 "app/chrome_command_ids.h",
212 "app/chrome_dll_resource.h",
213 "app/chrome_main.cc",
214 "app/chrome_main_delegate.cc",
215 "app/chrome_main_delegate.h",
216 "app/close_handle_hook_win.cc",
217 "app/close_handle_hook_win.h",
218 "app/delay_load_hook_win.cc",
219 "app/delay_load_hook_win.h",
223 ":chrome_dll_manifest",
224 ":chrome_dll_version",
225 "//base/trace_event/etw_manifest:chrome_events_win",
226 "//chrome/app/theme:chrome_unscaled_resources",
228 "//content/app/resources",
230 "//net:net_resources",
234 if (enable_configuration_policy) {
235 deps += [ "//components/policy" ]
237 if (current_cpu == "x86") {
238 # TODO(GYP) bug 512861: Lots of VCLinkerTool stuff on Windows.
239 #deps += [ 'chrome_user32_delay_imports' ] TODO(GYP)
242 # This is a large module that can't do incremental linking in some cases.
243 configs -= [ "//build/config/win:default_incremental_linking" ]
244 configs += [ "//build/config/win:default_large_module_incremental_linking" ]
246 # TODO(GYP) bug 512851: PGO.
250 deps += [ "//ui/compositor" ]
253 if (is_multi_dll_chrome) {
254 defines += [ "CHROME_MULTIPLE_DLL_BROWSER" ]
255 deps += [ "//content/public/app:browser" ]
258 ":child_dependencies",
259 "//content/public/app:both",
263 if (cld_version == 2) {
264 deps += [ "//third_party/cld_2" ]
268 #['OS=="mac" and component!="shared_library"', { TODO(GYP)
269 # 'includes': [ 'chrome_dll_bundle.gypi' ],
271 # TODO(GYP) Lots of other stuff in the OS=="mac" block.
274 if (enable_plugins && !is_multi_dll_chrome) {
279 if (is_multi_dll_chrome) {
280 # This manifest matches what GYP produces. It may not even be necessary.
281 windows_manifest("chrome_child_manifest") {
288 shared_library("chrome_child") {
290 "app/chrome_main.cc",
291 "app/chrome_main_delegate.cc",
292 "app/chrome_main_delegate.h",
293 "app/close_handle_hook_win.cc",
294 "app/close_handle_hook_win.h",
297 configs += [ "//build/config/compiler:wexit_time_destructors" ]
298 defines = [ "CHROME_MULTIPLE_DLL_CHILD" ]
301 ":child_dependencies",
302 ":chrome_child_manifest",
303 ":chrome_dll_version",
305 "//chrome/browser/policy:path_parser",
306 "//content/public/app:child",
310 # TODO(GYP) bug 512851: PGO on Windows.
311 # ['chrome_pgo_phase==1', {
314 # 'LinkTimeCodeGeneration': '2',
318 # ['chrome_pgo_phase==2', {
321 # 'LinkTimeCodeGeneration': '3',
326 if (enable_plugins) {
332 # GYP version: chromium_browser_dependencies variable in chrome.gyp
333 group("browser_dependencies") {
340 deps += [ "//ppapi/host" ]
343 if (enable_basic_printing || enable_print_preview) {
344 deps += [ "//printing" ]
345 if (enable_print_preview) {
346 deps += [ "//chrome/service" ]
351 # GYP version: chromium_child_dependencies variable in chrome.gyp
352 group("child_dependencies") {
359 "//chrome/browser/devtools",
364 "//content/public/child",
365 "//third_party/WebKit/public:blink_devtools_frontend_resources",
368 if (cld_version == 2) {
369 deps += [ "//third_party/cld_2:cld2_platform_impl" ]
373 deps += [ "//components/nacl/renderer/plugin:nacl_trusted_plugin" ]
378 # TODO(brettw) this duplicates "//chrome/common:version" which applies to
380 process_version("version_header") {
381 # TODO(brettW) this should have more reduced visibility, but chrome/browser
382 # currently depends on this.
383 #visibility = [ ":*" ]
385 # This one just uses the custom template and no separate sources.
387 template_file = "version.h.in"
389 # TODO(brettw) this should move to $target_gen_dir/version.h and
390 # source files including it should reference it via "chrome/version.h"
391 output = "$root_gen_dir/version.h"
394 process_version("chrome_exe_version") {
395 template_file = chrome_version_rc_template
397 "app/chrome_exe.ver",
399 output = "$target_gen_dir/chrome_exe_version.rc"
402 process_version("chrome_dll_version") {
403 template_file = chrome_version_rc_template
405 "app/chrome_dll.ver",
407 output = "$target_gen_dir/chrome_dll_version.rc"
410 # This manifest matches what GYP produces. It may not even be necessary.
411 windows_manifest("chrome_dll_manifest") {
414 common_controls_manifest,
419 process_version("nacl64_exe_version") {
420 template_file = chrome_version_rc_template
422 "app/nacl64_exe.ver",
424 output = "$target_gen_dir/nacl64_exe_version.rc"
427 process_version("other_version") {
428 template_file = chrome_version_rc_template
432 output = "$target_gen_dir/other_version.rc"
435 source_set("image_pre_reader") {
437 "app/image_pre_reader_win.cc",
438 "app/image_pre_reader_win.h",
446 # GYP version: chrome/chrome_resources.gyp:chrome_resources
449 # Note: GYP lists some dependencies in addition to these actions. However,
450 # these are just dependencies for the actions themselves, which our actions
451 # list individually when needed.
452 "//chrome/browser:resources",
453 "//chrome/common:resources",
454 "//chrome/renderer:resources",
457 if (enable_extensions) {
458 deps += [ "//chrome/common:extensions_api_resources" ]
462 # GYP version: chrome/chrome_resources.gyp:chrome_extra_resources
463 group("extra_resources") {
465 "//chrome/browser/resources:invalidations_resources",
466 "//chrome/browser/resources:memory_internals_resources",
467 "//chrome/browser/resources:net_internals_resources",
468 "//chrome/browser/resources:password_manager_internals_resources",
469 "//chrome/browser/resources:signin_internals_resources",
470 "//chrome/browser/resources:sync_internals_resources",
471 "//chrome/browser/resources:translate_internals_resources",
475 "//chrome/browser/resources:component_extension_resources",
476 "//chrome/browser/resources:options_resources",
477 "//chrome/browser/resources:settings_resources",
482 deps += [ "//chrome/browser/resources/chromeos/chromevox" ]
485 if (enable_extensions) {
487 "//chrome/browser/resources:quota_internals_resources",
488 "//chrome/browser/resources:sync_file_system_internals_resources",
493 if (is_chrome_branded) {
494 copy("default_apps") {
495 visibility = [ ":packed_resources" ]
497 "browser/resources/default_apps/docs.crx",
498 "browser/resources/default_apps/drive.crx",
499 "browser/resources/default_apps/external_extensions.json",
500 "browser/resources/default_apps/gmail.crx",
501 "browser/resources/default_apps/search.crx",
502 "browser/resources/default_apps/youtube.crx",
505 "$root_out_dir/default_apps/{{source_file_part}}",
508 # Force anybody that depends on this to get the default apps as data files.
509 data = process_file_template(sources, outputs)
513 group("packed_resources") {
515 ":repack_locales_pack",
516 ":repack_pseudo_locales_pack",
517 ":repack_chrome_100_percent",
520 if (is_chrome_branded) {
521 public_deps += [ ":default_apps" ]
525 public_deps += [ ":repack_chrome_200_percent" ]
528 if (enable_topchrome_md) {
529 public_deps += [ ":repack_chrome_material_100_percent" ]
532 public_deps += [ ":repack_chrome_material_200_percent" ]
537 repack("packed_extra_resources") {
538 visibility = [ "./*" ]
540 "$root_gen_dir/chrome/browser_resources.pak",
541 "$root_gen_dir/chrome/chrome_unscaled_resources.pak",
542 "$root_gen_dir/chrome/common_resources.pak",
543 "$root_gen_dir/chrome/invalidations_resources.pak",
544 "$root_gen_dir/chrome/memory_internals_resources.pak",
545 "$root_gen_dir/chrome/net_internals_resources.pak",
546 "$root_gen_dir/chrome/password_manager_internals_resources.pak",
547 "$root_gen_dir/chrome/signin_internals_resources.pak",
548 "$root_gen_dir/chrome/sync_internals_resources.pak",
549 "$root_gen_dir/chrome/translate_internals_resources.pak",
550 "$root_gen_dir/components/components_resources.pak",
551 "$root_gen_dir/net/net_resources.pak",
552 "$root_gen_dir/ui/resources/webui_resources.pak",
555 "//chrome/browser:resources",
556 "//chrome/app/theme:chrome_unscaled_resources",
557 "//chrome/common:resources",
558 "//chrome/browser/resources:invalidations_resources",
559 "//chrome/browser/resources:memory_internals_resources",
560 "//chrome/browser/resources:net_internals_resources",
561 "//chrome/browser/resources:password_manager_internals_resources",
562 "//chrome/browser/resources:signin_internals_resources",
563 "//chrome/browser/resources:sync_internals_resources",
564 "//chrome/browser/resources:translate_internals_resources",
565 "//components/resources",
566 "//net:net_resources",
570 if (!is_ios && !is_android) {
571 # New paks should be added here by default.
573 "$root_gen_dir/blink/devtools_resources.pak",
574 "$root_gen_dir/chrome/component_extension_resources.pak",
575 "$root_gen_dir/chrome/options_resources.pak",
576 "$root_gen_dir/chrome/quota_internals_resources.pak",
577 "$root_gen_dir/chrome/settings_resources.pak",
578 "$root_gen_dir/chrome/sync_file_system_internals_resources.pak",
579 "$root_gen_dir/chrome/webrtc_device_provider_resources.pak",
582 "//chrome/browser/devtools:webrtc_device_provider_resources",
583 "//chrome/browser/resources:component_extension_resources",
584 "//chrome/browser/resources:options_resources",
585 "//chrome/browser/resources:settings_resources",
586 "//chrome/browser/resources:quota_internals_resources",
587 "//chrome/browser/resources:sync_file_system_internals_resources",
588 "//content/browser/devtools:devtools_resources",
593 "$root_gen_dir/blink/public/resources/blink_resources.pak",
594 "$root_gen_dir/content/browser/tracing/tracing_resources.pak",
595 "$root_gen_dir/content/content_resources.pak",
598 "//content:resources",
599 "//content/browser/tracing:resources",
600 "//third_party/WebKit/public:resources",
604 sources += [ "$root_gen_dir/ui/file_manager/file_manager_resources.pak" ]
605 deps += [ "//ui/file_manager:resources" ]
607 if (enable_extensions) {
609 "$root_gen_dir/chrome/extensions_api_resources.pak",
610 "$root_gen_dir/extensions/extensions_renderer_resources.pak",
611 "$root_gen_dir/extensions/extensions_resources.pak",
614 "//chrome/common:extensions_api_resources",
615 "//extensions:extensions_resources",
619 # GYP outputs the file in the gen/repack directory. On non-Mac/iOS platforms
620 # it them copies it. This skipes the copy step and writes it to the final
622 if (is_mac || is_ios) {
623 output = "$root_gen_dir/repack/resources.pak"
625 output = "$root_out_dir/resources.pak"
629 # GYP version: chrome/chrome_resources.gyp:browser_tests_pak
630 repack("browser_tests_pak") {
632 "$root_gen_dir/chrome/options_test_resources.pak",
633 "$root_gen_dir/chrome/webui_test_resources.pak",
635 output = "$root_out_dir/browser_tests.pak"
637 "//chrome/browser/resources:options_test_resources",
638 "//chrome/test/data:webui_test_resources",
642 # Collects per-locale grit files from many sources into global per-locale files.
643 chrome_repack_locales("repack_locales_pack") {
644 visibility = [ ":*" ]
646 input_locales = locales
649 output_locales = locales_as_mac_outputs
651 output_locales = locales
655 chrome_repack_locales("repack_pseudo_locales_pack") {
656 visibility = [ ":*" ]
658 input_locales = [ "fake-bidi" ]
661 output_locales = [ "fake_bidi" ] # Mac uses underscores.
663 output_locales = [ "fake-bidi" ]
667 # Generates a rule to repack a set of resources, substituting a given string
668 # in for the percentage (e.g. "100", "200"). It generates the repacked files in
669 # the "gen" directory, and then introduces a copy rule to copy it to the root
672 # It's not clear why this two-step dance is necessary as opposed to just
673 # generating the file in the destination. However, this is what the GYP build
674 # does, and for maintenance purposes, this keeps the same files in the same
675 # place between the two builds when possible.
679 # String to substitute for the percentage.
680 template("chrome_repack_percent") {
681 percent = invoker.percent
683 repack_name = "${target_name}_repack"
684 repack_output_file = "$root_gen_dir/repack/chrome_${percent}_percent.pak"
686 copy_name = target_name
688 repack(repack_name) {
689 visibility = [ ":$copy_name" ]
691 # All sources should also have deps for completeness.
693 "$root_gen_dir/chrome/renderer_resources_${percent}_percent.pak",
694 "$root_gen_dir/chrome/theme_resources_${percent}_percent.pak",
695 "$root_gen_dir/components/components_resources_${percent}_percent.pak",
696 "$root_gen_dir/ui/resources/ui_resources_${percent}_percent.pak",
700 "//chrome/app/theme:theme_resources",
701 "//chrome/renderer:resources",
702 "//components/resources",
703 "//components/strings",
704 "//net:net_resources",
710 "$root_gen_dir/blink/public/resources/blink_image_resources_${percent}_percent.pak",
711 "$root_gen_dir/content/app/resources/content_resources_${percent}_percent.pak",
714 "//content/app/resources",
715 "//third_party/WebKit/public:image_resources",
720 [ "$root_gen_dir/ash/resources/ash_resources_${percent}_percent.pak" ]
721 deps += [ "//ash/resources" ]
724 sources += [ "$root_gen_dir/ui/views/resources/views_resources_${percent}_percent.pak" ]
725 deps += [ "//ui/views/resources" ]
728 sources += [ "$root_gen_dir/ui/chromeos/resources/ui_chromeos_resources_${percent}_percent.pak" ]
729 deps += [ "//ui/chromeos/resources" ]
731 if (enable_extensions) {
732 sources += [ "$root_gen_dir/extensions/extensions_browser_resources_${percent}_percent.pak" ]
733 deps += [ "//extensions:extensions_browser_resources" ]
735 if (enable_app_list) {
736 sources += [ "$root_gen_dir/ui/app_list/resources/app_list_resources_${percent}_percent.pak" ]
737 deps += [ "//ui/app_list/resources" ]
740 output = repack_output_file
744 visibility = [ ":*" ]
752 "$root_build_dir/chrome_${percent}_percent.pak",
757 chrome_repack_percent("repack_chrome_100_percent") {
762 chrome_repack_percent("repack_chrome_200_percent") {
767 # Generates a rule to repack a set of material design resources for the browser
768 # top chrome, substituting a given string in for the percentage (e.g. "100",
770 template("chrome_repack_material_percent") {
771 percent = invoker.percent
773 repack_name = "${target_name}_repack"
775 "$root_gen_dir/repack/chrome_material_${percent}_percent.pak"
777 copy_name = target_name
779 repack(repack_name) {
780 visibility = [ ":$copy_name" ]
782 # All sources should also have deps for completeness.
784 "$root_gen_dir/chrome/theme_resources_material_${percent}_percent.pak",
785 "$root_gen_dir/components/components_resources_material_${percent}_percent.pak",
789 "//chrome/app/theme:theme_resources",
790 "//components/resources",
793 output = repack_output_file
797 visibility = [ ":*" ]
805 "$root_build_dir/chrome_material_${percent}_percent.pak",
810 if (enable_topchrome_md) {
811 chrome_repack_material_percent("repack_chrome_material_100_percent") {
816 chrome_repack_material_percent("repack_chrome_material_200_percent") {
822 # GYP version: chrome/chrome_resources.gyp:chrome_strings
825 "//chrome/app:chromium_strings",
826 "//chrome/app:generated_resources",
827 "//chrome/app:google_chrome_strings",
828 "//chrome/app/resources:locale_settings",
833 # GYP: //chrome/chrome.gyp:content_setting_java
834 java_cpp_enum("content_setting_javagen") {
836 "../components/content_settings/core/common/content_settings.h",
839 "org/chromium/chrome/browser/ContentSetting.java",
843 # GYP: //chrome/chrome.gyp:content_settings_type_java
844 java_cpp_enum("content_settings_type_javagen") {
846 "../components/content_settings/core/common/content_settings_types.h",
849 "org/chromium/chrome/browser/ContentSettingsType.java",
853 # GYP: //chrome/chrome.gyp:page_info_connection_type_java
854 java_cpp_enum("page_info_connection_type_javagen") {
856 "browser/ui/android/website_settings_popup_android.h",
859 "org/chromium/chrome/browser/PageInfoConnectionType.java",
863 # GYP: //chrome/chrome_android.gypi:chrome_android_core
864 static_library("chrome_android_core") {
866 "app/android/chrome_android_initializer.cc",
867 "app/android/chrome_android_initializer.h",
868 "app/android/chrome_jni_onload.cc",
869 "app/android/chrome_jni_onload.h",
870 "app/android/chrome_main_delegate_android.cc",
871 "app/android/chrome_main_delegate_android.h",
872 "app/chrome_main_delegate.cc",
873 "app/chrome_main_delegate.h",
876 include_dirs = [ android_ndk_include_dir ]
885 "//chrome/browser/ui",
890 "//components/enhanced_bookmarks",
891 "//content/public/app:both",
898 if (is_chrome_branded) {
899 name = "Google Chrome"
900 filename = "google-chrome"
901 confdir = "google-chrome"
904 filename = "chromium-browser"
908 script = "//chrome/tools/build/linux/sed.py"
909 infile = "app/resources/manpage.1.in"
914 outfile = "$root_out_dir/chrome.1"
920 rebase_path(infile, root_build_dir),
921 rebase_path(outfile, root_build_dir),
922 "-e s/@@NAME@@/$name/",
923 "-e s/@@FILENAME@@/$filename/",
924 "-e s/@@CONFDIR@@/$confdir/",
928 action("linux_symbols") {
929 script = "//build/linux/dump_app_syms.py"
931 dump_syms_label = "//breakpad:dump_syms($host_toolchain)"
933 get_label_info(dump_syms_label, "root_out_dir") + "/" + "dump_syms"
935 chrome_binary = "$root_out_dir/chrome"
936 if (current_cpu == "x86") {
937 # Use "ia32" instead of "x86" for GYP compat.
938 symbol_file = "$root_out_dir/chrome.breakpad.ia32"
940 symbol_file = "$root_out_dir/chrome.breakpad.$current_cpu"
952 "./" + rebase_path(dump_syms_binary, root_build_dir),
953 "0", # TODO(GYP) This is linux_strip_binary if it is needed.
954 rebase_path(chrome_binary, root_build_dir),
955 rebase_path(symbol_file, root_build_dir),
964 # Copies some scripts and resources that are used for desktop integration.
967 "//chrome/app/theme/$branding_path_component/product_logo_48.png",
968 "//chrome/tools/build/linux/chrome-wrapper",
969 "//third_party/xdg-utils/scripts/xdg-mime",
970 "//third_party/xdg-utils/scripts/xdg-settings",
973 "$root_out_dir/{{source_file_part}}",