Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / chrome / BUILD.gn
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.
4
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")
10
11 if (is_android) {
12   import("//build/config/android/rules.gni")
13 }
14
15 if (!is_android && !(is_chromeos && !use_ozone)) {
16
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.
23   sources = [
24     "app/chrome_exe_resource.h",
25   ]
26   deps = []
27   datadeps = []
28
29   # TODO(GYP) mac_bundle_resources, xcode_settings
30
31   # TODO(GYP) order_profiling, order_text_section
32
33   if (is_win) {
34     sources += [
35       "app/chrome_exe_main_win.cc",
36       "app/client_util.cc",
37       "app/client_util.h",
38       "app/signature_validator_win.cc",
39       "app/signature_validator_win.h",
40       "//content/app/startup_helper_win.cc",
41     ]
42     deps += [ "//ui/gfx" ]
43   } else if (use_aura) {
44     # Non-Windows aura entrypoint.
45     sources += [ "app/chrome_exe_main_aura.cc" ]
46   }
47
48   if (is_linux) {
49     # TODO(GYP) manpage action
50
51     sources += [
52       "app/chrome_dll_resource.h",
53       "app/chrome_main.cc",
54       "app/chrome_main_delegate.cc",
55       "app/chrome_main_delegate.h",
56     ]
57
58     deps += [
59       # On Linux, link the dependencies (libraries) that make up actual
60       # Chromium functionality directly into the executable.
61       ":browser_dependencies",
62       ":child_dependencies",
63
64       "//base/allocator",
65       # Needed to use the master_preferences functions
66       "//chrome/installer/util",
67       "//content/public/app:both",
68     ]
69
70     # Needed for chrome_main.cc initialization of libraries.
71     configs += [ "//build/config/linux:pangocairo" ]
72
73     # TODO(GYP) ['profiling==0 and linux_disable_pie==0', {
74     #   'ldflags': [
75     #      '-pie',
76     #   ],
77     #}],
78
79     if (use_x11) {
80       configs += [
81         "//build/config/linux:x11",
82         "//build/config/linux:xext",
83       ]
84     }
85   }
86
87   if (is_mac) {
88     sources += [
89       "app/chrome_exe_main_mac.cc",
90     ]
91     # TODO(GYP) lots more stuff in the is_mac block.
92   } else {  # Non-Mac.
93     deps += [
94       ":packed_extra_resources",
95       ":packed_resources",
96
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)
101
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)
106     ]
107
108     # TODO(GYP) some stuff from GYP including chrome_multiple_dll.
109
110   }
111
112
113   if (!is_mac) {
114     # On Mac this is done in chrome_dll.gypi.
115     datadeps += [ "//pdf" ]
116
117     # TODO(GYP) pdf linux symbols
118   }
119 }
120
121 }  # !is_android
122
123 shared_library("main_dll") {
124   configs += [ "//build/config/compiler:wexit_time_destructors" ]
125
126   deps = [
127     ":browser_dependencies",
128     "//base/allocator",
129   ]
130   if (is_win) {
131     output_name = "chrome"
132
133     sources = [
134       "app/chrome_command_ids.h",
135       "app/chrome_dll.rc",
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",
145     ]
146
147     deps += [
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",
153       "//crypto",
154       "//net:net_resources",
155       "//third_party/wtl",
156       "//ui/views",
157       #'<(DEPTH)/chrome_elf/chrome_elf.gyp:chrome_elf' ]  TODO(GYP)
158     ]
159     if (enable_configuration_policy) {
160       deps += [ "//components/policy" ]
161     }
162     if (cpu_arch == "x86") {
163       # Add a dependency to custom import library for user32 delay imports only
164       # in x86 builds.
165       #deps += [ 'chrome_user32_delay_imports' ]  TODO(GYP)
166     }
167
168     # TODO(GYP) incremental linking flags in debug builds
169     #'LinkIncremental': '<(msvs_large_module_debug_link_mode)',
170
171     # TODO(GYP) Lots of VCLinkerTool stuff on Windows.
172
173     # TODO(GYP) chrome_pgo_phase on Windows.
174   }
175
176   if (use_aura) {
177     deps += [ "//ui/compositor" ]
178   }
179
180   #TODO(GYP) add chrome_multiple_dll support
181   if (false) {  #chrome_multiple_dll) {
182     defines = [ "CHROME_MULTIPLE_DLL_BROWSER" ]
183     deps += [
184       "//content/public/app:browser",
185     ]
186   } else {
187     deps += [
188       ":child_dependencies",
189       "//content/public/app:both",
190     ]
191   }
192
193   if (cld_version == 0 || cld_version == 2) {
194     deps += [
195       "//third_party/cld_2",
196     ]
197   }
198
199   if (is_mac) {
200     #['OS=="mac" and component!="shared_library"', {  TODO(GYP)
201     #  'includes': [ 'chrome_dll_bundle.gypi' ],
202     #}],
203
204     # TODO(GYP) Lots of other stuff in the OS=="mac" block.
205   }
206 }
207
208 # GYP version: chromium_browser_dependencies variable in chrome.gyp
209 group("browser_dependencies") {
210   deps = [
211     "//chrome/browser",
212     "//chrome/common",
213     "//sync",
214   ]
215   if (!is_ios) {
216     deps += [
217       "//ppapi:ppapi_host",
218     ]
219   }
220
221   if (enable_basic_printing || enable_print_preview) {
222     deps += [ "//printing" ]
223     if (enable_print_preview) {
224       deps += [ "//chrome/service" ]
225     }
226   }
227 }
228
229 # GYP version: chromium_child_dependencies variable in chrome.gyp
230 group("child_dependencies") {
231   deps = [
232     "//chrome/common",
233     "//sync",
234   ]
235   if (!is_ios) {
236     deps += [
237       "//chrome/browser/devtools",
238       "//chrome/plugin",
239       "//chrome/renderer",
240       "//chrome/utility",
241       "//content/public/child",
242       "//third_party/WebKit/public:blink_devtools_frontend_resources",
243     ]
244   }
245 }
246
247 if (is_win) {
248   # TODO(brettw) this duplicates "//chrome/common:version" which applies to
249   # Linux.
250   process_version("version_header") {
251     # TODO(brettW) this should have more reduced visibility, but chrome/browser
252     # currently depends on this.
253     #visibility = [ ":*" ]
254     source = "version.h.in"
255     # TODO(brettw) this should move to $target_gen_dir/version.h and
256     # source files including it should reference it via "chrome/version.h"
257     output = "$root_gen_dir/version.h"
258   }
259 }
260
261 # GYP version: chrome/chrome_resources.gyp:chrome_resources
262 group("resources") {
263   deps = [
264     # Note: GYP lists some dependencies in addition to these actions. However,
265     # these are just dependencies for the actions themselves, which our actions
266     # list individually when needed.
267     "//chrome/browser:resources",
268     "//chrome/common:resources",
269     "//chrome/renderer:resources",
270   ]
271
272   if (enable_extensions) {
273     deps += [ "//chrome/common:extensions_api_resources" ]
274   }
275 }
276
277 # GYP version: chrome/chrome_resources.gyp:chrome_extra_resources
278 group("extra_resources") {
279   deps = [
280     "//chrome/browser/resources:invalidations_resources",
281     "//chrome/browser/resources:memory_internals_resources",
282     "//chrome/browser/resources:net_internals_resources",
283     "//chrome/browser/resources:password_manager_internals_resources",
284     "//chrome/browser/resources:signin_internals_resources",
285     "//chrome/browser/resources:sync_internals_resources",
286     "//chrome/browser/resources:translate_internals_resources",
287   ]
288   if (!is_ios) {
289     deps += [
290       "//chrome/browser/resources:component_extension_resources",
291       "//chrome/browser/resources:options_resources",
292     ]
293   }
294
295   if (enable_chromevox_next) {
296     deps += [
297       #'browser/resources/chromeos/chromevox2/chromevox.gyp:chromevox2',  TODO(GYP)
298     ]
299   } else {
300     deps += [
301       #'browser/resources/chromeos/chromevox/chromevox.gyp:chromevox',  TODO(GYP)
302     ]
303   }
304
305   if (enable_extensions) {
306     deps += [
307       "//chrome/browser/resources:quota_internals_resources",
308       "//chrome/browser/resources:sync_file_system_internals_resources",
309     ]
310   }
311 }
312
313 group("packed_resources") {
314   deps = [
315     ":repack_locales_pack",
316     ":repack_pseudo_locales_pack",
317     ":repack_chrome_100_percent",
318   ]
319
320   # TODO(GYP) if (is_chrome_branded) {
321   # ... copy default_apps from default_apps_list
322
323   if (enable_hidpi) {
324     deps += [ ":repack_chrome_200_percent" ]
325   }
326 }
327
328 repack("packed_extra_resources") {
329   visibility = [ "./*" ]
330   sources = [
331     "$root_gen_dir/chrome/browser_resources.pak",
332     "$root_gen_dir/chrome/chrome_unscaled_resources.pak",
333     "$root_gen_dir/chrome/common_resources.pak",
334     "$root_gen_dir/chrome/invalidations_resources.pak",
335     "$root_gen_dir/chrome/memory_internals_resources.pak",
336     "$root_gen_dir/chrome/net_internals_resources.pak",
337     "$root_gen_dir/chrome/password_manager_internals_resources.pak",
338     "$root_gen_dir/chrome/signin_internals_resources.pak",
339     "$root_gen_dir/chrome/sync_internals_resources.pak",
340     "$root_gen_dir/chrome/translate_internals_resources.pak",
341     "$root_gen_dir/components/components_resources.pak",
342     "$root_gen_dir/net/net_resources.pak",
343     "$root_gen_dir/ui/resources/webui_resources.pak",
344   ]
345   deps = [
346     "//chrome/browser:resources",
347     "//chrome/app/theme:chrome_unscaled_resources",
348     "//chrome/common:resources",
349     "//chrome/browser/resources:invalidations_resources",
350     "//chrome/browser/resources:memory_internals_resources",
351     "//chrome/browser/resources:net_internals_resources",
352     "//chrome/browser/resources:password_manager_internals_resources",
353     "//chrome/browser/resources:signin_internals_resources",
354     "//chrome/browser/resources:sync_internals_resources",
355     "//chrome/browser/resources:translate_internals_resources",
356     "//components/resources",
357     "//net:net_resources",
358     "//ui/resources",
359   ]
360
361   if (!is_ios && !is_android) {
362     # New paks should be added here by default.
363     sources += [
364       "$root_gen_dir/webkit/devtools_resources.pak",
365       "$root_gen_dir/chrome/component_extension_resources.pak",
366       "$root_gen_dir/chrome/options_resources.pak",
367       "$root_gen_dir/chrome/quota_internals_resources.pak",
368       "$root_gen_dir/chrome/sync_file_system_internals_resources.pak",
369     ]
370     deps += [
371       "//content/browser/devtools:devtools_resources",
372       "//chrome/browser/resources:component_extension_resources",
373       "//chrome/browser/resources:options_resources",
374       "//chrome/browser/resources:quota_internals_resources",
375       "//chrome/browser/resources:sync_file_system_internals_resources",
376     ]
377   }
378   if (!is_ios) {
379     sources += [
380       "$root_gen_dir/blink/public/resources/blink_resources.pak",
381       "$root_gen_dir/content/browser/tracing/tracing_resources.pak",
382       "$root_gen_dir/content/content_resources.pak",
383     ]
384   }
385   if (is_chromeos) {
386     sources += [ "$root_gen_dir/ui/file_manager/file_manager_resources.pak" ]
387     deps += [ "//ui/file_manager:resources" ]
388   }
389   if (enable_extensions) {
390     sources += [
391       "$root_gen_dir/chrome/extensions_api_resources.pak",
392       "$root_gen_dir/extensions/extensions_renderer_resources.pak",
393       "$root_gen_dir/extensions/extensions_resources.pak",
394     ]
395     deps += [ "//chrome/common:extensions_api_resources" ]
396   }
397
398   # GYP outputs the file in the gen/repack directory. On non-Mac/iOS platforms
399   # it them copies it. This skipes the copy step and writes it to the final
400   # location.
401   if (is_mac || is_ios) {
402     output = "$root_gen_dir/repack/resources.pak"
403   } else {
404     output = "$root_out_dir/resources.pak"
405   }
406 }
407
408 # Collects per-locale grit files from many sources into global per-locale files.
409 chrome_repack_locales("repack_locales_pack") {
410   visibility = [ ":*" ]
411
412   input_locales = locales
413
414   if (is_mac) {
415     output_locales = locales_as_mac_outputs
416   } else {
417     output_locales = locales
418   }
419 }
420
421 chrome_repack_locales("repack_pseudo_locales_pack") {
422   visibility = [ ":*" ]
423
424   input_locales = [ "fake-bidi" ]
425
426   if (is_mac) {
427     output_locales = [ "fake_bidi" ]  # Mac uses underscores.
428   } else {
429     output_locales = [ "fake-bidi" ]
430   }
431 }
432
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
436 # build directory.
437 #
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.
442 #
443 # Argument:
444 #   percent [required]
445 #      String to substitute for the percentage.
446 template("chrome_repack_percent") {
447   percent = invoker.percent
448
449   repack_name = "${target_name}_repack"
450   repack_output_file = "$root_gen_dir/repack/chrome_${percent}_percent.pak"
451
452   copy_name = target_name
453
454   repack(repack_name) {
455     visibility = [ ":$copy_name" ]
456     # All sources should also have deps for completeness.
457     sources = [
458       "$root_gen_dir/components/components_resources_${percent}_percent.pak",
459       "$root_gen_dir/ui/resources/ui_resources_${percent}_percent.pak",
460       "$root_gen_dir/chrome/renderer_resources_${percent}_percent.pak",
461       "$root_gen_dir/chrome/theme_resources_${percent}_percent.pak",
462     ]
463
464     deps = [
465       "//chrome/app/theme:theme_resources",
466       "//chrome/renderer:resources",
467       "//components/strings",
468       "//net:net_resources",
469     ]
470
471     if (!is_ios) {
472       sources += [
473         "$root_gen_dir/content/app/resources/content_resources_${percent}_percent.pak",
474       ]
475       deps += [ "//content:resources" ]
476     }
477     if (use_ash) {
478       sources += [ "$root_gen_dir/ash/resources/ash_resources_${percent}_percent.pak" ]
479       deps += [ "//ash/resources" ]
480     }
481     if (use_athena) {
482       sources += [
483         "$root_gen_dir/athena/resources/athena_resources_${percent}_percent.pak",
484       ]
485       deps += [ "//athena/resources" ]
486     }
487     if (is_chromeos) {
488       sources += [
489         "$root_gen_dir/ui/chromeos/resources/ui_chromeos_resources_${percent}_percent.pak",
490       ]
491       deps += [ "//ui/chromeos/resources" ]
492     }
493     if (enable_extensions) {
494       sources += [
495         "$root_gen_dir/extensions/extensions_browser_resources_${percent}_percent.pak",
496       ]
497     }
498
499     output = repack_output_file
500   }
501
502   copy(copy_name) {
503     visibility = [ ":*" ]
504     deps = [ ":$repack_name" ]
505     sources = [ repack_output_file ]
506     outputs = [ "$root_build_dir/chrome_${percent}_percent.pak" ]
507   }
508 }
509
510 chrome_repack_percent("repack_chrome_100_percent") {
511   percent = "100"
512 }
513
514 if (enable_hidpi) {
515   chrome_repack_percent("repack_chrome_200_percent") {
516     percent = "200"
517   }
518 }
519
520 # GYP version: chrome/chrome_resources.gyp:chrome_strings
521 group("strings") {
522   deps = [
523     "//chrome/app:chromium_strings",
524     "//chrome/app:generated_resources",
525     "//chrome/app:google_chrome_strings",
526     "//chrome/app/resources:locale_settings",
527   ]
528 }
529
530 if (is_android) {
531
532 # GYP: //chrome/chrome.gyp:content_setting_java
533 java_cpp_enum("content_setting_javagen") {
534   sources = [
535     "../components/content_settings/core/common/content_settings.h"
536   ]
537   outputs = [
538     "org/chromium/chrome/browser/ContentSetting.java",
539   ]
540 }
541
542 # GYP: //chrome/chrome.gyp:content_settings_type_java
543 java_cpp_enum("content_settings_type_javagen") {
544   sources = [
545     "../components/content_settings/core/common/content_settings_types.h"
546   ]
547   outputs = [
548     "org/chromium/chrome/browser/ContentSettingsType.java",
549   ]
550 }
551
552 # GYP: //chrome/chrome.gyp:page_info_connection_type_java
553 java_cpp_enum("page_info_connection_type_javagen") {
554   sources = [
555     "browser/ui/android/website_settings_popup_android.h"
556   ]
557   outputs = [
558     "org/chromium/chrome/browser/PageInfoConnectionType.java",
559   ]
560 }
561
562 # GYP: //chrome/chrome_android.gypi:chrome_android_core
563 static_library("chrome_android_core") {
564   sources = [
565     "app/android/chrome_android_initializer.cc",
566     "app/android/chrome_android_initializer.h",
567     "app/android/chrome_main_delegate_android.cc",
568     "app/android/chrome_main_delegate_android.h",
569     "app/chrome_main_delegate.cc",
570     "app/chrome_main_delegate.h",
571   ]
572
573   include_dirs = [
574     android_ndk_include_dir,
575   ]
576
577   libs = [
578     "android",
579     "jnigraphics",
580   ]
581
582   deps = [
583     "//chrome/browser",
584     "//chrome/browser/ui",
585     "//chrome/plugin",
586     "//chrome/renderer",
587     "//chrome/utility",
588     "//components/enhanced_bookmarks",
589     "//content/public/app:browser",
590   ]
591 }
592
593 }