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