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",
43 "//chrome/browser:chrome_process_finder",
44 "//chrome/chrome_watcher",
45 "//chrome/chrome_watcher:client",
46 "//components/browser_watcher:browser_watcher_client",
49 } else if (use_aura) {
50 # Non-Windows aura entrypoint.
51 sources += [ "app/chrome_exe_main_aura.cc" ]
55 # TODO(GYP) manpage action
58 "app/chrome_dll_resource.h",
60 "app/chrome_main_delegate.cc",
61 "app/chrome_main_delegate.h",
65 # On Linux, link the dependencies (libraries) that make up actual
66 # Chromium functionality directly into the executable.
67 ":browser_dependencies",
68 ":child_dependencies",
71 # Needed to use the master_preferences functions
72 "//chrome/installer/util",
73 "//content/public/app:both",
76 # Needed for chrome_main.cc initialization of libraries.
77 configs += [ "//build/config/linux:pangocairo" ]
79 # TODO(GYP) ['profiling==0 and linux_disable_pie==0', {
87 "//build/config/linux:x11",
88 "//build/config/linux:xext",
94 sources += [ "app/chrome_exe_main_mac.cc" ]
95 # TODO(GYP) lots more stuff in the is_mac block.
98 ":packed_extra_resources",
101 # Copy Flash Player files to PRODUCT_DIR if applicable. Let the .gyp
102 # file decide what to do on a per-OS basis; on Mac, internal plugins
103 # go inside the framework, so this dependency is in chrome_dll.gypi.
104 #'../third_party/adobe/flash/flash_player.gyp:flapper_binaries', TODO(GYP)
106 # Copy CDM files to PRODUCT_DIR if applicable. Let the .gyp
107 # file decide what to do on a per-OS basis; on Mac, internal plugins
108 # go inside the framework, so this dependency is in chrome_dll.gypi.
109 #'../third_party/widevine/cdm/widevine_cdm.gyp:widevinecdmadapter', TODO(GYP)
111 # TODO(GYP) some stuff from GYP including chrome_multiple_dll.
115 # On Mac this is done in chrome_dll.gypi.
116 datadeps += [ "//pdf" ]
117 # TODO(GYP) pdf linux symbols
122 shared_library("main_dll") {
123 configs += [ "//build/config/compiler:wexit_time_destructors" ]
126 ":browser_dependencies",
130 output_name = "chrome"
133 "app/chrome_command_ids.h",
135 "app/chrome_dll_resource.h",
136 "app/chrome_main.cc",
137 "app/chrome_main_delegate.cc",
138 "app/chrome_main_delegate.h",
139 "app/close_handle_hook_win.cc",
140 "app/close_handle_hook_win.h",
141 "app/delay_load_hook_win.cc",
142 "app/delay_load_hook_win.h",
143 "//base/win/dllmain.cc",
147 # On Windows, link the dependencies (libraries) that make up actual
148 # Chromium functionality into this .dll.
149 #'chrome_version_resources', TODO(GYP)
150 "//chrome/app/theme:chrome_unscaled_resources",
152 "//content/app/resources",
154 "//net:net_resources",
158 if (enable_configuration_policy) {
159 deps += [ "//components/policy" ]
161 if (cpu_arch == "x86") {
162 # Add a dependency to custom import library for user32 delay imports only
164 #deps += [ 'chrome_user32_delay_imports' ] TODO(GYP)
167 # TODO(GYP) incremental linking flags in debug builds
168 #'LinkIncremental': '<(msvs_large_module_debug_link_mode)',
170 # TODO(GYP) Lots of VCLinkerTool stuff on Windows.
172 # TODO(GYP) chrome_pgo_phase on Windows.
176 deps += [ "//ui/compositor" ]
179 #TODO(GYP) add chrome_multiple_dll support
180 if (false) { #chrome_multiple_dll) {
181 defines = [ "CHROME_MULTIPLE_DLL_BROWSER" ]
182 deps += [ "//content/public/app:browser" ]
185 ":child_dependencies",
186 "//content/public/app:both",
190 if (cld_version == 0 || cld_version == 2) {
191 deps += [ "//third_party/cld_2" ]
195 #['OS=="mac" and component!="shared_library"', { TODO(GYP)
196 # 'includes': [ 'chrome_dll_bundle.gypi' ],
198 # TODO(GYP) Lots of other stuff in the OS=="mac" block.
202 # GYP version: chromium_browser_dependencies variable in chrome.gyp
203 group("browser_dependencies") {
210 deps += [ "//ppapi:ppapi_host" ]
213 if (enable_basic_printing || enable_print_preview) {
214 deps += [ "//printing" ]
215 if (enable_print_preview) {
216 deps += [ "//chrome/service" ]
221 # GYP version: chromium_child_dependencies variable in chrome.gyp
222 group("child_dependencies") {
229 "//chrome/browser/devtools",
233 "//content/public/child",
234 "//third_party/WebKit/public:blink_devtools_frontend_resources",
237 if (cld_version == 0 || cld_version == 2) {
238 deps += [ "//third_party/cld_2:cld2_platform_impl" ]
241 # TODO(gyp) if (enable_nacl) {
242 # deps += [ "<(DEPTH)/ppapi/native_client/src/trusted/plugin/plugin.gyp:nacl_trusted_plugin" ]
244 if (enable_remoting) {
245 deps += [ "//remoting/client/plugin" ]
250 # TODO(brettw) this duplicates "//chrome/common:version" which applies to
252 process_version("version_header") {
253 # TODO(brettW) this should have more reduced visibility, but chrome/browser
254 # currently depends on this.
255 #visibility = [ ":*" ]
256 source = "version.h.in"
258 # TODO(brettw) this should move to $target_gen_dir/version.h and
259 # source files including it should reference it via "chrome/version.h"
260 output = "$root_gen_dir/version.h"
263 source_set("image_pre_reader") {
265 "app/image_pre_reader_win.cc",
266 "app/image_pre_reader_win.h",
274 # GYP version: chrome/chrome_resources.gyp:chrome_resources
277 # Note: GYP lists some dependencies in addition to these actions. However,
278 # these are just dependencies for the actions themselves, which our actions
279 # list individually when needed.
280 "//chrome/browser:resources",
281 "//chrome/common:resources",
282 "//chrome/renderer:resources",
285 if (enable_extensions) {
286 deps += [ "//chrome/common:extensions_api_resources" ]
290 # GYP version: chrome/chrome_resources.gyp:chrome_extra_resources
291 group("extra_resources") {
293 "//chrome/browser/resources:invalidations_resources",
294 "//chrome/browser/resources:memory_internals_resources",
295 "//chrome/browser/resources:net_internals_resources",
296 "//chrome/browser/resources:password_manager_internals_resources",
297 "//chrome/browser/resources:signin_internals_resources",
298 "//chrome/browser/resources:sync_internals_resources",
299 "//chrome/browser/resources:translate_internals_resources",
303 "//chrome/browser/resources:component_extension_resources",
304 "//chrome/browser/resources:options_resources",
308 if (enable_chromevox_next) {
310 #'browser/resources/chromeos/chromevox2/chromevox.gyp:chromevox2', TODO(GYP)
314 #'browser/resources/chromeos/chromevox/chromevox.gyp:chromevox', TODO(GYP)
318 if (enable_extensions) {
320 "//chrome/browser/resources:quota_internals_resources",
321 "//chrome/browser/resources:sync_file_system_internals_resources",
326 group("packed_resources") {
328 ":repack_locales_pack",
329 ":repack_pseudo_locales_pack",
330 ":repack_chrome_100_percent",
333 # TODO(GYP) if (is_chrome_branded) {
334 # ... copy default_apps from default_apps_list
337 deps += [ ":repack_chrome_200_percent" ]
341 repack("packed_extra_resources") {
342 visibility = [ "./*" ]
344 "$root_gen_dir/chrome/browser_resources.pak",
345 "$root_gen_dir/chrome/chrome_unscaled_resources.pak",
346 "$root_gen_dir/chrome/common_resources.pak",
347 "$root_gen_dir/chrome/invalidations_resources.pak",
348 "$root_gen_dir/chrome/memory_internals_resources.pak",
349 "$root_gen_dir/chrome/net_internals_resources.pak",
350 "$root_gen_dir/chrome/password_manager_internals_resources.pak",
351 "$root_gen_dir/chrome/signin_internals_resources.pak",
352 "$root_gen_dir/chrome/sync_internals_resources.pak",
353 "$root_gen_dir/chrome/translate_internals_resources.pak",
354 "$root_gen_dir/components/components_resources.pak",
355 "$root_gen_dir/net/net_resources.pak",
356 "$root_gen_dir/ui/resources/webui_resources.pak",
359 "//chrome/browser:resources",
360 "//chrome/app/theme:chrome_unscaled_resources",
361 "//chrome/common:resources",
362 "//chrome/browser/resources:invalidations_resources",
363 "//chrome/browser/resources:memory_internals_resources",
364 "//chrome/browser/resources:net_internals_resources",
365 "//chrome/browser/resources:password_manager_internals_resources",
366 "//chrome/browser/resources:signin_internals_resources",
367 "//chrome/browser/resources:sync_internals_resources",
368 "//chrome/browser/resources:translate_internals_resources",
369 "//components/resources",
370 "//net:net_resources",
374 if (!is_ios && !is_android) {
375 # New paks should be added here by default.
377 "$root_gen_dir/chrome/component_extension_resources.pak",
378 "$root_gen_dir/chrome/options_resources.pak",
379 "$root_gen_dir/chrome/quota_internals_resources.pak",
380 "$root_gen_dir/chrome/sync_file_system_internals_resources.pak",
381 "$root_gen_dir/chrome/webrtc_device_provider_resources.pak",
382 "$root_gen_dir/blink/devtools_resources.pak",
385 "//chrome/browser/devtools:webrtc_device_provider_resources",
386 "//chrome/browser/resources:component_extension_resources",
387 "//chrome/browser/resources:options_resources",
388 "//chrome/browser/resources:quota_internals_resources",
389 "//chrome/browser/resources:sync_file_system_internals_resources",
390 "//content/browser/devtools:devtools_resources",
395 "$root_gen_dir/blink/public/resources/blink_resources.pak",
396 "$root_gen_dir/content/browser/tracing/tracing_resources.pak",
397 "$root_gen_dir/content/content_resources.pak",
401 sources += [ "$root_gen_dir/ui/file_manager/file_manager_resources.pak" ]
402 deps += [ "//ui/file_manager:resources" ]
404 if (enable_extensions) {
406 "$root_gen_dir/chrome/extensions_api_resources.pak",
407 "$root_gen_dir/extensions/extensions_renderer_resources.pak",
408 "$root_gen_dir/extensions/extensions_resources.pak",
410 deps += [ "//chrome/common:extensions_api_resources" ]
413 # GYP outputs the file in the gen/repack directory. On non-Mac/iOS platforms
414 # it them copies it. This skipes the copy step and writes it to the final
416 if (is_mac || is_ios) {
417 output = "$root_gen_dir/repack/resources.pak"
419 output = "$root_out_dir/resources.pak"
423 # GYP version: chrome/chrome_resources.gyp:browser_tests_pak
424 repack("browser_tests_pak") {
426 "$root_gen_dir/chrome/options_test_resources.pak",
428 output = "$root_out_dir/browser_tests.pak"
431 # Collects per-locale grit files from many sources into global per-locale files.
432 chrome_repack_locales("repack_locales_pack") {
433 visibility = [ ":*" ]
435 input_locales = locales
438 output_locales = locales_as_mac_outputs
440 output_locales = locales
444 chrome_repack_locales("repack_pseudo_locales_pack") {
445 visibility = [ ":*" ]
447 input_locales = [ "fake-bidi" ]
450 output_locales = [ "fake_bidi" ] # Mac uses underscores.
452 output_locales = [ "fake-bidi" ]
456 # Generates a rule to repack a set of resources, substituting a given string
457 # in for the percentage (e.g. "100", "200"). It generates the repacked files in
458 # the "gen" directory, and then introduces a copy rule to copy it to the root
461 # It's not clear why this two-step dance is necessary as opposed to just
462 # generating the file in the destination. However, this is what the GYP build
463 # does, and for maintenance purposes, this keeps the same files in the same
464 # place between the two builds when possible.
468 # String to substitute for the percentage.
469 template("chrome_repack_percent") {
470 percent = invoker.percent
472 repack_name = "${target_name}_repack"
473 repack_output_file = "$root_gen_dir/repack/chrome_${percent}_percent.pak"
475 copy_name = target_name
477 repack(repack_name) {
478 visibility = [ ":$copy_name" ]
480 # All sources should also have deps for completeness.
482 "$root_gen_dir/components/components_resources_${percent}_percent.pak",
483 "$root_gen_dir/ui/resources/ui_resources_${percent}_percent.pak",
484 "$root_gen_dir/chrome/renderer_resources_${percent}_percent.pak",
485 "$root_gen_dir/chrome/theme_resources_${percent}_percent.pak",
489 "//chrome/app/theme:theme_resources",
490 "//chrome/renderer:resources",
491 "//components/strings",
492 "//net:net_resources",
496 sources += [ "$root_gen_dir/content/app/resources/content_resources_${percent}_percent.pak" ]
497 deps += [ "//content:resources" ]
501 [ "$root_gen_dir/ash/resources/ash_resources_${percent}_percent.pak" ]
502 deps += [ "//ash/resources" ]
505 sources += [ "$root_gen_dir/ui/chromeos/resources/ui_chromeos_resources_${percent}_percent.pak" ]
506 deps += [ "//ui/chromeos/resources" ]
508 if (enable_extensions) {
509 sources += [ "$root_gen_dir/extensions/extensions_browser_resources_${percent}_percent.pak" ]
512 output = repack_output_file
516 visibility = [ ":*" ]
524 "$root_build_dir/chrome_${percent}_percent.pak",
529 chrome_repack_percent("repack_chrome_100_percent") {
534 chrome_repack_percent("repack_chrome_200_percent") {
539 # GYP version: chrome/chrome_resources.gyp:chrome_strings
542 "//chrome/app:chromium_strings",
543 "//chrome/app:generated_resources",
544 "//chrome/app:google_chrome_strings",
545 "//chrome/app/resources:locale_settings",
550 # GYP: //chrome/chrome.gyp:content_setting_java
551 java_cpp_enum("content_setting_javagen") {
553 "../components/content_settings/core/common/content_settings.h",
556 "org/chromium/chrome/browser/ContentSetting.java",
560 # GYP: //chrome/chrome.gyp:content_settings_type_java
561 java_cpp_enum("content_settings_type_javagen") {
563 "../components/content_settings/core/common/content_settings_types.h",
566 "org/chromium/chrome/browser/ContentSettingsType.java",
570 # GYP: //chrome/chrome.gyp:page_info_connection_type_java
571 java_cpp_enum("page_info_connection_type_javagen") {
573 "browser/ui/android/website_settings_popup_android.h",
576 "org/chromium/chrome/browser/PageInfoConnectionType.java",
580 # GYP: //chrome/chrome_android.gypi:chrome_android_core
581 static_library("chrome_android_core") {
583 "app/android/chrome_android_initializer.cc",
584 "app/android/chrome_android_initializer.h",
585 "app/android/chrome_main_delegate_android.cc",
586 "app/android/chrome_main_delegate_android.h",
587 "app/chrome_main_delegate.cc",
588 "app/chrome_main_delegate.h",
591 include_dirs = [ android_ndk_include_dir ]
600 "//chrome/browser/ui",
604 "//components/enhanced_bookmarks",
605 "//content/public/app:browser",