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