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",
32 # TODO(GYP) mac_bundle_resources, xcode_settings
36 "//content/public/common/content_switches.cc",
37 "//content/public/common/content_switches.h",
38 "app/chrome_crash_reporter_client.cc",
39 "app/chrome_crash_reporter_client.h",
41 "app/chrome_exe_load_config_win.cc",
42 "app/chrome_exe_main_win.cc",
43 "app/chrome_watcher_client_win.cc",
44 "app/chrome_watcher_client_win.h",
45 "app/chrome_watcher_command_line_win.cc",
46 "app/chrome_watcher_command_line_win.h",
49 "app/kasko_client.cc",
51 "app/signature_validator_win.cc",
52 "app/signature_validator_win.h",
53 "common/crash_keys.cc",
54 "common/crash_keys.h",
57 if (is_component_build) {
58 # This is necessary to make content_switches compile without DLL
59 # linkage errors in a component build.
60 defines += [ "COMPILE_CONTENT_STATICALLY" ]
64 ":chrome_exe_version",
68 # 'chrome_nacl_win64" TODO(GYP) bug 512869
69 # '../win8/delegate_execute/delegate_execute.gyp:*', TODO(GYP) bug 512867
70 # '../win8/metro_driver/metro_driver.gyp:metro_driver', TODO(GYP) bug 512864
72 "//breakpad:breakpad_handler",
73 "//breakpad:breakpad_sender",
74 "//chrome/app/version_assembly:chrome_exe_manifest",
75 "//chrome/browser:chrome_process_finder",
76 "//chrome/chrome_watcher",
77 "//chrome/chrome_watcher:client",
78 "//chrome/installer/util",
80 "//components/browser_watcher:browser_watcher_client",
81 "//components/crash/app",
82 "//components/crash_keys",
83 "//content:startup_helper_win",
88 data_deps = [ "//chrome/app/version_assembly:version_assembly_manifest" ]
94 configs -= [ "//build/config/win:console" ]
95 configs += [ "//build/config/win:windowed" ]
96 } else if (use_aura) {
97 # Non-Windows aura entrypoint.
98 sources += [ "app/chrome_exe_main_aura.cc" ]
103 "app/chrome_dll_resource.h",
104 "app/chrome_main.cc",
105 "app/chrome_main_delegate.cc",
106 "app/chrome_main_delegate.h",
110 # On Linux, link the dependencies (libraries) that make up actual
111 # Chromium functionality directly into the executable.
112 ":browser_dependencies",
113 ":child_dependencies",
117 # Needed to use the master_preferences functions
118 "//chrome/installer/util",
119 "//content/public/app:both",
122 # Needed for chrome_main.cc initialization of libraries.
123 configs += [ "//build/config/linux:pangocairo" ]
125 # GYP has this in a 'profiling==0 and linux_disable_pie==0' condition.
126 # but GN doesn't have either of these flags.
131 "//build/config/linux:x11",
132 "//build/config/linux:xext",
138 sources += [ "app/chrome_exe_main_mac.cc" ]
139 # TODO(GYP) lots more stuff in the is_mac block.
141 # These files are used by the installer so we need a public dep.
143 ":packed_extra_resources",
147 "//components/startup_metric_utils",
149 # Precompiled plugins that need to get copied to the output directory.
150 # On Mac, internal plugins go inside the framework, so these
151 # dependencies are on chrome.dll.
152 "//third_party/adobe/flash:flapper_binaries",
153 "//third_party/widevine/cdm:widevinecdmadapter",
157 if (is_linux && enable_plugins) {
161 if (is_multi_dll_chrome) {
162 defines += [ "CHROME_MULTIPLE_DLL" ]
163 data_deps += [ ":chrome_child" ]
168 shared_library("main_dll") {
169 configs += [ "//build/config/compiler:wexit_time_destructors" ]
173 ":browser_dependencies",
177 output_name = "chrome"
180 "//base/win/dllmain.cc",
181 "app/chrome_command_ids.h",
183 "app/chrome_dll_resource.h",
184 "app/chrome_main.cc",
185 "app/chrome_main_delegate.cc",
186 "app/chrome_main_delegate.h",
187 "app/close_handle_hook_win.cc",
188 "app/close_handle_hook_win.h",
189 "app/delay_load_hook_win.cc",
190 "app/delay_load_hook_win.h",
194 ":chrome_dll_manifest",
195 ":chrome_dll_version",
196 "//base/trace_event/etw_manifest:chrome_events_win",
197 "//chrome/app/theme:chrome_unscaled_resources",
199 "//content/app/resources",
201 "//net:net_resources",
205 if (enable_configuration_policy) {
206 deps += [ "//components/policy" ]
208 if (current_cpu == "x86") {
209 # TODO(GYP) bug 512861: Lots of VCLinkerTool stuff on Windows.
210 #deps += [ 'chrome_user32_delay_imports' ] TODO(GYP)
213 # This is a large module that can't do incremental linking in some cases.
214 configs -= [ "//build/config/win:default_incremental_linking" ]
215 configs += [ "//build/config/win:default_large_module_incremental_linking" ]
217 # TODO(GYP) bug 512851: PGO.
221 deps += [ "//ui/compositor" ]
224 if (is_multi_dll_chrome) {
225 defines += [ "CHROME_MULTIPLE_DLL_BROWSER" ]
226 deps += [ "//content/public/app:browser" ]
229 ":child_dependencies",
230 "//content/public/app:both",
234 if (cld_version == 2) {
235 deps += [ "//third_party/cld_2" ]
239 #['OS=="mac" and component!="shared_library"', { TODO(GYP)
240 # 'includes': [ 'chrome_dll_bundle.gypi' ],
242 # TODO(GYP) Lots of other stuff in the OS=="mac" block.
245 if (enable_plugins && !is_multi_dll_chrome) {
250 if (is_multi_dll_chrome) {
251 # This manifest matches what GYP produces. It may not even be necessary.
252 windows_manifest("chrome_child_manifest") {
259 shared_library("chrome_child") {
261 "app/chrome_main.cc",
262 "app/chrome_main_delegate.cc",
263 "app/chrome_main_delegate.h",
264 "app/close_handle_hook_win.cc",
265 "app/close_handle_hook_win.h",
268 configs += [ "//build/config/compiler:wexit_time_destructors" ]
269 defines = [ "CHROME_MULTIPLE_DLL_CHILD" ]
272 ":child_dependencies",
273 ":chrome_child_manifest",
274 ":chrome_dll_version",
276 "//chrome/browser/policy:path_parser",
277 "//content/public/app:child",
281 # TODO(GYP) bug 512851: PGO on Windows.
282 # ['chrome_pgo_phase==1', {
285 # 'LinkTimeCodeGeneration': '2',
289 # ['chrome_pgo_phase==2', {
292 # 'LinkTimeCodeGeneration': '3',
297 if (enable_plugins) {
303 # GYP version: chromium_browser_dependencies variable in chrome.gyp
304 group("browser_dependencies") {
311 deps += [ "//ppapi/host" ]
314 if (enable_basic_printing || enable_print_preview) {
315 deps += [ "//printing" ]
316 if (enable_print_preview) {
317 deps += [ "//chrome/service" ]
322 # GYP version: chromium_child_dependencies variable in chrome.gyp
323 group("child_dependencies") {
330 "//chrome/browser/devtools",
335 "//content/public/child",
336 "//third_party/WebKit/public:blink_devtools_frontend_resources",
339 if (cld_version == 2) {
340 deps += [ "//third_party/cld_2:cld2_platform_impl" ]
344 deps += [ "//components/nacl/renderer/plugin:nacl_trusted_plugin" ]
349 # TODO(brettw) this duplicates "//chrome/common:version" which applies to
351 process_version("version_header") {
352 # TODO(brettW) this should have more reduced visibility, but chrome/browser
353 # currently depends on this.
354 #visibility = [ ":*" ]
356 # This one just uses the custom template and no separate sources.
358 template_file = "version.h.in"
360 # TODO(brettw) this should move to $target_gen_dir/version.h and
361 # source files including it should reference it via "chrome/version.h"
362 output = "$root_gen_dir/version.h"
365 process_version("chrome_exe_version") {
367 "app/chrome_exe.ver",
369 output = "$target_gen_dir/chrome_exe_version.rc"
372 process_version("chrome_dll_version") {
374 "app/chrome_dll.ver",
376 output = "$target_gen_dir/chrome_dll_version.rc"
379 # This manifest matches what GYP produces. It may not even be necessary.
380 windows_manifest("chrome_dll_manifest") {
383 common_controls_manifest,
388 process_version("nacl64_exe_version") {
390 "app/nacl64_exe.ver",
392 output = "$target_gen_dir/nacl64_exe_version.rc"
395 process_version("other_version") {
399 output = "$target_gen_dir/other_version.rc"
402 source_set("image_pre_reader") {
404 "app/image_pre_reader_win.cc",
405 "app/image_pre_reader_win.h",
413 # GYP version: chrome/chrome_resources.gyp:chrome_resources
416 # Note: GYP lists some dependencies in addition to these actions. However,
417 # these are just dependencies for the actions themselves, which our actions
418 # list individually when needed.
419 "//chrome/browser:resources",
420 "//chrome/common:resources",
421 "//chrome/renderer:resources",
424 if (enable_extensions) {
425 deps += [ "//chrome/common:extensions_api_resources" ]
429 # GYP version: chrome/chrome_resources.gyp:chrome_extra_resources
430 group("extra_resources") {
432 "//chrome/browser/resources:invalidations_resources",
433 "//chrome/browser/resources:memory_internals_resources",
434 "//chrome/browser/resources:net_internals_resources",
435 "//chrome/browser/resources:password_manager_internals_resources",
436 "//chrome/browser/resources:signin_internals_resources",
437 "//chrome/browser/resources:sync_internals_resources",
438 "//chrome/browser/resources:translate_internals_resources",
442 "//chrome/browser/resources:component_extension_resources",
443 "//chrome/browser/resources:options_resources",
444 "//chrome/browser/resources:settings_resources",
449 deps += [ "//chrome/browser/resources/chromeos/chromevox" ]
452 if (enable_extensions) {
454 "//chrome/browser/resources:quota_internals_resources",
455 "//chrome/browser/resources:sync_file_system_internals_resources",
460 if (is_chrome_branded) {
461 copy("default_apps") {
462 visibility = [ ":packed_resources" ]
464 "browser/resources/default_apps/docs.crx",
465 "browser/resources/default_apps/drive.crx",
466 "browser/resources/default_apps/external_extensions.json",
467 "browser/resources/default_apps/gmail.crx",
468 "browser/resources/default_apps/search.crx",
469 "browser/resources/default_apps/youtube.crx",
472 "$root_out_dir/default_apps/{{source_file_part}}",
477 group("packed_resources") {
479 ":repack_locales_pack",
480 ":repack_pseudo_locales_pack",
481 ":repack_chrome_100_percent",
484 if (is_chrome_branded) {
485 deps += [ ":default_apps" ]
489 deps += [ ":repack_chrome_200_percent" ]
492 if (enable_topchrome_md) {
493 deps += [ ":repack_chrome_material_100_percent" ]
496 deps += [ ":repack_chrome_material_200_percent" ]
501 repack("packed_extra_resources") {
502 visibility = [ "./*" ]
504 "$root_gen_dir/chrome/browser_resources.pak",
505 "$root_gen_dir/chrome/chrome_unscaled_resources.pak",
506 "$root_gen_dir/chrome/common_resources.pak",
507 "$root_gen_dir/chrome/invalidations_resources.pak",
508 "$root_gen_dir/chrome/memory_internals_resources.pak",
509 "$root_gen_dir/chrome/net_internals_resources.pak",
510 "$root_gen_dir/chrome/password_manager_internals_resources.pak",
511 "$root_gen_dir/chrome/signin_internals_resources.pak",
512 "$root_gen_dir/chrome/sync_internals_resources.pak",
513 "$root_gen_dir/chrome/translate_internals_resources.pak",
514 "$root_gen_dir/components/components_resources.pak",
515 "$root_gen_dir/net/net_resources.pak",
516 "$root_gen_dir/ui/resources/webui_resources.pak",
519 "//chrome/browser:resources",
520 "//chrome/app/theme:chrome_unscaled_resources",
521 "//chrome/common:resources",
522 "//chrome/browser/resources:invalidations_resources",
523 "//chrome/browser/resources:memory_internals_resources",
524 "//chrome/browser/resources:net_internals_resources",
525 "//chrome/browser/resources:password_manager_internals_resources",
526 "//chrome/browser/resources:signin_internals_resources",
527 "//chrome/browser/resources:sync_internals_resources",
528 "//chrome/browser/resources:translate_internals_resources",
529 "//components/resources",
530 "//net:net_resources",
534 if (!is_ios && !is_android) {
535 # New paks should be added here by default.
537 "$root_gen_dir/blink/devtools_resources.pak",
538 "$root_gen_dir/chrome/component_extension_resources.pak",
539 "$root_gen_dir/chrome/options_resources.pak",
540 "$root_gen_dir/chrome/quota_internals_resources.pak",
541 "$root_gen_dir/chrome/settings_resources.pak",
542 "$root_gen_dir/chrome/sync_file_system_internals_resources.pak",
543 "$root_gen_dir/chrome/webrtc_device_provider_resources.pak",
546 "//chrome/browser/devtools:webrtc_device_provider_resources",
547 "//chrome/browser/resources:component_extension_resources",
548 "//chrome/browser/resources:options_resources",
549 "//chrome/browser/resources:settings_resources",
550 "//chrome/browser/resources:quota_internals_resources",
551 "//chrome/browser/resources:sync_file_system_internals_resources",
552 "//content/browser/devtools:devtools_resources",
557 "$root_gen_dir/blink/public/resources/blink_resources.pak",
558 "$root_gen_dir/content/browser/tracing/tracing_resources.pak",
559 "$root_gen_dir/content/content_resources.pak",
562 "//content:resources",
563 "//content/browser/tracing:resources",
564 "//third_party/WebKit/public:resources",
568 sources += [ "$root_gen_dir/ui/file_manager/file_manager_resources.pak" ]
569 deps += [ "//ui/file_manager:resources" ]
571 if (enable_extensions) {
573 "$root_gen_dir/chrome/extensions_api_resources.pak",
574 "$root_gen_dir/extensions/extensions_renderer_resources.pak",
575 "$root_gen_dir/extensions/extensions_resources.pak",
578 "//chrome/common:extensions_api_resources",
579 "//extensions:extensions_resources",
583 # GYP outputs the file in the gen/repack directory. On non-Mac/iOS platforms
584 # it them copies it. This skipes the copy step and writes it to the final
586 if (is_mac || is_ios) {
587 output = "$root_gen_dir/repack/resources.pak"
589 output = "$root_out_dir/resources.pak"
593 # GYP version: chrome/chrome_resources.gyp:browser_tests_pak
594 repack("browser_tests_pak") {
596 "$root_gen_dir/chrome/options_test_resources.pak",
597 "$root_gen_dir/chrome/webui_test_resources.pak",
599 output = "$root_out_dir/browser_tests.pak"
601 "//chrome/browser/resources:options_test_resources",
602 "//chrome/test/data:webui_test_resources",
606 # Collects per-locale grit files from many sources into global per-locale files.
607 chrome_repack_locales("repack_locales_pack") {
608 visibility = [ ":*" ]
610 input_locales = locales
613 output_locales = locales_as_mac_outputs
615 output_locales = locales
619 chrome_repack_locales("repack_pseudo_locales_pack") {
620 visibility = [ ":*" ]
622 input_locales = [ "fake-bidi" ]
625 output_locales = [ "fake_bidi" ] # Mac uses underscores.
627 output_locales = [ "fake-bidi" ]
631 # Generates a rule to repack a set of resources, substituting a given string
632 # in for the percentage (e.g. "100", "200"). It generates the repacked files in
633 # the "gen" directory, and then introduces a copy rule to copy it to the root
636 # It's not clear why this two-step dance is necessary as opposed to just
637 # generating the file in the destination. However, this is what the GYP build
638 # does, and for maintenance purposes, this keeps the same files in the same
639 # place between the two builds when possible.
643 # String to substitute for the percentage.
644 template("chrome_repack_percent") {
645 percent = invoker.percent
647 repack_name = "${target_name}_repack"
648 repack_output_file = "$root_gen_dir/repack/chrome_${percent}_percent.pak"
650 copy_name = target_name
652 repack(repack_name) {
653 visibility = [ ":$copy_name" ]
655 # All sources should also have deps for completeness.
657 "$root_gen_dir/chrome/renderer_resources_${percent}_percent.pak",
658 "$root_gen_dir/chrome/theme_resources_${percent}_percent.pak",
659 "$root_gen_dir/components/components_resources_${percent}_percent.pak",
660 "$root_gen_dir/ui/resources/ui_resources_${percent}_percent.pak",
664 "//chrome/app/theme:theme_resources",
665 "//chrome/renderer:resources",
666 "//components/resources",
667 "//components/strings",
668 "//net:net_resources",
674 "$root_gen_dir/blink/public/resources/blink_image_resources_${percent}_percent.pak",
675 "$root_gen_dir/content/app/resources/content_resources_${percent}_percent.pak",
678 "//content/app/resources",
679 "//third_party/WebKit/public:image_resources",
684 [ "$root_gen_dir/ash/resources/ash_resources_${percent}_percent.pak" ]
685 deps += [ "//ash/resources" ]
688 sources += [ "$root_gen_dir/ui/views/resources/views_resources_${percent}_percent.pak" ]
689 deps += [ "//ui/views/resources" ]
692 sources += [ "$root_gen_dir/ui/chromeos/resources/ui_chromeos_resources_${percent}_percent.pak" ]
693 deps += [ "//ui/chromeos/resources" ]
695 if (enable_extensions) {
696 sources += [ "$root_gen_dir/extensions/extensions_browser_resources_${percent}_percent.pak" ]
697 deps += [ "//extensions:extensions_browser_resources" ]
699 if (enable_app_list) {
700 sources += [ "$root_gen_dir/ui/app_list/resources/app_list_resources_${percent}_percent.pak" ]
701 deps += [ "//ui/app_list/resources" ]
704 output = repack_output_file
708 visibility = [ ":*" ]
716 "$root_build_dir/chrome_${percent}_percent.pak",
721 chrome_repack_percent("repack_chrome_100_percent") {
726 chrome_repack_percent("repack_chrome_200_percent") {
731 # Generates a rule to repack a set of material design resources for the browser
732 # top chrome, substituting a given string in for the percentage (e.g. "100",
734 template("chrome_repack_material_percent") {
735 percent = invoker.percent
737 repack_name = "${target_name}_repack"
739 "$root_gen_dir/repack/chrome_material_${percent}_percent.pak"
741 copy_name = target_name
743 repack(repack_name) {
744 visibility = [ ":$copy_name" ]
746 # All sources should also have deps for completeness.
748 "$root_gen_dir/chrome/theme_resources_material_${percent}_percent.pak",
749 "$root_gen_dir/components/components_resources_material_${percent}_percent.pak",
753 "//chrome/app/theme:theme_resources",
754 "//components/resources",
757 output = repack_output_file
761 visibility = [ ":*" ]
769 "$root_build_dir/chrome_material_${percent}_percent.pak",
774 if (enable_topchrome_md) {
775 chrome_repack_material_percent("repack_chrome_material_100_percent") {
780 chrome_repack_material_percent("repack_chrome_material_200_percent") {
786 # GYP version: chrome/chrome_resources.gyp:chrome_strings
789 "//chrome/app:chromium_strings",
790 "//chrome/app:generated_resources",
791 "//chrome/app:google_chrome_strings",
792 "//chrome/app/resources:locale_settings",
797 # GYP: //chrome/chrome.gyp:content_setting_java
798 java_cpp_enum("content_setting_javagen") {
800 "../components/content_settings/core/common/content_settings.h",
803 "org/chromium/chrome/browser/ContentSetting.java",
807 # GYP: //chrome/chrome.gyp:content_settings_type_java
808 java_cpp_enum("content_settings_type_javagen") {
810 "../components/content_settings/core/common/content_settings_types.h",
813 "org/chromium/chrome/browser/ContentSettingsType.java",
817 # GYP: //chrome/chrome.gyp:page_info_connection_type_java
818 java_cpp_enum("page_info_connection_type_javagen") {
820 "browser/ui/android/website_settings_popup_android.h",
823 "org/chromium/chrome/browser/PageInfoConnectionType.java",
827 # GYP: //chrome/chrome_android.gypi:chrome_android_core
828 static_library("chrome_android_core") {
830 "app/android/chrome_android_initializer.cc",
831 "app/android/chrome_android_initializer.h",
832 "app/android/chrome_jni_onload.cc",
833 "app/android/chrome_jni_onload.h",
834 "app/android/chrome_main_delegate_android.cc",
835 "app/android/chrome_main_delegate_android.h",
836 "app/chrome_main_delegate.cc",
837 "app/chrome_main_delegate.h",
840 include_dirs = [ android_ndk_include_dir ]
849 "//chrome/browser/ui",
854 "//components/enhanced_bookmarks",
855 "//content/public/app:both",
862 if (is_chrome_branded) {
863 name = "Google Chrome"
864 filename = "google-chrome"
865 confdir = "google-chrome"
868 filename = "chromium-browser"
872 script = "//chrome/tools/build/linux/sed.py"
873 infile = "app/resources/manpage.1.in"
878 outfile = "$root_out_dir/chrome.1"
884 rebase_path(infile, root_build_dir),
885 rebase_path(outfile, root_build_dir),
886 "-e s/@@NAME@@/$name/",
887 "-e s/@@FILENAME@@/$filename/",
888 "-e s/@@CONFDIR@@/$confdir/",
892 action("linux_symbols") {
893 script = "//build/linux/dump_app_syms.py"
895 dump_syms_label = "//breakpad:dump_syms($host_toolchain)"
897 get_label_info(dump_syms_label, "root_out_dir") + "/" + "dump_syms"
899 chrome_binary = "$root_out_dir/chrome"
900 if (current_cpu == "x86") {
901 # Use "ia32" instead of "x86" for GYP compat.
902 symbol_file = "$root_out_dir/chrome.breakpad.ia32"
904 symbol_file = "$root_out_dir/chrome.breakpad.$current_cpu"
916 "./" + rebase_path(dump_syms_binary, root_build_dir),
917 "0", # TODO(GYP) This is linux_strip_binary if it is needed.
918 rebase_path(chrome_binary, root_build_dir),
919 rebase_path(symbol_file, root_build_dir),