Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / build / common.gypi
1 # Copyright (c) 2012 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 # IMPORTANT:
6 # Please don't directly include this file if you are building via gyp_chromium,
7 # since gyp_chromium is automatically forcing its inclusion.
8 {
9   # Variables expected to be overriden on the GYP command line (-D) or by
10   # ~/.gyp/include.gypi.
11   'variables': {
12     # Putting a variables dict inside another variables dict looks kind of
13     # weird.  This is done so that 'host_arch', 'chromeos', etc are defined as
14     # variables within the outer variables dict here.  This is necessary
15     # to get these variables defined for the conditions within this variables
16     # dict that operate on these variables.
17     'variables': {
18       'variables': {
19         'variables': {
20           'variables': {
21             # Whether we're building a ChromeOS build.
22             'chromeos%': 0,
23
24             # Whether we're building the cast (chromecast) shell
25             'chromecast%': 0,
26
27             # Whether or not we are using the Aura windowing framework.
28             'use_aura%': 0,
29
30             # Whether or not we are building the Ash shell.
31             'use_ash%': 0,
32
33             # Whether or not we are using CRAS, the ChromeOS Audio Server.
34             'use_cras%': 0,
35
36             # Use a raw surface abstraction.
37             'use_ozone%': 0,
38
39             # Configure the build for small devices. See crbug.com/318413
40             'embedded%': 0,
41
42             'conditions': [
43               # Compute the architecture that we're building on.
44               ['OS=="win" or OS=="mac" or OS=="ios"', {
45                 'host_arch%': 'ia32',
46               }, {
47                 'host_arch%': '<!pymod_do_main(detect_host_arch)',
48               }],
49             ],
50           },
51           # Copy conditionally-set variables out one scope.
52           'chromeos%': '<(chromeos)',
53           'chromecast%': '<(chromecast)',
54           'use_aura%': '<(use_aura)',
55           'use_ash%': '<(use_ash)',
56           'use_cras%': '<(use_cras)',
57           'use_ozone%': '<(use_ozone)',
58           'embedded%': '<(embedded)',
59           'host_arch%': '<(host_arch)',
60
61           # Whether we are using Views Toolkit
62           'toolkit_views%': 0,
63
64           # Use the PCI lib to collect GPU information.
65           'use_libpci%': 1,
66
67           # Use OpenSSL instead of NSS as the underlying SSL and crypto
68           # implementation. Certificate verification will in most cases be
69           # handled by the OS. If OpenSSL's struct X509 is used to represent
70           # certificates, use_openssl_certs must be set.
71           'use_openssl%': 0,
72
73           # Typedef X509Certificate::OSCertHandle to OpenSSL's struct X509*.
74           'use_openssl_certs%': 0,
75
76           # Disable viewport meta tag by default.
77           'enable_viewport%': 0,
78
79           # Enable HiDPI support.
80           'enable_hidpi%': 0,
81
82           # Override buildtype to select the desired build flavor.
83           # Dev - everyday build for development/testing
84           # Official - release build (generally implies additional processing)
85           # TODO(mmoss) Once 'buildtype' is fully supported (e.g. Windows gyp
86           # conversion is done), some of the things which are now controlled by
87           # 'branding', such as symbol generation, will need to be refactored
88           # based on 'buildtype' (i.e. we don't care about saving symbols for
89           # non-Official # builds).
90           'buildtype%': 'Dev',
91
92           # Override branding to select the desired branding flavor.
93           'branding%': 'Chromium',
94
95           'conditions': [
96             # ChromeOS and Windows use Aura and Ash.
97             ['chromeos==1 or OS=="win" or OS=="linux"', {
98               'use_ash%': 1,
99               'use_aura%': 1,
100             }],
101
102             ['chromecast==1 and OS!="android"', {
103               'embedded%': 1,
104               'use_ozone%': 1,
105             }],
106
107             # Ozone uses Aura.
108             ['use_ozone==1', {
109               'use_aura%': 1,
110             }],
111
112             # Whether we're a traditional desktop unix.
113             ['(OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="solaris") and chromeos==0', {
114               'desktop_linux%': 1,
115             }, {
116               'desktop_linux%': 0,
117             }],
118
119             # Embedded implies ozone.
120             ['embedded==1', {
121               'use_ozone%': 1,
122             }],
123
124             ['OS=="android"', {
125               'target_arch%': 'arm',
126             }, {
127               # Default architecture we're building for is the architecture we're
128               # building on, and possibly sub-architecture (for iOS builds).
129               'target_arch%': '<(host_arch)',
130             }],
131           ],
132         },
133         # Copy conditionally-set variables out one scope.
134         'chromeos%': '<(chromeos)',
135         'chromecast%': '<(chromecast)',
136         'desktop_linux%': '<(desktop_linux)',
137         'use_aura%': '<(use_aura)',
138         'use_ash%': '<(use_ash)',
139         'use_cras%': '<(use_cras)',
140         'use_ozone%': '<(use_ozone)',
141         'embedded%': '<(embedded)',
142         'use_libpci%': '<(use_libpci)',
143         'use_openssl%': '<(use_openssl)',
144         'use_openssl_certs%': '<(use_openssl_certs)',
145         'enable_viewport%': '<(enable_viewport)',
146         'enable_hidpi%': '<(enable_hidpi)',
147         'buildtype%': '<(buildtype)',
148         'branding%': '<(branding)',
149         'host_arch%': '<(host_arch)',
150         'target_arch%': '<(target_arch)',
151
152         'target_subarch%': '',
153
154         # The channel to build on Android: stable, beta, dev, canary, or
155         # default. "default" should be used on non-official builds.
156         'android_channel%': 'default',
157
158         # This is set when building the Android WebView inside the Android
159         # build system, using the 'android' gyp backend. The WebView code is
160         # still built when this is unset, but builds using the normal chromium
161         # build system.
162         'android_webview_build%': 0,
163
164         # This is set when building the Android WebView in ninja for the
165         # telemetry bot.
166         'android_webview_telemetry_build%': 0,
167
168         # Set ARM architecture version.
169         'arm_version%': 7,
170
171         # Use aurax11 for clipboard implementation. This is true on linux_aura.
172         'use_clipboard_aurax11%': 0,
173
174         # goma settings.
175         # 1 to use goma.
176         # If no gomadir is set, it uses the default gomadir.
177         'use_goma%': 0,
178         'gomadir%': '',
179
180         # The system root for cross-compiles. Default: none.
181         'sysroot%': '',
182         'chroot_cmd%': '',
183
184         # The system libdir used for this ABI.
185         'system_libdir%': 'lib',
186
187         # Default MIPS arch variant. This is set in the conditions block
188         # below for MIPS targets.
189         'mips_arch_variant%': '',
190
191         'conditions': [
192           # Ash needs Aura.
193           ['use_aura==0', {
194             'use_ash%': 0,
195           }],
196
197           # Set default value of toolkit_views based on OS.
198           ['OS=="win" or chromeos==1 or use_aura==1', {
199             'toolkit_views%': 1,
200           }, {
201             'toolkit_views%': 0,
202           }],
203
204           # Embedded builds use aura without ash or views.
205           ['embedded==1', {
206             'use_aura%': 1,
207             'use_ash%': 0,
208             'toolkit_views%': 0,
209           }],
210
211           # Enable HiDPI on Mac OS, Chrome OS and Windows.
212           ['OS=="mac" or chromeos==1 or OS=="win"', {
213             'enable_hidpi%': 1,
214           }],
215
216           # Enable the OpenSSL backend on Mac OS.
217           ['OS=="mac"', {
218             'use_openssl%': 1,
219           }],
220
221           # Enable App Launcher everywhere but mobile.
222           ['OS!="ios" and OS!="android"', {
223             'enable_app_list%': 1,
224           }, {
225             'enable_app_list%': 0,
226           }],
227
228           ['use_aura==1 or (OS!="win" and OS!="mac" and OS!="ios" and OS!="android")', {
229             'use_default_render_theme%': 1,
230           }, {
231             'use_default_render_theme%': 0,
232           }],
233
234           ['use_ozone==1', {
235             'use_ozone_evdev%': 1,
236           }, {
237             'use_ozone_evdev%': 0,
238           }],
239
240           # Set default gomadir.
241           ['OS=="win"', {
242             'gomadir': 'c:\\goma\\goma-win',
243           }, {
244             'gomadir': '<!(/bin/echo -n ${HOME}/goma)',
245           }],
246
247           # Set the default "target_subarch" on iOS. Valid values are "arm32",
248           # "arm64" and "both" (meaning a fat binary).
249           #
250           # TODO(sdefresne): change the default from "arm32" to "both" for
251           # "target_subarch" once http://crbug.com/339477 is fixed.
252           #
253           # TODO(sdefresne): set the "target_arch" to "arm" once compilation
254           # of skia has been fixed for simulator. http://crbug.com/342377
255           ['OS=="ios"', {
256             'target_subarch%': 'arm32',
257           }],
258
259           # Set arch variants for MIPS platforms.
260           ['target_arch=="mips64el"', {
261             'conditions': [
262               ['OS=="android"', {
263                 'mips_arch_variant%': 'r6',
264               }, {
265                 'mips_arch_variant%': 'r2',
266               }],
267             ],
268           }],
269
270           ['target_arch=="mipsel"', {
271             'mips_arch_variant%': 'r1',
272           }],
273         ],
274       },
275
276       # Copy conditionally-set variables out one scope.
277       'chromeos%': '<(chromeos)',
278       'chromecast%': '<(chromecast)',
279       'host_arch%': '<(host_arch)',
280       'target_arch%': '<(target_arch)',
281       'target_subarch%': '<(target_subarch)',
282       'mips_arch_variant%': '<(mips_arch_variant)',
283       'toolkit_views%': '<(toolkit_views)',
284       'desktop_linux%': '<(desktop_linux)',
285       'use_aura%': '<(use_aura)',
286       'use_ash%': '<(use_ash)',
287       'use_cras%': '<(use_cras)',
288       'use_libpci%': '<(use_libpci)',
289       'use_ozone%': '<(use_ozone)',
290       'use_ozone_evdev%': '<(use_ozone_evdev)',
291       'use_clipboard_aurax11%': '<(use_clipboard_aurax11)',
292       'embedded%': '<(embedded)',
293       'use_openssl%': '<(use_openssl)',
294       'use_openssl_certs%': '<(use_openssl_certs)',
295       'enable_viewport%': '<(enable_viewport)',
296       'enable_hidpi%': '<(enable_hidpi)',
297       'android_channel%': '<(android_channel)',
298       'android_webview_build%': '<(android_webview_build)',
299       'android_webview_telemetry_build%': '<(android_webview_telemetry_build)',
300       'use_goma%': '<(use_goma)',
301       'gomadir%': '<(gomadir)',
302       'enable_app_list%': '<(enable_app_list)',
303       'use_default_render_theme%': '<(use_default_render_theme)',
304       'buildtype%': '<(buildtype)',
305       'branding%': '<(branding)',
306       'arm_version%': '<(arm_version)',
307       'sysroot%': '<(sysroot)',
308       'chroot_cmd%': '<(chroot_cmd)',
309       'system_libdir%': '<(system_libdir)',
310
311       # Set to 1 to enable fast builds. Set to 2 for even faster builds
312       # (it disables debug info for fastest compilation - only for use
313       # on compile-only bots).
314       'fastbuild%': 0,
315
316       # Set to 1 to not store any build metadata, e.g. ifdef out all __DATE__
317       # and __TIME__. Set to 0 to reenable the use of these macros in the code
318       # base. See http://crbug.com/314403.
319       'dont_embed_build_metadata%': 1,
320
321       # Set to 1 to force Visual C++ to use legacy debug information format /Z7.
322       # This is useful for parallel compilation tools which can't support /Zi.
323       # Only used on Windows.
324       'win_z7%' : 0,
325
326       # Set to 1 to enable dcheck in release.
327       'dcheck_always_on%': 0,
328
329       # Set to 1 to make a build that disables unshipped tracing events.
330       # Note: this setting is ignored if buildtype=="Official".
331       'tracing_like_official_build%': 0,
332
333       # Disable image loader component extension by default.
334       'image_loader_extension%': 0,
335
336       # Set NEON compilation flags.
337       'arm_neon%': 1,
338
339       # Detect NEON support at run-time.
340       'arm_neon_optional%': 0,
341
342       # Use libjpeg-turbo as the JPEG codec used by Chromium.
343       'use_libjpeg_turbo%': 1,
344
345       # Use system libjpeg. Note that the system's libjepg will be used even if
346       # use_libjpeg_turbo is set.
347       'use_system_libjpeg%': 0,
348
349       # By default, component is set to static_library and it can be overriden
350       # by the GYP command line or by ~/.gyp/include.gypi.
351       'component%': 'static_library',
352
353       # /analyze is off by default on Windows because it is very slow and noisy.
354       # Enable with GYP_DEFINES=win_analyze=1
355       'win_analyze%': 0,
356
357       # Set to select the Title Case versions of strings in GRD files.
358       'use_titlecase_in_grd%': 0,
359
360       # Use translations provided by volunteers at launchpad.net.  This
361       # currently only works on Linux.
362       'use_third_party_translations%': 0,
363
364       # Remoting compilation is enabled by default. Set to 0 to disable.
365       'remoting%': 1,
366
367       # Configuration policy is enabled by default. Set to 0 to disable.
368       'configuration_policy%': 1,
369
370       # Variable safe_browsing is used to control the build time configuration
371       # for safe browsing feature. Safe browsing can be compiled in 3 different
372       # levels: 0 disables it, 1 enables it fully, and 2 enables only UI and
373       # reporting features without enabling phishing and malware detection. This
374       # is useful to integrate a third party phishing/malware detection to
375       # existing safe browsing logic.
376       'safe_browsing%': 1,
377
378       # Web speech is enabled by default. Set to 0 to disable.
379       'enable_web_speech%': 1,
380
381       # Notifications are compiled in by default. Set to 0 to disable.
382       'notifications%' : 1,
383
384       # Use dsymutil to generate real .dSYM files on Mac. The default is 0 for
385       # regular builds and 1 for ASan builds.
386       'mac_want_real_dsym%': 'default',
387
388       # If this is set, the clang plugins used on the buildbot will be used.
389       # Run tools/clang/scripts/update.sh to make sure they are compiled.
390       # This causes 'clang_chrome_plugins_flags' to be set.
391       # Has no effect if 'clang' is not set as well.
392       'clang_use_chrome_plugins%': 1,
393
394       # Enable building with ASAN (Clang's -fsanitize=address option).
395       # -fsanitize=address only works with clang, but asan=1 implies clang=1
396       # See https://sites.google.com/a/chromium.org/dev/developers/testing/addresssanitizer
397       'asan%': 0,
398       'asan_blacklist%': '<(PRODUCT_DIR)/../../tools/memory/asan/blacklist.txt',
399       # Enable coverage gathering instrumentation in ASan. This flag also
400       # controls coverage granularity (1 for function-level coverage, 2 for
401       # block-level coverage).
402       'asan_coverage%': 0,
403       # Enable intra-object-overflow detection in ASan (experimental).
404       'asan_field_padding%': 0,
405
406       # Enable Chromium overrides of the default configurations for various
407       # dynamic tools (like ASan).
408       'use_sanitizer_options%': 0,
409
410       # Enable building with SyzyAsan.
411       # See https://code.google.com/p/sawbuck/wiki/SyzyASanHowTo
412       'syzyasan%': 0,
413
414       # Enable building with LSan (Clang's -fsanitize=leak option).
415       # -fsanitize=leak only works with clang, but lsan=1 implies clang=1
416       # See https://sites.google.com/a/chromium.org/dev/developers/testing/leaksanitizer
417       'lsan%': 0,
418
419       # Enable building with TSan (Clang's -fsanitize=thread option).
420       # -fsanitize=thread only works with clang, but tsan=1 implies clang=1
421       # See http://clang.llvm.org/docs/ThreadSanitizer.html
422       'tsan%': 0,
423       'tsan_blacklist%': '<(PRODUCT_DIR)/../../tools/memory/tsan_v2/ignores.txt',
424
425       # Enable building with MSan (Clang's -fsanitize=memory option).
426       # MemorySanitizer only works with clang, but msan=1 implies clang=1
427       # See http://clang.llvm.org/docs/MemorySanitizer.html
428       'msan%': 0,
429       'msan_blacklist%': '<(PRODUCT_DIR)/../../tools/msan/blacklist.txt',
430       # Track where uninitialized memory originates from. From fastest to
431       # slowest: 0 - no tracking, 1 - track only the initial allocation site, 2
432       # - track the chain of stores leading from allocation site to use site.
433       'msan_track_origins%': 1,
434
435       # Enable building with UBSan (Clang's -fsanitize=undefined option).
436       # -fsanitize=undefined only works with clang, but ubsan=1 implies clang=1
437       # See http://clang.llvm.org/docs/UsersManual.html
438       'ubsan%': 0,
439
440       # Enable building with UBsan's vptr (Clang's -fsanitize=vptr option).
441       # -fsanitize=vptr only works with clang, but ubsan_vptr=1 implies clang=1
442       'ubsan_vptr%': 0,
443       'ubsan_vptr_blacklist%': '<(PRODUCT_DIR)/../../tools/ubsan_vptr/blacklist.txt',
444
445       # Use the dynamic libraries instrumented by one of the sanitizers
446       # instead of the standard system libraries.
447       'use_instrumented_libraries%': 0,
448
449       # Use libc++ (third_party/libc++ and third_party/libc++abi) instead of
450       # stdlibc++ as standard library. This is intended to use for instrumented
451       # builds.
452       'use_custom_libcxx%': 0,
453
454       # Use system libc++ instead of the default C++ library, usually libstdc++.
455       # This is intended for iOS builds only.
456       'use_system_libcxx%': 0,
457
458       # Use a modified version of Clang to intercept allocated types and sizes
459       # for allocated objects. clang_type_profiler=1 implies clang=1.
460       # See http://dev.chromium.org/developers/deep-memory-profiler/cpp-object-type-identifier
461       # TODO(dmikurube): Support mac.  See http://crbug.com/123758#c11
462       'clang_type_profiler%': 0,
463
464       # Set to true to instrument the code with function call logger.
465       # See src/third_party/cygprofile/cyg-profile.cc for details.
466       'order_profiling%': 0,
467
468       # Use the provided profiled order file to link Chrome image with it.
469       # This makes Chrome faster by better using CPU cache when executing code.
470       # This is known as PGO (profile guided optimization).
471       # See https://sites.google.com/a/google.com/chrome-msk/dev/boot-speed-up-effort
472       'order_text_section%' : "",
473
474       # Set to 1 compile with -fPIC cflag on linux. This is a must for shared
475       # libraries on linux x86-64 and arm, plus ASLR.
476       'linux_fpic%': 1,
477
478       # Whether one-click signin is enabled or not.
479       'enable_one_click_signin%': 0,
480
481       # Whether to back up data before sync.
482       'enable_pre_sync_backup%': 0,
483
484       # Enable Chrome browser extensions
485       'enable_extensions%': 1,
486
487       # Enable Google Now.
488       'enable_google_now%': 1,
489
490       # Enable basic printing support and UI.
491       'enable_basic_printing%': 1,
492
493       # Enable printing with print preview. It does not imply
494       # enable_basic_printing. It's possible to build Chrome with preview only.
495       'enable_print_preview%': 1,
496
497       # Set the version of CLD.
498       #   0: Don't specify the version. This option is for the Finch testing.
499       #   1: Use only CLD1.
500       #   2: Use only CLD2.
501       'cld_version%': 2,
502
503       # For CLD2, the size of the tables that should be included in the build
504       # Only evaluated if cld_version == 2 or if building the CLD2 dynamic data
505       # tool explicitly.
506       # See third_party/cld_2/cld_2.gyp for more information.
507       #   0: Small tables, lower accuracy
508       #   1: Medium tables, medium accuracy
509       #   2: Large tables, high accuracy
510       'cld2_table_size%': 2,
511
512       # The data acquisition mode for CLD2. Possible values are:
513       #   static:     CLD2 data is statically linked to the executable.
514       #   standalone: CLD2 data is provided in a standalone file that is
515       #               bundled with the executable.
516       #   component:  CLD2 data is provided as a Chrome "component" and is
517       #               downloaded via the component updater.
518       #
519       # For more information on switching the CLD2 data source, see:
520       #   https://sites.google.com/a/chromium.org/dev/developers/how-tos/compact-language-detector-cld-data-source-configuration
521       #
522       # This string will be exposed in chrome://translate-internals under the
523       # heading "CLD Data Source". This allows easy determination of which
524       # data source the browser was built with.
525       'cld2_data_source%': 'static',
526
527       # Enable spell checker.
528       'enable_spellcheck%': 1,
529
530       # Webrtc compilation is enabled by default. Set to 0 to disable.
531       'enable_webrtc%': 1,
532
533       # Enables use of the session service, which is enabled by default.
534       # Support for disabling depends on the platform.
535       'enable_session_service%': 1,
536
537       # Enables theme support, which is enabled by default.  Support for
538       # disabling depends on the platform.
539       'enable_themes%': 1,
540
541       # Enables autofill dialog and associated features; disabled by default.
542       'enable_autofill_dialog%' : 0,
543
544       # Defaults Wallet integration in Autofill dialog to use production
545       # servers. Unofficial builds won't have the proper API keys.
546       'enable_prod_wallet_service%': 0,
547
548       # Enables support for background apps.
549       'enable_background%': 1,
550
551       # Enable the task manager by default.
552       'enable_task_manager%': 1,
553
554       # Enables used resource whitelist generation; disabled by default.
555       'enable_resource_whitelist_generation%': 0,
556
557       # Enable FILE support by default.
558       'disable_file_support%': 0,
559
560       # Enable FTP support by default.
561       'disable_ftp_support%': 0,
562
563       # Use native android functions in place of ICU.  Not supported by most
564       # components.
565       'use_icu_alternatives_on_android%': 0,
566
567       # XInput2 multitouch support is enabled by default (use_xi2_mt=2).
568       # Setting to zero value disables XI2 MT. When XI2 MT is enabled,
569       # the input value also defines the required XI2 minor minimum version.
570       # For example, use_xi2_mt=2 means XI2.2 or above version is required.
571       'use_xi2_mt%': 2,
572
573       # Use of precompiled headers on Windows.
574       #
575       # This variable may be explicitly set to 1 (enabled) or 0
576       # (disabled) in ~/.gyp/include.gypi or via the GYP command line.
577       # This setting will override the default.
578       #
579       # See
580       # http://code.google.com/p/chromium/wiki/WindowsPrecompiledHeaders
581       # for details.
582       'chromium_win_pch%': 0,
583
584       # Clang stuff.
585       'make_clang_dir%': 'third_party/llvm-build/Release+Asserts',
586       # Set this to true when building with Clang.
587       # See http://code.google.com/p/chromium/wiki/Clang for details.
588       # If this is set, clang is used as both host and target compiler in
589       # cross-compile builds.
590       'clang%': 0,
591
592       # Enable plug-in installation by default.
593       'enable_plugin_installation%': 1,
594
595       # Specifies whether to use canvas_skia.cc in place of platform
596       # specific implementations of gfx::Canvas. Affects text drawing in the
597       # Chrome UI.
598       # TODO(asvitkine): Enable this on all platforms and delete this flag.
599       #                  http://crbug.com/105550
600       'use_canvas_skia%': 0,
601
602       # Set to "tsan", "memcheck", or "drmemory" to configure the build to work
603       # with one of those tools.
604       'build_for_tool%': '',
605
606       # If no directory is specified then a temporary directory will be used.
607       'test_isolation_outdir%': '',
608       # True if isolate should fail if the isolate files refer to files
609       # that are missing.
610       'test_isolation_fail_on_missing': 1,
611
612       'wix_path%': '<(DEPTH)/third_party/wix',
613
614       # Managed users are enabled by default.
615       'enable_managed_users%': 1,
616
617       # Platform natively supports discardable memory.
618       'native_discardable_memory%': 0,
619
620       # Platform sends memory pressure signals natively.
621       'native_memory_pressure_signals%': 0,
622
623       'spdy_proxy_auth_property%' : '',
624       'spdy_proxy_auth_value%' : '',
625       'enable_mdns%' : 0,
626       'enable_service_discovery%': 0,
627       'enable_wifi_bootstrapping%': 0,
628       'enable_hangout_services_extension%': 0,
629
630        # Enable the Syzygy optimization step.
631       'syzygy_optimize%': 0,
632
633       # Enable hole punching for the protected video.
634       'video_hole%': 0,
635
636       # Temporary hack to allow us to unify blink's definitions of load
637       # completion. blink uses a crazy set of constraints to determine load
638       # completion, but only actually requires them for layout tests. However,
639       # we need to maintain all the old behaviors while the plumbing is put in
640       # place on both sides of the repo boundary.
641       'enable_load_completion_hacks%': 1,
642
643       # Automatically select platforms under ozone. Turn this off to
644       # build only explicitly selected platforms.
645       'ozone_auto_platforms%': 1,
646
647       # If this is set clang is used as host compiler, but not as target
648       # compiler. Always do this by default.
649       'host_clang%': 1,
650
651       # Variables to control Link-Time Optimizations (LTO).
652       # Note: the variables must *not* be enabled at the same time.
653       #       In this case LTO would 'merge' the optimization flags
654       #       at link-time which would lead to all code be optimized with -O2.
655       # Enable LTO on the code compiled with -Os.
656       # See crbug.com/407544
657       'use_lto%': 0,
658       # Enable LTO on code compiled with -O2.
659       'use_lto_o2%': 0,
660
661       'conditions': [
662         # A flag for POSIX platforms
663         ['OS=="win"', {
664           'os_posix%': 0,
665         }, {
666           'os_posix%': 1,
667         }],
668
669         # A flag for BSD platforms
670         ['OS=="freebsd" or OS=="openbsd"', {
671           'os_bsd%': 1,
672         }, {
673           'os_bsd%': 0,
674         }],
675
676         # NSS usage.
677         ['(OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="solaris") and use_openssl==0', {
678           'use_nss%': 1,
679         }, {
680           'use_nss%': 0,
681         }],
682
683         # When OpenSSL is used for SSL and crypto on Unix-like systems, use
684         # OpenSSL's certificate definition.
685         ['(OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="solaris") and use_openssl==1', {
686           'use_openssl_certs%': 1,
687         }, {
688           'use_openssl_certs%': 0,
689         }],
690
691         # libudev usage.  This currently only affects the content layer.
692         ['OS=="linux" and embedded==0', {
693           'use_udev%': 1,
694         }, {
695           'use_udev%': 0,
696         }],
697
698         # Flags to use X11 on non-Mac POSIX platforms.
699         ['OS=="win" or OS=="mac" or OS=="ios" or OS=="android" or use_ozone==1', {
700           'use_x11%': 0,
701         }, {
702           'use_x11%': 1,
703         }],
704
705         # Flags to use glib.
706         ['OS=="win" or OS=="mac" or OS=="ios" or OS=="android" or use_ozone==1', {
707           'use_glib%': 0,
708         }, {
709           'use_glib%': 1,
710         }],
711
712         # Flags to use pango and cairo.
713         ['OS=="win" or OS=="mac" or OS=="ios" or OS=="android" or embedded==1', {
714           'use_pango%': 0,
715           'use_cairo%': 0,
716         }, {
717           'use_pango%': 1,
718           'use_cairo%': 1,
719         }],
720
721         # DBus usage.
722         ['OS=="linux" and embedded==0', {
723           'use_dbus%': 1,
724         }, {
725           'use_dbus%': 0,
726         }],
727
728         # We always use skia text rendering in Aura on Windows, since GDI
729         # doesn't agree with our BackingStore.
730         # TODO(beng): remove once skia text rendering is on by default.
731         ['use_aura==1 and OS=="win"', {
732           'enable_skia_text%': 1,
733         }],
734
735         # A flag to enable or disable our compile-time dependency
736         # on gnome-keyring. If that dependency is disabled, no gnome-keyring
737         # support will be available. This option is useful
738         # for Linux distributions and for Aura.
739         ['OS!="linux" or chromeos==1', {
740           'use_gnome_keyring%': 0,
741         }, {
742           'use_gnome_keyring%': 1,
743         }],
744
745         ['OS=="mac" or OS=="ios"', {
746           # Mac and iOS want Title Case strings
747           'use_titlecase_in_grd%': 1,
748         }],
749
750         # Enable loader extensions on Chrome OS.
751         ['chromeos==1', {
752           'image_loader_extension%': 1,
753         }, {
754           'image_loader_extension%': 0,
755         }],
756
757         ['OS=="win" or OS=="mac" or (OS=="linux" and chromeos==0)', {
758           'enable_one_click_signin%': 1,
759           'enable_pre_sync_backup%': 1,
760         }],
761
762         ['OS=="android"', {
763           'enable_extensions%': 0,
764           'enable_google_now%': 0,
765           'cld_version%': 1,
766           'enable_spellcheck%': 0,
767           'enable_themes%': 0,
768           'remoting%': 0,
769           'arm_neon%': 0,
770           'arm_neon_optional%': 1,
771           'native_discardable_memory%': 1,
772           'native_memory_pressure_signals%': 1,
773           'enable_basic_printing%': 1,
774           'enable_print_preview%': 0,
775           'enable_task_manager%':0,
776           'video_hole%': 1,
777         }],
778
779         # Android OS includes support for proprietary codecs regardless of
780         # building Chromium or Google Chrome. We also ship Google Chrome and
781         # Chromecast with proprietary codecs.
782         ['OS=="android" or branding=="Chrome" or chromecast==1', {
783           'proprietary_codecs%': 1,
784         }, {
785           'proprietary_codecs%': 0,
786         }],
787
788         ['OS=="mac" or OS=="ios"', {
789           'native_discardable_memory%': 1,
790           'native_memory_pressure_signals%': 1,
791         }],
792
793         # Enable autofill dialog for Android, Mac and Views-enabled platforms.
794         ['toolkit_views==1 or (OS=="android" and android_webview_build==0) or OS=="mac"', {
795           'enable_autofill_dialog%': 1,
796
797           'conditions': [
798             ['buildtype=="Official"', {
799               'enable_prod_wallet_service%': 1,
800             }],
801           ]
802         }],
803
804         ['OS=="android"', {
805           'enable_webrtc%': 1,
806         }],
807
808         ['OS=="ios"', {
809           'disable_ftp_support%': 1,
810           'enable_extensions%': 0,
811           'enable_google_now%': 0,
812           'cld_version%': 1,
813           'enable_basic_printing%': 0,
814           'enable_print_preview%': 0,
815           'enable_session_service%': 0,
816           'enable_spellcheck%': 0,
817           'enable_themes%': 0,
818           'enable_webrtc%': 0,
819           'notifications%': 0,
820           'remoting%': 0,
821           'safe_browsing%': 0,
822           'enable_managed_users%': 0,
823           'enable_task_manager%': 0,
824           'use_system_libcxx%': 1,
825           'support_pre_M6_history_database%': 0,
826         }],
827
828         # Use GPU accelerated cross process image transport by default
829         # on linux builds with the Aura window manager
830         ['use_aura==1 and OS=="linux"', {
831           'ui_compositor_image_transport%': 1,
832         }, {
833           'ui_compositor_image_transport%': 0,
834         }],
835
836         # Turn precompiled headers on by default.
837         ['OS=="win" and buildtype!="Official"', {
838           'chromium_win_pch%': 1
839         }],
840
841         ['chromeos==1 or OS=="android" or OS=="ios" or desktop_linux==1', {
842           'enable_plugin_installation%': 0,
843         }, {
844           'enable_plugin_installation%': 1,
845         }],
846
847         # Whether PPAPI is enabled.
848         ['OS=="android" or OS=="ios" or embedded==1', {
849           'enable_plugins%': 0,
850         }, {
851           'enable_plugins%': 1,
852         }],
853
854         # linux_use_bundled_gold: whether to use the gold linker binary checked
855         # into third_party/binutils.  Force this off via GYP_DEFINES when you
856         # are using a custom toolchain and need to control -B in ldflags.
857         # Do not use 32-bit gold on 32-bit hosts as it runs out address space
858         # for component=static_library builds.
859         ['OS=="linux" and (target_arch=="x64" or target_arch=="arm")', {
860           'linux_use_bundled_gold%': 1,
861         }, {
862           'linux_use_bundled_gold%': 0,
863         }],
864
865         # linux_use_bundled_binutils: whether to use the binary binutils
866         # checked into third_party/binutils.  These are not multi-arch so cannot
867         # be used except on x86 and x86-64 (the only two architectures which
868         # are currently checke in).  Force this off via GYP_DEFINES when you
869         # are using a custom toolchain and need to control -B in cflags.
870         ['OS=="linux" and (target_arch=="x64")', {
871           'linux_use_bundled_binutils%': 1,
872         }, {
873           'linux_use_bundled_binutils%': 0,
874         }],
875
876         # linux_use_gold_flags: whether to use build flags that rely on gold.
877         # On by default for x64 Linux.
878         ['OS=="linux" and target_arch=="x64"', {
879           'linux_use_gold_flags%': 1,
880         }, {
881           'linux_use_gold_flags%': 0,
882         }],
883
884         # linux_use_debug_fission: whether to use split DWARF debug info
885         # files. This can reduce link time significantly, but is incompatible
886         # with some utilities such as icecc and ccache. Requires gold and
887         # gcc >= 4.8 or clang.
888         # http://gcc.gnu.org/wiki/DebugFission
889         ['OS=="linux" and target_arch=="x64"', {
890           'linux_use_debug_fission%': 1,
891         }, {
892           'linux_use_debug_fission%': 0,
893         }],
894
895         ['OS=="android" or OS=="ios"', {
896           'enable_captive_portal_detection%': 0,
897         }, {
898           'enable_captive_portal_detection%': 1,
899         }],
900
901         # Enable Skia UI text drawing incrementally on different platforms.
902         # http://crbug.com/105550
903         #
904         # On Aura, this allows per-tile painting to be used in the browser
905         # compositor.
906         ['OS!="android"', {
907           'use_canvas_skia%': 1,
908         }],
909
910         ['chromeos==1', {
911           'enable_basic_printing%': 0,
912           'enable_print_preview%': 1,
913           # When building for ChromeOS we dont want Chromium to use libjpeg_turbo.
914           'use_libjpeg_turbo%': 0,
915         }],
916
917         # Do not enable the Settings App on ChromeOS.
918         ['enable_app_list==1 and chromeos==0', {
919           'enable_settings_app%': 1,
920         }, {
921           'enable_settings_app%': 0,
922         }],
923
924         ['OS=="linux" and target_arch=="arm" and chromeos==0', {
925           # Set some defaults for arm/linux chrome builds
926           'use_allocator%': 'none',
927           # sysroot needs to be an absolute path otherwise it generates
928           # incorrect results when passed to pkg-config
929           'sysroot%': '<!(cd <(DEPTH) && pwd -P)/chrome/installer/linux/debian_wheezy_arm-sysroot',
930         }], # OS=="linux" and target_arch=="arm" and chromeos==0
931
932         ['OS=="linux" and branding=="Chrome" and buildtype=="Official" and chromeos==0', {
933           'conditions': [
934             ['target_arch=="x64"', {
935               'sysroot%': '<!(cd <(DEPTH) && pwd -P)/chrome/installer/linux/debian_wheezy_amd64-sysroot',
936             }],
937             ['target_arch=="ia32"', {
938               'sysroot%': '<!(cd <(DEPTH) && pwd -P)/chrome/installer/linux/debian_wheezy_i386-sysroot',
939             }],
940         ],
941         }], # OS=="linux" and branding=="Chrome" and buildtype=="Official" and chromeos==0
942
943         ['OS=="linux" and target_arch=="mipsel"', {
944           'sysroot%': '<!(cd <(DEPTH) && pwd -P)/mipsel-sysroot/sysroot',
945           'CXX%': '<!(cd <(DEPTH) && pwd -P)/mipsel-sysroot/bin/mipsel-linux-gnu-gcc',
946         }],
947
948         # Whether tests targets should be run, archived or just have the
949         # dependencies verified. All the tests targets have the '_run' suffix,
950         # e.g. base_unittests_run runs the target base_unittests. The test
951         # target always calls tools/swarming_client/isolate.py. See the script's
952         # --help for more information. Meant to be overriden with GYP_DEFINES.
953         # TODO(maruel): Remove the conditions as more configurations are
954         # supported.
955         ['OS!="ios" and OS!="android" and chromeos==0', {
956           'test_isolation_mode%': 'check',
957         }, {
958           'test_isolation_mode%': 'noop',
959         }],
960         # Whether Android build uses OpenMAX DL FFT.
961         ['OS=="android" and ((target_arch=="arm" and arm_version >= 7) or target_arch=="ia32" or target_arch=="x64" or target_arch=="arm64" or target_arch=="mipsel")', {
962           # Currently only supported on Android ARMv7+, ARM64, ia32, x64 and mipsel.
963           # When enabled, this will also enable WebAudio support on
964           # Android for these architectures.  Default is enabled.  Whether
965           # WebAudio is actually available depends on runtime settings
966           # and flags.
967           'use_openmax_dl_fft%': 1,
968         }, {
969           'use_openmax_dl_fft%': 0,
970         }],
971         ['OS=="win" or OS=="linux"', {
972             'enable_mdns%' : 1,
973         }],
974
975         # Turns on compiler optimizations in V8 in Debug build, except
976         # on android_clang, where we're hitting a weird linker error.
977         # TODO(dpranke): http://crbug.com/266155 .
978         ['OS=="android"', {
979           'v8_optimized_debug%': 1,
980         }, {
981           'v8_optimized_debug%': 2,
982         }],
983
984         # Disable various features by default on embedded.
985         ['embedded==1', {
986           'remoting%': 0,
987           'enable_basic_printing%': 0,
988           'enable_print_preview%': 0,
989         }],
990
991         # By default, use ICU data file (icudtl.dat) on all platforms
992         # except when building Android WebView or Chromecast.
993         # TODO(jshin): Handle 'use_system_icu' on Linux (Chromium).
994         # Set the data reduction proxy origin for Android Webview.
995         ['android_webview_build==0 and android_webview_telemetry_build==0 and chromecast==0', {
996           'icu_use_data_file_flag%' : 1,
997         }, {
998           'icu_use_data_file_flag%' : 0,
999         }],
1000         ['OS=="win" or OS=="mac"', {
1001             'enable_wifi_bootstrapping%' : 1,
1002         }],
1003
1004         # Path to sas.dll, which provides the SendSAS function.
1005         # http://msdn.microsoft.com/en-us/library/windows/desktop/dd979761(v=vs.85).aspx
1006         ['target_arch=="x64"', {
1007           'sas_dll_path%': '<(DEPTH)/third_party/platformsdk_win7/files/redist/amd64',
1008         }, {
1009           'sas_dll_path%': '<(DEPTH)/third_party/platformsdk_win7/files/redist/x86',
1010         }],
1011
1012         # Turn on JNI generation optimizations on non-WebView builds.
1013         ['OS=="android" and android_webview_build==0', {
1014           'optimize_jni_generation%': 1,
1015         }, {
1016           'optimize_jni_generation%': 0,
1017         }],
1018
1019         # TODO(baixo): Enable v8_use_external_startup_data
1020         # http://crbug.com/421063
1021         ['android_webview_build==0 and android_webview_telemetry_build==0 and chromecast==0', {
1022           'v8_use_external_startup_data': 0,
1023         }, {
1024           'v8_use_external_startup_data': 0,
1025         }],
1026       ],
1027
1028       # Set this to 1 to enable use of concatenated impulse responses
1029       # for the HRTF panner in WebAudio.
1030       'use_concatenated_impulse_responses': 1,
1031
1032       # You can set the variable 'use_official_google_api_keys' to 1
1033       # to use the Google-internal file containing official API keys
1034       # for Google Chrome even in a developer build.  Setting this
1035       # variable explicitly to 1 will cause your build to fail if the
1036       # internal file is missing.
1037       #
1038       # The variable is documented here, but not handled in this file;
1039       # see //google_apis/determine_use_official_keys.gypi for the
1040       # implementation.
1041       #
1042       # Set the variable to 0 to not use the internal file, even when
1043       # it exists in your checkout.
1044       #
1045       # Leave it unset in your include.gypi to have the variable
1046       # implicitly set to 1 if you have
1047       # src/google_apis/internal/google_chrome_api_keys.h in your
1048       # checkout, and implicitly set to 0 if not.
1049       #
1050       # Note that official builds always behave as if the variable
1051       # was explicitly set to 1, i.e. they always use official keys,
1052       # and will fail to build if the internal file is missing.
1053       #
1054       # NOTE: You MUST NOT explicitly set the variable to 2 in your
1055       # include.gypi or by other means. Due to subtleties of GYP, this
1056       # is not the same as leaving the variable unset, even though its
1057       # default value in
1058       # //google_apis/determine_use_official_keys.gypi is 2.
1059
1060       # Set these to bake the specified API keys and OAuth client
1061       # IDs/secrets into your build.
1062       #
1063       # If you create a build without values baked in, you can instead
1064       # set environment variables to provide the keys at runtime (see
1065       # src/google_apis/google_api_keys.h for details).  Features that
1066       # require server-side APIs may fail to work if no keys are
1067       # provided.
1068       #
1069       # Note that if you are building an official build or if
1070       # use_official_google_api_keys has been set to 1 (explicitly or
1071       # implicitly), these values will be ignored and the official
1072       # keys will be used instead.
1073       'google_api_key%': '',
1074       'google_default_client_id%': '',
1075       'google_default_client_secret%': '',
1076       # Native Client is enabled by default.
1077       'disable_nacl%': '0',
1078
1079       # Set to 1 to support old history files
1080       'support_pre_M6_history_database%': '1',
1081     },
1082
1083     # Copy conditionally-set variables out one scope.
1084     'branding%': '<(branding)',
1085     'buildtype%': '<(buildtype)',
1086     'target_arch%': '<(target_arch)',
1087     'target_subarch%': '<(target_subarch)',
1088     'mips_arch_variant%': '<(mips_arch_variant)',
1089     'host_arch%': '<(host_arch)',
1090     'toolkit_views%': '<(toolkit_views)',
1091     'ui_compositor_image_transport%': '<(ui_compositor_image_transport)',
1092     'use_aura%': '<(use_aura)',
1093     'use_ash%': '<(use_ash)',
1094     'use_cras%': '<(use_cras)',
1095     'use_libpci%': '<(use_libpci)',
1096     'use_openssl%': '<(use_openssl)',
1097     'use_openssl_certs%': '<(use_openssl_certs)',
1098     'use_nss%': '<(use_nss)',
1099     'use_udev%': '<(use_udev)',
1100     'os_bsd%': '<(os_bsd)',
1101     'os_posix%': '<(os_posix)',
1102     'use_dbus%': '<(use_dbus)',
1103     'use_glib%': '<(use_glib)',
1104     'use_pango%': '<(use_pango)',
1105     'use_cairo%': '<(use_cairo)',
1106     'use_ozone%': '<(use_ozone)',
1107     'use_ozone_evdev%': '<(use_ozone_evdev)',
1108     'use_clipboard_aurax11%': '<(use_clipboard_aurax11)',
1109     'desktop_linux%': '<(desktop_linux)',
1110     'use_x11%': '<(use_x11)',
1111     'use_gnome_keyring%': '<(use_gnome_keyring)',
1112     'linux_fpic%': '<(linux_fpic)',
1113     'chromeos%': '<(chromeos)',
1114     'chromecast%': '<(chromecast)',
1115     'enable_viewport%': '<(enable_viewport)',
1116     'enable_hidpi%': '<(enable_hidpi)',
1117     'use_xi2_mt%':'<(use_xi2_mt)',
1118     'image_loader_extension%': '<(image_loader_extension)',
1119     'fastbuild%': '<(fastbuild)',
1120     'dont_embed_build_metadata%': '<(dont_embed_build_metadata)',
1121     'win_z7%': '<(win_z7)',
1122     'dcheck_always_on%': '<(dcheck_always_on)',
1123     'tracing_like_official_build%': '<(tracing_like_official_build)',
1124     'arm_version%': '<(arm_version)',
1125     'arm_neon%': '<(arm_neon)',
1126     'arm_neon_optional%': '<(arm_neon_optional)',
1127     'sysroot%': '<(sysroot)',
1128     'chroot_cmd%': '<(chroot_cmd)',
1129     'system_libdir%': '<(system_libdir)',
1130     'component%': '<(component)',
1131     'win_analyze%': '<(win_analyze)',
1132     'enable_resource_whitelist_generation%': '<(enable_resource_whitelist_generation)',
1133     'use_titlecase_in_grd%': '<(use_titlecase_in_grd)',
1134     'use_third_party_translations%': '<(use_third_party_translations)',
1135     'remoting%': '<(remoting)',
1136     'enable_one_click_signin%': '<(enable_one_click_signin)',
1137     'enable_pre_sync_backup%': '<(enable_pre_sync_backup)',
1138     'enable_webrtc%': '<(enable_webrtc)',
1139     'chromium_win_pch%': '<(chromium_win_pch)',
1140     'configuration_policy%': '<(configuration_policy)',
1141     'safe_browsing%': '<(safe_browsing)',
1142     'enable_web_speech%': '<(enable_web_speech)',
1143     'notifications%': '<(notifications)',
1144     'clang_use_chrome_plugins%': '<(clang_use_chrome_plugins)',
1145     'mac_want_real_dsym%': '<(mac_want_real_dsym)',
1146     'asan%': '<(asan)',
1147     'asan_blacklist%': '<(asan_blacklist)',
1148     'asan_coverage%': '<(asan_coverage)',
1149     'asan_field_padding%': '<(asan_field_padding)',
1150     'use_sanitizer_options%': '<(use_sanitizer_options)',
1151     'syzyasan%': '<(syzyasan)',
1152     'syzygy_optimize%': '<(syzygy_optimize)',
1153     'lsan%': '<(lsan)',
1154     'msan%': '<(msan)',
1155     'msan_blacklist%': '<(msan_blacklist)',
1156     'msan_track_origins%': '<(msan_track_origins)',
1157     'tsan%': '<(tsan)',
1158     'tsan_blacklist%': '<(tsan_blacklist)',
1159     'ubsan%': '<(ubsan)',
1160     'ubsan_vptr%': '<(ubsan_vptr)',
1161     'ubsan_vptr_blacklist%': '<(ubsan_vptr_blacklist)',
1162     'use_instrumented_libraries%': '<(use_instrumented_libraries)',
1163     'use_custom_libcxx%': '<(use_custom_libcxx)',
1164     'use_system_libcxx%': '<(use_system_libcxx)',
1165     'clang_type_profiler%': '<(clang_type_profiler)',
1166     'order_profiling%': '<(order_profiling)',
1167     'order_text_section%': '<(order_text_section)',
1168     'enable_extensions%': '<(enable_extensions)',
1169     'enable_plugin_installation%': '<(enable_plugin_installation)',
1170     'enable_plugins%': '<(enable_plugins)',
1171     'enable_session_service%': '<(enable_session_service)',
1172     'enable_themes%': '<(enable_themes)',
1173     'enable_autofill_dialog%': '<(enable_autofill_dialog)',
1174     'enable_prod_wallet_service%': '<(enable_prod_wallet_service)',
1175     'enable_background%': '<(enable_background)',
1176     'linux_use_bundled_gold%': '<(linux_use_bundled_gold)',
1177     'linux_use_bundled_binutils%': '<(linux_use_bundled_binutils)',
1178     'linux_use_gold_flags%': '<(linux_use_gold_flags)',
1179     'linux_use_debug_fission%': '<(linux_use_debug_fission)',
1180     'use_canvas_skia%': '<(use_canvas_skia)',
1181     'test_isolation_mode%': '<(test_isolation_mode)',
1182     'test_isolation_outdir%': '<(test_isolation_outdir)',
1183     'test_isolation_fail_on_missing': '<(test_isolation_fail_on_missing)',
1184     'enable_basic_printing%': '<(enable_basic_printing)',
1185     'enable_print_preview%': '<(enable_print_preview)',
1186     'enable_spellcheck%': '<(enable_spellcheck)',
1187     'enable_google_now%': '<(enable_google_now)',
1188     'cld_version%': '<(cld_version)',
1189     'cld2_table_size%': '<(cld2_table_size)',
1190     'cld2_data_source%': '<(cld2_data_source)',
1191     'enable_captive_portal_detection%': '<(enable_captive_portal_detection)',
1192     'disable_file_support%': '<(disable_file_support)',
1193     'disable_ftp_support%': '<(disable_ftp_support)',
1194     'use_icu_alternatives_on_android%': '<(use_icu_alternatives_on_android)',
1195     'enable_task_manager%': '<(enable_task_manager)',
1196     'sas_dll_path%': '<(sas_dll_path)',
1197     'wix_path%': '<(wix_path)',
1198     'use_libjpeg_turbo%': '<(use_libjpeg_turbo)',
1199     'use_system_libjpeg%': '<(use_system_libjpeg)',
1200     'android_channel%': '<(android_channel)',
1201     'android_webview_build%': '<(android_webview_build)',
1202     'android_webview_telemetry_build%': '<(android_webview_telemetry_build)',
1203     'icu_use_data_file_flag%': '<(icu_use_data_file_flag)',
1204     'gyp_managed_install%': 0,
1205     'create_standalone_apk%': 1,
1206     'enable_app_list%': '<(enable_app_list)',
1207     'use_default_render_theme%': '<(use_default_render_theme)',
1208     'enable_settings_app%': '<(enable_settings_app)',
1209     'google_api_key%': '<(google_api_key)',
1210     'google_default_client_id%': '<(google_default_client_id)',
1211     'google_default_client_secret%': '<(google_default_client_secret)',
1212     'enable_managed_users%': '<(enable_managed_users)',
1213     'native_discardable_memory%': '<(native_discardable_memory)',
1214     'native_memory_pressure_signals%': '<(native_memory_pressure_signals)',
1215     'spdy_proxy_auth_property%': '<(spdy_proxy_auth_property)',
1216     'spdy_proxy_auth_value%': '<(spdy_proxy_auth_value)',
1217     'enable_mdns%' : '<(enable_mdns)',
1218     'enable_service_discovery%' : '<(enable_service_discovery)',
1219     'enable_wifi_bootstrapping%': '<(enable_wifi_bootstrapping)',
1220     'enable_hangout_services_extension%' : '<(enable_hangout_services_extension)',
1221     'v8_optimized_debug%': '<(v8_optimized_debug)',
1222     'proprietary_codecs%': '<(proprietary_codecs)',
1223     'use_goma%': '<(use_goma)',
1224     'gomadir%': '<(gomadir)',
1225     'use_lto%': '<(use_lto)',
1226     'use_lto_o2%': '<(use_lto_o2)',
1227     'video_hole%': '<(video_hole)',
1228     'enable_load_completion_hacks%': '<(enable_load_completion_hacks)',
1229     'support_pre_M6_history_database%': '<(support_pre_M6_history_database)',
1230     'v8_use_external_startup_data': '<(v8_use_external_startup_data)',
1231
1232     # Whether or not we are building the Athena shell.
1233     'use_athena%': '0',
1234
1235     # Use system protobuf instead of bundled one.
1236     'use_system_protobuf%': 0,
1237
1238     # Use system yasm instead of bundled one.
1239     'use_system_yasm%': 0,
1240
1241     # Use system ICU instead of bundled one.
1242     'use_system_icu%' : 0,
1243
1244     # Default to enabled PIE; this is important for ASLR but we may need to be
1245     # able to turn it off for various reasons.
1246     'linux_disable_pie%': 0,
1247
1248     # The release channel that this build targets. This is used to restrict
1249     # channel-specific build options, like which installer packages to create.
1250     # The default is 'all', which does no channel-specific filtering.
1251     'channel%': 'all',
1252
1253     # Override chromium_mac_pch and set it to 0 to suppress the use of
1254     # precompiled headers on the Mac.  Prefix header injection may still be
1255     # used, but prefix headers will not be precompiled.  This is useful when
1256     # using distcc to distribute a build to compile slaves that don't
1257     # share the same compiler executable as the system driving the compilation,
1258     # because precompiled headers rely on pointers into a specific compiler
1259     # executable's image.  Setting this to 0 is needed to use an experimental
1260     # Linux-Mac cross compiler distcc farm.
1261     'chromium_mac_pch%': 1,
1262
1263     # The default value for mac_strip in target_defaults. This cannot be
1264     # set there, per the comment about variable% in a target_defaults.
1265     'mac_strip_release%': 0,
1266
1267     # Set to 1 to enable java code coverage. Instruments classes during build
1268     # to produce .ec files during runtime.
1269     'emma_coverage%': 0,
1270
1271     # EMMA filter string consisting of a list of inclusion/exclusion patterns
1272     # separated with whitespace and/or comma. Only has effect if
1273     # 'emma_coverage=1'.
1274     'emma_filter%': '',
1275
1276     # Set to 1 to enable running Android lint on java/class files.
1277     'android_lint%': 1,
1278
1279     # Although base/allocator lets you select a heap library via an
1280     # environment variable, the libcmt shim it uses sometimes gets in
1281     # the way.  To disable it entirely, and switch to normal msvcrt, do e.g.
1282     #  'win_use_allocator_shim': 0,
1283     #  'win_release_RuntimeLibrary': 2
1284     # to ~/.gyp/include.gypi, gclient runhooks --force, and do a release build.
1285     'win_use_allocator_shim%': 1, # 1 = shim allocator via libcmt; 0 = msvcrt
1286
1287     # TODO(bradnelson): eliminate this when possible.
1288     # To allow local gyp files to prevent release.vsprops from being included.
1289     # Yes(1) means include release.vsprops.
1290     # Once all vsprops settings are migrated into gyp, this can go away.
1291     'msvs_use_common_release%': 1,
1292
1293     # TODO(bradnelson): eliminate this when possible.
1294     # To allow local gyp files to override additional linker options for msvs.
1295     # Yes(1) means set use the common linker options.
1296     'msvs_use_common_linker_extras%': 1,
1297
1298     # TODO(sgk): eliminate this if possible.
1299     # It would be nicer to support this via a setting in 'target_defaults'
1300     # in chrome/app/locales/locales.gypi overriding the setting in the
1301     # 'Debug' configuration in the 'target_defaults' dict below,
1302     # but that doesn't work as we'd like.
1303     'msvs_debug_link_incremental%': '2',
1304
1305     # Needed for some of the largest modules.
1306     'msvs_debug_link_nonincremental%': '1',
1307
1308     # Turns on Use Library Dependency Inputs for linking chrome.dll on Windows
1309     # to get incremental linking to be faster in debug builds.
1310     'incremental_chrome_dll%': '0',
1311
1312     # Experimental setting to break chrome.dll into multiple pieces based on
1313     # process type.
1314     'chrome_multiple_dll%': '0',
1315
1316     # Experimental setting to optimize Chrome's DLLs with PGO.
1317     'chrome_pgo_phase%': '0',
1318
1319     # Clang stuff.
1320     'clang%': '<(clang)',
1321     'host_clang%': '<(host_clang)',
1322     'make_clang_dir%': '<(make_clang_dir)',
1323
1324     # Control which version of clang to use when building for iOS.  If set to
1325     # '1', uses the version of clang that ships with Xcode.  If set to '0', uses
1326     # the version of clang that ships with the Chromium source.  This variable
1327     # is automatically set to '1' when using the Xcode generator.
1328     'clang_xcode%': 0,
1329
1330     # These two variables can be set in GYP_DEFINES while running
1331     # |gclient runhooks| to let clang run a plugin in every compilation.
1332     # Only has an effect if 'clang=1' is in GYP_DEFINES as well.
1333     # Example:
1334     #     GYP_DEFINES='clang=1 clang_load=/abs/path/to/libPrintFunctionNames.dylib clang_add_plugin=print-fns' gclient runhooks
1335
1336     'clang_load%': '',
1337     'clang_add_plugin%': '',
1338
1339     # Tell ld64 to write map files describing binary layout. Useful
1340     # for looking at what contributes to binary size, e.g. with
1341     # https://github.com/nico/bloat
1342     'mac_write_linker_maps%': 0,
1343
1344     # The default type of gtest.
1345     'gtest_target_type%': 'executable',
1346
1347     # Enable sampling based profiler.
1348     # See http://google-perftools.googlecode.com/svn/trunk/doc/cpuprofile.html
1349     'profiling%': '0',
1350     # Profile without optimizing out stack frames when profiling==1.
1351     'profiling_full_stack_frames%': '0',
1352
1353     # And if we want to dump symbols for Breakpad-enabled builds.
1354     'linux_dump_symbols%': 0,
1355     # And if we want to strip the binary after dumping symbols.
1356     'linux_strip_binary%': 0,
1357     # If we want stack unwind support for backtrace().
1358     'debug_unwind_tables%': 1,
1359     'release_unwind_tables%': 1,
1360
1361     # Override where to find binutils
1362     'binutils_version%': 0,
1363     'binutils_dir%': '',
1364
1365     # Enable TCMalloc.
1366     # Default of 'use_allocator' is set to 'none' if OS=='android' later.
1367     'use_allocator%': 'tcmalloc',
1368
1369     # Set to 1 to link against libgnome-keyring instead of using dlopen().
1370     'linux_link_gnome_keyring%': 0,
1371     # Set to 1 to link against gsettings APIs instead of using dlopen().
1372     'linux_link_gsettings%': 0,
1373
1374     # Enable use of OpenMAX DL FFT routines.
1375     'use_openmax_dl_fft%': '<(use_openmax_dl_fft)',
1376
1377     # Enable new NPDevice API.
1378     'enable_new_npdevice_api%': 0,
1379
1380     # .gyp files or targets should set chromium_code to 1 if they build
1381     # Chromium-specific code, as opposed to external code.  This variable is
1382     # used to control such things as the set of warnings to enable, and
1383     # whether warnings are treated as errors.
1384     'chromium_code%': 0,
1385
1386     # Disable fatal linker warnings, similarly to how we make it possible
1387     # to disable -Werror (e.g. for different toolchain versions).
1388     'disable_fatal_linker_warnings%': 0,
1389
1390     'release_valgrind_build%': 0,
1391
1392     # TODO(thakis): Make this a blacklist instead, http://crbug.com/101600
1393     'enable_wexit_time_destructors%': 0,
1394
1395     # Build libpeerconnection as a static library by default.
1396     'libpeer_target_type%': 'static_library',
1397
1398     # Set to 1 to compile with the OpenGL ES 2.0 conformance tests.
1399     'internal_gles2_conform_tests%': 0,
1400
1401     # Set to 1 to compile with the Khronos GL-CTS conformance tests.
1402     'internal_khronos_glcts_tests%': 0,
1403
1404     # Set to 1 to compile the filter fuzzer.
1405     'internal_filter_fuzzer%': 0,
1406
1407     # NOTE: When these end up in the Mac bundle, we need to replace '-' for '_'
1408     # so Cocoa is happy (http://crbug.com/20441).
1409     'locales': [
1410       'am', 'ar', 'bg', 'bn', 'ca', 'cs', 'da', 'de', 'el', 'en-GB',
1411       'en-US', 'es-419', 'es', 'et', 'fa', 'fi', 'fil', 'fr', 'gu', 'he',
1412       'hi', 'hr', 'hu', 'id', 'it', 'ja', 'kn', 'ko', 'lt', 'lv',
1413       'ml', 'mr', 'ms', 'nb', 'nl', 'pl', 'pt-BR', 'pt-PT', 'ro', 'ru',
1414       'sk', 'sl', 'sr', 'sv', 'sw', 'ta', 'te', 'th', 'tr', 'uk',
1415       'vi', 'zh-CN', 'zh-TW',
1416     ],
1417
1418     # Pseudo locales are special locales which are used for testing and
1419     # debugging. They don't get copied to the final app. For more info,
1420     # check out https://sites.google.com/a/chromium.org/dev/Home/fake-bidi
1421     'pseudo_locales': [
1422       'fake-bidi',
1423     ],
1424
1425     'grit_defines': [],
1426
1427     # If debug_devtools is set to 1, JavaScript files for DevTools are
1428     # stored as is and loaded from disk. Otherwise, a concatenated file
1429     # is stored in resources.pak. It is still possible to load JS files
1430     # from disk by passing --debug-devtools cmdline switch.
1431     'debug_devtools%': 0,
1432
1433     # The Java Bridge is not compiled in by default.
1434     'java_bridge%': 0,
1435
1436     # Code signing for iOS binaries.  The bots need to be able to disable this.
1437     'chromium_ios_signing%': 1,
1438
1439     # This flag is only used when disable_nacl==0 and disables all those
1440     # subcomponents which would require the installation of a native_client
1441     # untrusted toolchain.
1442     'disable_nacl_untrusted%': 0,
1443
1444     # Disable Dart by default.
1445     'enable_dart%': 0,
1446
1447     # Copy out the setting of disable_nacl.
1448     'disable_nacl%': '<(disable_nacl)',
1449
1450     # Portable Native Client is enabled by default.
1451     'disable_pnacl%': 0,
1452
1453     # Whether to build full debug version for Debug configuration on Android.
1454     # Compared to full debug version, the default Debug configuration on Android
1455     # has no full v8 debug, has size optimization and linker gc section, so that
1456     # we can build a debug version with acceptable size and performance.
1457     'android_full_debug%': 0,
1458
1459     # Sets the default version name and code for Android app, by default we
1460     # do a developer build.
1461     'android_app_version_name%': 'Developer Build',
1462     'android_app_version_code%': 1,
1463
1464     # Contains data about the attached devices for gyp_managed_install.
1465     'build_device_config_path': '<(PRODUCT_DIR)/build_devices.cfg',
1466
1467     'sas_dll_exists': '<!pymod_do_main(dir_exists "<(sas_dll_path)")',
1468     'wix_exists': '<!pymod_do_main(dir_exists "<(wix_path)")',
1469
1470     'windows_sdk_default_path': '<(DEPTH)/third_party/platformsdk_win8/files',
1471     'directx_sdk_default_path': '<(DEPTH)/third_party/directxsdk/files',
1472
1473     # Whether we are using the rlz library or not.  Platforms like Android send
1474     # rlz codes for searches but do not use the library.
1475     'enable_rlz%': 0,
1476
1477     # Turns on the i18n support in V8.
1478     'v8_enable_i18n_support': 1,
1479
1480     # Compile d8 for the host toolset.
1481     'v8_toolset_for_d8': 'host',
1482
1483     # Use brlapi from brltty for braille display support.
1484     'use_brlapi%': 0,
1485
1486     # Relative path to icu.gyp from this file.
1487     'icu_gyp_path': '../third_party/icu/icu.gyp',
1488
1489     # IPC fuzzer is disabled by default.
1490     'enable_ipc_fuzzer%': 0,
1491
1492
1493     # Force disable libstdc++ debug mode.
1494     'disable_glibcxx_debug%': 0,
1495
1496     # Set to 1 to compile with MSE support for MPEG2 TS
1497     'enable_mpeg2ts_stream_parser%': 0,
1498
1499     # Support ChromeOS touchpad gestures with ozone.
1500     'use_evdev_gestures%': 0,
1501
1502     # Default ozone platform (if no --ozone-platform flag).
1503     'ozone_platform%': "",
1504
1505     # Ozone platforms to include in the build.
1506     'ozone_platform_caca%': 0,
1507     'ozone_platform_dri%': 0,
1508     'ozone_platform_egltest%': 0,
1509     'ozone_platform_gbm%': 0,
1510     'ozone_platform_ozonex%': 0,
1511     'ozone_platform_test%': 0,
1512
1513     'conditions': [
1514       ['buildtype=="Official"', {
1515         # Continue to embed build meta data in Official builds, basically the
1516         # time it was built.
1517         # TODO(maruel): This decision should be revisited because having an
1518         # official deterministic build has high value too but MSVC toolset can't
1519         # generate anything deterministic with WPO enabled AFAIK.
1520         'dont_embed_build_metadata%': 0,
1521       }],
1522       # Enable the Syzygy optimization step for the official builds.
1523       ['OS=="win" and buildtype=="Official" and syzyasan!=1', {
1524         'syzygy_optimize%': 1,
1525       }, {
1526         'syzygy_optimize%': 0,
1527       }],
1528       # Get binutils version so we can enable debug fission if we can.
1529       ['os_posix==1 and OS!="mac" and OS!="ios"', {
1530         'conditions': [
1531           # compiler_version doesn't work with clang
1532           # TODO(mithro): Land https://codereview.chromium.org/199793014/ so
1533           # compiler_version works with clang.
1534           # TODO(glider): set clang to 1 earlier for ASan and TSan builds so
1535           # that it takes effect here.
1536           ['clang==0 and asan==0 and lsan==0 and tsan==0 and msan==0 and ubsan==0 and ubsan_vptr==0', {
1537             'binutils_version%': '<!pymod_do_main(compiler_version target assembler)',
1538           }],
1539           # On Android we know the binutils version in the toolchain.
1540           ['OS=="android"', {
1541             'binutils_version%': 222,
1542           }],
1543           ['host_arch=="x64"', {
1544             'binutils_dir%': 'third_party/binutils/Linux_x64/Release/bin',
1545           }],
1546           ['host_arch=="ia32"', {
1547             'binutils_dir%': 'third_party/binutils/Linux_ia32/Release/bin',
1548           }],
1549           # Our version of binutils in third_party/binutils
1550           ['linux_use_bundled_binutils==1', {
1551             'binutils_version%': 224,
1552           }],
1553         ],
1554       }, {
1555         'binutils_version%': 0,
1556       }],
1557       # The version of GCC in use, set later in platforms that use GCC and have
1558       # not explicitly chosen to build with clang. Currently, this means all
1559       # platforms except Windows, Mac and iOS.
1560       # TODO(glider): set clang to 1 earlier for ASan and TSan builds so that
1561       # it takes effect here.
1562       ['os_posix==1 and OS!="mac" and OS!="ios" and clang==0 and asan==0 and lsan==0 and tsan==0 and msan==0 and ubsan_vptr==0', {
1563         'conditions': [
1564           ['OS=="android" and android_webview_build==0', {
1565             'host_gcc_version%': '<!pymod_do_main(compiler_version host compiler)',
1566             # We directly set the gcc version since we know what we use.
1567             'gcc_version%': 49,
1568           }],
1569           ['OS=="android" and android_webview_build==1', {
1570             # Android WebView uses a hermetic clang toolchain for host builds.
1571             'host_gcc_version%': 0,
1572             # Android WebView uses the GCC toolchain from the Android build.
1573             'gcc_version%': 48,
1574           }],
1575           ['OS!="android"', {
1576             'host_gcc_version%': '<!pymod_do_main(compiler_version host compiler)',
1577             'gcc_version%': '<!pymod_do_main(compiler_version target compiler)',
1578           }],
1579         ],
1580       }, {
1581         'host_gcc_version%': 0,
1582         'gcc_version%': 0,
1583       }],
1584       ['OS=="win" and "<!pymod_do_main(dir_exists <(windows_sdk_default_path))"=="True"', {
1585         'windows_sdk_path%': '<(windows_sdk_default_path)',
1586       }, {
1587         'windows_sdk_path%': 'C:/Program Files (x86)/Windows Kits/8.0',
1588       }],
1589       ['OS=="win" and "<!pymod_do_main(dir_exists <(directx_sdk_default_path))"=="True"', {
1590         'directx_sdk_path%': '<(directx_sdk_default_path)',
1591       }, {
1592         'directx_sdk_path%': '$(DXSDK_DIR)',
1593       }],
1594       ['OS=="win"', {
1595         'windows_driver_kit_path%': '$(WDK_DIR)',
1596       }],
1597       ['os_posix==1 and OS!="mac" and OS!="ios"', {
1598         'conditions': [
1599           ['target_arch=="mipsel" or target_arch=="mips64el"', {
1600             'werror%': '',
1601             'disable_nacl%': 1,
1602             'nacl_untrusted_build%': 0,
1603             'use_allocator%': 'none',
1604           }],
1605           ['OS=="linux" and target_arch=="mipsel"', {
1606             'sysroot%': '<(sysroot)',
1607             'CXX%': '<(CXX)',
1608           }],
1609           # All Chrome builds have breakpad symbols, but only process the
1610           # symbols from official builds.
1611           ['(branding=="Chrome" and buildtype=="Official")', {
1612             'linux_dump_symbols%': 1,
1613
1614             # Omit unwind support in official release builds to save space. We
1615             # can use breakpad for these builds.
1616             'release_unwind_tables%': 0,
1617
1618             'conditions': [
1619               # For official builds, use a 64-bit linker to avoid running out
1620               # of address space. The buildbots should have a 64-bit kernel
1621               # and a 64-bit libc installed.
1622               ['host_arch=="ia32" and target_arch=="ia32"', {
1623                 'linux_use_bundled_gold%': '1',
1624                 'binutils_dir%': 'third_party/binutils/Linux_x64/Release/bin',
1625               }],
1626             ],
1627           }],
1628         ],
1629       }],  # os_posix==1 and OS!="mac" and OS!="ios"
1630       ['OS=="ios"', {
1631         'disable_nacl%': 1,
1632         'enable_background%': 0,
1633         'icu_use_data_file_flag%': 1,
1634         'enable_web_speech%': 0,
1635         'use_system_libxml%': 1,
1636         'use_system_sqlite%': 1,
1637         'locales==': [
1638           'ar', 'ca', 'cs', 'da', 'de', 'el', 'en-GB', 'en-US', 'es', 'es-MX',
1639           'fi', 'fr', 'he', 'hi', 'hr', 'hu', 'id', 'it', 'ja', 'ko', 'ms',
1640           'nb', 'nl', 'pl', 'pt', 'pt-PT', 'ro', 'ru', 'sk', 'sv', 'th', 'tr',
1641           'uk', 'vi', 'zh-CN', 'zh-TW',
1642         ],
1643
1644         # iOS SDK and deployment target support.  The |ios_sdk| value is left
1645         # blank so that when it is set in the project files it will be the
1646         # "current" iOS SDK.  Forcing a specific SDK even if it is "current"
1647         # causes Xcode to spit out a warning for every single project file for
1648         # not using the "current" SDK.
1649         'ios_sdk%': '',
1650         'ios_sdk_path%': '',
1651         'ios_deployment_target%': '7.0',
1652
1653         'conditions': [
1654           # ios_product_name is set to the name of the .app bundle as it should
1655           # appear on disk.
1656           ['branding=="Chrome"', {
1657             'ios_product_name%': 'Chrome',
1658           }, { # else: branding!="Chrome"
1659             'ios_product_name%': 'Chromium',
1660           }],
1661           ['branding=="Chrome" and buildtype=="Official"', {
1662             'ios_breakpad%': 1,
1663           }, { # else: branding!="Chrome" or buildtype!="Official"
1664             'ios_breakpad%': 0,
1665           }],
1666         ],
1667       }],  # OS=="ios"
1668       ['OS=="android"', {
1669         # Location of Android NDK.
1670         'variables': {
1671           'variables': {
1672             # Unfortunately we have to use absolute paths to the SDK/NDK because
1673             # they're passed to ant which uses a different relative path from
1674             # gyp.
1675             'android_ndk_root%': '<!(cd <(DEPTH) && pwd -P)/third_party/android_tools/ndk/',
1676             'android_sdk_root%': '<!(cd <(DEPTH) && pwd -P)/third_party/android_tools/sdk/',
1677             'android_host_arch%': '<!(uname -m)',
1678             # Android API-level of the SDK used for compilation.
1679             'android_sdk_version%': '21',
1680             'android_sdk_build_tools_version%': '21.0.1',
1681             'host_os%': "<!(uname -s | sed -e 's/Linux/linux/;s/Darwin/mac/')",
1682           },
1683           # Copy conditionally-set variables out one scope.
1684           'android_ndk_root%': '<(android_ndk_root)',
1685           'android_sdk_root%': '<(android_sdk_root)',
1686           'android_sdk_version%': '<(android_sdk_version)',
1687           'android_stlport_root': '<(android_ndk_root)/sources/cxx-stl/stlport',
1688           'host_os%': '<(host_os)',
1689
1690           'android_sdk%': '<(android_sdk_root)/platforms/android-<(android_sdk_version)',
1691           # Android SDK build tools (e.g. dx, aapt, aidl)
1692           'android_sdk_tools%': '<(android_sdk_root)/build-tools/<(android_sdk_build_tools_version)',
1693
1694           # Android API level 14 is ICS (Android 4.0) which is the minimum
1695           # platform requirement for Chrome on Android, we use it for native
1696           # code compilation.
1697           'conditions': [
1698             ['target_arch == "ia32"', {
1699               'android_app_abi%': 'x86',
1700               'android_gdbserver%': '<(android_ndk_root)/prebuilt/android-x86/gdbserver/gdbserver',
1701               'android_ndk_sysroot%': '<(android_ndk_root)/platforms/android-14/arch-x86',
1702               'android_ndk_lib_dir%': 'usr/lib',
1703               'android_toolchain%': '<(android_ndk_root)/toolchains/x86-4.9/prebuilt/<(host_os)-<(android_host_arch)/bin',
1704             }],
1705             ['target_arch == "x64"', {
1706               'android_app_abi%': 'x86_64',
1707               'android_gdbserver%': '<(android_ndk_root)/prebuilt/android-x86_64/gdbserver/gdbserver',
1708               'android_ndk_sysroot%': '<(android_ndk_root)/platforms/android-21/arch-x86_64',
1709               'android_ndk_lib_dir%': 'usr/lib64',
1710               'android_toolchain%': '<(android_ndk_root)/toolchains/x86_64-4.9/prebuilt/<(host_os)-<(android_host_arch)/bin',
1711             }],
1712             ['target_arch=="arm"', {
1713               'conditions': [
1714                 ['arm_version<7', {
1715                   'android_app_abi%': 'armeabi',
1716                 }, {
1717                   'android_app_abi%': 'armeabi-v7a',
1718                 }],
1719               ],
1720               'android_gdbserver%': '<(android_ndk_root)/prebuilt/android-arm/gdbserver/gdbserver',
1721               'android_ndk_sysroot%': '<(android_ndk_root)/platforms/android-14/arch-arm',
1722               'android_ndk_lib_dir%': 'usr/lib',
1723               'android_toolchain%': '<(android_ndk_root)/toolchains/arm-linux-androideabi-4.9/prebuilt/<(host_os)-<(android_host_arch)/bin',
1724             }],
1725             ['target_arch == "arm64"', {
1726               'android_app_abi%': 'arm64-v8a',
1727               'android_gdbserver%': '<(android_ndk_root)/prebuilt/android-arm64/gdbserver/gdbserver',
1728               'android_ndk_sysroot%': '<(android_ndk_root)/platforms/android-21/arch-arm64',
1729               'android_ndk_lib_dir%': 'usr/lib',
1730               'android_toolchain%': '<(android_ndk_root)/toolchains/aarch64-linux-android-4.9/prebuilt/<(host_os)-<(android_host_arch)/bin',
1731             }],
1732             ['target_arch == "mipsel"', {
1733               'android_app_abi%': 'mips',
1734               'android_gdbserver%': '<(android_ndk_root)/prebuilt/android-mips/gdbserver/gdbserver',
1735               'android_ndk_sysroot%': '<(android_ndk_root)/platforms/android-14/arch-mips',
1736               'android_ndk_lib_dir%': 'usr/lib',
1737               'android_toolchain%': '<(android_ndk_root)/toolchains/mipsel-linux-android-4.9/prebuilt/<(host_os)-<(android_host_arch)/bin',
1738             }],
1739             ['target_arch == "mips64el"', {
1740               'android_app_abi%': 'mips64',
1741               'android_gdbserver%': '<(android_ndk_root)/prebuilt/android-mips64/gdbserver/gdbserver',
1742               'android_ndk_sysroot%': '<(android_ndk_root)/platforms/android-21/arch-mips64',
1743               'android_ndk_lib_dir%': 'usr/lib64',
1744               'android_toolchain%': '<(android_ndk_root)/toolchains/mips64el-linux-android-4.9/prebuilt/<(host_os)-<(android_host_arch)/bin',
1745               'gcc_version%': 49,
1746             }],
1747           ],
1748         },
1749         # Copy conditionally-set variables out one scope.
1750         'android_app_abi%': '<(android_app_abi)',
1751         'android_gdbserver%': '<(android_gdbserver)',
1752         'android_ndk_root%': '<(android_ndk_root)',
1753         'android_ndk_sysroot%': '<(android_ndk_sysroot)',
1754         'android_sdk_root%': '<(android_sdk_root)',
1755         'android_sdk_version%': '<(android_sdk_version)',
1756         'android_toolchain%': '<(android_toolchain)',
1757
1758         'android_ndk_include': '<(android_ndk_sysroot)/usr/include',
1759         'android_ndk_lib': '<(android_ndk_sysroot)/<(android_ndk_lib_dir)',
1760         'android_sdk_tools%': '<(android_sdk_tools)',
1761         'android_sdk%': '<(android_sdk)',
1762         'android_sdk_jar%': '<(android_sdk)/android.jar',
1763
1764         'android_stlport_root': '<(android_stlport_root)',
1765         'android_stlport_include': '<(android_stlport_root)/stlport',
1766         'android_stlport_libs_dir': '<(android_stlport_root)/libs/<(android_app_abi)',
1767         'host_os%': '<(host_os)',
1768
1769         # Location of the "objcopy" binary, used by both gyp and scripts.
1770         'android_objcopy%' : '<!(/bin/echo -n <(android_toolchain)/*-objcopy)',
1771
1772         # Location of the "strip" binary, used by both gyp and scripts.
1773         'android_strip%' : '<!(/bin/echo -n <(android_toolchain)/*-strip)',
1774
1775         # Location of the "readelf" binary.
1776         'android_readelf%' : '<!(/bin/echo -n <(android_toolchain)/*-readelf)',
1777
1778         # Determines whether we should optimize JNI generation at the cost of
1779         # breaking assumptions in the build system that when inputs have changed
1780         # the outputs should always change as well.  This is meant purely for
1781         # developer builds, to avoid spurious re-linking of native files.
1782         'optimize_jni_generation%': '<(optimize_jni_generation)',
1783
1784         # Always uses openssl.
1785         'use_openssl%': 1,
1786         'use_openssl_certs%': 1,
1787
1788         'proprietary_codecs%': '<(proprietary_codecs)',
1789         'safe_browsing%': 1,
1790         'enable_web_speech%': 0,
1791         'java_bridge%': 1,
1792         'build_ffmpegsumo%': 0,
1793         'use_allocator%': 'none',
1794
1795         # Disable Native Client.
1796         'disable_nacl%': 1,
1797
1798         # Android does not support background apps.
1799         'enable_background%': 0,
1800
1801         # Sessions are store separately in the Java side.
1802         'enable_session_service%': 0,
1803
1804         'p2p_apis%' : 0,
1805
1806         'gtest_target_type%': 'shared_library',
1807
1808         # Uses system APIs for decoding audio and video.
1809         'use_libffmpeg%': '0',
1810
1811         # TODO(torne): Remove this unsupported option once all the places that
1812         # test it have been updated.
1813         'use_system_stlport%': 0,
1814
1815         # Copy it out one scope.
1816         'android_webview_build%': '<(android_webview_build)',
1817
1818         # Default android linker script for shared library exports.
1819         'android_linker_script%': '<(SHARED_INTERMEDIATE_DIR)/android_exports.lst',
1820       }],  # OS=="android"
1821       ['embedded==1', {
1822         'use_system_fontconfig%': 0,
1823       }, {
1824         'use_system_fontconfig%': 1,
1825       }],
1826       ['chromecast==1', {
1827         'enable_mpeg2ts_stream_parser%': 1,
1828         'ffmpeg_branding%': 'Chrome',
1829         'ozone_platform_ozonex%': 1,
1830         'use_playready%': 0,
1831         'conditions': [
1832           ['target_arch=="arm"', {
1833             'arm_arch%': '',
1834             'arm_tune%': 'cortex-a9',
1835             'arm_thumb%': 1,
1836             'video_hole%': 1,
1837           }],
1838         ],
1839       }],
1840       ['android_webview_build==1', {
1841         # When building the WebView in the Android tree, jarjar will remap all
1842         # the class names, so the JNI generator needs to know this.
1843         'jni_generator_jarjar_file': '../android_webview/build/jarjar-rules.txt',
1844       }],
1845       ['OS=="linux" and target_arch!="mipsel"', {
1846         # TODO(thakis): This is here to measure perf for a while.
1847         'clang%': 1,
1848       }],  # OS=="mac"
1849       ['OS=="mac"', {
1850         'conditions': [
1851           # All Chrome builds have breakpad symbols, but only process the
1852           # symbols from official builds.
1853           ['(branding=="Chrome" and buildtype=="Official")', {
1854             'mac_strip_release%': 1,
1855           }],
1856         ],
1857       }],  # OS=="mac"
1858       ['OS=="mac" or OS=="ios"', {
1859         'clang%': 1,
1860
1861         'variables': {
1862           # Mac OS X SDK and deployment target support.  The SDK identifies
1863           # the version of the system headers that will be used, and
1864           # corresponds to the MAC_OS_X_VERSION_MAX_ALLOWED compile-time
1865           # macro.  "Maximum allowed" refers to the operating system version
1866           # whose APIs are available in the headers.  The deployment target
1867           # identifies the minimum system version that the built products are
1868           # expected to function on.  It corresponds to the
1869           # MAC_OS_X_VERSION_MIN_REQUIRED compile-time macro.  To ensure these
1870           # macros are available, #include <AvailabilityMacros.h>.  Additional
1871           # documentation on these macros is available at
1872           # http://developer.apple.com/mac/library/technotes/tn2002/tn2064.html#SECTION3
1873           # Chrome normally builds with the Mac OS X 10.6 SDK and sets the
1874           # deployment target to 10.6.  Other projects, such as O3D, may
1875           # override these defaults.
1876
1877           # Normally, mac_sdk_min is used to find an SDK that Xcode knows
1878           # about that is at least the specified version. In official builds,
1879           # the SDK must match mac_sdk_min exactly. If the SDK is installed
1880           # someplace that Xcode doesn't know about, set mac_sdk_path to the
1881           # path to the SDK; when set to a non-empty string, SDK detection
1882           # based on mac_sdk_min will be bypassed entirely.
1883           'conditions': [
1884             ['OS=="ios"', {
1885               'mac_sdk_min%': '10.8',
1886             }, {  # else OS!="ios"
1887               'mac_sdk_min%': '10.6',
1888             }],
1889           ],
1890           'mac_sdk_path%': '',
1891
1892           'mac_deployment_target%': '10.6',
1893         },
1894
1895         'mac_sdk_min': '<(mac_sdk_min)',
1896         'mac_sdk_path': '<(mac_sdk_path)',
1897         'mac_deployment_target': '<(mac_deployment_target)',
1898
1899         # Compile in Breakpad support by default so that it can be
1900         # tested, even if it is not enabled by default at runtime.
1901         'mac_breakpad_compiled_in%': 1,
1902         'conditions': [
1903           # mac_product_name is set to the name of the .app bundle as it should
1904           # appear on disk.  This duplicates data from
1905           # chrome/app/theme/chromium/BRANDING and
1906           # chrome/app/theme/google_chrome/BRANDING, but is necessary to get
1907           # these names into the build system.
1908           ['branding=="Chrome"', {
1909             'mac_product_name%': 'Google Chrome',
1910           }, { # else: branding!="Chrome"
1911             'mac_product_name%': 'Chromium',
1912           }],
1913           # Official mac builds require a specific OS X SDK, but iOS and
1914           # non-official mac builds do not.
1915           ['branding=="Chrome" and buildtype=="Official" and OS=="mac"', {
1916             'mac_sdk%': '<!(python <(DEPTH)/build/mac/find_sdk.py --verify <(mac_sdk_min) --sdk_path=<(mac_sdk_path))',
1917           }, {
1918             'mac_sdk%': '<!(python <(DEPTH)/build/mac/find_sdk.py <(mac_sdk_min))',
1919           }],
1920           ['branding=="Chrome" and buildtype=="Official"', {
1921             # Enable uploading crash dumps.
1922             'mac_breakpad_uploads%': 1,
1923             # Enable dumping symbols at build time for use by Mac Breakpad.
1924             'mac_breakpad%': 1,
1925             # Enable Keystone auto-update support.
1926             'mac_keystone%': 1,
1927           }, { # else: branding!="Chrome" or buildtype!="Official"
1928             'mac_breakpad_uploads%': 0,
1929             'mac_breakpad%': 0,
1930             'mac_keystone%': 0,
1931           }],
1932         ],
1933       }],  # OS=="mac" or OS=="ios"
1934       ['OS=="win"', {
1935         'conditions': [
1936           # This is the architecture convention used in WinSDK paths.
1937           ['target_arch=="ia32"', {
1938             'winsdk_arch%': 'x86',
1939           },{
1940             'winsdk_arch%': '<(target_arch)',
1941           }],
1942           ['component=="shared_library"', {
1943             'win_use_allocator_shim%': 0,
1944           },{
1945             # Turn on multiple dll by default on Windows when in static_library.
1946             'chrome_multiple_dll%': 1,
1947           }],
1948           ['asan==1', {
1949             'win_use_allocator_shim%': 0,
1950           }],
1951           ['component=="shared_library" and "<(GENERATOR)"=="ninja"', {
1952             # Only enabled by default for ninja because it's buggy in VS.
1953             # Not enabled for component=static_library because some targets
1954             # are too large and the toolchain fails due to the size of the
1955             # .obj files.
1956             'incremental_chrome_dll%': 1,
1957           }],
1958           # Don't do incremental linking for large modules on 32-bit or when
1959           # component=static_library as the toolchain fails due to the size of
1960           # the .ilk files.
1961           ['MSVS_OS_BITS==32 or component=="static_library"', {
1962             'msvs_large_module_debug_link_mode%': '1',  # No
1963           },{
1964             'msvs_large_module_debug_link_mode%': '2',  # Yes
1965           }],
1966           ['MSVS_VERSION=="2013e"', {
1967             'msvs_express%': 1,
1968             'secure_atl%': 0,
1969           },{
1970             'msvs_express%': 0,
1971             'secure_atl%': 1,
1972           }],
1973         ],
1974         'nacl_win64_defines': [
1975           # This flag is used to minimize dependencies when building
1976           # Native Client loader for 64-bit Windows.
1977           'NACL_WIN64',
1978         ],
1979       }],
1980
1981       ['os_posix==1 and chromeos==0 and OS!="android" and OS!="ios" and embedded==0', {
1982         'use_cups%': 1,
1983       }, {
1984         'use_cups%': 0,
1985       }],
1986
1987       ['enable_plugins==1 and (OS=="linux" or OS=="mac" or OS=="win")', {
1988         'enable_pepper_cdms%': 1,
1989       }, {
1990         'enable_pepper_cdms%': 0,
1991       }],
1992
1993       ['OS=="android"', {
1994         'enable_browser_cdms%': 1,
1995       }, {
1996         'enable_browser_cdms%': 0,
1997       }],
1998
1999       # Native Client glibc toolchain is enabled
2000       # by default except on arm, mips and mips64.
2001       ['target_arch=="arm" or target_arch=="mipsel" or target_arch=="mips64el"', {
2002         'disable_glibc%': 1,
2003       }, {
2004         'disable_glibc%': 0,
2005       }],
2006
2007       # Set the relative path from this file to the GYP file of the JPEG
2008       # library used by Chromium.
2009       ['use_system_libjpeg==1 or use_libjpeg_turbo==0', {
2010         # Configuration for using the system libjeg is here.
2011         'libjpeg_gyp_path': '../third_party/libjpeg/libjpeg.gyp',
2012       }, {
2013         'libjpeg_gyp_path': '../third_party/libjpeg_turbo/libjpeg.gyp',
2014       }],
2015
2016       # Options controlling the use of GConf (the classic GNOME configuration
2017       # system) and GIO, which contains GSettings (the new GNOME config system).
2018       ['chromeos==1 or embedded==1', {
2019         'use_gconf%': 0,
2020         'use_gio%': 0,
2021       }, {
2022         'use_gconf%': 1,
2023         'use_gio%': 1,
2024       }],
2025
2026       # Set up -D and -E flags passed into grit.
2027       ['branding=="Chrome"', {
2028         # TODO(mmoss) The .grd files look for _google_chrome, but for
2029         # consistency they should look for google_chrome_build like C++.
2030         'grit_defines': ['-D', '_google_chrome',
2031                          '-E', 'CHROMIUM_BUILD=google_chrome'],
2032       }, {
2033         'grit_defines': ['-D', '_chromium',
2034                          '-E', 'CHROMIUM_BUILD=chromium'],
2035       }],
2036       ['chromeos==1', {
2037         'grit_defines': ['-D', 'chromeos', '-D', 'scale_factors=2x'],
2038       }],
2039       ['desktop_linux==1', {
2040         'grit_defines': ['-D', 'desktop_linux'],
2041       }],
2042       ['toolkit_views==1', {
2043         'grit_defines': ['-D', 'toolkit_views'],
2044       }],
2045       ['use_aura==1', {
2046         'grit_defines': ['-D', 'use_aura'],
2047       }],
2048       ['use_ash==1', {
2049         'grit_defines': ['-D', 'use_ash'],
2050       }],
2051       ['use_nss==1', {
2052         'grit_defines': ['-D', 'use_nss'],
2053       }],
2054       ['use_ozone==1', {
2055         'grit_defines': ['-D', 'use_ozone'],
2056       }],
2057       ['image_loader_extension==1', {
2058         'grit_defines': ['-D', 'image_loader_extension'],
2059       }],
2060       ['remoting==1', {
2061         'grit_defines': ['-D', 'remoting'],
2062       }],
2063       ['use_titlecase_in_grd==1', {
2064         'grit_defines': ['-D', 'use_titlecase'],
2065       }],
2066       ['use_third_party_translations==1', {
2067         'grit_defines': ['-D', 'use_third_party_translations'],
2068         'locales': [
2069           'ast', 'bs', 'ca@valencia', 'en-AU', 'eo', 'eu', 'gl', 'hy', 'ia',
2070           'ka', 'ku', 'kw', 'ms', 'ug'
2071         ],
2072       }],
2073       ['OS=="android"', {
2074         'grit_defines': [
2075           '-t', 'android',
2076           '-E', 'ANDROID_JAVA_TAGGED_ONLY=true',
2077           '--no-output-all-resource-defines',
2078         ],
2079       }],
2080       ['OS=="mac" or OS=="ios"', {
2081         'grit_defines': ['-D', 'scale_factors=2x'],
2082       }],
2083       ['OS == "ios"', {
2084         'grit_defines': [
2085           '-t', 'ios',
2086           # iOS uses a whitelist to filter resources.
2087           '-w', '<(DEPTH)/build/ios/grit_whitelist.txt',
2088           '--no-output-all-resource-defines',
2089         ],
2090
2091         # Enable host builds when generating with ninja-ios.
2092         'conditions': [
2093           ['"<(GENERATOR)"=="ninja"', {
2094             'host_os%': "mac",
2095           }],
2096
2097           # TODO(sdefresne): Remove the target_subarch check once Apple has
2098           # upstreamed the support for "arm64". http://crbug.com/341453
2099           ['target_subarch!="arm32" or "<(GENERATOR)"=="xcode"', {
2100             'clang_xcode%': 1,
2101           }],
2102         ],
2103       }],
2104       ['enable_extensions==1', {
2105         'grit_defines': ['-D', 'enable_extensions'],
2106       }],
2107       ['enable_plugins!=0', {
2108         'grit_defines': ['-D', 'enable_plugins'],
2109       }],
2110       ['enable_basic_printing==1 or enable_print_preview==1', {
2111         'grit_defines': ['-D', 'enable_printing'],
2112       }],
2113       ['enable_print_preview==1', {
2114         'grit_defines': ['-D', 'enable_print_preview'],
2115       }],
2116       ['enable_themes==1', {
2117         'grit_defines': ['-D', 'enable_themes'],
2118       }],
2119       ['enable_app_list==1', {
2120         'grit_defines': ['-D', 'enable_app_list'],
2121       }],
2122       ['enable_settings_app==1', {
2123         'grit_defines': ['-D', 'enable_settings_app'],
2124       }],
2125       ['enable_google_now==1', {
2126         'grit_defines': ['-D', 'enable_google_now'],
2127       }],
2128       ['use_concatenated_impulse_responses==1', {
2129         'grit_defines': ['-D', 'use_concatenated_impulse_responses'],
2130       }],
2131       ['enable_webrtc==1', {
2132         'grit_defines': ['-D', 'enable_webrtc'],
2133       }],
2134       ['enable_hangout_services_extension==1', {
2135         'grit_defines': ['-D', 'enable_hangout_services_extension'],
2136       }],
2137       ['enable_task_manager==1', {
2138         'grit_defines': ['-D', 'enable_task_manager'],
2139       }],
2140       ['notifications==1', {
2141         'grit_defines': ['-D', 'enable_notifications'],
2142       }],
2143       ['enable_wifi_bootstrapping==1', {
2144         'grit_defines': ['-D', 'enable_wifi_bootstrapping'],
2145       }],
2146       ['enable_resource_whitelist_generation==1 and OS!="win"', {
2147         'grit_rc_header_format': ['-h', '#define {textual_id} _Pragma("whitelisted_resource_{numeric_id}") {numeric_id}'],
2148       }],
2149       ['enable_resource_whitelist_generation==1 and OS=="win"', {
2150         'grit_rc_header_format': ['-h', '#define {textual_id} __pragma(message("whitelisted_resource_{numeric_id}")) {numeric_id}'],
2151       }],
2152       ['enable_mdns==1 or OS=="mac"', {
2153         'grit_defines': ['-D', 'enable_service_discovery'],
2154         'enable_service_discovery%': 1
2155       }],
2156       ['clang_use_chrome_plugins==1 and OS!="win"', {
2157         'clang_chrome_plugins_flags': [
2158           '<!@(<(DEPTH)/tools/clang/scripts/plugin_flags.sh)'
2159         ],
2160       }],
2161       ['asan==1 or msan==1 or lsan==1 or tsan==1', {
2162         'clang%': 1,
2163         'use_allocator%': 'none',
2164         'use_sanitizer_options%': 1,
2165       }],
2166       ['asan==1 and OS=="linux" and chromeos==0', {
2167         'use_custom_libcxx%': 1,
2168       }],
2169       ['ubsan==1', {
2170         'clang%': 1,
2171       }],
2172       ['ubsan_vptr==1', {
2173         'clang%': 1,
2174       }],
2175       ['asan==1 and OS=="mac"', {
2176         # TODO(glider): we do not strip ASan binaries until the dynamic ASan
2177         # runtime is fully adopted. See http://crbug.com/242503.
2178         'mac_strip_release': 0,
2179       }],
2180       ['tsan==1', {
2181         'use_custom_libcxx%': 1,
2182       }],
2183       ['msan==1', {
2184         # Use a just-built, MSan-instrumented libc++ instead of the system-wide
2185         # libstdc++. This is required to avoid false positive reports whenever
2186         # the C++ standard library is used.
2187         'use_custom_libcxx%': 1,
2188         # Running the V8-generated code on an ARM simulator is a powerful hack
2189         # that allows the tool to see the memory accesses from JITted code.
2190         # Without this flag, JS code causes false positive reports from MSan.
2191         'v8_target_arch': 'arm64',
2192       }],
2193
2194       ['OS=="linux" and clang_type_profiler==1', {
2195         'clang%': 1,
2196         'clang_use_chrome_plugins%': 0,
2197         'conditions': [
2198           ['host_arch=="x64"', {
2199             'make_clang_dir%': 'third_party/llvm-allocated-type/Linux_x64',
2200           }],
2201           ['host_arch=="ia32"', {
2202             # 32-bit Clang is unsupported.  It may not build.  Put your 32-bit
2203             # Clang in this directory at your own risk if needed for some
2204             # purpose (e.g. to compare 32-bit and 64-bit behavior like memory
2205             # usage).  Any failure by this compiler should not close the tree.
2206             'make_clang_dir%': 'third_party/llvm-allocated-type/Linux_ia32',
2207           }],
2208         ],
2209       }],
2210
2211       ['OS=="win"', {
2212         # The Clang plugins don't currently work on Windows.
2213         # TODO(hans): One day, this will work. (crbug.com/82385)
2214         'clang_use_chrome_plugins%': 0,
2215       }],
2216
2217       # On valgrind bots, override the optimizer settings so we don't inline too
2218       # much and make the stacks harder to figure out.
2219       #
2220       # TODO(rnk): Kill off variables that no one else uses and just implement
2221       # them under a build_for_tool== condition.
2222       ['build_for_tool=="memcheck" or build_for_tool=="tsan"', {
2223         # gcc flags
2224         'mac_debug_optimization': '1',
2225         'mac_release_optimization': '1',
2226         'release_optimize': '1',
2227         'no_gc_sections': 1,
2228         'debug_extra_cflags': '-g -fno-inline -fno-omit-frame-pointer '
2229                               '-fno-builtin -fno-optimize-sibling-calls',
2230         'release_extra_cflags': '-g -fno-inline -fno-omit-frame-pointer '
2231                                 '-fno-builtin -fno-optimize-sibling-calls',
2232
2233         # MSVS flags for TSan on Pin and Windows.
2234         'win_debug_RuntimeChecks': '0',
2235         'win_debug_disable_iterator_debugging': '1',
2236         'win_debug_Optimization': '1',
2237         'win_debug_InlineFunctionExpansion': '0',
2238         'win_release_InlineFunctionExpansion': '0',
2239         'win_release_OmitFramePointers': '0',
2240
2241         'use_allocator': 'tcmalloc',
2242         'release_valgrind_build': 1,
2243         'werror': '',
2244         'component': 'static_library',
2245         'use_system_zlib': 0,
2246       }],
2247
2248       # Build tweaks for DrMemory.
2249       # TODO(rnk): Combine with tsan config to share the builder.
2250       # http://crbug.com/108155
2251       ['build_for_tool=="drmemory"', {
2252         # These runtime checks force initialization of stack vars which blocks
2253         # DrMemory's uninit detection.
2254         'win_debug_RuntimeChecks': '0',
2255         # Iterator debugging is slow.
2256         'win_debug_disable_iterator_debugging': '1',
2257         # Try to disable optimizations that mess up stacks in a release build.
2258         # DrM-i#1054 (http://code.google.com/p/drmemory/issues/detail?id=1054)
2259         # /O2 and /Ob0 (disable inline) cannot be used together because of a
2260         # compiler bug, so we use /Ob1 instead.
2261         'win_release_InlineFunctionExpansion': '1',
2262         'win_release_OmitFramePointers': '0',
2263         # Ditto for debug, to support bumping win_debug_Optimization.
2264         'win_debug_InlineFunctionExpansion': 0,
2265         'win_debug_OmitFramePointers': 0,
2266         # Keep the code under #ifndef NVALGRIND.
2267         'release_valgrind_build': 1,
2268       }],
2269
2270       # Enable RLZ on Win, Mac, iOS and ChromeOS.
2271       ['branding=="Chrome" and (OS=="win" or OS=="mac" or OS=="ios" or chromeos==1)', {
2272         'enable_rlz%': 1,
2273       }],
2274
2275       # Set default compiler flags depending on ARM version.
2276       ['arm_version==6 and android_webview_build==0', {
2277         'arm_arch%': 'armv6',
2278         'arm_tune%': '',
2279         'arm_fpu%': 'vfp',
2280         'arm_float_abi%': 'softfp',
2281         'arm_thumb%': 0,
2282       }],
2283       ['arm_version==7 and android_webview_build==0', {
2284         'arm_arch%': 'armv7-a',
2285         'arm_tune%': 'generic-armv7-a',
2286         'conditions': [
2287           ['arm_neon==1', {
2288             'arm_fpu%': 'neon',
2289           }, {
2290             'arm_fpu%': 'vfpv3-d16',
2291           }],
2292         ],
2293         # Change the default to hard once the armhf transition is complete.
2294         'arm_float_abi%': 'softfp',
2295         'arm_thumb%': 1,
2296       }],
2297
2298       ['android_webview_build==1', {
2299         # The WebView build gets its cpu-specific flags from the Android build system.
2300         'arm_arch%': '',
2301         'arm_tune%': '',
2302         'arm_fpu%': '',
2303         'arm_float_abi%': '',
2304         'arm_thumb%': 0,
2305       }],
2306
2307       # Enable brlapi by default for chromeos.
2308       [ 'chromeos==1', {
2309         'use_brlapi%': 1,
2310       }],
2311
2312       ['use_ozone==1 and ozone_auto_platforms==1', {
2313         # Use test as the default platform.
2314         'ozone_platform%': 'test',
2315
2316         # Build all platforms whose deps are in install-build-deps.sh.
2317         # Only these platforms will be compile tested by buildbots.
2318         'ozone_platform_dri%': 1,
2319         'ozone_platform_test%': 1,
2320         'ozone_platform_egltest%': 1,
2321       }],
2322
2323       ['desktop_linux==1 and use_aura==1 and use_x11==1', {
2324         'use_clipboard_aurax11%': 1,
2325       }],
2326
2327       ['OS=="win" and use_goma==1', {
2328         # goma doesn't support pch yet.
2329         'chromium_win_pch': 0,
2330         # goma doesn't support PDB yet, so win_z7=1 or fastbuild=1.
2331         'conditions': [
2332           ['win_z7==0 and fastbuild==0', {
2333             'fastbuild': 1,
2334           }],
2335         ],
2336       }],
2337
2338       ['OS=="win" and (clang==1 or asan==1)', {
2339         'chromium_win_pch': 0,
2340       }],
2341
2342       ['host_clang==1', {
2343         'host_cc': '<(make_clang_dir)/bin/clang',
2344         'host_cxx': '<(make_clang_dir)/bin/clang++',
2345       }, {
2346         'host_cc': '<!(which gcc)',
2347         'host_cxx': '<!(which g++)',
2348       }],
2349
2350       # The seccomp-bpf sandbox is only supported on five architectures
2351       # currently.
2352       # Do not disable seccomp_bpf anywhere without talking to
2353       # security@chromium.org!
2354       ['((OS=="linux" or OS=="android") and '
2355            '(target_arch=="ia32" or target_arch=="x64" or '
2356              'target_arch=="arm" or target_arch=="mipsel" or '
2357              'target_arch=="arm64"))', {
2358          'use_seccomp_bpf%': 1,
2359       }, {
2360          'use_seccomp_bpf%': 0,
2361       }],
2362
2363       # Set component build with LTO until all tests pass.
2364       # This also reduces link time.
2365       ['use_lto==1', {
2366         'component%': "shared_library",
2367       }],
2368     ],
2369
2370     # older history files use fts2 instead of fts3
2371     'sqlite_enable_fts2%': '<(support_pre_M6_history_database)',
2372
2373     # The path to the ANGLE library.
2374     'angle_path': '<(DEPTH)/third_party/angle',
2375
2376     # List of default apps to install in new profiles.  The first list contains
2377     # the source files as found in svn.  The second list, used only for linux,
2378     # contains the destination location for each of the files.  When a crx
2379     # is added or removed from the list, the chrome/browser/resources/
2380     # default_apps/external_extensions.json file must also be updated.
2381     'default_apps_list': [
2382       'browser/resources/default_apps/external_extensions.json',
2383       'browser/resources/default_apps/gmail.crx',
2384       'browser/resources/default_apps/search.crx',
2385       'browser/resources/default_apps/youtube.crx',
2386       'browser/resources/default_apps/drive.crx',
2387       'browser/resources/default_apps/docs.crx',
2388     ],
2389     'default_apps_list_linux_dest': [
2390       '<(PRODUCT_DIR)/default_apps/external_extensions.json',
2391       '<(PRODUCT_DIR)/default_apps/gmail.crx',
2392       '<(PRODUCT_DIR)/default_apps/search.crx',
2393       '<(PRODUCT_DIR)/default_apps/youtube.crx',
2394       '<(PRODUCT_DIR)/default_apps/drive.crx',
2395       '<(PRODUCT_DIR)/default_apps/docs.crx',
2396     ],
2397
2398     # Whether to allow building of the GPU-related isolates.
2399     'archive_gpu_tests%': 0,
2400
2401     # Whether to allow building of chromoting related isolates.
2402     'archive_chromoting_tests%': 0,
2403
2404     # Flags to enable Murphy resource policy daemon integration on Tizen.
2405     'tizen%': 0,
2406     'enable_murphy%': 0,
2407   },
2408   'target_defaults': {
2409     'variables': {
2410       # The condition that operates on chromium_code is in a target_conditions
2411       # section, and will not have access to the default fallback value of
2412       # chromium_code at the top of this file, or to the chromium_code
2413       # variable placed at the root variables scope of .gyp files, because
2414       # those variables are not set at target scope.  As a workaround,
2415       # if chromium_code is not set at target scope, define it in target scope
2416       # to contain whatever value it has during early variable expansion.
2417       # That's enough to make it available during target conditional
2418       # processing.
2419       'chromium_code%': '<(chromium_code)',
2420
2421       'component%': '<(component)',
2422
2423       'chromecast%': '<(chromecast)',
2424
2425       # See http://msdn.microsoft.com/en-us/library/aa652360(VS.71).aspx
2426       'win_release_Optimization%': '2', # 2 = /Os
2427       'win_debug_Optimization%': '0',   # 0 = /Od
2428
2429       # See http://msdn.microsoft.com/en-us/library/2kxx5t2c(v=vs.80).aspx
2430       # Tri-state: blank is default, 1 on, 0 off
2431       'win_release_OmitFramePointers%': '0',
2432       # Tri-state: blank is default, 1 on, 0 off
2433       'win_debug_OmitFramePointers%': '',
2434
2435       # See http://msdn.microsoft.com/en-us/library/8wtf2dfz(VS.71).aspx
2436       'win_debug_RuntimeChecks%': '3',    # 3 = all checks enabled, 0 = off
2437
2438       # See http://msdn.microsoft.com/en-us/library/47238hez(VS.71).aspx
2439       'win_debug_InlineFunctionExpansion%': '',    # empty = default, 0 = off,
2440       'win_release_InlineFunctionExpansion%': '2', # 1 = only __inline, 2 = max
2441
2442       # VS inserts quite a lot of extra checks to algorithms like
2443       # std::partial_sort in Debug build which make them O(N^2)
2444       # instead of O(N*logN). This is particularly slow under memory
2445       # tools like ThreadSanitizer so we want it to be disablable.
2446       # See http://msdn.microsoft.com/en-us/library/aa985982(v=VS.80).aspx
2447       'win_debug_disable_iterator_debugging%': '0',
2448
2449       # An application manifest fragment to declare compatibility settings for
2450       # 'executable' targets. Ignored in other target type.
2451       'win_exe_compatibility_manifest%':
2452           '<(DEPTH)\\build\\win\\compatibility.manifest',
2453
2454       'release_extra_cflags%': '',
2455       'debug_extra_cflags%': '',
2456
2457       'release_valgrind_build%': '<(release_valgrind_build)',
2458
2459       # the non-qualified versions are widely assumed to be *nix-only
2460       'win_release_extra_cflags%': '',
2461       'win_debug_extra_cflags%': '',
2462
2463       # TODO(thakis): Make this a blacklist instead, http://crbug.com/101600
2464       'enable_wexit_time_destructors%': '<(enable_wexit_time_destructors)',
2465
2466       # Only used by Windows build for now.  Can be used to build into a
2467       # differet output directory, e.g., a build_dir_prefix of VS2010_ would
2468       # output files in src/build/VS2010_{Debug,Release}.
2469       'build_dir_prefix%': '',
2470
2471       # Targets are by default not nacl untrusted code.
2472       'nacl_untrusted_build%': 0,
2473
2474       'pnacl_compile_flags': [
2475         # pnacl uses the clang compiler so we need to suppress all the
2476         # same warnings as we do for clang.
2477         # TODO(sbc): Remove these if/when they are removed from the clang
2478         # build.
2479         '-Wno-unused-function',
2480         '-Wno-char-subscripts',
2481         '-Wno-c++11-extensions',
2482         '-Wno-unnamed-type-template-args',
2483       ],
2484
2485       'conditions': [
2486         ['OS=="win" and component=="shared_library"', {
2487           # See http://msdn.microsoft.com/en-us/library/aa652367.aspx
2488           'win_release_RuntimeLibrary%': '2', # 2 = /MD (nondebug DLL)
2489           'win_debug_RuntimeLibrary%': '3',   # 3 = /MDd (debug DLL)
2490         }, {
2491           # See http://msdn.microsoft.com/en-us/library/aa652367.aspx
2492           'win_release_RuntimeLibrary%': '0', # 0 = /MT (nondebug static)
2493           'win_debug_RuntimeLibrary%': '1',   # 1 = /MTd (debug static)
2494         }],
2495         ['OS=="ios"', {
2496           # See http://gcc.gnu.org/onlinedocs/gcc-4.4.2/gcc/Optimize-Options.html
2497           'mac_release_optimization%': 's', # Use -Os unless overridden
2498           'mac_debug_optimization%': '0',   # Use -O0 unless overridden
2499         }, {
2500           # See http://gcc.gnu.org/onlinedocs/gcc-4.4.2/gcc/Optimize-Options.html
2501           'mac_release_optimization%': '3', # Use -O3 unless overridden
2502           'mac_debug_optimization%': '0',   # Use -O0 unless overridden
2503         }],
2504         ['OS=="android"', {
2505           'host_os%': '<(host_os)',  # See comment above chromium_code.
2506         }],
2507       ],
2508       'clang_warning_flags': [
2509         '-Wheader-hygiene',
2510
2511         # Don't die on dtoa code that uses a char as an array index.
2512         # This is required solely for base/third_party/dmg_fp/dtoa.cc.
2513         '-Wno-char-subscripts',
2514
2515         # TODO(thakis): This used to be implied by -Wno-unused-function,
2516         # which we no longer use. Check if it makes sense to remove
2517         # this as well. http://crbug.com/316352
2518         '-Wno-unneeded-internal-declaration',
2519
2520         # Warns on switches on enums that cover all enum values but
2521         # also contain a default: branch. Chrome is full of that.
2522         '-Wno-covered-switch-default',
2523
2524         # Warns when a const char[] is converted to bool.
2525         '-Wstring-conversion',
2526
2527         # C++11-related flags:
2528
2529         # This warns on using ints as initializers for floats in
2530         # initializer lists (e.g. |int a = f(); CGSize s = { a, a };|),
2531         # which happens in several places in chrome code. Not sure if
2532         # this is worth fixing.
2533         '-Wno-c++11-narrowing',
2534
2535         # Clang considers the `register` keyword as deprecated, but e.g.
2536         # code generated by flex (used in angle) contains that keyword.
2537         # http://crbug.com/255186
2538         '-Wno-deprecated-register',
2539
2540         # TODO(hans): Clean this up. Or disable with finer granularity.
2541         '-Wno-unused-local-typedef',
2542       ],
2543     },
2544     'includes': [ 'set_clang_warning_flags.gypi', ],
2545     'defines': [
2546       # Don't use deprecated V8 APIs anywhere.
2547       'V8_DEPRECATION_WARNINGS',
2548     ],
2549     'include_dirs': [
2550       '<(SHARED_INTERMEDIATE_DIR)',
2551     ],
2552     'conditions': [
2553       ['(OS=="mac" or OS=="ios") and asan==1', {
2554         'dependencies': [
2555           '<(DEPTH)/build/mac/asan.gyp:asan_dynamic_runtime',
2556         ],
2557       }],
2558       ['OS=="win" and asan==1 and component=="shared_library"', {
2559         'dependencies': [
2560           '<(DEPTH)/build/win/asan.gyp:asan_dynamic_runtime',
2561         ],
2562       }],
2563       ['OS=="linux" and use_allocator!="none" and clang_type_profiler==1', {
2564         'cflags_cc!': ['-fno-rtti'],
2565         'cflags_cc+': [
2566           '-frtti',
2567           '-gline-tables-only',
2568           '-fintercept-allocation-functions',
2569         ],
2570         'defines': ['TYPE_PROFILING'],
2571         'dependencies': [
2572           '<(DEPTH)/base/allocator/allocator.gyp:type_profiler',
2573         ],
2574       }],
2575       ['branding=="Chrome"', {
2576         'defines': ['GOOGLE_CHROME_BUILD'],
2577       }, {  # else: branding!="Chrome"
2578         'defines': ['CHROMIUM_BUILD'],
2579       }],
2580       ['OS=="mac" and component=="shared_library"', {
2581         'xcode_settings': {
2582           'DYLIB_INSTALL_NAME_BASE': '@rpath',
2583           'LD_RUNPATH_SEARCH_PATHS': [
2584             # For unbundled binaries.
2585             '@loader_path/.',
2586             # For bundled binaries, to get back from Binary.app/Contents/MacOS.
2587             '@loader_path/../../..',
2588           ],
2589         },
2590       }],
2591       ['clang==1 and OS!="win"', {
2592         # This is here so that all files get recompiled after a clang roll and
2593         # when turning clang on or off.
2594         # (defines are passed via the command line, and build systems rebuild
2595         # things when their commandline changes). Nothing should ever read this
2596         # define.
2597         'defines': ['CR_CLANG_REVISION=<!(<(DEPTH)/tools/clang/scripts/update.sh --print-revision)'],
2598       }],
2599       ['enable_rlz==1', {
2600         'defines': ['ENABLE_RLZ'],
2601       }],
2602       ['component=="shared_library"', {
2603         'defines': ['COMPONENT_BUILD'],
2604       }],
2605       ['toolkit_views==1', {
2606         'defines': ['TOOLKIT_VIEWS=1'],
2607       }],
2608       ['ui_compositor_image_transport==1', {
2609         'defines': ['UI_COMPOSITOR_IMAGE_TRANSPORT'],
2610       }],
2611       ['use_aura==1', {
2612         'defines': ['USE_AURA=1'],
2613       }],
2614       ['use_ash==1', {
2615         'defines': ['USE_ASH=1'],
2616       }],
2617       ['use_pango==1', {
2618         'defines': ['USE_PANGO=1'],
2619       }],
2620       ['use_cairo==1', {
2621         'defines': ['USE_CAIRO=1'],
2622       }],
2623       ['use_cras==1', {
2624         'defines': ['USE_CRAS=1'],
2625       }],
2626       ['use_ozone==1', {
2627         'defines': ['USE_OZONE=1'],
2628       }],
2629       ['use_default_render_theme==1', {
2630         'defines': ['USE_DEFAULT_RENDER_THEME=1'],
2631       }],
2632       ['use_libjpeg_turbo==1', {
2633         'defines': ['USE_LIBJPEG_TURBO=1'],
2634       }],
2635       ['use_x11==1', {
2636         'defines': ['USE_X11=1'],
2637       }],
2638       ['use_clipboard_aurax11==1', {
2639         'defines': ['USE_CLIPBOARD_AURAX11=1'],
2640       }],
2641       ['enable_one_click_signin==1', {
2642         'defines': ['ENABLE_ONE_CLICK_SIGNIN'],
2643       }],
2644       ['enable_pre_sync_backup==1', {
2645         'defines': ['ENABLE_PRE_SYNC_BACKUP'],
2646       }],
2647       ['use_xi2_mt!=0 and use_x11==1', {
2648         'defines': ['USE_XI2_MT=<(use_xi2_mt)'],
2649       }],
2650       ['image_loader_extension==1', {
2651         'defines': ['IMAGE_LOADER_EXTENSION=1'],
2652       }],
2653       ['profiling==1', {
2654         'defines': ['ENABLE_PROFILING=1'],
2655       }],
2656       ['remoting==1', {
2657         'defines': ['ENABLE_REMOTING=1'],
2658       }],
2659       ['enable_webrtc==1', {
2660         'defines': ['ENABLE_WEBRTC=1'],
2661       }],
2662       ['proprietary_codecs==1', {
2663         'defines': ['USE_PROPRIETARY_CODECS'],
2664         'conditions': [
2665           ['enable_mpeg2ts_stream_parser==1', {
2666             'defines': ['ENABLE_MPEG2TS_STREAM_PARSER'],
2667           }],
2668         ],
2669       }],
2670       ['enable_viewport==1', {
2671         'defines': ['ENABLE_VIEWPORT'],
2672       }],
2673       ['enable_pepper_cdms==1', {
2674         'defines': ['ENABLE_PEPPER_CDMS'],
2675       }],
2676       ['enable_browser_cdms==1', {
2677         'defines': ['ENABLE_BROWSER_CDMS'],
2678       }],
2679       ['configuration_policy==1', {
2680         'defines': ['ENABLE_CONFIGURATION_POLICY'],
2681       }],
2682       ['notifications==1', {
2683         'defines': ['ENABLE_NOTIFICATIONS'],
2684       }],
2685       ['enable_hidpi==1', {
2686         'defines': ['ENABLE_HIDPI=1'],
2687       }],
2688       ['native_discardable_memory==1', {
2689         'defines': ['DISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY'],
2690       }],
2691       ['native_memory_pressure_signals==1', {
2692         'defines': ['SYSTEM_NATIVELY_SIGNALS_MEMORY_PRESSURE'],
2693       }],
2694       ['use_udev==1', {
2695         'defines': ['USE_UDEV'],
2696       }],
2697       ['fastbuild!=0', {
2698         'xcode_settings': {
2699           'GCC_GENERATE_DEBUGGING_SYMBOLS': 'NO',
2700         },
2701         'conditions': [
2702           ['clang==1 and asan==0 and msan==0 and tsan==0 and ubsan_vptr==0', {
2703             # Clang creates chubby debug information, which makes linking very
2704             # slow. For now, don't create debug information with clang.  See
2705             # http://crbug.com/70000
2706             'conditions': [
2707               ['OS=="linux"', {
2708                 'variables': {
2709                   'debug_extra_cflags': '-g0',
2710                 },
2711               }],
2712               # Android builds symbols on release by default, disable them.
2713               ['OS=="android"', {
2714                 'variables': {
2715                   'debug_extra_cflags': '-g0',
2716                   'release_extra_cflags': '-g0',
2717                 },
2718               }],
2719             ],
2720           }, { # else clang!=1
2721             'conditions': [
2722               ['OS=="win" and fastbuild==2', {
2723                 # Completely disable debug information.
2724                 'msvs_settings': {
2725                   'VCLinkerTool': {
2726                     'GenerateDebugInformation': 'false',
2727                   },
2728                   'VCCLCompilerTool': {
2729                     'DebugInformationFormat': '0',
2730                   },
2731                 },
2732               }],
2733               ['OS=="win" and fastbuild==1', {
2734                 'msvs_settings': {
2735                   'VCLinkerTool': {
2736                     # This tells the linker to generate .pdbs, so that
2737                     # we can get meaningful stack traces.
2738                     'GenerateDebugInformation': 'true',
2739                   },
2740                   'VCCLCompilerTool': {
2741                     # No debug info to be generated by compiler.
2742                     'DebugInformationFormat': '0',
2743                   },
2744                 },
2745               }],
2746               ['OS=="linux" and fastbuild==2', {
2747                 'variables': {
2748                   'debug_extra_cflags': '-g0',
2749                 },
2750               }],
2751               ['OS=="linux" and fastbuild==1', {
2752                 'variables': {
2753                   'debug_extra_cflags': '-g1',
2754                 },
2755               }],
2756               ['OS=="android" and fastbuild==2', {
2757                 'variables': {
2758                   'debug_extra_cflags': '-g0',
2759                   'release_extra_cflags': '-g0',
2760                 },
2761               }],
2762               ['OS=="android" and fastbuild==1', {
2763                 'variables': {
2764                   'debug_extra_cflags': '-g1',
2765                   'release_extra_cflags': '-g1',
2766                 },
2767               }],
2768             ],
2769           }], # clang!=1
2770         ],
2771       }],  # fastbuild!=0
2772       ['dont_embed_build_metadata==1', {
2773         'defines': [
2774           'DONT_EMBED_BUILD_METADATA',
2775         ],
2776       }],  # dont_embed_build_metadata==1
2777       ['dcheck_always_on!=0', {
2778         'defines': ['DCHECK_ALWAYS_ON=1'],
2779       }],  # dcheck_always_on!=0
2780       ['tracing_like_official_build!=0', {
2781         'defines': ['TRACING_IS_OFFICIAL_BUILD=1'],
2782       }],  # tracing_like_official_build!=0
2783       ['win_use_allocator_shim==0', {
2784         'conditions': [
2785           ['OS=="win"', {
2786             'defines': ['NO_TCMALLOC'],
2787           }],
2788         ],
2789       }],
2790       ['asan==1', {
2791         'defines': [
2792           'ADDRESS_SANITIZER',
2793           'MEMORY_TOOL_REPLACES_ALLOCATOR',
2794           'MEMORY_SANITIZER_INITIAL_SIZE',
2795         ],
2796       }],
2797       ['syzyasan==1', {
2798         # SyzyAsan needs /PROFILE turned on to produce appropriate pdbs.
2799         'msvs_settings': {
2800           'VCLinkerTool': {
2801             'Profile': 'true',
2802           },
2803         },
2804         'defines': [
2805             'SYZYASAN',
2806             'MEMORY_TOOL_REPLACES_ALLOCATOR',
2807             'MEMORY_SANITIZER_INITIAL_SIZE',
2808         ],
2809       }],
2810       ['OS=="win"', {
2811         'defines': [
2812           '__STD_C',
2813           '_CRT_SECURE_NO_DEPRECATE',
2814           '_SCL_SECURE_NO_DEPRECATE',
2815           # This define is required to pull in the new Win8 interfaces from
2816           # system headers like ShObjIdl.h.
2817           'NTDDI_VERSION=0x06020000',
2818           # This is required for ATL to use XP-safe versions of its functions.
2819           '_USING_V110_SDK71_',
2820         ],
2821         'include_dirs': [
2822           '<(DEPTH)/third_party/wtl/include',
2823         ],
2824         'conditions': [
2825           ['win_z7!=0', {
2826             'msvs_settings': {
2827               # Generates debug info when win_z7=1
2828               # even if fastbuild=1 (that makes GenerateDebugInformation false).
2829               'VCLinkerTool': {
2830                 'GenerateDebugInformation': 'true',
2831               },
2832               'VCCLCompilerTool': {
2833                 'DebugInformationFormat': '1',
2834               }
2835             }
2836           }],  # win_z7!=0
2837           ['win_analyze', {
2838             'defines!': [
2839               # This is prohibited when running /analyze.
2840               '_USING_V110_SDK71_',
2841             ],
2842             'msvs_settings': {
2843               'VCCLCompilerTool': {
2844                 # Set WarnAsError to false to disable this setting for most
2845                 # projects so that compilation continues.
2846                 'WarnAsError': 'false',
2847                 # When win_analyze is specified add the /analyze switch.
2848                 # Also add /WX- to force-disable WarnAsError for projects that
2849                 # override WarnAsError.
2850                 # Also, disable various noisy warnings that have low value.
2851                 'AdditionalOptions': [
2852                   '/analyze',
2853                   '/WX-',
2854                   '/wd6011',  # Dereferencing NULL pointer
2855                   '/wd6312',  # Possible infinite loop: use of the constant
2856                     # EXCEPTION_CONTINUE_EXECUTION in the exception-filter
2857                   '/wd6326',  # Potential comparison of constant with constant
2858                   '/wd28159', # Consider using 'GetTickCount64'
2859                   '/wd28204', # Inconsistent SAL annotations
2860                   '/wd28251', # Inconsistent SAL annotations
2861                   '/wd28252', # Inconsistent SAL annotations
2862                   '/wd28253', # Inconsistent SAL annotations
2863                   '/wd28196', # The precondition is not satisfied
2864                   '/wd28301', # Inconsistent SAL annotations
2865                   '/wd6340',  # Sign mismatch in function parameter
2866                   '/wd28182', # Dereferencing NULL pointer
2867                 ],
2868               },
2869             },
2870           }],  # win_analyze
2871         ],
2872       }],  # OS==win
2873       ['chromecast==1', {
2874         'defines': [
2875           'LOG_DISABLED=0',
2876         ],
2877         'conditions': [
2878           ['target_arch=="arm"', {
2879             'defines': [
2880               # TODO(lcwu): Work around an error when building Chromium
2881               # with gcc-4.5.3 (e.g. v8/src/platform-linux.cc). Remove
2882               # this define once the toolchain is updated.
2883               # See crbug.com/388933.
2884               '__SOFTFP',
2885             ],
2886           }],
2887           ['use_playready==1', {
2888             'defines': [
2889               'PLAYREADY_CDM_AVAILABLE',
2890             ],
2891           }],
2892         ],
2893       }],
2894       ['enable_task_manager==1', {
2895         'defines': [
2896           'ENABLE_TASK_MANAGER=1',
2897         ],
2898       }],
2899       ['enable_extensions==1', {
2900         'defines': [
2901           'ENABLE_EXTENSIONS=1',
2902         ],
2903       }],
2904       ['OS=="win" and branding=="Chrome"', {
2905         'defines': ['ENABLE_SWIFTSHADER'],
2906       }],
2907       ['enable_dart==1', {
2908         'defines': ['WEBKIT_USING_DART=1'],
2909       }],
2910       ['enable_plugin_installation==1', {
2911         'defines': ['ENABLE_PLUGIN_INSTALLATION=1'],
2912       }],
2913       ['enable_plugins==1', {
2914         'defines': ['ENABLE_PLUGINS=1'],
2915       }],
2916       ['enable_session_service==1', {
2917         'defines': ['ENABLE_SESSION_SERVICE=1'],
2918       }],
2919       ['enable_themes==1', {
2920         'defines': ['ENABLE_THEMES=1'],
2921       }],
2922       ['enable_autofill_dialog==1', {
2923         'defines': ['ENABLE_AUTOFILL_DIALOG=1'],
2924       }],
2925       ['enable_prod_wallet_service==1', {
2926         'defines': ['ENABLE_PROD_WALLET_SERVICE=1'],
2927       }],
2928       ['enable_background==1', {
2929         'defines': ['ENABLE_BACKGROUND=1'],
2930       }],
2931       ['enable_google_now==1', {
2932         'defines': ['ENABLE_GOOGLE_NOW=1'],
2933       }],
2934       ['cld_version!=0', {
2935         'defines': ['CLD_VERSION=<(cld_version)'],
2936       }],
2937       ['cld_version==2', {
2938         # This is used to populate the "CLD Data Source" field in:
2939         # chrome://translate-internals
2940         'defines': ['CLD2_DATA_SOURCE=<(cld2_data_source)'],
2941       }],
2942       ['enable_basic_printing==1 or enable_print_preview==1', {
2943         # Convenience define for ENABLE_BASIC_PRINTING || ENABLE_PRINT_PREVIEW.
2944         'defines': ['ENABLE_PRINTING=1'],
2945       }],
2946       ['enable_basic_printing==1', {
2947         # Enable basic printing support and UI.
2948         'defines': ['ENABLE_BASIC_PRINTING=1'],
2949       }],
2950       ['enable_print_preview==1', {
2951         # Enable printing with print preview.
2952         # Can be defined without ENABLE_BASIC_PRINTING.
2953         'defines': ['ENABLE_PRINT_PREVIEW=1'],
2954       }],
2955       ['enable_spellcheck==1', {
2956         'defines': ['ENABLE_SPELLCHECK=1'],
2957       }],
2958       ['enable_captive_portal_detection==1', {
2959         'defines': ['ENABLE_CAPTIVE_PORTAL_DETECTION=1'],
2960       }],
2961       ['enable_app_list==1', {
2962         'defines': ['ENABLE_APP_LIST=1'],
2963       }],
2964       ['enable_settings_app==1', {
2965         'defines': ['ENABLE_SETTINGS_APP=1'],
2966       }],
2967       ['disable_file_support==1', {
2968         'defines': ['DISABLE_FILE_SUPPORT=1'],
2969       }],
2970       ['disable_ftp_support==1', {
2971         'defines': ['DISABLE_FTP_SUPPORT=1'],
2972       }],
2973       ['use_icu_alternatives_on_android==1', {
2974         'defines': ['USE_ICU_ALTERNATIVES_ON_ANDROID=1'],
2975       }],
2976       ['enable_managed_users==1', {
2977         'defines': ['ENABLE_MANAGED_USERS=1'],
2978       }],
2979       ['spdy_proxy_auth_property != ""', {
2980         'defines': ['SPDY_PROXY_AUTH_PROPERTY="<(spdy_proxy_auth_property)"'],
2981       }],
2982       ['spdy_proxy_auth_value != ""', {
2983         'defines': ['SPDY_PROXY_AUTH_VALUE="<(spdy_proxy_auth_value)"'],
2984       }],
2985       ['enable_mdns==1', {
2986         'defines': ['ENABLE_MDNS=1'],
2987       }],
2988       ['enable_service_discovery==1', {
2989         'defines' : [ 'ENABLE_SERVICE_DISCOVERY=1' ],
2990       }],
2991       ['enable_wifi_bootstrapping==1', {
2992         'defines' : [ 'ENABLE_WIFI_BOOTSTRAPPING=1' ],
2993       }],
2994       ['enable_hangout_services_extension==1', {
2995         'defines': ['ENABLE_HANGOUT_SERVICES_EXTENSION=1'],
2996       }],
2997       ['enable_ipc_fuzzer==1', {
2998         'defines': ['ENABLE_IPC_FUZZER=1'],
2999       }],
3000       ['video_hole==1', {
3001         'defines': ['VIDEO_HOLE=1'],
3002       }],
3003       ['enable_load_completion_hacks==1', {
3004         'defines': ['ENABLE_LOAD_COMPLETION_HACKS=1'],
3005       }],
3006       ['v8_use_external_startup_data==1', {
3007        'defines': ['V8_USE_EXTERNAL_STARTUP_DATA'],
3008       }],
3009     ],  # conditions for 'target_defaults'
3010     'target_conditions': [
3011       ['<(use_libpci)==1', {
3012         'defines': ['USE_LIBPCI=1'],
3013       }],
3014       ['<(use_openssl)==1', {
3015         'defines': ['USE_OPENSSL=1'],
3016       }],
3017       ['<(use_openssl_certs)==1', {
3018         'defines': ['USE_OPENSSL_CERTS=1'],
3019       }],
3020       ['>(nacl_untrusted_build)==1', {
3021         'defines': [
3022           'USE_OPENSSL=1',
3023           'USE_OPENSSL_CERTS=1',
3024         ],
3025       }],
3026       ['<(use_glib)==1 and >(nacl_untrusted_build)==0', {
3027         'defines': ['USE_GLIB=1'],
3028       }],
3029       ['<(use_nss)==1 and >(nacl_untrusted_build)==0', {
3030         'defines': ['USE_NSS=1'],
3031       }],
3032       ['<(chromeos)==1 and >(nacl_untrusted_build)==0', {
3033         'defines': ['OS_CHROMEOS=1'],
3034       }],
3035       ['enable_wexit_time_destructors==1 and OS!="win"', {
3036         # TODO: Enable on Windows too, http://crbug.com/404525
3037         'variables': { 'clang_warning_flags': ['-Wexit-time-destructors']},
3038       }],
3039       ['chromium_code==0', {
3040         'conditions': [
3041           [ 'os_posix==1 and OS!="mac" and OS!="ios"', {
3042             # We don't want to get warnings from third-party code,
3043             # so remove any existing warning-enabling flags like -Wall.
3044             'cflags!': [
3045               '-Wall',
3046               '-Wextra',
3047             ],
3048             'cflags_cc': [
3049               # Don't warn about hash_map in third-party code.
3050               '-Wno-deprecated',
3051             ],
3052             'cflags': [
3053               # Don't warn about printf format problems.
3054               # This is off by default in gcc but on in Ubuntu's gcc(!).
3055               '-Wno-format',
3056             ],
3057             'cflags_cc!': [
3058               # Necessary because llvm.org/PR10448 is WONTFIX (crbug.com/90453).
3059               '-Wsign-compare',
3060             ]
3061           }],
3062           # TODO: Fix all warnings on chromeos too.
3063           [ 'os_posix==1 and OS!="mac" and OS!="ios" and (clang!=1 or chromeos==1)', {
3064             'cflags!': [
3065               '-Werror',
3066             ],
3067           }],
3068           [ 'os_posix==1 and os_bsd!=1 and OS!="mac" and OS!="android"', {
3069             'cflags': [
3070               # Don't warn about ignoring the return value from e.g. close().
3071               # This is off by default in some gccs but on by default in others.
3072               # BSD systems do not support this option, since they are usually
3073               # using gcc 4.2.1, which does not have this flag yet.
3074               '-Wno-unused-result',
3075             ],
3076           }],
3077           [ 'OS=="win"', {
3078             'defines': [
3079               '_CRT_SECURE_NO_DEPRECATE',
3080               '_CRT_NONSTDC_NO_WARNINGS',
3081               '_CRT_NONSTDC_NO_DEPRECATE',
3082               '_SCL_SECURE_NO_DEPRECATE',
3083             ],
3084             'msvs_disabled_warnings': [4800],
3085             'msvs_settings': {
3086               'VCCLCompilerTool': {
3087                 'WarningLevel': '3',
3088                 'WarnAsError': 'true',
3089                 'Detect64BitPortabilityProblems': 'false',
3090               },
3091             },
3092             'conditions': [
3093               ['buildtype=="Official"', {
3094                 'msvs_settings': {
3095                   'VCCLCompilerTool': { 'WarnAsError': 'false' },
3096                 }
3097               }],
3098               ['clang==1', {
3099                 'msvs_settings': {
3100                   'VCCLCompilerTool': { 'WarnAsError': 'false' },
3101                 }
3102               }],
3103               [ 'component=="shared_library"', {
3104               # TODO(darin): Unfortunately, some third_party code depends on base.
3105                 'msvs_disabled_warnings': [
3106                   4251,  # class 'std::xx' needs to have dll-interface.
3107                  ],
3108               }],
3109             ],
3110           }],
3111
3112           [ 'OS=="mac" or OS=="ios"', {
3113             'xcode_settings': {
3114               'WARNING_CFLAGS!': ['-Wall', '-Wextra'],
3115             },
3116             'conditions': [
3117               ['buildtype=="Official"', {
3118                 'xcode_settings': {
3119                   'GCC_TREAT_WARNINGS_AS_ERRORS': 'NO',    # -Werror
3120                 },
3121               }],
3122             ],
3123           }],
3124           [ 'OS=="ios"', {
3125             'xcode_settings': {
3126               # TODO(ios): Fix remaining warnings in third-party code, then
3127               # remove this; the Mac cleanup didn't get everything that's
3128               # flagged in an iOS build.
3129               'GCC_TREAT_WARNINGS_AS_ERRORS': 'NO',
3130               'RUN_CLANG_STATIC_ANALYZER': 'NO',
3131               # Several internal ios directories generate numerous warnings for
3132               # -Wobjc-missing-property-synthesis.
3133               'CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS': 'NO',
3134             },
3135           }],
3136         ],
3137       }, {
3138         'includes': [
3139            # Rules for excluding e.g. foo_win.cc from the build on non-Windows.
3140           'filename_rules.gypi',
3141         ],
3142         # In Chromium code, we define __STDC_foo_MACROS in order to get the
3143         # C99 macros on Mac and Linux.
3144         'defines': [
3145           '__STDC_CONSTANT_MACROS',
3146           '__STDC_FORMAT_MACROS',
3147         ],
3148         'conditions': [
3149           ['OS=="win"', {
3150             # turn on warnings for signed/unsigned mismatch on chromium code.
3151             'msvs_settings': {
3152               'VCCLCompilerTool': {
3153                 'AdditionalOptions': ['/we4389'],
3154               },
3155             },
3156           }],
3157           ['OS=="win" and component=="shared_library"', {
3158             'msvs_disabled_warnings': [
3159               4251,  # class 'std::xx' needs to have dll-interface.
3160             ],
3161           }],
3162         ],
3163       }],
3164     ],  # target_conditions for 'target_defaults'
3165     'default_configuration': 'Debug',
3166     'configurations': {
3167       # VCLinkerTool LinkIncremental values below:
3168       #   0 == default
3169       #   1 == /INCREMENTAL:NO
3170       #   2 == /INCREMENTAL
3171       # Debug links incremental, Release does not.
3172       #
3173       # Abstract base configurations to cover common attributes.
3174       #
3175       'Common_Base': {
3176         'abstract': 1,
3177         'msvs_configuration_attributes': {
3178           'OutputDirectory': '<(DEPTH)\\build\\<(build_dir_prefix)$(ConfigurationName)',
3179           'IntermediateDirectory': '$(OutDir)\\obj\\$(ProjectName)',
3180           'CharacterSet': '1',
3181         },
3182         # Add the default import libs.
3183         'msvs_settings':{
3184           'VCLinkerTool': {
3185             'AdditionalDependencies': [
3186               'kernel32.lib',
3187               'gdi32.lib',
3188               'winspool.lib',
3189               'comdlg32.lib',
3190               'advapi32.lib',
3191               'shell32.lib',
3192               'ole32.lib',
3193               'oleaut32.lib',
3194               'user32.lib',
3195               'uuid.lib',
3196               'odbc32.lib',
3197               'odbccp32.lib',
3198               'delayimp.lib',
3199               'credui.lib',
3200               'netapi32.lib',
3201             ],
3202           },
3203         },
3204       },
3205       'x86_Base': {
3206         'abstract': 1,
3207         'msvs_settings': {
3208           'VCLinkerTool': {
3209             'MinimumRequiredVersion': '5.01',  # XP.
3210             'TargetMachine': '1',
3211           },
3212           'VCLibrarianTool': {
3213             'TargetMachine': '1',
3214           },
3215         },
3216         'msvs_configuration_platform': 'Win32',
3217       },
3218       'x64_Base': {
3219         'abstract': 1,
3220         'msvs_configuration_platform': 'x64',
3221         'msvs_settings': {
3222           'VCLinkerTool': {
3223             # Make sure to understand http://crbug.com/361720 if you want to
3224             # increase this.
3225             'MinimumRequiredVersion': '5.02',  # Server 2003.
3226             'TargetMachine': '17', # x86 - 64
3227             'AdditionalLibraryDirectories!':
3228               ['<(windows_sdk_path)/Lib/win8/um/x86'],
3229             'AdditionalLibraryDirectories':
3230               ['<(windows_sdk_path)/Lib/win8/um/x64'],
3231             # Doesn't exist x64 SDK. Should use oleaut32 in any case.
3232             'IgnoreDefaultLibraryNames': [ 'olepro32.lib' ],
3233           },
3234           'VCLibrarianTool': {
3235             'AdditionalLibraryDirectories!':
3236               ['<(windows_sdk_path)/Lib/win8/um/x86'],
3237             'AdditionalLibraryDirectories':
3238               ['<(windows_sdk_path)/Lib/win8/um/x64'],
3239             'TargetMachine': '17', # x64
3240           },
3241         },
3242       },
3243       'Debug_Base': {
3244         'abstract': 1,
3245         'defines': [
3246           'DYNAMIC_ANNOTATIONS_ENABLED=1',
3247           'WTF_USE_DYNAMIC_ANNOTATIONS=1',
3248         ],
3249         'xcode_settings': {
3250           'GCC_OPTIMIZATION_LEVEL': '<(mac_debug_optimization)',
3251           'OTHER_CFLAGS': [
3252             '<@(debug_extra_cflags)',
3253           ],
3254         },
3255         'msvs_settings': {
3256           'VCCLCompilerTool': {
3257             'Optimization': '<(win_debug_Optimization)',
3258             'PreprocessorDefinitions': ['_DEBUG'],
3259             'BasicRuntimeChecks': '<(win_debug_RuntimeChecks)',
3260             'RuntimeLibrary': '<(win_debug_RuntimeLibrary)',
3261             'conditions': [
3262               # According to MSVS, InlineFunctionExpansion=0 means
3263               # "default inlining", not "/Ob0".
3264               # Thus, we have to handle InlineFunctionExpansion==0 separately.
3265               ['win_debug_InlineFunctionExpansion==0', {
3266                 'AdditionalOptions': ['/Ob0'],
3267               }],
3268               ['win_debug_InlineFunctionExpansion!=""', {
3269                 'InlineFunctionExpansion':
3270                   '<(win_debug_InlineFunctionExpansion)',
3271               }],
3272               ['win_debug_disable_iterator_debugging==1', {
3273                 'PreprocessorDefinitions': ['_HAS_ITERATOR_DEBUGGING=0'],
3274               }],
3275
3276               # if win_debug_OmitFramePointers is blank, leave as default
3277               ['win_debug_OmitFramePointers==1', {
3278                 'OmitFramePointers': 'true',
3279               }],
3280               ['win_debug_OmitFramePointers==0', {
3281                 'OmitFramePointers': 'false',
3282                 # The above is not sufficient (http://crbug.com/106711): it
3283                 # simply eliminates an explicit "/Oy", but both /O2 and /Ox
3284                 # perform FPO regardless, so we must explicitly disable.
3285                 # We still want the false setting above to avoid having
3286                 # "/Oy /Oy-" and warnings about overriding.
3287                 'AdditionalOptions': ['/Oy-'],
3288               }],
3289             ],
3290             'AdditionalOptions': [ '<@(win_debug_extra_cflags)', ],
3291           },
3292           'VCLinkerTool': {
3293             'LinkIncremental': '<(msvs_debug_link_incremental)',
3294             # ASLR makes debugging with windbg difficult because Chrome.exe and
3295             # Chrome.dll share the same base name. As result, windbg will
3296             # name the Chrome.dll module like chrome_<base address>, where
3297             # <base address> typically changes with each launch. This in turn
3298             # means that breakpoints in Chrome.dll don't stick from one launch
3299             # to the next. For this reason, we turn ASLR off in debug builds.
3300             # Note that this is a three-way bool, where 0 means to pick up
3301             # the default setting, 1 is off and 2 is on.
3302             'RandomizedBaseAddress': 1,
3303           },
3304           'VCResourceCompilerTool': {
3305             'PreprocessorDefinitions': ['_DEBUG'],
3306           },
3307         },
3308         'conditions': [
3309           ['OS=="linux" or OS=="android"', {
3310             'target_conditions': [
3311               ['_toolset=="target"', {
3312                 'cflags': [
3313                   '<@(debug_extra_cflags)',
3314                 ],
3315               }],
3316             ],
3317           }],
3318           ['OS=="linux" and target_arch!="ia32" and disable_glibcxx_debug==0', {
3319             # Enable libstdc++ debugging facilities to help catch problems
3320             # early, see http://crbug.com/65151 .
3321             # TODO(phajdan.jr): Should we enable this for all of POSIX?
3322             'defines': ['_GLIBCXX_DEBUG=1',],
3323           }],
3324           ['release_valgrind_build==0', {
3325             'xcode_settings': {
3326               'OTHER_CFLAGS': [
3327                 '-fstack-protector-all',  # Implies -fstack-protector
3328               ],
3329             },
3330           }],
3331           ['clang==1', {
3332             'cflags': [
3333               # Allow comparing the address of references and 'this' against 0
3334               # in debug builds. Technically, these can never be null in
3335               # well-defined C/C++ and Clang can optimize such checks away in
3336               # release builds, but they may be used in asserts in debug builds.
3337               '-Wno-undefined-bool-conversion',
3338               '-Wno-tautological-undefined-compare',
3339             ],
3340             'xcode_settings': {
3341               'OTHER_CFLAGS': [
3342                 '-Wno-undefined-bool-conversion',
3343                 '-Wno-tautological-undefined-compare',
3344               ],
3345             },
3346             'msvs_settings': {
3347               'VCCLCompilerTool': {
3348                 'AdditionalOptions': [
3349                   '-Wno-undefined-bool-conversion',
3350                   '-Wno-tautological-undefined-compare',
3351                 ],
3352               },
3353             },
3354           }],
3355         ],
3356       },
3357       'Release_Base': {
3358         'abstract': 1,
3359         'defines': [
3360           'NDEBUG',
3361         ],
3362         'xcode_settings': {
3363           'DEAD_CODE_STRIPPING': 'YES',  # -Wl,-dead_strip
3364           'GCC_OPTIMIZATION_LEVEL': '<(mac_release_optimization)',
3365           'OTHER_CFLAGS': [ '<@(release_extra_cflags)', ],
3366         },
3367         'msvs_settings': {
3368           'VCCLCompilerTool': {
3369             'RuntimeLibrary': '<(win_release_RuntimeLibrary)',
3370             'conditions': [
3371               # In official builds, each target will self-select
3372               # an optimization level.
3373               ['buildtype!="Official"', {
3374                   'Optimization': '<(win_release_Optimization)',
3375                 },
3376               ],
3377               # According to MSVS, InlineFunctionExpansion=0 means
3378               # "default inlining", not "/Ob0".
3379               # Thus, we have to handle InlineFunctionExpansion==0 separately.
3380               ['win_release_InlineFunctionExpansion==0', {
3381                 'AdditionalOptions': ['/Ob0'],
3382               }],
3383               ['win_release_InlineFunctionExpansion!=""', {
3384                 'InlineFunctionExpansion':
3385                   '<(win_release_InlineFunctionExpansion)',
3386               }],
3387
3388               # if win_release_OmitFramePointers is blank, leave as default
3389               ['win_release_OmitFramePointers==1', {
3390                 'OmitFramePointers': 'true',
3391               }],
3392               ['win_release_OmitFramePointers==0', {
3393                 'OmitFramePointers': 'false',
3394                 # The above is not sufficient (http://crbug.com/106711): it
3395                 # simply eliminates an explicit "/Oy", but both /O2 and /Ox
3396                 # perform FPO regardless, so we must explicitly disable.
3397                 # We still want the false setting above to avoid having
3398                 # "/Oy /Oy-" and warnings about overriding.
3399                 'AdditionalOptions': ['/Oy-'],
3400               }],
3401             ],
3402             'AdditionalOptions': [
3403                 '/d2Zi+',  # Improve debugging of Release builds.
3404                 '/Zc:inline',  # Remove unreferenced COMDAT (faster links).
3405                 '<@(win_release_extra_cflags)',
3406             ],
3407           },
3408           'VCLinkerTool': {
3409             # LinkIncremental is a tri-state boolean, where 0 means default
3410             # (i.e., inherit from parent solution), 1 means false, and
3411             # 2 means true.
3412             'LinkIncremental': '1',
3413             # This corresponds to the /PROFILE flag which ensures the PDB
3414             # file contains FIXUP information (growing the PDB file by about
3415             # 5%) but does not otherwise alter the output binary. This
3416             # information is used by the Syzygy optimization tool when
3417             # decomposing the release image.
3418             'Profile': 'true',
3419           },
3420         },
3421         'conditions': [
3422           ['msvs_use_common_release', {
3423             'includes': ['release.gypi'],
3424           }],
3425           ['release_valgrind_build==0 and tsan==0', {
3426             'defines': [
3427               'NVALGRIND',
3428               'DYNAMIC_ANNOTATIONS_ENABLED=0',
3429             ],
3430           }, {
3431             'defines': [
3432               'MEMORY_TOOL_REPLACES_ALLOCATOR',
3433               'MEMORY_SANITIZER_INITIAL_SIZE',
3434               'DYNAMIC_ANNOTATIONS_ENABLED=1',
3435               'WTF_USE_DYNAMIC_ANNOTATIONS=1',
3436             ],
3437           }],
3438           ['win_use_allocator_shim==0', {
3439             'defines': ['NO_TCMALLOC'],
3440           }],
3441           # _FORTIFY_SOURCE isn't really supported by Clang now, see
3442           # http://llvm.org/bugs/show_bug.cgi?id=16821.
3443           # It seems to work fine with Ubuntu 12 headers though, so use it
3444           # in official builds.
3445           ['os_posix==1 and (asan!=1 and msan!=1 and tsan!=1 and lsan!=1 and ubsan!=1) and (OS!="linux" or clang!=1 or buildtype=="Official")', {
3446             'target_conditions': [
3447               ['chromium_code==1', {
3448                 # Non-chromium code is not guaranteed to compile cleanly
3449                 # with _FORTIFY_SOURCE. Also, fortified build may fail
3450                 # when optimizations are disabled, so only do that for Release
3451                 # build.
3452                 'defines': [
3453                   '_FORTIFY_SOURCE=2',
3454                 ],
3455               }],
3456             ],
3457           }],
3458           ['OS=="linux" or OS=="android"', {
3459             'target_conditions': [
3460               ['_toolset=="target"', {
3461                 'cflags': [
3462                   '<@(release_extra_cflags)',
3463                 ],
3464                 'conditions': [
3465                   ['enable_resource_whitelist_generation==1', {
3466                     'cflags': [
3467                       '-Wunknown-pragmas -Wno-error=unknown-pragmas',
3468                     ],
3469                   }],
3470                 ],
3471               }],
3472             ],
3473           }],
3474           ['OS=="ios"', {
3475             'defines': [
3476               'NS_BLOCK_ASSERTIONS=1',
3477             ],
3478           }],
3479         ],
3480       },
3481       #
3482       # Concrete configurations
3483       #
3484       'Debug': {
3485         'inherit_from': ['Common_Base', 'x86_Base', 'Debug_Base'],
3486       },
3487       'Release': {
3488         'inherit_from': ['Common_Base', 'x86_Base', 'Release_Base'],
3489       },
3490       'conditions': [
3491         [ 'OS=="ios"', {
3492           'Profile': {
3493             'inherit_from': ['Common_Base', 'x86_Base', 'Release_Base'],
3494             'target_conditions': [
3495               [ '_type=="executable"', {
3496                 # To get a real .dSYM bundle produced by dsymutil, set the
3497                 # debug information format to dwarf-with-dsym.  Since
3498                 # strip_from_xcode will not be used, set Xcode to do the
3499                 # stripping as well.
3500                 'xcode_settings': {
3501                   'DEBUG_INFORMATION_FORMAT': 'dwarf-with-dsym',
3502                   'DEPLOYMENT_POSTPROCESSING': 'YES',
3503                   'STRIP_INSTALLED_PRODUCT': 'YES',
3504                 },
3505               }],
3506             ],
3507           },
3508         }],
3509         [ 'OS=="win"', {
3510           # TODO(bradnelson): add a gyp mechanism to make this more graceful.
3511           'Debug_x64': {
3512             'inherit_from': ['Common_Base', 'x64_Base', 'Debug_Base'],
3513           },
3514           'Release_x64': {
3515             'inherit_from': ['Common_Base', 'x64_Base', 'Release_Base'],
3516           },
3517         }],
3518       ],
3519     },
3520   },
3521   'conditions': [
3522     ['os_posix==1', {
3523       'target_defaults': {
3524         'ldflags': [
3525           '-Wl,-z,now',
3526           '-Wl,-z,relro',
3527         ],
3528         # TODO(glider): enable the default options on other systems.
3529         'conditions': [
3530           ['use_sanitizer_options==1 and ((OS=="linux" and (chromeos==0 or target_arch!="ia32")) or OS=="mac")', {
3531             'dependencies': [
3532               '<(DEPTH)/build/sanitizers/sanitizers.gyp:sanitizer_options',
3533             ],
3534           }],
3535         ],
3536       },
3537     }],
3538     # TODO(jochen): Enable this on chromeos on arm. http://crbug.com/356580
3539     ['os_posix==1 and disable_fatal_linker_warnings==0 and use_evdev_gestures==0 and (chromeos==0 or target_arch!="arm")', {
3540       'target_defaults': {
3541         'ldflags': [
3542           '-Wl,--fatal-warnings',
3543         ],
3544       },
3545     }],
3546     ['os_posix==1 and chromeos==0', {
3547       # Chrome OS enables -fstack-protector-strong via its build wrapper,
3548       # and we want to avoid overriding this, so stack-protector is only
3549       # enabled when not building on Chrome OS.
3550       # TODO(phajdan.jr): Use -fstack-protector-strong when our gcc
3551       # supports it.
3552       'target_defaults': {
3553         'cflags': [
3554           '-fstack-protector',
3555           '--param=ssp-buffer-size=4',
3556         ],
3557       },
3558     }],
3559     ['os_posix==1 and OS!="mac" and OS!="ios"', {
3560       'target_defaults': {
3561         # Enable -Werror by default, but put it in a variable so it can
3562         # be disabled in ~/.gyp/include.gypi on the valgrind builders.
3563         'variables': {
3564           'werror%': '-Werror',
3565           'libraries_for_target%': '',
3566         },
3567         'defines': [
3568           '_FILE_OFFSET_BITS=64',
3569         ],
3570         'cflags': [
3571           '<(werror)',  # See note above about the werror variable.
3572           '-pthread',
3573           '-fno-strict-aliasing',  # See http://crbug.com/32204
3574           '-Wall',
3575           # TODO(evan): turn this back on once all the builds work.
3576           # '-Wextra',
3577           # Don't warn about unused function params.  We use those everywhere.
3578           '-Wno-unused-parameter',
3579           # Don't warn about the "struct foo f = {0};" initialization pattern.
3580           '-Wno-missing-field-initializers',
3581           # Don't export any symbols (for example, to plugins we dlopen()).
3582           # Note: this is *required* to make some plugins work.
3583           '-fvisibility=hidden',
3584           '-pipe',
3585         ],
3586         'cflags_cc': [
3587           '-fno-exceptions',
3588           '-fno-rtti',
3589           '-fno-threadsafe-statics',
3590           # Make inline functions have hidden visiblity by default.
3591           # Surprisingly, not covered by -fvisibility=hidden.
3592           '-fvisibility-inlines-hidden',
3593           # GCC turns on -Wsign-compare for C++ under -Wall, but clang doesn't,
3594           # so we specify it explicitly.  (llvm.org/PR10448, crbug.com/90453)
3595           '-Wsign-compare',
3596         ],
3597         'ldflags': [
3598           '-pthread', '-Wl,-z,noexecstack',
3599         ],
3600         'libraries' : [
3601           '<(libraries_for_target)',
3602         ],
3603         'configurations': {
3604           'Debug_Base': {
3605             'variables': {
3606               'debug_optimize%': '0',
3607             },
3608             'defines': [
3609               '_DEBUG',
3610             ],
3611             'cflags': [
3612               '-O>(debug_optimize)',
3613               '-g',
3614               '-gdwarf-4',
3615             ],
3616             'conditions' : [
3617               ['OS=="android"', {
3618                 'ldflags': [
3619                   # Warn in case of text relocations.
3620                   '-Wl,--warn-shared-textrel',
3621                 ],
3622               }],
3623               ['OS=="android" and android_full_debug==0', {
3624                 # Some configurations are copied from Release_Base to reduce
3625                 # the binary size.
3626                 'variables': {
3627                   'debug_optimize%': 's',
3628                 },
3629                 'cflags': [
3630                   '-fdata-sections',
3631                   '-ffunction-sections',
3632                 ],
3633                 'ldflags': [
3634                   '-Wl,-O1',
3635                   '-Wl,--as-needed',
3636                 ],
3637               }],
3638               ['OS=="android" and android_full_debug==0 and target_arch!="arm64"', {
3639                 # We don't omit frame pointers on arm64 since they are required
3640                 # to correctly unwind stackframes which contain system library
3641                 # function frames (crbug.com/391706).
3642                 'cflags': [
3643                   '-fomit-frame-pointer',
3644                 ],
3645               }],
3646               ['OS=="linux" and target_arch=="ia32"', {
3647                 'ldflags': [
3648                   '-Wl,--no-as-needed',
3649                 ],
3650               }],
3651               ['debug_unwind_tables==1', {
3652                 'cflags': ['-funwind-tables'],
3653               }, {
3654                 'cflags': ['-fno-unwind-tables', '-fno-asynchronous-unwind-tables'],
3655               }],
3656               # TODO(mostynb): shuffle clang/gcc_version/binutils_version
3657               # definitions in to the right scope to use them when setting
3658               # linux_use_debug_fission, so it can be used here alone.
3659               ['linux_use_debug_fission==1 and linux_use_gold_flags==1 and (clang==1 or gcc_version>=48) and binutils_version>=223', {
3660                 'cflags': ['-gsplit-dwarf'],
3661               }],
3662             ],
3663           },
3664           'Release_Base': {
3665             'variables': {
3666               'release_optimize%': '2',
3667               # Binaries become big and gold is unable to perform GC
3668               # and remove unused sections for some of test targets
3669               # on 32 bit platform.
3670               # (This is currently observed only in chromeos valgrind bots)
3671               # The following flag is to disable --gc-sections linker
3672               # option for these bots.
3673               'no_gc_sections%': 0,
3674
3675               # TODO(bradnelson): reexamine how this is done if we change the
3676               # expansion of configurations
3677               'release_valgrind_build%': 0,
3678             },
3679             'cflags': [
3680               '-O<(release_optimize)',
3681               # Don't emit the GCC version ident directives, they just end up
3682               # in the .comment section taking up binary size.
3683               '-fno-ident',
3684               # Put data and code in their own sections, so that unused symbols
3685               # can be removed at link time with --gc-sections.
3686               '-fdata-sections',
3687               '-ffunction-sections',
3688             ],
3689             'ldflags': [
3690               # Specifically tell the linker to perform optimizations.
3691               # See http://lwn.net/Articles/192624/ .
3692               '-Wl,-O1',
3693               '-Wl,--as-needed',
3694             ],
3695             'conditions' : [
3696               ['no_gc_sections==0', {
3697                 'ldflags': [
3698                   '-Wl,--gc-sections',
3699                 ],
3700               }],
3701               ['OS=="android" and target_arch!="arm64"', {
3702                 # We don't omit frame pointers on arm64 since they are required
3703                 # to correctly unwind stackframes which contain system library
3704                 # function frames (crbug.com/391706).
3705                 'cflags': [
3706                   '-fomit-frame-pointer',
3707                 ]
3708               }],
3709               ['OS=="android"', {
3710                 'variables': {
3711                   'release_optimize%': 's',
3712                 },
3713                 'ldflags': [
3714                   # Warn in case of text relocations.
3715                   '-Wl,--warn-shared-textrel',
3716                 ],
3717               }],
3718               ['profiling==1', {
3719                 'cflags': [
3720                   '-fno-omit-frame-pointer',
3721                   '-g',
3722                 ],
3723                 'conditions' : [
3724                   ['profiling_full_stack_frames==1', {
3725                     'cflags': [
3726                       '-fno-inline',
3727                       '-fno-optimize-sibling-calls',
3728                     ],
3729                   }],
3730                 ],
3731               }],
3732               ['release_unwind_tables==1', {
3733                 'cflags': ['-funwind-tables'],
3734               }, {
3735                 'cflags': ['-fno-unwind-tables', '-fno-asynchronous-unwind-tables'],
3736               }],
3737             ],
3738           },
3739         },
3740         'conditions': [
3741           ['target_arch=="ia32"', {
3742             'target_conditions': [
3743               ['_toolset=="target"', {
3744                 'asflags': [
3745                   # Needed so that libs with .s files (e.g. libicudata.a)
3746                   # are compatible with the general 32-bit-ness.
3747                   '-32',
3748                 ],
3749                 # All floating-point computations on x87 happens in 80-bit
3750                 # precision.  Because the C and C++ language standards allow
3751                 # the compiler to keep the floating-point values in higher
3752                 # precision than what's specified in the source and doing so
3753                 # is more efficient than constantly rounding up to 64-bit or
3754                 # 32-bit precision as specified in the source, the compiler,
3755                 # especially in the optimized mode, tries very hard to keep
3756                 # values in x87 floating-point stack (in 80-bit precision)
3757                 # as long as possible. This has important side effects, that
3758                 # the real value used in computation may change depending on
3759                 # how the compiler did the optimization - that is, the value
3760                 # kept in 80-bit is different than the value rounded down to
3761                 # 64-bit or 32-bit. There are possible compiler options to
3762                 # make this behavior consistent (e.g. -ffloat-store would keep
3763                 # all floating-values in the memory, thus force them to be
3764                 # rounded to its original precision) but they have significant
3765                 # runtime performance penalty.
3766                 #
3767                 # -mfpmath=sse -msse2 makes the compiler use SSE instructions
3768                 # which keep floating-point values in SSE registers in its
3769                 # native precision (32-bit for single precision, and 64-bit
3770                 # for double precision values). This means the floating-point
3771                 # value used during computation does not change depending on
3772                 # how the compiler optimized the code, since the value is
3773                 # always kept in its specified precision.
3774                 #
3775                 # Refer to http://crbug.com/348761 for rationale behind SSE2
3776                 # being a minimum requirement for 32-bit Linux builds and
3777                 # http://crbug.com/313032 for an example where this has "bit"
3778                 # us in the past.
3779                 'cflags': [
3780                   '-msse2',
3781                   '-mfpmath=sse',
3782                   '-mmmx',  # Allows mmintrin.h for MMX intrinsics.
3783                   '-m32',
3784                 ],
3785                 'ldflags': [
3786                   '-m32',
3787                 ],
3788                 'conditions': [
3789                   # Use gold linker for Android ia32 target.
3790                   ['OS=="android"', {
3791                     'ldflags': [
3792                       '-fuse-ld=gold',
3793                     ],
3794                   }],
3795                   # Install packages have started cropping up with
3796                   # different headers between the 32-bit and 64-bit
3797                   # versions, so we have to shadow those differences off
3798                   # and make sure a 32-bit-on-64-bit build picks up the
3799                   # right files.
3800                   # For android build, use NDK headers instead of host headers
3801                   ['host_arch!="ia32" and OS!="android"', {
3802                     'include_dirs+': [
3803                       '/usr/include32',
3804                     ],
3805                   }],
3806                 ],
3807               }],
3808             ],
3809           }],
3810           ['target_arch=="x64"', {
3811             'target_conditions': [
3812               ['_toolset=="target"', {
3813                 'conditions': [
3814                   # Use gold linker for Android x64 target.
3815                   ['OS=="android"', {
3816                     'ldflags': [
3817                       '-fuse-ld=gold',
3818                     ],
3819                   }],
3820                 ],
3821                 'cflags': [
3822                   '-m64',
3823                   '-march=x86-64',
3824                 ],
3825                 'ldflags': [
3826                   '-m64',
3827                 ],
3828               }],
3829             ],
3830           }],
3831           ['target_arch=="arm"', {
3832             'target_conditions': [
3833               ['_toolset=="target"', {
3834                 'conditions': [
3835                   ['clang==0', {
3836                     'cflags_cc': [
3837                       # The codesourcery arm-2009q3 toolchain warns at that the ABI
3838                       # has changed whenever it encounters a varargs function. This
3839                       # silences those warnings, as they are not helpful and
3840                       # clutter legitimate warnings.
3841                       '-Wno-abi',
3842                     ],
3843                   }],
3844                   ['clang==1 and arm_arch!="" and OS!="android"', {
3845                     'cflags': [
3846                       '-target arm-linux-gnueabihf',
3847                     ],
3848                     'ldflags': [
3849                       '-target arm-linux-gnueabihf',
3850                     ],
3851                   }],
3852                   ['arm_arch!=""', {
3853                     'cflags': [
3854                       '-march=<(arm_arch)',
3855                     ],
3856                     'conditions': [
3857                       ['use_lto==1 or use_lto_o2==1', {
3858                         'ldflags': [
3859                           '-march=<(arm_arch)',
3860                         ],
3861                       }],
3862                     ],
3863                   }],
3864                   ['clang==1 and OS!="android"', {
3865                     'cflags': [
3866                       # We need to disable clang's builtin assembler as it can't
3867                       # handle several asm files, crbug.com/124610
3868                       '-no-integrated-as',
3869                     ],
3870                   }],
3871                   ['arm_tune!=""', {
3872                     'cflags': [
3873                       '-mtune=<(arm_tune)',
3874                     ],
3875                     'conditions': [
3876                       ['use_lto==1 or use_lto_o2==1', {
3877                         'ldflags': [
3878                           '-mtune=<(arm_tune)',
3879                         ],
3880                       }],
3881                     ],
3882                   }],
3883                   ['arm_fpu!=""', {
3884                     'cflags': [
3885                       '-mfpu=<(arm_fpu)',
3886                     ],
3887                     'conditions': [
3888                       ['use_lto==1 or use_lto_o2==1', {
3889                         'ldflags': [
3890                           '-mfpu=<(arm_fpu)',
3891                         ],
3892                       }],
3893                     ],
3894                   }],
3895                   ['arm_float_abi!=""', {
3896                     'cflags': [
3897                       '-mfloat-abi=<(arm_float_abi)',
3898                     ],
3899                     'conditions': [
3900                       ['use_lto==1 or use_lto_o2==1', {
3901                         'ldflags': [
3902                           '-mfloat-abi=<(arm_float_abi)',
3903                         ],
3904                       }],
3905                     ],
3906                   }],
3907                   ['arm_thumb==1', {
3908                     'cflags': [
3909                       '-mthumb',
3910                     ],
3911                     'conditions': [
3912                       ['use_lto==1 or use_lto_o2==1', {
3913                         'ldflags': [
3914                           '-mthumb',
3915                         ],
3916                       }],
3917                     ],
3918                   }],
3919                   ['OS=="android"', {
3920                     # Most of the following flags are derived from what Android
3921                     # uses by default when building for arm, reference for which
3922                     # can be found in the following file in the Android NDK:
3923                     # toolchains/arm-linux-androideabi-4.9/setup.mk
3924                     'cflags': [
3925                       # The tree-sra optimization (scalar replacement for
3926                       # aggregates enabling subsequent optimizations) leads to
3927                       # invalid code generation when using the Android NDK's
3928                       # compiler (r5-r7). This can be verified using
3929                       # webkit_unit_tests' WTF.Checked_int8_t test.
3930                       '-fno-tree-sra',
3931                       # The following option is disabled to improve binary
3932                       # size and performance in gcc 4.9.
3933                       '-fno-caller-saves',
3934                       '-Wno-psabi',
3935                     ],
3936                     # Android now supports .relro sections properly.
3937                     # NOTE: While these flags enable the generation of .relro
3938                     # sections, the generated libraries can still be loaded on
3939                     # older Android platform versions.
3940                     'ldflags': [
3941                         '-Wl,-z,relro',
3942                         '-Wl,-z,now',
3943                         '-fuse-ld=gold',
3944                     ],
3945                     'conditions': [
3946                       ['gcc_version==48 and clang==0', {
3947                         'cflags': [
3948                           # The following 5 options are disabled to save on
3949                           # binary size in GCC 4.8.
3950                           '-fno-partial-inlining',
3951                           '-fno-early-inlining',
3952                           '-fno-tree-copy-prop',
3953                           '-fno-tree-loop-optimize',
3954                           '-fno-move-loop-invariants',
3955                         ],
3956                       }],
3957                       ['arm_thumb==1', {
3958                         'cflags': [ '-mthumb-interwork' ],
3959                       }],
3960                       ['profiling==1', {
3961                         'cflags': [
3962                           # Thumb code with frame pointer makes chrome crash
3963                           # early.
3964                           '-marm',
3965                           '-mapcs-frame', # Required by -fno-omit-frame-pointer.
3966                           # The perf report sometimes incorrectly attributes
3967                           # code from tail calls.
3968                           '-fno-optimize-sibling-calls',
3969                         ],
3970                         'cflags!': [
3971                           '-fomit-frame-pointer',
3972                         ],
3973                       }],
3974                       ['clang==1', {
3975                         'cflags!': [
3976                           # Clang does not support the following options.
3977                           '-mthumb-interwork',
3978                           '-finline-limit=64',
3979                           '-fno-tree-sra',
3980                           '-fno-caller-saves',
3981                           '-Wno-psabi',
3982                         ],
3983                         'cflags': [
3984                           # TODO(hans) Enable integrated-as (crbug.com/124610).
3985                           '-no-integrated-as',
3986                           '-B<(android_toolchain)',  # Else /usr/bin/as gets picked up.
3987                         ],
3988                         'ldflags': [
3989                           # Let clang find the ld.gold in the NDK.
3990                           '--gcc-toolchain=<(android_toolchain)/..',
3991                         ],
3992                       }],
3993                       ['asan==1', {
3994                         'cflags': [
3995                           '-marm', # Required for frame pointer based stack traces.
3996                         ],
3997                       }],
3998                     ],
3999                   }],
4000                   ['chromecast==1', {
4001                     'cflags': [
4002                       # We set arm_arch to "" so that -march compiler option
4003                       # is not set.  Otherwise a gcc bug that would complain
4004                       # about it conflicting with '-mcpu=cortex-a9'. The flag
4005                       # '-march=armv7-a' is actually redundant anyway because
4006                       # it is enabled by default when we built the toolchain.
4007                       # And using '-mcpu=cortex-a9' should be sufficient.
4008                       '-mcpu=cortex-a9',
4009                       '-funwind-tables',
4010                       # Breakpad requires symbols with debugging information
4011                       '-g',
4012                     ],
4013                     'ldflags': [
4014                       # We want to statically link libstdc++/libgcc_s.
4015                       '-static-libstdc++',
4016                       '-static-libgcc',
4017                     ],
4018                     'cflags!': [
4019                       # Some components in Chromium (e.g. v8, skia, ffmpeg)
4020                       # define their own cflags for arm builds that could
4021                       # conflict with the flags we set here (e.g.
4022                       # '-mcpu=cortex-a9'). Remove these flags explicitly.
4023                       '-march=armv7-a',
4024                       '-mtune=cortex-a8',
4025                     ],
4026                   }],
4027                 ],
4028               }],
4029             ],
4030           }],
4031           ['target_arch=="arm64"', {
4032             'target_conditions': [
4033               ['_toolset=="target"', {
4034                 'conditions': [
4035                   ['OS=="android"', {
4036                     'cflags!': [
4037                        '-fstack-protector',  # stack protector is always enabled on arm64.
4038                     ],
4039                   }],
4040                 ],
4041               }],
4042             ],
4043           }],
4044           ['target_arch=="mipsel"', {
4045             'target_conditions': [
4046               ['_toolset=="target"', {
4047                 'conditions': [
4048                   ['android_webview_build==0 and mips_arch_variant=="r6"', {
4049                     'cflags': ['-mips32r6', '-Wa,-mips32r6'],
4050                     'conditions': [
4051                       ['OS=="android"', {
4052                         'ldflags': ['-mips32r6', '-Wl,-melf32ltsmip',],
4053                       }],
4054                     ],
4055                   }],
4056                   ['android_webview_build==0 and mips_arch_variant=="r2"', {
4057                     'cflags': ['-mips32r2', '-Wa,-mips32r2'],
4058                   }],
4059                   ['android_webview_build==0 and mips_arch_variant=="r1"', {
4060                     'cflags': ['-mips32', '-Wa,-mips32'],
4061                   }],
4062                 ],
4063                 'ldflags': [
4064                   '-Wl,--no-keep-memory'
4065                 ],
4066                 'cflags_cc': [
4067                   '-Wno-uninitialized',
4068                 ],
4069               }],
4070             ],
4071           }],
4072           ['target_arch=="mips64el"', {
4073             'target_conditions': [
4074               ['_toolset=="target"', {
4075                 'conditions': [
4076                   ['android_webview_build==0 and mips_arch_variant=="r6"', {
4077                     'cflags': ['-mips64r6', '-Wa,-mips64r6'],
4078                     'ldflags': [ '-mips64r6' ],
4079                   }],
4080                   ['android_webview_build==0 and mips_arch_variant=="r2"', {
4081                     'cflags': ['-mips64r2', '-Wa,-mips64r2'],
4082                     'ldflags': [ '-mips64r2' ],
4083                   }],
4084                 ],
4085                 'cflags_cc': [
4086                   '-Wno-uninitialized',
4087                 ],
4088               }],
4089             ],
4090           }],
4091           ['linux_fpic==1', {
4092             'cflags': [
4093               '-fPIC',
4094             ],
4095             'ldflags': [
4096               '-fPIC',
4097             ],
4098           }],
4099           ['sysroot!=""', {
4100             'target_conditions': [
4101               ['_toolset=="target"', {
4102                 'cflags': [
4103                   '--sysroot=<(sysroot)',
4104                 ],
4105                 'ldflags': [
4106                   '--sysroot=<(sysroot)',
4107                   '<!(<(DEPTH)/build/linux/sysroot_ld_path.sh <(sysroot))',
4108                 ],
4109               }]]
4110           }],
4111           ['clang==1', {
4112             'cflags': [
4113               # TODO(thakis): Remove, http://crbug.com/263960
4114               '-Wno-reserved-user-defined-literal',
4115             ],
4116             'cflags_cc': [
4117               # gnu++11 instead of c++11 is needed because some code uses
4118               # typeof() (a GNU extension).
4119               # TODO(thakis): Eventually switch this to c++11 instead,
4120               # http://crbug.com/427584
4121               '-std=gnu++11',
4122             ],
4123           }],
4124           ['clang==0 and host_clang==1', {
4125             'target_conditions': [
4126               ['_toolset=="host"', {
4127                 'cflags_cc': [ '-std=gnu++11', ],
4128               }],
4129             ],
4130           }],
4131           ['clang==1 and clang_use_chrome_plugins==1', {
4132             'cflags': [
4133               '<@(clang_chrome_plugins_flags)',
4134             ],
4135           }],
4136           ['clang==1 and clang_load!=""', {
4137             'cflags': [
4138               '-Xclang', '-load', '-Xclang', '<(clang_load)',
4139             ],
4140           }],
4141           ['clang==1 and clang_add_plugin!=""', {
4142             'cflags': [
4143               '-Xclang', '-add-plugin', '-Xclang', '<(clang_add_plugin)',
4144             ],
4145           }],
4146           ['clang==1 and target_arch=="ia32"', {
4147             'cflags': [
4148               # Else building libyuv gives clang's register allocator issues,
4149               # see llvm.org/PR15798 / crbug.com/233709
4150               '-momit-leaf-frame-pointer',
4151               # Align the stack on 16-byte boundaries, http://crbug.com/418554.
4152               '-mstack-alignment=16',
4153               '-mstackrealign',
4154             ],
4155           }],
4156           ['clang==1 and "<(GENERATOR)"=="ninja"', {
4157             'cflags': [
4158               # See http://crbug.com/110262
4159               '-fcolor-diagnostics',
4160             ],
4161           }],
4162           # Common options for AddressSanitizer, LeakSanitizer,
4163           # ThreadSanitizer and MemorySanitizer.
4164           ['asan==1 or lsan==1 or tsan==1 or msan==1 or ubsan==1 or ubsan_vptr==1', {
4165             'target_conditions': [
4166               ['_toolset=="target"', {
4167                 'cflags': [
4168                   '-fno-omit-frame-pointer',
4169                   '-gline-tables-only',
4170                 ],
4171                 'cflags!': [
4172                   '-fomit-frame-pointer',
4173                 ],
4174               }],
4175             ],
4176           }],
4177           ['asan==1 or lsan==1 or tsan==1 or msan==1', {
4178             'target_conditions': [
4179               ['_toolset=="target"', {
4180                 'ldflags!': [
4181                   # Functions interposed by the sanitizers can make ld think
4182                   # that some libraries aren't needed when they actually are,
4183                   # http://crbug.com/234010. As workaround, disable --as-needed.
4184                   '-Wl,--as-needed',
4185                 ],
4186                 'defines': [
4187                   'MEMORY_TOOL_REPLACES_ALLOCATOR',
4188                   'MEMORY_SANITIZER_INITIAL_SIZE',
4189                 ],
4190               }],
4191             ],
4192           }],
4193           ['asan==1', {
4194             'target_conditions': [
4195               ['_toolset=="target"', {
4196                 'cflags': [
4197                   '-fsanitize=address',
4198                   # TODO(earthdok): Re-enable. http://crbug.com/427202
4199                   #'-fsanitize-blacklist=<(asan_blacklist)',
4200                 ],
4201                 'ldflags': [
4202                   '-fsanitize=address',
4203                 ],
4204               }],
4205             ],
4206             'conditions': [
4207               ['OS=="mac"', {
4208                 'cflags': [
4209                   '-mllvm -asan-globals=0',  # http://crbug.com/352073
4210                 ],
4211               }],
4212             ],
4213           }],
4214           ['ubsan==1', {
4215             'target_conditions': [
4216               ['_toolset=="target"', {
4217                 'cflags': [
4218                   '-fsanitize=undefined',
4219                   # -fsanitize=vptr is incompatible with -fno-rtti.
4220                   '-fno-sanitize=vptr',
4221                 ],
4222                 'ldflags': [
4223                   '-fsanitize=undefined',
4224                   # -fsanitize=vptr is incompatible with -fno-rtti.
4225                   '-fno-sanitize=vptr',
4226                 ],
4227               }],
4228             ],
4229           }],
4230           ['ubsan_vptr==1', {
4231             'target_conditions': [
4232               ['_toolset=="target"', {
4233                 'cflags': [
4234                   '-fsanitize=vptr',
4235                   '-fsanitize-blacklist=<(ubsan_vptr_blacklist)',
4236                 ],
4237                 'cflags_cc!': [
4238                   '-fno-rtti',
4239                 ],
4240                 'cflags!': [
4241                   '-fno-rtti',
4242                 ],
4243                 'ldflags': [
4244                   '-fsanitize=vptr',
4245                 ],
4246                 'defines': [
4247                   'UNDEFINED_SANITIZER',
4248                 ],
4249               }],
4250             ],
4251           }],
4252           ['asan_coverage!=0', {
4253             'target_conditions': [
4254               ['_toolset=="target"', {
4255                 'cflags': [
4256                   '-mllvm -asan-coverage=<(asan_coverage)',
4257                 ],
4258               }],
4259             ],
4260           }],
4261           ['asan_field_padding!=0', {
4262             'target_conditions': [
4263               ['_toolset=="target"', {
4264                 'cflags': [
4265                   '-fsanitize-address-field-padding=<(asan_field_padding)',
4266                 ],
4267               }],
4268             ],
4269           }],
4270           ['lsan==1', {
4271             'target_conditions': [
4272               ['_toolset=="target"', {
4273                 'cflags': [
4274                   '-fsanitize=leak',
4275                 ],
4276                 'ldflags': [
4277                   '-fsanitize=leak',
4278                 ],
4279                 'defines': [
4280                   'LEAK_SANITIZER',
4281                   'WTF_USE_LEAK_SANITIZER=1',
4282                 ],
4283               }],
4284             ],
4285           }],
4286           ['tsan==1', {
4287             'target_conditions': [
4288               ['_toolset=="target"', {
4289                 'cflags': [
4290                   '-fsanitize=thread',
4291                   '-fPIC',
4292                   '-fsanitize-blacklist=<(tsan_blacklist)',
4293                 ],
4294                 'ldflags': [
4295                   '-fsanitize=thread',
4296                 ],
4297                 'defines': [
4298                   'THREAD_SANITIZER',
4299                   'DYNAMIC_ANNOTATIONS_EXTERNAL_IMPL=1',
4300                   'WTF_USE_DYNAMIC_ANNOTATIONS_NOIMPL=1',
4301                 ],
4302                 'target_conditions': [
4303                   ['_type=="executable"', {
4304                     'ldflags': [
4305                       '-pie',
4306                     ],
4307                   }],
4308                 ],
4309               }],
4310             ],
4311           }],
4312           ['msan==1', {
4313             'target_conditions': [
4314               ['_toolset=="target"', {
4315                 'cflags': [
4316                   '-fsanitize=memory',
4317                   '-fsanitize-memory-track-origins=<(msan_track_origins)',
4318                   '-fPIC',
4319                   '-fsanitize-blacklist=<(msan_blacklist)',
4320                 ],
4321                 'ldflags': [
4322                   '-fsanitize=memory',
4323                 ],
4324                 'defines': [
4325                   'MEMORY_SANITIZER',
4326                 ],
4327                 'target_conditions': [
4328                   ['_type=="executable"', {
4329                     'ldflags': [
4330                       '-pie',
4331                     ],
4332                   }],
4333                 ],
4334               }],
4335             ],
4336           }],
4337           ['use_instrumented_libraries==1', {
4338             'dependencies': [
4339               '<(DEPTH)/third_party/instrumented_libraries/instrumented_libraries.gyp:instrumented_libraries',
4340             ],
4341           }],
4342           ['use_custom_libcxx==1', {
4343             'dependencies': [
4344               '<(DEPTH)/third_party/libc++/libc++.gyp:libcxx_proxy',
4345             ],
4346           }],
4347           ['order_profiling!=0 and (chromeos==1 or OS=="linux" or OS=="android")', {
4348             'target_conditions' : [
4349               # crazy_linker has an upstream gyp file we can't edit, and we
4350               # don't want to instrument it.
4351               ['_toolset=="target" and _target_name!="crazy_linker"', {
4352                 'cflags': [
4353                   '-finstrument-functions',
4354                   # Allow mmx intrinsics to inline, so that the
4355                   #0 compiler can expand the intrinsics.
4356                   '-finstrument-functions-exclude-file-list=mmintrin.h',
4357                 ],
4358               }],
4359               ['_toolset=="target" and OS=="android"', {
4360                 'cflags': [
4361                   # Avoids errors with current NDK:
4362                   # "third_party/android_tools/ndk/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/include/arm_neon.h:3426:3: error: argument must be a constant"
4363                   '-finstrument-functions-exclude-file-list=arm_neon.h,SaturatedArithmeticARM.h',
4364                 ],
4365               }],
4366             ],
4367           }],
4368           ['linux_dump_symbols==1', {
4369             'cflags': [ '-g' ],
4370             'conditions': [
4371               ['OS=="linux" and host_arch=="ia32" and linux_use_bundled_gold==0', {
4372                 'target_conditions': [
4373                   ['_toolset=="target"', {
4374                     'ldflags': [
4375                       # Attempt to use less memory to prevent the linker from
4376                       # running out of address space. Considering installing a
4377                       # 64-bit kernel and switching to a 64-bit linker.
4378                       '-Wl,--no-keep-memory',
4379                     ],
4380                   }],
4381                 ],
4382               }],
4383             ],
4384           }],
4385           ['use_allocator!="tcmalloc"', {
4386             'defines': ['NO_TCMALLOC'],
4387           }],
4388           ['linux_use_gold_flags==1', {
4389             # Newer gccs and clangs support -fuse-ld, use the flag to force gold
4390             # selection.
4391             # gcc -- http://gcc.gnu.org/onlinedocs/gcc-4.8.0/gcc/Optimize-Options.html
4392             'ldflags': [ '-fuse-ld=gold', ],
4393
4394             'target_conditions': [
4395               ['_toolset=="target"', {
4396                 'ldflags': [
4397                   # Experimentation found that using four linking threads
4398                   # saved ~20% of link time.
4399                   # https://groups.google.com/a/chromium.org/group/chromium-dev/browse_thread/thread/281527606915bb36
4400                   # Only apply this to the target linker, since the host
4401                   # linker might not be gold, but isn't used much anyway.
4402                   # TODO(raymes): Disable threading because gold is frequently
4403                   # crashing on the bots: crbug.com/161942.
4404                   # '-Wl,--threads',
4405                   # '-Wl,--thread-count=4',
4406                 ],
4407               }],
4408             ],
4409             'conditions': [
4410               ['release_valgrind_build==0', {
4411                 'target_conditions': [
4412                   ['_toolset=="target"', {
4413                     'ldflags': [
4414                       '-Wl,--icf=safe',
4415                     ],
4416                   }],
4417                 ],
4418               }],
4419             ],
4420           }],
4421           ['linux_use_bundled_binutils==1', {
4422             'cflags': [
4423               '-B<!(cd <(DEPTH) && pwd -P)/<(binutils_dir)',
4424             ],
4425           }],
4426           ['linux_use_bundled_gold==1', {
4427             # Put our binutils, which contains gold in the search path. We pass
4428             # the path to gold to the compiler. gyp leaves unspecified what the
4429             # cwd is when running the compiler, so the normal gyp path-munging
4430             # fails us. This hack gets the right path.
4431             'ldflags': [
4432               '-B<!(cd <(DEPTH) && pwd -P)/<(binutils_dir)',
4433             ],
4434           }],
4435           # Some binutils 2.23 releases may or may not have new dtags enabled,
4436           # but they are all compatible with --disable-new-dtags,
4437           # because the new dynamic tags are not created by default.
4438           ['binutils_version>=223', {
4439             # Newer binutils don't set DT_RPATH unless you disable "new" dtags
4440             # and the new DT_RUNPATH doesn't work without --no-as-needed flag.
4441             # FIXME(mithro): Figure out the --as-needed/--no-as-needed flags
4442             # inside this file to allow usage of --no-as-needed and removal of
4443             # this flag.
4444             'ldflags': [
4445               '-Wl,--disable-new-dtags',
4446             ],
4447           }],
4448           ['gcc_version>=47 and clang==0', {
4449             'target_conditions': [
4450               ['_toolset=="target"', {
4451                 'cflags_cc': [
4452                   '-std=gnu++11',
4453                   # See comment for -Wno-c++11-narrowing.
4454                   '-Wno-narrowing',
4455                   # TODO(thakis): Remove, http://crbug.com/263960
4456                   '-Wno-literal-suffix',
4457                 ],
4458               }],
4459             ],
4460           }],
4461           ['host_gcc_version>=47 and clang==0 and host_clang==0', {
4462             'target_conditions': [
4463               ['_toolset=="host"', {
4464                 'cflags_cc': [
4465                   '-std=gnu++11',
4466                   # See comment for -Wno-c++11-narrowing.
4467                   '-Wno-narrowing',
4468                   # TODO(thakis): Remove, http://crbug.com/263960
4469                   '-Wno-literal-suffix',
4470                 ],
4471               }],
4472             ],
4473           }],
4474         ],
4475       },
4476     }],
4477     # FreeBSD-specific options; note that most FreeBSD options are set above,
4478     # with Linux.
4479     ['OS=="freebsd"', {
4480       'target_defaults': {
4481         'ldflags': [
4482           '-Wl,--no-keep-memory',
4483         ],
4484       },
4485     }],
4486     # Android-specific options; note that most are set above with Linux.
4487     ['OS=="android"', {
4488       'variables': {
4489         # This is a unique identifier for a given build. It's used for
4490         # identifying various build artifacts corresponding to a particular
4491         # build of chrome (e.g. where to find archived symbols).
4492         'chrome_build_id%': '',
4493         'conditions': [
4494           # Figure this out early since it needs symbols from libgcc.a, so it
4495           # has to be before that in the set of libraries.
4496           ['component=="shared_library"', {
4497               'android_stlport_library': 'stlport_shared',
4498           }, {
4499               'android_stlport_library': 'stlport_static',
4500           }],
4501         ],
4502
4503         # Placing this variable here prevents from forking libvpx, used
4504         # by remoting.  Remoting is off, so it needn't built,
4505         # so forking it's deps seems like overkill.
4506         # But this variable need defined to properly run gyp.
4507         # A proper solution is to have an OS==android conditional
4508         # in third_party/libvpx/libvpx.gyp to define it.
4509         'libvpx_path': 'lib/linux/arm',
4510       },
4511       'target_defaults': {
4512         'variables': {
4513           'release_extra_cflags%': '',
4514           'conditions': [
4515             # If we're using the components build, append "cr" to all shared
4516             # libraries to avoid naming collisions with android system library
4517             # versions with the same name (e.g. skia, icu).
4518             ['component=="shared_library"', {
4519               'android_product_extension': 'cr.so',
4520             }, {
4521               'android_product_extension': 'so',
4522             } ],
4523           ],
4524         },
4525         'target_conditions': [
4526           ['_type=="shared_library"', {
4527             'product_extension': '<(android_product_extension)',
4528           }],
4529
4530           # Settings for building device targets using Android's toolchain.
4531           # These are based on the setup.mk file from the Android NDK.
4532           #
4533           # The NDK Android executable link step looks as follows:
4534           #  $LDFLAGS
4535           #  $(TARGET_CRTBEGIN_DYNAMIC_O)  <-- crtbegin.o
4536           #  $(PRIVATE_OBJECTS)            <-- The .o that we built
4537           #  $(PRIVATE_STATIC_LIBRARIES)   <-- The .a that we built
4538           #  $(TARGET_LIBGCC)              <-- libgcc.a
4539           #  $(PRIVATE_SHARED_LIBRARIES)   <-- The .so that we built
4540           #  $(PRIVATE_LDLIBS)             <-- System .so
4541           #  $(TARGET_CRTEND_O)            <-- crtend.o
4542           #
4543           # For now the above are approximated for executables by adding
4544           # crtbegin.o to the end of the ldflags and 'crtend.o' to the end
4545           # of 'libraries'.
4546           #
4547           # The NDK Android shared library link step looks as follows:
4548           #  $LDFLAGS
4549           #  $(PRIVATE_OBJECTS)            <-- The .o that we built
4550           #  -l,--whole-archive
4551           #  $(PRIVATE_WHOLE_STATIC_LIBRARIES)
4552           #  -l,--no-whole-archive
4553           #  $(PRIVATE_STATIC_LIBRARIES)   <-- The .a that we built
4554           #  $(TARGET_LIBGCC)              <-- libgcc.a
4555           #  $(PRIVATE_SHARED_LIBRARIES)   <-- The .so that we built
4556           #  $(PRIVATE_LDLIBS)             <-- System .so
4557           #
4558           # For now, assume that whole static libraries are not needed.
4559           #
4560           # For both executables and shared libraries, add the proper
4561           # libgcc.a to the start of libraries which puts it in the
4562           # proper spot after .o and .a files get linked in.
4563           #
4564           # TODO: The proper thing to do longer-tem would be proper gyp
4565           # support for a custom link command line.
4566           ['_toolset=="target"', {
4567             'cflags!': [
4568               '-pthread',  # Not supported by Android toolchain.
4569             ],
4570             'cflags': [
4571               '-ffunction-sections',
4572               '-funwind-tables',
4573               '-g',
4574               '-fstack-protector',
4575               '-fno-short-enums',
4576               '-finline-limit=64',
4577               '-Wa,--noexecstack',
4578               '<@(release_extra_cflags)',
4579             ],
4580             'defines': [
4581               'ANDROID',
4582               '__GNU_SOURCE=1',  # Necessary for clone()
4583               'USE_STLPORT=1',
4584               '_STLP_USE_PTR_SPECIALIZATIONS=1',
4585               'CHROME_BUILD_ID="<(chrome_build_id)"',
4586             ],
4587             'ldflags!': [
4588               '-pthread',  # Not supported by Android toolchain.
4589             ],
4590             'ldflags': [
4591               '-Wl,--no-undefined',
4592             ],
4593             'conditions': [
4594               ['component=="static_library"', {
4595                 'ldflags': [
4596                   '-Wl,--exclude-libs=ALL',
4597                 ],
4598               }],
4599               ['clang==1', {
4600                 'cflags': [
4601                   # Work around incompatibilities between bionic and clang
4602                   # headers.
4603                   '-D__compiler_offsetof=__builtin_offsetof',
4604                   '-Dnan=__builtin_nan',
4605                 ],
4606                 'conditions': [
4607                   ['target_arch=="arm"', {
4608                     'cflags': [
4609                       '-target arm-linux-androideabi',
4610                     ],
4611                     'ldflags': [
4612                       '-target arm-linux-androideabi',
4613                     ],
4614                   }],
4615                   ['target_arch=="ia32"', {
4616                     'cflags': [
4617                       '-target x86-linux-androideabi',
4618                     ],
4619                     'ldflags': [
4620                       '-target x86-linux-androideabi',
4621                     ],
4622                   }],
4623                   # Place holder for x64 support, not tested.
4624                   # TODO: Enable clang support for Android x64. http://crbug.com/346626
4625                   ['target_arch=="x64"', {
4626                     'cflags': [
4627                       '-target x86_64-linux-androideabi',
4628                     ],
4629                     'ldflags': [
4630                       '-target x86_64-linux-androideabi',
4631                     ],
4632                   }],
4633                 ],
4634               }],
4635               ['asan==1', {
4636                 'cflags': [
4637                   # Android build relies on -Wl,--gc-sections removing
4638                   # unreachable code. ASan instrumentation for globals inhibits
4639                   # this and results in a library with unresolvable relocations.
4640                   # TODO(eugenis): find a way to reenable this.
4641                   '-mllvm -asan-globals=0',
4642                 ],
4643                 'conditions': [
4644                   ['target_arch=="arm"', {
4645                     'ldflags': [
4646                       # TODO(hans): The ASan runtime is no longer automatically
4647                       # added to the link line when using -nostdlib. Can we
4648                       # stop adding -nostdlib? (crbug.com/423429)
4649                       '<!(cd <(DEPTH) && pwd -P)/<(make_clang_dir)/lib/clang/3.6.0/lib/linux/libclang_rt.asan-arm-android.so',
4650                     ],
4651                   }],
4652                 ],
4653               }],
4654               ['android_webview_build==0', {
4655                 'defines': [
4656                   # The NDK has these things, but doesn't define the constants
4657                   # to say that it does. Define them here instead.
4658                   'HAVE_SYS_UIO_H',
4659                 ],
4660                 'cflags': [
4661                   '--sysroot=<(android_ndk_sysroot)',
4662                 ],
4663                 'ldflags': [
4664                   '--sysroot=<(android_ndk_sysroot)',
4665                   '-nostdlib',
4666                 ],
4667                 'variables': {
4668                   'conditions': [
4669                     ['target_arch=="arm" and arm_thumb==1', {
4670                       'thumb_option%': '-mthumb',
4671                     }, {
4672                       'thumb_option%': '',
4673                     }],
4674                   ],
4675                 },
4676                 'libraries': [
4677                   '-l<(android_stlport_library)',
4678                   # Manually link the libgcc.a that the cross compiler uses.
4679                   '<!(<(android_toolchain)/*-gcc <(thumb_option) -print-libgcc-file-name)',
4680                   '-lc',
4681                   '-ldl',
4682                   '-lm',
4683                 ],
4684               }],
4685               ['android_webview_build==1', {
4686                 'cflags': [
4687                   # Android predefines this as 1; undefine it here so Chromium
4688                   # can redefine it later to be 2 for chromium code and unset
4689                   # for third party code. This works because cflags are added
4690                   # before defines.
4691                   '-U_FORTIFY_SOURCE',
4692                   # Disable any additional warnings enabled by the Android build system but which
4693                   # chromium does not build cleanly with (when treating warning as errors).
4694                   # Things that are part of -Wextra:
4695                   '-Wno-extra', # Enabled by -Wextra, but no specific flag
4696                   '-Wno-ignored-qualifiers',
4697                   '-Wno-type-limits',
4698                   '-Wno-unused-but-set-variable',
4699                 ],
4700                 'cflags_cc': [
4701                   # Other things unrelated to -Wextra:
4702                   '-Wno-non-virtual-dtor',
4703                   '-Wno-sign-promo',
4704                 ],
4705                 'libraries': [
4706                   '-ldl',
4707                 ],
4708               }],
4709               ['android_webview_build==1', {
4710                 'target_conditions': [
4711                   ['chromium_code==0', {
4712                     'cflags': [
4713                       # There is a class of warning which:
4714                       #  1) Android always enables and also treats as errors
4715                       #  2) Chromium ignores in third party code
4716                       # So we re-enable those warnings when building Android.
4717                       '-Wno-address',
4718                       '-Wno-format-security',
4719                       '-Wno-return-type',
4720                       '-Wno-sequence-point',
4721                     ],
4722                     'cflags_cc': [
4723                       '-Wno-non-virtual-dtor',
4724                     ],
4725                   }],
4726                 ],
4727               }],
4728               ['target_arch == "arm"', {
4729                 'ldflags': [
4730                   # Enable identical code folding to reduce size.
4731                   '-Wl,--icf=safe',
4732                 ],
4733               }],
4734               # NOTE: The stlport header include paths below are specified in
4735               # cflags rather than include_dirs because they need to come
4736               # after include_dirs. Think of them like system headers, but
4737               # don't use '-isystem' because the arm-linux-androideabi-4.4.3
4738               # toolchain (circa Gingerbread) will exhibit strange errors.
4739               # The include ordering here is important; change with caution.
4740               ['android_webview_build==0', {
4741                 'cflags': [
4742                   '-isystem<(android_stlport_include)',
4743                 ],
4744                 'conditions': [
4745                   ['target_arch=="arm" and arm_thumb==1', {
4746                     'ldflags': [ '-L<(android_stlport_libs_dir)/thumb' ]
4747                   }, {
4748                     'ldflags': [ '-L<(android_stlport_libs_dir)' ]
4749                   }],
4750                 ],
4751               }, { # else: android_webview_build!=0
4752                 'aosp_build_settings': {
4753                   # Specify that we want to statically link stlport from the
4754                   # NDK. This will provide all the include and library paths
4755                   # automatically at build time, and link the right library.
4756                   'LOCAL_NDK_STL_VARIANT': 'stlport_static',
4757                 },
4758               }],
4759               ['target_arch=="ia32"', {
4760                 # The x86 toolchain currently has problems with stack-protector.
4761                 'cflags!': [
4762                   '-fstack-protector',
4763                 ],
4764                 'cflags': [
4765                   '-fno-stack-protector',
4766                 ],
4767               }],
4768             ],
4769             'target_conditions': [
4770               ['_type=="executable"', {
4771                 # Force android tools to export the "main" symbol so they can be
4772                 # loaded on ICS using the run_pie wrapper. See crbug.com/373219.
4773                 # TODO(primiano): remove -fvisibility and -rdynamic flags below
4774                 # when ICS support will be dropped.
4775                 'cflags': [
4776                   '-fPIE',
4777                   '-fvisibility=default',
4778                 ],
4779                 'ldflags': [
4780                   '-Bdynamic',
4781                   '-Wl,--gc-sections',
4782                   '-Wl,-z,nocopyreloc',
4783                   '-pie',
4784                   '-rdynamic',
4785                   # crtbegin_dynamic.o should be the last item in ldflags.
4786                   '<(android_ndk_lib)/crtbegin_dynamic.o',
4787                 ],
4788                 'libraries': [
4789                   # crtend_android.o needs to be the last item in libraries.
4790                   # Do not add any libraries after this!
4791                   '<(android_ndk_lib)/crtend_android.o',
4792                 ],
4793               }],
4794               ['_type=="shared_library" or _type=="loadable_module"', {
4795                 'ldflags!': [
4796                   '-Wl,--exclude-libs=ALL',
4797                 ],
4798                 'ldflags': [
4799                   '-Wl,-shared,-Bsymbolic',
4800                 ],
4801                 'conditions': [
4802                   ['android_webview_build==0', {
4803                     'ldflags': [
4804                       # crtbegin_so.o should be the last item in ldflags.
4805                       '<(android_ndk_lib)/crtbegin_so.o',
4806                     ],
4807                     'libraries': [
4808                       # crtend_so.o needs to be the last item in libraries.
4809                       # Do not add any libraries after this!
4810                       '<(android_ndk_lib)/crtend_so.o',
4811                     ],
4812                   }],
4813                 ],
4814               }],
4815             ],
4816           }],
4817           # Settings for building host targets using the system toolchain.
4818           ['_toolset=="host"', {
4819             'cflags!': [
4820               # Due to issues in Clang build system, using ASan on 32-bit
4821               # binaries on x86_64 host is problematic.
4822               # TODO(eugenis): re-enable.
4823               '-fsanitize=address',
4824             ],
4825             'ldflags!': [
4826               '-fsanitize=address',
4827               '-Wl,-z,noexecstack',
4828               '-Wl,--gc-sections',
4829               '-Wl,-O1',
4830               '-Wl,--as-needed',
4831               '-Wl,--warn-shared-textrel',
4832               '-Wl,--fatal-warnings',
4833             ],
4834           }],
4835           # Settings for building host targets on mac.
4836           ['_toolset=="host" and host_os=="mac"', {
4837             'ldflags!': [
4838               '-Wl,-z,now',
4839               '-Wl,-z,relro',
4840             ],
4841           }],
4842         ],
4843       },
4844     }],
4845     ['OS=="solaris"', {
4846       'cflags!': ['-fvisibility=hidden'],
4847       'cflags_cc!': ['-fvisibility-inlines-hidden'],
4848     }],
4849     ['OS=="mac" or OS=="ios"', {
4850       'target_defaults': {
4851         'mac_bundle': 0,
4852         'xcode_settings': {
4853           'ALWAYS_SEARCH_USER_PATHS': 'NO',
4854           # Don't link in libarclite_macosx.a, see http://crbug.com/156530.
4855           'CLANG_LINK_OBJC_RUNTIME': 'NO',          # -fno-objc-link-runtime
4856           'COPY_PHASE_STRIP': 'NO',
4857           'GCC_C_LANGUAGE_STANDARD': 'c99',         # -std=c99
4858           'GCC_CW_ASM_SYNTAX': 'NO',                # No -fasm-blocks
4859           'GCC_ENABLE_CPP_EXCEPTIONS': 'NO',        # -fno-exceptions
4860           'GCC_ENABLE_CPP_RTTI': 'NO',              # -fno-rtti
4861           'GCC_ENABLE_PASCAL_STRINGS': 'NO',        # No -mpascal-strings
4862           # GCC_INLINES_ARE_PRIVATE_EXTERN maps to -fvisibility-inlines-hidden
4863           'GCC_INLINES_ARE_PRIVATE_EXTERN': 'YES',
4864           'GCC_OBJC_CALL_CXX_CDTORS': 'YES',        # -fobjc-call-cxx-cdtors
4865           'GCC_SYMBOLS_PRIVATE_EXTERN': 'YES',      # -fvisibility=hidden
4866           'GCC_THREADSAFE_STATICS': 'NO',           # -fno-threadsafe-statics
4867           'GCC_TREAT_WARNINGS_AS_ERRORS': 'YES',    # -Werror
4868           'GCC_VERSION': '4.2',
4869           'GCC_WARN_ABOUT_MISSING_NEWLINE': 'YES',  # -Wnewline-eof
4870           'USE_HEADERMAP': 'NO',
4871           'WARNING_CFLAGS': [
4872             '-Wall',
4873             '-Wendif-labels',
4874             '-Wextra',
4875             # Don't warn about unused function parameters.
4876             '-Wno-unused-parameter',
4877             # Don't warn about the "struct foo f = {0};" initialization
4878             # pattern.
4879             '-Wno-missing-field-initializers',
4880           ],
4881           'conditions': [
4882             ['chromium_mac_pch', {'GCC_PRECOMPILE_PREFIX_HEADER': 'YES'},
4883                                  {'GCC_PRECOMPILE_PREFIX_HEADER': 'NO'}
4884             ],
4885             # Note that the prebuilt Clang binaries should not be used for iOS
4886             # development except for ASan builds.
4887             ['clang==1', {
4888               'CLANG_CXX_LANGUAGE_STANDARD': 'c++11',  # -std=c++11
4889               # Warn if automatic synthesis is triggered with
4890               # the -Wobjc-missing-property-synthesis flag.
4891               'CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS': 'YES',
4892               'GCC_VERSION': 'com.apple.compilers.llvm.clang.1_0',
4893               'WARNING_CFLAGS': [
4894                 # This warns on selectors from Cocoa headers (-length, -set).
4895                 # cfe-dev is currently discussing the merits of this warning.
4896                 # TODO(thakis): Reevaluate what to do with this, based one
4897                 # cfe-dev discussion.
4898                 '-Wno-selector-type-mismatch',
4899               ],
4900               'conditions': [
4901                 ['clang_xcode==0', {
4902                   'CC': '$(SOURCE_ROOT)/<(clang_dir)/clang',
4903                   'LDPLUSPLUS': '$(SOURCE_ROOT)/<(clang_dir)/clang++',
4904                 }],
4905               ],
4906             }],
4907             ['clang==1 and clang_xcode==0 and clang_use_chrome_plugins==1', {
4908               'OTHER_CFLAGS': [
4909                 '<@(clang_chrome_plugins_flags)',
4910               ],
4911             }],
4912             ['clang==1 and clang_xcode==0 and clang_load!=""', {
4913               'OTHER_CFLAGS': [
4914                 '-Xclang', '-load', '-Xclang', '<(clang_load)',
4915               ],
4916             }],
4917             ['clang==1 and clang_xcode==0 and clang_add_plugin!=""', {
4918               'OTHER_CFLAGS': [
4919                 '-Xclang', '-add-plugin', '-Xclang', '<(clang_add_plugin)',
4920               ],
4921             }],
4922             ['clang==1 and "<(GENERATOR)"=="ninja"', {
4923               'OTHER_CFLAGS': [
4924                 # See http://crbug.com/110262
4925                 '-fcolor-diagnostics',
4926               ],
4927             }],
4928             ['OS=="ios" and target_subarch!="arm32" and \
4929               "<(GENERATOR)"=="xcode"', {
4930               'OTHER_CFLAGS': [
4931                 # TODO(ios): when building Chrome for iOS on 64-bit platform
4932                 # with Xcode, the -Wshorted-64-to-32 warning is automatically
4933                 # enabled. This cause failures when compiling protobuf code,
4934                 # so disable the warning. http://crbug.com/359107
4935                 '-Wno-shorten-64-to-32',
4936               ],
4937             }],
4938           ],
4939         },
4940         'conditions': [
4941           ['clang==1', {
4942             'variables': {
4943               'clang_dir': '../third_party/llvm-build/Release+Asserts/bin',
4944             },
4945           }],
4946           ['asan==1', {
4947             'xcode_settings': {
4948               'OTHER_CFLAGS': [
4949                 '-fsanitize=address',
4950                 '-mllvm -asan-globals=0',  # http://crbug.com/352073
4951                 '-gline-tables-only',
4952               ],
4953             },
4954           }],
4955           ['asan_coverage!=0', {
4956             'target_conditions': [
4957               ['_toolset=="target"', {
4958                 'cflags': [
4959                   '-mllvm -asan-coverage=<(asan_coverage)',
4960                 ],
4961               }],
4962             ],
4963           }],
4964         ],
4965         'target_conditions': [
4966           ['_type!="static_library"', {
4967             'xcode_settings': {'OTHER_LDFLAGS': ['-Wl,-search_paths_first']},
4968             'conditions': [
4969               ['asan==1', {
4970                 'xcode_settings': {
4971                   'OTHER_LDFLAGS': [
4972                     '-fsanitize=address',
4973                   ],
4974                 },
4975               }],
4976               ['mac_write_linker_maps==1', {
4977                 'xcode_settings': {
4978                   'OTHER_LDFLAGS': [
4979                     '-Wl,-map,>(_target_name).map',
4980                   ],
4981                 },
4982               }],
4983             ],
4984           }],
4985           ['_mac_bundle', {
4986             'xcode_settings': {'OTHER_LDFLAGS': ['-Wl,-ObjC']},
4987             'target_conditions': [
4988               ['_type=="executable"', {
4989                 'conditions': [
4990                   ['asan==1', {
4991                     'postbuilds': [
4992                       {
4993                         'variables': {
4994                           # Define copy_asan_dylib_path in a variable ending in
4995                           # _path so that gyp understands it's a path and
4996                           # performs proper relativization during dict merging.
4997                           'copy_asan_dylib_path':
4998                             'mac/copy_asan_runtime_dylib.sh',
4999                         },
5000                         'postbuild_name': 'Copy ASan runtime dylib',
5001                         'action': [
5002                           '<(copy_asan_dylib_path)',
5003                         ],
5004                       },
5005                     ],
5006                   }],
5007                 ],
5008               }],
5009             ],
5010           }],
5011         ],  # target_conditions
5012       },  # target_defaults
5013     }],  # OS=="mac" or OS=="ios"
5014     ['OS=="mac"', {
5015       'target_defaults': {
5016         'defines': [
5017           # Prevent Mac OS X AssertMacros.h from defining macros that collide
5018           # with common names, like 'check', 'require', and 'verify'.
5019           # (Included by system header. Also exists on iOS but not included.)
5020           # http://opensource.apple.com/source/CarbonHeaders/CarbonHeaders-18.1/AssertMacros.h
5021           '__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORE=0',
5022         ],
5023         'variables': {
5024           # These should end with %, but there seems to be a bug with % in
5025           # variables that are intended to be set to different values in
5026           # different targets, like these.
5027           'mac_pie': 1,        # Most executables can be position-independent.
5028           # Strip debugging symbols from the target.
5029           'mac_strip': '<(mac_strip_release)',
5030           'conditions': [
5031             ['asan==1', {
5032               'conditions': [
5033                 ['mac_want_real_dsym=="default"', {
5034                   'mac_real_dsym': 1,
5035                 }, {
5036                   'mac_real_dsym': '<(mac_want_real_dsym)'
5037                 }],
5038               ],
5039             }, {
5040               'conditions': [
5041                 ['mac_want_real_dsym=="default"', {
5042                   'mac_real_dsym': 0, # Fake .dSYMs are fine in most cases.
5043                 }, {
5044                   'mac_real_dsym': '<(mac_want_real_dsym)'
5045                 }],
5046               ],
5047             }],
5048           ],
5049         },
5050         'xcode_settings': {
5051           'GCC_DYNAMIC_NO_PIC': 'NO',               # No -mdynamic-no-pic
5052                                                     # (Equivalent to -fPIC)
5053           # MACOSX_DEPLOYMENT_TARGET maps to -mmacosx-version-min
5054           'MACOSX_DEPLOYMENT_TARGET': '<(mac_deployment_target)',
5055           # Keep pch files below xcodebuild/.
5056           'SHARED_PRECOMPS_DIR': '$(CONFIGURATION_BUILD_DIR)/SharedPrecompiledHeaders',
5057           'OTHER_CFLAGS': [
5058             # Someday this can be replaced by an 'GCC_STRICT_ALIASING': 'NO'
5059             # xcode_setting, but not until all downstream projects' mac bots are
5060             # using xcode >= 4.6, because that's when the default value of the
5061             # flag in the compiler switched.  Pre-4.6, the value 'NO' for that
5062             # setting is a no-op as far as xcode is concerned, but the compiler
5063             # behaves differently based on whether -fno-strict-aliasing is
5064             # specified or not.
5065             '-fno-strict-aliasing',  # See http://crbug.com/32204.
5066           ],
5067         },
5068         'target_conditions': [
5069           ['_type=="executable"', {
5070             'postbuilds': [
5071               {
5072                 # Arranges for data (heap) pages to be protected against
5073                 # code execution when running on Mac OS X 10.7 ("Lion"), and
5074                 # ensures that the position-independent executable (PIE) bit
5075                 # is set for ASLR when running on Mac OS X 10.5 ("Leopard").
5076                 'variables': {
5077                   # Define change_mach_o_flags in a variable ending in _path
5078                   # so that GYP understands it's a path and performs proper
5079                   # relativization during dict merging.
5080                   'change_mach_o_flags_path':
5081                       'mac/change_mach_o_flags_from_xcode.sh',
5082                   'change_mach_o_flags_options%': [
5083                   ],
5084                   'target_conditions': [
5085                     ['mac_pie==0 or release_valgrind_build==1', {
5086                       # Don't enable PIE if it's unwanted. It's unwanted if
5087                       # the target specifies mac_pie=0 or if building for
5088                       # Valgrind, because Valgrind doesn't understand slide.
5089                       # See the similar mac_pie/release_valgrind_build check
5090                       # below.
5091                       'change_mach_o_flags_options': [
5092                         '--no-pie',
5093                       ],
5094                     }],
5095                   ],
5096                 },
5097                 'postbuild_name': 'Change Mach-O Flags',
5098                 'action': [
5099                   '<(change_mach_o_flags_path)',
5100                   '>@(change_mach_o_flags_options)',
5101                 ],
5102               },
5103             ],
5104             'conditions': [
5105               ['asan==1', {
5106                 'variables': {
5107                  'asan_saves_file': 'asan.saves',
5108                 },
5109                 'xcode_settings': {
5110                   'CHROMIUM_STRIP_SAVE_FILE': '<(asan_saves_file)',
5111                 },
5112               }],
5113             ],
5114             'target_conditions': [
5115               ['mac_pie==1 and release_valgrind_build==0', {
5116                 # Turn on position-independence (ASLR) for executables. When
5117                 # PIE is on for the Chrome executables, the framework will
5118                 # also be subject to ASLR.
5119                 # Don't do this when building for Valgrind, because Valgrind
5120                 # doesn't understand slide. TODO: Make Valgrind on Mac OS X
5121                 # understand slide, and get rid of the Valgrind check.
5122                 'xcode_settings': {
5123                   'OTHER_LDFLAGS': [
5124                     '-Wl,-pie',  # Position-independent executable (MH_PIE)
5125                   ],
5126                 },
5127               }],
5128             ],
5129           }],
5130           ['(_type=="executable" or _type=="shared_library" or \
5131              _type=="loadable_module") and mac_strip!=0', {
5132             'target_conditions': [
5133               ['mac_real_dsym == 1', {
5134                 # To get a real .dSYM bundle produced by dsymutil, set the
5135                 # debug information format to dwarf-with-dsym.  Since
5136                 # strip_from_xcode will not be used, set Xcode to do the
5137                 # stripping as well.
5138                 'configurations': {
5139                   'Release_Base': {
5140                     'xcode_settings': {
5141                       'DEBUG_INFORMATION_FORMAT': 'dwarf-with-dsym',
5142                       'DEPLOYMENT_POSTPROCESSING': 'YES',
5143                       'STRIP_INSTALLED_PRODUCT': 'YES',
5144                       'target_conditions': [
5145                         ['_type=="shared_library" or _type=="loadable_module"', {
5146                           # The Xcode default is to strip debugging symbols
5147                           # only (-S).  Local symbols should be stripped as
5148                           # well, which will be handled by -x.  Xcode will
5149                           # continue to insert -S when stripping even when
5150                           # additional flags are added with STRIPFLAGS.
5151                           'STRIPFLAGS': '-x',
5152                         }],  # _type=="shared_library" or _type=="loadable_module"
5153                         ['_type=="executable"', {
5154                           'conditions': [
5155                             ['asan==1', {
5156                               'STRIPFLAGS': '-s $(CHROMIUM_STRIP_SAVE_FILE)',
5157                             }]
5158                           ],
5159                         }],  # _type=="executable" and asan==1
5160                       ],  # target_conditions
5161                     },  # xcode_settings
5162                   },  # configuration "Release"
5163                 },  # configurations
5164               }, {  # mac_real_dsym != 1
5165                 # To get a fast fake .dSYM bundle, use a post-build step to
5166                 # produce the .dSYM and strip the executable.  strip_from_xcode
5167                 # only operates in the Release configuration.
5168                 'postbuilds': [
5169                   {
5170                     'variables': {
5171                       # Define strip_from_xcode in a variable ending in _path
5172                       # so that gyp understands it's a path and performs proper
5173                       # relativization during dict merging.
5174                       'strip_from_xcode_path': 'mac/strip_from_xcode',
5175                     },
5176                     'postbuild_name': 'Strip If Needed',
5177                     'action': ['<(strip_from_xcode_path)'],
5178                   },
5179                 ],  # postbuilds
5180               }],  # mac_real_dsym
5181             ],  # target_conditions
5182           }],  # (_type=="executable" or _type=="shared_library" or
5183                #  _type=="loadable_module") and mac_strip!=0
5184         ],  # target_conditions
5185       },  # target_defaults
5186     }],  # OS=="mac"
5187     ['OS=="ios"', {
5188       'target_defaults': {
5189         'xcode_settings' : {
5190           'CLANG_CXX_LANGUAGE_STANDARD': 'c++11',
5191
5192           'conditions': [
5193             # Older Xcodes do not support -Wno-deprecated-register, so pass an
5194             # additional flag to suppress the "unknown compiler option" error.
5195             # Restrict this flag to builds that are either compiling with Xcode
5196             # or compiling with Xcode's Clang.  This will allow Ninja builds to
5197             # continue failing on unknown compiler options.
5198             # TODO(rohitrao): This flag is temporary and should be removed as
5199             # soon as the iOS bots are updated to use Xcode 5.1.
5200             ['clang_xcode==1', {
5201               'WARNING_CFLAGS': [
5202                 '-Wno-unknown-warning-option',
5203               ],
5204             }],
5205
5206             # Limit the valid architectures depending on "target_subarch".
5207             # This need to include the "arm" architectures but also the "x86"
5208             # ones (they are used when building for the simulator).
5209             ['target_subarch=="arm32"', {
5210               'VALID_ARCHS': ['armv7', 'i386'],
5211             }],
5212             ['target_subarch=="arm64"', {
5213               'VALID_ARCHS': ['arm64', 'x86_64'],
5214             }],
5215             ['target_subarch=="both"', {
5216               'VALID_ARCHS': ['arm64', 'armv7', 'x86_64', 'i386'],
5217             }],
5218             ['use_system_libcxx==1', {
5219               'target_conditions': [
5220                 # Only use libc++ when building target for iOS not when building
5221                 # tools for the host (OS X) as Mac targets OS X SDK 10.6 which
5222                 # does not support libc++.
5223                 ['_toolset=="target"', {
5224                   'CLANG_CXX_LIBRARY': 'libc++',  # -stdlib=libc++
5225                 }]
5226               ],
5227             }, {
5228               # The default for deployment target of 7.0+ is libc++, so force
5229               # the old behavior unless libc++ is enabled.
5230               'CLANG_CXX_LIBRARY': 'libstdc++',  # -stdlib=libstdc++
5231             }],
5232           ],
5233         },
5234         'target_conditions': [
5235           ['_toolset=="host"', {
5236             'xcode_settings': {
5237               'SDKROOT': 'macosx<(mac_sdk)',  # -isysroot
5238               'MACOSX_DEPLOYMENT_TARGET': '<(mac_deployment_target)',
5239               'VALID_ARCHS': [
5240                 'x86_64',
5241               ],
5242               'ARCHS': [
5243                 'x86_64',
5244               ],
5245             },
5246           }],
5247           ['_toolset=="target"', {
5248             'xcode_settings': {
5249               # This section should be for overriding host settings. But,
5250               # since we can't negate the iphone deployment target above, we
5251               # instead set it here for target only.
5252               'IPHONEOS_DEPLOYMENT_TARGET': '<(ios_deployment_target)',
5253               'ARCHS': ['$(ARCHS_STANDARD_INCLUDING_64_BIT)'],
5254             },
5255           }],
5256           ['_type=="executable"', {
5257             'configurations': {
5258               'Release_Base': {
5259                 'xcode_settings': {
5260                   'DEPLOYMENT_POSTPROCESSING': 'YES',
5261                   'STRIP_INSTALLED_PRODUCT': 'YES',
5262                 },
5263               },
5264               'Debug_Base': {
5265                 'xcode_settings': {
5266                   # Remove dSYM to reduce build time.
5267                   'DEBUG_INFORMATION_FORMAT': 'dwarf',
5268                 },
5269               },
5270             },
5271             'xcode_settings': {
5272               'conditions': [
5273                 ['chromium_ios_signing', {
5274                   # iOS SDK wants everything for device signed.
5275                   'CODE_SIGN_IDENTITY[sdk=iphoneos*]': 'iPhone Developer',
5276                 }, {
5277                   'CODE_SIGNING_REQUIRED': 'NO',
5278                   'CODE_SIGN_IDENTITY[sdk=iphoneos*]': '',
5279                 }],
5280               ],
5281             },
5282           }],
5283         ],  # target_conditions
5284       },  # target_defaults
5285     }],  # OS=="ios"
5286     ['OS=="win"', {
5287       'target_defaults': {
5288         'defines': [
5289           '_WIN32_WINNT=0x0602',
5290           'WINVER=0x0602',
5291           'WIN32',
5292           '_WINDOWS',
5293           'NOMINMAX',
5294           'PSAPI_VERSION=1',
5295           '_CRT_RAND_S',
5296           'CERT_CHAIN_PARA_HAS_EXTRA_FIELDS',
5297           'WIN32_LEAN_AND_MEAN',
5298           '_ATL_NO_OPENGL',
5299           # _HAS_EXCEPTIONS must match ExceptionHandling in msvs_settings.
5300           '_HAS_EXCEPTIONS=0',
5301         ],
5302         'conditions': [
5303           ['buildtype=="Official"', {
5304               # In official builds, targets can self-select an optimization
5305               # level by defining a variable named 'optimize', and setting it
5306               # to one of
5307               # - "size", optimizes for minimal code size - the default.
5308               # - "speed", optimizes for speed over code size.
5309               # - "max", whole program optimization and link-time code
5310               #   generation. This is very expensive and should be used
5311               #   sparingly.
5312               'variables': {
5313                 'optimize%': 'size',
5314               },
5315               'msvs_settings': {
5316                 'VCLinkerTool': {
5317                   # Set /LTCG for the official builds.
5318                   'LinkTimeCodeGeneration': '1',
5319                 },
5320               },
5321               'target_conditions': [
5322                 ['optimize=="size"', {
5323                     'msvs_settings': {
5324                       'VCCLCompilerTool': {
5325                         # 1, optimizeMinSpace, Minimize Size (/O1)
5326                         'Optimization': '1',
5327                         # 2, favorSize - Favor small code (/Os)
5328                         'FavorSizeOrSpeed': '2',
5329                       },
5330                     },
5331                   },
5332                 ],
5333                 ['optimize=="speed"', {
5334                     'msvs_settings': {
5335                       'VCCLCompilerTool': {
5336                         # 2, optimizeMaxSpeed, Maximize Speed (/O2)
5337                         'Optimization': '2',
5338                         # 1, favorSpeed - Favor fast code (/Ot)
5339                         'FavorSizeOrSpeed': '1',
5340                       },
5341                     },
5342                   },
5343                 ],
5344                 ['optimize=="max"', {
5345                     # Disable Warning 4702 ("Unreachable code") for the WPO/PGO
5346                     # builds. Probably anything that this would catch that
5347                     # wouldn't be caught in a normal build isn't going to
5348                     # actually be a bug, so the incremental value of C4702 for
5349                     # PGO builds is likely very small.
5350                     'msvs_disabled_warnings': [
5351                       4702
5352                     ],
5353                     'msvs_settings': {
5354                       'VCCLCompilerTool': {
5355                         # 2, optimizeMaxSpeed, Maximize Speed (/O2)
5356                         'Optimization': '2',
5357                         # 1, favorSpeed - Favor fast code (/Ot)
5358                         'FavorSizeOrSpeed': '1',
5359                         # This implies link time code generation.
5360                         'WholeProgramOptimization': 'true',
5361                       },
5362                     },
5363                   },
5364                 ],
5365               ],
5366             },
5367           ],
5368           ['secure_atl', {
5369             'defines': [
5370               '_SECURE_ATL',
5371             ],
5372           }],
5373           ['msvs_express', {
5374             'configurations': {
5375               'x86_Base': {
5376                 'msvs_settings': {
5377                   'VCLinkerTool': {
5378                     'AdditionalLibraryDirectories':
5379                       ['<(windows_driver_kit_path)/lib/ATL/i386'],
5380                   },
5381                   'VCLibrarianTool': {
5382                     'AdditionalLibraryDirectories':
5383                       ['<(windows_driver_kit_path)/lib/ATL/i386'],
5384                   },
5385                 },
5386               },
5387               'x64_Base': {
5388                 'msvs_settings': {
5389                   'VCLibrarianTool': {
5390                     'AdditionalLibraryDirectories':
5391                       ['<(windows_driver_kit_path)/lib/ATL/amd64'],
5392                   },
5393                   'VCLinkerTool': {
5394                     'AdditionalLibraryDirectories':
5395                       ['<(windows_driver_kit_path)/lib/ATL/amd64'],
5396                   },
5397                 },
5398               },
5399             },
5400             # https://code.google.com/p/chromium/issues/detail?id=372451#c20
5401             # Warning 4702 ("Unreachable code") should be re-enabled once
5402             # Express users are updated to VS2013 Update 2.
5403             'msvs_disabled_warnings': [
5404               4702
5405             ],
5406             'msvs_settings': {
5407               'VCCLCompilerTool': {
5408                 'AdditionalOptions!': [
5409                     '/Zc:inline',  # Not supported on non-updated Express.
5410                 ],
5411               },
5412               'VCLinkerTool': {
5413                 # Explicitly required when using the ATL with express
5414                 'AdditionalDependencies': ['atlthunk.lib'],
5415
5416                 # ATL 8.0 included in WDK 7.1 makes the linker to generate
5417                 # almost eight hundred LNK4254 and LNK4078 warnings:
5418                 #   - warning LNK4254: section 'ATL' (50000040) merged into
5419                 #     '.rdata' (40000040) with different attributes
5420                 #   - warning LNK4078: multiple 'ATL' sections found with
5421                 #     different attributes
5422                 'AdditionalOptions': ['/ignore:4254', '/ignore:4078'],
5423               },
5424             },
5425             'msvs_system_include_dirs': [
5426               '<(windows_driver_kit_path)/inc/atl71',
5427               '<(windows_driver_kit_path)/inc/mfc42',
5428             ],
5429           }],
5430         ],
5431         'msvs_system_include_dirs': [
5432           '<(windows_sdk_path)/Include/shared',
5433           '<(windows_sdk_path)/Include/um',
5434           '<(windows_sdk_path)/Include/winrt',
5435           '$(VSInstallDir)/VC/atlmfc/include',
5436         ],
5437         'msvs_cygwin_shell': 0,
5438         'msvs_disabled_warnings': [
5439           # C4127: conditional expression is constant
5440           # This warning can in theory catch dead code and other problems, but
5441           # triggers in far too many desirable cases where the conditional
5442           # expression is either set by macros or corresponds some legitimate
5443           # compile-time constant expression (due to constant template args,
5444           # conditionals comparing the sizes of different types, etc.).  Some of
5445           # these can be worked around, but it's not worth it.
5446           4127,
5447
5448           # C4351: new behavior: elements of array 'array' will be default
5449           #        initialized
5450           # This is a silly "warning" that basically just alerts you that the
5451           # compiler is going to actually follow the language spec like it's
5452           # supposed to, instead of not following it like old buggy versions
5453           # did.  There's absolutely no reason to turn this on.
5454           4351,
5455
5456           # C4355: 'this': used in base member initializer list
5457           # It's commonly useful to pass |this| to objects in a class'
5458           # initializer list.  While this warning can catch real bugs, most of
5459           # the time the constructors in question don't attempt to call methods
5460           # on the passed-in pointer (until later), and annotating every legit
5461           # usage of this is simply more hassle than the warning is worth.
5462           4355,
5463
5464           # C4503: 'identifier': decorated name length exceeded, name was
5465           #        truncated
5466           # This only means that some long error messages might have truncated
5467           # identifiers in the presence of lots of templates.  It has no effect
5468           # on program correctness and there's no real reason to waste time
5469           # trying to prevent it.
5470           4503,
5471
5472           # C4611: interaction between 'function' and C++ object destruction is
5473           #        non-portable
5474           # This warning is unavoidable when using e.g. setjmp/longjmp.  MSDN
5475           # suggests using exceptions instead of setjmp/longjmp for C++, but
5476           # Chromium code compiles without exception support.  We therefore have
5477           # to use setjmp/longjmp for e.g. JPEG decode error handling, which
5478           # means we have to turn off this warning (and be careful about how
5479           # object destruction happens in such cases).
5480           4611,
5481
5482           # TODO(maruel): These warnings are level 4. They will be slowly
5483           # removed as code is fixed.
5484           4100, # Unreferenced formal parameter
5485           4121, # Alignment of a member was sensitive to packing
5486           4189, # Local variable is initialized but not referenced
5487           4244, # Conversion from 'type1' to 'type2', possible loss of data
5488           4481, # Nonstandard extension used: override specifier 'keyword'
5489           4505, # Unreferenced local function has been removed
5490           4510, # Default constructor could not be generated
5491           4512, # Assignment operator could not be generated
5492           4610, # Object can never be instantiated
5493         ],
5494         'msvs_settings': {
5495           'VCCLCompilerTool': {
5496             'AdditionalOptions': ['/MP'],
5497             'MinimalRebuild': 'false',
5498             'BufferSecurityCheck': 'true',
5499             'EnableFunctionLevelLinking': 'true',
5500             'RuntimeTypeInfo': 'false',
5501             'WarningLevel': '4',
5502             'WarnAsError': 'true',
5503             'DebugInformationFormat': '3',
5504             # ExceptionHandling must match _HAS_EXCEPTIONS above.
5505             'ExceptionHandling': '0',
5506           },
5507           'VCLibrarianTool': {
5508             'AdditionalOptions': ['/ignore:4221'],
5509             'AdditionalLibraryDirectories': [
5510               '<(windows_sdk_path)/Lib/win8/um/x86',
5511             ],
5512           },
5513           'VCLinkerTool': {
5514             'AdditionalDependencies': [
5515               'wininet.lib',
5516               'dnsapi.lib',
5517               'version.lib',
5518               'msimg32.lib',
5519               'ws2_32.lib',
5520               'usp10.lib',
5521               'psapi.lib',
5522               'dbghelp.lib',
5523               'winmm.lib',
5524               'shlwapi.lib',
5525             ],
5526             'AdditionalLibraryDirectories': [
5527               '<(windows_sdk_path)/Lib/win8/um/x86',
5528             ],
5529             'GenerateDebugInformation': 'true',
5530             'MapFileName': '$(OutDir)\\$(TargetName).map',
5531             'ImportLibrary': '$(OutDir)\\lib\\$(TargetName).lib',
5532             'FixedBaseAddress': '1',
5533             # SubSystem values:
5534             #   0 == not set
5535             #   1 == /SUBSYSTEM:CONSOLE
5536             #   2 == /SUBSYSTEM:WINDOWS
5537             # Most of the executables we'll ever create are tests
5538             # and utilities with console output.
5539             'SubSystem': '1',
5540           },
5541           'VCMIDLTool': {
5542             'GenerateStublessProxies': 'true',
5543             'TypeLibraryName': '$(InputName).tlb',
5544             'OutputDirectory': '$(IntDir)',
5545             'HeaderFileName': '$(InputName).h',
5546             'DLLDataFileName': '$(InputName).dlldata.c',
5547             'InterfaceIdentifierFileName': '$(InputName)_i.c',
5548             'ProxyFileName': '$(InputName)_p.c',
5549           },
5550           'VCResourceCompilerTool': {
5551             'Culture' : '1033',
5552             'AdditionalIncludeDirectories': [
5553               '<(DEPTH)',
5554               '<(SHARED_INTERMEDIATE_DIR)',
5555             ],
5556           },
5557           'target_conditions': [
5558             ['_type=="executable"', {
5559               'VCManifestTool': {
5560                 'EmbedManifest': 'true',
5561               },
5562             }],
5563             ['_type=="executable" and ">(win_exe_compatibility_manifest)"!=""', {
5564               'VCManifestTool': {
5565                 'AdditionalManifestFiles': [
5566                   '>(win_exe_compatibility_manifest)',
5567                 ],
5568               },
5569             }],
5570           ],
5571           'conditions': [
5572             ['clang==1', {
5573               # Building with Clang on Windows is a work in progress and very
5574               # experimental. See crbug.com/82385.
5575               'VCCLCompilerTool': {
5576                 'WarnAsError': 'false',
5577                 'RuntimeTypeInfo': 'false',
5578                 'AdditionalOptions': [
5579                   '-fmsc-version=1800',
5580                   '/fallback',
5581
5582                   # Many files use intrinsics without including this header.
5583                   # TODO(hans): Fix those files, or move this to sub-GYPs.
5584                   '/FIIntrin.h',
5585
5586                   # TODO(hans): Make this list shorter eventually.
5587                   '-Qunused-arguments',
5588                   '-Wno-c++11-compat-deprecated-writable-strings',
5589                   '-Wno-deprecated-declarations',
5590                   '-Wno-empty-body',
5591                   '-Wno-enum-conversion',
5592                   '-Wno-extra-tokens',
5593                   '-Wno-ignored-attributes',
5594                   '-Wno-incompatible-pointer-types',
5595                   '-Wno-int-to-void-pointer-cast',
5596                   '-Wno-invalid-noreturn',
5597                   '-Wno-logical-op-parentheses',
5598                   '-Wno-microsoft',
5599                   '-Wno-missing-braces',
5600                   '-Wno-missing-declarations',
5601                   '-Wno-msvc-include',
5602                   '-Wno-null-dereference',
5603                   '-Wno-overloaded-virtual',
5604                   '-Wno-parentheses',
5605                   '-Wno-pointer-sign',
5606                   '-Wno-reorder',
5607                   '-Wno-return-type-c-linkage',
5608                   '-Wno-self-assign',
5609                   '-Wno-sometimes-uninitialized',
5610                   '-Wno-switch',
5611                   '-Wno-tautological-compare',
5612                   '-Wno-unknown-pragmas',
5613                   '-Wno-unsequenced',
5614                   '-Wno-unused-function',
5615                   '-Wno-unused-private-field',
5616                   '-Wno-unused-value',
5617                   '-Wno-unused-variable',
5618                   '-Wno-unused-local-typedef',  # http://crbug.com/411648
5619                   '-Wno-inconsistent-missing-override', #http://crbug.com/428099
5620                 ],
5621               },
5622             }],
5623             ['asan==1', {
5624               # ASan on Windows is a work in progress and very experimental.
5625               # See crbug.com/345874.
5626               'VCCLCompilerTool': {
5627                 'AdditionalOptions': [
5628                   '-fsanitize=address',
5629                 ],
5630                 'AdditionalIncludeDirectories': [
5631                   # MSVC needs to be able to find the sanitizer headers when
5632                   # invoked via /fallback. This is critical for using macros
5633                   # like ASAN_UNPOISON_MEMORY_REGION in files where we fall
5634                   # back.
5635                   '<(DEPTH)/<(make_clang_dir)/lib/clang/3.6.0/include_sanitizer',
5636                 ],
5637               },
5638               'VCLinkerTool': {
5639                 'AdditionalLibraryDirectories': [
5640                   # TODO(hans): If make_clang_dir is absolute, this breaks.
5641                   '<(DEPTH)/<(make_clang_dir)/lib/clang/3.6.0/lib/windows',
5642                 ],
5643               },
5644               'target_conditions': [
5645                 ['component=="shared_library"', {
5646                   'VCLinkerTool': {
5647                     'AdditionalDependencies': [
5648                        'clang_rt.asan_dynamic-i386.lib',
5649                        'clang_rt.asan_dynamic_runtime_thunk-i386.lib',
5650                     ],
5651                   },
5652                 }],
5653                 ['_type=="executable" and component=="static_library"', {
5654                   'VCLinkerTool': {
5655                     'AdditionalDependencies': [
5656                        'clang_rt.asan-i386.lib',
5657                     ],
5658                   },
5659                 }],
5660                 ['(_type=="shared_library" or _type=="loadable_module") and component=="static_library"', {
5661                   'VCLinkerTool': {
5662                     'AdditionalDependencies': [
5663                        'clang_rt.asan_dll_thunk-i386.lib',
5664                     ],
5665                   },
5666                 }],
5667               ],
5668             }],
5669           ],
5670         },
5671       },
5672     }],
5673     ['disable_nacl==1', {
5674       'target_defaults': {
5675         'defines': [
5676           'DISABLE_NACL',
5677         ],
5678       },
5679     }],
5680     ['OS=="win" and msvs_use_common_linker_extras', {
5681       'target_defaults': {
5682         'msvs_settings': {
5683           'VCLinkerTool': {
5684             'DelayLoadDLLs': [
5685               'dbghelp.dll',
5686               'dwmapi.dll',
5687               'shell32.dll',
5688               'uxtheme.dll',
5689             ],
5690           },
5691         },
5692         'configurations': {
5693           'x86_Base': {
5694             'msvs_settings': {
5695               'VCLinkerTool': {
5696                 'AdditionalOptions': [
5697                   '/safeseh',
5698                   '/dynamicbase',
5699                   '/ignore:4199',
5700                   '/ignore:4221',
5701                   '/nxcompat',
5702                 ],
5703                 'conditions': [
5704                   ['syzyasan==0', {
5705                     'AdditionalOptions': ['/largeaddressaware'],
5706                   }],
5707                 ],
5708               },
5709             },
5710           },
5711           'x64_Base': {
5712             'msvs_settings': {
5713               'VCLinkerTool': {
5714                 'AdditionalOptions': [
5715                   # safeseh is not compatible with x64
5716                   '/dynamicbase',
5717                   '/ignore:4199',
5718                   '/ignore:4221',
5719                   '/nxcompat',
5720                 ],
5721               },
5722             },
5723           },
5724         },
5725       },
5726     }],
5727     ['enable_new_npdevice_api==1', {
5728       'target_defaults': {
5729         'defines': [
5730           'ENABLE_NEW_NPDEVICE_API',
5731         ],
5732       },
5733     }],
5734     # Don't warn about the "typedef 'foo' locally defined but not used"
5735     # for gcc 4.8 and higher.
5736     # TODO: remove this flag once all builds work. See crbug.com/227506
5737     ['gcc_version>=48 and clang==0', {
5738       'target_defaults': {
5739         'cflags': [
5740           '-Wno-unused-local-typedefs',
5741         ],
5742       },
5743     }],
5744     ['gcc_version>=48 and clang==0 and host_clang==1', {
5745       'target_defaults': {
5746         'target_conditions': [
5747           ['_toolset=="host"', { 'cflags!': [ '-Wno-unused-local-typedefs' ]}],
5748         ],
5749       },
5750     }],
5751     # In the android webview build, force host targets to be compiled with clang
5752     # as the hermetic host gcc is very old on some platforms. This is already
5753     # the default on the current development version of AOSP but we force it
5754     # here in case we need to compile against an older release version. We also
5755     # explicitly set it to false for target binaries to avoid causing problems
5756     # for the work to enable clang by default in AOSP. We also force the use of
5757     # libstdc++ on host as peculiarities of the android gyp backend mean that
5758     # using libc++ doesn't work, and Chromium doesn't yet require a more modern
5759     # C++ library.
5760     ['android_webview_build==1', {
5761       'target_defaults': {
5762         'target_conditions': [
5763           ['_toolset=="host"', {
5764             'aosp_build_settings': {
5765               'LOCAL_CLANG': 'true',
5766               'LOCAL_CXX_STL': 'libstdc++',
5767             },
5768           }, {  # else: _toolset != "host"
5769             'aosp_build_settings': {
5770               'LOCAL_CLANG': 'false',
5771             },
5772           }],
5773         ],
5774       },
5775     }],
5776     # We need a special case to handle the android webview build on mac because
5777     # the host gcc there doesn't accept this flag, but the target gcc may
5778     # require it.
5779     ['gcc_version>=48 and android_webview_build==1 and host_os=="mac"', {
5780       'target_defaults': {
5781         'target_conditions': [
5782           ['_toolset=="host"', {
5783             'cflags!': [
5784               '-Wno-unused-local-typedefs',
5785             ],
5786           }],
5787         ],
5788       },
5789     }],
5790     ['clang==1 and ((OS!="mac" and OS!="ios") or clang_xcode==0) '
5791         'and OS!="win"', {
5792       'make_global_settings': [
5793         ['CC', '<(make_clang_dir)/bin/clang'],
5794         ['CXX', '<(make_clang_dir)/bin/clang++'],
5795         ['CC.host', '$(CC)'],
5796         ['CXX.host', '$(CXX)'],
5797       ],
5798     }],
5799     ['clang==1 and OS=="win"', {
5800       'make_global_settings': [
5801         # On Windows, gyp's ninja generator only looks at CC.
5802         ['CC', '<(make_clang_dir)/bin/clang-cl'],
5803       ],
5804     }],
5805     ['OS=="android" and clang==0', {
5806       # Hardcode the compiler names in the Makefile so that
5807       # it won't depend on the environment at make time.
5808       'make_global_settings': [
5809         ['CC', '<!(/bin/echo -n <(android_toolchain)/*-gcc)'],
5810         ['CXX', '<!(/bin/echo -n <(android_toolchain)/*-g++)'],
5811         ['CC.host', '<(host_cc)'],
5812         ['CXX.host', '<(host_cxx)'],
5813       ],
5814     }],
5815     ['OS=="linux" and target_arch=="mipsel"', {
5816       'make_global_settings': [
5817         ['CC', '<(sysroot)/../bin/mipsel-linux-gnu-gcc'],
5818         ['CXX', '<(sysroot)/../bin/mipsel-linux-gnu-g++'],
5819         ['CC.host', '<(host_cc)'],
5820         ['CXX.host', '<(host_cxx)'],
5821       ],
5822     }],
5823     ['OS=="linux" and target_arch=="arm" and host_arch!="arm" and chromeos==0 and clang==0', {
5824       # Set default ARM cross compiling on linux.  These can be overridden
5825       # using CC/CXX/etc environment variables.
5826       'make_global_settings': [
5827         ['CC', '<!(which arm-linux-gnueabihf-gcc)'],
5828         ['CXX', '<!(which arm-linux-gnueabihf-g++)'],
5829         ['CC.host', '<(host_cc)'],
5830         ['CXX.host', '<(host_cxx)'],
5831       ],
5832     }],
5833
5834     # TODO(yyanagisawa): supports GENERATOR==make
5835     #  make generator doesn't support CC_wrapper without CC
5836     #  in make_global_settings yet.
5837     ['use_goma==1 and ("<(GENERATOR)"=="ninja" or clang==1)', {
5838       'make_global_settings': [
5839        ['CC_wrapper', '<(gomadir)/gomacc'],
5840        ['CXX_wrapper', '<(gomadir)/gomacc'],
5841        ['CC.host_wrapper', '<(gomadir)/gomacc'],
5842        ['CXX.host_wrapper', '<(gomadir)/gomacc'],
5843       ],
5844     }],
5845     ['use_lto==1', {
5846       'target_defaults': {
5847         'target_conditions': [
5848           ['_toolset=="target"', {
5849             'cflags': [
5850               '-flto',
5851               '-ffat-lto-objects',
5852             ],
5853           }],
5854         ],
5855       },
5856     }],
5857     ['use_lto==1 or use_lto_o2==1', {
5858       'target_defaults': {
5859         'target_conditions': [
5860           ['_toolset=="target"', {
5861             'ldflags': [
5862               '-flto=32',
5863             ],
5864           }],
5865         ],
5866       },
5867     }],
5868   ],
5869   'xcode_settings': {
5870     # DON'T ADD ANYTHING NEW TO THIS BLOCK UNLESS YOU REALLY REALLY NEED IT!
5871     # This block adds *project-wide* configuration settings to each project
5872     # file.  It's almost always wrong to put things here.  Specify your
5873     # custom xcode_settings in target_defaults to add them to targets instead.
5874
5875     'conditions': [
5876       # In an Xcode Project Info window, the "Base SDK for All Configurations"
5877       # setting sets the SDK on a project-wide basis. In order to get the
5878       # configured SDK to show properly in the Xcode UI, SDKROOT must be set
5879       # here at the project level.
5880       ['OS=="mac"', {
5881         'conditions': [
5882           ['mac_sdk_path==""', {
5883             'SDKROOT': 'macosx<(mac_sdk)',  # -isysroot
5884           }, {
5885             'SDKROOT': '<(mac_sdk_path)',  # -isysroot
5886           }],
5887         ],
5888       }],
5889       ['OS=="ios"', {
5890         'conditions': [
5891           ['ios_sdk_path==""', {
5892             'conditions': [
5893               # TODO(justincohen): Ninja only supports simulator for now.
5894               ['"<(GENERATOR)"=="xcode"', {
5895                 'SDKROOT': 'iphoneos<(ios_sdk)',  # -isysroot
5896               }, {
5897                 'SDKROOT': 'iphonesimulator<(ios_sdk)',  # -isysroot
5898               }],
5899             ],
5900           }, {
5901             'SDKROOT': '<(ios_sdk_path)',  # -isysroot
5902           }],
5903         ],
5904       }],
5905       ['OS=="ios"', {
5906         # Target both iPhone and iPad.
5907         'TARGETED_DEVICE_FAMILY': '1,2',
5908       }, {  # OS!="ios"
5909         'conditions': [
5910           ['target_arch=="x64"', {
5911             'ARCHS': [
5912               'x86_64'
5913             ],
5914           }],
5915           ['target_arch=="ia32"', {
5916             'ARCHS': [
5917               'i386'
5918             ],
5919           }],
5920         ],
5921       }],
5922     ],
5923
5924     # The Xcode generator will look for an xcode_settings section at the root
5925     # of each dict and use it to apply settings on a file-wide basis.  Most
5926     # settings should not be here, they should be in target-specific
5927     # xcode_settings sections, or better yet, should use non-Xcode-specific
5928     # settings in target dicts.  SYMROOT is a special case, because many other
5929     # Xcode variables depend on it, including variables such as
5930     # PROJECT_DERIVED_FILE_DIR.  When a source group corresponding to something
5931     # like PROJECT_DERIVED_FILE_DIR is added to a project, in order for the
5932     # files to appear (when present) in the UI as actual files and not red
5933     # red "missing file" proxies, the correct path to PROJECT_DERIVED_FILE_DIR,
5934     # and therefore SYMROOT, needs to be set at the project level.
5935     'SYMROOT': '<(DEPTH)/xcodebuild',
5936   },
5937 }