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