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