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