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