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")
11 # TODO(GYP) for Windows need to the the reorder-imports step which probably
12 # means adding another target and renaming this to chrome_initial like in GYP.
13 executable("chrome") {
14 # Because the sources list varies so significantly per-platform, generally
15 # each platform lists its own files rather than relying on filtering or
16 # removing unused files.
18 "app/chrome_exe_resource.h",
23 # TODO(GYP) mac_bundle_resources, xcode_settings
25 # TODO(GYP) order_profiling, order_text_section
29 "app/chrome_exe_main_win.cc",
32 "app/signature_validator_win.cc",
33 "app/signature_validator_win.h",
34 "//content/app/startup_helper_win.cc",
36 deps += [ "//ui/gfx" ]
37 } else if (use_aura) {
38 # Non-Windows aura entrypoint.
39 sources += [ "app/chrome_exe_main_aura.cc" ]
43 # TODO(GYP) manpage action
46 "app/chrome_dll_resource.h",
48 "app/chrome_main_delegate.cc",
49 "app/chrome_main_delegate.h",
53 # On Linux, link the dependencies (libraries) that make up actual
54 # Chromium functionality directly into the executable.
55 ":browser_dependencies",
56 ":child_dependencies",
59 # Needed to use the master_preferences functions
60 "//chrome/installer/util",
61 "//content/public/app:both",
64 # Needed for chrome_main.cc initialization of libraries.
65 configs += [ "//build/config/linux:pangocairo" ]
67 # TODO(GYP) ['profiling==0 and linux_disable_pie==0', {
75 "//build/config/linux:x11",
76 "//build/config/linux:xext",
83 "app/chrome_exe_main_mac.cc",
85 # TODO(GYP) lots more stuff in the is_mac block.
88 ":packed_extra_resources",
91 # Copy Flash Player files to PRODUCT_DIR if applicable. Let the .gyp
92 # file decide what to do on a per-OS basis; on Mac, internal plugins
93 # go inside the framework, so this dependency is in chrome_dll.gypi.
94 #'../third_party/adobe/flash/flash_player.gyp:flapper_binaries', TODO(GYP)
96 # Copy CDM files to PRODUCT_DIR if applicable. Let the .gyp
97 # file decide what to do on a per-OS basis; on Mac, internal plugins
98 # go inside the framework, so this dependency is in chrome_dll.gypi.
99 #'../third_party/widevine/cdm/widevine_cdm.gyp:widevinecdmadapter', TODO(GYP)
102 # TODO(GYP) some stuff from GYP including chrome_multiple_dll.
107 if (!is_mac && !is_android) {
108 # On Mac this is done in chrome_dll.gypi. Android doesn't use pdfium.
109 datadeps += [ "//pdf" ]
111 # 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",
149 #'<(DEPTH)/chrome_elf/chrome_elf.gyp:chrome_elf' ] TODO(GYP)
151 if (enable_configuration_policy) {
152 deps += [ "//components/policy" ]
154 if (cpu_arch == "x86") {
155 # Add a dependency to custom import library for user32 delay imports only
157 #deps += [ 'chrome_user32_delay_imports' ] TODO(GYP)
160 # TODO(GYP) incremental linking flags in debug builds
161 #'LinkIncremental': '<(msvs_large_module_debug_link_mode)',
163 # TODO(GYP) Lots of VCLinkerTool stuff on Windows.
165 # TODO(GYP) chrome_pgo_phase on Windows.
169 deps += [ "//ui/compositor" ]
172 #TODO(GYP) add chrome_multiple_dll support
173 if (false) { #chrome_multiple_dll) {
174 defines = [ "CHROME_MULTIPLE_DLL_BROWSER" ]
176 "//content/public/app:browser",
180 ":child_dependencies",
181 "//content/public/app:both",
185 if (cld_version == 0 || cld_version == 2) {
187 "//third_party/cld_2",
192 #['OS=="mac" and component!="shared_library"', { TODO(GYP)
193 # 'includes': [ 'chrome_dll_bundle.gypi' ],
196 # TODO(GYP) Lots of other stuff in the OS=="mac" block.
200 # GYP version: chromium_browser_dependencies variable in chrome.gyp
201 group("browser_dependencies") {
209 "//ppapi:ppapi_host",
213 if (printing_mode != 0) {
214 deps += [ "//printing" ]
215 if (printing_mode == 1) {
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",
240 # TODO(brettw) this duplicates "//chrome/common:version" which applies to
242 process_version("version_header") {
243 # TODO(brettW) this should have more reduced visibility, but chrome/browser
244 # currently depends on this.
245 #visibility = [ ":*" ]
246 source = "version.h.in"
247 # TODO(brettw) this should move to $target_gen_dir/version.h and
248 # source files including it should reference it via "chrome/version.h"
249 output = "$root_gen_dir/version.h"
253 # GYP version: chrome/chrome_resources.gyp:chrome_resources
256 # Note: GYP lists some dependencies in addition to these actions. However,
257 # these are just dependencies for the actions themselves, which our actions
258 # list individually when needed.
259 "//chrome/browser:resources",
260 "//chrome/common:resources",
261 "//chrome/renderer:resources",
264 if (enable_extensions) {
265 deps += [ "//chrome/common:extensions_api_resources" ]
269 # GYP version: chrome/chrome_resources.gyp:chrome_extra_resources
270 group("extra_resources") {
272 "//chrome/browser/resources:invalidations_resources",
273 "//chrome/browser/resources:memory_internals_resources",
274 "//chrome/browser/resources:net_internals_resources",
275 "//chrome/browser/resources:password_manager_internals_resources",
276 "//chrome/browser/resources:signin_internals_resources",
277 "//chrome/browser/resources:sync_internals_resources",
278 "//chrome/browser/resources:translate_internals_resources",
282 "//chrome/browser/resources:component_extension_resources",
283 "//chrome/browser/resources:options_resources",
287 if (enable_chromevox_next) {
289 #'browser/resources/chromeos/chromevox2/chromevox.gyp:chromevox2', TODO(GYP)
293 #'browser/resources/chromeos/chromevox/chromevox.gyp:chromevox', TODO(GYP)
297 if (enable_extensions) {
299 "//chrome/browser/resources:quota_internals_resources",
300 "//chrome/browser/resources:sync_file_system_internals_resources",
305 group("packed_resources") {
307 ":repack_locales_pack",
308 ":repack_pseudo_locales_pack",
309 ":repack_chrome_100_percent",
312 # TODO(GYP) if (is_chrome_branded) {
313 # ... copy default_apps from default_apps_list
316 deps += [ ":repack_chrome_200_percent" ]
320 repack("packed_extra_resources") {
321 visibility = [ ":*" ]
323 "$root_gen_dir/chrome/browser_resources.pak",
324 "$root_gen_dir/chrome/app/theme/chrome_unscaled_resources.pak",
325 "$root_gen_dir/chrome/common_resources.pak",
326 "$root_gen_dir/chrome/browser/resources/invalidations_resources.pak",
327 "$root_gen_dir/chrome/browser/resources/memory_internals_resources.pak",
328 "$root_gen_dir/chrome/browser/resources/net_internals_resources.pak",
329 "$root_gen_dir/chrome/browser/resources/password_manager_internals_resources.pak",
330 "$root_gen_dir/chrome/browser/resources/signin_internals_resources.pak",
331 "$root_gen_dir/chrome/browser/resources/sync_internals_resources.pak",
332 "$root_gen_dir/chrome/browser/resources/translate_internals_resources.pak",
333 "$root_gen_dir/components/resources/component_resources.pak",
334 "$root_gen_dir/net/net_resources.pak",
335 "$root_gen_dir/ui/resources/webui_resources.pak",
338 "//chrome/browser:resources",
339 "//chrome/app/theme:chrome_unscaled_resources",
340 "//chrome/common:resources",
341 "//chrome/browser/resources:invalidations_resources",
342 "//chrome/browser/resources:memory_internals_resources",
343 "//chrome/browser/resources:net_internals_resources",
344 "//chrome/browser/resources:password_manager_internals_resources",
345 "//chrome/browser/resources:signin_internals_resources",
346 "//chrome/browser/resources:sync_internals_resources",
347 "//chrome/browser/resources:translate_internals_resources",
348 "//components/resources",
349 "//net:net_resources",
353 if (!is_ios && !is_android) {
354 # New paks should be added here by default.
356 "$root_gen_dir/webkit/devtools_resources.pak",
357 "$root_gen_dir/chrome/browser/resources/component_extension_resources.pak",
358 "$root_gen_dir/chrome/browser/resources/options_resources.pak",
359 "$root_gen_dir/chrome/browser/resources/quota_internals_resources.pak",
360 "$root_gen_dir/chrome/browser/resources/sync_file_system_internals_resources.pak",
363 "//content/browser/devtools:devtools_resources",
364 "//chrome/browser/resources:component_extension_resources",
365 "//chrome/browser/resources:options_resources",
366 "//chrome/browser/resources:quota_internals_resources",
367 "//chrome/browser/resources:sync_file_system_internals_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",
375 "$root_gen_dir/extensions/extensions_renderer_resources.pak",
376 "$root_gen_dir/extensions/extensions_resources.pak",
380 sources += [ "$root_gen_dir/ui/file_manager/file_manager_resources.pak" ]
381 deps += [ "//ui/file_manager:resources" ]
383 if (enable_extensions) {
384 sources += [ "$root_gen_dir/chrome/extensions_api_resources.pak" ]
385 deps += [ "//chrome/common:extensions_api_resources" ]
388 # GYP outputs the file in the gen/repack directory. On non-Mac/iOS platforms
389 # it them copies it. This skipes the copy step and writes it to the final
391 if (is_mac || is_ios) {
392 output = "$root_gen_dir/repack/resources.pak"
394 output = "$root_out_dir/resources.pak"
398 # Collects per-locale grit files from many sources into global per-locale files.
399 chrome_repack_locales("repack_locales_pack") {
400 visibility = [ ":*" ]
402 input_locales = locales
405 output_locales = locales_as_mac_outputs
407 output_locales = locales
411 chrome_repack_locales("repack_pseudo_locales_pack") {
412 visibility = [ ":*" ]
414 input_locales = [ "fake-bidi" ]
417 output_locales = [ "fake_bidi" ] # Mac uses underscores.
419 output_locales = [ "fake-bidi" ]
423 # Generates a rule to repack a set of resources, substituting a given string
424 # in for the percentage (e.g. "100", "200"). It generates the repacked files in
425 # the "gen" directory, and then introduces a copy rule to copy it to the root
428 # It's not clear why this two-step dance is necessary as opposed to just
429 # generating the file in the destination. However, this is what the GYP build
430 # does, and for maintenance purposes, this keeps the same files in the same
431 # place between the two builds when possible.
435 # String to substitute for the percentage.
436 template("chrome_repack_percent") {
437 percent = invoker.percent
439 repack_name = "${target_name}_repack"
440 repack_output_file = "$root_gen_dir/repack/chrome_${percent}_percent.pak"
442 copy_name = target_name
444 repack(repack_name) {
445 visibility = [ ":$copy_name" ]
446 # All sources should also have deps for completeness.
448 "$root_gen_dir/components/resources/component_resources_${percent}_percent.pak",
449 "$root_gen_dir/ui/resources/ui_resources_${percent}_percent.pak",
450 "$root_gen_dir/chrome/renderer_resources_${percent}_percent.pak",
451 "$root_gen_dir/chrome/app/theme/theme_resources_${percent}_percent.pak",
455 "//chrome/app/theme:theme_resources",
456 "//chrome/renderer:resources",
457 "//components/strings",
458 "//net:net_resources",
463 "$root_gen_dir/content/app/resources/content_resources_${percent}_percent.pak",
465 deps += [ "//content:resources" ]
468 sources += [ "$root_gen_dir/ash/resources/ash_resources_${percent}_percent.pak" ]
469 deps += [ "//ash/resources" ]
473 "$root_gen_dir/athena/resources/athena_resources_${percent}_percent.pak",
475 deps += [ "//athena/resources" ]
479 "$root_gen_dir/ui/chromeos/resources/ui_chromeos_resources_${percent}_percent.pak",
481 deps += [ "//ui/chromeos/resources" ]
483 if (enable_extensions) {
485 "$root_gen_dir/extensions/extensions_browser_resources_${percent}_percent.pak",
489 output = repack_output_file
493 visibility = [ ":*" ]
494 deps = [ ":$repack_name" ]
495 sources = [ repack_output_file ]
496 outputs = [ "$root_build_dir/chrome_${percent}_percent.pak" ]
500 chrome_repack_percent("repack_chrome_100_percent") {
505 chrome_repack_percent("repack_chrome_200_percent") {
510 # GYP version: chrome/chrome_resources.gyp:chrome_strings
513 "//chrome/app:chromium_strings",
514 "//chrome/app:generated_resources",
515 "//chrome/app:google_chrome_strings",
516 "//chrome/app/resources:locale_settings",