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 "app/chrome_exe_main_win.cc",
38 "app/signature_validator_win.cc",
39 "app/signature_validator_win.h",
40 "//content/app/startup_helper_win.cc",
43 ":chrome_version_resources",
45 "//chrome/browser:chrome_process_finder",
46 "//chrome/chrome_watcher",
47 "//chrome/chrome_watcher:client",
48 "//components/browser_watcher:browser_watcher_client",
51 } else if (use_aura) {
52 # Non-Windows aura entrypoint.
53 sources += [ "app/chrome_exe_main_aura.cc" ]
57 # TODO(GYP) manpage action
60 "app/chrome_dll_resource.h",
62 "app/chrome_main_delegate.cc",
63 "app/chrome_main_delegate.h",
67 # On Linux, link the dependencies (libraries) that make up actual
68 # Chromium functionality directly into the executable.
69 ":browser_dependencies",
70 ":child_dependencies",
73 # Needed to use the master_preferences functions
74 "//chrome/installer/util",
75 "//content/public/app:both",
78 # Needed for chrome_main.cc initialization of libraries.
79 configs += [ "//build/config/linux:pangocairo" ]
81 # TODO(GYP) ['profiling==0 and linux_disable_pie==0', {
89 "//build/config/linux:x11",
90 "//build/config/linux:xext",
96 sources += [ "app/chrome_exe_main_mac.cc" ]
97 # TODO(GYP) lots more stuff in the is_mac block.
100 ":packed_extra_resources",
103 # Copy Flash Player files to PRODUCT_DIR if applicable. Let the .gyp
104 # file decide what to do on a per-OS basis; on Mac, internal plugins
105 # go inside the framework, so this dependency is in chrome_dll.gypi.
106 #'../third_party/adobe/flash/flash_player.gyp:flapper_binaries', TODO(GYP)
108 # Copy CDM files to PRODUCT_DIR if applicable. Let the .gyp
109 # file decide what to do on a per-OS basis; on Mac, internal plugins
110 # go inside the framework, so this dependency is in chrome_dll.gypi.
111 #'../third_party/widevine/cdm/widevine_cdm.gyp:widevinecdmadapter', TODO(GYP)
113 # TODO(GYP) some stuff from GYP including chrome_multiple_dll.
117 # On Mac this is done in chrome_dll.gypi.
118 datadeps += [ "//pdf" ]
119 # TODO(GYP) pdf linux symbols
124 shared_library("main_dll") {
125 configs += [ "//build/config/compiler:wexit_time_destructors" ]
128 ":browser_dependencies",
132 output_name = "chrome"
135 "app/chrome_command_ids.h",
137 "app/chrome_dll_resource.h",
138 "app/chrome_main.cc",
139 "app/chrome_main_delegate.cc",
140 "app/chrome_main_delegate.h",
141 "app/close_handle_hook_win.cc",
142 "app/close_handle_hook_win.h",
143 "app/delay_load_hook_win.cc",
144 "app/delay_load_hook_win.h",
145 "//base/win/dllmain.cc",
149 # On Windows, link the dependencies (libraries) that make up actual
150 # Chromium functionality into this .dll.
151 ":chrome_version_resources",
152 "//chrome/app/theme:chrome_unscaled_resources",
154 "//content/app/resources",
156 "//net:net_resources",
160 if (enable_configuration_policy) {
161 deps += [ "//components/policy" ]
163 if (cpu_arch == "x86") {
164 # Add a dependency to custom import library for user32 delay imports only
166 #deps += [ 'chrome_user32_delay_imports' ] TODO(GYP)
169 # TODO(GYP) incremental linking flags in debug builds
170 #'LinkIncremental': '<(msvs_large_module_debug_link_mode)',
172 # TODO(GYP) Lots of VCLinkerTool stuff on Windows.
174 # TODO(GYP) chrome_pgo_phase on Windows.
178 deps += [ "//ui/compositor" ]
181 #TODO(GYP) add chrome_multiple_dll support
182 if (false) { #chrome_multiple_dll) {
183 defines = [ "CHROME_MULTIPLE_DLL_BROWSER" ]
184 deps += [ "//content/public/app:browser" ]
187 ":child_dependencies",
188 "//content/public/app:both",
192 if (cld_version == 0 || cld_version == 2) {
193 deps += [ "//third_party/cld_2" ]
197 #['OS=="mac" and component!="shared_library"', { TODO(GYP)
198 # 'includes': [ 'chrome_dll_bundle.gypi' ],
200 # TODO(GYP) Lots of other stuff in the OS=="mac" block.
204 # GYP version: chromium_browser_dependencies variable in chrome.gyp
205 group("browser_dependencies") {
212 deps += [ "//ppapi:ppapi_host" ]
215 if (enable_basic_printing || enable_print_preview) {
216 deps += [ "//printing" ]
217 if (enable_print_preview) {
218 deps += [ "//chrome/service" ]
223 # GYP version: chromium_child_dependencies variable in chrome.gyp
224 group("child_dependencies") {
231 "//chrome/browser/devtools",
235 "//content/public/child",
236 "//third_party/WebKit/public:blink_devtools_frontend_resources",
239 if (cld_version == 0 || cld_version == 2) {
240 deps += [ "//third_party/cld_2:cld2_platform_impl" ]
243 # TODO(gyp) if (enable_nacl) {
244 # deps += [ "<(DEPTH)/components/nacl/renderer/plugin/plugin.gyp:nacl_trusted_plugin" ]
246 if (enable_remoting) {
247 deps += [ "//remoting/client/plugin" ]
252 # TODO(brettw) this duplicates "//chrome/common:version" which applies to
254 process_version("version_header") {
255 # TODO(brettW) this should have more reduced visibility, but chrome/browser
256 # currently depends on this.
257 #visibility = [ ":*" ]
258 source = "version.h.in"
260 # TODO(brettw) this should move to $target_gen_dir/version.h and
261 # source files including it should reference it via "chrome/version.h"
262 output = "$root_gen_dir/version.h"
265 process_version("chrome_exe_version") {
266 source = "//chrome/app/chrome_version.rc.version"
267 output = "$target_gen_dir/chrome_exe_version.rc"
270 rebase_path("app/chrome_exe.ver", root_build_dir),
274 process_version("chrome_dll_version") {
275 source = "//chrome/app/chrome_version.rc.version"
276 output = "$target_gen_dir/chrome_dll_version.rc"
279 rebase_path("app/chrome_dll.ver", root_build_dir),
283 process_version("nacl64_exe_version") {
284 source = "//chrome/app/chrome_version.rc.version"
285 output = "$target_gen_dir/nacl64_exe_version.rc"
288 rebase_path("app/nacl64_exe.ver", root_build_dir),
292 process_version("other_version") {
293 source = "//chrome/app/chrome_version.rc.version"
294 output = "$target_gen_dir/other_version.rc"
297 rebase_path("app/other.ver", root_build_dir),
301 group("chrome_version_resources") {
303 ":chrome_exe_version",
304 ":chrome_dll_version",
305 ":nacl64_exe_version",
310 source_set("image_pre_reader") {
312 "app/image_pre_reader_win.cc",
313 "app/image_pre_reader_win.h",
321 # GYP version: chrome/chrome_resources.gyp:chrome_resources
324 # Note: GYP lists some dependencies in addition to these actions. However,
325 # these are just dependencies for the actions themselves, which our actions
326 # list individually when needed.
327 "//chrome/browser:resources",
328 "//chrome/common:resources",
329 "//chrome/renderer:resources",
332 if (enable_extensions) {
333 deps += [ "//chrome/common:extensions_api_resources" ]
337 # GYP version: chrome/chrome_resources.gyp:chrome_extra_resources
338 group("extra_resources") {
340 "//chrome/browser/resources:invalidations_resources",
341 "//chrome/browser/resources:memory_internals_resources",
342 "//chrome/browser/resources:net_internals_resources",
343 "//chrome/browser/resources:password_manager_internals_resources",
344 "//chrome/browser/resources:signin_internals_resources",
345 "//chrome/browser/resources:sync_internals_resources",
346 "//chrome/browser/resources:translate_internals_resources",
350 "//chrome/browser/resources:component_extension_resources",
351 "//chrome/browser/resources:options_resources",
355 if (enable_chromevox_next) {
357 #'browser/resources/chromeos/chromevox2/chromevox.gyp:chromevox2', TODO(GYP)
361 #'browser/resources/chromeos/chromevox/chromevox.gyp:chromevox', TODO(GYP)
365 if (enable_extensions) {
367 "//chrome/browser/resources:quota_internals_resources",
368 "//chrome/browser/resources:sync_file_system_internals_resources",
373 group("packed_resources") {
375 ":repack_locales_pack",
376 ":repack_pseudo_locales_pack",
377 ":repack_chrome_100_percent",
380 # TODO(GYP) if (is_chrome_branded) {
381 # ... copy default_apps from default_apps_list
384 deps += [ ":repack_chrome_200_percent" ]
388 repack("packed_extra_resources") {
389 visibility = [ "./*" ]
391 "$root_gen_dir/chrome/browser_resources.pak",
392 "$root_gen_dir/chrome/chrome_unscaled_resources.pak",
393 "$root_gen_dir/chrome/common_resources.pak",
394 "$root_gen_dir/chrome/invalidations_resources.pak",
395 "$root_gen_dir/chrome/memory_internals_resources.pak",
396 "$root_gen_dir/chrome/net_internals_resources.pak",
397 "$root_gen_dir/chrome/password_manager_internals_resources.pak",
398 "$root_gen_dir/chrome/signin_internals_resources.pak",
399 "$root_gen_dir/chrome/sync_internals_resources.pak",
400 "$root_gen_dir/chrome/translate_internals_resources.pak",
401 "$root_gen_dir/components/components_resources.pak",
402 "$root_gen_dir/net/net_resources.pak",
403 "$root_gen_dir/ui/resources/webui_resources.pak",
406 "//chrome/browser:resources",
407 "//chrome/app/theme:chrome_unscaled_resources",
408 "//chrome/common:resources",
409 "//chrome/browser/resources:invalidations_resources",
410 "//chrome/browser/resources:memory_internals_resources",
411 "//chrome/browser/resources:net_internals_resources",
412 "//chrome/browser/resources:password_manager_internals_resources",
413 "//chrome/browser/resources:signin_internals_resources",
414 "//chrome/browser/resources:sync_internals_resources",
415 "//chrome/browser/resources:translate_internals_resources",
416 "//components/resources",
417 "//net:net_resources",
421 if (!is_ios && !is_android) {
422 # New paks should be added here by default.
424 "$root_gen_dir/chrome/component_extension_resources.pak",
425 "$root_gen_dir/chrome/options_resources.pak",
426 "$root_gen_dir/chrome/quota_internals_resources.pak",
427 "$root_gen_dir/chrome/sync_file_system_internals_resources.pak",
428 "$root_gen_dir/chrome/webrtc_device_provider_resources.pak",
429 "$root_gen_dir/blink/devtools_resources.pak",
432 "//chrome/browser/devtools:webrtc_device_provider_resources",
433 "//chrome/browser/resources:component_extension_resources",
434 "//chrome/browser/resources:options_resources",
435 "//chrome/browser/resources:quota_internals_resources",
436 "//chrome/browser/resources:sync_file_system_internals_resources",
437 "//content/browser/devtools:devtools_resources",
442 "$root_gen_dir/blink/public/resources/blink_resources.pak",
443 "$root_gen_dir/content/browser/tracing/tracing_resources.pak",
444 "$root_gen_dir/content/content_resources.pak",
448 sources += [ "$root_gen_dir/ui/file_manager/file_manager_resources.pak" ]
449 deps += [ "//ui/file_manager:resources" ]
451 if (enable_extensions) {
453 "$root_gen_dir/chrome/extensions_api_resources.pak",
454 "$root_gen_dir/extensions/extensions_renderer_resources.pak",
455 "$root_gen_dir/extensions/extensions_resources.pak",
457 deps += [ "//chrome/common:extensions_api_resources" ]
460 # GYP outputs the file in the gen/repack directory. On non-Mac/iOS platforms
461 # it them copies it. This skipes the copy step and writes it to the final
463 if (is_mac || is_ios) {
464 output = "$root_gen_dir/repack/resources.pak"
466 output = "$root_out_dir/resources.pak"
470 # GYP version: chrome/chrome_resources.gyp:browser_tests_pak
471 repack("browser_tests_pak") {
473 "$root_gen_dir/chrome/options_test_resources.pak",
475 output = "$root_out_dir/browser_tests.pak"
478 # Collects per-locale grit files from many sources into global per-locale files.
479 chrome_repack_locales("repack_locales_pack") {
480 visibility = [ ":*" ]
482 input_locales = locales
485 output_locales = locales_as_mac_outputs
487 output_locales = locales
491 chrome_repack_locales("repack_pseudo_locales_pack") {
492 visibility = [ ":*" ]
494 input_locales = [ "fake-bidi" ]
497 output_locales = [ "fake_bidi" ] # Mac uses underscores.
499 output_locales = [ "fake-bidi" ]
503 # Generates a rule to repack a set of resources, substituting a given string
504 # in for the percentage (e.g. "100", "200"). It generates the repacked files in
505 # the "gen" directory, and then introduces a copy rule to copy it to the root
508 # It's not clear why this two-step dance is necessary as opposed to just
509 # generating the file in the destination. However, this is what the GYP build
510 # does, and for maintenance purposes, this keeps the same files in the same
511 # place between the two builds when possible.
515 # String to substitute for the percentage.
516 template("chrome_repack_percent") {
517 percent = invoker.percent
519 repack_name = "${target_name}_repack"
520 repack_output_file = "$root_gen_dir/repack/chrome_${percent}_percent.pak"
522 copy_name = target_name
524 repack(repack_name) {
525 visibility = [ ":$copy_name" ]
527 # All sources should also have deps for completeness.
529 "$root_gen_dir/components/components_resources_${percent}_percent.pak",
530 "$root_gen_dir/ui/resources/ui_resources_${percent}_percent.pak",
531 "$root_gen_dir/chrome/renderer_resources_${percent}_percent.pak",
532 "$root_gen_dir/chrome/theme_resources_${percent}_percent.pak",
536 "//chrome/app/theme:theme_resources",
537 "//chrome/renderer:resources",
538 "//components/strings",
539 "//net:net_resources",
543 sources += [ "$root_gen_dir/content/app/resources/content_resources_${percent}_percent.pak" ]
544 deps += [ "//content:resources" ]
548 [ "$root_gen_dir/ash/resources/ash_resources_${percent}_percent.pak" ]
549 deps += [ "//ash/resources" ]
552 sources += [ "$root_gen_dir/ui/chromeos/resources/ui_chromeos_resources_${percent}_percent.pak" ]
553 deps += [ "//ui/chromeos/resources" ]
555 if (enable_extensions) {
556 sources += [ "$root_gen_dir/extensions/extensions_browser_resources_${percent}_percent.pak" ]
559 output = repack_output_file
563 visibility = [ ":*" ]
571 "$root_build_dir/chrome_${percent}_percent.pak",
576 chrome_repack_percent("repack_chrome_100_percent") {
581 chrome_repack_percent("repack_chrome_200_percent") {
586 # GYP version: chrome/chrome_resources.gyp:chrome_strings
589 "//chrome/app:chromium_strings",
590 "//chrome/app:generated_resources",
591 "//chrome/app:google_chrome_strings",
592 "//chrome/app/resources:locale_settings",
597 # GYP: //chrome/chrome.gyp:content_setting_java
598 java_cpp_enum("content_setting_javagen") {
600 "../components/content_settings/core/common/content_settings.h",
603 "org/chromium/chrome/browser/ContentSetting.java",
607 # GYP: //chrome/chrome.gyp:content_settings_type_java
608 java_cpp_enum("content_settings_type_javagen") {
610 "../components/content_settings/core/common/content_settings_types.h",
613 "org/chromium/chrome/browser/ContentSettingsType.java",
617 # GYP: //chrome/chrome.gyp:page_info_connection_type_java
618 java_cpp_enum("page_info_connection_type_javagen") {
620 "browser/ui/android/website_settings_popup_android.h",
623 "org/chromium/chrome/browser/PageInfoConnectionType.java",
627 # GYP: //chrome/chrome_android.gypi:chrome_android_core
628 static_library("chrome_android_core") {
630 "app/android/chrome_android_initializer.cc",
631 "app/android/chrome_android_initializer.h",
632 "app/android/chrome_jni_onload.cc",
633 "app/android/chrome_main_delegate_android.cc",
634 "app/android/chrome_main_delegate_android.h",
635 "app/chrome_main_delegate.cc",
636 "app/chrome_main_delegate.h",
639 include_dirs = [ android_ndk_include_dir ]
648 "//chrome/browser/ui",
652 "//components/enhanced_bookmarks",
653 "//content/public/app:browser",