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