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 "app/chrome_exe_main_win.cc",
37 "app/signature_validator_win.cc",
38 "app/signature_validator_win.h",
39 "//content/app/startup_helper_win.cc",
41 deps += [ "//ui/gfx" ]
42 } else if (use_aura) {
43 # Non-Windows aura entrypoint.
44 sources += [ "app/chrome_exe_main_aura.cc" ]
48 # TODO(GYP) manpage action
51 "app/chrome_dll_resource.h",
53 "app/chrome_main_delegate.cc",
54 "app/chrome_main_delegate.h",
58 # On Linux, link the dependencies (libraries) that make up actual
59 # Chromium functionality directly into the executable.
60 ":browser_dependencies",
61 ":child_dependencies",
64 # Needed to use the master_preferences functions
65 "//chrome/installer/util",
66 "//content/public/app:both",
69 # Needed for chrome_main.cc initialization of libraries.
70 configs += [ "//build/config/linux:pangocairo" ]
72 # TODO(GYP) ['profiling==0 and linux_disable_pie==0', {
80 "//build/config/linux:x11",
81 "//build/config/linux:xext",
87 sources += [ "app/chrome_exe_main_mac.cc" ]
88 # TODO(GYP) lots more stuff in the is_mac block.
91 ":packed_extra_resources",
94 # Copy Flash Player files to PRODUCT_DIR if applicable. Let the .gyp
95 # file decide what to do on a per-OS basis; on Mac, internal plugins
96 # go inside the framework, so this dependency is in chrome_dll.gypi.
97 #'../third_party/adobe/flash/flash_player.gyp:flapper_binaries', TODO(GYP)
99 # Copy CDM files to PRODUCT_DIR if applicable. Let the .gyp
100 # file decide what to do on a per-OS basis; on Mac, internal plugins
101 # go inside the framework, so this dependency is in chrome_dll.gypi.
102 #'../third_party/widevine/cdm/widevine_cdm.gyp:widevinecdmadapter', TODO(GYP)
104 # TODO(GYP) some stuff from GYP including chrome_multiple_dll.
108 # On Mac this is done in chrome_dll.gypi.
109 datadeps += [ "//pdf" ]
110 # TODO(GYP) pdf linux symbols
115 shared_library("main_dll") {
116 configs += [ "//build/config/compiler:wexit_time_destructors" ]
119 ":browser_dependencies",
123 output_name = "chrome"
126 "app/chrome_command_ids.h",
128 "app/chrome_dll_resource.h",
129 "app/chrome_main.cc",
130 "app/chrome_main_delegate.cc",
131 "app/chrome_main_delegate.h",
132 "app/close_handle_hook_win.cc",
133 "app/close_handle_hook_win.h",
134 "app/delay_load_hook_win.cc",
135 "app/delay_load_hook_win.h",
136 "//base/win/dllmain.cc",
140 # On Windows, link the dependencies (libraries) that make up actual
141 # Chromium functionality into this .dll.
142 #'chrome_version_resources', TODO(GYP)
143 "//chrome/app/theme:chrome_unscaled_resources",
144 "//content/app/resources",
146 "//net:net_resources",
150 #'<(DEPTH)/chrome_elf/chrome_elf.gyp:chrome_elf' ] TODO(GYP)
152 if (enable_configuration_policy) {
153 deps += [ "//components/policy" ]
155 if (cpu_arch == "x86") {
156 # Add a dependency to custom import library for user32 delay imports only
158 #deps += [ 'chrome_user32_delay_imports' ] TODO(GYP)
161 # TODO(GYP) incremental linking flags in debug builds
162 #'LinkIncremental': '<(msvs_large_module_debug_link_mode)',
164 # TODO(GYP) Lots of VCLinkerTool stuff on Windows.
166 # TODO(GYP) chrome_pgo_phase on Windows.
170 deps += [ "//ui/compositor" ]
173 #TODO(GYP) add chrome_multiple_dll support
174 if (false) { #chrome_multiple_dll) {
175 defines = [ "CHROME_MULTIPLE_DLL_BROWSER" ]
176 deps += [ "//content/public/app:browser" ]
179 ":child_dependencies",
180 "//content/public/app:both",
184 if (cld_version == 0 || cld_version == 2) {
185 deps += [ "//third_party/cld_2" ]
189 #['OS=="mac" and component!="shared_library"', { TODO(GYP)
190 # 'includes': [ 'chrome_dll_bundle.gypi' ],
192 # TODO(GYP) Lots of other stuff in the OS=="mac" block.
196 # GYP version: chromium_browser_dependencies variable in chrome.gyp
197 group("browser_dependencies") {
204 deps += [ "//ppapi:ppapi_host" ]
207 if (enable_basic_printing || enable_print_preview) {
208 deps += [ "//printing" ]
209 if (enable_print_preview) {
210 deps += [ "//chrome/service" ]
215 # GYP version: chromium_child_dependencies variable in chrome.gyp
216 group("child_dependencies") {
223 "//chrome/browser/devtools",
227 "//content/public/child",
228 "//third_party/WebKit/public:blink_devtools_frontend_resources",
231 if (cld_version == 0 || cld_version == 2) {
232 deps += [ "//third_party/cld_2:cld2_platform_impl" ]
237 # TODO(brettw) this duplicates "//chrome/common:version" which applies to
239 process_version("version_header") {
240 # TODO(brettW) this should have more reduced visibility, but chrome/browser
241 # currently depends on this.
242 #visibility = [ ":*" ]
243 source = "version.h.in"
245 # TODO(brettw) this should move to $target_gen_dir/version.h and
246 # source files including it should reference it via "chrome/version.h"
247 output = "$root_gen_dir/version.h"
251 # GYP version: chrome/chrome_resources.gyp:chrome_resources
254 # Note: GYP lists some dependencies in addition to these actions. However,
255 # these are just dependencies for the actions themselves, which our actions
256 # list individually when needed.
257 "//chrome/browser:resources",
258 "//chrome/common:resources",
259 "//chrome/renderer:resources",
262 if (enable_extensions) {
263 deps += [ "//chrome/common:extensions_api_resources" ]
267 # GYP version: chrome/chrome_resources.gyp:chrome_extra_resources
268 group("extra_resources") {
270 "//chrome/browser/resources:invalidations_resources",
271 "//chrome/browser/resources:memory_internals_resources",
272 "//chrome/browser/resources:net_internals_resources",
273 "//chrome/browser/resources:password_manager_internals_resources",
274 "//chrome/browser/resources:signin_internals_resources",
275 "//chrome/browser/resources:sync_internals_resources",
276 "//chrome/browser/resources:translate_internals_resources",
280 "//chrome/browser/resources:component_extension_resources",
281 "//chrome/browser/resources:options_resources",
285 if (enable_chromevox_next) {
287 #'browser/resources/chromeos/chromevox2/chromevox.gyp:chromevox2', TODO(GYP)
291 #'browser/resources/chromeos/chromevox/chromevox.gyp:chromevox', TODO(GYP)
295 if (enable_extensions) {
297 "//chrome/browser/resources:quota_internals_resources",
298 "//chrome/browser/resources:sync_file_system_internals_resources",
303 group("packed_resources") {
305 ":repack_locales_pack",
306 ":repack_pseudo_locales_pack",
307 ":repack_chrome_100_percent",
310 # TODO(GYP) if (is_chrome_branded) {
311 # ... copy default_apps from default_apps_list
314 deps += [ ":repack_chrome_200_percent" ]
318 repack("packed_extra_resources") {
319 visibility = [ "./*" ]
321 "$root_gen_dir/chrome/browser_resources.pak",
322 "$root_gen_dir/chrome/chrome_unscaled_resources.pak",
323 "$root_gen_dir/chrome/common_resources.pak",
324 "$root_gen_dir/chrome/invalidations_resources.pak",
325 "$root_gen_dir/chrome/memory_internals_resources.pak",
326 "$root_gen_dir/chrome/net_internals_resources.pak",
327 "$root_gen_dir/chrome/password_manager_internals_resources.pak",
328 "$root_gen_dir/chrome/signin_internals_resources.pak",
329 "$root_gen_dir/chrome/sync_internals_resources.pak",
330 "$root_gen_dir/chrome/translate_internals_resources.pak",
331 "$root_gen_dir/components/components_resources.pak",
332 "$root_gen_dir/net/net_resources.pak",
333 "$root_gen_dir/ui/resources/webui_resources.pak",
336 "//chrome/browser:resources",
337 "//chrome/app/theme:chrome_unscaled_resources",
338 "//chrome/common:resources",
339 "//chrome/browser/resources:invalidations_resources",
340 "//chrome/browser/resources:memory_internals_resources",
341 "//chrome/browser/resources:net_internals_resources",
342 "//chrome/browser/resources:password_manager_internals_resources",
343 "//chrome/browser/resources:signin_internals_resources",
344 "//chrome/browser/resources:sync_internals_resources",
345 "//chrome/browser/resources:translate_internals_resources",
346 "//components/resources",
347 "//net:net_resources",
351 if (!is_ios && !is_android) {
352 # New paks should be added here by default.
354 "$root_gen_dir/chrome/component_extension_resources.pak",
355 "$root_gen_dir/chrome/options_resources.pak",
356 "$root_gen_dir/chrome/quota_internals_resources.pak",
357 "$root_gen_dir/chrome/sync_file_system_internals_resources.pak",
358 "$root_gen_dir/chrome/webrtc_device_provider_resources.pak",
359 "$root_gen_dir/webkit/devtools_resources.pak",
362 "//chrome/browser/devtools:webrtc_device_provider_resources",
363 "//chrome/browser/resources:component_extension_resources",
364 "//chrome/browser/resources:options_resources",
365 "//chrome/browser/resources:quota_internals_resources",
366 "//chrome/browser/resources:sync_file_system_internals_resources",
367 "//content/browser/devtools:devtools_resources",
372 "$root_gen_dir/blink/public/resources/blink_resources.pak",
373 "$root_gen_dir/content/browser/tracing/tracing_resources.pak",
374 "$root_gen_dir/content/content_resources.pak",
378 sources += [ "$root_gen_dir/ui/file_manager/file_manager_resources.pak" ]
379 deps += [ "//ui/file_manager:resources" ]
381 if (enable_extensions) {
383 "$root_gen_dir/chrome/extensions_api_resources.pak",
384 "$root_gen_dir/extensions/extensions_renderer_resources.pak",
385 "$root_gen_dir/extensions/extensions_resources.pak",
387 deps += [ "//chrome/common:extensions_api_resources" ]
390 # GYP outputs the file in the gen/repack directory. On non-Mac/iOS platforms
391 # it them copies it. This skipes the copy step and writes it to the final
393 if (is_mac || is_ios) {
394 output = "$root_gen_dir/repack/resources.pak"
396 output = "$root_out_dir/resources.pak"
400 # GYP version: chrome/chrome_resources.gyp:browser_tests_pak
401 repack("browser_tests_pak") {
403 "$root_gen_dir/chrome/options_test_resources.pak",
405 output = "$root_out_dir/browser_tests.pak"
408 # Collects per-locale grit files from many sources into global per-locale files.
409 chrome_repack_locales("repack_locales_pack") {
410 visibility = [ ":*" ]
412 input_locales = locales
415 output_locales = locales_as_mac_outputs
417 output_locales = locales
421 chrome_repack_locales("repack_pseudo_locales_pack") {
422 visibility = [ ":*" ]
424 input_locales = [ "fake-bidi" ]
427 output_locales = [ "fake_bidi" ] # Mac uses underscores.
429 output_locales = [ "fake-bidi" ]
433 # Generates a rule to repack a set of resources, substituting a given string
434 # in for the percentage (e.g. "100", "200"). It generates the repacked files in
435 # the "gen" directory, and then introduces a copy rule to copy it to the root
438 # It's not clear why this two-step dance is necessary as opposed to just
439 # generating the file in the destination. However, this is what the GYP build
440 # does, and for maintenance purposes, this keeps the same files in the same
441 # place between the two builds when possible.
445 # String to substitute for the percentage.
446 template("chrome_repack_percent") {
447 percent = invoker.percent
449 repack_name = "${target_name}_repack"
450 repack_output_file = "$root_gen_dir/repack/chrome_${percent}_percent.pak"
452 copy_name = target_name
454 repack(repack_name) {
455 visibility = [ ":$copy_name" ]
457 # All sources should also have deps for completeness.
459 "$root_gen_dir/components/components_resources_${percent}_percent.pak",
460 "$root_gen_dir/ui/resources/ui_resources_${percent}_percent.pak",
461 "$root_gen_dir/chrome/renderer_resources_${percent}_percent.pak",
462 "$root_gen_dir/chrome/theme_resources_${percent}_percent.pak",
466 "//chrome/app/theme:theme_resources",
467 "//chrome/renderer:resources",
468 "//components/strings",
469 "//net:net_resources",
473 sources += [ "$root_gen_dir/content/app/resources/content_resources_${percent}_percent.pak" ]
474 deps += [ "//content:resources" ]
478 [ "$root_gen_dir/ash/resources/ash_resources_${percent}_percent.pak" ]
479 deps += [ "//ash/resources" ]
482 sources += [ "$root_gen_dir/athena/resources/athena_resources_${percent}_percent.pak" ]
483 deps += [ "//athena/resources" ]
486 sources += [ "$root_gen_dir/ui/chromeos/resources/ui_chromeos_resources_${percent}_percent.pak" ]
487 deps += [ "//ui/chromeos/resources" ]
489 if (enable_extensions) {
490 sources += [ "$root_gen_dir/extensions/extensions_browser_resources_${percent}_percent.pak" ]
493 output = repack_output_file
497 visibility = [ ":*" ]
505 "$root_build_dir/chrome_${percent}_percent.pak",
510 chrome_repack_percent("repack_chrome_100_percent") {
515 chrome_repack_percent("repack_chrome_200_percent") {
520 # GYP version: chrome/chrome_resources.gyp:chrome_strings
523 "//chrome/app:chromium_strings",
524 "//chrome/app:generated_resources",
525 "//chrome/app:google_chrome_strings",
526 "//chrome/app/resources:locale_settings",
531 # GYP: //chrome/chrome.gyp:content_setting_java
532 java_cpp_enum("content_setting_javagen") {
534 "../components/content_settings/core/common/content_settings.h",
537 "org/chromium/chrome/browser/ContentSetting.java",
541 # GYP: //chrome/chrome.gyp:content_settings_type_java
542 java_cpp_enum("content_settings_type_javagen") {
544 "../components/content_settings/core/common/content_settings_types.h",
547 "org/chromium/chrome/browser/ContentSettingsType.java",
551 # GYP: //chrome/chrome.gyp:page_info_connection_type_java
552 java_cpp_enum("page_info_connection_type_javagen") {
554 "browser/ui/android/website_settings_popup_android.h",
557 "org/chromium/chrome/browser/PageInfoConnectionType.java",
561 # GYP: //chrome/chrome_android.gypi:chrome_android_core
562 static_library("chrome_android_core") {
564 "app/android/chrome_android_initializer.cc",
565 "app/android/chrome_android_initializer.h",
566 "app/android/chrome_main_delegate_android.cc",
567 "app/android/chrome_main_delegate_android.h",
568 "app/chrome_main_delegate.cc",
569 "app/chrome_main_delegate.h",
572 include_dirs = [ android_ndk_include_dir ]
581 "//chrome/browser/ui",
585 "//components/enhanced_bookmarks",
586 "//content/public/app:browser",