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