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 "$root_out_dir/resources.pak",
34 if (is_linux || is_win) {
36 "$root_out_dir/chrome_100_percent.pak",
37 "$root_out_dir/locales/en-US.pak",
38 "$root_out_dir/locales/fr.pak",
42 if (is_win || (is_linux && target_cpu == "x64")) {
44 # TODO(GYP): Enable this when the IRT is in the right location.
45 # "$root_out_dir/nacl_irt_x86_64.nexe"
47 } else if (is_linux && target_cpu == "arm") {
49 # TODO(GYP): same comment
50 # "$root_out_dir/nacl_irt_arm.nexe"
57 # TODO(GYP) mac_bundle_resources, xcode_settings
61 "//content/public/common/content_switches.cc",
62 "//content/public/common/content_switches.h",
63 "app/chrome_crash_reporter_client.cc",
64 "app/chrome_crash_reporter_client.h",
66 "app/chrome_exe_load_config_win.cc",
67 "app/chrome_exe_main_win.cc",
68 "app/chrome_watcher_client_win.cc",
69 "app/chrome_watcher_client_win.h",
70 "app/chrome_watcher_command_line_win.cc",
71 "app/chrome_watcher_command_line_win.h",
74 "app/kasko_client.cc",
76 "app/signature_validator_win.cc",
77 "app/signature_validator_win.h",
78 "common/crash_keys.cc",
79 "common/crash_keys.h",
82 if (is_component_build) {
83 # This is necessary to make content_switches compile without DLL
84 # linkage errors in a component build.
85 defines += [ "COMPILE_CONTENT_STATICALLY" ]
89 ":chrome_exe_version",
93 # 'chrome_nacl_win64" TODO(GYP) bug 512869
94 # '../win8/delegate_execute/delegate_execute.gyp:*', TODO(GYP) bug 512867
95 # '../win8/metro_driver/metro_driver.gyp:metro_driver', TODO(GYP) bug 512864
97 "//breakpad:breakpad_handler",
98 "//breakpad:breakpad_sender",
99 "//chrome/app/version_assembly:chrome_exe_manifest",
100 "//chrome/browser:chrome_process_finder",
101 "//chrome/chrome_watcher",
102 "//chrome/chrome_watcher:client",
103 "//chrome/installer/util",
105 "//components/browser_watcher:browser_watcher_client",
106 "//components/crash/app",
107 "//components/crash_keys",
108 "//content:startup_helper_win",
113 data_deps = [ "//chrome/app/version_assembly:version_assembly_manifest" ]
119 configs -= [ "//build/config/win:console" ]
120 configs += [ "//build/config/win:windowed" ]
121 } else if (use_aura) {
122 # Non-Windows aura entrypoint.
123 sources += [ "app/chrome_exe_main_aura.cc" ]
128 "app/chrome_dll_resource.h",
129 "app/chrome_main.cc",
130 "app/chrome_main_delegate.cc",
131 "app/chrome_main_delegate.h",
135 # On Linux, link the dependencies (libraries) that make up actual
136 # Chromium functionality directly into the executable.
137 ":browser_dependencies",
138 ":child_dependencies",
142 # Needed to use the master_preferences functions
143 "//chrome/installer/util",
144 "//content/public/app:both",
147 # Needed for chrome_main.cc initialization of libraries.
148 configs += [ "//build/config/linux:pangocairo" ]
150 # GYP has this in a 'profiling==0 and linux_disable_pie==0' condition.
151 # but GN doesn't have either of these flags.
156 "//build/config/linux:x11",
157 "//build/config/linux:xext",
163 sources += [ "app/chrome_exe_main_mac.cc" ]
164 # TODO(GYP) lots more stuff in the is_mac block.
166 # These files are used by the installer so we need a public dep.
168 ":packed_extra_resources",
172 "//components/startup_metric_utils",
174 # Precompiled plugins that need to get copied to the output directory.
175 # On Mac, internal plugins go inside the framework, so these
176 # dependencies are on chrome.dll.
177 "//third_party/adobe/flash:flapper_binaries",
178 "//third_party/widevine/cdm:widevinecdmadapter",
182 if (is_linux && enable_plugins) {
186 if (is_multi_dll_chrome) {
187 defines += [ "CHROME_MULTIPLE_DLL" ]
188 data_deps += [ ":chrome_child" ]
193 shared_library("main_dll") {
194 configs += [ "//build/config/compiler:wexit_time_destructors" ]
198 ":browser_dependencies",
202 output_name = "chrome"
205 "//base/win/dllmain.cc",
206 "app/chrome_command_ids.h",
208 "app/chrome_dll_resource.h",
209 "app/chrome_main.cc",
210 "app/chrome_main_delegate.cc",
211 "app/chrome_main_delegate.h",
212 "app/close_handle_hook_win.cc",
213 "app/close_handle_hook_win.h",
214 "app/delay_load_hook_win.cc",
215 "app/delay_load_hook_win.h",
219 ":chrome_dll_manifest",
220 ":chrome_dll_version",
221 "//base/trace_event/etw_manifest:chrome_events_win",
222 "//chrome/app/theme:chrome_unscaled_resources",
224 "//content/app/resources",
226 "//net:net_resources",
230 if (enable_configuration_policy) {
231 deps += [ "//components/policy" ]
233 if (current_cpu == "x86") {
234 # TODO(GYP) bug 512861: Lots of VCLinkerTool stuff on Windows.
235 #deps += [ 'chrome_user32_delay_imports' ] TODO(GYP)
238 # This is a large module that can't do incremental linking in some cases.
239 configs -= [ "//build/config/win:default_incremental_linking" ]
240 configs += [ "//build/config/win:default_large_module_incremental_linking" ]
242 # TODO(GYP) bug 512851: PGO.
246 deps += [ "//ui/compositor" ]
249 if (is_multi_dll_chrome) {
250 defines += [ "CHROME_MULTIPLE_DLL_BROWSER" ]
251 deps += [ "//content/public/app:browser" ]
254 ":child_dependencies",
255 "//content/public/app:both",
259 if (cld_version == 2) {
260 deps += [ "//third_party/cld_2" ]
264 #['OS=="mac" and component!="shared_library"', { TODO(GYP)
265 # 'includes': [ 'chrome_dll_bundle.gypi' ],
267 # TODO(GYP) Lots of other stuff in the OS=="mac" block.
270 if (enable_plugins && !is_multi_dll_chrome) {
275 if (is_multi_dll_chrome) {
276 # This manifest matches what GYP produces. It may not even be necessary.
277 windows_manifest("chrome_child_manifest") {
284 shared_library("chrome_child") {
286 "app/chrome_main.cc",
287 "app/chrome_main_delegate.cc",
288 "app/chrome_main_delegate.h",
289 "app/close_handle_hook_win.cc",
290 "app/close_handle_hook_win.h",
293 configs += [ "//build/config/compiler:wexit_time_destructors" ]
294 defines = [ "CHROME_MULTIPLE_DLL_CHILD" ]
297 ":child_dependencies",
298 ":chrome_child_manifest",
299 ":chrome_dll_version",
301 "//chrome/browser/policy:path_parser",
302 "//content/public/app:child",
306 # TODO(GYP) bug 512851: PGO on Windows.
307 # ['chrome_pgo_phase==1', {
310 # 'LinkTimeCodeGeneration': '2',
314 # ['chrome_pgo_phase==2', {
317 # 'LinkTimeCodeGeneration': '3',
322 if (enable_plugins) {
328 # GYP version: chromium_browser_dependencies variable in chrome.gyp
329 group("browser_dependencies") {
336 deps += [ "//ppapi/host" ]
339 if (enable_basic_printing || enable_print_preview) {
340 deps += [ "//printing" ]
341 if (enable_print_preview) {
342 deps += [ "//chrome/service" ]
347 # GYP version: chromium_child_dependencies variable in chrome.gyp
348 group("child_dependencies") {
355 "//chrome/browser/devtools",
360 "//content/public/child",
361 "//third_party/WebKit/public:blink_devtools_frontend_resources",
364 if (cld_version == 2) {
365 deps += [ "//third_party/cld_2:cld2_platform_impl" ]
369 deps += [ "//components/nacl/renderer/plugin:nacl_trusted_plugin" ]
374 # TODO(brettw) this duplicates "//chrome/common:version" which applies to
376 process_version("version_header") {
377 # TODO(brettW) this should have more reduced visibility, but chrome/browser
378 # currently depends on this.
379 #visibility = [ ":*" ]
381 # This one just uses the custom template and no separate sources.
383 template_file = "version.h.in"
385 # TODO(brettw) this should move to $target_gen_dir/version.h and
386 # source files including it should reference it via "chrome/version.h"
387 output = "$root_gen_dir/version.h"
390 process_version("chrome_exe_version") {
392 "app/chrome_exe.ver",
394 output = "$target_gen_dir/chrome_exe_version.rc"
397 process_version("chrome_dll_version") {
399 "app/chrome_dll.ver",
401 output = "$target_gen_dir/chrome_dll_version.rc"
404 # This manifest matches what GYP produces. It may not even be necessary.
405 windows_manifest("chrome_dll_manifest") {
408 common_controls_manifest,
413 process_version("nacl64_exe_version") {
415 "app/nacl64_exe.ver",
417 output = "$target_gen_dir/nacl64_exe_version.rc"
420 process_version("other_version") {
424 output = "$target_gen_dir/other_version.rc"
427 source_set("image_pre_reader") {
429 "app/image_pre_reader_win.cc",
430 "app/image_pre_reader_win.h",
438 # GYP version: chrome/chrome_resources.gyp:chrome_resources
441 # Note: GYP lists some dependencies in addition to these actions. However,
442 # these are just dependencies for the actions themselves, which our actions
443 # list individually when needed.
444 "//chrome/browser:resources",
445 "//chrome/common:resources",
446 "//chrome/renderer:resources",
449 if (enable_extensions) {
450 deps += [ "//chrome/common:extensions_api_resources" ]
454 # GYP version: chrome/chrome_resources.gyp:chrome_extra_resources
455 group("extra_resources") {
457 "//chrome/browser/resources:invalidations_resources",
458 "//chrome/browser/resources:memory_internals_resources",
459 "//chrome/browser/resources:net_internals_resources",
460 "//chrome/browser/resources:password_manager_internals_resources",
461 "//chrome/browser/resources:signin_internals_resources",
462 "//chrome/browser/resources:sync_internals_resources",
463 "//chrome/browser/resources:translate_internals_resources",
467 "//chrome/browser/resources:component_extension_resources",
468 "//chrome/browser/resources:options_resources",
469 "//chrome/browser/resources:settings_resources",
474 deps += [ "//chrome/browser/resources/chromeos/chromevox" ]
477 if (enable_extensions) {
479 "//chrome/browser/resources:quota_internals_resources",
480 "//chrome/browser/resources:sync_file_system_internals_resources",
485 if (is_chrome_branded) {
486 copy("default_apps") {
487 visibility = [ ":packed_resources" ]
489 "browser/resources/default_apps/docs.crx",
490 "browser/resources/default_apps/drive.crx",
491 "browser/resources/default_apps/external_extensions.json",
492 "browser/resources/default_apps/gmail.crx",
493 "browser/resources/default_apps/search.crx",
494 "browser/resources/default_apps/youtube.crx",
497 "$root_out_dir/default_apps/{{source_file_part}}",
502 group("packed_resources") {
504 ":repack_locales_pack",
505 ":repack_pseudo_locales_pack",
506 ":repack_chrome_100_percent",
509 if (is_chrome_branded) {
510 deps += [ ":default_apps" ]
514 deps += [ ":repack_chrome_200_percent" ]
517 if (enable_topchrome_md) {
518 deps += [ ":repack_chrome_material_100_percent" ]
521 deps += [ ":repack_chrome_material_200_percent" ]
526 repack("packed_extra_resources") {
527 visibility = [ "./*" ]
529 "$root_gen_dir/chrome/browser_resources.pak",
530 "$root_gen_dir/chrome/chrome_unscaled_resources.pak",
531 "$root_gen_dir/chrome/common_resources.pak",
532 "$root_gen_dir/chrome/invalidations_resources.pak",
533 "$root_gen_dir/chrome/memory_internals_resources.pak",
534 "$root_gen_dir/chrome/net_internals_resources.pak",
535 "$root_gen_dir/chrome/password_manager_internals_resources.pak",
536 "$root_gen_dir/chrome/signin_internals_resources.pak",
537 "$root_gen_dir/chrome/sync_internals_resources.pak",
538 "$root_gen_dir/chrome/translate_internals_resources.pak",
539 "$root_gen_dir/components/components_resources.pak",
540 "$root_gen_dir/net/net_resources.pak",
541 "$root_gen_dir/ui/resources/webui_resources.pak",
544 "//chrome/browser:resources",
545 "//chrome/app/theme:chrome_unscaled_resources",
546 "//chrome/common:resources",
547 "//chrome/browser/resources:invalidations_resources",
548 "//chrome/browser/resources:memory_internals_resources",
549 "//chrome/browser/resources:net_internals_resources",
550 "//chrome/browser/resources:password_manager_internals_resources",
551 "//chrome/browser/resources:signin_internals_resources",
552 "//chrome/browser/resources:sync_internals_resources",
553 "//chrome/browser/resources:translate_internals_resources",
554 "//components/resources",
555 "//net:net_resources",
559 if (!is_ios && !is_android) {
560 # New paks should be added here by default.
562 "$root_gen_dir/blink/devtools_resources.pak",
563 "$root_gen_dir/chrome/component_extension_resources.pak",
564 "$root_gen_dir/chrome/options_resources.pak",
565 "$root_gen_dir/chrome/quota_internals_resources.pak",
566 "$root_gen_dir/chrome/settings_resources.pak",
567 "$root_gen_dir/chrome/sync_file_system_internals_resources.pak",
568 "$root_gen_dir/chrome/webrtc_device_provider_resources.pak",
571 "//chrome/browser/devtools:webrtc_device_provider_resources",
572 "//chrome/browser/resources:component_extension_resources",
573 "//chrome/browser/resources:options_resources",
574 "//chrome/browser/resources:settings_resources",
575 "//chrome/browser/resources:quota_internals_resources",
576 "//chrome/browser/resources:sync_file_system_internals_resources",
577 "//content/browser/devtools:devtools_resources",
582 "$root_gen_dir/blink/public/resources/blink_resources.pak",
583 "$root_gen_dir/content/browser/tracing/tracing_resources.pak",
584 "$root_gen_dir/content/content_resources.pak",
587 "//content:resources",
588 "//content/browser/tracing:resources",
589 "//third_party/WebKit/public:resources",
593 sources += [ "$root_gen_dir/ui/file_manager/file_manager_resources.pak" ]
594 deps += [ "//ui/file_manager:resources" ]
596 if (enable_extensions) {
598 "$root_gen_dir/chrome/extensions_api_resources.pak",
599 "$root_gen_dir/extensions/extensions_renderer_resources.pak",
600 "$root_gen_dir/extensions/extensions_resources.pak",
603 "//chrome/common:extensions_api_resources",
604 "//extensions:extensions_resources",
608 # GYP outputs the file in the gen/repack directory. On non-Mac/iOS platforms
609 # it them copies it. This skipes the copy step and writes it to the final
611 if (is_mac || is_ios) {
612 output = "$root_gen_dir/repack/resources.pak"
614 output = "$root_out_dir/resources.pak"
618 # GYP version: chrome/chrome_resources.gyp:browser_tests_pak
619 repack("browser_tests_pak") {
621 "$root_gen_dir/chrome/options_test_resources.pak",
622 "$root_gen_dir/chrome/webui_test_resources.pak",
624 output = "$root_out_dir/browser_tests.pak"
626 "//chrome/browser/resources:options_test_resources",
627 "//chrome/test/data:webui_test_resources",
631 # Collects per-locale grit files from many sources into global per-locale files.
632 chrome_repack_locales("repack_locales_pack") {
633 visibility = [ ":*" ]
635 input_locales = locales
638 output_locales = locales_as_mac_outputs
640 output_locales = locales
644 chrome_repack_locales("repack_pseudo_locales_pack") {
645 visibility = [ ":*" ]
647 input_locales = [ "fake-bidi" ]
650 output_locales = [ "fake_bidi" ] # Mac uses underscores.
652 output_locales = [ "fake-bidi" ]
656 # Generates a rule to repack a set of resources, substituting a given string
657 # in for the percentage (e.g. "100", "200"). It generates the repacked files in
658 # the "gen" directory, and then introduces a copy rule to copy it to the root
661 # It's not clear why this two-step dance is necessary as opposed to just
662 # generating the file in the destination. However, this is what the GYP build
663 # does, and for maintenance purposes, this keeps the same files in the same
664 # place between the two builds when possible.
668 # String to substitute for the percentage.
669 template("chrome_repack_percent") {
670 percent = invoker.percent
672 repack_name = "${target_name}_repack"
673 repack_output_file = "$root_gen_dir/repack/chrome_${percent}_percent.pak"
675 copy_name = target_name
677 repack(repack_name) {
678 visibility = [ ":$copy_name" ]
680 # All sources should also have deps for completeness.
682 "$root_gen_dir/chrome/renderer_resources_${percent}_percent.pak",
683 "$root_gen_dir/chrome/theme_resources_${percent}_percent.pak",
684 "$root_gen_dir/components/components_resources_${percent}_percent.pak",
685 "$root_gen_dir/ui/resources/ui_resources_${percent}_percent.pak",
689 "//chrome/app/theme:theme_resources",
690 "//chrome/renderer:resources",
691 "//components/resources",
692 "//components/strings",
693 "//net:net_resources",
699 "$root_gen_dir/blink/public/resources/blink_image_resources_${percent}_percent.pak",
700 "$root_gen_dir/content/app/resources/content_resources_${percent}_percent.pak",
703 "//content/app/resources",
704 "//third_party/WebKit/public:image_resources",
709 [ "$root_gen_dir/ash/resources/ash_resources_${percent}_percent.pak" ]
710 deps += [ "//ash/resources" ]
713 sources += [ "$root_gen_dir/ui/views/resources/views_resources_${percent}_percent.pak" ]
714 deps += [ "//ui/views/resources" ]
717 sources += [ "$root_gen_dir/ui/chromeos/resources/ui_chromeos_resources_${percent}_percent.pak" ]
718 deps += [ "//ui/chromeos/resources" ]
720 if (enable_extensions) {
721 sources += [ "$root_gen_dir/extensions/extensions_browser_resources_${percent}_percent.pak" ]
722 deps += [ "//extensions:extensions_browser_resources" ]
724 if (enable_app_list) {
725 sources += [ "$root_gen_dir/ui/app_list/resources/app_list_resources_${percent}_percent.pak" ]
726 deps += [ "//ui/app_list/resources" ]
729 output = repack_output_file
733 visibility = [ ":*" ]
741 "$root_build_dir/chrome_${percent}_percent.pak",
746 chrome_repack_percent("repack_chrome_100_percent") {
751 chrome_repack_percent("repack_chrome_200_percent") {
756 # Generates a rule to repack a set of material design resources for the browser
757 # top chrome, substituting a given string in for the percentage (e.g. "100",
759 template("chrome_repack_material_percent") {
760 percent = invoker.percent
762 repack_name = "${target_name}_repack"
764 "$root_gen_dir/repack/chrome_material_${percent}_percent.pak"
766 copy_name = target_name
768 repack(repack_name) {
769 visibility = [ ":$copy_name" ]
771 # All sources should also have deps for completeness.
773 "$root_gen_dir/chrome/theme_resources_material_${percent}_percent.pak",
774 "$root_gen_dir/components/components_resources_material_${percent}_percent.pak",
778 "//chrome/app/theme:theme_resources",
779 "//components/resources",
782 output = repack_output_file
786 visibility = [ ":*" ]
794 "$root_build_dir/chrome_material_${percent}_percent.pak",
799 if (enable_topchrome_md) {
800 chrome_repack_material_percent("repack_chrome_material_100_percent") {
805 chrome_repack_material_percent("repack_chrome_material_200_percent") {
811 # GYP version: chrome/chrome_resources.gyp:chrome_strings
814 "//chrome/app:chromium_strings",
815 "//chrome/app:generated_resources",
816 "//chrome/app:google_chrome_strings",
817 "//chrome/app/resources:locale_settings",
822 # GYP: //chrome/chrome.gyp:content_setting_java
823 java_cpp_enum("content_setting_javagen") {
825 "../components/content_settings/core/common/content_settings.h",
828 "org/chromium/chrome/browser/ContentSetting.java",
832 # GYP: //chrome/chrome.gyp:content_settings_type_java
833 java_cpp_enum("content_settings_type_javagen") {
835 "../components/content_settings/core/common/content_settings_types.h",
838 "org/chromium/chrome/browser/ContentSettingsType.java",
842 # GYP: //chrome/chrome.gyp:page_info_connection_type_java
843 java_cpp_enum("page_info_connection_type_javagen") {
845 "browser/ui/android/website_settings_popup_android.h",
848 "org/chromium/chrome/browser/PageInfoConnectionType.java",
852 # GYP: //chrome/chrome_android.gypi:chrome_android_core
853 static_library("chrome_android_core") {
855 "app/android/chrome_android_initializer.cc",
856 "app/android/chrome_android_initializer.h",
857 "app/android/chrome_jni_onload.cc",
858 "app/android/chrome_jni_onload.h",
859 "app/android/chrome_main_delegate_android.cc",
860 "app/android/chrome_main_delegate_android.h",
861 "app/chrome_main_delegate.cc",
862 "app/chrome_main_delegate.h",
865 include_dirs = [ android_ndk_include_dir ]
874 "//chrome/browser/ui",
879 "//components/enhanced_bookmarks",
880 "//content/public/app:both",
887 if (is_chrome_branded) {
888 name = "Google Chrome"
889 filename = "google-chrome"
890 confdir = "google-chrome"
893 filename = "chromium-browser"
897 script = "//chrome/tools/build/linux/sed.py"
898 infile = "app/resources/manpage.1.in"
903 outfile = "$root_out_dir/chrome.1"
909 rebase_path(infile, root_build_dir),
910 rebase_path(outfile, root_build_dir),
911 "-e s/@@NAME@@/$name/",
912 "-e s/@@FILENAME@@/$filename/",
913 "-e s/@@CONFDIR@@/$confdir/",
917 action("linux_symbols") {
918 script = "//build/linux/dump_app_syms.py"
920 dump_syms_label = "//breakpad:dump_syms($host_toolchain)"
922 get_label_info(dump_syms_label, "root_out_dir") + "/" + "dump_syms"
924 chrome_binary = "$root_out_dir/chrome"
925 if (current_cpu == "x86") {
926 # Use "ia32" instead of "x86" for GYP compat.
927 symbol_file = "$root_out_dir/chrome.breakpad.ia32"
929 symbol_file = "$root_out_dir/chrome.breakpad.$current_cpu"
941 "./" + rebase_path(dump_syms_binary, root_build_dir),
942 "0", # TODO(GYP) This is linux_strip_binary if it is needed.
943 rebase_path(chrome_binary, root_build_dir),
944 rebase_path(symbol_file, root_build_dir),