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 "app/chrome_crash_reporter_client.cc",
45 "app/chrome_crash_reporter_client.h",
47 "app/chrome_exe_main_win.cc",
48 "app/chrome_watcher_client_win.cc",
49 "app/chrome_watcher_client_win.h",
50 "app/chrome_watcher_command_line_win.cc",
51 "app/chrome_watcher_command_line_win.h",
54 "app/signature_validator_win.cc",
55 "app/signature_validator_win.h",
56 "common/crash_keys.cc",
57 "common/crash_keys.h'",
58 "//content/app/startup_helper_win.cc",
59 "//content/public/common/content_switches.cc",
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" ]
282 # TODO(gyp) if (enable_nacl) {
283 # deps += [ "<(DEPTH)/components/nacl/renderer/plugin/plugin.gyp: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 = [ ":*" ]
297 source = "version.h.in"
299 # TODO(brettw) this should move to $target_gen_dir/version.h and
300 # source files including it should reference it via "chrome/version.h"
301 output = "$root_gen_dir/version.h"
304 process_version("chrome_exe_version") {
305 source = "//chrome/app/chrome_version.rc.version"
306 output = "$target_gen_dir/chrome_exe_version.rc"
309 rebase_path("app/chrome_exe.ver", root_build_dir),
313 process_version("chrome_dll_version") {
314 source = "//chrome/app/chrome_version.rc.version"
315 output = "$target_gen_dir/chrome_dll_version.rc"
318 rebase_path("app/chrome_dll.ver", root_build_dir),
322 process_version("nacl64_exe_version") {
323 source = "//chrome/app/chrome_version.rc.version"
324 output = "$target_gen_dir/nacl64_exe_version.rc"
327 rebase_path("app/nacl64_exe.ver", root_build_dir),
331 process_version("other_version") {
332 source = "//chrome/app/chrome_version.rc.version"
333 output = "$target_gen_dir/other_version.rc"
336 rebase_path("app/other.ver", root_build_dir),
340 group("chrome_version_resources") {
342 ":chrome_exe_version",
343 ":chrome_dll_version",
344 ":nacl64_exe_version",
349 source_set("image_pre_reader") {
351 "app/image_pre_reader_win.cc",
352 "app/image_pre_reader_win.h",
360 # GYP version: chrome/chrome_resources.gyp:chrome_resources
363 # Note: GYP lists some dependencies in addition to these actions. However,
364 # these are just dependencies for the actions themselves, which our actions
365 # list individually when needed.
366 "//chrome/browser:resources",
367 "//chrome/common:resources",
368 "//chrome/renderer:resources",
371 if (enable_extensions) {
372 deps += [ "//chrome/common:extensions_api_resources" ]
376 # GYP version: chrome/chrome_resources.gyp:chrome_extra_resources
377 group("extra_resources") {
379 "//chrome/browser/resources:invalidations_resources",
380 "//chrome/browser/resources:memory_internals_resources",
381 "//chrome/browser/resources:net_internals_resources",
382 "//chrome/browser/resources:password_manager_internals_resources",
383 "//chrome/browser/resources:signin_internals_resources",
384 "//chrome/browser/resources:sync_internals_resources",
385 "//chrome/browser/resources:translate_internals_resources",
389 "//chrome/browser/resources:component_extension_resources",
390 "//chrome/browser/resources:options_resources",
394 if (enable_chromevox_next) {
396 #'browser/resources/chromeos/chromevox2/chromevox.gyp:chromevox2', TODO(GYP)
400 #'browser/resources/chromeos/chromevox/chromevox.gyp:chromevox', TODO(GYP)
404 if (enable_extensions) {
406 "//chrome/browser/resources:quota_internals_resources",
407 "//chrome/browser/resources:sync_file_system_internals_resources",
412 if (is_chrome_branded) {
413 copy("default_apps") {
414 visibility = [ ":packed_resources" ]
416 "browser/resources/default_apps/external_extensions.json",
417 "browser/resources/default_apps/gmail.crx",
418 "browser/resources/default_apps/search.crx",
419 "browser/resources/default_apps/youtube.crx",
420 "browser/resources/default_apps/drive.crx",
421 "browser/resources/default_apps/docs.crx",
424 "$root_out_dir/default_apps/{{source_file_part}}",
429 group("packed_resources") {
431 ":repack_locales_pack",
432 ":repack_pseudo_locales_pack",
433 ":repack_chrome_100_percent",
436 if (is_chrome_branded) {
437 deps += [ ":default_apps" ]
441 deps += [ ":repack_chrome_200_percent" ]
445 repack("packed_extra_resources") {
446 visibility = [ "./*" ]
448 "$root_gen_dir/chrome/browser_resources.pak",
449 "$root_gen_dir/chrome/chrome_unscaled_resources.pak",
450 "$root_gen_dir/chrome/common_resources.pak",
451 "$root_gen_dir/chrome/invalidations_resources.pak",
452 "$root_gen_dir/chrome/memory_internals_resources.pak",
453 "$root_gen_dir/chrome/net_internals_resources.pak",
454 "$root_gen_dir/chrome/password_manager_internals_resources.pak",
455 "$root_gen_dir/chrome/signin_internals_resources.pak",
456 "$root_gen_dir/chrome/sync_internals_resources.pak",
457 "$root_gen_dir/chrome/translate_internals_resources.pak",
458 "$root_gen_dir/components/components_resources.pak",
459 "$root_gen_dir/net/net_resources.pak",
460 "$root_gen_dir/ui/resources/webui_resources.pak",
463 "//chrome/browser:resources",
464 "//chrome/app/theme:chrome_unscaled_resources",
465 "//chrome/common:resources",
466 "//chrome/browser/resources:invalidations_resources",
467 "//chrome/browser/resources:memory_internals_resources",
468 "//chrome/browser/resources:net_internals_resources",
469 "//chrome/browser/resources:password_manager_internals_resources",
470 "//chrome/browser/resources:signin_internals_resources",
471 "//chrome/browser/resources:sync_internals_resources",
472 "//chrome/browser/resources:translate_internals_resources",
473 "//components/resources",
474 "//net:net_resources",
478 if (!is_ios && !is_android) {
479 # New paks should be added here by default.
481 "$root_gen_dir/chrome/component_extension_resources.pak",
482 "$root_gen_dir/chrome/options_resources.pak",
483 "$root_gen_dir/chrome/quota_internals_resources.pak",
484 "$root_gen_dir/chrome/sync_file_system_internals_resources.pak",
485 "$root_gen_dir/chrome/webrtc_device_provider_resources.pak",
486 "$root_gen_dir/blink/devtools_resources.pak",
489 "//chrome/browser/devtools:webrtc_device_provider_resources",
490 "//chrome/browser/resources:component_extension_resources",
491 "//chrome/browser/resources:options_resources",
492 "//chrome/browser/resources:quota_internals_resources",
493 "//chrome/browser/resources:sync_file_system_internals_resources",
494 "//content/browser/devtools:devtools_resources",
499 "$root_gen_dir/blink/public/resources/blink_resources.pak",
500 "$root_gen_dir/content/browser/tracing/tracing_resources.pak",
501 "$root_gen_dir/content/content_resources.pak",
505 sources += [ "$root_gen_dir/ui/file_manager/file_manager_resources.pak" ]
506 deps += [ "//ui/file_manager: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/components/components_resources_${percent}_percent.pak",
587 "$root_gen_dir/ui/resources/ui_resources_${percent}_percent.pak",
588 "$root_gen_dir/chrome/renderer_resources_${percent}_percent.pak",
589 "$root_gen_dir/chrome/theme_resources_${percent}_percent.pak",
593 "//chrome/app/theme:theme_resources",
594 "//chrome/renderer:resources",
595 "//components/strings",
596 "//net:net_resources",
600 sources += [ "$root_gen_dir/content/app/resources/content_resources_${percent}_percent.pak" ]
601 deps += [ "//content:resources" ]
605 [ "$root_gen_dir/ash/resources/ash_resources_${percent}_percent.pak" ]
606 deps += [ "//ash/resources" ]
609 sources += [ "$root_gen_dir/ui/chromeos/resources/ui_chromeos_resources_${percent}_percent.pak" ]
610 deps += [ "//ui/chromeos/resources" ]
612 if (enable_extensions) {
613 sources += [ "$root_gen_dir/extensions/extensions_browser_resources_${percent}_percent.pak" ]
616 output = repack_output_file
620 visibility = [ ":*" ]
628 "$root_build_dir/chrome_${percent}_percent.pak",
633 chrome_repack_percent("repack_chrome_100_percent") {
638 chrome_repack_percent("repack_chrome_200_percent") {
643 # GYP version: chrome/chrome_resources.gyp:chrome_strings
646 "//chrome/app:chromium_strings",
647 "//chrome/app:generated_resources",
648 "//chrome/app:google_chrome_strings",
649 "//chrome/app/resources:locale_settings",
654 # GYP: //chrome/chrome.gyp:content_setting_java
655 java_cpp_enum("content_setting_javagen") {
657 "../components/content_settings/core/common/content_settings.h",
660 "org/chromium/chrome/browser/ContentSetting.java",
664 # GYP: //chrome/chrome.gyp:content_settings_type_java
665 java_cpp_enum("content_settings_type_javagen") {
667 "../components/content_settings/core/common/content_settings_types.h",
670 "org/chromium/chrome/browser/ContentSettingsType.java",
674 # GYP: //chrome/chrome.gyp:page_info_connection_type_java
675 java_cpp_enum("page_info_connection_type_javagen") {
677 "browser/ui/android/website_settings_popup_android.h",
680 "org/chromium/chrome/browser/PageInfoConnectionType.java",
684 # GYP: //chrome/chrome_android.gypi:chrome_android_core
685 static_library("chrome_android_core") {
687 "app/android/chrome_android_initializer.cc",
688 "app/android/chrome_android_initializer.h",
689 "app/android/chrome_jni_onload.cc",
690 "app/android/chrome_main_delegate_android.cc",
691 "app/android/chrome_main_delegate_android.h",
692 "app/chrome_main_delegate.cc",
693 "app/chrome_main_delegate.h",
696 include_dirs = [ android_ndk_include_dir ]
705 "//chrome/browser/ui",
710 "//components/enhanced_bookmarks",
711 "//content/public/app:browser",
718 if (is_chrome_branded) {
719 name = "Google Chrome"
720 filename = "google-chrome"
721 confdir = "google-chrome"
724 filename = "chromium-browser"
728 script = "//chrome/tools/build/linux/sed.py"
729 infile = "app/resources/manpage.1.in"
734 outfile = "$root_out_dir/chrome.1"
740 rebase_path(infile, root_build_dir),
741 rebase_path(outfile, root_build_dir),
742 "-e s/@@NAME@@/$name/",
743 "-e s/@@FILENAME@@/$filename/",
744 "-e s/@@CONFDIR@@/$confdir/",