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_android && !(is_chromeos && !use_ozone)) {
17 # TODO(GYP) for Windows need to the the reorder-imports step which probably
18 # means adding another target and renaming this to chrome_initial like in GYP.
19 executable("chrome") {
20 # Because the sources list varies so significantly per-platform, generally
21 # each platform lists its own files rather than relying on filtering or
22 # removing unused files.
24 "app/chrome_exe_resource.h",
29 # TODO(GYP) mac_bundle_resources, xcode_settings
31 # TODO(GYP) order_profiling, order_text_section
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",
42 deps += [ "//ui/gfx" ]
43 } else if (use_aura) {
44 # Non-Windows aura entrypoint.
45 sources += [ "app/chrome_exe_main_aura.cc" ]
49 # TODO(GYP) manpage action
52 "app/chrome_dll_resource.h",
54 "app/chrome_main_delegate.cc",
55 "app/chrome_main_delegate.h",
59 # On Linux, link the dependencies (libraries) that make up actual
60 # Chromium functionality directly into the executable.
61 ":browser_dependencies",
62 ":child_dependencies",
65 # Needed to use the master_preferences functions
66 "//chrome/installer/util",
67 "//content/public/app:both",
70 # Needed for chrome_main.cc initialization of libraries.
71 configs += [ "//build/config/linux:pangocairo" ]
73 # TODO(GYP) ['profiling==0 and linux_disable_pie==0', {
81 "//build/config/linux:x11",
82 "//build/config/linux:xext",
89 "app/chrome_exe_main_mac.cc",
91 # TODO(GYP) lots more stuff in the is_mac block.
94 ":packed_extra_resources",
97 # Copy Flash Player files to PRODUCT_DIR if applicable. Let the .gyp
98 # file decide what to do on a per-OS basis; on Mac, internal plugins
99 # go inside the framework, so this dependency is in chrome_dll.gypi.
100 #'../third_party/adobe/flash/flash_player.gyp:flapper_binaries', TODO(GYP)
102 # Copy CDM files to PRODUCT_DIR if applicable. Let the .gyp
103 # file decide what to do on a per-OS basis; on Mac, internal plugins
104 # go inside the framework, so this dependency is in chrome_dll.gypi.
105 #'../third_party/widevine/cdm/widevine_cdm.gyp:widevinecdmadapter', TODO(GYP)
108 # TODO(GYP) some stuff from GYP including chrome_multiple_dll.
114 # On Mac this is done in chrome_dll.gypi.
115 datadeps += [ "//pdf" ]
117 # TODO(GYP) pdf linux symbols
123 shared_library("main_dll") {
124 configs += [ "//build/config/compiler:wexit_time_destructors" ]
127 ":browser_dependencies",
131 output_name = "chrome"
134 "app/chrome_command_ids.h",
136 "app/chrome_dll_resource.h",
137 "app/chrome_main.cc",
138 "app/chrome_main_delegate.cc",
139 "app/chrome_main_delegate.h",
140 "app/close_handle_hook_win.cc",
141 "app/close_handle_hook_win.h",
142 "app/delay_load_hook_win.cc",
143 "app/delay_load_hook_win.h",
144 "//base/win/dllmain.cc",
148 # On Windows, link the dependencies (libraries) that make up actual
149 # Chromium functionality into this .dll.
150 #'chrome_version_resources', TODO(GYP)
151 "//chrome/app/theme:chrome_unscaled_resources",
152 "//content/app/resources",
154 "//net:net_resources",
157 #'<(DEPTH)/chrome_elf/chrome_elf.gyp:chrome_elf' ] TODO(GYP)
159 if (enable_configuration_policy) {
160 deps += [ "//components/policy" ]
162 if (cpu_arch == "x86") {
163 # Add a dependency to custom import library for user32 delay imports only
165 #deps += [ 'chrome_user32_delay_imports' ] TODO(GYP)
168 # TODO(GYP) incremental linking flags in debug builds
169 #'LinkIncremental': '<(msvs_large_module_debug_link_mode)',
171 # TODO(GYP) Lots of VCLinkerTool stuff on Windows.
173 # TODO(GYP) chrome_pgo_phase on Windows.
177 deps += [ "//ui/compositor" ]
180 #TODO(GYP) add chrome_multiple_dll support
181 if (false) { #chrome_multiple_dll) {
182 defines = [ "CHROME_MULTIPLE_DLL_BROWSER" ]
184 "//content/public/app:browser",
188 ":child_dependencies",
189 "//content/public/app:both",
193 if (cld_version == 0 || cld_version == 2) {
195 "//third_party/cld_2",
200 #['OS=="mac" and component!="shared_library"', { TODO(GYP)
201 # 'includes': [ 'chrome_dll_bundle.gypi' ],
204 # TODO(GYP) Lots of other stuff in the OS=="mac" block.
208 # GYP version: chromium_browser_dependencies variable in chrome.gyp
209 group("browser_dependencies") {
217 "//ppapi:ppapi_host",
221 if (enable_basic_printing || enable_print_preview) {
222 deps += [ "//printing" ]
223 if (enable_print_preview) {
224 deps += [ "//chrome/service" ]
229 # GYP version: chromium_child_dependencies variable in chrome.gyp
230 group("child_dependencies") {
237 "//chrome/browser/devtools",
241 "//content/public/child",
242 "//third_party/WebKit/public:blink_devtools_frontend_resources",
245 if (cld_version == 0 || cld_version == 2) {
247 "//third_party/cld_2:cld2_platform_impl",
253 # TODO(brettw) this duplicates "//chrome/common:version" which applies to
255 process_version("version_header") {
256 # TODO(brettW) this should have more reduced visibility, but chrome/browser
257 # currently depends on this.
258 #visibility = [ ":*" ]
259 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"
266 # GYP version: chrome/chrome_resources.gyp:chrome_resources
269 # Note: GYP lists some dependencies in addition to these actions. However,
270 # these are just dependencies for the actions themselves, which our actions
271 # list individually when needed.
272 "//chrome/browser:resources",
273 "//chrome/common:resources",
274 "//chrome/renderer:resources",
277 if (enable_extensions) {
278 deps += [ "//chrome/common:extensions_api_resources" ]
282 # GYP version: chrome/chrome_resources.gyp:chrome_extra_resources
283 group("extra_resources") {
285 "//chrome/browser/resources:invalidations_resources",
286 "//chrome/browser/resources:memory_internals_resources",
287 "//chrome/browser/resources:net_internals_resources",
288 "//chrome/browser/resources:password_manager_internals_resources",
289 "//chrome/browser/resources:signin_internals_resources",
290 "//chrome/browser/resources:sync_internals_resources",
291 "//chrome/browser/resources:translate_internals_resources",
295 "//chrome/browser/resources:component_extension_resources",
296 "//chrome/browser/resources:options_resources",
300 if (enable_chromevox_next) {
302 #'browser/resources/chromeos/chromevox2/chromevox.gyp:chromevox2', TODO(GYP)
306 #'browser/resources/chromeos/chromevox/chromevox.gyp:chromevox', TODO(GYP)
310 if (enable_extensions) {
312 "//chrome/browser/resources:quota_internals_resources",
313 "//chrome/browser/resources:sync_file_system_internals_resources",
318 group("packed_resources") {
320 ":repack_locales_pack",
321 ":repack_pseudo_locales_pack",
322 ":repack_chrome_100_percent",
325 # TODO(GYP) if (is_chrome_branded) {
326 # ... copy default_apps from default_apps_list
329 deps += [ ":repack_chrome_200_percent" ]
333 repack("packed_extra_resources") {
334 visibility = [ "./*" ]
336 "$root_gen_dir/chrome/browser_resources.pak",
337 "$root_gen_dir/chrome/chrome_unscaled_resources.pak",
338 "$root_gen_dir/chrome/common_resources.pak",
339 "$root_gen_dir/chrome/invalidations_resources.pak",
340 "$root_gen_dir/chrome/memory_internals_resources.pak",
341 "$root_gen_dir/chrome/net_internals_resources.pak",
342 "$root_gen_dir/chrome/password_manager_internals_resources.pak",
343 "$root_gen_dir/chrome/signin_internals_resources.pak",
344 "$root_gen_dir/chrome/sync_internals_resources.pak",
345 "$root_gen_dir/chrome/translate_internals_resources.pak",
346 "$root_gen_dir/components/components_resources.pak",
347 "$root_gen_dir/net/net_resources.pak",
348 "$root_gen_dir/ui/resources/webui_resources.pak",
351 "//chrome/browser:resources",
352 "//chrome/app/theme:chrome_unscaled_resources",
353 "//chrome/common:resources",
354 "//chrome/browser/resources:invalidations_resources",
355 "//chrome/browser/resources:memory_internals_resources",
356 "//chrome/browser/resources:net_internals_resources",
357 "//chrome/browser/resources:password_manager_internals_resources",
358 "//chrome/browser/resources:signin_internals_resources",
359 "//chrome/browser/resources:sync_internals_resources",
360 "//chrome/browser/resources:translate_internals_resources",
361 "//components/resources",
362 "//net:net_resources",
366 if (!is_ios && !is_android) {
367 # New paks should be added here by default.
369 "$root_gen_dir/webkit/devtools_resources.pak",
370 "$root_gen_dir/chrome/component_extension_resources.pak",
371 "$root_gen_dir/chrome/options_resources.pak",
372 "$root_gen_dir/chrome/quota_internals_resources.pak",
373 "$root_gen_dir/chrome/sync_file_system_internals_resources.pak",
376 "//content/browser/devtools:devtools_resources",
377 "//chrome/browser/resources:component_extension_resources",
378 "//chrome/browser/resources:options_resources",
379 "//chrome/browser/resources:quota_internals_resources",
380 "//chrome/browser/resources:sync_file_system_internals_resources",
385 "$root_gen_dir/blink/public/resources/blink_resources.pak",
386 "$root_gen_dir/content/browser/tracing/tracing_resources.pak",
387 "$root_gen_dir/content/content_resources.pak",
391 sources += [ "$root_gen_dir/ui/file_manager/file_manager_resources.pak" ]
392 deps += [ "//ui/file_manager:resources" ]
394 if (enable_extensions) {
396 "$root_gen_dir/chrome/extensions_api_resources.pak",
397 "$root_gen_dir/extensions/extensions_renderer_resources.pak",
398 "$root_gen_dir/extensions/extensions_resources.pak",
400 deps += [ "//chrome/common:extensions_api_resources" ]
403 # GYP outputs the file in the gen/repack directory. On non-Mac/iOS platforms
404 # it them copies it. This skipes the copy step and writes it to the final
406 if (is_mac || is_ios) {
407 output = "$root_gen_dir/repack/resources.pak"
409 output = "$root_out_dir/resources.pak"
413 # GYP version: chrome/chrome_resources.gyp:browser_tests_pak
414 repack("browser_tests_pak") {
416 "$root_gen_dir/chrome/options_test_resources.pak",
418 output = "$root_out_dir/browser_tests.pak"
421 # Collects per-locale grit files from many sources into global per-locale files.
422 chrome_repack_locales("repack_locales_pack") {
423 visibility = [ ":*" ]
425 input_locales = locales
428 output_locales = locales_as_mac_outputs
430 output_locales = locales
434 chrome_repack_locales("repack_pseudo_locales_pack") {
435 visibility = [ ":*" ]
437 input_locales = [ "fake-bidi" ]
440 output_locales = [ "fake_bidi" ] # Mac uses underscores.
442 output_locales = [ "fake-bidi" ]
446 # Generates a rule to repack a set of resources, substituting a given string
447 # in for the percentage (e.g. "100", "200"). It generates the repacked files in
448 # the "gen" directory, and then introduces a copy rule to copy it to the root
451 # It's not clear why this two-step dance is necessary as opposed to just
452 # generating the file in the destination. However, this is what the GYP build
453 # does, and for maintenance purposes, this keeps the same files in the same
454 # place between the two builds when possible.
458 # String to substitute for the percentage.
459 template("chrome_repack_percent") {
460 percent = invoker.percent
462 repack_name = "${target_name}_repack"
463 repack_output_file = "$root_gen_dir/repack/chrome_${percent}_percent.pak"
465 copy_name = target_name
467 repack(repack_name) {
468 visibility = [ ":$copy_name" ]
469 # All sources should also have deps for completeness.
471 "$root_gen_dir/components/components_resources_${percent}_percent.pak",
472 "$root_gen_dir/ui/resources/ui_resources_${percent}_percent.pak",
473 "$root_gen_dir/chrome/renderer_resources_${percent}_percent.pak",
474 "$root_gen_dir/chrome/theme_resources_${percent}_percent.pak",
478 "//chrome/app/theme:theme_resources",
479 "//chrome/renderer:resources",
480 "//components/strings",
481 "//net:net_resources",
486 "$root_gen_dir/content/app/resources/content_resources_${percent}_percent.pak",
488 deps += [ "//content:resources" ]
491 sources += [ "$root_gen_dir/ash/resources/ash_resources_${percent}_percent.pak" ]
492 deps += [ "//ash/resources" ]
496 "$root_gen_dir/athena/resources/athena_resources_${percent}_percent.pak",
498 deps += [ "//athena/resources" ]
502 "$root_gen_dir/ui/chromeos/resources/ui_chromeos_resources_${percent}_percent.pak",
504 deps += [ "//ui/chromeos/resources" ]
506 if (enable_extensions) {
508 "$root_gen_dir/extensions/extensions_browser_resources_${percent}_percent.pak",
512 output = repack_output_file
516 visibility = [ ":*" ]
517 deps = [ ":$repack_name" ]
518 sources = [ repack_output_file ]
519 outputs = [ "$root_build_dir/chrome_${percent}_percent.pak" ]
523 chrome_repack_percent("repack_chrome_100_percent") {
528 chrome_repack_percent("repack_chrome_200_percent") {
533 # GYP version: chrome/chrome_resources.gyp:chrome_strings
536 "//chrome/app:chromium_strings",
537 "//chrome/app:generated_resources",
538 "//chrome/app:google_chrome_strings",
539 "//chrome/app/resources:locale_settings",
545 # GYP: //chrome/chrome.gyp:content_setting_java
546 java_cpp_enum("content_setting_javagen") {
548 "../components/content_settings/core/common/content_settings.h"
551 "org/chromium/chrome/browser/ContentSetting.java",
555 # GYP: //chrome/chrome.gyp:content_settings_type_java
556 java_cpp_enum("content_settings_type_javagen") {
558 "../components/content_settings/core/common/content_settings_types.h"
561 "org/chromium/chrome/browser/ContentSettingsType.java",
565 # GYP: //chrome/chrome.gyp:page_info_connection_type_java
566 java_cpp_enum("page_info_connection_type_javagen") {
568 "browser/ui/android/website_settings_popup_android.h"
571 "org/chromium/chrome/browser/PageInfoConnectionType.java",
575 # GYP: //chrome/chrome_android.gypi:chrome_android_core
576 static_library("chrome_android_core") {
578 "app/android/chrome_android_initializer.cc",
579 "app/android/chrome_android_initializer.h",
580 "app/android/chrome_main_delegate_android.cc",
581 "app/android/chrome_main_delegate_android.h",
582 "app/chrome_main_delegate.cc",
583 "app/chrome_main_delegate.h",
587 android_ndk_include_dir,
597 "//chrome/browser/ui",
601 "//components/enhanced_bookmarks",
602 "//content/public/app:browser",