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