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