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:widevinecdmadapter",
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 "$root_gen_dir/base/trace_event/etw_manifest/chrome_events_win.rc",
169 "//base/win/dllmain.cc",
170 "app/chrome_command_ids.h",
172 "app/chrome_dll_resource.h",
173 "app/chrome_main.cc",
174 "app/chrome_main_delegate.cc",
175 "app/chrome_main_delegate.h",
176 "app/close_handle_hook_win.cc",
177 "app/close_handle_hook_win.h",
178 "app/delay_load_hook_win.cc",
179 "app/delay_load_hook_win.h",
183 # On Windows, link the dependencies (libraries) that make up actual
184 # Chromium functionality into this .dll.
185 ":chrome_version_resources",
186 "//base/trace_event/etw_manifest:chrome_events_win",
187 "//chrome/app/theme:chrome_unscaled_resources",
189 "//content/app/resources",
191 "//net:net_resources",
195 if (enable_configuration_policy) {
196 deps += [ "//components/policy" ]
198 if (current_cpu == "x86") {
199 # Add a dependency to custom import library for user32 delay imports only
201 #deps += [ 'chrome_user32_delay_imports' ] TODO(GYP)
204 # This is a large module that can't do incremental linking in some cases.
205 configs -= [ "//build/config/win:default_incremental_linking" ]
206 configs += [ "//build/config/win:default_large_module_incremental_linking" ]
208 # TODO(GYP) Lots of VCLinkerTool stuff on Windows.
210 # TODO(GYP) chrome_pgo_phase on Windows.
214 deps += [ "//ui/compositor" ]
217 #TODO(GYP) add chrome_multiple_dll support
218 if (false) { #chrome_multiple_dll) {
219 defines += [ "CHROME_MULTIPLE_DLL_BROWSER" ]
220 deps += [ "//content/public/app:browser" ]
223 ":child_dependencies",
224 "//content/public/app:both",
228 if (cld_version == 0 || cld_version == 2) {
229 deps += [ "//third_party/cld_2" ]
233 #['OS=="mac" and component!="shared_library"', { TODO(GYP)
234 # 'includes': [ 'chrome_dll_bundle.gypi' ],
236 # TODO(GYP) Lots of other stuff in the OS=="mac" block.
239 if (enable_plugins) {
244 # GYP version: chromium_browser_dependencies variable in chrome.gyp
245 group("browser_dependencies") {
252 deps += [ "//ppapi/host" ]
255 if (enable_basic_printing || enable_print_preview) {
256 deps += [ "//printing" ]
257 if (enable_print_preview) {
258 deps += [ "//chrome/service" ]
263 # GYP version: chromium_child_dependencies variable in chrome.gyp
264 group("child_dependencies") {
271 "//chrome/browser/devtools",
276 "//content/public/child",
277 "//third_party/WebKit/public:blink_devtools_frontend_resources",
280 if (cld_version == 0 || cld_version == 2) {
281 deps += [ "//third_party/cld_2:cld2_platform_impl" ]
285 deps += [ "//components/nacl/renderer/plugin:nacl_trusted_plugin" ]
287 if (enable_remoting) {
288 deps += [ "//remoting/client/plugin" ]
293 # TODO(brettw) this duplicates "//chrome/common:version" which applies to
295 process_version("version_header") {
296 # TODO(brettW) this should have more reduced visibility, but chrome/browser
297 # currently depends on this.
298 #visibility = [ ":*" ]
300 # This one just uses the custom template and no separate sources.
302 template_file = "version.h.in"
304 # TODO(brettw) this should move to $target_gen_dir/version.h and
305 # source files including it should reference it via "chrome/version.h"
306 output = "$root_gen_dir/version.h"
309 process_version("chrome_exe_version") {
311 "app/chrome_exe.ver",
313 output = "$target_gen_dir/chrome_exe_version.rc"
316 process_version("chrome_dll_version") {
318 "app/chrome_dll.ver",
320 output = "$target_gen_dir/chrome_dll_version.rc"
323 process_version("nacl64_exe_version") {
325 "app/nacl64_exe.ver",
327 output = "$target_gen_dir/nacl64_exe_version.rc"
330 process_version("other_version") {
334 output = "$target_gen_dir/other_version.rc"
337 group("chrome_version_resources") {
339 ":chrome_exe_version",
340 ":chrome_dll_version",
341 ":nacl64_exe_version",
346 source_set("image_pre_reader") {
348 "app/image_pre_reader_win.cc",
349 "app/image_pre_reader_win.h",
357 # GYP version: chrome/chrome_resources.gyp:chrome_resources
360 # Note: GYP lists some dependencies in addition to these actions. However,
361 # these are just dependencies for the actions themselves, which our actions
362 # list individually when needed.
363 "//chrome/browser:resources",
364 "//chrome/common:resources",
365 "//chrome/renderer:resources",
368 if (enable_extensions) {
369 deps += [ "//chrome/common:extensions_api_resources" ]
373 # GYP version: chrome/chrome_resources.gyp:chrome_extra_resources
374 group("extra_resources") {
376 "//chrome/browser/resources:invalidations_resources",
377 "//chrome/browser/resources:memory_internals_resources",
378 "//chrome/browser/resources:net_internals_resources",
379 "//chrome/browser/resources:password_manager_internals_resources",
380 "//chrome/browser/resources:signin_internals_resources",
381 "//chrome/browser/resources:sync_internals_resources",
382 "//chrome/browser/resources:translate_internals_resources",
386 "//chrome/browser/resources:component_extension_resources",
387 "//chrome/browser/resources:options_resources",
388 "//chrome/browser/resources:settings_resources",
392 if (enable_chromevox_next) {
394 #'browser/resources/chromeos/chromevox2/chromevox.gyp:chromevox2', TODO(GYP)
398 #'browser/resources/chromeos/chromevox/chromevox.gyp:chromevox', TODO(GYP)
402 if (enable_extensions) {
404 "//chrome/browser/resources:quota_internals_resources",
405 "//chrome/browser/resources:sync_file_system_internals_resources",
410 if (is_chrome_branded) {
411 copy("default_apps") {
412 visibility = [ ":packed_resources" ]
414 "browser/resources/default_apps/docs.crx",
415 "browser/resources/default_apps/drive.crx",
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",
422 "$root_out_dir/default_apps/{{source_file_part}}",
427 group("packed_resources") {
429 ":repack_locales_pack",
430 ":repack_pseudo_locales_pack",
431 ":repack_chrome_100_percent",
434 if (is_chrome_branded) {
435 deps += [ ":default_apps" ]
439 deps += [ ":repack_chrome_200_percent" ]
443 repack("packed_extra_resources") {
444 visibility = [ "./*" ]
446 "$root_gen_dir/chrome/browser_resources.pak",
447 "$root_gen_dir/chrome/chrome_unscaled_resources.pak",
448 "$root_gen_dir/chrome/common_resources.pak",
449 "$root_gen_dir/chrome/invalidations_resources.pak",
450 "$root_gen_dir/chrome/memory_internals_resources.pak",
451 "$root_gen_dir/chrome/net_internals_resources.pak",
452 "$root_gen_dir/chrome/password_manager_internals_resources.pak",
453 "$root_gen_dir/chrome/signin_internals_resources.pak",
454 "$root_gen_dir/chrome/sync_internals_resources.pak",
455 "$root_gen_dir/chrome/translate_internals_resources.pak",
456 "$root_gen_dir/components/components_resources.pak",
457 "$root_gen_dir/net/net_resources.pak",
458 "$root_gen_dir/ui/resources/webui_resources.pak",
461 "//chrome/browser:resources",
462 "//chrome/app/theme:chrome_unscaled_resources",
463 "//chrome/common:resources",
464 "//chrome/browser/resources:invalidations_resources",
465 "//chrome/browser/resources:memory_internals_resources",
466 "//chrome/browser/resources:net_internals_resources",
467 "//chrome/browser/resources:password_manager_internals_resources",
468 "//chrome/browser/resources:signin_internals_resources",
469 "//chrome/browser/resources:sync_internals_resources",
470 "//chrome/browser/resources:translate_internals_resources",
471 "//components/resources",
472 "//net:net_resources",
476 if (!is_ios && !is_android) {
477 # New paks should be added here by default.
479 "$root_gen_dir/blink/devtools_resources.pak",
480 "$root_gen_dir/chrome/component_extension_resources.pak",
481 "$root_gen_dir/chrome/options_resources.pak",
482 "$root_gen_dir/chrome/quota_internals_resources.pak",
483 "$root_gen_dir/chrome/settings_resources.pak",
484 "$root_gen_dir/chrome/sync_file_system_internals_resources.pak",
485 "$root_gen_dir/chrome/webrtc_device_provider_resources.pak",
488 "//chrome/browser/devtools:webrtc_device_provider_resources",
489 "//chrome/browser/resources:component_extension_resources",
490 "//chrome/browser/resources:options_resources",
491 "//chrome/browser/resources:settings_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 sources += [ "$root_gen_dir/ui/oobe/oobe_resources.pak" ]
507 deps += [ "//ui/file_manager:resources" ]
508 deps += [ "//ui/oobe:resources" ]
510 if (enable_extensions) {
512 "$root_gen_dir/chrome/extensions_api_resources.pak",
513 "$root_gen_dir/extensions/extensions_renderer_resources.pak",
514 "$root_gen_dir/extensions/extensions_resources.pak",
516 deps += [ "//chrome/common:extensions_api_resources" ]
519 # GYP outputs the file in the gen/repack directory. On non-Mac/iOS platforms
520 # it them copies it. This skipes the copy step and writes it to the final
522 if (is_mac || is_ios) {
523 output = "$root_gen_dir/repack/resources.pak"
525 output = "$root_out_dir/resources.pak"
529 # GYP version: chrome/chrome_resources.gyp:browser_tests_pak
530 repack("browser_tests_pak") {
532 "$root_gen_dir/chrome/options_test_resources.pak",
534 output = "$root_out_dir/browser_tests.pak"
537 # Collects per-locale grit files from many sources into global per-locale files.
538 chrome_repack_locales("repack_locales_pack") {
539 visibility = [ ":*" ]
541 input_locales = locales
544 output_locales = locales_as_mac_outputs
546 output_locales = locales
550 chrome_repack_locales("repack_pseudo_locales_pack") {
551 visibility = [ ":*" ]
553 input_locales = [ "fake-bidi" ]
556 output_locales = [ "fake_bidi" ] # Mac uses underscores.
558 output_locales = [ "fake-bidi" ]
562 # Generates a rule to repack a set of resources, substituting a given string
563 # in for the percentage (e.g. "100", "200"). It generates the repacked files in
564 # the "gen" directory, and then introduces a copy rule to copy it to the root
567 # It's not clear why this two-step dance is necessary as opposed to just
568 # generating the file in the destination. However, this is what the GYP build
569 # does, and for maintenance purposes, this keeps the same files in the same
570 # place between the two builds when possible.
574 # String to substitute for the percentage.
575 template("chrome_repack_percent") {
576 percent = invoker.percent
578 repack_name = "${target_name}_repack"
579 repack_output_file = "$root_gen_dir/repack/chrome_${percent}_percent.pak"
581 copy_name = target_name
583 repack(repack_name) {
584 visibility = [ ":$copy_name" ]
586 # All sources should also have deps for completeness.
588 "$root_gen_dir/chrome/renderer_resources_${percent}_percent.pak",
589 "$root_gen_dir/chrome/theme_resources_${percent}_percent.pak",
590 "$root_gen_dir/components/components_resources_${percent}_percent.pak",
591 "$root_gen_dir/ui/resources/ui_resources_${percent}_percent.pak",
595 "//chrome/app/theme:theme_resources",
596 "//chrome/renderer:resources",
597 "//components/strings",
598 "//net:net_resources",
603 "$root_gen_dir/blink/public/resources/blink_image_resources_${percent}_percent.pak",
604 "$root_gen_dir/content/app/resources/content_resources_${percent}_percent.pak",
606 deps += [ "//content:resources" ]
610 [ "$root_gen_dir/ash/resources/ash_resources_${percent}_percent.pak" ]
611 deps += [ "//ash/resources" ]
614 sources += [ "$root_gen_dir/ui/chromeos/resources/ui_chromeos_resources_${percent}_percent.pak" ]
615 deps += [ "//ui/chromeos/resources" ]
617 if (enable_extensions) {
618 sources += [ "$root_gen_dir/extensions/extensions_browser_resources_${percent}_percent.pak" ]
621 output = repack_output_file
625 visibility = [ ":*" ]
633 "$root_build_dir/chrome_${percent}_percent.pak",
638 chrome_repack_percent("repack_chrome_100_percent") {
643 chrome_repack_percent("repack_chrome_200_percent") {
648 # GYP version: chrome/chrome_resources.gyp:chrome_strings
651 "//chrome/app:chromium_strings",
652 "//chrome/app:generated_resources",
653 "//chrome/app:google_chrome_strings",
654 "//chrome/app/resources:locale_settings",
659 # GYP: //chrome/chrome.gyp:content_setting_java
660 java_cpp_enum("content_setting_javagen") {
662 "../components/content_settings/core/common/content_settings.h",
665 "org/chromium/chrome/browser/ContentSetting.java",
669 # GYP: //chrome/chrome.gyp:content_settings_type_java
670 java_cpp_enum("content_settings_type_javagen") {
672 "../components/content_settings/core/common/content_settings_types.h",
675 "org/chromium/chrome/browser/ContentSettingsType.java",
679 # GYP: //chrome/chrome.gyp:page_info_connection_type_java
680 java_cpp_enum("page_info_connection_type_javagen") {
682 "browser/ui/android/website_settings_popup_android.h",
685 "org/chromium/chrome/browser/PageInfoConnectionType.java",
689 # GYP: //chrome/chrome_android.gypi:chrome_android_core
690 static_library("chrome_android_core") {
692 "app/android/chrome_android_initializer.cc",
693 "app/android/chrome_android_initializer.h",
694 "app/android/chrome_jni_onload.cc",
695 "app/android/chrome_jni_onload.h",
696 "app/android/chrome_main_delegate_android.cc",
697 "app/android/chrome_main_delegate_android.h",
698 "app/chrome_main_delegate.cc",
699 "app/chrome_main_delegate.h",
702 include_dirs = [ android_ndk_include_dir ]
711 "//chrome/browser/ui",
716 "//components/enhanced_bookmarks",
717 "//content/public/app:both",
724 if (is_chrome_branded) {
725 name = "Google Chrome"
726 filename = "google-chrome"
727 confdir = "google-chrome"
730 filename = "chromium-browser"
734 script = "//chrome/tools/build/linux/sed.py"
735 infile = "app/resources/manpage.1.in"
740 outfile = "$root_out_dir/chrome.1"
746 rebase_path(infile, root_build_dir),
747 rebase_path(outfile, root_build_dir),
748 "-e s/@@NAME@@/$name/",
749 "-e s/@@FILENAME@@/$filename/",
750 "-e s/@@CONFDIR@@/$confdir/",