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")
13 # TODO(GYP) for Windows need to the the reorder-imports step which probably
14 # means adding another target and renaming this to chrome_initial like in GYP.
15 executable("chrome") {
16 # Because the sources list varies so significantly per-platform, generally
17 # each platform lists its own files rather than relying on filtering or
18 # removing unused files.
20 "app/chrome_exe_resource.h",
25 # TODO(GYP) mac_bundle_resources, xcode_settings
27 # TODO(GYP) order_profiling, order_text_section
31 "app/chrome_exe_main_win.cc",
34 "app/signature_validator_win.cc",
35 "app/signature_validator_win.h",
36 "//content/app/startup_helper_win.cc",
38 deps += [ "//ui/gfx" ]
39 } else if (use_aura) {
40 # Non-Windows aura entrypoint.
41 sources += [ "app/chrome_exe_main_aura.cc" ]
45 # TODO(GYP) manpage action
48 "app/chrome_dll_resource.h",
50 "app/chrome_main_delegate.cc",
51 "app/chrome_main_delegate.h",
55 # On Linux, link the dependencies (libraries) that make up actual
56 # Chromium functionality directly into the executable.
57 ":browser_dependencies",
58 ":child_dependencies",
61 # Needed to use the master_preferences functions
62 "//chrome/installer/util",
63 "//content/public/app:both",
66 # Needed for chrome_main.cc initialization of libraries.
67 configs += [ "//build/config/linux:pangocairo" ]
69 # TODO(GYP) ['profiling==0 and linux_disable_pie==0', {
77 "//build/config/linux:x11",
78 "//build/config/linux:xext",
85 "app/chrome_exe_main_mac.cc",
87 # TODO(GYP) lots more stuff in the is_mac block.
90 ":packed_extra_resources",
93 # Copy Flash Player files to PRODUCT_DIR if applicable. Let the .gyp
94 # file decide what to do on a per-OS basis; on Mac, internal plugins
95 # go inside the framework, so this dependency is in chrome_dll.gypi.
96 #'../third_party/adobe/flash/flash_player.gyp:flapper_binaries', TODO(GYP)
98 # Copy CDM files to PRODUCT_DIR if applicable. Let the .gyp
99 # file decide what to do on a per-OS basis; on Mac, internal plugins
100 # go inside the framework, so this dependency is in chrome_dll.gypi.
101 #'../third_party/widevine/cdm/widevine_cdm.gyp:widevinecdmadapter', TODO(GYP)
104 # TODO(GYP) some stuff from GYP including chrome_multiple_dll.
110 # On Mac this is done in chrome_dll.gypi.
111 datadeps += [ "//pdf" ]
113 # TODO(GYP) pdf linux symbols
119 shared_library("main_dll") {
120 configs += [ "//build/config/compiler:wexit_time_destructors" ]
123 ":browser_dependencies",
127 output_name = "chrome"
130 "app/chrome_command_ids.h",
132 "app/chrome_dll_resource.h",
133 "app/chrome_main.cc",
134 "app/chrome_main_delegate.cc",
135 "app/chrome_main_delegate.h",
136 "app/close_handle_hook_win.cc",
137 "app/close_handle_hook_win.h",
138 "app/delay_load_hook_win.cc",
139 "app/delay_load_hook_win.h",
140 "//base/win/dllmain.cc",
144 # On Windows, link the dependencies (libraries) that make up actual
145 # Chromium functionality into this .dll.
146 #'chrome_version_resources', TODO(GYP)
147 "//chrome/app/theme:chrome_unscaled_resources",
148 "//content/app/resources",
150 "//net:net_resources",
153 #'<(DEPTH)/chrome_elf/chrome_elf.gyp:chrome_elf' ] TODO(GYP)
155 if (enable_configuration_policy) {
156 deps += [ "//components/policy" ]
158 if (cpu_arch == "x86") {
159 # Add a dependency to custom import library for user32 delay imports only
161 #deps += [ 'chrome_user32_delay_imports' ] TODO(GYP)
164 # TODO(GYP) incremental linking flags in debug builds
165 #'LinkIncremental': '<(msvs_large_module_debug_link_mode)',
167 # TODO(GYP) Lots of VCLinkerTool stuff on Windows.
169 # TODO(GYP) chrome_pgo_phase on Windows.
173 deps += [ "//ui/compositor" ]
176 #TODO(GYP) add chrome_multiple_dll support
177 if (false) { #chrome_multiple_dll) {
178 defines = [ "CHROME_MULTIPLE_DLL_BROWSER" ]
180 "//content/public/app:browser",
184 ":child_dependencies",
185 "//content/public/app:both",
189 if (cld_version == 0 || cld_version == 2) {
191 "//third_party/cld_2",
196 #['OS=="mac" and component!="shared_library"', { TODO(GYP)
197 # '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") {
213 "//ppapi:ppapi_host",
217 if (printing_mode != 0) {
218 deps += [ "//printing" ]
219 if (printing_mode == 1) {
220 deps += [ "//chrome/service" ]
225 # GYP version: chromium_child_dependencies variable in chrome.gyp
226 group("child_dependencies") {
233 "//chrome/browser/devtools",
237 "//content/public/child",
238 "//third_party/WebKit/public:blink_devtools_frontend_resources",
244 # TODO(brettw) this duplicates "//chrome/common:version" which applies to
246 process_version("version_header") {
247 # TODO(brettW) this should have more reduced visibility, but chrome/browser
248 # currently depends on this.
249 #visibility = [ ":*" ]
250 source = "version.h.in"
251 # TODO(brettw) this should move to $target_gen_dir/version.h and
252 # source files including it should reference it via "chrome/version.h"
253 output = "$root_gen_dir/version.h"
257 # GYP version: chrome/chrome_resources.gyp:chrome_resources
260 # Note: GYP lists some dependencies in addition to these actions. However,
261 # these are just dependencies for the actions themselves, which our actions
262 # list individually when needed.
263 "//chrome/browser:resources",
264 "//chrome/common:resources",
265 "//chrome/renderer:resources",
268 if (enable_extensions) {
269 deps += [ "//chrome/common:extensions_api_resources" ]
273 # GYP version: chrome/chrome_resources.gyp:chrome_extra_resources
274 group("extra_resources") {
276 "//chrome/browser/resources:invalidations_resources",
277 "//chrome/browser/resources:memory_internals_resources",
278 "//chrome/browser/resources:net_internals_resources",
279 "//chrome/browser/resources:password_manager_internals_resources",
280 "//chrome/browser/resources:signin_internals_resources",
281 "//chrome/browser/resources:sync_internals_resources",
282 "//chrome/browser/resources:translate_internals_resources",
286 "//chrome/browser/resources:component_extension_resources",
287 "//chrome/browser/resources:options_resources",
291 if (enable_chromevox_next) {
293 #'browser/resources/chromeos/chromevox2/chromevox.gyp:chromevox2', TODO(GYP)
297 #'browser/resources/chromeos/chromevox/chromevox.gyp:chromevox', TODO(GYP)
301 if (enable_extensions) {
303 "//chrome/browser/resources:quota_internals_resources",
304 "//chrome/browser/resources:sync_file_system_internals_resources",
309 group("packed_resources") {
311 ":repack_locales_pack",
312 ":repack_pseudo_locales_pack",
313 ":repack_chrome_100_percent",
316 # TODO(GYP) if (is_chrome_branded) {
317 # ... copy default_apps from default_apps_list
320 deps += [ ":repack_chrome_200_percent" ]
324 repack("packed_extra_resources") {
325 visibility = [ ":*" ]
327 "$root_gen_dir/chrome/browser_resources.pak",
328 "$root_gen_dir/chrome/app/theme/chrome_unscaled_resources.pak",
329 "$root_gen_dir/chrome/common_resources.pak",
330 "$root_gen_dir/chrome/browser/resources/invalidations_resources.pak",
331 "$root_gen_dir/chrome/browser/resources/memory_internals_resources.pak",
332 "$root_gen_dir/chrome/browser/resources/net_internals_resources.pak",
333 "$root_gen_dir/chrome/browser/resources/password_manager_internals_resources.pak",
334 "$root_gen_dir/chrome/browser/resources/signin_internals_resources.pak",
335 "$root_gen_dir/chrome/browser/resources/sync_internals_resources.pak",
336 "$root_gen_dir/chrome/browser/resources/translate_internals_resources.pak",
337 "$root_gen_dir/components/resources/components_resources.pak",
338 "$root_gen_dir/net/net_resources.pak",
339 "$root_gen_dir/ui/resources/webui_resources.pak",
342 "//chrome/browser:resources",
343 "//chrome/app/theme:chrome_unscaled_resources",
344 "//chrome/common:resources",
345 "//chrome/browser/resources:invalidations_resources",
346 "//chrome/browser/resources:memory_internals_resources",
347 "//chrome/browser/resources:net_internals_resources",
348 "//chrome/browser/resources:password_manager_internals_resources",
349 "//chrome/browser/resources:signin_internals_resources",
350 "//chrome/browser/resources:sync_internals_resources",
351 "//chrome/browser/resources:translate_internals_resources",
352 "//components/resources",
353 "//net:net_resources",
357 if (!is_ios && !is_android) {
358 # New paks should be added here by default.
360 "$root_gen_dir/webkit/devtools_resources.pak",
361 "$root_gen_dir/chrome/browser/resources/component_extension_resources.pak",
362 "$root_gen_dir/chrome/browser/resources/options_resources.pak",
363 "$root_gen_dir/chrome/browser/resources/quota_internals_resources.pak",
364 "$root_gen_dir/chrome/browser/resources/sync_file_system_internals_resources.pak",
367 "//content/browser/devtools:devtools_resources",
368 "//chrome/browser/resources:component_extension_resources",
369 "//chrome/browser/resources:options_resources",
370 "//chrome/browser/resources:quota_internals_resources",
371 "//chrome/browser/resources:sync_file_system_internals_resources",
376 "$root_gen_dir/blink/public/resources/blink_resources.pak",
377 "$root_gen_dir/content/browser/tracing/tracing_resources.pak",
378 "$root_gen_dir/content/content_resources.pak",
382 sources += [ "$root_gen_dir/ui/file_manager/file_manager_resources.pak" ]
383 deps += [ "//ui/file_manager:resources" ]
385 if (enable_extensions) {
387 "$root_gen_dir/chrome/extensions_api_resources.pak",
388 "$root_gen_dir/extensions/extensions_renderer_resources.pak",
389 "$root_gen_dir/extensions/extensions_resources.pak",
391 deps += [ "//chrome/common:extensions_api_resources" ]
394 # GYP outputs the file in the gen/repack directory. On non-Mac/iOS platforms
395 # it them copies it. This skipes the copy step and writes it to the final
397 if (is_mac || is_ios) {
398 output = "$root_gen_dir/repack/resources.pak"
400 output = "$root_out_dir/resources.pak"
404 # Collects per-locale grit files from many sources into global per-locale files.
405 chrome_repack_locales("repack_locales_pack") {
406 visibility = [ ":*" ]
408 input_locales = locales
411 output_locales = locales_as_mac_outputs
413 output_locales = locales
417 chrome_repack_locales("repack_pseudo_locales_pack") {
418 visibility = [ ":*" ]
420 input_locales = [ "fake-bidi" ]
423 output_locales = [ "fake_bidi" ] # Mac uses underscores.
425 output_locales = [ "fake-bidi" ]
429 # Generates a rule to repack a set of resources, substituting a given string
430 # in for the percentage (e.g. "100", "200"). It generates the repacked files in
431 # the "gen" directory, and then introduces a copy rule to copy it to the root
434 # It's not clear why this two-step dance is necessary as opposed to just
435 # generating the file in the destination. However, this is what the GYP build
436 # does, and for maintenance purposes, this keeps the same files in the same
437 # place between the two builds when possible.
441 # String to substitute for the percentage.
442 template("chrome_repack_percent") {
443 percent = invoker.percent
445 repack_name = "${target_name}_repack"
446 repack_output_file = "$root_gen_dir/repack/chrome_${percent}_percent.pak"
448 copy_name = target_name
450 repack(repack_name) {
451 visibility = [ ":$copy_name" ]
452 # All sources should also have deps for completeness.
454 "$root_gen_dir/components/resources/components_resources_${percent}_percent.pak",
455 "$root_gen_dir/ui/resources/ui_resources_${percent}_percent.pak",
456 "$root_gen_dir/chrome/renderer_resources_${percent}_percent.pak",
457 "$root_gen_dir/chrome/app/theme/theme_resources_${percent}_percent.pak",
461 "//chrome/app/theme:theme_resources",
462 "//chrome/renderer:resources",
463 "//components/strings",
464 "//net:net_resources",
469 "$root_gen_dir/content/app/resources/content_resources_${percent}_percent.pak",
471 deps += [ "//content:resources" ]
474 sources += [ "$root_gen_dir/ash/resources/ash_resources_${percent}_percent.pak" ]
475 deps += [ "//ash/resources" ]
479 "$root_gen_dir/athena/resources/athena_resources_${percent}_percent.pak",
481 deps += [ "//athena/resources" ]
485 "$root_gen_dir/ui/chromeos/resources/ui_chromeos_resources_${percent}_percent.pak",
487 deps += [ "//ui/chromeos/resources" ]
489 if (enable_extensions) {
491 "$root_gen_dir/extensions/extensions_browser_resources_${percent}_percent.pak",
495 output = repack_output_file
499 visibility = [ ":*" ]
500 deps = [ ":$repack_name" ]
501 sources = [ repack_output_file ]
502 outputs = [ "$root_build_dir/chrome_${percent}_percent.pak" ]
506 chrome_repack_percent("repack_chrome_100_percent") {
511 chrome_repack_percent("repack_chrome_200_percent") {
516 # GYP version: chrome/chrome_resources.gyp:chrome_strings
519 "//chrome/app:chromium_strings",
520 "//chrome/app:generated_resources",
521 "//chrome/app:google_chrome_strings",
522 "//chrome/app/resources:locale_settings",