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")
15 if (is_win && !link_chrome_on_windows) {
16 # When linking is disabled on Windows, create a dummy Chrome target to
17 # make targets work that depend on Chrome.
24 if (!is_android && (!is_win || link_chrome_on_windows)) {
25 # TODO(GYP) for Windows need to the the reorder-imports step which probably
26 # means adding another target and renaming this to chrome_initial like in GYP.
27 executable("chrome") {
28 # Because the sources list varies so significantly per-platform, generally
29 # each platform lists its own files rather than relying on filtering or
30 # removing unused files.
32 "app/chrome_exe_resource.h",
37 # TODO(GYP) mac_bundle_resources, xcode_settings
39 # TODO(GYP) order_profiling, order_text_section
43 "$target_gen_dir/chrome_exe_version.rc",
44 "//content/app/startup_helper_win.cc",
45 "//content/public/common/content_switches.cc",
46 "app/chrome_crash_reporter_client.cc",
47 "app/chrome_crash_reporter_client.h",
49 "app/chrome_exe_main_win.cc",
50 "app/chrome_watcher_client_win.cc",
51 "app/chrome_watcher_client_win.h",
52 "app/chrome_watcher_command_line_win.cc",
53 "app/chrome_watcher_command_line_win.h",
56 "app/signature_validator_win.cc",
57 "app/signature_validator_win.h",
58 "common/crash_keys.cc",
59 "common/crash_keys.h'",
62 ":chrome_version_resources",
66 # 'chrome_nacl_win64" TODO(GYP)
67 # '../win8/delegate_execute/delegate_execute.gyp:*', TODO(GYP)
68 # '../win8/metro_driver/metro_driver.gyp:metro_driver', TODO(GYP)
70 "//breakpad:breakpad_handler",
71 "//breakpad:breakpad_sender",
72 "//chrome/browser:chrome_process_finder",
73 "//chrome/chrome_watcher",
74 "//chrome/chrome_watcher:client",
75 "//chrome/installer/util",
77 "//components/browser_watcher:browser_watcher_client",
78 "//components/crash/app",
87 configs -= [ "//build/config/win:console" ]
88 configs += [ "//build/config/win:windowed" ]
89 } else if (use_aura) {
90 # Non-Windows aura entrypoint.
91 sources += [ "app/chrome_exe_main_aura.cc" ]
96 "app/chrome_dll_resource.h",
98 "app/chrome_main_delegate.cc",
99 "app/chrome_main_delegate.h",
103 # On Linux, link the dependencies (libraries) that make up actual
104 # Chromium functionality directly into the executable.
105 ":browser_dependencies",
106 ":child_dependencies",
110 # Needed to use the master_preferences functions
111 "//chrome/installer/util",
112 "//content/public/app:both",
115 # Needed for chrome_main.cc initialization of libraries.
116 configs += [ "//build/config/linux:pangocairo" ]
118 # TODO(GYP) ['profiling==0 and linux_disable_pie==0', {
126 "//build/config/linux:x11",
127 "//build/config/linux:xext",
133 sources += [ "app/chrome_exe_main_mac.cc" ]
134 # TODO(GYP) lots more stuff in the is_mac block.
137 ":packed_extra_resources",
139 "//components/startup_metric_utils",
141 # Precompiled plugins that need to get copied to the output directory.
142 # On Mac, internal plugins go inside the framework, so these
143 # dependencies are on chrome.dll.
144 "//third_party/adobe/flash:flapper_binaries",
145 "//third_party/widevine/cdm:adapter",
147 # TODO(GYP) some stuff from GYP including chrome_multiple_dll.
150 if (is_linux && enable_plugins) {
156 if (!is_win || link_chrome_on_windows) {
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 # TODO(GYP) incremental linking flags in debug builds
203 #'LinkIncremental': '<(msvs_large_module_debug_link_mode)',
205 # TODO(GYP) Lots of VCLinkerTool stuff on Windows.
207 # TODO(GYP) chrome_pgo_phase on Windows.
211 deps += [ "//ui/compositor" ]
214 #TODO(GYP) add chrome_multiple_dll support
215 if (false) { #chrome_multiple_dll) {
216 defines = [ "CHROME_MULTIPLE_DLL_BROWSER" ]
217 deps += [ "//content/public/app:browser" ]
220 ":child_dependencies",
221 "//content/public/app:both",
225 if (cld_version == 0 || cld_version == 2) {
226 deps += [ "//third_party/cld_2" ]
230 #['OS=="mac" and component!="shared_library"', { TODO(GYP)
231 # 'includes': [ 'chrome_dll_bundle.gypi' ],
233 # TODO(GYP) Lots of other stuff in the OS=="mac" block.
236 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",
389 if (enable_chromevox_next) {
391 #'browser/resources/chromeos/chromevox2/chromevox.gyp:chromevox2', TODO(GYP)
395 #'browser/resources/chromeos/chromevox/chromevox.gyp:chromevox', TODO(GYP)
399 if (enable_extensions) {
401 "//chrome/browser/resources:quota_internals_resources",
402 "//chrome/browser/resources:sync_file_system_internals_resources",
407 if (is_chrome_branded) {
408 copy("default_apps") {
409 visibility = [ ":packed_resources" ]
411 "browser/resources/default_apps/docs.crx",
412 "browser/resources/default_apps/drive.crx",
413 "browser/resources/default_apps/external_extensions.json",
414 "browser/resources/default_apps/gmail.crx",
415 "browser/resources/default_apps/search.crx",
416 "browser/resources/default_apps/youtube.crx",
419 "$root_out_dir/default_apps/{{source_file_part}}",
424 group("packed_resources") {
426 ":repack_locales_pack",
427 ":repack_pseudo_locales_pack",
428 ":repack_chrome_100_percent",
431 if (is_chrome_branded) {
432 deps += [ ":default_apps" ]
436 deps += [ ":repack_chrome_200_percent" ]
440 repack("packed_extra_resources") {
441 visibility = [ "./*" ]
443 "$root_gen_dir/chrome/browser_resources.pak",
444 "$root_gen_dir/chrome/chrome_unscaled_resources.pak",
445 "$root_gen_dir/chrome/common_resources.pak",
446 "$root_gen_dir/chrome/invalidations_resources.pak",
447 "$root_gen_dir/chrome/memory_internals_resources.pak",
448 "$root_gen_dir/chrome/net_internals_resources.pak",
449 "$root_gen_dir/chrome/password_manager_internals_resources.pak",
450 "$root_gen_dir/chrome/signin_internals_resources.pak",
451 "$root_gen_dir/chrome/sync_internals_resources.pak",
452 "$root_gen_dir/chrome/translate_internals_resources.pak",
453 "$root_gen_dir/components/components_resources.pak",
454 "$root_gen_dir/net/net_resources.pak",
455 "$root_gen_dir/ui/resources/webui_resources.pak",
458 "//chrome/browser:resources",
459 "//chrome/app/theme:chrome_unscaled_resources",
460 "//chrome/common:resources",
461 "//chrome/browser/resources:invalidations_resources",
462 "//chrome/browser/resources:memory_internals_resources",
463 "//chrome/browser/resources:net_internals_resources",
464 "//chrome/browser/resources:password_manager_internals_resources",
465 "//chrome/browser/resources:signin_internals_resources",
466 "//chrome/browser/resources:sync_internals_resources",
467 "//chrome/browser/resources:translate_internals_resources",
468 "//components/resources",
469 "//net:net_resources",
473 if (!is_ios && !is_android) {
474 # New paks should be added here by default.
476 "$root_gen_dir/blink/devtools_resources.pak",
477 "$root_gen_dir/chrome/component_extension_resources.pak",
478 "$root_gen_dir/chrome/options_resources.pak",
479 "$root_gen_dir/chrome/quota_internals_resources.pak",
480 "$root_gen_dir/chrome/sync_file_system_internals_resources.pak",
481 "$root_gen_dir/chrome/webrtc_device_provider_resources.pak",
484 "//chrome/browser/devtools:webrtc_device_provider_resources",
485 "//chrome/browser/resources:component_extension_resources",
486 "//chrome/browser/resources:options_resources",
487 "//chrome/browser/resources:quota_internals_resources",
488 "//chrome/browser/resources:sync_file_system_internals_resources",
489 "//content/browser/devtools:devtools_resources",
494 "$root_gen_dir/blink/public/resources/blink_resources.pak",
495 "$root_gen_dir/content/browser/tracing/tracing_resources.pak",
496 "$root_gen_dir/content/content_resources.pak",
500 sources += [ "$root_gen_dir/ui/file_manager/file_manager_resources.pak" ]
501 deps += [ "//ui/file_manager:resources" ]
503 if (enable_extensions) {
505 "$root_gen_dir/chrome/extensions_api_resources.pak",
506 "$root_gen_dir/extensions/extensions_renderer_resources.pak",
507 "$root_gen_dir/extensions/extensions_resources.pak",
509 deps += [ "//chrome/common:extensions_api_resources" ]
512 # GYP outputs the file in the gen/repack directory. On non-Mac/iOS platforms
513 # it them copies it. This skipes the copy step and writes it to the final
515 if (is_mac || is_ios) {
516 output = "$root_gen_dir/repack/resources.pak"
518 output = "$root_out_dir/resources.pak"
522 # GYP version: chrome/chrome_resources.gyp:browser_tests_pak
523 repack("browser_tests_pak") {
525 "$root_gen_dir/chrome/options_test_resources.pak",
527 output = "$root_out_dir/browser_tests.pak"
530 # Collects per-locale grit files from many sources into global per-locale files.
531 chrome_repack_locales("repack_locales_pack") {
532 visibility = [ ":*" ]
534 input_locales = locales
537 output_locales = locales_as_mac_outputs
539 output_locales = locales
543 chrome_repack_locales("repack_pseudo_locales_pack") {
544 visibility = [ ":*" ]
546 input_locales = [ "fake-bidi" ]
549 output_locales = [ "fake_bidi" ] # Mac uses underscores.
551 output_locales = [ "fake-bidi" ]
555 # Generates a rule to repack a set of resources, substituting a given string
556 # in for the percentage (e.g. "100", "200"). It generates the repacked files in
557 # the "gen" directory, and then introduces a copy rule to copy it to the root
560 # It's not clear why this two-step dance is necessary as opposed to just
561 # generating the file in the destination. However, this is what the GYP build
562 # does, and for maintenance purposes, this keeps the same files in the same
563 # place between the two builds when possible.
567 # String to substitute for the percentage.
568 template("chrome_repack_percent") {
569 percent = invoker.percent
571 repack_name = "${target_name}_repack"
572 repack_output_file = "$root_gen_dir/repack/chrome_${percent}_percent.pak"
574 copy_name = target_name
576 repack(repack_name) {
577 visibility = [ ":$copy_name" ]
579 # All sources should also have deps for completeness.
581 "$root_gen_dir/chrome/renderer_resources_${percent}_percent.pak",
582 "$root_gen_dir/chrome/theme_resources_${percent}_percent.pak",
583 "$root_gen_dir/components/components_resources_${percent}_percent.pak",
584 "$root_gen_dir/ui/resources/ui_resources_${percent}_percent.pak",
588 "//chrome/app/theme:theme_resources",
589 "//chrome/renderer:resources",
590 "//components/strings",
591 "//net:net_resources",
595 sources += [ "$root_gen_dir/content/app/resources/content_resources_${percent}_percent.pak" ]
596 deps += [ "//content:resources" ]
600 [ "$root_gen_dir/ash/resources/ash_resources_${percent}_percent.pak" ]
601 deps += [ "//ash/resources" ]
604 sources += [ "$root_gen_dir/ui/chromeos/resources/ui_chromeos_resources_${percent}_percent.pak" ]
605 deps += [ "//ui/chromeos/resources" ]
607 if (enable_extensions) {
608 sources += [ "$root_gen_dir/extensions/extensions_browser_resources_${percent}_percent.pak" ]
611 output = repack_output_file
615 visibility = [ ":*" ]
623 "$root_build_dir/chrome_${percent}_percent.pak",
628 chrome_repack_percent("repack_chrome_100_percent") {
633 chrome_repack_percent("repack_chrome_200_percent") {
638 # GYP version: chrome/chrome_resources.gyp:chrome_strings
641 "//chrome/app:chromium_strings",
642 "//chrome/app:generated_resources",
643 "//chrome/app:google_chrome_strings",
644 "//chrome/app/resources:locale_settings",
649 # GYP: //chrome/chrome.gyp:content_setting_java
650 java_cpp_enum("content_setting_javagen") {
652 "../components/content_settings/core/common/content_settings.h",
655 "org/chromium/chrome/browser/ContentSetting.java",
659 # GYP: //chrome/chrome.gyp:content_settings_type_java
660 java_cpp_enum("content_settings_type_javagen") {
662 "../components/content_settings/core/common/content_settings_types.h",
665 "org/chromium/chrome/browser/ContentSettingsType.java",
669 # GYP: //chrome/chrome.gyp:page_info_connection_type_java
670 java_cpp_enum("page_info_connection_type_javagen") {
672 "browser/ui/android/website_settings_popup_android.h",
675 "org/chromium/chrome/browser/PageInfoConnectionType.java",
679 # GYP: //chrome/chrome_android.gypi:chrome_android_core
680 static_library("chrome_android_core") {
682 "app/android/chrome_android_initializer.cc",
683 "app/android/chrome_android_initializer.h",
684 "app/android/chrome_jni_onload.cc",
685 "app/android/chrome_main_delegate_android.cc",
686 "app/android/chrome_main_delegate_android.h",
687 "app/chrome_main_delegate.cc",
688 "app/chrome_main_delegate.h",
691 include_dirs = [ android_ndk_include_dir ]
700 "//chrome/browser/ui",
705 "//components/enhanced_bookmarks",
706 "//content/public/app:browser",
713 if (is_chrome_branded) {
714 name = "Google Chrome"
715 filename = "google-chrome"
716 confdir = "google-chrome"
719 filename = "chromium-browser"
723 script = "//chrome/tools/build/linux/sed.py"
724 infile = "app/resources/manpage.1.in"
729 outfile = "$root_out_dir/chrome.1"
735 rebase_path(infile, root_build_dir),
736 rebase_path(outfile, root_build_dir),
737 "-e s/@@NAME@@/$name/",
738 "-e s/@@FILENAME@@/$filename/",
739 "-e s/@@CONFDIR@@/$confdir/",