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/blink/public/resources/blink_resources.pak",
490 "$root_gen_dir/content/browser/tracing/tracing_resources.pak",
491 "$root_gen_dir/content/content_resources.pak",
495 sources += [ "$root_gen_dir/ui/file_manager/file_manager_resources.pak" ]
496 sources += [ "$root_gen_dir/ui/oobe/oobe_resources.pak" ]
497 deps += [ "//ui/file_manager:resources" ]
498 deps += [ "//ui/oobe:resources" ]
500 if (enable_extensions) {
502 "$root_gen_dir/chrome/extensions_api_resources.pak",
503 "$root_gen_dir/extensions/extensions_renderer_resources.pak",
504 "$root_gen_dir/extensions/extensions_resources.pak",
506 deps += [ "//chrome/common:extensions_api_resources" ]
509 # GYP outputs the file in the gen/repack directory. On non-Mac/iOS platforms
510 # it them copies it. This skipes the copy step and writes it to the final
512 if (is_mac || is_ios) {
513 output = "$root_gen_dir/repack/resources.pak"
515 output = "$root_out_dir/resources.pak"
519 # GYP version: chrome/chrome_resources.gyp:browser_tests_pak
520 repack("browser_tests_pak") {
522 "$root_gen_dir/chrome/options_test_resources.pak",
524 output = "$root_out_dir/browser_tests.pak"
527 # Collects per-locale grit files from many sources into global per-locale files.
528 chrome_repack_locales("repack_locales_pack") {
529 visibility = [ ":*" ]
531 input_locales = locales
534 output_locales = locales_as_mac_outputs
536 output_locales = locales
540 chrome_repack_locales("repack_pseudo_locales_pack") {
541 visibility = [ ":*" ]
543 input_locales = [ "fake-bidi" ]
546 output_locales = [ "fake_bidi" ] # Mac uses underscores.
548 output_locales = [ "fake-bidi" ]
552 # Generates a rule to repack a set of resources, substituting a given string
553 # in for the percentage (e.g. "100", "200"). It generates the repacked files in
554 # the "gen" directory, and then introduces a copy rule to copy it to the root
557 # It's not clear why this two-step dance is necessary as opposed to just
558 # generating the file in the destination. However, this is what the GYP build
559 # does, and for maintenance purposes, this keeps the same files in the same
560 # place between the two builds when possible.
564 # String to substitute for the percentage.
565 template("chrome_repack_percent") {
566 percent = invoker.percent
568 repack_name = "${target_name}_repack"
569 repack_output_file = "$root_gen_dir/repack/chrome_${percent}_percent.pak"
571 copy_name = target_name
573 repack(repack_name) {
574 visibility = [ ":$copy_name" ]
576 # All sources should also have deps for completeness.
578 "$root_gen_dir/chrome/renderer_resources_${percent}_percent.pak",
579 "$root_gen_dir/chrome/theme_resources_${percent}_percent.pak",
580 "$root_gen_dir/components/components_resources_${percent}_percent.pak",
581 "$root_gen_dir/ui/resources/ui_resources_${percent}_percent.pak",
585 "//chrome/app/theme:theme_resources",
586 "//chrome/renderer:resources",
587 "//components/strings",
588 "//net:net_resources",
593 "$root_gen_dir/blink/public/resources/blink_image_resources_${percent}_percent.pak",
594 "$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_jni_onload.h",
686 "app/android/chrome_main_delegate_android.cc",
687 "app/android/chrome_main_delegate_android.h",
688 "app/chrome_main_delegate.cc",
689 "app/chrome_main_delegate.h",
692 include_dirs = [ android_ndk_include_dir ]
701 "//chrome/browser/ui",
706 "//components/enhanced_bookmarks",
707 "//content/public/app:both",
714 if (is_chrome_branded) {
715 name = "Google Chrome"
716 filename = "google-chrome"
717 confdir = "google-chrome"
720 filename = "chromium-browser"
724 script = "//chrome/tools/build/linux/sed.py"
725 infile = "app/resources/manpage.1.in"
730 outfile = "$root_out_dir/chrome.1"
736 rebase_path(infile, root_build_dir),
737 rebase_path(outfile, root_build_dir),
738 "-e s/@@NAME@@/$name/",
739 "-e s/@@FILENAME@@/$filename/",
740 "-e s/@@CONFDIR@@/$confdir/",