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/features.gni")
6 import("//build/config/locales.gni")
7 import("//build/config/ui.gni")
8 import("//chrome/chrome_repack_locales.gni")
9 import("//chrome/version.gni")
12 import("//build/config/android/rules.gni")
16 # TODO(GYP) for Windows need to the the reorder-imports step which probably
17 # means adding another target and renaming this to chrome_initial like in GYP.
18 executable("chrome") {
19 # Because the sources list varies so significantly per-platform, generally
20 # each platform lists its own files rather than relying on filtering or
21 # removing unused files.
23 "app/chrome_exe_resource.h",
29 # TODO(GYP) mac_bundle_resources, xcode_settings
31 # TODO(GYP) order_profiling, order_text_section
35 "$target_gen_dir/chrome_exe_version.rc",
36 "//content/app/startup_helper_win.cc",
37 "//content/public/common/content_switches.cc",
38 "app/chrome_crash_reporter_client.cc",
39 "app/chrome_crash_reporter_client.h",
41 "app/chrome_exe_main_win.cc",
42 "app/chrome_watcher_client_win.cc",
43 "app/chrome_watcher_client_win.h",
44 "app/chrome_watcher_command_line_win.cc",
45 "app/chrome_watcher_command_line_win.h",
48 "app/kasko_client.cc",
50 "app/signature_validator_win.cc",
51 "app/signature_validator_win.h",
52 "common/crash_keys.cc",
53 "common/crash_keys.h'",
56 if (is_component_build) {
57 # This is necessary to make content_switches compile without DLL
58 # linkage errors in a component build.
59 defines += [ "COMPILE_CONTENT_STATICALLY" ]
63 ":chrome_version_resources",
67 # 'chrome_nacl_win64" TODO(GYP)
68 # '../win8/delegate_execute/delegate_execute.gyp:*', TODO(GYP)
69 # '../win8/metro_driver/metro_driver.gyp:metro_driver', TODO(GYP)
71 "//breakpad:breakpad_handler",
72 "//breakpad:breakpad_sender",
73 "//chrome/browser:chrome_process_finder",
74 "//chrome/chrome_watcher",
75 "//chrome/chrome_watcher:client",
76 "//chrome/installer/util",
78 "//components/browser_watcher:browser_watcher_client",
79 "//components/crash/app",
88 configs -= [ "//build/config/win:console" ]
89 configs += [ "//build/config/win:windowed" ]
90 } else if (use_aura) {
91 # Non-Windows aura entrypoint.
92 sources += [ "app/chrome_exe_main_aura.cc" ]
97 "app/chrome_dll_resource.h",
99 "app/chrome_main_delegate.cc",
100 "app/chrome_main_delegate.h",
104 # On Linux, link the dependencies (libraries) that make up actual
105 # Chromium functionality directly into the executable.
106 ":browser_dependencies",
107 ":child_dependencies",
111 # Needed to use the master_preferences functions
112 "//chrome/installer/util",
113 "//content/public/app:both",
116 # Needed for chrome_main.cc initialization of libraries.
117 configs += [ "//build/config/linux:pangocairo" ]
119 # TODO(GYP) ['profiling==0 and linux_disable_pie==0', {
127 "//build/config/linux:x11",
128 "//build/config/linux:xext",
134 sources += [ "app/chrome_exe_main_mac.cc" ]
135 # TODO(GYP) lots more stuff in the is_mac block.
138 ":packed_extra_resources",
140 "//components/startup_metric_utils",
142 # Precompiled plugins that need to get copied to the output directory.
143 # On Mac, internal plugins go inside the framework, so these
144 # dependencies are on chrome.dll.
145 "//third_party/adobe/flash:flapper_binaries",
146 "//third_party/widevine/cdm:adapter",
148 # TODO(GYP) some stuff from GYP including chrome_multiple_dll.
151 if (is_linux && enable_plugins) {
157 shared_library("main_dll") {
158 configs += [ "//build/config/compiler:wexit_time_destructors" ]
161 ":browser_dependencies",
165 output_name = "chrome"
168 "//base/win/dllmain.cc",
169 "app/chrome_command_ids.h",
171 "app/chrome_dll_resource.h",
172 "app/chrome_main.cc",
173 "app/chrome_main_delegate.cc",
174 "app/chrome_main_delegate.h",
175 "app/close_handle_hook_win.cc",
176 "app/close_handle_hook_win.h",
177 "app/delay_load_hook_win.cc",
178 "app/delay_load_hook_win.h",
182 # On Windows, link the dependencies (libraries) that make up actual
183 # Chromium functionality into this .dll.
184 ":chrome_version_resources",
185 "//chrome/app/theme:chrome_unscaled_resources",
187 "//content/app/resources",
189 "//net:net_resources",
193 if (enable_configuration_policy) {
194 deps += [ "//components/policy" ]
196 if (current_cpu == "x86") {
197 # Add a dependency to custom import library for user32 delay imports only
199 #deps += [ 'chrome_user32_delay_imports' ] TODO(GYP)
202 # This is a large module that can't do incremental linking in some cases.
203 configs -= [ "//build/config/win:default_incremental_linking" ]
204 configs += [ "//build/config/win:default_large_module_incremental_linking" ]
206 # TODO(GYP) Lots of VCLinkerTool stuff on Windows.
208 # TODO(GYP) chrome_pgo_phase on Windows.
212 deps += [ "//ui/compositor" ]
215 #TODO(GYP) add chrome_multiple_dll support
216 if (false) { #chrome_multiple_dll) {
217 defines += [ "CHROME_MULTIPLE_DLL_BROWSER" ]
218 deps += [ "//content/public/app:browser" ]
221 ":child_dependencies",
222 "//content/public/app:both",
226 if (cld_version == 0 || cld_version == 2) {
227 deps += [ "//third_party/cld_2" ]
231 #['OS=="mac" and component!="shared_library"', { TODO(GYP)
232 # 'includes': [ 'chrome_dll_bundle.gypi' ],
234 # TODO(GYP) Lots of other stuff in the OS=="mac" block.
237 if (enable_plugins) {
242 # GYP version: chromium_browser_dependencies variable in chrome.gyp
243 group("browser_dependencies") {
250 deps += [ "//ppapi/host" ]
253 if (enable_basic_printing || enable_print_preview) {
254 deps += [ "//printing" ]
255 if (enable_print_preview) {
256 deps += [ "//chrome/service" ]
261 # GYP version: chromium_child_dependencies variable in chrome.gyp
262 group("child_dependencies") {
269 "//chrome/browser/devtools",
274 "//content/public/child",
275 "//third_party/WebKit/public:blink_devtools_frontend_resources",
278 if (cld_version == 0 || cld_version == 2) {
279 deps += [ "//third_party/cld_2:cld2_platform_impl" ]
283 deps += [ "//components/nacl/renderer/plugin:nacl_trusted_plugin" ]
285 if (enable_remoting) {
286 deps += [ "//remoting/client/plugin" ]
291 # TODO(brettw) this duplicates "//chrome/common:version" which applies to
293 process_version("version_header") {
294 # TODO(brettW) this should have more reduced visibility, but chrome/browser
295 # currently depends on this.
296 #visibility = [ ":*" ]
298 # This one just uses the custom template and no separate sources.
300 template_file = "version.h.in"
302 # TODO(brettw) this should move to $target_gen_dir/version.h and
303 # source files including it should reference it via "chrome/version.h"
304 output = "$root_gen_dir/version.h"
307 process_version("chrome_exe_version") {
309 "app/chrome_exe.ver",
311 output = "$target_gen_dir/chrome_exe_version.rc"
314 process_version("chrome_dll_version") {
316 "app/chrome_dll.ver",
318 output = "$target_gen_dir/chrome_dll_version.rc"
321 process_version("nacl64_exe_version") {
323 "app/nacl64_exe.ver",
325 output = "$target_gen_dir/nacl64_exe_version.rc"
328 process_version("other_version") {
332 output = "$target_gen_dir/other_version.rc"
335 group("chrome_version_resources") {
337 ":chrome_exe_version",
338 ":chrome_dll_version",
339 ":nacl64_exe_version",
344 source_set("image_pre_reader") {
346 "app/image_pre_reader_win.cc",
347 "app/image_pre_reader_win.h",
355 # GYP version: chrome/chrome_resources.gyp:chrome_resources
358 # Note: GYP lists some dependencies in addition to these actions. However,
359 # these are just dependencies for the actions themselves, which our actions
360 # list individually when needed.
361 "//chrome/browser:resources",
362 "//chrome/common:resources",
363 "//chrome/renderer:resources",
366 if (enable_extensions) {
367 deps += [ "//chrome/common:extensions_api_resources" ]
371 # GYP version: chrome/chrome_resources.gyp:chrome_extra_resources
372 group("extra_resources") {
374 "//chrome/browser/resources:invalidations_resources",
375 "//chrome/browser/resources:memory_internals_resources",
376 "//chrome/browser/resources:net_internals_resources",
377 "//chrome/browser/resources:password_manager_internals_resources",
378 "//chrome/browser/resources:signin_internals_resources",
379 "//chrome/browser/resources:sync_internals_resources",
380 "//chrome/browser/resources:translate_internals_resources",
384 "//chrome/browser/resources:component_extension_resources",
385 "//chrome/browser/resources:options_resources",
386 "//chrome/browser/resources:settings_resources",
390 if (enable_chromevox_next) {
392 #'browser/resources/chromeos/chromevox2/chromevox.gyp:chromevox2', TODO(GYP)
396 #'browser/resources/chromeos/chromevox/chromevox.gyp:chromevox', TODO(GYP)
400 if (enable_extensions) {
402 "//chrome/browser/resources:quota_internals_resources",
403 "//chrome/browser/resources:sync_file_system_internals_resources",
408 if (is_chrome_branded) {
409 copy("default_apps") {
410 visibility = [ ":packed_resources" ]
412 "browser/resources/default_apps/docs.crx",
413 "browser/resources/default_apps/drive.crx",
414 "browser/resources/default_apps/external_extensions.json",
415 "browser/resources/default_apps/gmail.crx",
416 "browser/resources/default_apps/search.crx",
417 "browser/resources/default_apps/youtube.crx",
420 "$root_out_dir/default_apps/{{source_file_part}}",
425 group("packed_resources") {
427 ":repack_locales_pack",
428 ":repack_pseudo_locales_pack",
429 ":repack_chrome_100_percent",
432 if (is_chrome_branded) {
433 deps += [ ":default_apps" ]
437 deps += [ ":repack_chrome_200_percent" ]
441 repack("packed_extra_resources") {
442 visibility = [ "./*" ]
444 "$root_gen_dir/chrome/browser_resources.pak",
445 "$root_gen_dir/chrome/chrome_unscaled_resources.pak",
446 "$root_gen_dir/chrome/common_resources.pak",
447 "$root_gen_dir/chrome/invalidations_resources.pak",
448 "$root_gen_dir/chrome/memory_internals_resources.pak",
449 "$root_gen_dir/chrome/net_internals_resources.pak",
450 "$root_gen_dir/chrome/password_manager_internals_resources.pak",
451 "$root_gen_dir/chrome/signin_internals_resources.pak",
452 "$root_gen_dir/chrome/sync_internals_resources.pak",
453 "$root_gen_dir/chrome/translate_internals_resources.pak",
454 "$root_gen_dir/components/components_resources.pak",
455 "$root_gen_dir/net/net_resources.pak",
456 "$root_gen_dir/ui/resources/webui_resources.pak",
459 "//chrome/browser:resources",
460 "//chrome/app/theme:chrome_unscaled_resources",
461 "//chrome/common:resources",
462 "//chrome/browser/resources:invalidations_resources",
463 "//chrome/browser/resources:memory_internals_resources",
464 "//chrome/browser/resources:net_internals_resources",
465 "//chrome/browser/resources:password_manager_internals_resources",
466 "//chrome/browser/resources:signin_internals_resources",
467 "//chrome/browser/resources:sync_internals_resources",
468 "//chrome/browser/resources:translate_internals_resources",
469 "//components/resources",
470 "//net:net_resources",
474 if (!is_ios && !is_android) {
475 # New paks should be added here by default.
477 "$root_gen_dir/blink/devtools_resources.pak",
478 "$root_gen_dir/chrome/component_extension_resources.pak",
479 "$root_gen_dir/chrome/options_resources.pak",
480 "$root_gen_dir/chrome/quota_internals_resources.pak",
481 "$root_gen_dir/chrome/settings_resources.pak",
482 "$root_gen_dir/chrome/sync_file_system_internals_resources.pak",
483 "$root_gen_dir/chrome/webrtc_device_provider_resources.pak",
486 "//chrome/browser/devtools:webrtc_device_provider_resources",
487 "//chrome/browser/resources:component_extension_resources",
488 "//chrome/browser/resources:options_resources",
489 "//chrome/browser/resources:settings_resources",
490 "//chrome/browser/resources:quota_internals_resources",
491 "//chrome/browser/resources:sync_file_system_internals_resources",
492 "//content/browser/devtools:devtools_resources",
497 "$root_gen_dir/blink/public/resources/blink_resources.pak",
498 "$root_gen_dir/content/browser/tracing/tracing_resources.pak",
499 "$root_gen_dir/content/content_resources.pak",
503 sources += [ "$root_gen_dir/ui/file_manager/file_manager_resources.pak" ]
504 sources += [ "$root_gen_dir/ui/oobe/oobe_resources.pak" ]
505 deps += [ "//ui/file_manager:resources" ]
506 deps += [ "//ui/oobe:resources" ]
508 if (enable_extensions) {
510 "$root_gen_dir/chrome/extensions_api_resources.pak",
511 "$root_gen_dir/extensions/extensions_renderer_resources.pak",
512 "$root_gen_dir/extensions/extensions_resources.pak",
514 deps += [ "//chrome/common:extensions_api_resources" ]
517 # GYP outputs the file in the gen/repack directory. On non-Mac/iOS platforms
518 # it them copies it. This skipes the copy step and writes it to the final
520 if (is_mac || is_ios) {
521 output = "$root_gen_dir/repack/resources.pak"
523 output = "$root_out_dir/resources.pak"
527 # GYP version: chrome/chrome_resources.gyp:browser_tests_pak
528 repack("browser_tests_pak") {
530 "$root_gen_dir/chrome/options_test_resources.pak",
532 output = "$root_out_dir/browser_tests.pak"
535 # Collects per-locale grit files from many sources into global per-locale files.
536 chrome_repack_locales("repack_locales_pack") {
537 visibility = [ ":*" ]
539 input_locales = locales
542 output_locales = locales_as_mac_outputs
544 output_locales = locales
548 chrome_repack_locales("repack_pseudo_locales_pack") {
549 visibility = [ ":*" ]
551 input_locales = [ "fake-bidi" ]
554 output_locales = [ "fake_bidi" ] # Mac uses underscores.
556 output_locales = [ "fake-bidi" ]
560 # Generates a rule to repack a set of resources, substituting a given string
561 # in for the percentage (e.g. "100", "200"). It generates the repacked files in
562 # the "gen" directory, and then introduces a copy rule to copy it to the root
565 # It's not clear why this two-step dance is necessary as opposed to just
566 # generating the file in the destination. However, this is what the GYP build
567 # does, and for maintenance purposes, this keeps the same files in the same
568 # place between the two builds when possible.
572 # String to substitute for the percentage.
573 template("chrome_repack_percent") {
574 percent = invoker.percent
576 repack_name = "${target_name}_repack"
577 repack_output_file = "$root_gen_dir/repack/chrome_${percent}_percent.pak"
579 copy_name = target_name
581 repack(repack_name) {
582 visibility = [ ":$copy_name" ]
584 # All sources should also have deps for completeness.
586 "$root_gen_dir/chrome/renderer_resources_${percent}_percent.pak",
587 "$root_gen_dir/chrome/theme_resources_${percent}_percent.pak",
588 "$root_gen_dir/components/components_resources_${percent}_percent.pak",
589 "$root_gen_dir/ui/resources/ui_resources_${percent}_percent.pak",
593 "//chrome/app/theme:theme_resources",
594 "//chrome/renderer:resources",
595 "//components/strings",
596 "//net:net_resources",
601 "$root_gen_dir/blink/public/resources/blink_image_resources_${percent}_percent.pak",
602 "$root_gen_dir/content/app/resources/content_resources_${percent}_percent.pak",
604 deps += [ "//content:resources" ]
608 [ "$root_gen_dir/ash/resources/ash_resources_${percent}_percent.pak" ]
609 deps += [ "//ash/resources" ]
612 sources += [ "$root_gen_dir/ui/chromeos/resources/ui_chromeos_resources_${percent}_percent.pak" ]
613 deps += [ "//ui/chromeos/resources" ]
615 if (enable_extensions) {
616 sources += [ "$root_gen_dir/extensions/extensions_browser_resources_${percent}_percent.pak" ]
619 output = repack_output_file
623 visibility = [ ":*" ]
631 "$root_build_dir/chrome_${percent}_percent.pak",
636 chrome_repack_percent("repack_chrome_100_percent") {
641 chrome_repack_percent("repack_chrome_200_percent") {
646 # GYP version: chrome/chrome_resources.gyp:chrome_strings
649 "//chrome/app:chromium_strings",
650 "//chrome/app:generated_resources",
651 "//chrome/app:google_chrome_strings",
652 "//chrome/app/resources:locale_settings",
657 # GYP: //chrome/chrome.gyp:content_setting_java
658 java_cpp_enum("content_setting_javagen") {
660 "../components/content_settings/core/common/content_settings.h",
663 "org/chromium/chrome/browser/ContentSetting.java",
667 # GYP: //chrome/chrome.gyp:content_settings_type_java
668 java_cpp_enum("content_settings_type_javagen") {
670 "../components/content_settings/core/common/content_settings_types.h",
673 "org/chromium/chrome/browser/ContentSettingsType.java",
677 # GYP: //chrome/chrome.gyp:page_info_connection_type_java
678 java_cpp_enum("page_info_connection_type_javagen") {
680 "browser/ui/android/website_settings_popup_android.h",
683 "org/chromium/chrome/browser/PageInfoConnectionType.java",
687 # GYP: //chrome/chrome_android.gypi:chrome_android_core
688 static_library("chrome_android_core") {
690 "app/android/chrome_android_initializer.cc",
691 "app/android/chrome_android_initializer.h",
692 "app/android/chrome_jni_onload.cc",
693 "app/android/chrome_jni_onload.h",
694 "app/android/chrome_main_delegate_android.cc",
695 "app/android/chrome_main_delegate_android.h",
696 "app/chrome_main_delegate.cc",
697 "app/chrome_main_delegate.h",
700 include_dirs = [ android_ndk_include_dir ]
709 "//chrome/browser/ui",
714 "//components/enhanced_bookmarks",
715 "//content/public/app:both",
722 if (is_chrome_branded) {
723 name = "Google Chrome"
724 filename = "google-chrome"
725 confdir = "google-chrome"
728 filename = "chromium-browser"
732 script = "//chrome/tools/build/linux/sed.py"
733 infile = "app/resources/manpage.1.in"
738 outfile = "$root_out_dir/chrome.1"
744 rebase_path(infile, root_build_dir),
745 rebase_path(outfile, root_build_dir),
746 "-e s/@@NAME@@/$name/",
747 "-e s/@@FILENAME@@/$filename/",
748 "-e s/@@CONFDIR@@/$confdir/",