Revert of Restored disable print preview policy. (patchset #8 id:140001 of https...
[chromium-blink-merge.git] / build / common.gypi
blob6f4223b15eb59c2f9eea622480f777039de0f960
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     'conditions': [
1505       # Enable the Syzygy optimization step for the official builds.
1506       ['OS=="win" and buildtype=="Official" and syzyasan!=1', {
1507         'syzygy_optimize%': 1,
1508       }, {
1509         'syzygy_optimize%': 0,
1510       }],
1511       # Get binutils version so we can enable debug fission if we can.
1512       ['os_posix==1 and OS!="mac" and OS!="ios"', {
1513         'conditions': [
1514           # compiler_version doesn't work with clang
1515           # TODO(mithro): Land https://codereview.chromium.org/199793014/ so
1516           # compiler_version works with clang.
1517           # TODO(glider): set clang to 1 earlier for ASan and TSan builds so
1518           # that it takes effect here.
1519           ['clang==0 and asan==0 and lsan==0 and tsan==0 and msan==0 and ubsan==0 and ubsan_vptr==0', {
1520             'binutils_version%': '<!pymod_do_main(compiler_version target assembler)',
1521           }],
1522           # On Android we know the binutils version in the toolchain.
1523           ['OS=="android"', {
1524             'binutils_version%': 222,
1525           }],
1526           ['host_arch=="x64"', {
1527             'binutils_dir%': 'third_party/binutils/Linux_x64/Release/bin',
1528           }],
1529           ['host_arch=="ia32"', {
1530             'binutils_dir%': 'third_party/binutils/Linux_ia32/Release/bin',
1531           }],
1532           # Our version of binutils in third_party/binutils
1533           ['linux_use_bundled_binutils==1', {
1534             'binutils_version%': 224,
1535           }],
1536         ],
1537       }, {
1538         'binutils_version%': 0,
1539       }],
1540       # The version of GCC in use, set later in platforms that use GCC and have
1541       # not explicitly chosen to build with clang. Currently, this means all
1542       # platforms except Windows, Mac and iOS.
1543       # TODO(glider): set clang to 1 earlier for ASan and TSan builds so that
1544       # it takes effect here.
1545       ['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', {
1546         'conditions': [
1547           ['OS=="android" and android_webview_build==0', {
1548             'host_gcc_version%': '<!pymod_do_main(compiler_version host compiler)',
1549             # We directly set the gcc version since we know what we use.
1550             'gcc_version%': 49,
1551           }],
1552           ['OS=="android" and android_webview_build==1', {
1553             # Android WebView uses a hermetic clang toolchain for host builds.
1554             'host_gcc_version%': 0,
1555             # Android WebView uses the GCC toolchain from the Android build.
1556             'gcc_version%': 48,
1557           }],
1558           ['OS!="android"', {
1559             'host_gcc_version%': '<!pymod_do_main(compiler_version host compiler)',
1560             'gcc_version%': '<!pymod_do_main(compiler_version target compiler)',
1561           }],
1562         ],
1563       }, {
1564         'host_gcc_version%': 0,
1565         'gcc_version%': 0,
1566       }],
1567       ['OS=="win" and "<!pymod_do_main(dir_exists <(windows_sdk_default_path))"=="True"', {
1568         'windows_sdk_path%': '<(windows_sdk_default_path)',
1569       }, {
1570         'windows_sdk_path%': 'C:/Program Files (x86)/Windows Kits/8.0',
1571       }],
1572       ['OS=="win" and "<!pymod_do_main(dir_exists <(directx_sdk_default_path))"=="True"', {
1573         'directx_sdk_path%': '<(directx_sdk_default_path)',
1574       }, {
1575         'directx_sdk_path%': '$(DXSDK_DIR)',
1576       }],
1577       ['OS=="win"', {
1578         'windows_driver_kit_path%': '$(WDK_DIR)',
1579       }],
1580       ['os_posix==1 and OS!="mac" and OS!="ios"', {
1581         'conditions': [
1582           ['target_arch=="mipsel" or target_arch=="mips64el"', {
1583             'werror%': '',
1584             'disable_nacl%': 1,
1585             'nacl_untrusted_build%': 0,
1586             'use_allocator%': 'none',
1587           }],
1588           ['OS=="linux" and target_arch=="mipsel"', {
1589             'sysroot%': '<(sysroot)',
1590             'CXX%': '<(CXX)',
1591           }],
1592           # All Chrome builds have breakpad symbols, but only process the
1593           # symbols from official builds.
1594           ['(branding=="Chrome" and buildtype=="Official")', {
1595             'linux_dump_symbols%': 1,
1597             # Omit unwind support in official release builds to save space. We
1598             # can use breakpad for these builds.
1599             'release_unwind_tables%': 0,
1601             'conditions': [
1602               # For official builds, use a 64-bit linker to avoid running out
1603               # of address space. The buildbots should have a 64-bit kernel
1604               # and a 64-bit libc installed.
1605               ['host_arch=="ia32" and target_arch=="ia32"', {
1606                 'linux_use_bundled_gold%': '1',
1607                 'binutils_dir%': 'third_party/binutils/Linux_x64/Release/bin',
1608               }],
1609             ],
1610           }],
1611         ],
1612       }],  # os_posix==1 and OS!="mac" and OS!="ios"
1613       ['OS=="ios"', {
1614         'disable_nacl%': 1,
1615         'enable_background%': 0,
1616         'icu_use_data_file_flag%': 1,
1617         'enable_web_speech%': 0,
1618         'use_system_libxml%': 1,
1619         'use_system_sqlite%': 1,
1620         'locales==': [
1621           'ar', 'ca', 'cs', 'da', 'de', 'el', 'en-GB', 'en-US', 'es', 'es-MX',
1622           'fi', 'fr', 'he', 'hi', 'hr', 'hu', 'id', 'it', 'ja', 'ko', 'ms',
1623           'nb', 'nl', 'pl', 'pt', 'pt-PT', 'ro', 'ru', 'sk', 'sv', 'th', 'tr',
1624           'uk', 'vi', 'zh-CN', 'zh-TW',
1625         ],
1627         # The Mac SDK is set for iOS builds and passed through to Mac
1628         # sub-builds. This allows the Mac sub-build SDK in an iOS build to be
1629         # overridden from the command line the same way it is for a Mac build.
1630         'mac_sdk%': '<!(python <(DEPTH)/build/mac/find_sdk.py 10.6)',
1632         # iOS SDK and deployment target support.  The |ios_sdk| value is left
1633         # blank so that when it is set in the project files it will be the
1634         # "current" iOS SDK.  Forcing a specific SDK even if it is "current"
1635         # causes Xcode to spit out a warning for every single project file for
1636         # not using the "current" SDK.
1637         'ios_sdk%': '',
1638         'ios_sdk_path%': '',
1639         'ios_deployment_target%': '7.0',
1641         'conditions': [
1642           # ios_product_name is set to the name of the .app bundle as it should
1643           # appear on disk.
1644           ['branding=="Chrome"', {
1645             'ios_product_name%': 'Chrome',
1646           }, { # else: branding!="Chrome"
1647             'ios_product_name%': 'Chromium',
1648           }],
1649           ['branding=="Chrome" and buildtype=="Official"', {
1650             'ios_breakpad%': 1,
1651           }, { # else: branding!="Chrome" or buildtype!="Official"
1652             'ios_breakpad%': 0,
1653           }],
1654         ],
1655       }],  # OS=="ios"
1656       ['OS=="android"', {
1657         # Location of Android NDK.
1658         'variables': {
1659           'variables': {
1660             # Unfortunately we have to use absolute paths to the SDK/NDK because
1661             # they're passed to ant which uses a different relative path from
1662             # gyp.
1663             'android_ndk_root%': '<!(cd <(DEPTH) && pwd -P)/third_party/android_tools/ndk/',
1664             'android_sdk_root%': '<!(cd <(DEPTH) && pwd -P)/third_party/android_tools/sdk/',
1665             'android_host_arch%': '<!(uname -m)',
1666             # Android API-level of the SDK used for compilation.
1667             'android_sdk_version%': '20',
1668             'android_sdk_build_tools_version%': '20.0.0',
1669             'host_os%': "<!(uname -s | sed -e 's/Linux/linux/;s/Darwin/mac/')",
1670           },
1671           # Copy conditionally-set variables out one scope.
1672           'android_ndk_root%': '<(android_ndk_root)',
1673           'android_sdk_root%': '<(android_sdk_root)',
1674           'android_sdk_version%': '<(android_sdk_version)',
1675           'android_stlport_root': '<(android_ndk_root)/sources/cxx-stl/stlport',
1676           'host_os%': '<(host_os)',
1678           'android_sdk%': '<(android_sdk_root)/platforms/android-<(android_sdk_version)',
1679           # Android SDK build tools (e.g. dx, aapt, aidl)
1680           'android_sdk_tools%': '<(android_sdk_root)/build-tools/<(android_sdk_build_tools_version)',
1682           # Android API level 14 is ICS (Android 4.0) which is the minimum
1683           # platform requirement for Chrome on Android, we use it for native
1684           # code compilation.
1685           'conditions': [
1686             ['target_arch == "ia32"', {
1687               'android_app_abi%': 'x86',
1688               'android_gdbserver%': '<(android_ndk_root)/prebuilt/android-x86/gdbserver/gdbserver',
1689               'android_ndk_sysroot%': '<(android_ndk_root)/platforms/android-14/arch-x86',
1690               'android_ndk_lib_dir%': 'usr/lib',
1691               'android_toolchain%': '<(android_ndk_root)/toolchains/x86-4.9/prebuilt/<(host_os)-<(android_host_arch)/bin',
1692             }],
1693             ['target_arch == "x64"', {
1694               'android_app_abi%': 'x86_64',
1695               'android_gdbserver%': '<(android_ndk_root)/prebuilt/android-x86_64/gdbserver/gdbserver',
1696               'android_ndk_sysroot%': '<(android_ndk_root)/platforms/android-L/arch-x86_64',
1697               'android_ndk_lib_dir%': 'usr/lib64',
1698               'android_toolchain%': '<(android_ndk_root)/toolchains/x86_64-4.9/prebuilt/<(host_os)-<(android_host_arch)/bin',
1699             }],
1700             ['target_arch=="arm"', {
1701               'conditions': [
1702                 ['arm_version<7', {
1703                   'android_app_abi%': 'armeabi',
1704                 }, {
1705                   'android_app_abi%': 'armeabi-v7a',
1706                 }],
1707               ],
1708               'android_gdbserver%': '<(android_ndk_root)/prebuilt/android-arm/gdbserver/gdbserver',
1709               'android_ndk_sysroot%': '<(android_ndk_root)/platforms/android-14/arch-arm',
1710               'android_ndk_lib_dir%': 'usr/lib',
1711               'android_toolchain%': '<(android_ndk_root)/toolchains/arm-linux-androideabi-4.9/prebuilt/<(host_os)-<(android_host_arch)/bin',
1712             }],
1713             ['target_arch == "arm64"', {
1714               'android_app_abi%': 'arm64-v8a',
1715               'android_gdbserver%': '<(android_ndk_root)/prebuilt/android-arm64/gdbserver/gdbserver',
1716               'android_ndk_sysroot%': '<(android_ndk_root)/platforms/android-L/arch-arm64',
1717               'android_ndk_lib_dir%': 'usr/lib',
1718               'android_toolchain%': '<(android_ndk_root)/toolchains/aarch64-linux-android-4.9/prebuilt/<(host_os)-<(android_host_arch)/bin',
1719             }],
1720             ['target_arch == "mipsel"', {
1721               'android_app_abi%': 'mips',
1722               'android_gdbserver%': '<(android_ndk_root)/prebuilt/android-mips/gdbserver/gdbserver',
1723               'android_ndk_sysroot%': '<(android_ndk_root)/platforms/android-14/arch-mips',
1724               'android_ndk_lib_dir%': 'usr/lib',
1725               'android_toolchain%': '<(android_ndk_root)/toolchains/mipsel-linux-android-4.9/prebuilt/<(host_os)-<(android_host_arch)/bin',
1726             }],
1727             ['target_arch == "mips64el"', {
1728               'android_app_abi%': 'mips64',
1729               'android_gdbserver%': '<(android_ndk_root)/prebuilt/android-mips64/gdbserver/gdbserver',
1730               'android_ndk_sysroot%': '<(android_ndk_root)/platforms/android-L/arch-mips64',
1731               'android_ndk_lib_dir%': 'usr/lib64',
1732               'android_toolchain%': '<(android_ndk_root)/toolchains/mips64el-linux-android-4.9/prebuilt/<(host_os)-<(android_host_arch)/bin',
1733               'gcc_version%': 49,
1734             }],
1735           ],
1736         },
1737         # Copy conditionally-set variables out one scope.
1738         'android_app_abi%': '<(android_app_abi)',
1739         'android_gdbserver%': '<(android_gdbserver)',
1740         'android_ndk_root%': '<(android_ndk_root)',
1741         'android_ndk_sysroot%': '<(android_ndk_sysroot)',
1742         'android_sdk_root%': '<(android_sdk_root)',
1743         'android_sdk_version%': '<(android_sdk_version)',
1744         'android_toolchain%': '<(android_toolchain)',
1746         'android_ndk_include': '<(android_ndk_sysroot)/usr/include',
1747         'android_ndk_lib': '<(android_ndk_sysroot)/<(android_ndk_lib_dir)',
1748         'android_sdk_tools%': '<(android_sdk_tools)',
1749         'android_sdk%': '<(android_sdk)',
1750         'android_sdk_jar%': '<(android_sdk)/android.jar',
1752         'android_stlport_root': '<(android_stlport_root)',
1753         'android_stlport_include': '<(android_stlport_root)/stlport',
1754         'android_stlport_libs_dir': '<(android_stlport_root)/libs/<(android_app_abi)',
1755         'host_os%': '<(host_os)',
1757         # Location of the "objcopy" binary, used by both gyp and scripts.
1758         'android_objcopy%' : '<!(/bin/echo -n <(android_toolchain)/*-objcopy)',
1760         # Location of the "strip" binary, used by both gyp and scripts.
1761         'android_strip%' : '<!(/bin/echo -n <(android_toolchain)/*-strip)',
1763         # Location of the "readelf" binary.
1764         'android_readelf%' : '<!(/bin/echo -n <(android_toolchain)/*-readelf)',
1766         # Determines whether we should optimize JNI generation at the cost of
1767         # breaking assumptions in the build system that when inputs have changed
1768         # the outputs should always change as well.  This is meant purely for
1769         # developer builds, to avoid spurious re-linking of native files.
1770         'optimize_jni_generation%': '<(optimize_jni_generation)',
1772         # Always uses openssl.
1773         'use_openssl%': 1,
1774         'use_openssl_certs%': 1,
1776         'proprietary_codecs%': '<(proprietary_codecs)',
1777         'safe_browsing%': 1,
1778         'enable_web_speech%': 0,
1779         'java_bridge%': 1,
1780         'build_ffmpegsumo%': 0,
1781         'use_allocator%': 'none',
1783         # Disable Native Client.
1784         'disable_nacl%': 1,
1786         # Android does not support background apps.
1787         'enable_background%': 0,
1789         # Sessions are store separately in the Java side.
1790         'enable_session_service%': 0,
1792         'p2p_apis%' : 0,
1794         'gtest_target_type%': 'shared_library',
1796         # Uses system APIs for decoding audio and video.
1797         'use_libffmpeg%': '0',
1799         # When building as part of the Android system, use system libraries
1800         # where possible to reduce ROM size.
1801         'use_system_icu%': '<(android_webview_build)',
1802         'use_system_stlport%': '<(android_webview_build)',
1804         # Copy it out one scope.
1805         'android_webview_build%': '<(android_webview_build)',
1807         # Default android linker script for shared library exports.
1808         'android_linker_script%': '<(SHARED_INTERMEDIATE_DIR)/android_exports.lst',
1809       }],  # OS=="android"
1810       ['embedded==1', {
1811         'use_system_fontconfig%': 0,
1812       }, {
1813         'use_system_fontconfig%': 1,
1814       }],
1815       ['chromecast==1', {
1816         'enable_mpeg2ts_stream_parser%': 1,
1817         'ffmpeg_branding%': 'Chrome',
1818         'ozone_platform_ozonex%': 1,
1819         'use_playready%': 0,
1820         'conditions': [
1821           ['target_arch=="arm"', {
1822             'arm_arch%': '',
1823             'arm_tune%': 'cortex-a9',
1824             'arm_thumb%': 1,
1825             'video_hole%': 1,
1826           }],
1827         ],
1828       }],
1829       ['android_webview_build==1', {
1830         # When building the WebView in the Android tree, jarjar will remap all
1831         # the class names, so the JNI generator needs to know this.
1832         'jni_generator_jarjar_file': '../android_webview/build/jarjar-rules.txt',
1833       }],
1834       ['OS=="linux" and target_arch!="mipsel"', {
1835         # TODO(thakis): This is here to measure perf for a while.
1836         'clang%': 1,
1837       }],  # OS=="mac"
1838       ['OS=="mac"', {
1839         'conditions': [
1840           # All Chrome builds have breakpad symbols, but only process the
1841           # symbols from official builds.
1842           ['(branding=="Chrome" and buildtype=="Official")', {
1843             'mac_strip_release%': 1,
1844           }],
1845         ],
1846       }],  # OS=="mac"
1847       ['OS=="mac" or OS=="ios"', {
1848         'clang%': 1,
1850         'variables': {
1851           # Mac OS X SDK and deployment target support.  The SDK identifies
1852           # the version of the system headers that will be used, and
1853           # corresponds to the MAC_OS_X_VERSION_MAX_ALLOWED compile-time
1854           # macro.  "Maximum allowed" refers to the operating system version
1855           # whose APIs are available in the headers.  The deployment target
1856           # identifies the minimum system version that the built products are
1857           # expected to function on.  It corresponds to the
1858           # MAC_OS_X_VERSION_MIN_REQUIRED compile-time macro.  To ensure these
1859           # macros are available, #include <AvailabilityMacros.h>.  Additional
1860           # documentation on these macros is available at
1861           # http://developer.apple.com/mac/library/technotes/tn2002/tn2064.html#SECTION3
1862           # Chrome normally builds with the Mac OS X 10.6 SDK and sets the
1863           # deployment target to 10.6.  Other projects, such as O3D, may
1864           # override these defaults.
1866           # Normally, mac_sdk_min is used to find an SDK that Xcode knows
1867           # about that is at least the specified version. In official builds,
1868           # the SDK must match mac_sdk_min exactly. If the SDK is installed
1869           # someplace that Xcode doesn't know about, set mac_sdk_path to the
1870           # path to the SDK; when set to a non-empty string, SDK detection
1871           # based on mac_sdk_min will be bypassed entirely.
1872           'mac_sdk_min%': '10.6',
1873           'mac_sdk_path%': '',
1875           'mac_deployment_target%': '10.6',
1876         },
1878         'mac_sdk_min': '<(mac_sdk_min)',
1879         'mac_sdk_path': '<(mac_sdk_path)',
1880         'mac_deployment_target': '<(mac_deployment_target)',
1882         # Compile in Breakpad support by default so that it can be
1883         # tested, even if it is not enabled by default at runtime.
1884         'mac_breakpad_compiled_in%': 1,
1885         'conditions': [
1886           # mac_product_name is set to the name of the .app bundle as it should
1887           # appear on disk.  This duplicates data from
1888           # chrome/app/theme/chromium/BRANDING and
1889           # chrome/app/theme/google_chrome/BRANDING, but is necessary to get
1890           # these names into the build system.
1891           ['branding=="Chrome"', {
1892             'mac_product_name%': 'Google Chrome',
1893           }, { # else: branding!="Chrome"
1894             'mac_product_name%': 'Chromium',
1895           }],
1897           ['branding=="Chrome" and buildtype=="Official"', {
1898             'mac_sdk%': '<!(python <(DEPTH)/build/mac/find_sdk.py --verify <(mac_sdk_min) --sdk_path=<(mac_sdk_path))',
1899             # Enable uploading crash dumps.
1900             'mac_breakpad_uploads%': 1,
1901             # Enable dumping symbols at build time for use by Mac Breakpad.
1902             'mac_breakpad%': 1,
1903             # Enable Keystone auto-update support.
1904             'mac_keystone%': 1,
1905           }, { # else: branding!="Chrome" or buildtype!="Official"
1906             'mac_sdk%': '<!(python <(DEPTH)/build/mac/find_sdk.py <(mac_sdk_min))',
1907             'mac_breakpad_uploads%': 0,
1908             'mac_breakpad%': 0,
1909             'mac_keystone%': 0,
1910           }],
1911         ],
1912       }],  # OS=="mac" or OS=="ios"
1913       ['OS=="win"', {
1914         'conditions': [
1915           # This is the architecture convention used in WinSDK paths.
1916           ['target_arch=="ia32"', {
1917             'winsdk_arch%': 'x86',
1918           },{
1919             'winsdk_arch%': '<(target_arch)',
1920           }],
1921           ['component=="shared_library"', {
1922             'win_use_allocator_shim%': 0,
1923           },{
1924             # Turn on multiple dll by default on Windows when in static_library.
1925             'chrome_multiple_dll%': 1,
1926           }],
1927           ['asan==1', {
1928             'win_use_allocator_shim%': 0,
1929           }],
1930           ['component=="shared_library" and "<(GENERATOR)"=="ninja"', {
1931             # Only enabled by default for ninja because it's buggy in VS.
1932             # Not enabled for component=static_library because some targets
1933             # are too large and the toolchain fails due to the size of the
1934             # .obj files.
1935             'incremental_chrome_dll%': 1,
1936           }],
1937           # Don't do incremental linking for large modules on 32-bit or when
1938           # component=static_library as the toolchain fails due to the size of
1939           # the .ilk files.
1940           ['MSVS_OS_BITS==32 or component=="static_library"', {
1941             'msvs_large_module_debug_link_mode%': '1',  # No
1942           },{
1943             'msvs_large_module_debug_link_mode%': '2',  # Yes
1944           }],
1945           ['MSVS_VERSION=="2013e"', {
1946             'msvs_express%': 1,
1947             'secure_atl%': 0,
1948           },{
1949             'msvs_express%': 0,
1950             'secure_atl%': 1,
1951           }],
1952         ],
1953         'nacl_win64_defines': [
1954           # This flag is used to minimize dependencies when building
1955           # Native Client loader for 64-bit Windows.
1956           'NACL_WIN64',
1957         ],
1958       }],
1960       ['os_posix==1 and chromeos==0 and OS!="android" and OS!="ios" and embedded==0', {
1961         'use_cups%': 1,
1962       }, {
1963         'use_cups%': 0,
1964       }],
1966       ['enable_plugins==1 and (OS=="linux" or OS=="mac" or OS=="win")', {
1967         'enable_pepper_cdms%': 1,
1968       }, {
1969         'enable_pepper_cdms%': 0,
1970       }],
1972       ['OS=="android"', {
1973         'enable_browser_cdms%': 1,
1974       }, {
1975         'enable_browser_cdms%': 0,
1976       }],
1978       # Native Client glibc toolchain is enabled
1979       # by default except on arm, mips and mips64.
1980       ['target_arch=="arm" or target_arch=="mipsel" or target_arch=="mips64el"', {
1981         'disable_glibc%': 1,
1982       }, {
1983         'disable_glibc%': 0,
1984       }],
1986       # Set the relative path from this file to the GYP file of the JPEG
1987       # library used by Chromium.
1988       ['use_system_libjpeg==1 or use_libjpeg_turbo==0', {
1989         # Configuration for using the system libjeg is here.
1990         'libjpeg_gyp_path': '../third_party/libjpeg/libjpeg.gyp',
1991       }, {
1992         'libjpeg_gyp_path': '../third_party/libjpeg_turbo/libjpeg.gyp',
1993       }],
1995       # Options controlling the use of GConf (the classic GNOME configuration
1996       # system) and GIO, which contains GSettings (the new GNOME config system).
1997       ['chromeos==1 or embedded==1', {
1998         'use_gconf%': 0,
1999         'use_gio%': 0,
2000       }, {
2001         'use_gconf%': 1,
2002         'use_gio%': 1,
2003       }],
2005       # Set up -D and -E flags passed into grit.
2006       ['branding=="Chrome"', {
2007         # TODO(mmoss) The .grd files look for _google_chrome, but for
2008         # consistency they should look for google_chrome_build like C++.
2009         'grit_defines': ['-D', '_google_chrome',
2010                          '-E', 'CHROMIUM_BUILD=google_chrome'],
2011       }, {
2012         'grit_defines': ['-D', '_chromium',
2013                          '-E', 'CHROMIUM_BUILD=chromium'],
2014       }],
2015       ['chromeos==1', {
2016         'grit_defines': ['-D', 'chromeos', '-D', 'scale_factors=2x'],
2017       }],
2018       ['desktop_linux==1', {
2019         'grit_defines': ['-D', 'desktop_linux'],
2020       }],
2021       ['toolkit_views==1', {
2022         'grit_defines': ['-D', 'toolkit_views'],
2023       }],
2024       ['use_aura==1', {
2025         'grit_defines': ['-D', 'use_aura'],
2026       }],
2027       ['use_ash==1', {
2028         'grit_defines': ['-D', 'use_ash'],
2029       }],
2030       ['use_nss==1', {
2031         'grit_defines': ['-D', 'use_nss'],
2032       }],
2033       ['use_ozone==1', {
2034         'grit_defines': ['-D', 'use_ozone'],
2035       }],
2036       ['image_loader_extension==1', {
2037         'grit_defines': ['-D', 'image_loader_extension'],
2038       }],
2039       ['remoting==1', {
2040         'grit_defines': ['-D', 'remoting'],
2041       }],
2042       ['use_titlecase_in_grd==1', {
2043         'grit_defines': ['-D', 'use_titlecase'],
2044       }],
2045       ['use_third_party_translations==1', {
2046         'grit_defines': ['-D', 'use_third_party_translations'],
2047         'locales': [
2048           'ast', 'bs', 'ca@valencia', 'en-AU', 'eo', 'eu', 'gl', 'hy', 'ia',
2049           'ka', 'ku', 'kw', 'ms', 'ug'
2050         ],
2051       }],
2052       ['OS=="android"', {
2053         'grit_defines': ['-t', 'android',
2054                          '-E', 'ANDROID_JAVA_TAGGED_ONLY=true'],
2055       }],
2056       ['OS=="mac" or OS=="ios"', {
2057         'grit_defines': ['-D', 'scale_factors=2x'],
2058       }],
2059       ['OS == "ios"', {
2060         'grit_defines': [
2061           '-t', 'ios',
2062           # iOS uses a whitelist to filter resources.
2063           '-w', '<(DEPTH)/build/ios/grit_whitelist.txt'
2064         ],
2066         # Enable host builds when generating with ninja-ios.
2067         'conditions': [
2068           ['"<(GENERATOR)"=="ninja"', {
2069             'host_os%': "mac",
2070           }],
2072           # TODO(sdefresne): Remove the target_subarch check once Apple has
2073           # upstreamed the support for "arm64". http://crbug.com/341453
2074           ['target_subarch!="arm32" or "<(GENERATOR)"=="xcode"', {
2075             'clang_xcode%': 1,
2076           }],
2077         ],
2078       }],
2079       ['enable_extensions==1', {
2080         'grit_defines': ['-D', 'enable_extensions'],
2081       }],
2082       ['enable_plugins!=0', {
2083         'grit_defines': ['-D', 'enable_plugins'],
2084       }],
2085       ['enable_printing!=0', {
2086         'grit_defines': ['-D', 'enable_printing'],
2087       }],
2088       ['enable_printing==1', {
2089         'grit_defines': ['-D', 'enable_full_printing'],
2090       }],
2091       ['enable_themes==1', {
2092         'grit_defines': ['-D', 'enable_themes'],
2093       }],
2094       ['enable_app_list==1', {
2095         'grit_defines': ['-D', 'enable_app_list'],
2096       }],
2097       ['enable_settings_app==1', {
2098         'grit_defines': ['-D', 'enable_settings_app'],
2099       }],
2100       ['enable_google_now==1', {
2101         'grit_defines': ['-D', 'enable_google_now'],
2102       }],
2103       ['use_concatenated_impulse_responses==1', {
2104         'grit_defines': ['-D', 'use_concatenated_impulse_responses'],
2105       }],
2106       ['enable_webrtc==1', {
2107         'grit_defines': ['-D', 'enable_webrtc'],
2108       }],
2109       ['enable_hangout_services_extension==1', {
2110         'grit_defines': ['-D', 'enable_hangout_services_extension'],
2111       }],
2112       ['enable_task_manager==1', {
2113         'grit_defines': ['-D', 'enable_task_manager'],
2114       }],
2115       ['notifications==1', {
2116         'grit_defines': ['-D', 'enable_notifications'],
2117       }],
2118       ['enable_wifi_bootstrapping==1', {
2119         'grit_defines': ['-D', 'enable_wifi_bootstrapping'],
2120       }],
2121       ['enable_resource_whitelist_generation==1 and OS!="win"', {
2122         'grit_rc_header_format': ['-h', '#define {textual_id} _Pragma("whitelisted_resource_{numeric_id}") {numeric_id}'],
2123       }],
2124       ['enable_resource_whitelist_generation==1 and OS=="win"', {
2125         'grit_rc_header_format': ['-h', '#define {textual_id} __pragma(message("whitelisted_resource_{numeric_id}")) {numeric_id}'],
2126       }],
2127       ['enable_mdns==1 or OS=="mac"', {
2128         'grit_defines': ['-D', 'enable_service_discovery'],
2129         'enable_service_discovery%': 1
2130       }],
2131       ['clang_use_chrome_plugins==1 and OS!="win"', {
2132         'clang_chrome_plugins_flags': [
2133           '<!@(<(DEPTH)/tools/clang/scripts/plugin_flags.sh)'
2134         ],
2135       }],
2136       ['asan==1 or msan==1 or lsan==1 or tsan==1', {
2137         'clang%': 1,
2138         'use_allocator%': 'none',
2139         'use_sanitizer_options%': 1,
2140       }],
2141       ['asan==1 and OS=="linux" and chromeos==0', {
2142         'use_custom_libcxx%': 1,
2143       }],
2144       ['ubsan==1', {
2145         'clang%': 1,
2146       }],
2147       ['ubsan_vptr==1', {
2148         'clang%': 1,
2149       }],
2150       ['asan==1 and OS=="mac"', {
2151         # TODO(glider): we do not strip ASan binaries until the dynamic ASan
2152         # runtime is fully adopted. See http://crbug.com/242503.
2153         'mac_strip_release': 0,
2154       }],
2155       ['tsan==1', {
2156         'use_custom_libcxx%': 1,
2157       }],
2158       ['msan==1', {
2159         # Use a just-built, MSan-instrumented libc++ instead of the system-wide
2160         # libstdc++. This is required to avoid false positive reports whenever
2161         # the C++ standard library is used.
2162         'use_custom_libcxx%': 1,
2163         # Running the V8-generated code on an ARM simulator is a powerful hack
2164         # that allows the tool to see the memory accesses from JITted code.
2165         # Without this flag, JS code causes false positive reports from MSan.
2166         'v8_target_arch': 'arm64',
2167       }],
2169       ['OS=="linux" and clang_type_profiler==1', {
2170         'clang%': 1,
2171         'clang_use_chrome_plugins%': 0,
2172         'conditions': [
2173           ['host_arch=="x64"', {
2174             'make_clang_dir%': 'third_party/llvm-allocated-type/Linux_x64',
2175           }],
2176           ['host_arch=="ia32"', {
2177             # 32-bit Clang is unsupported.  It may not build.  Put your 32-bit
2178             # Clang in this directory at your own risk if needed for some
2179             # purpose (e.g. to compare 32-bit and 64-bit behavior like memory
2180             # usage).  Any failure by this compiler should not close the tree.
2181             'make_clang_dir%': 'third_party/llvm-allocated-type/Linux_ia32',
2182           }],
2183         ],
2184       }],
2186       ['OS=="win"', {
2187         # The Clang plugins don't currently work on Windows.
2188         # TODO(hans): One day, this will work. (crbug.com/82385)
2189         'clang_use_chrome_plugins%': 0,
2190       }],
2192       # On valgrind bots, override the optimizer settings so we don't inline too
2193       # much and make the stacks harder to figure out.
2194       #
2195       # TODO(rnk): Kill off variables that no one else uses and just implement
2196       # them under a build_for_tool== condition.
2197       ['build_for_tool=="memcheck" or build_for_tool=="tsan"', {
2198         # gcc flags
2199         'mac_debug_optimization': '1',
2200         'mac_release_optimization': '1',
2201         'release_optimize': '1',
2202         'no_gc_sections': 1,
2203         'debug_extra_cflags': '-g -fno-inline -fno-omit-frame-pointer '
2204                               '-fno-builtin -fno-optimize-sibling-calls',
2205         'release_extra_cflags': '-g -fno-inline -fno-omit-frame-pointer '
2206                                 '-fno-builtin -fno-optimize-sibling-calls',
2208         # MSVS flags for TSan on Pin and Windows.
2209         'win_debug_RuntimeChecks': '0',
2210         'win_debug_disable_iterator_debugging': '1',
2211         'win_debug_Optimization': '1',
2212         'win_debug_InlineFunctionExpansion': '0',
2213         'win_release_InlineFunctionExpansion': '0',
2214         'win_release_OmitFramePointers': '0',
2216         'use_allocator': 'tcmalloc',
2217         'release_valgrind_build': 1,
2218         'werror': '',
2219         'component': 'static_library',
2220         'use_system_zlib': 0,
2221       }],
2223       # Build tweaks for DrMemory.
2224       # TODO(rnk): Combine with tsan config to share the builder.
2225       # http://crbug.com/108155
2226       ['build_for_tool=="drmemory"', {
2227         # These runtime checks force initialization of stack vars which blocks
2228         # DrMemory's uninit detection.
2229         'win_debug_RuntimeChecks': '0',
2230         # Iterator debugging is slow.
2231         'win_debug_disable_iterator_debugging': '1',
2232         # Try to disable optimizations that mess up stacks in a release build.
2233         # DrM-i#1054 (http://code.google.com/p/drmemory/issues/detail?id=1054)
2234         # /O2 and /Ob0 (disable inline) cannot be used together because of a
2235         # compiler bug, so we use /Ob1 instead.
2236         'win_release_InlineFunctionExpansion': '1',
2237         'win_release_OmitFramePointers': '0',
2238         # Ditto for debug, to support bumping win_debug_Optimization.
2239         'win_debug_InlineFunctionExpansion': 0,
2240         'win_debug_OmitFramePointers': 0,
2241         # Keep the code under #ifndef NVALGRIND.
2242         'release_valgrind_build': 1,
2243       }],
2245       # Enable RLZ on Win, Mac, iOS and ChromeOS.
2246       ['branding=="Chrome" and (OS=="win" or OS=="mac" or OS=="ios" or chromeos==1)', {
2247         'enable_rlz%': 1,
2248       }],
2250       # Set default compiler flags depending on ARM version.
2251       ['arm_version==6 and android_webview_build==0', {
2252         'arm_arch%': 'armv6',
2253         'arm_tune%': '',
2254         'arm_fpu%': 'vfp',
2255         'arm_float_abi%': 'softfp',
2256         'arm_thumb%': 0,
2257       }],
2258       ['arm_version==7 and android_webview_build==0', {
2259         'arm_arch%': 'armv7-a',
2260         'arm_tune%': 'generic-armv7-a',
2261         'conditions': [
2262           ['arm_neon==1', {
2263             'arm_fpu%': 'neon',
2264           }, {
2265             'arm_fpu%': 'vfpv3-d16',
2266           }],
2267         ],
2268         # Change the default to hard once the armhf transition is complete.
2269         'arm_float_abi%': 'softfp',
2270         'arm_thumb%': 1,
2271       }],
2273       ['android_webview_build==1', {
2274         # The WebView build gets its cpu-specific flags from the Android build system.
2275         'arm_arch%': '',
2276         'arm_tune%': '',
2277         'arm_fpu%': '',
2278         'arm_float_abi%': '',
2279         'arm_thumb%': 0,
2280       }],
2282       # Enable brlapi by default for chromeos.
2283       [ 'chromeos==1', {
2284         'use_brlapi%': 1,
2285       }],
2287       ['use_ozone==1 and ozone_auto_platforms==1', {
2288         # Use test as the default platform.
2289         'ozone_platform%': 'test',
2291         # Build all platforms whose deps are in install-build-deps.sh.
2292         # Only these platforms will be compile tested by buildbots.
2293         'ozone_platform_dri%': 1,
2294         'ozone_platform_test%': 1,
2295         'ozone_platform_egltest%': 1,
2296       }],
2298       ['desktop_linux==1 and use_aura==1 and use_x11==1', {
2299         'use_clipboard_aurax11%': 1,
2300       }],
2302       ['OS=="win" and use_goma==1', {
2303         # goma doesn't support pch yet.
2304         'chromium_win_pch': 0,
2305         # goma doesn't support PDB yet, so win_z7=1 or fastbuild=1.
2306         'conditions': [
2307           ['win_z7==0 and fastbuild==0', {
2308             'fastbuild': 1,
2309           }],
2310         ],
2311       }],
2313       ['OS=="win" and (clang==1 or asan==1)', {
2314         'chromium_win_pch': 0,
2315       }],
2317       ['host_clang==1', {
2318         'host_cc': '<(make_clang_dir)/bin/clang',
2319         'host_cxx': '<(make_clang_dir)/bin/clang++',
2320       }, {
2321         'host_cc': '<!(which gcc)',
2322         'host_cxx': '<!(which g++)',
2323       }],
2325       # The seccomp-bpf sandbox is only supported on five architectures
2326       # currently.
2327       # Do not disable seccomp_bpf anywhere without talking to
2328       # security@chromium.org!
2329       ['((OS=="linux" or OS=="android") and '
2330            '(target_arch=="ia32" or target_arch=="x64" or '
2331              'target_arch=="arm" or target_arch=="mipsel" or '
2332              'target_arch=="arm64"))', {
2333          'use_seccomp_bpf%': 1,
2334       }, {
2335          'use_seccomp_bpf%': 0,
2336       }],
2337     ],
2339     # The path to the ANGLE library.
2340     'angle_path': '<(DEPTH)/third_party/angle',
2342     # List of default apps to install in new profiles.  The first list contains
2343     # the source files as found in svn.  The second list, used only for linux,
2344     # contains the destination location for each of the files.  When a crx
2345     # is added or removed from the list, the chrome/browser/resources/
2346     # default_apps/external_extensions.json file must also be updated.
2347     'default_apps_list': [
2348       'browser/resources/default_apps/external_extensions.json',
2349       'browser/resources/default_apps/gmail.crx',
2350       'browser/resources/default_apps/search.crx',
2351       'browser/resources/default_apps/youtube.crx',
2352       'browser/resources/default_apps/drive.crx',
2353       'browser/resources/default_apps/docs.crx',
2354     ],
2355     'default_apps_list_linux_dest': [
2356       '<(PRODUCT_DIR)/default_apps/external_extensions.json',
2357       '<(PRODUCT_DIR)/default_apps/gmail.crx',
2358       '<(PRODUCT_DIR)/default_apps/search.crx',
2359       '<(PRODUCT_DIR)/default_apps/youtube.crx',
2360       '<(PRODUCT_DIR)/default_apps/drive.crx',
2361       '<(PRODUCT_DIR)/default_apps/docs.crx',
2362     ],
2364     # Whether to allow building of the GPU-related isolates.
2365     'archive_gpu_tests%': 0,
2367      # Whether to allow building of chromoting related isolates.
2368     'archive_chromoting_tests%': 0,
2369   },
2370   'target_defaults': {
2371     'variables': {
2372       # The condition that operates on chromium_code is in a target_conditions
2373       # section, and will not have access to the default fallback value of
2374       # chromium_code at the top of this file, or to the chromium_code
2375       # variable placed at the root variables scope of .gyp files, because
2376       # those variables are not set at target scope.  As a workaround,
2377       # if chromium_code is not set at target scope, define it in target scope
2378       # to contain whatever value it has during early variable expansion.
2379       # That's enough to make it available during target conditional
2380       # processing.
2381       'chromium_code%': '<(chromium_code)',
2383       'component%': '<(component)',
2385       'chromecast%': '<(chromecast)',
2387       # See http://msdn.microsoft.com/en-us/library/aa652360(VS.71).aspx
2388       'win_release_Optimization%': '2', # 2 = /Os
2389       'win_debug_Optimization%': '0',   # 0 = /Od
2391       # See http://msdn.microsoft.com/en-us/library/2kxx5t2c(v=vs.80).aspx
2392       # Tri-state: blank is default, 1 on, 0 off
2393       'win_release_OmitFramePointers%': '0',
2394       # Tri-state: blank is default, 1 on, 0 off
2395       'win_debug_OmitFramePointers%': '',
2397       # See http://msdn.microsoft.com/en-us/library/8wtf2dfz(VS.71).aspx
2398       'win_debug_RuntimeChecks%': '3',    # 3 = all checks enabled, 0 = off
2400       # See http://msdn.microsoft.com/en-us/library/47238hez(VS.71).aspx
2401       'win_debug_InlineFunctionExpansion%': '',    # empty = default, 0 = off,
2402       'win_release_InlineFunctionExpansion%': '2', # 1 = only __inline, 2 = max
2404       # VS inserts quite a lot of extra checks to algorithms like
2405       # std::partial_sort in Debug build which make them O(N^2)
2406       # instead of O(N*logN). This is particularly slow under memory
2407       # tools like ThreadSanitizer so we want it to be disablable.
2408       # See http://msdn.microsoft.com/en-us/library/aa985982(v=VS.80).aspx
2409       'win_debug_disable_iterator_debugging%': '0',
2411       # An application manifest fragment to declare compatibility settings for
2412       # 'executable' targets. Ignored in other target type.
2413       'win_exe_compatibility_manifest%':
2414           '<(DEPTH)\\build\\win\\compatibility.manifest',
2416       'release_extra_cflags%': '',
2417       'debug_extra_cflags%': '',
2419       'release_valgrind_build%': '<(release_valgrind_build)',
2421       # the non-qualified versions are widely assumed to be *nix-only
2422       'win_release_extra_cflags%': '',
2423       'win_debug_extra_cflags%': '',
2425       # TODO(thakis): Make this a blacklist instead, http://crbug.com/101600
2426       'enable_wexit_time_destructors%': '<(enable_wexit_time_destructors)',
2428       # Only used by Windows build for now.  Can be used to build into a
2429       # differet output directory, e.g., a build_dir_prefix of VS2010_ would
2430       # output files in src/build/VS2010_{Debug,Release}.
2431       'build_dir_prefix%': '',
2433       # Targets are by default not nacl untrusted code.
2434       'nacl_untrusted_build%': 0,
2436       'pnacl_compile_flags': [
2437         # pnacl uses the clang compiler so we need to suppress all the
2438         # same warnings as we do for clang.
2439         # TODO(sbc): Remove these if/when they are removed from the clang
2440         # build.
2441         '-Wno-unused-function',
2442         '-Wno-char-subscripts',
2443         '-Wno-c++11-extensions',
2444         '-Wno-unnamed-type-template-args',
2445       ],
2447       'conditions': [
2448         ['OS=="win" and component=="shared_library"', {
2449           # See http://msdn.microsoft.com/en-us/library/aa652367.aspx
2450           'win_release_RuntimeLibrary%': '2', # 2 = /MD (nondebug DLL)
2451           'win_debug_RuntimeLibrary%': '3',   # 3 = /MDd (debug DLL)
2452         }, {
2453           # See http://msdn.microsoft.com/en-us/library/aa652367.aspx
2454           'win_release_RuntimeLibrary%': '0', # 0 = /MT (nondebug static)
2455           'win_debug_RuntimeLibrary%': '1',   # 1 = /MTd (debug static)
2456         }],
2457         ['OS=="ios"', {
2458           # See http://gcc.gnu.org/onlinedocs/gcc-4.4.2/gcc/Optimize-Options.html
2459           'mac_release_optimization%': 's', # Use -Os unless overridden
2460           'mac_debug_optimization%': '0',   # Use -O0 unless overridden
2461         }, {
2462           # See http://gcc.gnu.org/onlinedocs/gcc-4.4.2/gcc/Optimize-Options.html
2463           'mac_release_optimization%': '3', # Use -O3 unless overridden
2464           'mac_debug_optimization%': '0',   # Use -O0 unless overridden
2465         }],
2466         ['OS=="android"', {
2467           'host_os%': '<(host_os)',  # See comment above chromium_code.
2468         }],
2469       ],
2470       'clang_warning_flags': [
2471         '-Wheader-hygiene',
2473         # Don't die on dtoa code that uses a char as an array index.
2474         # This is required solely for base/third_party/dmg_fp/dtoa.cc.
2475         '-Wno-char-subscripts',
2477         # TODO(thakis): This used to be implied by -Wno-unused-function,
2478         # which we no longer use. Check if it makes sense to remove
2479         # this as well. http://crbug.com/316352
2480         '-Wno-unneeded-internal-declaration',
2482         # Warns on switches on enums that cover all enum values but
2483         # also contain a default: branch. Chrome is full of that.
2484         '-Wno-covered-switch-default',
2486         # Warns when a const char[] is converted to bool.
2487         '-Wstring-conversion',
2489         # C++11-related flags:
2491         # This warns on using ints as initializers for floats in
2492         # initializer lists (e.g. |int a = f(); CGSize s = { a, a };|),
2493         # which happens in several places in chrome code. Not sure if
2494         # this is worth fixing.
2495         '-Wno-c++11-narrowing',
2497         # Clang considers the `register` keyword as deprecated, but e.g.
2498         # code generated by flex (used in angle) contains that keyword.
2499         # http://crbug.com/255186
2500         '-Wno-deprecated-register',
2501       ],
2502     },
2503     'includes': [ 'set_clang_warning_flags.gypi', ],
2504     'defines': [
2505       # Don't use deprecated V8 APIs anywhere.
2506       'V8_DEPRECATION_WARNINGS',
2507     ],
2508     'include_dirs': [
2509       '<(SHARED_INTERMEDIATE_DIR)',
2510     ],
2511     'conditions': [
2512       ['(OS=="mac" or OS=="ios") and asan==1', {
2513         'dependencies': [
2514           '<(DEPTH)/build/mac/asan.gyp:asan_dynamic_runtime',
2515         ],
2516       }],
2517       ['OS=="win" and asan==1 and component=="shared_library"', {
2518         'dependencies': [
2519           '<(DEPTH)/build/win/asan.gyp:asan_dynamic_runtime',
2520         ],
2521       }],
2522       ['OS=="linux" and use_allocator!="none" and clang_type_profiler==1', {
2523         'cflags_cc!': ['-fno-rtti'],
2524         'cflags_cc+': [
2525           '-frtti',
2526           '-gline-tables-only',
2527           '-fintercept-allocation-functions',
2528         ],
2529         'defines': ['TYPE_PROFILING'],
2530         'dependencies': [
2531           '<(DEPTH)/base/allocator/allocator.gyp:type_profiler',
2532         ],
2533       }],
2534       ['branding=="Chrome"', {
2535         'defines': ['GOOGLE_CHROME_BUILD'],
2536       }, {  # else: branding!="Chrome"
2537         'defines': ['CHROMIUM_BUILD'],
2538       }],
2539       ['OS=="mac" and component=="shared_library"', {
2540         'xcode_settings': {
2541           'DYLIB_INSTALL_NAME_BASE': '@rpath',
2542           'LD_RUNPATH_SEARCH_PATHS': [
2543             # For unbundled binaries.
2544             '@loader_path/.',
2545             # For bundled binaries, to get back from Binary.app/Contents/MacOS.
2546             '@loader_path/../../..',
2547           ],
2548         },
2549       }],
2550       ['clang==1 and OS!="win"', {
2551         # This is here so that all files get recompiled after a clang roll and
2552         # when turning clang on or off.
2553         # (defines are passed via the command line, and build systems rebuild
2554         # things when their commandline changes). Nothing should ever read this
2555         # define.
2556         'defines': ['CR_CLANG_REVISION=<!(<(DEPTH)/tools/clang/scripts/update.sh --print-revision)'],
2557       }],
2558       ['enable_rlz==1', {
2559         'defines': ['ENABLE_RLZ'],
2560       }],
2561       ['component=="shared_library"', {
2562         'defines': ['COMPONENT_BUILD'],
2563       }],
2564       ['toolkit_views==1', {
2565         'defines': ['TOOLKIT_VIEWS=1'],
2566       }],
2567       ['ui_compositor_image_transport==1', {
2568         'defines': ['UI_COMPOSITOR_IMAGE_TRANSPORT'],
2569       }],
2570       ['use_aura==1', {
2571         'defines': ['USE_AURA=1'],
2572       }],
2573       ['use_ash==1', {
2574         'defines': ['USE_ASH=1'],
2575       }],
2576       ['use_pango==1', {
2577         'defines': ['USE_PANGO=1'],
2578       }],
2579       ['use_cairo==1', {
2580         'defines': ['USE_CAIRO=1'],
2581       }],
2582       ['use_cras==1', {
2583         'defines': ['USE_CRAS=1'],
2584       }],
2585       ['use_glib==1', {
2586         'defines': ['USE_GLIB=1'],
2587       }],
2588       ['use_ozone==1', {
2589         'defines': ['USE_OZONE=1'],
2590       }],
2591       ['use_default_render_theme==1', {
2592         'defines': ['USE_DEFAULT_RENDER_THEME=1'],
2593       }],
2594       ['use_libjpeg_turbo==1', {
2595         'defines': ['USE_LIBJPEG_TURBO=1'],
2596       }],
2597       ['use_x11==1', {
2598         'defines': ['USE_X11=1'],
2599       }],
2600       ['use_clipboard_aurax11==1', {
2601         'defines': ['USE_CLIPBOARD_AURAX11=1'],
2602       }],
2603       ['enable_one_click_signin==1', {
2604         'defines': ['ENABLE_ONE_CLICK_SIGNIN'],
2605       }],
2606       ['enable_pre_sync_backup==1', {
2607         'defines': ['ENABLE_PRE_SYNC_BACKUP'],
2608       }],
2609       ['use_xi2_mt!=0 and use_x11==1', {
2610         'defines': ['USE_XI2_MT=<(use_xi2_mt)'],
2611       }],
2612       ['image_loader_extension==1', {
2613         'defines': ['IMAGE_LOADER_EXTENSION=1'],
2614       }],
2615       ['profiling==1', {
2616         'defines': ['ENABLE_PROFILING=1'],
2617       }],
2618       ['remoting==1', {
2619         'defines': ['ENABLE_REMOTING=1'],
2620       }],
2621       ['enable_webrtc==1', {
2622         'defines': ['ENABLE_WEBRTC=1'],
2623       }],
2624       ['proprietary_codecs==1', {
2625         'defines': ['USE_PROPRIETARY_CODECS'],
2626         'conditions': [
2627           ['enable_mpeg2ts_stream_parser==1', {
2628             'defines': ['ENABLE_MPEG2TS_STREAM_PARSER'],
2629           }],
2630         ],
2631       }],
2632       ['enable_viewport==1', {
2633         'defines': ['ENABLE_VIEWPORT'],
2634       }],
2635       ['enable_pepper_cdms==1', {
2636         'defines': ['ENABLE_PEPPER_CDMS'],
2637       }],
2638       ['enable_browser_cdms==1', {
2639         'defines': ['ENABLE_BROWSER_CDMS'],
2640       }],
2641       ['configuration_policy==1', {
2642         'defines': ['ENABLE_CONFIGURATION_POLICY'],
2643       }],
2644       ['notifications==1', {
2645         'defines': ['ENABLE_NOTIFICATIONS'],
2646       }],
2647       ['enable_hidpi==1', {
2648         'defines': ['ENABLE_HIDPI=1'],
2649       }],
2650       ['native_discardable_memory==1', {
2651         'defines': ['DISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY'],
2652       }],
2653       ['native_memory_pressure_signals==1', {
2654         'defines': ['SYSTEM_NATIVELY_SIGNALS_MEMORY_PRESSURE'],
2655       }],
2656       ['use_udev==1', {
2657         'defines': ['USE_UDEV'],
2658       }],
2659       ['fastbuild!=0', {
2660         'xcode_settings': {
2661           'GCC_GENERATE_DEBUGGING_SYMBOLS': 'NO',
2662         },
2663         'conditions': [
2664           ['clang==1 and asan==0 and msan==0 and tsan==0 and ubsan_vptr==0', {
2665             # Clang creates chubby debug information, which makes linking very
2666             # slow. For now, don't create debug information with clang.  See
2667             # http://crbug.com/70000
2668             'conditions': [
2669               ['OS=="linux"', {
2670                 'variables': {
2671                   'debug_extra_cflags': '-g0',
2672                 },
2673               }],
2674               # Android builds symbols on release by default, disable them.
2675               ['OS=="android"', {
2676                 'variables': {
2677                   'debug_extra_cflags': '-g0',
2678                   'release_extra_cflags': '-g0',
2679                 },
2680               }],
2681             ],
2682           }, { # else clang!=1
2683             'conditions': [
2684               ['OS=="win" and fastbuild==2', {
2685                 # Completely disable debug information.
2686                 'msvs_settings': {
2687                   'VCLinkerTool': {
2688                     'GenerateDebugInformation': 'false',
2689                   },
2690                   'VCCLCompilerTool': {
2691                     'DebugInformationFormat': '0',
2692                   },
2693                 },
2694               }],
2695               ['OS=="win" and fastbuild==1', {
2696                 'msvs_settings': {
2697                   'VCLinkerTool': {
2698                     # This tells the linker to generate .pdbs, so that
2699                     # we can get meaningful stack traces.
2700                     'GenerateDebugInformation': 'true',
2701                   },
2702                   'VCCLCompilerTool': {
2703                     # No debug info to be generated by compiler.
2704                     'DebugInformationFormat': '0',
2705                   },
2706                 },
2707               }],
2708               ['OS=="linux" and fastbuild==2', {
2709                 'variables': {
2710                   'debug_extra_cflags': '-g0',
2711                 },
2712               }],
2713               ['OS=="linux" and fastbuild==1', {
2714                 'variables': {
2715                   'debug_extra_cflags': '-g1',
2716                 },
2717               }],
2718               ['OS=="android" and fastbuild==2', {
2719                 'variables': {
2720                   'debug_extra_cflags': '-g0',
2721                   'release_extra_cflags': '-g0',
2722                 },
2723               }],
2724               ['OS=="android" and fastbuild==1', {
2725                 'variables': {
2726                   'debug_extra_cflags': '-g1',
2727                   'release_extra_cflags': '-g1',
2728                 },
2729               }],
2730             ],
2731           }], # clang!=1
2732         ],
2733       }],  # fastbuild!=0
2734       ['dont_embed_build_metadata==1', {
2735         'defines': [
2736           'DONT_EMBED_BUILD_METADATA',
2737         ],
2738       }],  # dont_embed_build_metadata==1
2739       ['dcheck_always_on!=0', {
2740         'defines': ['DCHECK_ALWAYS_ON=1'],
2741       }],  # dcheck_always_on!=0
2742       ['tracing_like_official_build!=0', {
2743         'defines': ['TRACING_IS_OFFICIAL_BUILD=1'],
2744       }],  # tracing_like_official_build!=0
2745       ['win_use_allocator_shim==0', {
2746         'conditions': [
2747           ['OS=="win"', {
2748             'defines': ['NO_TCMALLOC'],
2749           }],
2750         ],
2751       }],
2752       ['enable_eglimage==1', {
2753         'defines': [
2754           'ENABLE_EGLIMAGE=1',
2755         ],
2756       }],
2757       ['asan==1', {
2758         'defines': [
2759           'ADDRESS_SANITIZER',
2760           'MEMORY_TOOL_REPLACES_ALLOCATOR',
2761           'MEMORY_SANITIZER_INITIAL_SIZE',
2762         ],
2763       }],
2764       ['syzyasan==1', {
2765         # SyzyAsan needs /PROFILE turned on to produce appropriate pdbs.
2766         'msvs_settings': {
2767           'VCLinkerTool': {
2768             'Profile': 'true',
2769           },
2770         },
2771         'defines': [
2772             'SYZYASAN',
2773             'MEMORY_TOOL_REPLACES_ALLOCATOR',
2774             'MEMORY_SANITIZER_INITIAL_SIZE',
2775         ],
2776       }],
2777       ['OS=="win"', {
2778         'defines': [
2779           '__STD_C',
2780           '_CRT_SECURE_NO_DEPRECATE',
2781           '_SCL_SECURE_NO_DEPRECATE',
2782           # This define is required to pull in the new Win8 interfaces from
2783           # system headers like ShObjIdl.h.
2784           'NTDDI_VERSION=0x06020000',
2785           # This is required for ATL to use XP-safe versions of its functions.
2786           '_USING_V110_SDK71_',
2787         ],
2788         'include_dirs': [
2789           '<(DEPTH)/third_party/wtl/include',
2790         ],
2791         'conditions': [
2792           ['win_z7!=0', {
2793             'msvs_settings': {
2794               # Generates debug info when win_z7=1
2795               # even if fastbuild=1 (that makes GenerateDebugInformation false).
2796               'VCLinkerTool': {
2797                 'GenerateDebugInformation': 'true',
2798               },
2799               'VCCLCompilerTool': {
2800                 'DebugInformationFormat': '1',
2801               }
2802             }
2803           }],
2804         ],  # win_z7!=0
2805       }],  # OS==win
2806       ['chromecast==1', {
2807         'defines': [
2808           'LOG_DISABLED=0',
2809         ],
2810         'conditions': [
2811           ['target_arch=="arm"', {
2812             'defines': [
2813               # TODO(lcwu): Work around an error when building Chromium
2814               # with gcc-4.5.3 (e.g. v8/src/platform-linux.cc). Remove
2815               # this define once the toolchain is updated.
2816               # See crbug.com/388933.
2817               '__SOFTFP',
2818             ],
2819           }],
2820           ['use_playready==1', {
2821             'defines': [
2822               'PLAYREADY_CDM_AVAILABLE',
2823             ],
2824           }],
2825         ],
2826       }],
2827       ['enable_task_manager==1', {
2828         'defines': [
2829           'ENABLE_TASK_MANAGER=1',
2830         ],
2831       }],
2832       ['enable_extensions==1', {
2833         'defines': [
2834           'ENABLE_EXTENSIONS=1',
2835         ],
2836       }],
2837       ['OS=="win" and branding=="Chrome"', {
2838         'defines': ['ENABLE_SWIFTSHADER'],
2839       }],
2840       ['enable_dart==1', {
2841         'defines': ['WEBKIT_USING_DART=1'],
2842       }],
2843       ['enable_plugin_installation==1', {
2844         'defines': ['ENABLE_PLUGIN_INSTALLATION=1'],
2845       }],
2846       ['enable_plugins==1', {
2847         'defines': ['ENABLE_PLUGINS=1'],
2848       }],
2849       ['enable_session_service==1', {
2850         'defines': ['ENABLE_SESSION_SERVICE=1'],
2851       }],
2852       ['enable_themes==1', {
2853         'defines': ['ENABLE_THEMES=1'],
2854       }],
2855       ['enable_autofill_dialog==1', {
2856         'defines': ['ENABLE_AUTOFILL_DIALOG=1'],
2857       }],
2858       ['enable_prod_wallet_service==1', {
2859         'defines': ['ENABLE_PROD_WALLET_SERVICE=1'],
2860       }],
2861       ['enable_background==1', {
2862         'defines': ['ENABLE_BACKGROUND=1'],
2863       }],
2864       ['enable_google_now==1', {
2865         'defines': ['ENABLE_GOOGLE_NOW=1'],
2866       }],
2867       ['cld_version!=0', {
2868         'defines': ['CLD_VERSION=<(cld_version)'],
2869       }],
2870       ['cld_version==2', {
2871         # This is used to populate the "CLD Data Source" field in:
2872         # chrome://translate-internals
2873         'defines': ['CLD2_DATA_SOURCE=<(cld2_data_source)'],
2874       }],
2875       ['enable_printing==1', {
2876         'defines': ['ENABLE_FULL_PRINTING=1', 'ENABLE_PRINTING=1'],
2877       }],
2878       ['enable_printing==1 and OS=="win"', {
2879         'defines': ['DISABLE_BASIC_PRINTING=1'],
2880       }],
2881       ['enable_printing==2', {
2882         'defines': ['ENABLE_PRINTING=1'],
2883       }],
2884       ['enable_spellcheck==1', {
2885         'defines': ['ENABLE_SPELLCHECK=1'],
2886       }],
2887       ['enable_captive_portal_detection==1', {
2888         'defines': ['ENABLE_CAPTIVE_PORTAL_DETECTION=1'],
2889       }],
2890       ['enable_app_list==1', {
2891         'defines': ['ENABLE_APP_LIST=1'],
2892       }],
2893       ['enable_settings_app==1', {
2894         'defines': ['ENABLE_SETTINGS_APP=1'],
2895       }],
2896       ['disable_file_support==1', {
2897         'defines': ['DISABLE_FILE_SUPPORT=1'],
2898       }],
2899       ['disable_ftp_support==1', {
2900         'defines': ['DISABLE_FTP_SUPPORT=1'],
2901       }],
2902       ['use_icu_alternatives_on_android==1', {
2903         'defines': ['USE_ICU_ALTERNATIVES_ON_ANDROID=1'],
2904       }],
2905       ['enable_managed_users==1', {
2906         'defines': ['ENABLE_MANAGED_USERS=1'],
2907       }],
2908       ['data_reduction_fallback_host != ""', {
2909         'defines': [
2910           'DATA_REDUCTION_FALLBACK_HOST="<(data_reduction_fallback_host)"'],
2911       }],
2912       ['data_reduction_dev_host != ""', {
2913         'defines': [
2914           'DATA_REDUCTION_DEV_HOST="<(data_reduction_dev_host)"'],
2915       }],
2916       ['data_reduction_dev_fallback_host != ""', {
2917         'defines': [
2918           'DATA_REDUCTION_DEV_FALLBACK_HOST="<(data_reduction_dev_fallback_host)"'],
2919       }],
2920       ['spdy_proxy_auth_origin != ""', {
2921         'defines': ['SPDY_PROXY_AUTH_ORIGIN="<(spdy_proxy_auth_origin)"'],
2922       }],
2923       ['spdy_proxy_auth_property != ""', {
2924         'defines': ['SPDY_PROXY_AUTH_PROPERTY="<(spdy_proxy_auth_property)"'],
2925       }],
2926       ['spdy_proxy_auth_value != ""', {
2927         'defines': ['SPDY_PROXY_AUTH_VALUE="<(spdy_proxy_auth_value)"'],
2928       }],
2929       ['data_reduction_proxy_probe_url != ""', {
2930         'defines': [
2931           'DATA_REDUCTION_PROXY_PROBE_URL="<(data_reduction_proxy_probe_url)"'],
2932       }],
2933       ['data_reduction_proxy_warmup_url != ""', {
2934         'defines': [
2935           'DATA_REDUCTION_PROXY_WARMUP_URL="<(data_reduction_proxy_warmup_url)"'],
2936       }],
2937       ['data_reduction_proxy_ssl_origin != ""', {
2938         'defines': [
2939           'DATA_REDUCTION_PROXY_SSL_ORIGIN="<(data_reduction_proxy_ssl_origin)"'],
2940       }],
2941       ['data_reduction_proxy_alt_origin != ""', {
2942         'defines': [
2943           'DATA_REDUCTION_PROXY_ALT_ORIGIN="<(data_reduction_proxy_alt_origin)"'],
2944       }],
2945       ['data_reduction_proxy_alt_fallback_origin != ""', {
2946         'defines': [
2947           'DATA_REDUCTION_PROXY_ALT_FALLBACK_ORIGIN="<(data_reduction_proxy_alt_fallback_origin)"'],
2948       }],
2949       ['enable_mdns==1', {
2950         'defines': ['ENABLE_MDNS=1'],
2951       }],
2952       ['enable_service_discovery==1', {
2953         'defines' : [ 'ENABLE_SERVICE_DISCOVERY=1' ],
2954       }],
2955       ['enable_wifi_bootstrapping==1', {
2956         'defines' : [ 'ENABLE_WIFI_BOOTSTRAPPING=1' ],
2957       }],
2958       ['enable_hangout_services_extension==1', {
2959         'defines': ['ENABLE_HANGOUT_SERVICES_EXTENSION=1'],
2960       }],
2961       ['enable_ipc_fuzzer==1', {
2962         'defines': ['ENABLE_IPC_FUZZER=1'],
2963       }],
2964       ['video_hole==1', {
2965         'defines': ['VIDEO_HOLE=1'],
2966       }],
2967       ['enable_load_completion_hacks==1', {
2968         'defines': ['ENABLE_LOAD_COMPLETION_HACKS=1'],
2969       }],
2970     ],  # conditions for 'target_defaults'
2971     'target_conditions': [
2972       ['<(use_openssl)==1', {
2973         'defines': ['USE_OPENSSL=1'],
2974       }],
2975       ['<(use_openssl_certs)==1', {
2976         'defines': ['USE_OPENSSL_CERTS=1'],
2977       }],
2978       ['>(nacl_untrusted_build)==1', {
2979         'defines': [
2980           'USE_OPENSSL=1',
2981           'USE_OPENSSL_CERTS=1',
2982         ],
2983       }],
2984       ['<(use_nss)==1 and >(nacl_untrusted_build)==0', {
2985         'defines': ['USE_NSS=1'],
2986       }],
2987       ['<(chromeos)==1 and >(nacl_untrusted_build)==0', {
2988         'defines': ['OS_CHROMEOS=1'],
2989       }],
2990       ['enable_wexit_time_destructors==1 and OS!="win"', {
2991         # TODO: Enable on Windows too, http://crbug.com/404525
2992         'variables': { 'clang_warning_flags': ['-Wexit-time-destructors']},
2993       }],
2994       ['chromium_code==0', {
2995         'conditions': [
2996           [ 'os_posix==1 and OS!="mac" and OS!="ios"', {
2997             # We don't want to get warnings from third-party code,
2998             # so remove any existing warning-enabling flags like -Wall.
2999             'cflags!': [
3000               '-Wall',
3001               '-Wextra',
3002             ],
3003             'cflags_cc': [
3004               # Don't warn about hash_map in third-party code.
3005               '-Wno-deprecated',
3006             ],
3007             'cflags': [
3008               # Don't warn about printf format problems.
3009               # This is off by default in gcc but on in Ubuntu's gcc(!).
3010               '-Wno-format',
3011             ],
3012             'cflags_cc!': [
3013               # Necessary because llvm.org/PR10448 is WONTFIX (crbug.com/90453).
3014               '-Wsign-compare',
3015             ]
3016           }],
3017           # TODO: Fix all warnings on chromeos too.
3018           [ 'os_posix==1 and OS!="mac" and OS!="ios" and (clang!=1 or chromeos==1)', {
3019             'cflags!': [
3020               '-Werror',
3021             ],
3022           }],
3023           [ 'os_posix==1 and os_bsd!=1 and OS!="mac" and OS!="android"', {
3024             'cflags': [
3025               # Don't warn about ignoring the return value from e.g. close().
3026               # This is off by default in some gccs but on by default in others.
3027               # BSD systems do not support this option, since they are usually
3028               # using gcc 4.2.1, which does not have this flag yet.
3029               '-Wno-unused-result',
3030             ],
3031           }],
3032           [ 'OS=="win"', {
3033             'defines': [
3034               '_CRT_SECURE_NO_DEPRECATE',
3035               '_CRT_NONSTDC_NO_WARNINGS',
3036               '_CRT_NONSTDC_NO_DEPRECATE',
3037               '_SCL_SECURE_NO_DEPRECATE',
3038             ],
3039             'msvs_disabled_warnings': [4800],
3040             'msvs_settings': {
3041               'VCCLCompilerTool': {
3042                 'WarningLevel': '3',
3043                 'WarnAsError': 'true',
3044                 'Detect64BitPortabilityProblems': 'false',
3045               },
3046             },
3047             'conditions': [
3048               ['buildtype=="Official"', {
3049                 'msvs_settings': {
3050                   'VCCLCompilerTool': { 'WarnAsError': 'false' },
3051                 }
3052               }],
3053               ['clang==1', {
3054                 'msvs_settings': {
3055                   'VCCLCompilerTool': { 'WarnAsError': 'false' },
3056                 }
3057               }],
3058               [ 'component=="shared_library"', {
3059               # TODO(darin): Unfortunately, some third_party code depends on base.
3060                 'msvs_disabled_warnings': [
3061                   4251,  # class 'std::xx' needs to have dll-interface.
3062                  ],
3063               }],
3064             ],
3065           }],
3067           [ 'OS=="mac" or OS=="ios"', {
3068             'xcode_settings': {
3069               'WARNING_CFLAGS!': ['-Wall', '-Wextra'],
3070             },
3071             'conditions': [
3072               ['buildtype=="Official"', {
3073                 'xcode_settings': {
3074                   'GCC_TREAT_WARNINGS_AS_ERRORS': 'NO',    # -Werror
3075                 },
3076               }],
3077             ],
3078           }],
3079           [ 'OS=="ios"', {
3080             'xcode_settings': {
3081               # TODO(ios): Fix remaining warnings in third-party code, then
3082               # remove this; the Mac cleanup didn't get everything that's
3083               # flagged in an iOS build.
3084               'GCC_TREAT_WARNINGS_AS_ERRORS': 'NO',
3085               'RUN_CLANG_STATIC_ANALYZER': 'NO',
3086               # Several internal ios directories generate numerous warnings for
3087               # -Wobjc-missing-property-synthesis.
3088               'CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS': 'NO',
3089             },
3090           }],
3091         ],
3092       }, {
3093         'includes': [
3094            # Rules for excluding e.g. foo_win.cc from the build on non-Windows.
3095           'filename_rules.gypi',
3096         ],
3097         # In Chromium code, we define __STDC_foo_MACROS in order to get the
3098         # C99 macros on Mac and Linux.
3099         'defines': [
3100           '__STDC_CONSTANT_MACROS',
3101           '__STDC_FORMAT_MACROS',
3102         ],
3103         'conditions': [
3104           ['OS=="win"', {
3105             # turn on warnings for signed/unsigned mismatch on chromium code.
3106             'msvs_settings': {
3107               'VCCLCompilerTool': {
3108                 'AdditionalOptions': ['/we4389'],
3109               },
3110             },
3111           }],
3112           ['OS=="win" and component=="shared_library"', {
3113             'msvs_disabled_warnings': [
3114               4251,  # class 'std::xx' needs to have dll-interface.
3115             ],
3116           }],
3117         ],
3118       }],
3119     ],  # target_conditions for 'target_defaults'
3120     'default_configuration': 'Debug',
3121     'configurations': {
3122       # VCLinkerTool LinkIncremental values below:
3123       #   0 == default
3124       #   1 == /INCREMENTAL:NO
3125       #   2 == /INCREMENTAL
3126       # Debug links incremental, Release does not.
3127       #
3128       # Abstract base configurations to cover common attributes.
3129       #
3130       'Common_Base': {
3131         'abstract': 1,
3132         'msvs_configuration_attributes': {
3133           'OutputDirectory': '<(DEPTH)\\build\\<(build_dir_prefix)$(ConfigurationName)',
3134           'IntermediateDirectory': '$(OutDir)\\obj\\$(ProjectName)',
3135           'CharacterSet': '1',
3136         },
3137         # Add the default import libs.
3138         'msvs_settings':{
3139           'VCLinkerTool': {
3140             'AdditionalDependencies': [
3141               'kernel32.lib',
3142               'gdi32.lib',
3143               'winspool.lib',
3144               'comdlg32.lib',
3145               'advapi32.lib',
3146               'shell32.lib',
3147               'ole32.lib',
3148               'oleaut32.lib',
3149               'user32.lib',
3150               'uuid.lib',
3151               'odbc32.lib',
3152               'odbccp32.lib',
3153               'delayimp.lib',
3154               'credui.lib',
3155               'netapi32.lib',
3156             ],
3157           },
3158         },
3159       },
3160       'x86_Base': {
3161         'abstract': 1,
3162         'msvs_settings': {
3163           'VCLinkerTool': {
3164             'MinimumRequiredVersion': '5.01',  # XP.
3165             'TargetMachine': '1',
3166           },
3167           'VCLibrarianTool': {
3168             'TargetMachine': '1',
3169           },
3170         },
3171         'msvs_configuration_platform': 'Win32',
3172       },
3173       'x64_Base': {
3174         'abstract': 1,
3175         'msvs_configuration_platform': 'x64',
3176         'msvs_settings': {
3177           'VCLinkerTool': {
3178             # Make sure to understand http://crbug.com/361720 if you want to
3179             # increase this.
3180             'MinimumRequiredVersion': '5.02',  # Server 2003.
3181             'TargetMachine': '17', # x86 - 64
3182             'AdditionalLibraryDirectories!':
3183               ['<(windows_sdk_path)/Lib/win8/um/x86'],
3184             'AdditionalLibraryDirectories':
3185               ['<(windows_sdk_path)/Lib/win8/um/x64'],
3186             # Doesn't exist x64 SDK. Should use oleaut32 in any case.
3187             'IgnoreDefaultLibraryNames': [ 'olepro32.lib' ],
3188           },
3189           'VCLibrarianTool': {
3190             'AdditionalLibraryDirectories!':
3191               ['<(windows_sdk_path)/Lib/win8/um/x86'],
3192             'AdditionalLibraryDirectories':
3193               ['<(windows_sdk_path)/Lib/win8/um/x64'],
3194             'TargetMachine': '17', # x64
3195           },
3196         },
3197       },
3198       'Debug_Base': {
3199         'abstract': 1,
3200         'defines': [
3201           'DYNAMIC_ANNOTATIONS_ENABLED=1',
3202           'WTF_USE_DYNAMIC_ANNOTATIONS=1',
3203         ],
3204         'xcode_settings': {
3205           'GCC_OPTIMIZATION_LEVEL': '<(mac_debug_optimization)',
3206           'OTHER_CFLAGS': [
3207             '<@(debug_extra_cflags)',
3208           ],
3209         },
3210         'msvs_settings': {
3211           'VCCLCompilerTool': {
3212             'Optimization': '<(win_debug_Optimization)',
3213             'PreprocessorDefinitions': ['_DEBUG'],
3214             'BasicRuntimeChecks': '<(win_debug_RuntimeChecks)',
3215             'RuntimeLibrary': '<(win_debug_RuntimeLibrary)',
3216             'conditions': [
3217               # According to MSVS, InlineFunctionExpansion=0 means
3218               # "default inlining", not "/Ob0".
3219               # Thus, we have to handle InlineFunctionExpansion==0 separately.
3220               ['win_debug_InlineFunctionExpansion==0', {
3221                 'AdditionalOptions': ['/Ob0'],
3222               }],
3223               ['win_debug_InlineFunctionExpansion!=""', {
3224                 'InlineFunctionExpansion':
3225                   '<(win_debug_InlineFunctionExpansion)',
3226               }],
3227               ['win_debug_disable_iterator_debugging==1', {
3228                 'PreprocessorDefinitions': ['_HAS_ITERATOR_DEBUGGING=0'],
3229               }],
3231               # if win_debug_OmitFramePointers is blank, leave as default
3232               ['win_debug_OmitFramePointers==1', {
3233                 'OmitFramePointers': 'true',
3234               }],
3235               ['win_debug_OmitFramePointers==0', {
3236                 'OmitFramePointers': 'false',
3237                 # The above is not sufficient (http://crbug.com/106711): it
3238                 # simply eliminates an explicit "/Oy", but both /O2 and /Ox
3239                 # perform FPO regardless, so we must explicitly disable.
3240                 # We still want the false setting above to avoid having
3241                 # "/Oy /Oy-" and warnings about overriding.
3242                 'AdditionalOptions': ['/Oy-'],
3243               }],
3244             ],
3245             'AdditionalOptions': [ '<@(win_debug_extra_cflags)', ],
3246           },
3247           'VCLinkerTool': {
3248             'LinkIncremental': '<(msvs_debug_link_incremental)',
3249             # ASLR makes debugging with windbg difficult because Chrome.exe and
3250             # Chrome.dll share the same base name. As result, windbg will
3251             # name the Chrome.dll module like chrome_<base address>, where
3252             # <base address> typically changes with each launch. This in turn
3253             # means that breakpoints in Chrome.dll don't stick from one launch
3254             # to the next. For this reason, we turn ASLR off in debug builds.
3255             # Note that this is a three-way bool, where 0 means to pick up
3256             # the default setting, 1 is off and 2 is on.
3257             'RandomizedBaseAddress': 1,
3258           },
3259           'VCResourceCompilerTool': {
3260             'PreprocessorDefinitions': ['_DEBUG'],
3261           },
3262         },
3263         'conditions': [
3264           ['OS=="linux" or OS=="android"', {
3265             'target_conditions': [
3266               ['_toolset=="target"', {
3267                 'cflags': [
3268                   '<@(debug_extra_cflags)',
3269                 ],
3270               }],
3271             ],
3272           }],
3273           ['OS=="linux" and target_arch!="ia32" and disable_glibcxx_debug==0', {
3274             # Enable libstdc++ debugging facilities to help catch problems
3275             # early, see http://crbug.com/65151 .
3276             # TODO(phajdan.jr): Should we enable this for all of POSIX?
3277             'defines': ['_GLIBCXX_DEBUG=1',],
3278           }],
3279           ['release_valgrind_build==0', {
3280             'xcode_settings': {
3281               'OTHER_CFLAGS': [
3282                 '-fstack-protector-all',  # Implies -fstack-protector
3283               ],
3284             },
3285           }],
3286           ['clang==1', {
3287             'cflags': [
3288               # Allow comparing the address of references and 'this' against 0
3289               # in debug builds. Technically, these can never be null in
3290               # well-defined C/C++ and Clang can optimize such checks away in
3291               # release builds, but they may be used in asserts in debug builds.
3292               '-Wno-undefined-bool-conversion',
3293               '-Wno-tautological-undefined-compare',
3294             ],
3295             'xcode_settings': {
3296               'OTHER_CFLAGS': [
3297                 '-Wno-undefined-bool-conversion',
3298                 '-Wno-tautological-undefined-compare',
3299               ],
3300             },
3301             'msvs_settings': {
3302               'VCCLCompilerTool': {
3303                 'AdditionalOptions': [
3304                   '-Wno-undefined-bool-conversion',
3305                   '-Wno-tautological-undefined-compare',
3306                 ],
3307               },
3308             },
3309           }],
3310         ],
3311       },
3312       'Release_Base': {
3313         'abstract': 1,
3314         'defines': [
3315           'NDEBUG',
3316         ],
3317         'xcode_settings': {
3318           'DEAD_CODE_STRIPPING': 'YES',  # -Wl,-dead_strip
3319           'GCC_OPTIMIZATION_LEVEL': '<(mac_release_optimization)',
3320           'OTHER_CFLAGS': [ '<@(release_extra_cflags)', ],
3321         },
3322         'msvs_settings': {
3323           'VCCLCompilerTool': {
3324             'RuntimeLibrary': '<(win_release_RuntimeLibrary)',
3325             'conditions': [
3326               # In official builds, each target will self-select
3327               # an optimization level.
3328               ['buildtype!="Official"', {
3329                   'Optimization': '<(win_release_Optimization)',
3330                 },
3331               ],
3332               # According to MSVS, InlineFunctionExpansion=0 means
3333               # "default inlining", not "/Ob0".
3334               # Thus, we have to handle InlineFunctionExpansion==0 separately.
3335               ['win_release_InlineFunctionExpansion==0', {
3336                 'AdditionalOptions': ['/Ob0'],
3337               }],
3338               ['win_release_InlineFunctionExpansion!=""', {
3339                 'InlineFunctionExpansion':
3340                   '<(win_release_InlineFunctionExpansion)',
3341               }],
3343               # if win_release_OmitFramePointers is blank, leave as default
3344               ['win_release_OmitFramePointers==1', {
3345                 'OmitFramePointers': 'true',
3346               }],
3347               ['win_release_OmitFramePointers==0', {
3348                 'OmitFramePointers': 'false',
3349                 # The above is not sufficient (http://crbug.com/106711): it
3350                 # simply eliminates an explicit "/Oy", but both /O2 and /Ox
3351                 # perform FPO regardless, so we must explicitly disable.
3352                 # We still want the false setting above to avoid having
3353                 # "/Oy /Oy-" and warnings about overriding.
3354                 'AdditionalOptions': ['/Oy-'],
3355               }],
3356             ],
3357             'AdditionalOptions': [
3358                 '/d2Zi+',  # Improve debugging of Release builds.
3359                 '/Zc:inline',  # Remove unreferenced COMDAT (faster links).
3360                 '<@(win_release_extra_cflags)',
3361             ],
3362           },
3363           'VCLinkerTool': {
3364             # LinkIncremental is a tri-state boolean, where 0 means default
3365             # (i.e., inherit from parent solution), 1 means false, and
3366             # 2 means true.
3367             'LinkIncremental': '1',
3368             # This corresponds to the /PROFILE flag which ensures the PDB
3369             # file contains FIXUP information (growing the PDB file by about
3370             # 5%) but does not otherwise alter the output binary. This
3371             # information is used by the Syzygy optimization tool when
3372             # decomposing the release image.
3373             'Profile': 'true',
3374           },
3375         },
3376         'conditions': [
3377           ['msvs_use_common_release', {
3378             'includes': ['release.gypi'],
3379           }],
3380           ['release_valgrind_build==0 and tsan==0', {
3381             'defines': [
3382               'NVALGRIND',
3383               'DYNAMIC_ANNOTATIONS_ENABLED=0',
3384             ],
3385           }, {
3386             'defines': [
3387               'MEMORY_TOOL_REPLACES_ALLOCATOR',
3388               'MEMORY_SANITIZER_INITIAL_SIZE',
3389               'DYNAMIC_ANNOTATIONS_ENABLED=1',
3390               'WTF_USE_DYNAMIC_ANNOTATIONS=1',
3391             ],
3392           }],
3393           ['win_use_allocator_shim==0', {
3394             'defines': ['NO_TCMALLOC'],
3395           }],
3396           # _FORTIFY_SOURCE isn't really supported by Clang now, see
3397           # http://llvm.org/bugs/show_bug.cgi?id=16821.
3398           # It seems to work fine with Ubuntu 12 headers though, so use it
3399           # in official builds.
3400           ['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")', {
3401             'target_conditions': [
3402               ['chromium_code==1', {
3403                 # Non-chromium code is not guaranteed to compile cleanly
3404                 # with _FORTIFY_SOURCE. Also, fortified build may fail
3405                 # when optimizations are disabled, so only do that for Release
3406                 # build.
3407                 'defines': [
3408                   '_FORTIFY_SOURCE=2',
3409                 ],
3410               }],
3411             ],
3412           }],
3413           ['OS=="linux" or OS=="android"', {
3414             'target_conditions': [
3415               ['_toolset=="target"', {
3416                 'cflags': [
3417                   '<@(release_extra_cflags)',
3418                 ],
3419                 'conditions': [
3420                   ['enable_resource_whitelist_generation==1', {
3421                     'cflags': [
3422                       '-Wunknown-pragmas -Wno-error=unknown-pragmas',
3423                     ],
3424                   }],
3425                 ],
3426               }],
3427             ],
3428           }],
3429           ['OS=="ios"', {
3430             'defines': [
3431               'NS_BLOCK_ASSERTIONS=1',
3432             ],
3433           }],
3434         ],
3435       },
3436       #
3437       # Concrete configurations
3438       #
3439       'Debug': {
3440         'inherit_from': ['Common_Base', 'x86_Base', 'Debug_Base'],
3441       },
3442       'Release': {
3443         'inherit_from': ['Common_Base', 'x86_Base', 'Release_Base'],
3444       },
3445       'conditions': [
3446         [ 'OS=="ios"', {
3447           'Profile': {
3448             'inherit_from': ['Common_Base', 'x86_Base', 'Release_Base'],
3449             'target_conditions': [
3450               [ '_type=="executable"', {
3451                 # To get a real .dSYM bundle produced by dsymutil, set the
3452                 # debug information format to dwarf-with-dsym.  Since
3453                 # strip_from_xcode will not be used, set Xcode to do the
3454                 # stripping as well.
3455                 'xcode_settings': {
3456                   'DEBUG_INFORMATION_FORMAT': 'dwarf-with-dsym',
3457                   'DEPLOYMENT_POSTPROCESSING': 'YES',
3458                   'STRIP_INSTALLED_PRODUCT': 'YES',
3459                 },
3460               }],
3461             ],
3462           },
3463         }],
3464         [ 'OS=="win"', {
3465           # TODO(bradnelson): add a gyp mechanism to make this more graceful.
3466           'Debug_x64': {
3467             'inherit_from': ['Common_Base', 'x64_Base', 'Debug_Base'],
3468           },
3469           'Release_x64': {
3470             'inherit_from': ['Common_Base', 'x64_Base', 'Release_Base'],
3471           },
3472         }],
3473       ],
3474     },
3475   },
3476   'conditions': [
3477     ['os_posix==1', {
3478       'target_defaults': {
3479         'ldflags': [
3480           '-Wl,-z,now',
3481           '-Wl,-z,relro',
3482         ],
3483         # TODO(glider): enable the default options on other systems.
3484         'conditions': [
3485           ['use_sanitizer_options==1 and ((OS=="linux" and (chromeos==0 or target_arch!="ia32")) or OS=="mac")', {
3486             'dependencies': [
3487               '<(DEPTH)/build/sanitizers/sanitizers.gyp:sanitizer_options',
3488             ],
3489           }],
3490         ],
3491       },
3492     }],
3493     # TODO(jochen): Enable this on chromeos on arm. http://crbug.com/356580
3494     ['os_posix==1 and disable_fatal_linker_warnings==0 and use_evdev_gestures==0 and (chromeos==0 or target_arch!="arm")', {
3495       'target_defaults': {
3496         'ldflags': [
3497           '-Wl,--fatal-warnings',
3498         ],
3499       },
3500     }],
3501     ['os_posix==1 and chromeos==0', {
3502       # Chrome OS enables -fstack-protector-strong via its build wrapper,
3503       # and we want to avoid overriding this, so stack-protector is only
3504       # enabled when not building on Chrome OS.
3505       # TODO(phajdan.jr): Use -fstack-protector-strong when our gcc
3506       # supports it.
3507       'target_defaults': {
3508         'cflags': [
3509           '-fstack-protector',
3510           '--param=ssp-buffer-size=4',
3511         ],
3512       },
3513     }],
3514     ['os_posix==1 and OS!="mac" and OS!="ios"', {
3515       'target_defaults': {
3516         # Enable -Werror by default, but put it in a variable so it can
3517         # be disabled in ~/.gyp/include.gypi on the valgrind builders.
3518         'variables': {
3519           'werror%': '-Werror',
3520           'libraries_for_target%': '',
3521         },
3522         'defines': [
3523           '_FILE_OFFSET_BITS=64',
3524         ],
3525         'cflags': [
3526           '<(werror)',  # See note above about the werror variable.
3527           '-pthread',
3528           '-fno-strict-aliasing',  # See http://crbug.com/32204
3529           '-Wall',
3530           # TODO(evan): turn this back on once all the builds work.
3531           # '-Wextra',
3532           # Don't warn about unused function params.  We use those everywhere.
3533           '-Wno-unused-parameter',
3534           # Don't warn about the "struct foo f = {0};" initialization pattern.
3535           '-Wno-missing-field-initializers',
3536           # Don't export any symbols (for example, to plugins we dlopen()).
3537           # Note: this is *required* to make some plugins work.
3538           '-fvisibility=hidden',
3539           '-pipe',
3540         ],
3541         'cflags_cc': [
3542           '-fno-exceptions',
3543           '-fno-rtti',
3544           '-fno-threadsafe-statics',
3545           # Make inline functions have hidden visiblity by default.
3546           # Surprisingly, not covered by -fvisibility=hidden.
3547           '-fvisibility-inlines-hidden',
3548           # GCC turns on -Wsign-compare for C++ under -Wall, but clang doesn't,
3549           # so we specify it explicitly.  (llvm.org/PR10448, crbug.com/90453)
3550           '-Wsign-compare',
3551         ],
3552         'ldflags': [
3553           '-pthread', '-Wl,-z,noexecstack',
3554         ],
3555         'libraries' : [
3556           '<(libraries_for_target)',
3557         ],
3558         'configurations': {
3559           'Debug_Base': {
3560             'variables': {
3561               'debug_optimize%': '0',
3562             },
3563             'defines': [
3564               '_DEBUG',
3565             ],
3566             'cflags': [
3567               '-O>(debug_optimize)',
3568               '-g',
3569               '-gdwarf-4',
3570             ],
3571             'conditions' : [
3572               ['OS=="android"', {
3573                 'ldflags': [
3574                   # Warn in case of text relocations.
3575                   '-Wl,--warn-shared-textrel',
3576                 ],
3577               }],
3578               ['OS=="android" and android_full_debug==0', {
3579                 # Some configurations are copied from Release_Base to reduce
3580                 # the binary size.
3581                 'variables': {
3582                   'debug_optimize%': 's',
3583                 },
3584                 'cflags': [
3585                   '-fdata-sections',
3586                   '-ffunction-sections',
3587                 ],
3588                 'ldflags': [
3589                   '-Wl,-O1',
3590                   '-Wl,--as-needed',
3591                 ],
3592               }],
3593               ['OS=="android" and android_full_debug==0 and target_arch!="arm64"', {
3594                 # We don't omit frame pointers on arm64 since they are required
3595                 # to correctly unwind stackframes which contain system library
3596                 # function frames (crbug.com/391706).
3597                 'cflags': [
3598                   '-fomit-frame-pointer',
3599                 ],
3600               }],
3601               ['OS=="linux" and target_arch=="ia32"', {
3602                 'ldflags': [
3603                   '-Wl,--no-as-needed',
3604                 ],
3605               }],
3606               ['debug_unwind_tables==1', {
3607                 'cflags': ['-funwind-tables'],
3608               }, {
3609                 'cflags': ['-fno-unwind-tables', '-fno-asynchronous-unwind-tables'],
3610               }],
3611               # TODO(mostynb): shuffle clang/gcc_version/binutils_version
3612               # definitions in to the right scope to use them when setting
3613               # linux_use_debug_fission, so it can be used here alone.
3614               ['linux_use_debug_fission==1 and linux_use_gold_flags==1 and (clang==1 or gcc_version>=48) and binutils_version>=223', {
3615                 'cflags': ['-gsplit-dwarf'],
3616               }],
3617             ],
3618           },
3619           'Release_Base': {
3620             'variables': {
3621               'release_optimize%': '2',
3622               # Binaries become big and gold is unable to perform GC
3623               # and remove unused sections for some of test targets
3624               # on 32 bit platform.
3625               # (This is currently observed only in chromeos valgrind bots)
3626               # The following flag is to disable --gc-sections linker
3627               # option for these bots.
3628               'no_gc_sections%': 0,
3630               # TODO(bradnelson): reexamine how this is done if we change the
3631               # expansion of configurations
3632               'release_valgrind_build%': 0,
3633             },
3634             'cflags': [
3635               '-O<(release_optimize)',
3636               # Don't emit the GCC version ident directives, they just end up
3637               # in the .comment section taking up binary size.
3638               '-fno-ident',
3639               # Put data and code in their own sections, so that unused symbols
3640               # can be removed at link time with --gc-sections.
3641               '-fdata-sections',
3642               '-ffunction-sections',
3643             ],
3644             'ldflags': [
3645               # Specifically tell the linker to perform optimizations.
3646               # See http://lwn.net/Articles/192624/ .
3647               '-Wl,-O1',
3648               '-Wl,--as-needed',
3649             ],
3650             'conditions' : [
3651               ['no_gc_sections==0', {
3652                 'ldflags': [
3653                   '-Wl,--gc-sections',
3654                 ],
3655               }],
3656               ['OS=="android" and target_arch!="arm64"', {
3657                 # We don't omit frame pointers on arm64 since they are required
3658                 # to correctly unwind stackframes which contain system library
3659                 # function frames (crbug.com/391706).
3660                 'cflags': [
3661                   '-fomit-frame-pointer',
3662                 ]
3663               }],
3664               ['OS=="android"', {
3665                 'variables': {
3666                   'release_optimize%': 's',
3667                 },
3668                 'ldflags': [
3669                   # Warn in case of text relocations.
3670                   '-Wl,--warn-shared-textrel',
3671                 ],
3672               }],
3673               ['profiling==1', {
3674                 'cflags': [
3675                   '-fno-omit-frame-pointer',
3676                   '-g',
3677                 ],
3678                 'conditions' : [
3679                   ['profiling_full_stack_frames==1', {
3680                     'cflags': [
3681                       '-fno-inline',
3682                       '-fno-optimize-sibling-calls',
3683                     ],
3684                   }],
3685                 ],
3686               }],
3687               ['release_unwind_tables==1', {
3688                 'cflags': ['-funwind-tables'],
3689               }, {
3690                 'cflags': ['-fno-unwind-tables', '-fno-asynchronous-unwind-tables'],
3691               }],
3692             ],
3693           },
3694         },
3695         'conditions': [
3696           ['target_arch=="ia32"', {
3697             'target_conditions': [
3698               ['_toolset=="target"', {
3699                 'asflags': [
3700                   # Needed so that libs with .s files (e.g. libicudata.a)
3701                   # are compatible with the general 32-bit-ness.
3702                   '-32',
3703                 ],
3704                 # All floating-point computations on x87 happens in 80-bit
3705                 # precision.  Because the C and C++ language standards allow
3706                 # the compiler to keep the floating-point values in higher
3707                 # precision than what's specified in the source and doing so
3708                 # is more efficient than constantly rounding up to 64-bit or
3709                 # 32-bit precision as specified in the source, the compiler,
3710                 # especially in the optimized mode, tries very hard to keep
3711                 # values in x87 floating-point stack (in 80-bit precision)
3712                 # as long as possible. This has important side effects, that
3713                 # the real value used in computation may change depending on
3714                 # how the compiler did the optimization - that is, the value
3715                 # kept in 80-bit is different than the value rounded down to
3716                 # 64-bit or 32-bit. There are possible compiler options to
3717                 # make this behavior consistent (e.g. -ffloat-store would keep
3718                 # all floating-values in the memory, thus force them to be
3719                 # rounded to its original precision) but they have significant
3720                 # runtime performance penalty.
3721                 #
3722                 # -mfpmath=sse -msse2 makes the compiler use SSE instructions
3723                 # which keep floating-point values in SSE registers in its
3724                 # native precision (32-bit for single precision, and 64-bit
3725                 # for double precision values). This means the floating-point
3726                 # value used during computation does not change depending on
3727                 # how the compiler optimized the code, since the value is
3728                 # always kept in its specified precision.
3729                 #
3730                 # Refer to http://crbug.com/348761 for rationale behind SSE2
3731                 # being a minimum requirement for 32-bit Linux builds and
3732                 # http://crbug.com/313032 for an example where this has "bit"
3733                 # us in the past.
3734                 'cflags': [
3735                   '-msse2',
3736                   '-mfpmath=sse',
3737                   '-mmmx',  # Allows mmintrin.h for MMX intrinsics.
3738                   '-m32',
3739                 ],
3740                 'ldflags': [
3741                   '-m32',
3742                 ],
3743                 'conditions': [
3744                   # Use gold linker for Android ia32 target.
3745                   ['OS=="android"', {
3746                     'ldflags': [
3747                       '-fuse-ld=gold',
3748                     ],
3749                   }],
3750                   # Install packages have started cropping up with
3751                   # different headers between the 32-bit and 64-bit
3752                   # versions, so we have to shadow those differences off
3753                   # and make sure a 32-bit-on-64-bit build picks up the
3754                   # right files.
3755                   # For android build, use NDK headers instead of host headers
3756                   ['host_arch!="ia32" and OS!="android"', {
3757                     'include_dirs+': [
3758                       '/usr/include32',
3759                     ],
3760                   }],
3761                 ],
3762               }],
3763             ],
3764           }],
3765           ['target_arch=="x64"', {
3766             'target_conditions': [
3767               ['_toolset=="target"', {
3768                 'conditions': [
3769                   # Use gold linker for Android x64 target.
3770                   ['OS=="android"', {
3771                     'ldflags': [
3772                       '-fuse-ld=gold',
3773                     ],
3774                   }],
3775                 ],
3776                 'cflags': [
3777                   '-m64',
3778                   '-march=x86-64',
3779                 ],
3780                 'ldflags': [
3781                   '-m64',
3782                 ],
3783               }],
3784             ],
3785           }],
3786           ['target_arch=="arm"', {
3787             'target_conditions': [
3788               ['_toolset=="target"', {
3789                 'conditions': [
3790                   ['clang==0', {
3791                     'cflags_cc': [
3792                       # The codesourcery arm-2009q3 toolchain warns at that the ABI
3793                       # has changed whenever it encounters a varargs function. This
3794                       # silences those warnings, as they are not helpful and
3795                       # clutter legitimate warnings.
3796                       '-Wno-abi',
3797                     ],
3798                   }],
3799                   ['clang==1 and arm_arch!="" and OS!="android"', {
3800                     'cflags': [
3801                       '-target arm-linux-gnueabihf',
3802                     ],
3803                     'ldflags': [
3804                       '-target arm-linux-gnueabihf',
3805                     ],
3806                   }],
3807                   ['arm_arch!=""', {
3808                     'cflags': [
3809                       '-march=<(arm_arch)',
3810                     ],
3811                   }],
3812                   ['clang==1 and OS!="android"', {
3813                     'cflags': [
3814                       # We need to disable clang's builtin assembler as it can't
3815                       # handle several asm files, crbug.com/124610
3816                       '-no-integrated-as',
3817                     ],
3818                   }],
3819                   ['arm_tune!=""', {
3820                     'cflags': [
3821                       '-mtune=<(arm_tune)',
3822                     ],
3823                   }],
3824                   ['arm_fpu!=""', {
3825                     'cflags': [
3826                       '-mfpu=<(arm_fpu)',
3827                     ],
3828                   }],
3829                   ['arm_float_abi!=""', {
3830                     'cflags': [
3831                       '-mfloat-abi=<(arm_float_abi)',
3832                     ],
3833                   }],
3834                   ['arm_thumb==1', {
3835                     'cflags': [
3836                       '-mthumb',
3837                     ],
3838                   }],
3839                   ['OS=="android"', {
3840                     # Most of the following flags are derived from what Android
3841                     # uses by default when building for arm, reference for which
3842                     # can be found in the following file in the Android NDK:
3843                     # toolchains/arm-linux-androideabi-4.9/setup.mk
3844                     'cflags': [
3845                       # The tree-sra optimization (scalar replacement for
3846                       # aggregates enabling subsequent optimizations) leads to
3847                       # invalid code generation when using the Android NDK's
3848                       # compiler (r5-r7). This can be verified using
3849                       # webkit_unit_tests' WTF.Checked_int8_t test.
3850                       '-fno-tree-sra',
3851                       # The following option is disabled to improve binary
3852                       # size and performance in gcc 4.9.
3853                       '-fno-caller-saves',
3854                       '-Wno-psabi',
3855                     ],
3856                     # Android now supports .relro sections properly.
3857                     # NOTE: While these flags enable the generation of .relro
3858                     # sections, the generated libraries can still be loaded on
3859                     # older Android platform versions.
3860                     'ldflags': [
3861                         '-Wl,-z,relro',
3862                         '-Wl,-z,now',
3863                         '-fuse-ld=gold',
3864                     ],
3865                     'conditions': [
3866                       ['gcc_version==48 and clang==0', {
3867                         'cflags': [
3868                           # The following 5 options are disabled to save on
3869                           # binary size in GCC 4.8.
3870                           '-fno-partial-inlining',
3871                           '-fno-early-inlining',
3872                           '-fno-tree-copy-prop',
3873                           '-fno-tree-loop-optimize',
3874                           '-fno-move-loop-invariants',
3875                         ],
3876                       }],
3877                       ['arm_thumb==1', {
3878                         'cflags': [ '-mthumb-interwork' ],
3879                       }],
3880                       ['profiling==1', {
3881                         'cflags': [
3882                           # Thumb code with frame pointer makes chrome crash
3883                           # early.
3884                           '-marm',
3885                           '-mapcs-frame', # Required by -fno-omit-frame-pointer.
3886                           # The perf report sometimes incorrectly attributes
3887                           # code from tail calls.
3888                           '-fno-optimize-sibling-calls',
3889                         ],
3890                         'cflags!': [
3891                           '-fomit-frame-pointer',
3892                         ],
3893                       }],
3894                       ['clang==1', {
3895                         'cflags!': [
3896                           # Clang does not support the following options.
3897                           '-mthumb-interwork',
3898                           '-finline-limit=64',
3899                           '-fno-tree-sra',
3900                           '-fno-caller-saves',
3901                           '-Wno-psabi',
3902                         ],
3903                         'cflags': [
3904                           # TODO(hans) Enable integrated-as (crbug.com/124610).
3905                           '-no-integrated-as',
3906                           '-B<(android_toolchain)',  # Else /usr/bin/as gets picked up.
3907                         ],
3908                         'ldflags': [
3909                           # Let clang find the ld.gold in the NDK.
3910                           '--gcc-toolchain=<(android_toolchain)/..',
3911                         ],
3912                       }],
3913                       ['asan==1', {
3914                         'cflags': [
3915                           '-marm', # Required for frame pointer based stack traces.
3916                         ],
3917                       }],
3918                     ],
3919                   }],
3920                   ['chromecast==1', {
3921                     'cflags': [
3922                       # We set arm_arch to "" so that -march compiler option
3923                       # is not set.  Otherwise a gcc bug that would complain
3924                       # about it conflicting with '-mcpu=cortex-a9'. The flag
3925                       # '-march=armv7-a' is actually redundant anyway because
3926                       # it is enabled by default when we built the toolchain.
3927                       # And using '-mcpu=cortex-a9' should be sufficient.
3928                       '-mcpu=cortex-a9',
3929                       '-funwind-tables',
3930                       # Breakpad requires symbols with debugging information
3931                       '-g',
3932                     ],
3933                     'ldflags': [
3934                       # We want to statically link libstdc++/libgcc_s.
3935                       '-static-libstdc++',
3936                       '-static-libgcc',
3937                     ],
3938                     'cflags!': [
3939                       # Some components in Chromium (e.g. v8, skia, ffmpeg)
3940                       # define their own cflags for arm builds that could
3941                       # conflict with the flags we set here (e.g.
3942                       # '-mcpu=cortex-a9'). Remove these flags explicitly.
3943                       '-march=armv7-a',
3944                       '-mtune=cortex-a8',
3945                     ],
3946                   }],
3947                 ],
3948               }],
3949             ],
3950           }],
3951           ['target_arch=="arm64"', {
3952             'target_conditions': [
3953               ['_toolset=="target"', {
3954                 'conditions': [
3955                   ['OS=="android"', {
3956                     'cflags!': [
3957                        '-fstack-protector',  # stack protector is always enabled on arm64.
3958                     ],
3959                   }],
3960                 ],
3961               }],
3962             ],
3963           }],
3964           ['target_arch=="mipsel"', {
3965             'target_conditions': [
3966               ['_toolset=="target"', {
3967                 'conditions': [
3968                   ['android_webview_build==0 and mips_arch_variant=="r6"', {
3969                     'cflags': ['-mips32r6', '-Wa,-mips32r6'],
3970                     'conditions': [
3971                       ['OS=="android"', {
3972                         'ldflags': ['-mips32r6', '-Wl,-melf32ltsmip',],
3973                       }],
3974                     ],
3975                   }],
3976                   ['android_webview_build==0 and mips_arch_variant=="r2"', {
3977                     'cflags': ['-mips32r2', '-Wa,-mips32r2'],
3978                   }],
3979                   ['android_webview_build==0 and mips_arch_variant=="r1"', {
3980                     'cflags': ['-mips32', '-Wa,-mips32'],
3981                   }],
3982                 ],
3983                 'ldflags': [
3984                   '-Wl,--no-keep-memory'
3985                 ],
3986                 'cflags_cc': [
3987                   '-Wno-uninitialized',
3988                 ],
3989               }],
3990             ],
3991           }],
3992           ['target_arch=="mips64el"', {
3993             'target_conditions': [
3994               ['_toolset=="target"', {
3995                 'conditions': [
3996                   ['android_webview_build==0 and mips_arch_variant=="r6"', {
3997                     'cflags': ['-mips64r6', '-Wa,-mips64r6'],
3998                     'ldflags': [ '-mips64r6' ],
3999                   }],
4000                   ['android_webview_build==0 and mips_arch_variant=="r2"', {
4001                     'cflags': ['-mips64r2', '-Wa,-mips64r2'],
4002                     'ldflags': [ '-mips64r2' ],
4003                   }],
4004                 ],
4005                 'cflags_cc': [
4006                   '-Wno-uninitialized',
4007                 ],
4008               }],
4009             ],
4010           }],
4011           ['linux_fpic==1', {
4012             'cflags': [
4013               '-fPIC',
4014             ],
4015             'ldflags': [
4016               '-fPIC',
4017             ],
4018           }],
4019           ['sysroot!=""', {
4020             'target_conditions': [
4021               ['_toolset=="target"', {
4022                 'cflags': [
4023                   '--sysroot=<(sysroot)',
4024                 ],
4025                 'ldflags': [
4026                   '--sysroot=<(sysroot)',
4027                   '<!(<(DEPTH)/build/linux/sysroot_ld_path.sh <(sysroot))',
4028                 ],
4029               }]]
4030           }],
4031           ['clang==1', {
4032             'cflags': [
4033               # TODO(thakis): Remove, http://crbug.com/263960
4034               '-Wno-reserved-user-defined-literal',
4035             ],
4036             'cflags_cc': [
4037               # See the comment in the Mac section for what it takes to move
4038               # this to -std=c++11.
4039               '-std=gnu++11',
4040             ],
4041           }],
4042           ['clang==0 and host_clang==1', {
4043             'target_conditions': [
4044               ['_toolset=="host"', {
4045                 'cflags_cc': [ '-std=gnu++11', ],
4046               }],
4047             ],
4048           }],
4049           ['clang==1 and clang_use_chrome_plugins==1', {
4050             'cflags': [
4051               '<@(clang_chrome_plugins_flags)',
4052             ],
4053           }],
4054           ['clang==1 and clang_load!=""', {
4055             'cflags': [
4056               '-Xclang', '-load', '-Xclang', '<(clang_load)',
4057             ],
4058           }],
4059           ['clang==1 and clang_add_plugin!=""', {
4060             'cflags': [
4061               '-Xclang', '-add-plugin', '-Xclang', '<(clang_add_plugin)',
4062             ],
4063           }],
4064           ['clang==1 and target_arch=="ia32"', {
4065             'cflags': [
4066               # Else building libyuv gives clang's register allocator issues,
4067               # see llvm.org/PR15798 / crbug.com/233709
4068               '-momit-leaf-frame-pointer',
4069             ],
4070           }],
4071           ['clang==1 and "<(GENERATOR)"=="ninja"', {
4072             'cflags': [
4073               # See http://crbug.com/110262
4074               '-fcolor-diagnostics',
4075             ],
4076           }],
4077           # Common options for AddressSanitizer, LeakSanitizer,
4078           # ThreadSanitizer and MemorySanitizer.
4079           ['asan==1 or lsan==1 or tsan==1 or msan==1 or ubsan==1 or ubsan_vptr==1', {
4080             'target_conditions': [
4081               ['_toolset=="target"', {
4082                 'cflags': [
4083                   '-fno-omit-frame-pointer',
4084                   '-gline-tables-only',
4085                 ],
4086                 'cflags!': [
4087                   '-fomit-frame-pointer',
4088                 ],
4089               }],
4090             ],
4091           }],
4092           ['asan==1 or lsan==1 or tsan==1 or msan==1', {
4093             'target_conditions': [
4094               ['_toolset=="target"', {
4095                 'ldflags!': [
4096                   # Functions interposed by the sanitizers can make ld think
4097                   # that some libraries aren't needed when they actually are,
4098                   # http://crbug.com/234010. As workaround, disable --as-needed.
4099                   '-Wl,--as-needed',
4100                 ],
4101                 'defines': [
4102                   'MEMORY_TOOL_REPLACES_ALLOCATOR',
4103                   'MEMORY_SANITIZER_INITIAL_SIZE',
4104                 ],
4105               }],
4106             ],
4107           }],
4108           ['asan==1', {
4109             'target_conditions': [
4110               ['_toolset=="target"', {
4111                 'cflags': [
4112                   '-fsanitize=address',
4113                 ],
4114                 'ldflags': [
4115                   '-fsanitize=address',
4116                 ],
4117               }],
4118             ],
4119             'conditions': [
4120               ['OS=="mac"', {
4121                 'cflags': [
4122                   '-mllvm -asan-globals=0',  # http://crbug.com/352073
4123                 ],
4124               }],
4125             ],
4126           }],
4127           ['ubsan==1', {
4128             'target_conditions': [
4129               ['_toolset=="target"', {
4130                 'cflags': [
4131                   '-fsanitize=undefined',
4132                   # -fsanitize=vptr is incompatible with -fno-rtti.
4133                   '-fno-sanitize=vptr',
4134                 ],
4135                 'ldflags': [
4136                   '-fsanitize=undefined',
4137                   # -fsanitize=vptr is incompatible with -fno-rtti.
4138                   '-fno-sanitize=vptr',
4139                 ],
4140               }],
4141             ],
4142           }],
4143           ['ubsan_vptr==1', {
4144             'target_conditions': [
4145               ['_toolset=="target"', {
4146                 'cflags': [
4147                   '-fsanitize=vptr',
4148                   '-fsanitize-blacklist=<(ubsan_vptr_blacklist)',
4149                 ],
4150                 'cflags_cc!': [
4151                   '-fno-rtti',
4152                 ],
4153                 'cflags!': [
4154                   '-fno-rtti',
4155                 ],
4156                 'ldflags': [
4157                   '-fsanitize=vptr',
4158                 ],
4159                 'defines': [
4160                   'UNDEFINED_SANITIZER',
4161                 ],
4162               }],
4163             ],
4164           }],
4165           ['asan_coverage!=0', {
4166             'target_conditions': [
4167               ['_toolset=="target"', {
4168                 'cflags': [
4169                   '-mllvm -asan-coverage=<(asan_coverage)',
4170                 ],
4171               }],
4172             ],
4173           }],
4174           ['lsan==1', {
4175             'target_conditions': [
4176               ['_toolset=="target"', {
4177                 'cflags': [
4178                   '-fsanitize=leak',
4179                 ],
4180                 'ldflags': [
4181                   '-fsanitize=leak',
4182                 ],
4183                 'defines': [
4184                   'LEAK_SANITIZER',
4185                   'WTF_USE_LEAK_SANITIZER=1',
4186                 ],
4187               }],
4188             ],
4189           }],
4190           ['tsan==1', {
4191             'target_conditions': [
4192               ['_toolset=="target"', {
4193                 'cflags': [
4194                   '-fsanitize=thread',
4195                   '-fPIC',
4196                   '-fsanitize-blacklist=<(tsan_blacklist)',
4197                 ],
4198                 'ldflags': [
4199                   '-fsanitize=thread',
4200                 ],
4201                 'defines': [
4202                   'THREAD_SANITIZER',
4203                   'DYNAMIC_ANNOTATIONS_EXTERNAL_IMPL=1',
4204                   'WTF_USE_DYNAMIC_ANNOTATIONS_NOIMPL=1',
4205                 ],
4206                 'target_conditions': [
4207                   ['_type=="executable"', {
4208                     'ldflags': [
4209                       '-pie',
4210                     ],
4211                   }],
4212                 ],
4213               }],
4214             ],
4215           }],
4216           ['msan==1', {
4217             'target_conditions': [
4218               ['_toolset=="target"', {
4219                 'cflags': [
4220                   '-fsanitize=memory',
4221                   '-fsanitize-memory-track-origins=<(msan_track_origins)',
4222                   '-fPIC',
4223                   '-fsanitize-blacklist=<(msan_blacklist)',
4224                 ],
4225                 'ldflags': [
4226                   '-fsanitize=memory',
4227                 ],
4228                 'defines': [
4229                   'MEMORY_SANITIZER',
4230                 ],
4231                 'target_conditions': [
4232                   ['_type=="executable"', {
4233                     'ldflags': [
4234                       '-pie',
4235                     ],
4236                   }],
4237                 ],
4238               }],
4239             ],
4240           }],
4241           ['use_instrumented_libraries==1', {
4242             'dependencies': [
4243               '<(DEPTH)/third_party/instrumented_libraries/instrumented_libraries.gyp:instrumented_libraries',
4244             ],
4245           }],
4246           ['use_custom_libcxx==1', {
4247             'dependencies': [
4248               '<(DEPTH)/third_party/libc++/libc++.gyp:libcxx_proxy',
4249             ],
4250           }],
4251           ['order_profiling!=0 and (chromeos==1 or OS=="linux" or OS=="android")', {
4252             'target_conditions' : [
4253               # crazy_linker has an upstream gyp file we can't edit, and we
4254               # don't want to instrument it.
4255               ['_toolset=="target" and _target_name!="crazy_linker"', {
4256                 'cflags': [
4257                   '-finstrument-functions',
4258                   # Allow mmx intrinsics to inline, so that the
4259                   #0 compiler can expand the intrinsics.
4260                   '-finstrument-functions-exclude-file-list=mmintrin.h',
4261                 ],
4262               }],
4263               ['_toolset=="target" and OS=="android"', {
4264                 'cflags': [
4265                   # Avoids errors with current NDK:
4266                   # "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"
4267                   '-finstrument-functions-exclude-file-list=arm_neon.h,SaturatedArithmeticARM.h',
4268                 ],
4269               }],
4270             ],
4271           }],
4272           ['linux_dump_symbols==1', {
4273             'cflags': [ '-g' ],
4274             'conditions': [
4275               ['OS=="linux" and host_arch=="ia32" and linux_use_bundled_gold==0', {
4276                 'target_conditions': [
4277                   ['_toolset=="target"', {
4278                     'ldflags': [
4279                       # Attempt to use less memory to prevent the linker from
4280                       # running out of address space. Considering installing a
4281                       # 64-bit kernel and switching to a 64-bit linker.
4282                       '-Wl,--no-keep-memory',
4283                     ],
4284                   }],
4285                 ],
4286               }],
4287             ],
4288           }],
4289           ['use_allocator!="tcmalloc"', {
4290             'defines': ['NO_TCMALLOC'],
4291           }],
4292           ['linux_use_gold_flags==1', {
4293             # Newer gccs and clangs support -fuse-ld, use the flag to force gold
4294             # selection.
4295             # gcc -- http://gcc.gnu.org/onlinedocs/gcc-4.8.0/gcc/Optimize-Options.html
4296             'ldflags': [ '-fuse-ld=gold', ],
4298             'target_conditions': [
4299               ['_toolset=="target"', {
4300                 'ldflags': [
4301                   # Experimentation found that using four linking threads
4302                   # saved ~20% of link time.
4303                   # https://groups.google.com/a/chromium.org/group/chromium-dev/browse_thread/thread/281527606915bb36
4304                   # Only apply this to the target linker, since the host
4305                   # linker might not be gold, but isn't used much anyway.
4306                   # TODO(raymes): Disable threading because gold is frequently
4307                   # crashing on the bots: crbug.com/161942.
4308                   # '-Wl,--threads',
4309                   # '-Wl,--thread-count=4',
4310                 ],
4311               }],
4312             ],
4313             'conditions': [
4314               ['release_valgrind_build==0', {
4315                 'target_conditions': [
4316                   ['_toolset=="target"', {
4317                     'ldflags': [
4318                       '-Wl,--icf=safe',
4319                     ],
4320                   }],
4321                 ],
4322               }],
4323             ],
4324           }],
4325           ['linux_use_bundled_binutils==1', {
4326             'cflags': [
4327               '-B<!(cd <(DEPTH) && pwd -P)/<(binutils_dir)',
4328             ],
4329           }],
4330           ['linux_use_bundled_gold==1', {
4331             # Put our binutils, which contains gold in the search path. We pass
4332             # the path to gold to the compiler. gyp leaves unspecified what the
4333             # cwd is when running the compiler, so the normal gyp path-munging
4334             # fails us. This hack gets the right path.
4335             'ldflags': [
4336               '-B<!(cd <(DEPTH) && pwd -P)/<(binutils_dir)',
4337             ],
4338           }],
4339           # Some binutils 2.23 releases may or may not have new dtags enabled,
4340           # but they are all compatible with --disable-new-dtags,
4341           # because the new dynamic tags are not created by default.
4342           ['binutils_version>=223', {
4343             # Newer binutils don't set DT_RPATH unless you disable "new" dtags
4344             # and the new DT_RUNPATH doesn't work without --no-as-needed flag.
4345             # FIXME(mithro): Figure out the --as-needed/--no-as-needed flags
4346             # inside this file to allow usage of --no-as-needed and removal of
4347             # this flag.
4348             'ldflags': [
4349               '-Wl,--disable-new-dtags',
4350             ],
4351           }],
4352           ['gcc_version>=47 and clang==0', {
4353             'target_conditions': [
4354               ['_toolset=="target"', {
4355                 'cflags_cc': [
4356                   '-std=gnu++11',
4357                   # See comment for -Wno-c++11-narrowing.
4358                   '-Wno-narrowing',
4359                   # TODO(thakis): Remove, http://crbug.com/263960
4360                   '-Wno-literal-suffix',
4361                 ],
4362               }],
4363             ],
4364           }],
4365           ['host_gcc_version>=47 and clang==0 and host_clang==0', {
4366             'target_conditions': [
4367               ['_toolset=="host"', {
4368                 'cflags_cc': [
4369                   '-std=gnu++11',
4370                   # See comment for -Wno-c++11-narrowing.
4371                   '-Wno-narrowing',
4372                   # TODO(thakis): Remove, http://crbug.com/263960
4373                   '-Wno-literal-suffix',
4374                 ],
4375               }],
4376             ],
4377           }],
4378         ],
4379       },
4380     }],
4381     # FreeBSD-specific options; note that most FreeBSD options are set above,
4382     # with Linux.
4383     ['OS=="freebsd"', {
4384       'target_defaults': {
4385         'ldflags': [
4386           '-Wl,--no-keep-memory',
4387         ],
4388       },
4389     }],
4390     # Android-specific options; note that most are set above with Linux.
4391     ['OS=="android"', {
4392       'variables': {
4393         # This is a unique identifier for a given build. It's used for
4394         # identifying various build artifacts corresponding to a particular
4395         # build of chrome (e.g. where to find archived symbols).
4396         'chrome_build_id%': '',
4397         'conditions': [
4398           # Use shared stlport library when system one used.
4399           # Figure this out early since it needs symbols from libgcc.a, so it
4400           # has to be before that in the set of libraries.
4401           ['use_system_stlport==1', {
4402             'android_stlport_library': 'stlport',
4403           }, {
4404             'conditions': [
4405               ['component=="shared_library"', {
4406                   'android_stlport_library': 'stlport_shared',
4407               }, {
4408                   'android_stlport_library': 'stlport_static',
4409               }],
4410             ],
4411           }],
4412         ],
4414         # Placing this variable here prevents from forking libvpx, used
4415         # by remoting.  Remoting is off, so it needn't built,
4416         # so forking it's deps seems like overkill.
4417         # But this variable need defined to properly run gyp.
4418         # A proper solution is to have an OS==android conditional
4419         # in third_party/libvpx/libvpx.gyp to define it.
4420         'libvpx_path': 'lib/linux/arm',
4421       },
4422       'target_defaults': {
4423         'variables': {
4424           'release_extra_cflags%': '',
4425           'conditions': [
4426             # If we're using the components build, append "cr" to all shared
4427             # libraries to avoid naming collisions with android system library
4428             # versions with the same name (e.g. skia, icu).
4429             ['component=="shared_library"', {
4430               'android_product_extension': 'cr.so',
4431             }, {
4432               'android_product_extension': 'so',
4433             } ],
4434           ],
4435         },
4436         'target_conditions': [
4437           ['_type=="shared_library"', {
4438             'product_extension': '<(android_product_extension)',
4439           }],
4441           # Settings for building device targets using Android's toolchain.
4442           # These are based on the setup.mk file from the Android NDK.
4443           #
4444           # The NDK Android executable link step looks as follows:
4445           #  $LDFLAGS
4446           #  $(TARGET_CRTBEGIN_DYNAMIC_O)  <-- crtbegin.o
4447           #  $(PRIVATE_OBJECTS)            <-- The .o that we built
4448           #  $(PRIVATE_STATIC_LIBRARIES)   <-- The .a that we built
4449           #  $(TARGET_LIBGCC)              <-- libgcc.a
4450           #  $(PRIVATE_SHARED_LIBRARIES)   <-- The .so that we built
4451           #  $(PRIVATE_LDLIBS)             <-- System .so
4452           #  $(TARGET_CRTEND_O)            <-- crtend.o
4453           #
4454           # For now the above are approximated for executables by adding
4455           # crtbegin.o to the end of the ldflags and 'crtend.o' to the end
4456           # of 'libraries'.
4457           #
4458           # The NDK Android shared library link step looks as follows:
4459           #  $LDFLAGS
4460           #  $(PRIVATE_OBJECTS)            <-- The .o that we built
4461           #  -l,--whole-archive
4462           #  $(PRIVATE_WHOLE_STATIC_LIBRARIES)
4463           #  -l,--no-whole-archive
4464           #  $(PRIVATE_STATIC_LIBRARIES)   <-- The .a that we built
4465           #  $(TARGET_LIBGCC)              <-- libgcc.a
4466           #  $(PRIVATE_SHARED_LIBRARIES)   <-- The .so that we built
4467           #  $(PRIVATE_LDLIBS)             <-- System .so
4468           #
4469           # For now, assume that whole static libraries are not needed.
4470           #
4471           # For both executables and shared libraries, add the proper
4472           # libgcc.a to the start of libraries which puts it in the
4473           # proper spot after .o and .a files get linked in.
4474           #
4475           # TODO: The proper thing to do longer-tem would be proper gyp
4476           # support for a custom link command line.
4477           ['_toolset=="target"', {
4478             'cflags!': [
4479               '-pthread',  # Not supported by Android toolchain.
4480             ],
4481             'cflags': [
4482               '-ffunction-sections',
4483               '-funwind-tables',
4484               '-g',
4485               '-fstack-protector',
4486               '-fno-short-enums',
4487               '-finline-limit=64',
4488               '-Wa,--noexecstack',
4489               '<@(release_extra_cflags)',
4490             ],
4491             'defines': [
4492               'ANDROID',
4493               '__GNU_SOURCE=1',  # Necessary for clone()
4494               'USE_STLPORT=1',
4495               '_STLP_USE_PTR_SPECIALIZATIONS=1',
4496               'CHROME_BUILD_ID="<(chrome_build_id)"',
4497             ],
4498             'ldflags!': [
4499               '-pthread',  # Not supported by Android toolchain.
4500             ],
4501             'ldflags': [
4502               '-nostdlib',
4503               '-Wl,--no-undefined',
4504             ],
4505             'libraries': [
4506               '-l<(android_stlport_library)',
4507               # Manually link the libgcc.a that the cross compiler uses.
4508               '<!(<(android_toolchain)/*-gcc -print-libgcc-file-name)',
4509               '-lc',
4510               '-ldl',
4511               '-lm',
4512             ],
4513             'conditions': [
4514               ['component=="static_library"', {
4515                 'ldflags': [
4516                   '-Wl,--exclude-libs=ALL',
4517                 ],
4518               }],
4519               ['clang==1', {
4520                 'cflags': [
4521                   # Work around incompatibilities between bionic and clang
4522                   # headers.
4523                   '-D__compiler_offsetof=__builtin_offsetof',
4524                   '-Dnan=__builtin_nan',
4525                 ],
4526                 'conditions': [
4527                   ['target_arch=="arm"', {
4528                     'cflags': [
4529                       '-target arm-linux-androideabi',
4530                     ],
4531                     'ldflags': [
4532                       '-target arm-linux-androideabi',
4533                     ],
4534                   }],
4535                   ['target_arch=="ia32"', {
4536                     'cflags': [
4537                       '-target x86-linux-androideabi',
4538                     ],
4539                     'ldflags': [
4540                       '-target x86-linux-androideabi',
4541                     ],
4542                   }],
4543                   # Place holder for x64 support, not tested.
4544                   # TODO: Enable clang support for Android x64. http://crbug.com/346626
4545                   ['target_arch=="x64"', {
4546                     'cflags': [
4547                       '-target x86_64-linux-androideabi',
4548                     ],
4549                     'ldflags': [
4550                       '-target x86_64-linux-androideabi',
4551                     ],
4552                   }],
4553                 ],
4554               }],
4555               ['asan==1', {
4556                 'cflags': [
4557                   # Android build relies on -Wl,--gc-sections removing
4558                   # unreachable code. ASan instrumentation for globals inhibits
4559                   # this and results in a library with unresolvable relocations.
4560                   # TODO(eugenis): find a way to reenable this.
4561                   '-mllvm -asan-globals=0',
4562                 ],
4563               }],
4564               ['android_webview_build==0', {
4565                 'defines': [
4566                   # The NDK has these things, but doesn't define the constants
4567                   # to say that it does. Define them here instead.
4568                   'HAVE_SYS_UIO_H',
4569                 ],
4570                 'cflags': [
4571                   '--sysroot=<(android_ndk_sysroot)',
4572                 ],
4573                 'ldflags': [
4574                   '--sysroot=<(android_ndk_sysroot)',
4575                 ],
4576               }],
4577               ['android_webview_build==1', {
4578                 'include_dirs': [
4579                   # OpenAL headers from the Android tree.
4580                   '<(android_src)/frameworks/wilhelm/include',
4581                 ],
4582                 'cflags': [
4583                   # Android predefines this as 1; undefine it here so Chromium
4584                   # can redefine it later to be 2 for chromium code and unset
4585                   # for third party code. This works because cflags are added
4586                   # before defines.
4587                   '-U_FORTIFY_SOURCE',
4588                   # Disable any additional warnings enabled by the Android build system but which
4589                   # chromium does not build cleanly with (when treating warning as errors).
4590                   # Things that are part of -Wextra:
4591                   '-Wno-extra', # Enabled by -Wextra, but no specific flag
4592                   '-Wno-ignored-qualifiers',
4593                   '-Wno-type-limits',
4594                   '-Wno-unused-but-set-variable',
4595                 ],
4596                 'cflags_cc': [
4597                   # Other things unrelated to -Wextra:
4598                   '-Wno-non-virtual-dtor',
4599                   '-Wno-sign-promo',
4600                 ],
4601               }],
4602               ['android_webview_build==1', {
4603                 'target_conditions': [
4604                   ['chromium_code==0', {
4605                     'cflags': [
4606                       # There is a class of warning which:
4607                       #  1) Android always enables and also treats as errors
4608                       #  2) Chromium ignores in third party code
4609                       # So we re-enable those warnings when building Android.
4610                       '-Wno-address',
4611                       '-Wno-format-security',
4612                       '-Wno-return-type',
4613                       '-Wno-sequence-point',
4614                     ],
4615                     'cflags_cc': [
4616                       '-Wno-non-virtual-dtor',
4617                     ],
4618                   }],
4619                 ],
4620               }],
4621               ['target_arch == "arm"', {
4622                 'ldflags': [
4623                   # Enable identical code folding to reduce size.
4624                   '-Wl,--icf=safe',
4625                 ],
4626               }],
4627               # NOTE: The stlport header include paths below are specified in
4628               # cflags rather than include_dirs because they need to come
4629               # after include_dirs. Think of them like system headers, but
4630               # don't use '-isystem' because the arm-linux-androideabi-4.4.3
4631               # toolchain (circa Gingerbread) will exhibit strange errors.
4632               # The include ordering here is important; change with caution.
4633               ['use_system_stlport==1', {
4634                 'cflags': [
4635                   # For libstdc++/include, which is used by stlport.
4636                   '-I<(android_src)/bionic',
4637                   '-I<(android_src)/external/stlport/stlport',
4638                 ],
4639               }, { # else: use_system_stlport!=1
4640                 'cflags': [
4641                   '-isystem<(android_stlport_include)',
4642                 ],
4643                 'ldflags': [
4644                   '-L<(android_stlport_libs_dir)',
4645                 ],
4646               }],
4647               ['target_arch=="ia32"', {
4648                 # The x86 toolchain currently has problems with stack-protector.
4649                 'cflags!': [
4650                   '-fstack-protector',
4651                 ],
4652                 'cflags': [
4653                   '-fno-stack-protector',
4654                 ],
4655               }],
4656             ],
4657             'target_conditions': [
4658               ['_type=="executable"', {
4659                 # Force android tools to export the "main" symbol so they can be
4660                 # loaded on ICS using the run_pie wrapper. See crbug.com/373219.
4661                 # TODO(primiano): remove -fvisibility and -rdynamic flags below
4662                 # when ICS support will be dropped.
4663                 'cflags': [
4664                   '-fPIE',
4665                   '-fvisibility=default',
4666                 ],
4667                 'ldflags': [
4668                   '-Bdynamic',
4669                   '-Wl,--gc-sections',
4670                   '-Wl,-z,nocopyreloc',
4671                   '-pie',
4672                   '-rdynamic',
4673                   # crtbegin_dynamic.o should be the last item in ldflags.
4674                   '<(android_ndk_lib)/crtbegin_dynamic.o',
4675                 ],
4676                 'libraries': [
4677                   # crtend_android.o needs to be the last item in libraries.
4678                   # Do not add any libraries after this!
4679                   '<(android_ndk_lib)/crtend_android.o',
4680                 ],
4681               }],
4682               ['_type=="shared_library" or _type=="loadable_module"', {
4683                 'ldflags!': [
4684                   '-Wl,--exclude-libs=ALL',
4685                 ],
4686                 'ldflags': [
4687                   '-Wl,-shared,-Bsymbolic',
4688                 ],
4689                 'conditions': [
4690                   ['android_webview_build==0', {
4691                     'ldflags': [
4692                       # crtbegin_so.o should be the last item in ldflags.
4693                       '<(android_ndk_lib)/crtbegin_so.o',
4694                     ],
4695                     'libraries': [
4696                       # crtend_so.o needs to be the last item in libraries.
4697                       # Do not add any libraries after this!
4698                       '<(android_ndk_lib)/crtend_so.o',
4699                     ],
4700                   }],
4701                 ],
4702               }],
4703             ],
4704           }],
4705           # Settings for building host targets using the system toolchain.
4706           ['_toolset=="host"', {
4707             'cflags!': [
4708               # Due to issues in Clang build system, using ASan on 32-bit
4709               # binaries on x86_64 host is problematic.
4710               # TODO(eugenis): re-enable.
4711               '-fsanitize=address',
4712             ],
4713             'ldflags!': [
4714               '-fsanitize=address',
4715               '-Wl,-z,noexecstack',
4716               '-Wl,--gc-sections',
4717               '-Wl,-O1',
4718               '-Wl,--as-needed',
4719               '-Wl,--warn-shared-textrel',
4720               '-Wl,--fatal-warnings',
4721             ],
4722           }],
4723           # Settings for building host targets on mac.
4724           ['_toolset=="host" and host_os=="mac"', {
4725             'ldflags!': [
4726               '-Wl,-z,now',
4727               '-Wl,-z,relro',
4728             ],
4729           }],
4730         ],
4731       },
4732     }],
4733     ['OS=="solaris"', {
4734       'cflags!': ['-fvisibility=hidden'],
4735       'cflags_cc!': ['-fvisibility-inlines-hidden'],
4736     }],
4737     ['OS=="mac" or OS=="ios"', {
4738       'target_defaults': {
4739         'mac_bundle': 0,
4740         'xcode_settings': {
4741           'ALWAYS_SEARCH_USER_PATHS': 'NO',
4742           # Don't link in libarclite_macosx.a, see http://crbug.com/156530.
4743           'CLANG_LINK_OBJC_RUNTIME': 'NO',          # -fno-objc-link-runtime
4744           'COPY_PHASE_STRIP': 'NO',
4745           'GCC_C_LANGUAGE_STANDARD': 'c99',         # -std=c99
4746           'GCC_CW_ASM_SYNTAX': 'NO',                # No -fasm-blocks
4747           'GCC_ENABLE_CPP_EXCEPTIONS': 'NO',        # -fno-exceptions
4748           'GCC_ENABLE_CPP_RTTI': 'NO',              # -fno-rtti
4749           'GCC_ENABLE_PASCAL_STRINGS': 'NO',        # No -mpascal-strings
4750           # GCC_INLINES_ARE_PRIVATE_EXTERN maps to -fvisibility-inlines-hidden
4751           'GCC_INLINES_ARE_PRIVATE_EXTERN': 'YES',
4752           'GCC_OBJC_CALL_CXX_CDTORS': 'YES',        # -fobjc-call-cxx-cdtors
4753           'GCC_SYMBOLS_PRIVATE_EXTERN': 'YES',      # -fvisibility=hidden
4754           'GCC_THREADSAFE_STATICS': 'NO',           # -fno-threadsafe-statics
4755           'GCC_TREAT_WARNINGS_AS_ERRORS': 'YES',    # -Werror
4756           'GCC_VERSION': '4.2',
4757           'GCC_WARN_ABOUT_MISSING_NEWLINE': 'YES',  # -Wnewline-eof
4758           'USE_HEADERMAP': 'NO',
4759           'WARNING_CFLAGS': [
4760             '-Wall',
4761             '-Wendif-labels',
4762             '-Wextra',
4763             # Don't warn about unused function parameters.
4764             '-Wno-unused-parameter',
4765             # Don't warn about the "struct foo f = {0};" initialization
4766             # pattern.
4767             '-Wno-missing-field-initializers',
4768           ],
4769           'conditions': [
4770             ['chromium_mac_pch', {'GCC_PRECOMPILE_PREFIX_HEADER': 'YES'},
4771                                  {'GCC_PRECOMPILE_PREFIX_HEADER': 'NO'}
4772             ],
4773             # Note that the prebuilt Clang binaries should not be used for iOS
4774             # development except for ASan builds.
4775             ['clang==1', {
4776               # gnu++11 instead of c++11 is needed because some code uses
4777               # typeof() (a GNU extension).
4778               # TODO(thakis): Eventually switch this to c++11 instead of
4779               # gnu++11 (once typeof can be removed, which is blocked on c++11
4780               # being available everywhere).
4781               'CLANG_CXX_LANGUAGE_STANDARD': 'gnu++11',  # -std=gnu++11
4782               # Warn if automatic synthesis is triggered with
4783               # the -Wobjc-missing-property-synthesis flag.
4784               'CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS': 'YES',
4785               'GCC_VERSION': 'com.apple.compilers.llvm.clang.1_0',
4786               'WARNING_CFLAGS': [
4787                 # This warns on selectors from Cocoa headers (-length, -set).
4788                 # cfe-dev is currently discussing the merits of this warning.
4789                 # TODO(thakis): Reevaluate what to do with this, based one
4790                 # cfe-dev discussion.
4791                 '-Wno-selector-type-mismatch',
4792               ],
4793               'conditions': [
4794                 ['clang_xcode==0', {
4795                   'CC': '$(SOURCE_ROOT)/<(clang_dir)/clang',
4796                   'LDPLUSPLUS': '$(SOURCE_ROOT)/<(clang_dir)/clang++',
4797                 }],
4798               ],
4799             }],
4800             ['clang==1 and clang_xcode==0 and clang_use_chrome_plugins==1', {
4801               'OTHER_CFLAGS': [
4802                 '<@(clang_chrome_plugins_flags)',
4803               ],
4804             }],
4805             ['clang==1 and clang_xcode==0 and clang_load!=""', {
4806               'OTHER_CFLAGS': [
4807                 '-Xclang', '-load', '-Xclang', '<(clang_load)',
4808               ],
4809             }],
4810             ['clang==1 and clang_xcode==0 and clang_add_plugin!=""', {
4811               'OTHER_CFLAGS': [
4812                 '-Xclang', '-add-plugin', '-Xclang', '<(clang_add_plugin)',
4813               ],
4814             }],
4815             ['clang==1 and "<(GENERATOR)"=="ninja"', {
4816               'OTHER_CFLAGS': [
4817                 # See http://crbug.com/110262
4818                 '-fcolor-diagnostics',
4819               ],
4820             }],
4821             ['OS=="ios" and target_subarch!="arm32" and \
4822               "<(GENERATOR)"=="xcode"', {
4823               'OTHER_CFLAGS': [
4824                 # TODO(ios): when building Chrome for iOS on 64-bit platform
4825                 # with Xcode, the -Wshorted-64-to-32 warning is automatically
4826                 # enabled. This cause failures when compiling protobuf code,
4827                 # so disable the warning. http://crbug.com/359107
4828                 '-Wno-shorten-64-to-32',
4829               ],
4830             }],
4831           ],
4832         },
4833         'conditions': [
4834           ['clang==1', {
4835             'variables': {
4836               'clang_dir': '../third_party/llvm-build/Release+Asserts/bin',
4837             },
4838           }],
4839           ['asan==1', {
4840             'xcode_settings': {
4841               'OTHER_CFLAGS': [
4842                 '-fsanitize=address',
4843                 '-mllvm -asan-globals=0',  # http://crbug.com/352073
4844                 '-gline-tables-only',
4845               ],
4846             },
4847           }],
4848           ['asan_coverage!=0', {
4849             'target_conditions': [
4850               ['_toolset=="target"', {
4851                 'cflags': [
4852                   '-mllvm -asan-coverage=<(asan_coverage)',
4853                 ],
4854               }],
4855             ],
4856           }],
4857         ],
4858         'target_conditions': [
4859           ['_type!="static_library"', {
4860             'xcode_settings': {'OTHER_LDFLAGS': ['-Wl,-search_paths_first']},
4861             'conditions': [
4862               ['asan==1', {
4863                 'xcode_settings': {
4864                   'OTHER_LDFLAGS': [
4865                     '-fsanitize=address',
4866                   ],
4867                 },
4868               }],
4869               ['mac_write_linker_maps==1', {
4870                 'xcode_settings': {
4871                   'OTHER_LDFLAGS': [
4872                     '-Wl,-map,>(_target_name).map',
4873                   ],
4874                 },
4875               }],
4876             ],
4877           }],
4878           ['_mac_bundle', {
4879             'xcode_settings': {'OTHER_LDFLAGS': ['-Wl,-ObjC']},
4880             'target_conditions': [
4881               ['_type=="executable"', {
4882                 'conditions': [
4883                   ['asan==1', {
4884                     'postbuilds': [
4885                       {
4886                         'variables': {
4887                           # Define copy_asan_dylib_path in a variable ending in
4888                           # _path so that gyp understands it's a path and
4889                           # performs proper relativization during dict merging.
4890                           'copy_asan_dylib_path':
4891                             'mac/copy_asan_runtime_dylib.sh',
4892                         },
4893                         'postbuild_name': 'Copy ASan runtime dylib',
4894                         'action': [
4895                           '<(copy_asan_dylib_path)',
4896                         ],
4897                       },
4898                     ],
4899                   }],
4900                 ],
4901               }],
4902             ],
4903           }],
4904         ],  # target_conditions
4905       },  # target_defaults
4906     }],  # OS=="mac" or OS=="ios"
4907     ['OS=="mac"', {
4908       'target_defaults': {
4909         'defines': [
4910           # Prevent Mac OS X AssertMacros.h from defining macros that collide
4911           # with common names, like 'check', 'require', and 'verify'.
4912           # (Included by system header. Also exists on iOS but not included.)
4913           # http://opensource.apple.com/source/CarbonHeaders/CarbonHeaders-18.1/AssertMacros.h
4914           '__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORE=0',
4915         ],
4916         'variables': {
4917           # These should end with %, but there seems to be a bug with % in
4918           # variables that are intended to be set to different values in
4919           # different targets, like these.
4920           'mac_pie': 1,        # Most executables can be position-independent.
4921           # Strip debugging symbols from the target.
4922           'mac_strip': '<(mac_strip_release)',
4923           'conditions': [
4924             ['asan==1', {
4925               'conditions': [
4926                 ['mac_want_real_dsym=="default"', {
4927                   'mac_real_dsym': 1,
4928                 }, {
4929                   'mac_real_dsym': '<(mac_want_real_dsym)'
4930                 }],
4931               ],
4932             }, {
4933               'conditions': [
4934                 ['mac_want_real_dsym=="default"', {
4935                   'mac_real_dsym': 0, # Fake .dSYMs are fine in most cases.
4936                 }, {
4937                   'mac_real_dsym': '<(mac_want_real_dsym)'
4938                 }],
4939               ],
4940             }],
4941           ],
4942         },
4943         'xcode_settings': {
4944           'GCC_DYNAMIC_NO_PIC': 'NO',               # No -mdynamic-no-pic
4945                                                     # (Equivalent to -fPIC)
4946           # MACOSX_DEPLOYMENT_TARGET maps to -mmacosx-version-min
4947           'MACOSX_DEPLOYMENT_TARGET': '<(mac_deployment_target)',
4948           # Keep pch files below xcodebuild/.
4949           'SHARED_PRECOMPS_DIR': '$(CONFIGURATION_BUILD_DIR)/SharedPrecompiledHeaders',
4950           'OTHER_CFLAGS': [
4951             # Someday this can be replaced by an 'GCC_STRICT_ALIASING': 'NO'
4952             # xcode_setting, but not until all downstream projects' mac bots are
4953             # using xcode >= 4.6, because that's when the default value of the
4954             # flag in the compiler switched.  Pre-4.6, the value 'NO' for that
4955             # setting is a no-op as far as xcode is concerned, but the compiler
4956             # behaves differently based on whether -fno-strict-aliasing is
4957             # specified or not.
4958             '-fno-strict-aliasing',  # See http://crbug.com/32204.
4959           ],
4960         },
4961         'target_conditions': [
4962           ['_type=="executable"', {
4963             'postbuilds': [
4964               {
4965                 # Arranges for data (heap) pages to be protected against
4966                 # code execution when running on Mac OS X 10.7 ("Lion"), and
4967                 # ensures that the position-independent executable (PIE) bit
4968                 # is set for ASLR when running on Mac OS X 10.5 ("Leopard").
4969                 'variables': {
4970                   # Define change_mach_o_flags in a variable ending in _path
4971                   # so that GYP understands it's a path and performs proper
4972                   # relativization during dict merging.
4973                   'change_mach_o_flags_path':
4974                       'mac/change_mach_o_flags_from_xcode.sh',
4975                   'change_mach_o_flags_options%': [
4976                   ],
4977                   'target_conditions': [
4978                     ['mac_pie==0 or release_valgrind_build==1', {
4979                       # Don't enable PIE if it's unwanted. It's unwanted if
4980                       # the target specifies mac_pie=0 or if building for
4981                       # Valgrind, because Valgrind doesn't understand slide.
4982                       # See the similar mac_pie/release_valgrind_build check
4983                       # below.
4984                       'change_mach_o_flags_options': [
4985                         '--no-pie',
4986                       ],
4987                     }],
4988                   ],
4989                 },
4990                 'postbuild_name': 'Change Mach-O Flags',
4991                 'action': [
4992                   '<(change_mach_o_flags_path)',
4993                   '>@(change_mach_o_flags_options)',
4994                 ],
4995               },
4996             ],
4997             'conditions': [
4998               ['asan==1', {
4999                 'variables': {
5000                  'asan_saves_file': 'asan.saves',
5001                 },
5002                 'xcode_settings': {
5003                   'CHROMIUM_STRIP_SAVE_FILE': '<(asan_saves_file)',
5004                 },
5005               }],
5006             ],
5007             'target_conditions': [
5008               ['mac_pie==1 and release_valgrind_build==0', {
5009                 # Turn on position-independence (ASLR) for executables. When
5010                 # PIE is on for the Chrome executables, the framework will
5011                 # also be subject to ASLR.
5012                 # Don't do this when building for Valgrind, because Valgrind
5013                 # doesn't understand slide. TODO: Make Valgrind on Mac OS X
5014                 # understand slide, and get rid of the Valgrind check.
5015                 'xcode_settings': {
5016                   'OTHER_LDFLAGS': [
5017                     '-Wl,-pie',  # Position-independent executable (MH_PIE)
5018                   ],
5019                 },
5020               }],
5021             ],
5022           }],
5023           ['(_type=="executable" or _type=="shared_library" or \
5024              _type=="loadable_module") and mac_strip!=0', {
5025             'target_conditions': [
5026               ['mac_real_dsym == 1', {
5027                 # To get a real .dSYM bundle produced by dsymutil, set the
5028                 # debug information format to dwarf-with-dsym.  Since
5029                 # strip_from_xcode will not be used, set Xcode to do the
5030                 # stripping as well.
5031                 'configurations': {
5032                   'Release_Base': {
5033                     'xcode_settings': {
5034                       'DEBUG_INFORMATION_FORMAT': 'dwarf-with-dsym',
5035                       'DEPLOYMENT_POSTPROCESSING': 'YES',
5036                       'STRIP_INSTALLED_PRODUCT': 'YES',
5037                       'target_conditions': [
5038                         ['_type=="shared_library" or _type=="loadable_module"', {
5039                           # The Xcode default is to strip debugging symbols
5040                           # only (-S).  Local symbols should be stripped as
5041                           # well, which will be handled by -x.  Xcode will
5042                           # continue to insert -S when stripping even when
5043                           # additional flags are added with STRIPFLAGS.
5044                           'STRIPFLAGS': '-x',
5045                         }],  # _type=="shared_library" or _type=="loadable_module"
5046                         ['_type=="executable"', {
5047                           'conditions': [
5048                             ['asan==1', {
5049                               'STRIPFLAGS': '-s $(CHROMIUM_STRIP_SAVE_FILE)',
5050                             }]
5051                           ],
5052                         }],  # _type=="executable" and asan==1
5053                       ],  # target_conditions
5054                     },  # xcode_settings
5055                   },  # configuration "Release"
5056                 },  # configurations
5057               }, {  # mac_real_dsym != 1
5058                 # To get a fast fake .dSYM bundle, use a post-build step to
5059                 # produce the .dSYM and strip the executable.  strip_from_xcode
5060                 # only operates in the Release configuration.
5061                 'postbuilds': [
5062                   {
5063                     'variables': {
5064                       # Define strip_from_xcode in a variable ending in _path
5065                       # so that gyp understands it's a path and performs proper
5066                       # relativization during dict merging.
5067                       'strip_from_xcode_path': 'mac/strip_from_xcode',
5068                     },
5069                     'postbuild_name': 'Strip If Needed',
5070                     'action': ['<(strip_from_xcode_path)'],
5071                   },
5072                 ],  # postbuilds
5073               }],  # mac_real_dsym
5074             ],  # target_conditions
5075           }],  # (_type=="executable" or _type=="shared_library" or
5076                #  _type=="loadable_module") and mac_strip!=0
5077         ],  # target_conditions
5078       },  # target_defaults
5079     }],  # OS=="mac"
5080     ['OS=="ios"', {
5081       'target_defaults': {
5082         'xcode_settings' : {
5083           # TODO(stuartmorgan): switch to c++0x (see TODOs in the clang
5084           # section above).
5085           'CLANG_CXX_LANGUAGE_STANDARD': 'gnu++0x',
5087           'conditions': [
5088             # Older Xcodes do not support -Wno-deprecated-register, so pass an
5089             # additional flag to suppress the "unknown compiler option" error.
5090             # Restrict this flag to builds that are either compiling with Xcode
5091             # or compiling with Xcode's Clang.  This will allow Ninja builds to
5092             # continue failing on unknown compiler options.
5093             # TODO(rohitrao): This flag is temporary and should be removed as
5094             # soon as the iOS bots are updated to use Xcode 5.1.
5095             ['clang_xcode==1', {
5096               'WARNING_CFLAGS': [
5097                 '-Wno-unknown-warning-option',
5098               ],
5099             }],
5101             # Limit the valid architectures depending on "target_subarch".
5102             # This need to include the "arm" architectures but also the "x86"
5103             # ones (they are used when building for the simulator).
5104             ['target_subarch=="arm32"', {
5105               'VALID_ARCHS': ['armv7', 'i386'],
5106             }],
5107             ['target_subarch=="arm64"', {
5108               'VALID_ARCHS': ['arm64', 'x86_64'],
5109             }],
5110             ['target_subarch=="both"', {
5111               'VALID_ARCHS': ['arm64', 'armv7', 'x86_64', 'i386'],
5112             }],
5113             ['use_system_libcxx==1', {
5114               'target_conditions': [
5115                 # Only use libc++ when building target for iOS not when building
5116                 # tools for the host (OS X) as Mac targets OS X SDK 10.6 which
5117                 # does not support libc++.
5118                 ['_toolset=="target"', {
5119                   'CLANG_CXX_LIBRARY': 'libc++',  # -stdlib=libc++
5120                 }]
5121               ],
5122             }, {
5123               # The default for deployment target of 7.0+ is libc++, so force
5124               # the old behavior unless libc++ is enabled.
5125               'CLANG_CXX_LIBRARY': 'libstdc++',  # -stdlib=libstdc++
5126             }],
5127           ],
5128         },
5129         'target_conditions': [
5130           ['_toolset=="host"', {
5131             'xcode_settings': {
5132               'SDKROOT': 'macosx<(mac_sdk)',  # -isysroot
5133               'MACOSX_DEPLOYMENT_TARGET': '<(mac_deployment_target)',
5134               'VALID_ARCHS': [
5135                 'x86_64',
5136               ],
5137               'ARCHS': [
5138                 'x86_64',
5139               ],
5140             },
5141           }],
5142           ['_toolset=="target"', {
5143             'xcode_settings': {
5144               # This section should be for overriding host settings. But,
5145               # since we can't negate the iphone deployment target above, we
5146               # instead set it here for target only.
5147               'IPHONEOS_DEPLOYMENT_TARGET': '<(ios_deployment_target)',
5148               'ARCHS': ['$(ARCHS_STANDARD_INCLUDING_64_BIT)'],
5149             },
5150           }],
5151           ['_type=="executable"', {
5152             'configurations': {
5153               'Release_Base': {
5154                 'xcode_settings': {
5155                   'DEPLOYMENT_POSTPROCESSING': 'YES',
5156                   'STRIP_INSTALLED_PRODUCT': 'YES',
5157                 },
5158               },
5159               'Debug_Base': {
5160                 'xcode_settings': {
5161                   # Remove dSYM to reduce build time.
5162                   'DEBUG_INFORMATION_FORMAT': 'dwarf',
5163                 },
5164               },
5165             },
5166             'xcode_settings': {
5167               'conditions': [
5168                 ['chromium_ios_signing', {
5169                   # iOS SDK wants everything for device signed.
5170                   'CODE_SIGN_IDENTITY[sdk=iphoneos*]': 'iPhone Developer',
5171                 }, {
5172                   'CODE_SIGNING_REQUIRED': 'NO',
5173                   'CODE_SIGN_IDENTITY[sdk=iphoneos*]': '',
5174                 }],
5175               ],
5176             },
5177           }],
5178         ],  # target_conditions
5179       },  # target_defaults
5180     }],  # OS=="ios"
5181     ['OS=="win"', {
5182       'target_defaults': {
5183         'defines': [
5184           '_WIN32_WINNT=0x0602',
5185           'WINVER=0x0602',
5186           'WIN32',
5187           '_WINDOWS',
5188           'NOMINMAX',
5189           'PSAPI_VERSION=1',
5190           '_CRT_RAND_S',
5191           'CERT_CHAIN_PARA_HAS_EXTRA_FIELDS',
5192           'WIN32_LEAN_AND_MEAN',
5193           '_ATL_NO_OPENGL',
5194           # _HAS_EXCEPTIONS must match ExceptionHandling in msvs_settings.
5195           '_HAS_EXCEPTIONS=0',
5196         ],
5197         'conditions': [
5198           ['buildtype=="Official"', {
5199               # In official builds, targets can self-select an optimization
5200               # level by defining a variable named 'optimize', and setting it
5201               # to one of
5202               # - "size", optimizes for minimal code size - the default.
5203               # - "speed", optimizes for speed over code size.
5204               # - "max", whole program optimization and link-time code
5205               #   generation. This is very expensive and should be used
5206               #   sparingly.
5207               'variables': {
5208                 'optimize%': 'size',
5209               },
5210               'msvs_settings': {
5211                 'VCLinkerTool': {
5212                   # Set /LTCG for the official builds.
5213                   'LinkTimeCodeGeneration': '1',
5214                 },
5215               },
5216               'target_conditions': [
5217                 ['optimize=="size"', {
5218                     'msvs_settings': {
5219                       'VCCLCompilerTool': {
5220                         # 1, optimizeMinSpace, Minimize Size (/O1)
5221                         'Optimization': '1',
5222                         # 2, favorSize - Favor small code (/Os)
5223                         'FavorSizeOrSpeed': '2',
5224                       },
5225                     },
5226                   },
5227                 ],
5228                 ['optimize=="speed"', {
5229                     'msvs_settings': {
5230                       'VCCLCompilerTool': {
5231                         # 2, optimizeMaxSpeed, Maximize Speed (/O2)
5232                         'Optimization': '2',
5233                         # 1, favorSpeed - Favor fast code (/Ot)
5234                         'FavorSizeOrSpeed': '1',
5235                       },
5236                     },
5237                   },
5238                 ],
5239                 ['optimize=="max"', {
5240                     # Disable Warning 4702 ("Unreachable code") for the WPO/PGO
5241                     # builds. Probably anything that this would catch that
5242                     # wouldn't be caught in a normal build isn't going to
5243                     # actually be a bug, so the incremental value of C4702 for
5244                     # PGO builds is likely very small.
5245                     'msvs_disabled_warnings': [
5246                       4702
5247                     ],
5248                     'msvs_settings': {
5249                       'VCCLCompilerTool': {
5250                         # 2, optimizeMaxSpeed, Maximize Speed (/O2)
5251                         'Optimization': '2',
5252                         # 1, favorSpeed - Favor fast code (/Ot)
5253                         'FavorSizeOrSpeed': '1',
5254                         # This implies link time code generation.
5255                         'WholeProgramOptimization': 'true',
5256                       },
5257                     },
5258                   },
5259                 ],
5260               ],
5261             },
5262           ],
5263           ['secure_atl', {
5264             'defines': [
5265               '_SECURE_ATL',
5266             ],
5267           }],
5268           ['msvs_express', {
5269             'configurations': {
5270               'x86_Base': {
5271                 'msvs_settings': {
5272                   'VCLinkerTool': {
5273                     'AdditionalLibraryDirectories':
5274                       ['<(windows_driver_kit_path)/lib/ATL/i386'],
5275                   },
5276                   'VCLibrarianTool': {
5277                     'AdditionalLibraryDirectories':
5278                       ['<(windows_driver_kit_path)/lib/ATL/i386'],
5279                   },
5280                 },
5281               },
5282               'x64_Base': {
5283                 'msvs_settings': {
5284                   'VCLibrarianTool': {
5285                     'AdditionalLibraryDirectories':
5286                       ['<(windows_driver_kit_path)/lib/ATL/amd64'],
5287                   },
5288                   'VCLinkerTool': {
5289                     'AdditionalLibraryDirectories':
5290                       ['<(windows_driver_kit_path)/lib/ATL/amd64'],
5291                   },
5292                 },
5293               },
5294             },
5295             # https://code.google.com/p/chromium/issues/detail?id=372451#c20
5296             # Warning 4702 ("Unreachable code") should be re-enabled once
5297             # Express users are updated to VS2013 Update 2.
5298             'msvs_disabled_warnings': [
5299               4702
5300             ],
5301             'msvs_settings': {
5302               'VCCLCompilerTool': {
5303                 'AdditionalOptions!': [
5304                     '/Zc:inline',  # Not supported on non-updated Express.
5305                 ],
5306               },
5307               'VCLinkerTool': {
5308                 # Explicitly required when using the ATL with express
5309                 'AdditionalDependencies': ['atlthunk.lib'],
5311                 # ATL 8.0 included in WDK 7.1 makes the linker to generate
5312                 # almost eight hundred LNK4254 and LNK4078 warnings:
5313                 #   - warning LNK4254: section 'ATL' (50000040) merged into
5314                 #     '.rdata' (40000040) with different attributes
5315                 #   - warning LNK4078: multiple 'ATL' sections found with
5316                 #     different attributes
5317                 'AdditionalOptions': ['/ignore:4254', '/ignore:4078'],
5318               },
5319             },
5320             'msvs_system_include_dirs': [
5321               '<(windows_driver_kit_path)/inc/atl71',
5322               '<(windows_driver_kit_path)/inc/mfc42',
5323             ],
5324           }],
5325         ],
5326         'msvs_system_include_dirs': [
5327           '<(windows_sdk_path)/Include/shared',
5328           '<(windows_sdk_path)/Include/um',
5329           '<(windows_sdk_path)/Include/winrt',
5330           '$(VSInstallDir)/VC/atlmfc/include',
5331         ],
5332         'msvs_cygwin_shell': 0,
5333         'msvs_disabled_warnings': [
5334           # C4127: conditional expression is constant
5335           # This warning can in theory catch dead code and other problems, but
5336           # triggers in far too many desirable cases where the conditional
5337           # expression is either set by macros or corresponds some legitimate
5338           # compile-time constant expression (due to constant template args,
5339           # conditionals comparing the sizes of different types, etc.).  Some of
5340           # these can be worked around, but it's not worth it.
5341           4127,
5343           # C4351: new behavior: elements of array 'array' will be default
5344           #        initialized
5345           # This is a silly "warning" that basically just alerts you that the
5346           # compiler is going to actually follow the language spec like it's
5347           # supposed to, instead of not following it like old buggy versions
5348           # did.  There's absolutely no reason to turn this on.
5349           4351,
5351           # C4355: 'this': used in base member initializer list
5352           # It's commonly useful to pass |this| to objects in a class'
5353           # initializer list.  While this warning can catch real bugs, most of
5354           # the time the constructors in question don't attempt to call methods
5355           # on the passed-in pointer (until later), and annotating every legit
5356           # usage of this is simply more hassle than the warning is worth.
5357           4355,
5359           # C4503: 'identifier': decorated name length exceeded, name was
5360           #        truncated
5361           # This only means that some long error messages might have truncated
5362           # identifiers in the presence of lots of templates.  It has no effect
5363           # on program correctness and there's no real reason to waste time
5364           # trying to prevent it.
5365           4503,
5367           # C4611: interaction between 'function' and C++ object destruction is
5368           #        non-portable
5369           # This warning is unavoidable when using e.g. setjmp/longjmp.  MSDN
5370           # suggests using exceptions instead of setjmp/longjmp for C++, but
5371           # Chromium code compiles without exception support.  We therefore have
5372           # to use setjmp/longjmp for e.g. JPEG decode error handling, which
5373           # means we have to turn off this warning (and be careful about how
5374           # object destruction happens in such cases).
5375           4611,
5377           # TODO(maruel): These warnings are level 4. They will be slowly
5378           # removed as code is fixed.
5379           4100, # Unreferenced formal parameter
5380           4121, # Alignment of a member was sensitive to packing
5381           4189, # Local variable is initialized but not referenced
5382           4244, # Conversion from 'type1' to 'type2', possible loss of data
5383           4481, # Nonstandard extension used: override specifier 'keyword'
5384           4505, # Unreferenced local function has been removed
5385           4510, # Default constructor could not be generated
5386           4512, # Assignment operator could not be generated
5387           4610, # Object can never be instantiated
5388         ],
5389         'msvs_settings': {
5390           'VCCLCompilerTool': {
5391             'AdditionalOptions': ['/MP'],
5392             'MinimalRebuild': 'false',
5393             'BufferSecurityCheck': 'true',
5394             'EnableFunctionLevelLinking': 'true',
5395             'RuntimeTypeInfo': 'false',
5396             'WarningLevel': '4',
5397             'WarnAsError': 'true',
5398             'DebugInformationFormat': '3',
5399             # ExceptionHandling must match _HAS_EXCEPTIONS above.
5400             'ExceptionHandling': '0',
5401           },
5402           'VCLibrarianTool': {
5403             'AdditionalOptions': ['/ignore:4221'],
5404             'AdditionalLibraryDirectories': [
5405               '<(windows_sdk_path)/Lib/win8/um/x86',
5406             ],
5407           },
5408           'VCLinkerTool': {
5409             'AdditionalDependencies': [
5410               'wininet.lib',
5411               'dnsapi.lib',
5412               'version.lib',
5413               'msimg32.lib',
5414               'ws2_32.lib',
5415               'usp10.lib',
5416               'psapi.lib',
5417               'dbghelp.lib',
5418               'winmm.lib',
5419               'shlwapi.lib',
5420             ],
5421             'AdditionalLibraryDirectories': [
5422               '<(windows_sdk_path)/Lib/win8/um/x86',
5423             ],
5424             'GenerateDebugInformation': 'true',
5425             'MapFileName': '$(OutDir)\\$(TargetName).map',
5426             'ImportLibrary': '$(OutDir)\\lib\\$(TargetName).lib',
5427             'FixedBaseAddress': '1',
5428             # SubSystem values:
5429             #   0 == not set
5430             #   1 == /SUBSYSTEM:CONSOLE
5431             #   2 == /SUBSYSTEM:WINDOWS
5432             # Most of the executables we'll ever create are tests
5433             # and utilities with console output.
5434             'SubSystem': '1',
5435           },
5436           'VCMIDLTool': {
5437             'GenerateStublessProxies': 'true',
5438             'TypeLibraryName': '$(InputName).tlb',
5439             'OutputDirectory': '$(IntDir)',
5440             'HeaderFileName': '$(InputName).h',
5441             'DLLDataFileName': '$(InputName).dlldata.c',
5442             'InterfaceIdentifierFileName': '$(InputName)_i.c',
5443             'ProxyFileName': '$(InputName)_p.c',
5444           },
5445           'VCResourceCompilerTool': {
5446             'Culture' : '1033',
5447             'AdditionalIncludeDirectories': [
5448               '<(DEPTH)',
5449               '<(SHARED_INTERMEDIATE_DIR)',
5450             ],
5451           },
5452           'target_conditions': [
5453             ['_type=="executable"', {
5454               'VCManifestTool': {
5455                 'EmbedManifest': 'true',
5456               },
5457             }],
5458             ['_type=="executable" and ">(win_exe_compatibility_manifest)"!=""', {
5459               'VCManifestTool': {
5460                 'AdditionalManifestFiles': [
5461                   '>(win_exe_compatibility_manifest)',
5462                 ],
5463               },
5464             }],
5465           ],
5466           'conditions': [
5467             ['clang==1', {
5468               # Building with Clang on Windows is a work in progress and very
5469               # experimental. See crbug.com/82385.
5470               'VCCLCompilerTool': {
5471                 'WarnAsError': 'false',
5472                 'RuntimeTypeInfo': 'false',
5473                 'AdditionalOptions': [
5474                   '-fmsc-version=1800',
5475                   '/fallback',
5477                   # Many files use intrinsics without including this header.
5478                   # TODO(hans): Fix those files, or move this to sub-GYPs.
5479                   '/FIIntrin.h',
5481                   # TODO(hans): Make this list shorter eventually.
5482                   '-Qunused-arguments',
5483                   '-Wno-c++11-compat-deprecated-writable-strings',
5484                   '-Wno-deprecated-declarations',
5485                   '-Wno-empty-body',
5486                   '-Wno-enum-conversion',
5487                   '-Wno-extra-tokens',
5488                   '-Wno-ignored-attributes',
5489                   '-Wno-incompatible-pointer-types',
5490                   '-Wno-int-to-void-pointer-cast',
5491                   '-Wno-invalid-noreturn',
5492                   '-Wno-logical-op-parentheses',
5493                   '-Wno-microsoft',
5494                   '-Wno-missing-braces',
5495                   '-Wno-missing-declarations',
5496                   '-Wno-msvc-include',
5497                   '-Wno-null-dereference',
5498                   '-Wno-overloaded-virtual',
5499                   '-Wno-parentheses',
5500                   '-Wno-pointer-sign',
5501                   '-Wno-reorder',
5502                   '-Wno-return-type-c-linkage',
5503                   '-Wno-self-assign',
5504                   '-Wno-sometimes-uninitialized',
5505                   '-Wno-switch',
5506                   '-Wno-tautological-compare',
5507                   '-Wno-unknown-pragmas',
5508                   '-Wno-unsequenced',
5509                   '-Wno-unused-function',
5510                   '-Wno-unused-private-field',
5511                   '-Wno-unused-value',
5512                   '-Wno-unused-variable',
5513                   '-Wno-unused-local-typedef',  # http://crbug.com/411648
5514                 ],
5515               },
5516             }],
5517             ['asan==1', {
5518               # ASan on Windows is a work in progress and very experimental.
5519               # See crbug.com/345874.
5520               'VCCLCompilerTool': {
5521                 'AdditionalOptions': [
5522                   '-fsanitize=address',
5523                 ],
5524                 'AdditionalIncludeDirectories': [
5525                   # MSVC needs to be able to find the sanitizer headers when
5526                   # invoked via /fallback. This is critical for using macros
5527                   # like ASAN_UNPOISON_MEMORY_REGION in files where we fall
5528                   # back.
5529                   '<(DEPTH)/<(make_clang_dir)/lib/clang/3.6.0/include_sanitizer',
5530                 ],
5531               },
5532               'VCLinkerTool': {
5533                 'AdditionalLibraryDirectories': [
5534                   # TODO(hans): If make_clang_dir is absolute, this breaks.
5535                   '<(DEPTH)/<(make_clang_dir)/lib/clang/3.6.0/lib/windows',
5536                 ],
5537               },
5538               'target_conditions': [
5539                 ['component=="shared_library"', {
5540                   'VCLinkerTool': {
5541                     'AdditionalDependencies': [
5542                        'clang_rt.asan_dynamic-i386.lib',
5543                        'clang_rt.asan_dynamic_runtime_thunk-i386.lib',
5544                     ],
5545                   },
5546                 }],
5547                 ['_type=="executable" and component=="static_library"', {
5548                   'VCLinkerTool': {
5549                     'AdditionalDependencies': [
5550                        'clang_rt.asan-i386.lib',
5551                     ],
5552                   },
5553                 }],
5554                 ['(_type=="shared_library" or _type=="loadable_module") and component=="static_library"', {
5555                   'VCLinkerTool': {
5556                     'AdditionalDependencies': [
5557                        'clang_rt.asan_dll_thunk-i386.lib',
5558                     ],
5559                   },
5560                 }],
5561               ],
5562             }],
5563           ],
5564         },
5565       },
5566     }],
5567     ['disable_nacl==1', {
5568       'target_defaults': {
5569         'defines': [
5570           'DISABLE_NACL',
5571         ],
5572       },
5573     }],
5574     ['OS=="win" and msvs_use_common_linker_extras', {
5575       'target_defaults': {
5576         'msvs_settings': {
5577           'VCLinkerTool': {
5578             'DelayLoadDLLs': [
5579               'dbghelp.dll',
5580               'dwmapi.dll',
5581               'shell32.dll',
5582               'uxtheme.dll',
5583             ],
5584           },
5585         },
5586         'configurations': {
5587           'x86_Base': {
5588             'msvs_settings': {
5589               'VCLinkerTool': {
5590                 'AdditionalOptions': [
5591                   '/safeseh',
5592                   '/dynamicbase',
5593                   '/ignore:4199',
5594                   '/ignore:4221',
5595                   '/nxcompat',
5596                 ],
5597                 'conditions': [
5598                   ['syzyasan==0', {
5599                     'AdditionalOptions': ['/largeaddressaware'],
5600                   }],
5601                 ],
5602               },
5603             },
5604           },
5605           'x64_Base': {
5606             'msvs_settings': {
5607               'VCLinkerTool': {
5608                 'AdditionalOptions': [
5609                   # safeseh is not compatible with x64
5610                   '/dynamicbase',
5611                   '/ignore:4199',
5612                   '/ignore:4221',
5613                   '/nxcompat',
5614                 ],
5615               },
5616             },
5617           },
5618         },
5619       },
5620     }],
5621     ['enable_new_npdevice_api==1', {
5622       'target_defaults': {
5623         'defines': [
5624           'ENABLE_NEW_NPDEVICE_API',
5625         ],
5626       },
5627     }],
5628     # Don't warn about the "typedef 'foo' locally defined but not used"
5629     # for gcc 4.8 and higher.
5630     # TODO: remove this flag once all builds work. See crbug.com/227506
5631     ['gcc_version>=48 and clang==0', {
5632       'target_defaults': {
5633         'cflags': [
5634           '-Wno-unused-local-typedefs',
5635         ],
5636       },
5637     }],
5638     ['gcc_version>=48 and clang==0 and host_clang==1', {
5639       'target_defaults': {
5640         'target_conditions': [
5641           ['_toolset=="host"', { 'cflags!': [ '-Wno-unused-local-typedefs' ]}],
5642         ],
5643       },
5644     }],
5645     # We need a special case to handle the android webview build on mac because
5646     # the host gcc there doesn't accept this flag, but the target gcc may
5647     # require it.
5648     ['gcc_version>=48 and android_webview_build==1 and host_os=="mac"', {
5649       'target_defaults': {
5650         'target_conditions': [
5651           ['_toolset=="host"', {
5652             'cflags!': [
5653               '-Wno-unused-local-typedefs',
5654             ],
5655           }],
5656         ],
5657       },
5658     }],
5659     ['clang==1 and ((OS!="mac" and OS!="ios") or clang_xcode==0) '
5660         'and OS!="win"', {
5661       'make_global_settings': [
5662         ['CC', '<(make_clang_dir)/bin/clang'],
5663         ['CXX', '<(make_clang_dir)/bin/clang++'],
5664         ['CC.host', '$(CC)'],
5665         ['CXX.host', '$(CXX)'],
5666       ],
5667     }],
5668     ['clang==1 and OS=="win"', {
5669       'make_global_settings': [
5670         # On Windows, gyp's ninja generator only looks at CC.
5671         ['CC', '<(make_clang_dir)/bin/clang-cl'],
5672       ],
5673     }],
5674     ['OS=="android" and clang==0', {
5675       # Hardcode the compiler names in the Makefile so that
5676       # it won't depend on the environment at make time.
5677       'make_global_settings': [
5678         ['CC', '<!(/bin/echo -n <(android_toolchain)/*-gcc)'],
5679         ['CXX', '<!(/bin/echo -n <(android_toolchain)/*-g++)'],
5680         ['CC.host', '<(host_cc)'],
5681         ['CXX.host', '<(host_cxx)'],
5682       ],
5683     }],
5684     ['OS=="linux" and target_arch=="mipsel"', {
5685       'make_global_settings': [
5686         ['CC', '<(sysroot)/../bin/mipsel-linux-gnu-gcc'],
5687         ['CXX', '<(sysroot)/../bin/mipsel-linux-gnu-g++'],
5688         ['CC.host', '<(host_cc)'],
5689         ['CXX.host', '<(host_cxx)'],
5690       ],
5691     }],
5692     ['OS=="linux" and target_arch=="arm" and host_arch!="arm" and chromeos==0 and clang==0', {
5693       # Set default ARM cross compiling on linux.  These can be overridden
5694       # using CC/CXX/etc environment variables.
5695       'make_global_settings': [
5696         ['CC', '<!(which arm-linux-gnueabihf-gcc)'],
5697         ['CXX', '<!(which arm-linux-gnueabihf-g++)'],
5698         ['CC.host', '<(host_cc)'],
5699         ['CXX.host', '<(host_cxx)'],
5700       ],
5701     }],
5703     # TODO(yyanagisawa): supports GENERATOR==make
5704     #  make generator doesn't support CC_wrapper without CC
5705     #  in make_global_settings yet.
5706     ['use_goma==1 and ("<(GENERATOR)"=="ninja" or clang==1)', {
5707       'make_global_settings': [
5708        ['CC_wrapper', '<(gomadir)/gomacc'],
5709        ['CXX_wrapper', '<(gomadir)/gomacc'],
5710        ['CC.host_wrapper', '<(gomadir)/gomacc'],
5711        ['CXX.host_wrapper', '<(gomadir)/gomacc'],
5712       ],
5713     }],
5714   ],
5715   'xcode_settings': {
5716     # DON'T ADD ANYTHING NEW TO THIS BLOCK UNLESS YOU REALLY REALLY NEED IT!
5717     # This block adds *project-wide* configuration settings to each project
5718     # file.  It's almost always wrong to put things here.  Specify your
5719     # custom xcode_settings in target_defaults to add them to targets instead.
5721     'conditions': [
5722       # In an Xcode Project Info window, the "Base SDK for All Configurations"
5723       # setting sets the SDK on a project-wide basis. In order to get the
5724       # configured SDK to show properly in the Xcode UI, SDKROOT must be set
5725       # here at the project level.
5726       ['OS=="mac"', {
5727         'conditions': [
5728           ['mac_sdk_path==""', {
5729             'SDKROOT': 'macosx<(mac_sdk)',  # -isysroot
5730           }, {
5731             'SDKROOT': '<(mac_sdk_path)',  # -isysroot
5732           }],
5733         ],
5734       }],
5735       ['OS=="ios"', {
5736         'conditions': [
5737           ['ios_sdk_path==""', {
5738             'conditions': [
5739               # TODO(justincohen): Ninja only supports simulator for now.
5740               ['"<(GENERATOR)"=="xcode"', {
5741                 'SDKROOT': 'iphoneos<(ios_sdk)',  # -isysroot
5742               }, {
5743                 'SDKROOT': 'iphonesimulator<(ios_sdk)',  # -isysroot
5744               }],
5745             ],
5746           }, {
5747             'SDKROOT': '<(ios_sdk_path)',  # -isysroot
5748           }],
5749         ],
5750       }],
5751       ['OS=="ios"', {
5752         # Target both iPhone and iPad.
5753         'TARGETED_DEVICE_FAMILY': '1,2',
5754       }, {  # OS!="ios"
5755         'conditions': [
5756           ['target_arch=="x64"', {
5757             'ARCHS': [
5758               'x86_64'
5759             ],
5760           }],
5761           ['target_arch=="ia32"', {
5762             'ARCHS': [
5763               'i386'
5764             ],
5765           }],
5766         ],
5767       }],
5768     ],
5770     # The Xcode generator will look for an xcode_settings section at the root
5771     # of each dict and use it to apply settings on a file-wide basis.  Most
5772     # settings should not be here, they should be in target-specific
5773     # xcode_settings sections, or better yet, should use non-Xcode-specific
5774     # settings in target dicts.  SYMROOT is a special case, because many other
5775     # Xcode variables depend on it, including variables such as
5776     # PROJECT_DERIVED_FILE_DIR.  When a source group corresponding to something
5777     # like PROJECT_DERIVED_FILE_DIR is added to a project, in order for the
5778     # files to appear (when present) in the UI as actual files and not red
5779     # red "missing file" proxies, the correct path to PROJECT_DERIVED_FILE_DIR,
5780     # and therefore SYMROOT, needs to be set at the project level.
5781     'SYMROOT': '<(DEPTH)/xcodebuild',
5782   },