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