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",
28 # TODO(GYP) mac_bundle_resources, xcode_settings
30 # TODO(GYP) order_profiling, order_text_section
34 "$target_gen_dir/chrome_exe_version.rc",
35 "//content/app/startup_helper_win.cc",
36 "//content/public/common/content_switches.cc",
37 "app/chrome_crash_reporter_client.cc",
38 "app/chrome_crash_reporter_client.h",
40 "app/chrome_exe_main_win.cc",
41 "app/chrome_watcher_client_win.cc",
42 "app/chrome_watcher_client_win.h",
43 "app/chrome_watcher_command_line_win.cc",
44 "app/chrome_watcher_command_line_win.h",
47 "app/kasko_client.cc",
49 "app/signature_validator_win.cc",
50 "app/signature_validator_win.h",
51 "common/crash_keys.cc",
52 "common/crash_keys.h'",
55 ":chrome_version_resources",
59 # 'chrome_nacl_win64" TODO(GYP)
60 # '../win8/delegate_execute/delegate_execute.gyp:*', TODO(GYP)
61 # '../win8/metro_driver/metro_driver.gyp:metro_driver', TODO(GYP)
63 "//breakpad:breakpad_handler",
64 "//breakpad:breakpad_sender",
65 "//chrome/browser:chrome_process_finder",
66 "//chrome/chrome_watcher",
67 "//chrome/chrome_watcher:client",
68 "//chrome/installer/util",
70 "//components/browser_watcher:browser_watcher_client",
71 "//components/crash/app",
80 configs -= [ "//build/config/win:console" ]
81 configs += [ "//build/config/win:windowed" ]
82 } else if (use_aura) {
83 # Non-Windows aura entrypoint.
84 sources += [ "app/chrome_exe_main_aura.cc" ]
89 "app/chrome_dll_resource.h",
91 "app/chrome_main_delegate.cc",
92 "app/chrome_main_delegate.h",
96 # On Linux, link the dependencies (libraries) that make up actual
97 # Chromium functionality directly into the executable.
98 ":browser_dependencies",
99 ":child_dependencies",
103 # Needed to use the master_preferences functions
104 "//chrome/installer/util",
105 "//content/public/app:both",
108 # Needed for chrome_main.cc initialization of libraries.
109 configs += [ "//build/config/linux:pangocairo" ]
111 # TODO(GYP) ['profiling==0 and linux_disable_pie==0', {
119 "//build/config/linux:x11",
120 "//build/config/linux:xext",
126 sources += [ "app/chrome_exe_main_mac.cc" ]
127 # TODO(GYP) lots more stuff in the is_mac block.
130 ":packed_extra_resources",
132 "//components/startup_metric_utils",
134 # Precompiled plugins that need to get copied to the output directory.
135 # On Mac, internal plugins go inside the framework, so these
136 # dependencies are on chrome.dll.
137 "//third_party/adobe/flash:flapper_binaries",
138 "//third_party/widevine/cdm:adapter",
140 # TODO(GYP) some stuff from GYP including chrome_multiple_dll.
143 if (is_linux && enable_plugins) {
149 shared_library("main_dll") {
150 configs += [ "//build/config/compiler:wexit_time_destructors" ]
153 ":browser_dependencies",
157 output_name = "chrome"
160 "//base/win/dllmain.cc",
161 "app/chrome_command_ids.h",
163 "app/chrome_dll_resource.h",
164 "app/chrome_main.cc",
165 "app/chrome_main_delegate.cc",
166 "app/chrome_main_delegate.h",
167 "app/close_handle_hook_win.cc",
168 "app/close_handle_hook_win.h",
169 "app/delay_load_hook_win.cc",
170 "app/delay_load_hook_win.h",
174 # On Windows, link the dependencies (libraries) that make up actual
175 # Chromium functionality into this .dll.
176 ":chrome_version_resources",
177 "//chrome/app/theme:chrome_unscaled_resources",
179 "//content/app/resources",
181 "//net:net_resources",
185 if (enable_configuration_policy) {
186 deps += [ "//components/policy" ]
188 if (current_cpu == "x86") {
189 # Add a dependency to custom import library for user32 delay imports only
191 #deps += [ 'chrome_user32_delay_imports' ] TODO(GYP)
194 # This is a large module that can't do incremental linking in some cases.
195 configs -= [ "//build/config/win:default_incremental_linking" ]
196 configs += [ "//build/config/win:default_large_module_incremental_linking" ]
198 # TODO(GYP) Lots of VCLinkerTool stuff on Windows.
200 # TODO(GYP) chrome_pgo_phase on Windows.
204 deps += [ "//ui/compositor" ]
207 #TODO(GYP) add chrome_multiple_dll support
208 if (false) { #chrome_multiple_dll) {
209 defines = [ "CHROME_MULTIPLE_DLL_BROWSER" ]
210 deps += [ "//content/public/app:browser" ]
213 ":child_dependencies",
214 "//content/public/app:both",
218 if (cld_version == 0 || cld_version == 2) {
219 deps += [ "//third_party/cld_2" ]
223 #['OS=="mac" and component!="shared_library"', { TODO(GYP)
224 # 'includes': [ 'chrome_dll_bundle.gypi' ],
226 # TODO(GYP) Lots of other stuff in the OS=="mac" block.
229 if (enable_plugins) {
234 # GYP version: chromium_browser_dependencies variable in chrome.gyp
235 group("browser_dependencies") {
242 deps += [ "//ppapi/host" ]
245 if (enable_basic_printing || enable_print_preview) {
246 deps += [ "//printing" ]
247 if (enable_print_preview) {
248 deps += [ "//chrome/service" ]
253 # GYP version: chromium_child_dependencies variable in chrome.gyp
254 group("child_dependencies") {
261 "//chrome/browser/devtools",
266 "//content/public/child",
267 "//third_party/WebKit/public:blink_devtools_frontend_resources",
270 if (cld_version == 0 || cld_version == 2) {
271 deps += [ "//third_party/cld_2:cld2_platform_impl" ]
275 deps += [ "//components/nacl/renderer/plugin:nacl_trusted_plugin" ]
277 if (enable_remoting) {
278 deps += [ "//remoting/client/plugin" ]
283 # TODO(brettw) this duplicates "//chrome/common:version" which applies to
285 process_version("version_header") {
286 # TODO(brettW) this should have more reduced visibility, but chrome/browser
287 # currently depends on this.
288 #visibility = [ ":*" ]
290 # This one just uses the custom template and no separate sources.
292 template_file = "version.h.in"
294 # TODO(brettw) this should move to $target_gen_dir/version.h and
295 # source files including it should reference it via "chrome/version.h"
296 output = "$root_gen_dir/version.h"
299 process_version("chrome_exe_version") {
301 "app/chrome_exe.ver",
303 output = "$target_gen_dir/chrome_exe_version.rc"
306 process_version("chrome_dll_version") {
308 "app/chrome_dll.ver",
310 output = "$target_gen_dir/chrome_dll_version.rc"
313 process_version("nacl64_exe_version") {
315 "app/nacl64_exe.ver",
317 output = "$target_gen_dir/nacl64_exe_version.rc"
320 process_version("other_version") {
324 output = "$target_gen_dir/other_version.rc"
327 group("chrome_version_resources") {
329 ":chrome_exe_version",
330 ":chrome_dll_version",
331 ":nacl64_exe_version",
336 source_set("image_pre_reader") {
338 "app/image_pre_reader_win.cc",
339 "app/image_pre_reader_win.h",
347 # GYP version: chrome/chrome_resources.gyp:chrome_resources
350 # Note: GYP lists some dependencies in addition to these actions. However,
351 # these are just dependencies for the actions themselves, which our actions
352 # list individually when needed.
353 "//chrome/browser:resources",
354 "//chrome/common:resources",
355 "//chrome/renderer:resources",
358 if (enable_extensions) {
359 deps += [ "//chrome/common:extensions_api_resources" ]
363 # GYP version: chrome/chrome_resources.gyp:chrome_extra_resources
364 group("extra_resources") {
366 "//chrome/browser/resources:invalidations_resources",
367 "//chrome/browser/resources:memory_internals_resources",
368 "//chrome/browser/resources:net_internals_resources",
369 "//chrome/browser/resources:password_manager_internals_resources",
370 "//chrome/browser/resources:signin_internals_resources",
371 "//chrome/browser/resources:sync_internals_resources",
372 "//chrome/browser/resources:translate_internals_resources",
376 "//chrome/browser/resources:component_extension_resources",
377 "//chrome/browser/resources:options_resources",
378 "//chrome/browser/resources:settings_resources",
382 if (enable_chromevox_next) {
384 #'browser/resources/chromeos/chromevox2/chromevox.gyp:chromevox2', TODO(GYP)
388 #'browser/resources/chromeos/chromevox/chromevox.gyp:chromevox', TODO(GYP)
392 if (enable_extensions) {
394 "//chrome/browser/resources:quota_internals_resources",
395 "//chrome/browser/resources:sync_file_system_internals_resources",
400 if (is_chrome_branded) {
401 copy("default_apps") {
402 visibility = [ ":packed_resources" ]
404 "browser/resources/default_apps/docs.crx",
405 "browser/resources/default_apps/drive.crx",
406 "browser/resources/default_apps/external_extensions.json",
407 "browser/resources/default_apps/gmail.crx",
408 "browser/resources/default_apps/search.crx",
409 "browser/resources/default_apps/youtube.crx",
412 "$root_out_dir/default_apps/{{source_file_part}}",
417 group("packed_resources") {
419 ":repack_locales_pack",
420 ":repack_pseudo_locales_pack",
421 ":repack_chrome_100_percent",
424 if (is_chrome_branded) {
425 deps += [ ":default_apps" ]
429 deps += [ ":repack_chrome_200_percent" ]
433 repack("packed_extra_resources") {
434 visibility = [ "./*" ]
436 "$root_gen_dir/chrome/browser_resources.pak",
437 "$root_gen_dir/chrome/chrome_unscaled_resources.pak",
438 "$root_gen_dir/chrome/common_resources.pak",
439 "$root_gen_dir/chrome/invalidations_resources.pak",
440 "$root_gen_dir/chrome/memory_internals_resources.pak",
441 "$root_gen_dir/chrome/net_internals_resources.pak",
442 "$root_gen_dir/chrome/password_manager_internals_resources.pak",
443 "$root_gen_dir/chrome/signin_internals_resources.pak",
444 "$root_gen_dir/chrome/sync_internals_resources.pak",
445 "$root_gen_dir/chrome/translate_internals_resources.pak",
446 "$root_gen_dir/components/components_resources.pak",
447 "$root_gen_dir/net/net_resources.pak",
448 "$root_gen_dir/ui/resources/webui_resources.pak",
451 "//chrome/browser:resources",
452 "//chrome/app/theme:chrome_unscaled_resources",
453 "//chrome/common:resources",
454 "//chrome/browser/resources:invalidations_resources",
455 "//chrome/browser/resources:memory_internals_resources",
456 "//chrome/browser/resources:net_internals_resources",
457 "//chrome/browser/resources:password_manager_internals_resources",
458 "//chrome/browser/resources:signin_internals_resources",
459 "//chrome/browser/resources:sync_internals_resources",
460 "//chrome/browser/resources:translate_internals_resources",
461 "//components/resources",
462 "//net:net_resources",
466 if (!is_ios && !is_android) {
467 # New paks should be added here by default.
469 "$root_gen_dir/blink/devtools_resources.pak",
470 "$root_gen_dir/chrome/component_extension_resources.pak",
471 "$root_gen_dir/chrome/options_resources.pak",
472 "$root_gen_dir/chrome/quota_internals_resources.pak",
473 "$root_gen_dir/chrome/settings_resources.pak",
474 "$root_gen_dir/chrome/sync_file_system_internals_resources.pak",
475 "$root_gen_dir/chrome/webrtc_device_provider_resources.pak",
478 "//chrome/browser/devtools:webrtc_device_provider_resources",
479 "//chrome/browser/resources:component_extension_resources",
480 "//chrome/browser/resources:options_resources",
481 "//chrome/browser/resources:settings_resources",
482 "//chrome/browser/resources:quota_internals_resources",
483 "//chrome/browser/resources:sync_file_system_internals_resources",
484 "//content/browser/devtools:devtools_resources",
489 "$root_gen_dir/content/browser/tracing/tracing_resources.pak",
490 "$root_gen_dir/content/content_resources.pak",
494 sources += [ "$root_gen_dir/ui/file_manager/file_manager_resources.pak" ]
495 sources += [ "$root_gen_dir/ui/oobe/oobe_resources.pak" ]
496 deps += [ "//ui/file_manager:resources" ]
497 deps += [ "//ui/oobe:resources" ]
499 if (enable_extensions) {
501 "$root_gen_dir/chrome/extensions_api_resources.pak",
502 "$root_gen_dir/extensions/extensions_renderer_resources.pak",
503 "$root_gen_dir/extensions/extensions_resources.pak",
505 deps += [ "//chrome/common:extensions_api_resources" ]
508 # GYP outputs the file in the gen/repack directory. On non-Mac/iOS platforms
509 # it them copies it. This skipes the copy step and writes it to the final
511 if (is_mac || is_ios) {
512 output = "$root_gen_dir/repack/resources.pak"
514 output = "$root_out_dir/resources.pak"
518 # GYP version: chrome/chrome_resources.gyp:browser_tests_pak
519 repack("browser_tests_pak") {
521 "$root_gen_dir/chrome/options_test_resources.pak",
523 output = "$root_out_dir/browser_tests.pak"
526 # Collects per-locale grit files from many sources into global per-locale files.
527 chrome_repack_locales("repack_locales_pack") {
528 visibility = [ ":*" ]
530 input_locales = locales
533 output_locales = locales_as_mac_outputs
535 output_locales = locales
539 chrome_repack_locales("repack_pseudo_locales_pack") {
540 visibility = [ ":*" ]
542 input_locales = [ "fake-bidi" ]
545 output_locales = [ "fake_bidi" ] # Mac uses underscores.
547 output_locales = [ "fake-bidi" ]
551 # Generates a rule to repack a set of resources, substituting a given string
552 # in for the percentage (e.g. "100", "200"). It generates the repacked files in
553 # the "gen" directory, and then introduces a copy rule to copy it to the root
556 # It's not clear why this two-step dance is necessary as opposed to just
557 # generating the file in the destination. However, this is what the GYP build
558 # does, and for maintenance purposes, this keeps the same files in the same
559 # place between the two builds when possible.
563 # String to substitute for the percentage.
564 template("chrome_repack_percent") {
565 percent = invoker.percent
567 repack_name = "${target_name}_repack"
568 repack_output_file = "$root_gen_dir/repack/chrome_${percent}_percent.pak"
570 copy_name = target_name
572 repack(repack_name) {
573 visibility = [ ":$copy_name" ]
575 # All sources should also have deps for completeness.
577 "$root_gen_dir/chrome/renderer_resources_${percent}_percent.pak",
578 "$root_gen_dir/chrome/theme_resources_${percent}_percent.pak",
579 "$root_gen_dir/components/components_resources_${percent}_percent.pak",
580 "$root_gen_dir/ui/resources/ui_resources_${percent}_percent.pak",
584 "//chrome/app/theme:theme_resources",
585 "//chrome/renderer:resources",
586 "//components/strings",
587 "//net:net_resources",
592 "$root_gen_dir/blink/public/resources/blink_resources_${percent}_percent.pak",
593 "$root_gen_dir/content/app/resources/content_resources_${percent}_percent.pak",
595 deps += [ "//content:resources" ]
599 [ "$root_gen_dir/ash/resources/ash_resources_${percent}_percent.pak" ]
600 deps += [ "//ash/resources" ]
603 sources += [ "$root_gen_dir/ui/chromeos/resources/ui_chromeos_resources_${percent}_percent.pak" ]
604 deps += [ "//ui/chromeos/resources" ]
606 if (enable_extensions) {
607 sources += [ "$root_gen_dir/extensions/extensions_browser_resources_${percent}_percent.pak" ]
610 output = repack_output_file
614 visibility = [ ":*" ]
622 "$root_build_dir/chrome_${percent}_percent.pak",
627 chrome_repack_percent("repack_chrome_100_percent") {
632 chrome_repack_percent("repack_chrome_200_percent") {
637 # GYP version: chrome/chrome_resources.gyp:chrome_strings
640 "//chrome/app:chromium_strings",
641 "//chrome/app:generated_resources",
642 "//chrome/app:google_chrome_strings",
643 "//chrome/app/resources:locale_settings",
648 # GYP: //chrome/chrome.gyp:content_setting_java
649 java_cpp_enum("content_setting_javagen") {
651 "../components/content_settings/core/common/content_settings.h",
654 "org/chromium/chrome/browser/ContentSetting.java",
658 # GYP: //chrome/chrome.gyp:content_settings_type_java
659 java_cpp_enum("content_settings_type_javagen") {
661 "../components/content_settings/core/common/content_settings_types.h",
664 "org/chromium/chrome/browser/ContentSettingsType.java",
668 # GYP: //chrome/chrome.gyp:page_info_connection_type_java
669 java_cpp_enum("page_info_connection_type_javagen") {
671 "browser/ui/android/website_settings_popup_android.h",
674 "org/chromium/chrome/browser/PageInfoConnectionType.java",
678 # GYP: //chrome/chrome_android.gypi:chrome_android_core
679 static_library("chrome_android_core") {
681 "app/android/chrome_android_initializer.cc",
682 "app/android/chrome_android_initializer.h",
683 "app/android/chrome_jni_onload.cc",
684 "app/android/chrome_jni_onload.h",
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:both",
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/",