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