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/app",
110 "//components/crash_keys",
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 deps += [ "//ppapi/host" ]
347 if (enable_basic_printing || enable_print_preview) {
348 deps += [ "//printing" ]
349 if (enable_print_preview) {
350 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 deps += [ "//third_party/cld_2:cld2_platform_impl" ]
377 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 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:sync_internals_resources",
475 "//chrome/browser/resources:translate_internals_resources",
479 "//chrome/browser/resources:component_extension_resources",
480 "//chrome/browser/resources:options_resources",
481 "//chrome/browser/resources:settings_resources",
486 deps += [ "//chrome/browser/resources/chromeos/chromevox" ]
489 if (enable_extensions) {
491 "//chrome/browser/resources:quota_internals_resources",
492 "//chrome/browser/resources:sync_file_system_internals_resources",
497 if (is_chrome_branded) {
498 copy("default_apps") {
499 visibility = [ ":packed_resources" ]
501 "browser/resources/default_apps/docs.crx",
502 "browser/resources/default_apps/drive.crx",
503 "browser/resources/default_apps/external_extensions.json",
504 "browser/resources/default_apps/gmail.crx",
505 "browser/resources/default_apps/search.crx",
506 "browser/resources/default_apps/youtube.crx",
509 "$root_out_dir/default_apps/{{source_file_part}}",
512 # Force anybody that depends on this to get the default apps as data files.
513 data = process_file_template(sources, outputs)
517 group("packed_resources") {
519 ":repack_locales_pack",
520 ":repack_pseudo_locales_pack",
521 ":repack_chrome_100_percent",
524 if (is_chrome_branded) {
525 public_deps += [ ":default_apps" ]
529 public_deps += [ ":repack_chrome_200_percent" ]
532 if (enable_topchrome_md) {
533 public_deps += [ ":repack_chrome_material_100_percent" ]
536 public_deps += [ ":repack_chrome_material_200_percent" ]
541 repack("packed_extra_resources") {
542 visibility = [ "./*" ]
544 "$root_gen_dir/chrome/browser_resources.pak",
545 "$root_gen_dir/chrome/chrome_unscaled_resources.pak",
546 "$root_gen_dir/chrome/common_resources.pak",
547 "$root_gen_dir/chrome/invalidations_resources.pak",
548 "$root_gen_dir/chrome/memory_internals_resources.pak",
549 "$root_gen_dir/chrome/net_internals_resources.pak",
550 "$root_gen_dir/chrome/password_manager_internals_resources.pak",
551 "$root_gen_dir/chrome/signin_internals_resources.pak",
552 "$root_gen_dir/chrome/sync_internals_resources.pak",
553 "$root_gen_dir/chrome/translate_internals_resources.pak",
554 "$root_gen_dir/components/components_resources.pak",
555 "$root_gen_dir/net/net_resources.pak",
556 "$root_gen_dir/ui/resources/webui_resources.pak",
559 "//chrome/browser:resources",
560 "//chrome/app/theme:chrome_unscaled_resources",
561 "//chrome/common:resources",
562 "//chrome/browser/resources:invalidations_resources",
563 "//chrome/browser/resources:memory_internals_resources",
564 "//chrome/browser/resources:net_internals_resources",
565 "//chrome/browser/resources:password_manager_internals_resources",
566 "//chrome/browser/resources:signin_internals_resources",
567 "//chrome/browser/resources:sync_internals_resources",
568 "//chrome/browser/resources:translate_internals_resources",
569 "//components/resources",
570 "//net:net_resources",
574 if (!is_ios && !is_android) {
575 # New paks should be added here by default.
577 "$root_gen_dir/blink/devtools_resources.pak",
578 "$root_gen_dir/chrome/component_extension_resources.pak",
579 "$root_gen_dir/chrome/options_resources.pak",
580 "$root_gen_dir/chrome/quota_internals_resources.pak",
581 "$root_gen_dir/chrome/settings_resources.pak",
582 "$root_gen_dir/chrome/sync_file_system_internals_resources.pak",
583 "$root_gen_dir/chrome/webrtc_device_provider_resources.pak",
586 "//chrome/browser/devtools:webrtc_device_provider_resources",
587 "//chrome/browser/resources:component_extension_resources",
588 "//chrome/browser/resources:options_resources",
589 "//chrome/browser/resources:settings_resources",
590 "//chrome/browser/resources:quota_internals_resources",
591 "//chrome/browser/resources:sync_file_system_internals_resources",
592 "//content/browser/devtools:devtools_resources",
597 "$root_gen_dir/blink/public/resources/blink_resources.pak",
598 "$root_gen_dir/content/browser/tracing/tracing_resources.pak",
599 "$root_gen_dir/content/content_resources.pak",
602 "//content:resources",
603 "//content/browser/tracing:resources",
604 "//third_party/WebKit/public:resources",
608 sources += [ "$root_gen_dir/ui/file_manager/file_manager_resources.pak" ]
609 deps += [ "//ui/file_manager:resources" ]
611 if (enable_extensions) {
613 "$root_gen_dir/chrome/extensions_api_resources.pak",
614 "$root_gen_dir/extensions/extensions_renderer_resources.pak",
615 "$root_gen_dir/extensions/extensions_resources.pak",
618 "//chrome/common:extensions_api_resources",
619 "//extensions:extensions_resources",
623 # GYP outputs the file in the gen/repack directory. On non-Mac/iOS platforms
624 # it them copies it. This skipes the copy step and writes it to the final
626 if (is_mac || is_ios) {
627 output = "$root_gen_dir/repack/resources.pak"
629 output = "$root_out_dir/resources.pak"
633 # GYP version: chrome/chrome_resources.gyp:browser_tests_pak
634 repack("browser_tests_pak") {
636 "$root_gen_dir/chrome/options_test_resources.pak",
637 "$root_gen_dir/chrome/webui_test_resources.pak",
639 output = "$root_out_dir/browser_tests.pak"
641 "//chrome/browser/resources:options_test_resources",
642 "//chrome/test/data:webui_test_resources",
646 # Collects per-locale grit files from many sources into global per-locale files.
647 chrome_repack_locales("repack_locales_pack") {
648 visibility = [ ":*" ]
650 input_locales = locales
653 output_locales = locales_as_mac_outputs
655 output_locales = locales
659 chrome_repack_locales("repack_pseudo_locales_pack") {
660 visibility = [ ":*" ]
662 input_locales = [ "fake-bidi" ]
665 output_locales = [ "fake_bidi" ] # Mac uses underscores.
667 output_locales = [ "fake-bidi" ]
671 # Generates a rule to repack a set of resources, substituting a given string
672 # in for the percentage (e.g. "100", "200"). It generates the repacked files in
673 # the "gen" directory, and then introduces a copy rule to copy it to the root
676 # It's not clear why this two-step dance is necessary as opposed to just
677 # generating the file in the destination. However, this is what the GYP build
678 # does, and for maintenance purposes, this keeps the same files in the same
679 # place between the two builds when possible.
683 # String to substitute for the percentage.
684 template("chrome_repack_percent") {
685 percent = invoker.percent
687 repack_name = "${target_name}_repack"
688 repack_output_file = "$root_gen_dir/repack/chrome_${percent}_percent.pak"
690 copy_name = target_name
692 repack(repack_name) {
693 visibility = [ ":$copy_name" ]
695 # All sources should also have deps for completeness.
697 "$root_gen_dir/chrome/renderer_resources_${percent}_percent.pak",
698 "$root_gen_dir/chrome/theme_resources_${percent}_percent.pak",
699 "$root_gen_dir/components/components_resources_${percent}_percent.pak",
700 "$root_gen_dir/ui/resources/ui_resources_${percent}_percent.pak",
704 "//chrome/app/theme:theme_resources",
705 "//chrome/renderer:resources",
706 "//components/resources",
707 "//components/strings",
708 "//net:net_resources",
714 "$root_gen_dir/blink/public/resources/blink_image_resources_${percent}_percent.pak",
715 "$root_gen_dir/content/app/resources/content_resources_${percent}_percent.pak",
718 "//content/app/resources",
719 "//third_party/WebKit/public:image_resources",
724 [ "$root_gen_dir/ash/resources/ash_resources_${percent}_percent.pak" ]
725 deps += [ "//ash/resources" ]
728 sources += [ "$root_gen_dir/ui/views/resources/views_resources_${percent}_percent.pak" ]
729 deps += [ "//ui/views/resources" ]
732 sources += [ "$root_gen_dir/ui/chromeos/resources/ui_chromeos_resources_${percent}_percent.pak" ]
733 deps += [ "//ui/chromeos/resources" ]
735 if (enable_extensions) {
736 sources += [ "$root_gen_dir/extensions/extensions_browser_resources_${percent}_percent.pak" ]
737 deps += [ "//extensions:extensions_browser_resources" ]
739 if (enable_app_list) {
740 sources += [ "$root_gen_dir/ui/app_list/resources/app_list_resources_${percent}_percent.pak" ]
741 deps += [ "//ui/app_list/resources" ]
744 output = repack_output_file
748 visibility = [ ":*" ]
756 "$root_build_dir/chrome_${percent}_percent.pak",
761 chrome_repack_percent("repack_chrome_100_percent") {
766 chrome_repack_percent("repack_chrome_200_percent") {
771 # Generates a rule to repack a set of material design resources for the browser
772 # top chrome, substituting a given string in for the percentage (e.g. "100",
774 template("chrome_repack_material_percent") {
775 percent = invoker.percent
777 repack_name = "${target_name}_repack"
779 "$root_gen_dir/repack/chrome_material_${percent}_percent.pak"
781 copy_name = target_name
783 repack(repack_name) {
784 visibility = [ ":$copy_name" ]
786 # All sources should also have deps for completeness.
788 "$root_gen_dir/chrome/theme_resources_material_${percent}_percent.pak",
789 "$root_gen_dir/components/components_resources_material_${percent}_percent.pak",
793 "//chrome/app/theme:theme_resources",
794 "//components/resources",
797 output = repack_output_file
801 visibility = [ ":*" ]
809 "$root_build_dir/chrome_material_${percent}_percent.pak",
814 if (enable_topchrome_md) {
815 chrome_repack_material_percent("repack_chrome_material_100_percent") {
820 chrome_repack_material_percent("repack_chrome_material_200_percent") {
826 # GYP version: chrome/chrome_resources.gyp:chrome_strings
829 "//chrome/app:chromium_strings",
830 "//chrome/app:generated_resources",
831 "//chrome/app:google_chrome_strings",
832 "//chrome/app/resources:locale_settings",
837 # GYP: //chrome/chrome.gyp:content_setting_java
838 java_cpp_enum("content_setting_javagen") {
840 "../components/content_settings/core/common/content_settings.h",
843 "org/chromium/chrome/browser/ContentSetting.java",
847 # GYP: //chrome/chrome.gyp:content_settings_type_java
848 java_cpp_enum("content_settings_type_javagen") {
850 "../components/content_settings/core/common/content_settings_types.h",
853 "org/chromium/chrome/browser/ContentSettingsType.java",
857 # GYP: //chrome/chrome.gyp:page_info_connection_type_java
858 java_cpp_enum("page_info_connection_type_javagen") {
860 "browser/ui/android/website_settings_popup_android.h",
863 "org/chromium/chrome/browser/PageInfoConnectionType.java",
867 # GYP: //chrome/chrome_android.gypi:chrome_android_core
868 static_library("chrome_android_core") {
870 "app/android/chrome_android_initializer.cc",
871 "app/android/chrome_android_initializer.h",
872 "app/android/chrome_jni_onload.cc",
873 "app/android/chrome_jni_onload.h",
874 "app/android/chrome_main_delegate_android.cc",
875 "app/android/chrome_main_delegate_android.h",
876 "app/chrome_main_delegate.cc",
877 "app/chrome_main_delegate.h",
880 include_dirs = [ android_ndk_include_dir ]
889 "//chrome/browser/ui",
894 "//components/enhanced_bookmarks",
895 "//content/public/app:both",
902 if (is_chrome_branded) {
903 name = "Google Chrome"
904 filename = "google-chrome"
905 confdir = "google-chrome"
908 filename = "chromium-browser"
912 script = "//chrome/tools/build/linux/sed.py"
913 infile = "app/resources/manpage.1.in"
918 outfile = "$root_out_dir/chrome.1"
924 rebase_path(infile, root_build_dir),
925 rebase_path(outfile, root_build_dir),
926 "-e s/@@NAME@@/$name/",
927 "-e s/@@FILENAME@@/$filename/",
928 "-e s/@@CONFDIR@@/$confdir/",
932 action("linux_symbols") {
933 script = "//build/linux/dump_app_syms.py"
935 dump_syms_label = "//breakpad:dump_syms($host_toolchain)"
937 get_label_info(dump_syms_label, "root_out_dir") + "/" + "dump_syms"
939 chrome_binary = "$root_out_dir/chrome"
940 if (current_cpu == "x86") {
941 # Use "ia32" instead of "x86" for GYP compat.
942 symbol_file = "$root_out_dir/chrome.breakpad.ia32"
944 symbol_file = "$root_out_dir/chrome.breakpad.$current_cpu"
956 "./" + rebase_path(dump_syms_binary, root_build_dir),
957 "0", # TODO(GYP) This is linux_strip_binary if it is needed.
958 rebase_path(chrome_binary, root_build_dir),
959 rebase_path(symbol_file, root_build_dir),
968 # Copies some scripts and resources that are used for desktop integration.
971 "//chrome/app/theme/$branding_path_component/product_logo_48.png",
972 "//chrome/tools/build/linux/chrome-wrapper",
973 "//third_party/xdg-utils/scripts/xdg-mime",
974 "//third_party/xdg-utils/scripts/xdg-settings",
977 "$root_out_dir/{{source_file_part}}",