Fix callback after destruction of native ContentViewRenderView.
[chromium-blink-merge.git] / build / common.gypi
blob5516c63fb77467ce06a27fb98cbce8b1f70b2b7c
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             # Use a raw surface abstraction.
31             'use_ozone%': 0,
32           },
33           # Copy conditionally-set variables out one scope.
34           'chromeos%': '<(chromeos)',
35           'use_aura%': '<(use_aura)',
36           'use_ash%': '<(use_ash)',
37           'use_ozone%': '<(use_ozone)',
39           # Whether we are using Views Toolkit
40           'toolkit_views%': 0,
42           # Use OpenSSL instead of NSS. Under development: see http://crbug.com/62803
43           'use_openssl%': 0,
45           # Disable viewport meta tag by default.
46           'enable_viewport%': 0,
48           # Enable DoubleResourceLoadTiming support.
49           'enable_double_resource_load_timing%': 1,
51           # Enable HiDPI support.
52           'enable_hidpi%': 0,
54           # Enable touch optimized art assets and metrics.
55           'enable_touch_ui%': 0,
57           # Override buildtype to select the desired build flavor.
58           # Dev - everyday build for development/testing
59           # Official - release build (generally implies additional processing)
60           # TODO(mmoss) Once 'buildtype' is fully supported (e.g. Windows gyp
61           # conversion is done), some of the things which are now controlled by
62           # 'branding', such as symbol generation, will need to be refactored
63           # based on 'buildtype' (i.e. we don't care about saving symbols for
64           # non-Official # builds).
65           'buildtype%': 'Dev',
67           # Override branding to select the desired branding flavor.
68           'branding%': 'Chromium',
70           'conditions': [
71             # ChromeOS implies ash.
72             ['chromeos==1', {
73               'use_ash%': 1,
74               'use_aura%': 1,
75             }],
77             # For now, Windows builds that |use_aura| should also imply using
78             # ash. This rule should be removed for the future when Windows is
79             # using the aura windows without the ash interface.
80             ['use_aura==1 and OS=="win"', {
81               'use_ash%': 1,
82             }],
83             ['use_ash==1', {
84               'use_aura%': 1,
85             }],
87             # Compute the architecture that we're building on.
88             ['OS=="win" or OS=="mac" or OS=="ios"', {
89               'host_arch%': 'ia32',
90             }, {
91               # This handles the Unix platforms for which there is some support.
92               # Anything else gets passed through, which probably won't work
93               # very well; such hosts should pass an explicit target_arch to
94               # gyp.
95               'host_arch%':
96                 '<!(uname -m | sed -e "s/i.86/ia32/;s/x86_64/x64/;s/amd64/x64/;s/arm.*/arm/;s/i86pc/ia32/")',
97             }],
98           ],
99         },
100         # Copy conditionally-set variables out one scope.
101         'chromeos%': '<(chromeos)',
102         'use_aura%': '<(use_aura)',
103         'use_ash%': '<(use_ash)',
104         'use_ozone%': '<(use_ozone)',
105         'use_openssl%': '<(use_openssl)',
106         'enable_viewport%': '<(enable_viewport)',
107         'enable_double_resource_load_timing%': '<(enable_double_resource_load_timing)',
108         'enable_hidpi%': '<(enable_hidpi)',
109         'enable_touch_ui%': '<(enable_touch_ui)',
110         'buildtype%': '<(buildtype)',
111         'branding%': '<(branding)',
112         'host_arch%': '<(host_arch)',
114         # Default architecture we're building for is the architecture we're
115         # building on.
116         'target_arch%': '<(host_arch)',
118         # This is set when building the Android WebView inside the Android
119         # build system, using the 'android' gyp backend. The WebView code is
120         # still built when this is unset, but builds using the normal chromium
121         # build system.
122         'android_webview_build%': 0,
124         # Sets whether chrome is built for google tv device.
125         'google_tv%': 0,
127         # Set ARM architecture version.
128         'arm_version%': 7,
130         'conditions': [
131           # Set default value of toolkit_views based on OS.
132           ['OS=="win" or chromeos==1 or use_aura==1', {
133             'toolkit_views%': 1,
134           }, {
135             'toolkit_views%': 0,
136           }],
138           # Set toolkit_uses_gtk for the Chromium browser on Linux.
139           ['(OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="solaris") and use_aura==0 and use_ozone==0', {
140             'toolkit_uses_gtk%': 1,
141           }, {
142             'toolkit_uses_gtk%': 0,
143           }],
145           # Enable HiDPI on Mac OS and Chrome OS.
146           ['OS=="mac" or chromeos==1', {
147             'enable_hidpi%': 1,
148           }],
150           # Enable touch UI on Metro.
151           ['OS=="win"', {
152             'enable_touch_ui%': 1,
153           }],
155           # Enable App Launcher only on ChromeOS, Windows and OSX.
156           ['use_ash==1 or OS=="win" or OS=="mac"', {
157             'enable_app_list%': 1,
158           }, {
159             'enable_app_list%': 0,
160           }],
162           ['use_aura==1 or (OS!="win" and OS!="mac" and OS!="ios" and OS!="android")', {
163             'use_default_render_theme%': 1,
164           }, {
165             'use_default_render_theme%': 0,
166           }],
168           # TODO(thestig) Remove the linux_lsb_release check after all the
169           # official Ubuntu Lucid builder are gone.
170           ['OS=="linux" and branding=="Chrome" and buildtype=="Official" and chromeos==0', {
171             'linux_lsb_release%': '<!(lsb_release -r -s)',
172           }, {
173             'linux_lsb_release%': '',
174           }], # OS=="linux" and branding=="Chrome" and buildtype=="Official" and chromeos==0
175         ],
176       },
178       # Copy conditionally-set variables out one scope.
179       'chromeos%': '<(chromeos)',
180       'host_arch%': '<(host_arch)',
181       'target_arch%': '<(target_arch)',
182       'toolkit_views%': '<(toolkit_views)',
183       'toolkit_uses_gtk%': '<(toolkit_uses_gtk)',
184       'use_aura%': '<(use_aura)',
185       'use_ash%': '<(use_ash)',
186       'use_ozone%': '<(use_ozone)',
187       'use_openssl%': '<(use_openssl)',
188       'enable_viewport%': '<(enable_viewport)',
189       'enable_double_resource_load_timing%': '<(enable_double_resource_load_timing)',
190       'enable_hidpi%': '<(enable_hidpi)',
191       'enable_touch_ui%': '<(enable_touch_ui)',
192       'android_webview_build%': '<(android_webview_build)',
193       'google_tv%': '<(google_tv)',
194       'enable_app_list%': '<(enable_app_list)',
195       'use_default_render_theme%': '<(use_default_render_theme)',
196       'buildtype%': '<(buildtype)',
197       'branding%': '<(branding)',
198       'arm_version%': '<(arm_version)',
199       'linux_lsb_release%': '<(linux_lsb_release)',
201       # Set to 1 to enable fast builds. Set to 2 for even faster builds
202       # (it disables debug info for fastest compilation - only for use
203       # on compile-only bots).
204       'fastbuild%': 0,
206       # Set to 1 to enable dcheck in release without having to use the flag.
207       'dcheck_always_on%': 0,
209       # Disable file manager component extension by default.
210       'file_manager_extension%': 0,
212       # Disable image loader component extension by default.
213       'image_loader_extension%': 0,
215       # Python version.
216       'python_ver%': '2.6',
219       # Set NEON compilation flags.
220       'arm_neon%': 1,
222       # Detect NEON support at run-time.
223       'arm_neon_optional%': 0,
225       # The system root for cross-compiles. Default: none.
226       'sysroot%': '',
228       # The system libdir used for this ABI.
229       'system_libdir%': 'lib',
231       # On Linux, we build with sse2 for Chromium builds.
232       'disable_sse2%': 0,
234       # Use libjpeg-turbo as the JPEG codec used by Chromium.
235       'use_libjpeg_turbo%': 1,
237       # Use system libjpeg. Note that the system's libjepg will be used even if
238       # use_libjpeg_turbo is set.
239       'use_system_libjpeg%': 0,
241       # By default, component is set to static_library and it can be overriden
242       # by the GYP command line or by ~/.gyp/include.gypi.
243       'component%': 'static_library',
245       # Set to select the Title Case versions of strings in GRD files.
246       'use_titlecase_in_grd_files%': 0,
248       # Use translations provided by volunteers at launchpad.net.  This
249       # currently only works on Linux.
250       'use_third_party_translations%': 0,
252       # Remoting compilation is enabled by default. Set to 0 to disable.
253       'remoting%': 1,
255       # Configuration policy is enabled by default. Set to 0 to disable.
256       'configuration_policy%': 1,
258       # Variable safe_browsing is used to control the build time configuration
259       # for safe browsing feature. Safe browsing can be compiled in 3 different
260       # levels: 0 disables it, 1 enables it fully, and 2 enables only UI and
261       # reporting features without enabling phishing and malware detection. This
262       # is useful to integrate a third party phishing/malware detection to
263       # existing safe browsing logic.
264       'safe_browsing%': 1,
266       # Speech input is compiled in by default. Set to 0 to disable.
267       'input_speech%': 1,
269       # Notifications are compiled in by default. Set to 0 to disable.
270       'notifications%' : 1,
272       # Use dsymutil to generate real .dSYM files on Mac. The default is 0 for
273       # regular builds and 1 for ASan builds.
274       'mac_want_real_dsym%': 'default',
276       # If this is set, the clang plugins used on the buildbot will be used.
277       # Run tools/clang/scripts/update.sh to make sure they are compiled.
278       # This causes 'clang_chrome_plugins_flags' to be set.
279       # Has no effect if 'clang' is not set as well.
280       'clang_use_chrome_plugins%': 1,
282       # Enable building with ASAN (Clang's -fsanitize=address option).
283       # -fsanitize=address only works with clang, but asan=1 implies clang=1
284       # See https://sites.google.com/a/chromium.org/dev/developers/testing/addresssanitizer
285       'asan%': 0,
287       # Enable building with TSAN (Clang's -fsanitize=thread option).
288       # -fsanitize=thread only works with clang, but tsan=1 implies clang=1
289       # See http://clang.llvm.org/docs/ThreadSanitizer.html
290       'tsan%': 0,
291       'tsan_blacklist%': '<(PRODUCT_DIR)/../../tools/valgrind/tsan_v2/ignores.txt',
293       # Enable building with MSAN (Clang's -fsanitize=memory option).
294       # MemorySanitizer only works with clang, but msan=1 implies clang=1
295       # See http://clang.llvm.org/docs/MemorySanitizer.html
296       'msan%': 0,
298       # Use a modified version of Clang to intercept allocated types and sizes
299       # for allocated objects. clang_type_profiler=1 implies clang=1.
300       # See http://dev.chromium.org/developers/deep-memory-profiler/cpp-object-type-identifier
301       # TODO(dmikurube): Support mac.  See http://crbug.com/123758#c11
302       'clang_type_profiler%': 0,
304       # Set to true to instrument the code with function call logger.
305       # See src/third_party/cygprofile/cyg-profile.cc for details.
306       'order_profiling%': 0,
308       # Use the provided profiled order file to link Chrome image with it.
309       # This makes Chrome faster by better using CPU cache when executing code.
310       # This is known as PGO (profile guided optimization).
311       # See https://sites.google.com/a/google.com/chrome-msk/dev/boot-speed-up-effort
312       'order_text_section%' : "",
314       # Set to 1 compile with -fPIC cflag on linux. This is a must for shared
315       # libraries on linux x86-64 and arm, plus ASLR.
316       'linux_fpic%': 1,
318       # Whether one-click signin is enabled or not.
319       'enable_one_click_signin%': 0,
321       # Enable Chrome browser extensions
322       'enable_extensions%': 1,
324       # Enable browser automation.
325       'enable_automation%': 1,
327       # Enable Google Now.
328       'enable_google_now%': 1,
330       # Enable language detection.
331       'enable_language_detection%': 1,
333       # Enable printing support and UI.
334       'enable_printing%': 1,
336       # Webrtc compilation is enabled by default. Set to 0 to disable.
337       'enable_webrtc%': 1,
339       # Enables use of the session service, which is enabled by default.
340       # Support for disabling depends on the platform.
341       'enable_session_service%': 1,
343       # Enables theme support, which is enabled by default.  Support for
344       # disabling depends on the platform.
345       'enable_themes%': 1,
347       # Enables autofill dialog and associated features; disabled by default.
348       'enable_autofill_dialog%' : 0,
350       # Uses OEM-specific wallpaper resources on Chrome OS.
351       'use_oem_wallpaper%': 0,
353       # Enables support for background apps.
354       'enable_background%': 1,
356       # Enable the task manager by default.
357       'enable_task_manager%': 1,
359       # Enable FTP support by default.
360       'disable_ftp_support%': 0,
362       # XInput2 multitouch support is disabled by default (use_xi2_mt=0).
363       # Setting to non-zero value enables XI2 MT. When XI2 MT is enabled,
364       # the input value also defines the required XI2 minor minimum version.
365       # For example, use_xi2_mt=2 means XI2.2 or above version is required.
366       'use_xi2_mt%': 0,
368       # Use of precompiled headers on Windows.
369       #
370       # This variable may be explicitly set to 1 (enabled) or 0
371       # (disabled) in ~/.gyp/include.gypi or via the GYP command line.
372       # This setting will override the default.
373       #
374       # See
375       # http://code.google.com/p/chromium/wiki/WindowsPrecompiledHeaders
376       # for details.
377       'chromium_win_pch%': 0,
379       # Set this to true when building with Clang.
380       # See http://code.google.com/p/chromium/wiki/Clang for details.
381       'clang%': 0,
383       # Enable plug-in installation by default.
384       'enable_plugin_installation%': 1,
386       # Enable PPAPI and NPAPI by default.
387       # TODO(nileshagrawal): Make this flag enable/disable NPAPI as well
388       # as PPAPI; see crbug.com/162667.
389       'enable_plugins%': 1,
391       # Specifies whether to use canvas_skia.cc in place of platform
392       # specific implementations of gfx::Canvas. Affects text drawing in the
393       # Chrome UI.
394       # TODO(asvitkine): Enable this on all platforms and delete this flag.
395       #                  http://crbug.com/105550
396       'use_canvas_skia%': 0,
398       # Set to "tsan", "memcheck", or "drmemory" to configure the build to work
399       # with one of those tools.
400       'build_for_tool%': '',
402       # If no directory is specified then a temporary directory will be used.
403       'test_isolation_outdir%': '',
404       # True if isolate should fail if the isolate files refer to files
405       # that are missing.
406       'test_isolation_fail_on_missing': 0,
408       'sas_dll_path%': '<(DEPTH)/third_party/platformsdk_win7/files/redist/x86',
409       'wix_path%': '<(DEPTH)/third_party/wix',
411       # Managed users are enabled by default.
412       'enable_managed_users%': 1,
414       'spdy_proxy_auth_origin%' : '',
415       'spdy_proxy_auth_property%' : '',
416       'spdy_proxy_auth_value%' : '',
418       'conditions': [
419         # A flag for POSIX platforms
420         ['OS=="win"', {
421           'os_posix%': 0,
422         }, {
423           'os_posix%': 1,
424         }],
426         # A flag for BSD platforms
427         ['OS=="freebsd" or OS=="openbsd"', {
428           'os_bsd%': 1,
429         }, {
430           'os_bsd%': 0,
431         }],
433         # Set armv7 for backward compatibility.
434         ['arm_version==7', {
435           'armv7': 1,
436         }, {
437           'armv7': 0,
438         }],
440         # NSS usage.
441         ['(OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="solaris") and use_openssl==0', {
442           'use_nss%': 1,
443         }, {
444           'use_nss%': 0,
445         }],
447         # Flags to use X11 on non-Mac POSIX platforms.
448         ['OS=="win" or OS=="mac" or OS=="ios" or OS=="android" or use_ozone==1', {
449           'use_x11%': 0,
450         }, {
451           'use_x11%': 1,
452         }],
454         # Flags to use pango and glib on non-Mac POSIX platforms.
455         ['OS=="win" or OS=="mac" or OS=="ios" or OS=="android"', {
456           'use_glib%': 0,
457           'use_pango%': 0,
458         }, {
459           'use_glib%': 1,
460           'use_pango%': 1,
461         }],
463         # We always use skia text rendering in Aura on Windows, since GDI
464         # doesn't agree with our BackingStore.
465         # TODO(beng): remove once skia text rendering is on by default.
466         ['use_aura==1 and OS=="win"', {
467           'enable_skia_text%': 1,
468         }],
470         # A flag to enable or disable our compile-time dependency
471         # on gnome-keyring. If that dependency is disabled, no gnome-keyring
472         # support will be available. This option is useful
473         # for Linux distributions and for Aura.
474         ['chromeos==1 or use_aura==1', {
475           'use_gnome_keyring%': 0,
476         }, {
477           'use_gnome_keyring%': 1,
478         }],
480         ['toolkit_uses_gtk==1 or OS=="mac" or OS=="ios"', {
481           # GTK+, Mac and iOS want Title Case strings
482           'use_titlecase_in_grd_files%': 1,
483         }],
485         # Enable file manager and image loader extensions on Chrome OS.
486         ['chromeos==1', {
487           'file_manager_extension%': 1,
488           'image_loader_extension%': 1,
489         }, {
490           'file_manager_extension%': 0,
491           'image_loader_extension%': 0,
492         }],
494         ['OS=="win" or OS=="mac" or (OS=="linux" and chromeos==0)', {
495           'enable_one_click_signin%': 1,
496         }],
498         ['OS=="android"', {
499           'enable_automation%': 0,
500           'enable_extensions%': 0,
501           'enable_google_now%': 0,
502           'enable_language_detection%': 1,
503           'enable_printing%': 0,
504           'enable_themes%': 0,
505           'proprietary_codecs%': 1,
506           'remoting%': 0,
507           'arm_neon%': 0,
508           'arm_neon_optional%': 1,
509         }],
511         # Enable autofill dialog for Android and Views-enabled platforms for now.
512         ['toolkit_views==1 or (OS=="android" and android_webview_build==0) or OS=="mac"', {
513           'enable_autofill_dialog%': 1
514         }],
516         ['OS=="android" and android_webview_build==0', {
517           'enable_webrtc%': 1,
518         }],
520         # Disable WebRTC for building WebView as part of Android system.
521         # TODO(boliu): Decide if we want WebRTC, and if so, also merge
522         # the necessary third_party repositories.
523         ['OS=="android" and android_webview_build==1', {
524           'enable_webrtc%': 0,
525         }],
527         ['OS=="ios"', {
528           'configuration_policy%': 0,
529           'disable_ftp_support%': 1,
530           'enable_automation%': 0,
531           'enable_extensions%': 0,
532           'enable_google_now%': 0,
533           'enable_language_detection%': 0,
534           'enable_printing%': 0,
535           'enable_session_service%': 0,
536           'enable_themes%': 0,
537           'enable_webrtc%': 0,
538           'notifications%': 0,
539           'remoting%': 0,
540           'safe_browsing%': 0,
541           'enable_managed_users%': 0,
542         }],
544         # Use GPU accelerated cross process image transport by default
545         # on linux builds with the Aura window manager
546         ['use_aura==1 and OS=="linux"', {
547           'ui_compositor_image_transport%': 1,
548         }, {
549           'ui_compositor_image_transport%': 0,
550         }],
552         # Turn precompiled headers on by default.
553         ['OS=="win" and buildtype!="Official"', {
554           'chromium_win_pch%': 1
555         }],
557         ['chromeos==1 or OS=="android" or OS=="ios"', {
558           'enable_plugin_installation%': 0,
559         }, {
560           'enable_plugin_installation%': 1,
561         }],
563         ['(OS=="android" and google_tv!=1) or OS=="ios"', {
564           'enable_plugins%': 0,
565         }, {
566           'enable_plugins%': 1,
567         }],
569         # linux_use_gold_binary: whether to use the binary checked into
570         # third_party/gold.  Gold is not used for 32-bit linux builds
571         # as it runs out of address space.
572         ['OS=="linux" and (target_arch=="x64" or target_arch=="arm")', {
573           'linux_use_gold_binary%': 1,
574         }, {
575           'linux_use_gold_binary%': 0,
576         }],
578         # linux_use_gold_flags: whether to use build flags that rely on gold.
579         # On by default for x64 Linux.  Temporarily off for ChromeOS as
580         # it failed on a buildbot.
581         ['OS=="linux" and target_arch=="x64" and chromeos==0', {
582           'linux_use_gold_flags%': 1,
583         }, {
584           'linux_use_gold_flags%': 0,
585         }],
587         ['chromeos==1', {
588           'linux_use_libgps%': 1,
589         }, { # chromeos==0
590           # Do not use libgps on desktop Linux by default,
591           # see http://crbug.com/103751.
592           'linux_use_libgps%': 0,
593         }],
595         ['OS=="android" or OS=="ios"', {
596           'enable_captive_portal_detection%': 0,
597         }, {
598           'enable_captive_portal_detection%': 1,
599         }],
601         # Enable Skia UI text drawing incrementally on different platforms.
602         # http://crbug.com/105550
603         #
604         # On Aura, this allows per-tile painting to be used in the browser
605         # compositor.
606         ['OS!="mac" and OS!="android"', {
607           'use_canvas_skia%': 1,
608         }],
610         ['chromeos==1', {
611           # When building for ChromeOS we dont want Chromium to use libjpeg_turbo.
612           'use_libjpeg_turbo%': 0,
613         }],
615         ['OS=="android"', {
616           # When building as part of the Android system, use system libraries
617           # where possible to reduce ROM size.
618           'use_system_libjpeg%': '<(android_webview_build)',
619         }],
621         # Enable Settings App only on Windows.
622         ['enable_app_list==1 and OS=="win"', {
623           'enable_settings_app%': 1,
624         }, {
625           'enable_settings_app%': 0,
626         }],
628         ['OS=="linux" and target_arch=="arm" and chromeos==0', {
629           # Set some defaults for arm/linux chrome builds
630           'linux_breakpad%': 0,
631           'linux_use_tcmalloc%': 0,
632           # sysroot needs to be an absolute path otherwise it generates
633           # incorrect results when passed to pkg-config
634           'sysroot%': '<!(cd <(DEPTH) && pwd -P)/arm-sysroot',
635         }], # OS=="linux" and target_arch=="arm" and chromeos==0
637         ['linux_lsb_release=="12.04"', {
638           'conditions': [
639             ['target_arch=="x64"', {
640               'sysroot%': '<!(cd <(DEPTH) && pwd -P)/chrome/installer/linux/internal/debian_wheezy_amd64-sysroot',
641             }],
642             ['target_arch=="ia32"', {
643               'sysroot%': '<!(cd <(DEPTH) && pwd -P)/chrome/installer/linux/internal/debian_wheezy_i386-sysroot',
644             }],
645         ],
646         }], # linux_lsb_release=="12.04"
648         ['target_arch=="mipsel"', {
649           'sysroot%': '<!(cd <(DEPTH) && pwd -P)/mipsel-sysroot/sysroot',
650           'CXX%': '<!(cd <(DEPTH) && pwd -P)/mipsel-sysroot/bin/mipsel-linux-gnu-gcc',
651         }],
653         # Whether tests targets should be run, archived or just have the
654         # dependencies verified. All the tests targets have the '_run' suffix,
655         # e.g. base_unittests_run runs the target base_unittests. The test
656         # target always calls tools/swarm_client/isolate.py. See the script's
657         # --help for more information and the valid --mode values. Meant to be
658         # overriden with GYP_DEFINES.
659         # TODO(maruel): Remove the conditions as more configurations are
660         # supported.
661         # TODO(csharp): Remove OS!="mac" once xcode can run the isolate code
662         # again.
663         # NOTE: The check for disable_nacl==0 and component=="static_library"
664         # can't be used here because these variables are not defined yet, but it
665         # is still not supported.
666         ['OS!="mac" and OS!="ios" and OS!="android" and chromeos==0', {
667           'test_isolation_mode%': 'check',
668         }, {
669           'test_isolation_mode%': 'noop',
670         }],
671         # Whether Android ARM build uses OpenMAX DL FFT.
672         ['OS=="android" and target_arch=="arm" and android_webview_build==0', {
673           # Currently only supported on Android ARM, without webview.
674           # When enabled, this will also enable WebAudio on Android
675           # ARM.  Default is enabled.
676           'use_openmax_dl_fft%': 1,
677         }, {
678           'use_openmax_dl_fft%': 0,
679         }],
680       ],
682       # Set this to 1 to enable use of concatenated impulse responses
683       # for the HRTF panner in WebAudio.
684       'use_concatenated_impulse_responses': 1,
686       # You can set the variable 'use_official_google_api_keys' to 1
687       # to use the Google-internal file containing official API keys
688       # for Google Chrome even in a developer build.  Setting this
689       # variable explicitly to 1 will cause your build to fail if the
690       # internal file is missing.
691       #
692       # The variable is documented here, but not handled in this file;
693       # see //google_apis/determine_use_official_keys.gypi for the
694       # implementation.
695       #
696       # Set the variable to 0 to not use the internal file, even when
697       # it exists in your checkout.
698       #
699       # Leave it unset in your include.gypi to have the variable
700       # implicitly set to 1 if you have
701       # src/google_apis/internal/google_chrome_api_keys.h in your
702       # checkout, and implicitly set to 0 if not.
703       #
704       # Note that official builds always behave as if the variable
705       # was explicitly set to 1, i.e. they always use official keys,
706       # and will fail to build if the internal file is missing.
707       #
708       # NOTE: You MUST NOT explicitly set the variable to 2 in your
709       # include.gypi or by other means. Due to subtleties of GYP, this
710       # is not the same as leaving the variable unset, even though its
711       # default value in
712       # //google_apis/determine_use_official_keys.gypi is 2.
714       # Set these to bake the specified API keys and OAuth client
715       # IDs/secrets into your build.
716       #
717       # If you create a build without values baked in, you can instead
718       # set environment variables to provide the keys at runtime (see
719       # src/google_apis/google_api_keys.h for details).  Features that
720       # require server-side APIs may fail to work if no keys are
721       # provided.
722       #
723       # Note that if you are building an official build or if
724       # use_official_google_api_keys has been set to 1 (explicitly or
725       # implicitly), these values will be ignored and the official
726       # keys will be used instead.
727       'google_api_key%': '',
728       'google_default_client_id%': '',
729       'google_default_client_secret%': '',
730     },
732     # Copy conditionally-set variables out one scope.
733     'branding%': '<(branding)',
734     'buildtype%': '<(buildtype)',
735     'target_arch%': '<(target_arch)',
736     'host_arch%': '<(host_arch)',
737     'toolkit_views%': '<(toolkit_views)',
738     'ui_compositor_image_transport%': '<(ui_compositor_image_transport)',
739     'use_aura%': '<(use_aura)',
740     'use_ash%': '<(use_ash)',
741     'use_openssl%': '<(use_openssl)',
742     'use_nss%': '<(use_nss)',
743     'os_bsd%': '<(os_bsd)',
744     'os_posix%': '<(os_posix)',
745     'use_glib%': '<(use_glib)',
746     'use_pango%': '<(use_pango)',
747     'use_ozone%': '<(use_ozone)',
748     'toolkit_uses_gtk%': '<(toolkit_uses_gtk)',
749     'use_x11%': '<(use_x11)',
750     'use_gnome_keyring%': '<(use_gnome_keyring)',
751     'linux_fpic%': '<(linux_fpic)',
752     'chromeos%': '<(chromeos)',
753     'enable_viewport%': '<(enable_viewport)',
754     'enable_double_resource_load_timing%': '<(enable_double_resource_load_timing)',
755     'enable_hidpi%': '<(enable_hidpi)',
756     'enable_touch_ui%': '<(enable_touch_ui)',
757     'use_xi2_mt%':'<(use_xi2_mt)',
758     'file_manager_extension%': '<(file_manager_extension)',
759     'image_loader_extension%': '<(image_loader_extension)',
760     'fastbuild%': '<(fastbuild)',
761     'dcheck_always_on%': '<(dcheck_always_on)',
762     'python_ver%': '<(python_ver)',
763     'arm_version%': '<(arm_version)',
764     'armv7%': '<(armv7)',
765     'arm_neon%': '<(arm_neon)',
766     'arm_neon_optional%': '<(arm_neon_optional)',
767     'sysroot%': '<(sysroot)',
768     'system_libdir%': '<(system_libdir)',
769     'component%': '<(component)',
770     'use_titlecase_in_grd_files%': '<(use_titlecase_in_grd_files)',
771     'use_third_party_translations%': '<(use_third_party_translations)',
772     'remoting%': '<(remoting)',
773     'enable_one_click_signin%': '<(enable_one_click_signin)',
774     'enable_webrtc%': '<(enable_webrtc)',
775     'chromium_win_pch%': '<(chromium_win_pch)',
776     'configuration_policy%': '<(configuration_policy)',
777     'safe_browsing%': '<(safe_browsing)',
778     'input_speech%': '<(input_speech)',
779     'notifications%': '<(notifications)',
780     'clang_use_chrome_plugins%': '<(clang_use_chrome_plugins)',
781     'mac_want_real_dsym%': '<(mac_want_real_dsym)',
782     'asan%': '<(asan)',
783     'msan%': '<(msan)',
784     'tsan%': '<(tsan)',
785     'tsan_blacklist%': '<(tsan_blacklist)',
786     'clang_type_profiler%': '<(clang_type_profiler)',
787     'order_profiling%': '<(order_profiling)',
788     'order_text_section%': '<(order_text_section)',
789     'enable_extensions%': '<(enable_extensions)',
790     'enable_plugin_installation%': '<(enable_plugin_installation)',
791     'enable_plugins%': '<(enable_plugins)',
792     'enable_session_service%': '<(enable_session_service)',
793     'enable_themes%': '<(enable_themes)',
794     'enable_autofill_dialog%': '<(enable_autofill_dialog)',
795     'use_oem_wallpaper%': '<(use_oem_wallpaper)',
796     'enable_background%': '<(enable_background)',
797     'linux_use_gold_binary%': '<(linux_use_gold_binary)',
798     'linux_use_gold_flags%': '<(linux_use_gold_flags)',
799     'linux_use_libgps%': '<(linux_use_libgps)',
800     'use_canvas_skia%': '<(use_canvas_skia)',
801     'test_isolation_mode%': '<(test_isolation_mode)',
802     'test_isolation_outdir%': '<(test_isolation_outdir)',
803     'test_isolation_fail_on_missing': '<(test_isolation_fail_on_missing)',
804     'enable_automation%': '<(enable_automation)',
805     'enable_printing%': '<(enable_printing)',
806     'enable_google_now%': '<(enable_google_now)',
807     'enable_language_detection%': '<(enable_language_detection)',
808     'enable_captive_portal_detection%': '<(enable_captive_portal_detection)',
809     'disable_ftp_support%': '<(disable_ftp_support)',
810     'enable_task_manager%': '<(enable_task_manager)',
811     'sas_dll_path%': '<(sas_dll_path)',
812     'wix_path%': '<(wix_path)',
813     'use_libjpeg_turbo%': '<(use_libjpeg_turbo)',
814     'use_system_libjpeg%': '<(use_system_libjpeg)',
815     'android_webview_build%': '<(android_webview_build)',
816     'gyp_managed_install%': 0,
817     'google_tv%': '<(google_tv)',
818     'enable_app_list%': '<(enable_app_list)',
819     'use_default_render_theme%': '<(use_default_render_theme)',
820     'enable_settings_app%': '<(enable_settings_app)',
821     'google_api_key%': '<(google_api_key)',
822     'google_default_client_id%': '<(google_default_client_id)',
823     'google_default_client_secret%': '<(google_default_client_secret)',
824     'enable_managed_users%': '<(enable_managed_users)',
825     'spdy_proxy_auth_origin%': '<(spdy_proxy_auth_origin)',
826     'spdy_proxy_auth_property%': '<(spdy_proxy_auth_property)',
827     'spdy_proxy_auth_value%': '<(spdy_proxy_auth_value)',
829     # Use system mesa instead of bundled one.
830     'use_system_mesa%': 0,
832     # Use system nspr instead of the bundled one.
833     'use_system_nspr%': 0,
835     # Use system protobuf instead of bundled one.
836     'use_system_protobuf%': 0,
838     # Use system yasm instead of bundled one.
839     'use_system_yasm%': 0,
841     # Use system ICU instead of bundled one.
842     'use_system_icu%' : 0,
844     # Default to enabled PIE; this is important for ASLR but we may need to be
845     # able to turn it off for various reasons.
846     'linux_disable_pie%': 0,
848     # The release channel that this build targets. This is used to restrict
849     # channel-specific build options, like which installer packages to create.
850     # The default is 'all', which does no channel-specific filtering.
851     'channel%': 'all',
853     # Override chromium_mac_pch and set it to 0 to suppress the use of
854     # precompiled headers on the Mac.  Prefix header injection may still be
855     # used, but prefix headers will not be precompiled.  This is useful when
856     # using distcc to distribute a build to compile slaves that don't
857     # share the same compiler executable as the system driving the compilation,
858     # because precompiled headers rely on pointers into a specific compiler
859     # executable's image.  Setting this to 0 is needed to use an experimental
860     # Linux-Mac cross compiler distcc farm.
861     'chromium_mac_pch%': 1,
863     # The default value for mac_strip in target_defaults. This cannot be
864     # set there, per the comment about variable% in a target_defaults.
865     'mac_strip_release%': 1,
867     # Set to 1 to enable code coverage.  In addition to build changes
868     # (e.g. extra CFLAGS), also creates a new target in the src/chrome
869     # project file called "coverage".
870     # Currently ignored on Windows.
871     'coverage%': 0,
873     # Set to 1 to force Visual C++ to use legacy debug information format /Z7.
874     # This is useful for parallel compilation tools which can't support /Zi.
875     # Only used on Windows.
876     'win_z7%' : 0,
878     # Although base/allocator lets you select a heap library via an
879     # environment variable, the libcmt shim it uses sometimes gets in
880     # the way.  To disable it entirely, and switch to normal msvcrt, do e.g.
881     #  'win_use_allocator_shim': 0,
882     #  'win_release_RuntimeLibrary': 2
883     # to ~/.gyp/include.gypi, gclient runhooks --force, and do a release build.
884     'win_use_allocator_shim%': 1, # 1 = shim allocator via libcmt; 0 = msvcrt
886     # Whether usage of OpenMAX is enabled.
887     'enable_openmax%': 0,
889     # Whether proprietary audio/video codecs are assumed to be included with
890     # this build (only meaningful if branding!=Chrome).
891     'proprietary_codecs%': 0,
893     # TODO(bradnelson): eliminate this when possible.
894     # To allow local gyp files to prevent release.vsprops from being included.
895     # Yes(1) means include release.vsprops.
896     # Once all vsprops settings are migrated into gyp, this can go away.
897     'msvs_use_common_release%': 1,
899     # TODO(bradnelson): eliminate this when possible.
900     # To allow local gyp files to override additional linker options for msvs.
901     # Yes(1) means set use the common linker options.
902     'msvs_use_common_linker_extras%': 1,
904     # TODO(sgk): eliminate this if possible.
905     # It would be nicer to support this via a setting in 'target_defaults'
906     # in chrome/app/locales/locales.gypi overriding the setting in the
907     # 'Debug' configuration in the 'target_defaults' dict below,
908     # but that doesn't work as we'd like.
909     'msvs_debug_link_incremental%': '2',
911     # Needed for some of the largest modules.
912     'msvs_debug_link_nonincremental%': '1',
914     # Turns on Use Library Dependency Inputs for linking chrome.dll on Windows
915     # to get incremental linking to be faster in debug builds.
916     'incremental_chrome_dll%': '0',
918     # Experimental setting to break chrome.dll in to multiple parts (currently
919     # two, split primarily along browser/render lines).
920     'chrome_split_dll%': '0',
922     # The default settings for third party code for treating
923     # warnings-as-errors. Ideally, this would not be required, however there
924     # is some third party code that takes a long time to fix/roll. So, this
925     # flag allows us to have warnings as errors in general to prevent
926     # regressions in most modules, while working on the bits that are
927     # remaining.
928     'win_third_party_warn_as_error%': 'true',
930     # This is the location of the sandbox binary. Chrome looks for this before
931     # running the zygote process. If found, and SUID, it will be used to
932     # sandbox the zygote process and, thus, all renderer processes.
933     'linux_sandbox_path%': '',
935     # Clang stuff.
936     'clang%': '<(clang)',
937     'make_clang_dir%': 'third_party/llvm-build/Release+Asserts',
939     # These two variables can be set in GYP_DEFINES while running
940     # |gclient runhooks| to let clang run a plugin in every compilation.
941     # Only has an effect if 'clang=1' is in GYP_DEFINES as well.
942     # Example:
943     #     GYP_DEFINES='clang=1 clang_load=/abs/path/to/libPrintFunctionNames.dylib clang_add_plugin=print-fns' gclient runhooks
945     'clang_load%': '',
946     'clang_add_plugin%': '',
948     # The default type of gtest.
949     'gtest_target_type%': 'executable',
951     # Enable sampling based profiler.
952     # See http://google-perftools.googlecode.com/svn/trunk/doc/cpuprofile.html
953     'profiling%': '0',
955     # Enable strict glibc debug mode.
956     'glibcxx_debug%': 0,
957     # Compile in Breakpad support by default so that it can be tested,
958     # even if it not enabled by default at runtime.
959     'linux_breakpad%': 1,
960     # And if we want to dump symbols for Breakpad-enabled builds.
961     'linux_dump_symbols%': 0,
962     # And if we want to strip the binary after dumping symbols.
963     'linux_strip_binary%': 0,
964     # Strip the test binaries needed for Linux reliability tests.
965     'linux_strip_reliability_tests%': 0,
967     # Enable TCMalloc.
968     'linux_use_tcmalloc%': 1,
969     'android_use_tcmalloc%': 0,
971     # Disable TCMalloc's heapchecker.
972     'linux_use_heapchecker%': 0,
974     # Disable shadow stack keeping used by heapcheck to unwind the stacks
975     # better.
976     'linux_keep_shadow_stacks%': 0,
978     # Set to 1 to link against libgnome-keyring instead of using dlopen().
979     'linux_link_gnome_keyring%': 0,
980     # Set to 1 to link against gsettings APIs instead of using dlopen().
981     'linux_link_gsettings%': 0,
983     # Default arch variant for MIPS.
984     'mips_arch_variant%': 'mips32r2',
986     # Enable use of OpenMAX DL FFT routines.
987     'use_openmax_dl_fft%': '<(use_openmax_dl_fft)',
989     # Enable new NPDevice API.
990     'enable_new_npdevice_api%': 0,
992     # Enable EGLImage support in OpenMAX
993     'enable_eglimage%': 1,
995     # Enable a variable used elsewhere throughout the GYP files to determine
996     # whether to compile in the sources for the GPU plugin / process.
997     'enable_gpu%': 1,
999     # .gyp files or targets should set chromium_code to 1 if they build
1000     # Chromium-specific code, as opposed to external code.  This variable is
1001     # used to control such things as the set of warnings to enable, and
1002     # whether warnings are treated as errors.
1003     'chromium_code%': 0,
1005     'release_valgrind_build%': 0,
1007     # TODO(thakis): Make this a blacklist instead, http://crbug.com/101600
1008     'enable_wexit_time_destructors%': 0,
1010     # Set to 1 to compile with the built in pdf viewer.
1011     'internal_pdf%': 0,
1013     # Set to 1 to compile with the OpenGL ES 2.0 conformance tests.
1014     'internal_gles2_conform_tests%': 0,
1016     # NOTE: When these end up in the Mac bundle, we need to replace '-' for '_'
1017     # so Cocoa is happy (http://crbug.com/20441).
1018     'locales': [
1019       'am', 'ar', 'bg', 'bn', 'ca', 'cs', 'da', 'de', 'el', 'en-GB',
1020       'en-US', 'es-419', 'es', 'et', 'fa', 'fi', 'fil', 'fr', 'gu', 'he',
1021       'hi', 'hr', 'hu', 'id', 'it', 'ja', 'kn', 'ko', 'lt', 'lv',
1022       'ml', 'mr', 'ms', 'nb', 'nl', 'pl', 'pt-BR', 'pt-PT', 'ro', 'ru',
1023       'sk', 'sl', 'sr', 'sv', 'sw', 'ta', 'te', 'th', 'tr', 'uk',
1024       'vi', 'zh-CN', 'zh-TW',
1025     ],
1027     # Pseudo locales are special locales which are used for testing and
1028     # debugging. They don't get copied to the final app. For more info,
1029     # check out https://sites.google.com/a/chromium.org/dev/Home/fake-bidi
1030     'pseudo_locales': [
1031       'fake-bidi',
1032     ],
1034     'grit_defines': [],
1036     # If debug_devtools is set to 1, JavaScript files for DevTools are
1037     # stored as is and loaded from disk. Otherwise, a concatenated file
1038     # is stored in resources.pak. It is still possible to load JS files
1039     # from disk by passing --debug-devtools cmdline switch.
1040     'debug_devtools%': 0,
1042     # The Java Bridge is not compiled in by default.
1043     'java_bridge%': 0,
1045     # Code signing for iOS binaries.  The bots need to be able to disable this.
1046     'chromium_ios_signing%': 1,
1048     # This flag is only used when disable_nacl==0 and disables all those
1049     # subcomponents which would require the installation of a native_client
1050     # untrusted toolchain.
1051     'disable_nacl_untrusted%': 0,
1053     # Disable Dart by default.
1054     'enable_dart%': 0,
1056     # The desired version of Windows SDK can be set in ~/.gyp/include.gypi.
1057     'msbuild_toolset%': '',
1059     # Native Client is enabled by default.
1060     'disable_nacl%': 0,
1062     # Portable Native Client is enabled by default.
1063     'disable_pnacl%': 0,
1065     # Whether to build full debug version for Debug configuration on Android.
1066     # Compared to full debug version, the default Debug configuration on Android
1067     # has no full v8 debug, has size optimization and linker gc section, so that
1068     # we can build a debug version with acceptable size and performance.
1069     'android_full_debug%': 0,
1071     # Sets the default version name and code for Android app, by default we
1072     # do a developer build.
1073     'android_app_version_name%': 'Developer Build',
1074     'android_app_version_code%': 0,
1076     'sas_dll_exists': '<!(python <(DEPTH)/build/dir_exists.py <(sas_dll_path))',
1077     'wix_exists': '<!(python <(DEPTH)/build/dir_exists.py <(wix_path))',
1079     'windows_sdk_default_path': '<(DEPTH)/third_party/platformsdk_win8/files',
1080     'directx_sdk_default_path': '<(DEPTH)/third_party/directxsdk/files',
1082     # Whether we are using the rlz library or not.  Platforms like Android send
1083     # rlz codes for searches but do not use the library.
1084     'enable_rlz%': 0,
1086     # MDNS is disabled by default.
1087     'enable_mdns%' : 0,
1089     'conditions': [
1090       # The version of GCC in use, set later in platforms that use GCC and have
1091       # not explicitly chosen to build with clang. Currently, this means all
1092       # platforms except Windows, Mac and iOS.
1093       # TODO(glider): set clang to 1 earlier for ASan and TSan builds so that
1094       # it takes effect here.
1095       ['os_posix==1 and OS!="mac" and OS!="ios" and clang==0 and asan==0 and tsan==0 and msan==0', {
1096         'gcc_version%': '<!(python <(DEPTH)/build/compiler_version.py)',
1097       }, {
1098         'gcc_version%': 0,
1099       }],
1100       ['OS=="win" and "<!(python <(DEPTH)/build/dir_exists.py <(windows_sdk_default_path))"=="True"', {
1101         'windows_sdk_path%': '<(windows_sdk_default_path)',
1102       }, {
1103         'windows_sdk_path%': 'C:/Program Files (x86)/Windows Kits/8.0',
1104       }],
1105       ['OS=="win" and "<!(python <(DEPTH)/build/dir_exists.py <(directx_sdk_default_path))"=="True"', {
1106         'directx_sdk_path%': '<(directx_sdk_default_path)',
1107       }, {
1108         'directx_sdk_path%': '$(DXSDK_DIR)',
1109       }],
1110       ['OS=="win"', {
1111         'windows_driver_kit_path%': '$(WDK_DIR)',
1112         # Set the python arch to prevent conflicts with pyauto on Win64 build.
1113         # TODO(jschuh): crbug.com/177664 Investigate Win64 pyauto build.
1114         'python_arch%': 'ia32',
1115       }],
1116       ['os_posix==1 and OS!="mac" and OS!="ios"', {
1117         # Figure out the python architecture to decide if we build pyauto.
1118         'python_arch%': '<!(<(DEPTH)/build/linux/python_arch.sh <(sysroot)/usr/<(system_libdir)/libpython<(python_ver).so.1.0)',
1119         'conditions': [
1120           ['target_arch=="mipsel"', {
1121             'werror%': '',
1122             'disable_nacl%': 1,
1123             'nacl_untrusted_build%': 0,
1124             'linux_use_tcmalloc%': 0,
1125             'linux_breakpad%': 0,
1126             'sysroot%': '<(sysroot)',
1127             'CXX%': '<(CXX)',
1128           }],
1129           # All Chrome builds have breakpad symbols, but only process the
1130           # symbols from official builds.
1131           ['(branding=="Chrome" and buildtype=="Official")', {
1132             'linux_dump_symbols%': 1,
1133           }],
1134         ],
1135       }],  # os_posix==1 and OS!="mac" and OS!="ios"
1136       ['OS=="ios"', {
1137         'disable_nacl%': 1,
1138         'enable_background%': 0,
1139         'enable_gpu%': 0,
1140         'enable_task_manager%': 0,
1141         'icu_use_data_file_flag%': 1,
1142         'use_system_libxml%': 1,
1143         'use_system_sqlite%': 1,
1144         'locales==': [
1145           'ar', 'ca', 'cs', 'da', 'de', 'el', 'en-GB', 'en-US', 'es', 'fi',
1146           'fr', 'he', 'hr', 'hu', 'id', 'it', 'ja', 'ko', 'ms', 'nl', 'pl',
1147           'pt', 'pt-PT', 'ro', 'ru', 'sk', 'sv', 'th', 'tr', 'uk', 'vi',
1148           'zh-CN', 'zh-TW',
1149         ],
1151         # The Mac SDK is set for iOS builds and passed through to Mac
1152         # sub-builds. This allows the Mac sub-build SDK in an iOS build to be
1153         # overridden from the command line the same way it is for a Mac build.
1154         'mac_sdk%': '<!(python <(DEPTH)/build/mac/find_sdk.py 10.6)',
1156         # iOS SDK and deployment target support.  The iOS 5.0 SDK is actually
1157         # what is required, but the value is left blank so when it is set in
1158         # the project files it will be the "current" iOS SDK.  Forcing 5.0
1159         # even though it is "current" causes Xcode to spit out a warning for
1160         # every single project file for not using the "current" SDK.
1161         'ios_sdk%': '',
1162         'ios_sdk_path%': '',
1163         'ios_deployment_target%': '5.0',
1165         'conditions': [
1166           # ios_product_name is set to the name of the .app bundle as it should
1167           # appear on disk.
1168           ['branding=="Chrome"', {
1169             'ios_product_name%': 'Chrome',
1170           }, { # else: branding!="Chrome"
1171             'ios_product_name%': 'Chromium',
1172           }],
1173           ['branding=="Chrome" and buildtype=="Official"', {
1174             'ios_breakpad%': 1,
1175           }, { # else: branding!="Chrome" or buildtype!="Official"
1176             'ios_breakpad%': 0,
1177           }],
1178         ],
1179       }],  # OS=="ios"
1180       ['OS=="android"', {
1181         # Location of Android NDK.
1182         'variables': {
1183           'variables': {
1184              # Unfortuantely we have to use absolute paths to the SDK/NDK beause
1185              # they're passed to ant which uses a different relative path from
1186              # gyp.
1187              'android_ndk_root%': '<!(cd <(DEPTH) && pwd -P)/third_party/android_tools/ndk/',
1188              'android_sdk_root%': '<!(cd <(DEPTH) && pwd -P)/third_party/android_tools/sdk/',
1189              'android_host_arch%': '<!(uname -m)',
1190              # Android API-level of the SDK used for compilation.
1191              'android_sdk_version%': '17',
1192           },
1193           # Copy conditionally-set variables out one scope.
1194           'android_ndk_root%': '<(android_ndk_root)',
1195           'android_sdk_root%': '<(android_sdk_root)',
1196           'android_sdk_version%': '<(android_sdk_version)',
1197           'android_stlport_root': '<(android_ndk_root)/sources/cxx-stl/stlport',
1199           'android_sdk%': '<(android_sdk_root)/platforms/android-<(android_sdk_version)',
1201           # Android API level 14 is ICS (Android 4.0) which is the minimum
1202           # platform requirement for Chrome on Android, we use it for native
1203           # code compilation.
1204           'conditions': [
1205             ['target_arch == "ia32"', {
1206               'android_app_abi%': 'x86',
1207               'android_gdbserver%': '<(android_ndk_root)/prebuilt/android-x86/gdbserver/gdbserver',
1208               'android_ndk_sysroot%': '<(android_ndk_root)/platforms/android-14/arch-x86',
1209               'android_toolchain%': '<(android_ndk_root)/toolchains/x86-4.6/prebuilt/<(host_os)-<(android_host_arch)/bin',
1210             }],
1211             ['target_arch=="arm"', {
1212               'conditions': [
1213                 ['arm_version<7', {
1214                   'android_app_abi%': 'armeabi',
1215                 }, {
1216                   'android_app_abi%': 'armeabi-v7a',
1217                 }],
1218               ],
1219               'android_gdbserver%': '<(android_ndk_root)/prebuilt/android-arm/gdbserver/gdbserver',
1220               'android_ndk_sysroot%': '<(android_ndk_root)/platforms/android-14/arch-arm',
1221               'android_toolchain%': '<(android_ndk_root)/toolchains/arm-linux-androideabi-4.6/prebuilt/<(host_os)-<(android_host_arch)/bin',
1222             }],
1223             ['target_arch == "mipsel"', {
1224               'android_app_abi%': 'mips',
1225               'android_gdbserver%': '<(android_ndk_root)/prebuilt/android-mips/gdbserver/gdbserver',
1226               'android_ndk_sysroot%': '<(android_ndk_root)/platforms/android-14/arch-mips',
1227               'android_toolchain%': '<(android_ndk_root)/toolchains/mipsel-linux-android-4.6/prebuilt/<(host_os)-<(android_host_arch)/bin',
1228             }],
1229           ],
1230         },
1231         # Copy conditionally-set variables out one scope.
1232         'android_app_abi%': '<(android_app_abi)',
1233         'android_gdbserver%': '<(android_gdbserver)',
1234         'android_ndk_root%': '<(android_ndk_root)',
1235         'android_ndk_sysroot': '<(android_ndk_sysroot)',
1236         'android_sdk_root%': '<(android_sdk_root)',
1237         'android_sdk_version%': '<(android_sdk_version)',
1238         'android_toolchain%': '<(android_toolchain)',
1240         'android_ndk_include': '<(android_ndk_sysroot)/usr/include',
1241         'android_ndk_lib': '<(android_ndk_sysroot)/usr/lib',
1242         'android_sdk_tools%': '<(android_sdk_root)/platform-tools',
1243         'android_sdk%': '<(android_sdk)',
1244         'android_sdk_jar%': '<(android_sdk)/android.jar',
1246         'android_stlport_root': '<(android_stlport_root)',
1247         'android_stlport_include': '<(android_stlport_root)/stlport',
1248         'android_stlport_libs_dir': '<(android_stlport_root)/libs/<(android_app_abi)',
1250         # Location of the "strip" binary, used by both gyp and scripts.
1251         'android_strip%' : '<!(/bin/echo -n <(android_toolchain)/*-strip)',
1253         # Location of the "readelf" binary.
1254         'android_readelf%' : '<!(/bin/echo -n <(android_toolchain)/*-readelf)',
1256         # Provides an absolute path to PRODUCT_DIR (e.g. out/Release). Used
1257         # to specify the output directory for Ant in the Android build.
1258         'ant_build_out': '`cd <(PRODUCT_DIR) && pwd -P`',
1260         # Determines whether we should optimize JNI generation at the cost of
1261         # breaking assumptions in the build system that when inputs have changed
1262         # the outputs should always change as well.  This is meant purely for
1263         # developer builds, to avoid spurious re-linking of native files.
1264         'optimize_jni_generation%': 0,
1266         # Always uses openssl.
1267         'use_openssl%': 1,
1269         'proprietary_codecs%': '<(proprietary_codecs)',
1270         'enable_task_manager%': 0,
1271         'safe_browsing%': 2,
1272         'configuration_policy%': 0,
1273         'input_speech%': 0,
1274         'enable_automation%': 0,
1275         'java_bridge%': 1,
1276         'build_ffmpegsumo%': 0,
1277         'linux_use_tcmalloc%': 0,
1279         # Disable Native Client.
1280         'disable_nacl%': 1,
1282         # Android does not support background apps.
1283         'enable_background%': 0,
1285         # Sessions are store separately in the Java side.
1286         'enable_session_service%': 0,
1288         # Set to 1 once we have a notification system for Android.
1289         # http://crbug.com/115320
1290         'notifications%': 0,
1292         'p2p_apis%' : 0,
1294         'gtest_target_type%': 'shared_library',
1296         # Uses system APIs for decoding audio and video.
1297         'use_libffmpeg%': '0',
1299         # Always use the chromium skia.
1300         'use_system_skia%': '0',
1302         # When building as part of the Android system, use system libraries
1303         # where possible to reduce ROM size.
1304         # TODO(steveblock): Investigate using the system version of sqlite.
1305         'use_system_sqlite%': 0,  # '<(android_webview_build)',
1306         'use_system_expat%': '<(android_webview_build)',
1307         'use_system_icu%': '<(android_webview_build)',
1308         'use_system_stlport%': '<(android_webview_build)',
1310         'enable_managed_users%': 0,
1312         # Copy it out one scope.
1313         'android_webview_build%': '<(android_webview_build)',
1314       }],  # OS=="android"
1315       ['OS=="mac"', {
1316         # Enable clang on mac by default!
1317         'clang%': 1,
1318       }],  # OS=="mac"
1319       ['OS=="mac" or OS=="ios"', {
1320         'variables': {
1321           # Mac OS X SDK and deployment target support.  The SDK identifies
1322           # the version of the system headers that will be used, and
1323           # corresponds to the MAC_OS_X_VERSION_MAX_ALLOWED compile-time
1324           # macro.  "Maximum allowed" refers to the operating system version
1325           # whose APIs are available in the headers.  The deployment target
1326           # identifies the minimum system version that the built products are
1327           # expected to function on.  It corresponds to the
1328           # MAC_OS_X_VERSION_MIN_REQUIRED compile-time macro.  To ensure these
1329           # macros are available, #include <AvailabilityMacros.h>.  Additional
1330           # documentation on these macros is available at
1331           # http://developer.apple.com/mac/library/technotes/tn2002/tn2064.html#SECTION3
1332           # Chrome normally builds with the Mac OS X 10.6 SDK and sets the
1333           # deployment target to 10.6.  Other projects, such as O3D, may
1334           # override these defaults.
1336           # Normally, mac_sdk_min is used to find an SDK that Xcode knows
1337           # about that is at least the specified version. In official builds,
1338           # the SDK must match mac_sdk_min exactly. If the SDK is installed
1339           # someplace that Xcode doesn't know about, set mac_sdk_path to the
1340           # path to the SDK; when set to a non-empty string, SDK detection
1341           # based on mac_sdk_min will be bypassed entirely.
1342           'mac_sdk_min%': '10.6',
1343           'mac_sdk_path%': '',
1345           'mac_deployment_target%': '10.6',
1346         },
1348         'mac_sdk_min': '<(mac_sdk_min)',
1349         'mac_sdk_path': '<(mac_sdk_path)',
1350         'mac_deployment_target': '<(mac_deployment_target)',
1352         # Compile in Breakpad support by default so that it can be
1353         # tested, even if it is not enabled by default at runtime.
1354         'mac_breakpad_compiled_in%': 1,
1355         'conditions': [
1356           # mac_product_name is set to the name of the .app bundle as it should
1357           # appear on disk.  This duplicates data from
1358           # chrome/app/theme/chromium/BRANDING and
1359           # chrome/app/theme/google_chrome/BRANDING, but is necessary to get
1360           # these names into the build system.
1361           ['branding=="Chrome"', {
1362             'mac_product_name%': 'Google Chrome',
1363           }, { # else: branding!="Chrome"
1364             'mac_product_name%': 'Chromium',
1365           }],
1367           ['branding=="Chrome" and buildtype=="Official"', {
1368             'mac_sdk%': '<!(python <(DEPTH)/build/mac/find_sdk.py --verify <(mac_sdk_min) --sdk_path=<(mac_sdk_path))',
1369             # Enable uploading crash dumps.
1370             'mac_breakpad_uploads%': 1,
1371             # Enable dumping symbols at build time for use by Mac Breakpad.
1372             'mac_breakpad%': 1,
1373             # Enable Keystone auto-update support.
1374             'mac_keystone%': 1,
1375           }, { # else: branding!="Chrome" or buildtype!="Official"
1376             'mac_sdk%': '<!(python <(DEPTH)/build/mac/find_sdk.py <(mac_sdk_min))',
1377             'mac_breakpad_uploads%': 0,
1378             'mac_breakpad%': 0,
1379             'mac_keystone%': 0,
1380           }],
1381         ],
1382       }],  # OS=="mac" or OS=="ios"
1383       ['OS=="win"', {
1384         'conditions': [
1385           ['component=="shared_library"', {
1386             'win_use_allocator_shim%': 0,
1387           }],
1388           ['component=="shared_library" and "<(GENERATOR)"=="ninja"', {
1389             # Only enabled by default for ninja because it's buggy in VS.
1390             # Not enabled for component=static_library because some targets
1391             # are too large and the toolchain fails due to the size of the
1392             # .obj files.
1393             'incremental_chrome_dll%': 1,
1394           }],
1395           # Don't do incremental linking for large modules on 32-bit.
1396           ['MSVS_OS_BITS==32', {
1397             'msvs_large_module_debug_link_mode%': '1',  # No
1398           },{
1399             'msvs_large_module_debug_link_mode%': '2',  # Yes
1400           }],
1401           ['MSVS_VERSION=="2012e" or MSVS_VERSION=="2010e"', {
1402             'msvs_express%': 1,
1403             'secure_atl%': 0,
1404           },{
1405             'msvs_express%': 0,
1406             'secure_atl%': 1,
1407           }],
1408         ],
1409         'nacl_win64_defines': [
1410           # This flag is used to minimize dependencies when building
1411           # Native Client loader for 64-bit Windows.
1412           'NACL_WIN64',
1413         ],
1414       }],
1416       ['os_posix==1 and chromeos==0 and OS!="android" and OS!="ios"', {
1417         'use_cups%': 1,
1418       }, {
1419         'use_cups%': 0,
1420       }],
1422       ['enable_plugins==1 and (OS=="linux" or OS=="mac" or OS=="win" or google_tv==1)', {
1423         'enable_pepper_cdms%': 1,
1424       }, {
1425         'enable_pepper_cdms%': 0,
1426       }],
1428       # Native Client glibc toolchain is enabled
1429       # by default except on arm and mips.
1430       ['target_arch=="arm" or target_arch=="mipsel"', {
1431         'disable_glibc%': 1,
1432       }, {
1433         'disable_glibc%': 0,
1434       }],
1436       # Disable SSE2 when building for ARM or MIPS.
1437       ['target_arch=="arm" or target_arch=="mipsel"', {
1438         'disable_sse2%': 1,
1439       }, {
1440         'disable_sse2%': '<(disable_sse2)',
1441       }],
1443       # Set the relative path from this file to the GYP file of the JPEG
1444       # library used by Chromium.
1445       ['use_system_libjpeg==1 or use_libjpeg_turbo==0', {
1446         # Configuration for using the system libjeg is here.
1447         'libjpeg_gyp_path': '../third_party/libjpeg/libjpeg.gyp',
1448       }, {
1449         'libjpeg_gyp_path': '../third_party/libjpeg_turbo/libjpeg.gyp',
1450       }],
1452       # Options controlling the use of GConf (the classic GNOME configuration
1453       # system) and GIO, which contains GSettings (the new GNOME config system).
1454       ['chromeos==1', {
1455         'use_gconf%': 0,
1456         'use_gio%': 0,
1457       }, {
1458         'use_gconf%': 1,
1459         'use_gio%': 1,
1460       }],
1462       # Set up -D and -E flags passed into grit.
1463       ['branding=="Chrome"', {
1464         # TODO(mmoss) The .grd files look for _google_chrome, but for
1465         # consistency they should look for google_chrome_build like C++.
1466         'grit_defines': ['-D', '_google_chrome',
1467                          '-E', 'CHROMIUM_BUILD=google_chrome'],
1468       }, {
1469         'grit_defines': ['-D', '_chromium',
1470                          '-E', 'CHROMIUM_BUILD=chromium'],
1471       }],
1472       ['chromeos==1', {
1473         'grit_defines': ['-D', 'chromeos', '-D', 'scale_factors=2x'],
1474       }],
1475       ['toolkit_views==1', {
1476         'grit_defines': ['-D', 'toolkit_views'],
1477       }],
1478       ['use_aura==1', {
1479         'grit_defines': ['-D', 'use_aura'],
1480       }],
1481       ['use_ash==1', {
1482         'grit_defines': ['-D', 'use_ash'],
1483       }],
1484       ['use_nss==1', {
1485         'grit_defines': ['-D', 'use_nss'],
1486       }],
1487       ['use_ozone==1', {
1488         'grit_defines': ['-D', 'use_ozone'],
1489       }],
1490       ['file_manager_extension==1', {
1491         'grit_defines': ['-D', 'file_manager_extension'],
1492       }],
1493       ['image_loader_extension==1', {
1494         'grit_defines': ['-D', 'image_loader_extension'],
1495       }],
1496       ['remoting==1', {
1497         'grit_defines': ['-D', 'remoting'],
1498       }],
1499       ['use_titlecase_in_grd_files==1', {
1500         'grit_defines': ['-D', 'use_titlecase'],
1501       }],
1502       ['use_third_party_translations==1', {
1503         'grit_defines': ['-D', 'use_third_party_translations'],
1504         'locales': [
1505           'ast', 'bs', 'ca@valencia', 'en-AU', 'eo', 'eu', 'gl', 'hy', 'ia',
1506           'ka', 'ku', 'kw', 'ms', 'ug'
1507         ],
1508       }],
1509       ['OS=="android"', {
1510         'grit_defines': ['-t', 'android',
1511                          '-E', 'ANDROID_JAVA_TAGGED_ONLY=true'],
1512         'conditions': [
1513           ['google_tv==1', {
1514             'grit_defines': ['-D', 'google_tv'],
1515           }],
1516         ],
1517       }],
1518       ['OS=="mac"', {
1519         'grit_defines': ['-D', 'scale_factors=2x'],
1520       }],
1521       ['OS == "ios"', {
1522         'grit_defines': [
1523           # define for iOS specific resources.
1524           '-D', 'ios',
1525           # iOS uses a whitelist to filter resources.
1526           '-w', '<(DEPTH)/build/ios/grit_whitelist.txt'
1527         ],
1529         # Enable clang and host builds when generating with ninja-ios.
1530         'conditions': [
1531           ['"<(GENERATOR)"=="ninja"', {
1532             'clang%': 1,
1533             'host_os%': "mac",
1534           }]
1535         ],
1536       }],
1537       ['enable_extensions==1', {
1538         'grit_defines': ['-D', 'enable_extensions'],
1539       }],
1540       ['enable_printing==1', {
1541         'grit_defines': ['-D', 'enable_printing'],
1542       }],
1543       ['enable_themes==1', {
1544         'grit_defines': ['-D', 'enable_themes'],
1545       }],
1546       ['use_oem_wallpaper==1', {
1547         'grit_defines': ['-D', 'use_oem_wallpaper'],
1548       }],
1549       ['enable_app_list==1', {
1550         'grit_defines': ['-D', 'enable_app_list'],
1551       }],
1552       ['enable_settings_app==1', {
1553         'grit_defines': ['-D', 'enable_settings_app'],
1554       }],
1555       ['enable_google_now==1', {
1556         'grit_defines': ['-D', 'enable_google_now'],
1557       }],
1558       ['use_concatenated_impulse_responses==1', {
1559         'grit_defines': ['-D', 'use_concatenated_impulse_responses'],
1560       }],
1561       ['clang_use_chrome_plugins==1 and OS!="win"', {
1562         'clang_chrome_plugins_flags': [
1563           '<!@(<(DEPTH)/tools/clang/scripts/plugin_flags.sh)'
1564         ],
1565       }],
1567       ['asan==1 and OS!="win"', {
1568         'clang%': 1,
1569       }],
1570       ['asan==1 and OS=="mac"', {
1571         # See http://crbug.com/145503.
1572         'component': "static_library",
1573         # TODO(glider): we do not strip ASan binaries until the dynamic ASan
1574         # runtime is fully adopted. See http://crbug.com/242503.
1575         'mac_strip_release': 0,
1576       }],
1577       ['tsan==1', {
1578         'clang%': 1,
1579       }],
1580       ['msan==1', {
1581         'clang%': 1,
1582       }],
1584       ['OS=="linux" and clang_type_profiler==1', {
1585         'clang%': 1,
1586         'clang_use_chrome_plugins%': 0,
1587         'conditions': [
1588           ['host_arch=="x64"', {
1589             'make_clang_dir%': 'third_party/llvm-allocated-type/Linux_x64',
1590           }],
1591           ['host_arch=="ia32"', {
1592             # 32-bit Clang is unsupported.  It may not build.  Put your 32-bit
1593             # Clang in this directory at your own risk if needed for some
1594             # purpose (e.g. to compare 32-bit and 64-bit behavior like memory
1595             # usage).  Any failure by this compiler should not close the tree.
1596             'make_clang_dir%': 'third_party/llvm-allocated-type/Linux_ia32',
1597           }],
1598         ],
1599       }],
1601       # On valgrind bots, override the optimizer settings so we don't inline too
1602       # much and make the stacks harder to figure out.
1603       #
1604       # TODO(rnk): Kill off variables that no one else uses and just implement
1605       # them under a build_for_tool== condition.
1606       ['build_for_tool=="memcheck" or build_for_tool=="tsan"', {
1607         # gcc flags
1608         'mac_debug_optimization': '1',
1609         'mac_release_optimization': '1',
1610         'release_optimize': '1',
1611         'no_gc_sections': 1,
1612         'debug_extra_cflags': '-g -fno-inline -fno-omit-frame-pointer '
1613                               '-fno-builtin -fno-optimize-sibling-calls',
1614         'release_extra_cflags': '-g -fno-inline -fno-omit-frame-pointer '
1615                                 '-fno-builtin -fno-optimize-sibling-calls',
1617         # MSVS flags for TSan on Pin and Windows.
1618         'win_debug_RuntimeChecks': '0',
1619         'win_debug_disable_iterator_debugging': '1',
1620         'win_debug_Optimization': '1',
1621         'win_debug_InlineFunctionExpansion': '0',
1622         'win_release_InlineFunctionExpansion': '0',
1623         'win_release_OmitFramePointers': '0',
1625         'linux_use_tcmalloc': 1,
1626         'release_valgrind_build': 1,
1627         'werror': '',
1628         'component': 'static_library',
1629         'use_system_zlib': 0,
1630       }],
1632       # Build tweaks for DrMemory.
1633       # TODO(rnk): Combine with tsan config to share the builder.
1634       # http://crbug.com/108155
1635       ['build_for_tool=="drmemory"', {
1636         # These runtime checks force initialization of stack vars which blocks
1637         # DrMemory's uninit detection.
1638         'win_debug_RuntimeChecks': '0',
1639         # Iterator debugging is slow.
1640         'win_debug_disable_iterator_debugging': '1',
1641         # Try to disable optimizations that mess up stacks in a release build.
1642         # DrM-i#1054 (http://code.google.com/p/drmemory/issues/detail?id=1054)
1643         # /O2 and /Ob0 (disable inline) cannot be used together because of a
1644         # compiler bug, so we use /Ob1 instead.
1645         'win_release_InlineFunctionExpansion': '1',
1646         'win_release_OmitFramePointers': '0',
1647         # Ditto for debug, to support bumping win_debug_Optimization.
1648         'win_debug_InlineFunctionExpansion': 0,
1649         'win_debug_OmitFramePointers': 0,
1650         # Keep the code under #ifndef NVALGRIND.
1651         'release_valgrind_build': 1,
1652       }],
1654       # Enable RLZ on Win, Mac and ChromeOS.
1655       ['branding=="Chrome" and (OS=="win" or OS=="mac" or chromeos==1)', {
1656         'enable_rlz%': 1,
1657       }],
1659       # Set default compiler flags depending on ARM version.
1660       ['arm_version==5 and android_webview_build==0', {
1661         # Flags suitable for Android emulator
1662         'arm_arch%': 'armv5te',
1663         'arm_tune%': 'xscale',
1664         'arm_fpu%': '',
1665         'arm_float_abi%': 'soft',
1666         'arm_thumb%': 0,
1667       }],
1668       ['arm_version==6 and android_webview_build==0', {
1669         'arm_arch%': 'armv6',
1670         'arm_tune%': '',
1671         'arm_fpu%': '',
1672         'arm_float_abi%': 'soft',
1673         'arm_thumb%': 0,
1674       }],
1675       ['arm_version==7 and android_webview_build==0', {
1676         'arm_arch%': 'armv7-a',
1677         'arm_tune%': 'cortex-a8',
1678         'conditions': [
1679           ['arm_neon==1', {
1680             'arm_fpu%': 'neon',
1681           }, {
1682             'arm_fpu%': 'vfpv3-d16',
1683           }],
1684         ],
1685         'arm_float_abi%': 'softfp',
1686         'arm_thumb%': 1,
1687       }],
1689       ['android_webview_build==1', {
1690         # The WebView build gets its cpu-specific flags from the Android build system.
1691         'arm_arch%': '',
1692         'arm_tune%': '',
1693         'arm_fpu%': '',
1694         'arm_float_abi%': '',
1695         'arm_thumb%': 0,
1696       }],
1697     ],
1699     # List of default apps to install in new profiles.  The first list contains
1700     # the source files as found in svn.  The second list, used only for linux,
1701     # contains the destination location for each of the files.  When a crx
1702     # is added or removed from the list, the chrome/browser/resources/
1703     # default_apps/external_extensions.json file must also be updated.
1704     'default_apps_list': [
1705       'browser/resources/default_apps/external_extensions.json',
1706       'browser/resources/default_apps/gmail.crx',
1707       'browser/resources/default_apps/search.crx',
1708       'browser/resources/default_apps/youtube.crx',
1709       'browser/resources/default_apps/drive.crx',
1710       'browser/resources/default_apps/docs.crx',
1711     ],
1712     'default_apps_list_linux_dest': [
1713       '<(PRODUCT_DIR)/default_apps/external_extensions.json',
1714       '<(PRODUCT_DIR)/default_apps/gmail.crx',
1715       '<(PRODUCT_DIR)/default_apps/search.crx',
1716       '<(PRODUCT_DIR)/default_apps/youtube.crx',
1717       '<(PRODUCT_DIR)/default_apps/drive.crx',
1718       '<(PRODUCT_DIR)/default_apps/docs.crx',
1719     ],
1720   },
1721   'target_defaults': {
1722     'variables': {
1723       # The condition that operates on chromium_code is in a target_conditions
1724       # section, and will not have access to the default fallback value of
1725       # chromium_code at the top of this file, or to the chromium_code
1726       # variable placed at the root variables scope of .gyp files, because
1727       # those variables are not set at target scope.  As a workaround,
1728       # if chromium_code is not set at target scope, define it in target scope
1729       # to contain whatever value it has during early variable expansion.
1730       # That's enough to make it available during target conditional
1731       # processing.
1732       'chromium_code%': '<(chromium_code)',
1734       # See http://msdn.microsoft.com/en-us/library/aa652360(VS.71).aspx
1735       'win_release_Optimization%': '2', # 2 = /Os
1736       'win_debug_Optimization%': '0',   # 0 = /Od
1738       # See http://msdn.microsoft.com/en-us/library/2kxx5t2c(v=vs.80).aspx
1739       # Tri-state: blank is default, 1 on, 0 off
1740       'win_release_OmitFramePointers%': '0',
1741       # Tri-state: blank is default, 1 on, 0 off
1742       'win_debug_OmitFramePointers%': '',
1744       # See http://msdn.microsoft.com/en-us/library/8wtf2dfz(VS.71).aspx
1745       'win_debug_RuntimeChecks%': '3',    # 3 = all checks enabled, 0 = off
1747       # See http://msdn.microsoft.com/en-us/library/47238hez(VS.71).aspx
1748       'win_debug_InlineFunctionExpansion%': '',    # empty = default, 0 = off,
1749       'win_release_InlineFunctionExpansion%': '2', # 1 = only __inline, 2 = max
1751       # VS inserts quite a lot of extra checks to algorithms like
1752       # std::partial_sort in Debug build which make them O(N^2)
1753       # instead of O(N*logN). This is particularly slow under memory
1754       # tools like ThreadSanitizer so we want it to be disablable.
1755       # See http://msdn.microsoft.com/en-us/library/aa985982(v=VS.80).aspx
1756       'win_debug_disable_iterator_debugging%': '0',
1758       'release_extra_cflags%': '',
1759       'debug_extra_cflags%': '',
1761       'release_valgrind_build%': '<(release_valgrind_build)',
1763       # the non-qualified versions are widely assumed to be *nix-only
1764       'win_release_extra_cflags%': '',
1765       'win_debug_extra_cflags%': '',
1767       # TODO(thakis): Make this a blacklist instead, http://crbug.com/101600
1768       'enable_wexit_time_destructors%': '<(enable_wexit_time_destructors)',
1770       # Only used by Windows build for now.  Can be used to build into a
1771       # differet output directory, e.g., a build_dir_prefix of VS2010_ would
1772       # output files in src/build/VS2010_{Debug,Release}.
1773       'build_dir_prefix%': '',
1775       # Targets are by default not nacl untrusted code.
1776       'nacl_untrusted_build%': 0,
1778       'pnacl_compile_flags': [
1779         # pnacl uses the clang compiler so we need to supress all the
1780         # same warnings as we do for clang.
1781         # TODO(sbc): Remove these if/when they are removed from the clang
1782         # build.
1783         '-Wno-unused-function',
1784         '-Wno-char-subscripts',
1785         '-Wno-c++11-extensions',
1786         '-Wno-unnamed-type-template-args',
1787       ],
1789       'conditions': [
1790         ['OS=="win" and component=="shared_library"', {
1791           # See http://msdn.microsoft.com/en-us/library/aa652367.aspx
1792           'win_release_RuntimeLibrary%': '2', # 2 = /MD (nondebug DLL)
1793           'win_debug_RuntimeLibrary%': '3',   # 3 = /MDd (debug DLL)
1794         }, {
1795           # See http://msdn.microsoft.com/en-us/library/aa652367.aspx
1796           'win_release_RuntimeLibrary%': '0', # 0 = /MT (nondebug static)
1797           'win_debug_RuntimeLibrary%': '1',   # 1 = /MTd (debug static)
1798         }],
1799         ['OS=="ios"', {
1800           # See http://gcc.gnu.org/onlinedocs/gcc-4.4.2/gcc/Optimize-Options.html
1801           'mac_release_optimization%': 's', # Use -Os unless overridden
1802           'mac_debug_optimization%': '0',   # Use -O0 unless overridden
1803         }, {
1804           # See http://gcc.gnu.org/onlinedocs/gcc-4.4.2/gcc/Optimize-Options.html
1805           'mac_release_optimization%': '3', # Use -O3 unless overridden
1806           'mac_debug_optimization%': '0',   # Use -O0 unless overridden
1807         }],
1808       ],
1809     },
1810     'conditions': [
1811       ['(OS=="mac" or OS=="ios") and asan==1', {
1812         'dependencies': [
1813           '<(DEPTH)/build/mac/asan.gyp:asan_dynamic_runtime',
1814         ],
1815       }],
1816       ['OS=="linux" and linux_use_tcmalloc==1 and clang_type_profiler==1', {
1817         'cflags_cc!': ['-fno-rtti'],
1818         'cflags_cc+': [
1819           '-frtti',
1820           '-gline-tables-only',
1821           '-fintercept-allocation-functions',
1822         ],
1823         'defines': ['TYPE_PROFILING'],
1824         'dependencies': [
1825           '<(DEPTH)/base/allocator/allocator.gyp:type_profiler',
1826         ],
1827       }],
1828       ['chrome_split_dll', {
1829         'variables': {
1830           'chrome_split_dll': '<!(python <(DEPTH)/tools/win/split_link/check_installed.py)',
1831         },
1832         'defines': ['CHROME_SPLIT_DLL'],
1833       }],
1834       ['OS=="linux" and clang==1 and host_arch=="ia32"', {
1835         # TODO(dmikurube): Remove -Wno-sentinel when Clang/LLVM is fixed.
1836         # See http://crbug.com/162818.
1837         'cflags+': ['-Wno-sentinel'],
1838       }],
1839       ['OS=="win" and "<(msbuild_toolset)"!=""', {
1840         'msbuild_toolset': '<(msbuild_toolset)',
1841       }],
1842       ['branding=="Chrome"', {
1843         'defines': ['GOOGLE_CHROME_BUILD'],
1844       }, {  # else: branding!="Chrome"
1845         'defines': ['CHROMIUM_BUILD'],
1846       }],
1847       ['OS=="mac" and component=="shared_library"', {
1848         'xcode_settings': {
1849           'DYLIB_INSTALL_NAME_BASE': '@rpath',
1850           'LD_RUNPATH_SEARCH_PATHS': [
1851             # For unbundled binaries.
1852             '@loader_path/.',
1853             # For bundled binaries, to get back from Binary.app/Contents/MacOS.
1854             '@loader_path/../../..',
1855           ],
1856         },
1857       }],
1858       ['enable_double_resource_load_timing==1', {
1859         'defines': ['ENABLE_DOUBLE_RESOURCE_LOAD_TIMING'],
1860       }],
1861       ['enable_rlz==1', {
1862         'defines': ['ENABLE_RLZ'],
1863       }],
1864       ['component=="shared_library"', {
1865         'defines': ['COMPONENT_BUILD'],
1866       }],
1867       ['toolkit_views==1', {
1868         'defines': ['TOOLKIT_VIEWS=1'],
1869       }],
1870       ['ui_compositor_image_transport==1', {
1871         'defines': ['UI_COMPOSITOR_IMAGE_TRANSPORT'],
1872       }],
1873       ['use_aura==1', {
1874         'defines': ['USE_AURA=1'],
1875       }],
1876       ['use_ash==1', {
1877         'defines': ['USE_ASH=1'],
1878       }],
1879       ['use_ozone==1', {
1880         'defines': ['USE_OZONE=1'],
1881       }],
1882       ['use_default_render_theme==1', {
1883         'defines': ['USE_DEFAULT_RENDER_THEME=1'],
1884       }],
1885       ['use_libjpeg_turbo==1', {
1886         'defines': ['USE_LIBJPEG_TURBO=1'],
1887       }],
1888       ['use_nss==1', {
1889         'defines': ['USE_NSS=1'],
1890       }],
1891       ['use_x11==1', {
1892         'defines': ['USE_X11=1'],
1893       }],
1894       ['enable_one_click_signin==1', {
1895         'defines': ['ENABLE_ONE_CLICK_SIGNIN'],
1896       }],
1897       ['toolkit_uses_gtk==1 and toolkit_views==0', {
1898         # TODO(erg): We are progressively sealing up use of deprecated features
1899         # in gtk in preparation for an eventual porting to gtk3.
1900         'defines': ['GTK_DISABLE_SINGLE_INCLUDES=1'],
1901       }],
1902       ['chromeos==1', {
1903         'defines': ['OS_CHROMEOS=1'],
1904       }],
1905       ['google_tv==1', {
1906         'defines': ['GOOGLE_TV=1'],
1907       }],
1908       ['use_xi2_mt!=0', {
1909         'defines': ['USE_XI2_MT=<(use_xi2_mt)'],
1910       }],
1911       ['file_manager_extension==1', {
1912         'defines': ['FILE_MANAGER_EXTENSION=1'],
1913       }],
1914       ['image_loader_extension==1', {
1915         'defines': ['IMAGE_LOADER_EXTENSION=1'],
1916       }],
1917       ['profiling==1', {
1918         'defines': ['ENABLE_PROFILING=1'],
1919       }],
1920       ['OS=="linux" and glibcxx_debug==1', {
1921         'defines': ['_GLIBCXX_DEBUG=1',],
1922         'cflags_cc+': ['-g'],
1923       }],
1924       ['remoting==1', {
1925         'defines': ['ENABLE_REMOTING=1'],
1926       }],
1927       ['enable_webrtc==1', {
1928         'defines': ['ENABLE_WEBRTC=1'],
1929       }],
1930       ['proprietary_codecs==1', {
1931         'defines': ['USE_PROPRIETARY_CODECS'],
1932       }],
1933       ['enable_viewport==1', {
1934         'defines': ['ENABLE_VIEWPORT'],
1935       }],
1936       ['enable_pepper_cdms==1', {
1937         'defines': ['ENABLE_PEPPER_CDMS'],
1938       }],
1939       ['configuration_policy==1', {
1940         'defines': ['ENABLE_CONFIGURATION_POLICY'],
1941       }],
1942       ['input_speech==1', {
1943         'defines': ['ENABLE_INPUT_SPEECH'],
1944       }],
1945       ['notifications==1', {
1946         'defines': ['ENABLE_NOTIFICATIONS'],
1947       }],
1948       ['enable_hidpi==1', {
1949         'defines': ['ENABLE_HIDPI=1'],
1950       }],
1951       ['fastbuild!=0', {
1952         'xcode_settings': {
1953           'GCC_GENERATE_DEBUGGING_SYMBOLS': 'NO',
1954         },
1955         'conditions': [
1956           ['clang==1', {
1957             # Clang creates chubby debug information, which makes linking very
1958             # slow. For now, don't create debug information with clang.  See
1959             # http://crbug.com/70000
1960             'conditions': [
1961               ['OS=="linux"', {
1962                 'variables': {
1963                   'debug_extra_cflags': '-g0',
1964                 },
1965               }],
1966               # Android builds symbols on release by default, disable them.
1967               ['OS=="android"', {
1968                 'variables': {
1969                   'debug_extra_cflags': '-g0',
1970                   'release_extra_cflags': '-g0',
1971                 },
1972               }],
1973             ],
1974           }, { # else clang!=1
1975             'conditions': [
1976               ['OS=="win" and fastbuild==2', {
1977                 # Completely disable debug information.
1978                 'msvs_settings': {
1979                   'VCLinkerTool': {
1980                     'GenerateDebugInformation': 'false',
1981                   },
1982                   'VCCLCompilerTool': {
1983                     'DebugInformationFormat': '0',
1984                   },
1985                 },
1986               }],
1987               ['OS=="win" and fastbuild==1', {
1988                 'msvs_settings': {
1989                   'VCLinkerTool': {
1990                     # This tells the linker to generate .pdbs, so that
1991                     # we can get meaningful stack traces.
1992                     'GenerateDebugInformation': 'true',
1993                   },
1994                   'VCCLCompilerTool': {
1995                     # No debug info to be generated by compiler.
1996                     'DebugInformationFormat': '0',
1997                   },
1998                 },
1999               }],
2000               ['OS=="linux" and fastbuild==2', {
2001                 'variables': {
2002                   'debug_extra_cflags': '-g0',
2003                 },
2004               }],
2005               ['OS=="linux" and fastbuild==1', {
2006                 'variables': {
2007                   'debug_extra_cflags': '-g1',
2008                 },
2009               }],
2010               ['OS=="android" and fastbuild==2', {
2011                 'variables': {
2012                   'debug_extra_cflags': '-g0',
2013                   'release_extra_cflags': '-g0',
2014                 },
2015               }],
2016               ['OS=="android" and fastbuild==1', {
2017                 'variables': {
2018                   'debug_extra_cflags': '-g1',
2019                   'release_extra_cflags': '-g1',
2020                 },
2021               }],
2022             ],
2023           }], # clang!=1
2024         ],
2025       }],  # fastbuild!=0
2026       ['dcheck_always_on!=0', {
2027         'defines': ['DCHECK_ALWAYS_ON=1'],
2028       }],  # dcheck_always_on!=0
2029       ['win_use_allocator_shim==0', {
2030         'conditions': [
2031           ['OS=="win"', {
2032             'defines': ['NO_TCMALLOC'],
2033           }],
2034         ],
2035       }],
2036       ['enable_gpu==1', {
2037         'defines': [
2038           'ENABLE_GPU=1',
2039         ],
2040       }],
2041       ['use_openssl==1', {
2042         'defines': [
2043           'USE_OPENSSL=1',
2044         ],
2045       }],
2046       ['enable_eglimage==1', {
2047         'defines': [
2048           'ENABLE_EGLIMAGE=1',
2049         ],
2050       }],
2051       ['asan==1 and OS=="win"', {
2052         # Since asan on windows uses Syzygy, we need /PROFILE turned on to
2053         # produce appropriate pdbs.
2054         'msvs_settings': {
2055           'VCLinkerTool': {
2056             'Profile': 'true',
2057           },
2058         },
2059         'defines': ['ADDRESS_SANITIZER'],
2060       }],  # asan==1 and OS=="win"
2061       ['coverage!=0', {
2062         'conditions': [
2063           ['OS=="mac" or OS=="ios"', {
2064             'xcode_settings': {
2065               'GCC_INSTRUMENT_PROGRAM_FLOW_ARCS': 'YES',  # -fprofile-arcs
2066               'GCC_GENERATE_TEST_COVERAGE_FILES': 'YES',  # -ftest-coverage
2067             },
2068           }],
2069           ['OS=="mac"', {
2070             # Add -lgcov for types executable, shared_library, and
2071             # loadable_module; not for static_library.
2072             # This is a delayed conditional.
2073             'target_conditions': [
2074               ['_type!="static_library"', {
2075                 'xcode_settings': { 'OTHER_LDFLAGS': [ '-lgcov' ] },
2076               }],
2077             ],
2078           }],
2079           ['OS=="linux" or OS=="android"', {
2080             'cflags': [ '-ftest-coverage',
2081                         '-fprofile-arcs' ],
2082             'link_settings': { 'libraries': [ '-lgcov' ] },
2083           }],
2084           ['OS=="win"', {
2085             'variables': {
2086               # Disable incremental linking for all modules.
2087               # 0: inherit, 1: disabled, 2: enabled.
2088               'msvs_debug_link_incremental': '1',
2089               'msvs_large_module_debug_link_mode': '1',
2090               # Disable RTC. Syzygy explicitly doesn't support RTC instrumented
2091               # binaries for now.
2092               'win_debug_RuntimeChecks': '0',
2093             },
2094             'defines': [
2095               # Disable iterator debugging (huge speed boost without any
2096               # change in coverage results).
2097               '_HAS_ITERATOR_DEBUGGING=0',
2098             ],
2099             'msvs_settings': {
2100               'VCLinkerTool': {
2101                 # Enable profile information (necessary for coverage
2102                 # instrumentation). This is incompatible with incremental
2103                 # linking.
2104                 'Profile': 'true',
2105               },
2106             }
2107          }],  # OS==win
2108         ],  # conditions for coverage
2109       }],  # coverage!=0
2110       ['OS=="win"', {
2111         'defines': [
2112           '__STD_C',
2113           '_CRT_SECURE_NO_DEPRECATE',
2114           '_SCL_SECURE_NO_DEPRECATE',
2115           # This define is required to pull in the new Win8 interfaces from
2116           # system headers like ShObjIdl.h.
2117           'NTDDI_VERSION=0x06020000',
2118         ],
2119         'include_dirs': [
2120           '<(DEPTH)/third_party/wtl/include',
2121         ],
2122         'conditions': [
2123           ['win_z7!=0', {
2124             'msvs_settings': {
2125               # Generates debug info when win_z7=1
2126               # even if fastbuild=1 (that makes GenerateDebugInformation false).
2127               'VCLinkerTool': {
2128                 'GenerateDebugInformation': 'true',
2129               },
2130               'VCCLCompilerTool': {
2131                 'DebugInformationFormat': '1',
2132               }
2133             }
2134           }],
2135           ['"<(GENERATOR)"=="msvs"', {
2136             'msvs_settings': {
2137               'VCLinkerTool': {
2138                 # Make the pdb name sane. Otherwise foo.exe and foo.dll both
2139                 # have foo.pdb. The ninja generator already defaults to this and
2140                 # can't handle the $(TargetPath) macro.
2141                 'ProgramDatabaseFile': '$(TargetPath).pdb',
2142               }
2143             },
2144           }],
2145         ],  # win_z7!=0
2146       }],  # OS==win
2147       ['enable_task_manager==1', {
2148         'defines': [
2149           'ENABLE_TASK_MANAGER=1',
2150         ],
2151       }],
2152       ['enable_extensions==1', {
2153         'defines': [
2154           'ENABLE_EXTENSIONS=1',
2155         ],
2156       }],
2157       ['OS=="win" and branding=="Chrome"', {
2158         'defines': ['ENABLE_SWIFTSHADER'],
2159       }],
2160       ['enable_dart==1', {
2161         'defines': ['WEBKIT_USING_DART=1'],
2162       }],
2163       ['enable_plugin_installation==1', {
2164         'defines': ['ENABLE_PLUGIN_INSTALLATION=1'],
2165       }],
2166       ['enable_plugins==1', {
2167         'defines': ['ENABLE_PLUGINS=1'],
2168       }],
2169       ['enable_session_service==1', {
2170         'defines': ['ENABLE_SESSION_SERVICE=1'],
2171       }],
2172       ['enable_themes==1', {
2173         'defines': ['ENABLE_THEMES=1'],
2174       }],
2175       ['enable_autofill_dialog==1', {
2176         'defines': ['ENABLE_AUTOFILL_DIALOG=1'],
2177       }],
2178       ['enable_background==1', {
2179         'defines': ['ENABLE_BACKGROUND=1'],
2180       }],
2181       ['enable_automation==1', {
2182         'defines': ['ENABLE_AUTOMATION=1'],
2183       }],
2184       ['enable_google_now==1', {
2185         'defines': ['ENABLE_GOOGLE_NOW=1'],
2186       }],
2187       ['enable_language_detection==1', {
2188         'defines': ['ENABLE_LANGUAGE_DETECTION=1'],
2189       }],
2190       ['enable_printing==1', {
2191         'defines': ['ENABLE_PRINTING=1'],
2192       }],
2193       ['enable_captive_portal_detection==1', {
2194         'defines': ['ENABLE_CAPTIVE_PORTAL_DETECTION=1'],
2195       }],
2196       ['enable_app_list==1', {
2197         'defines': ['ENABLE_APP_LIST=1'],
2198       }],
2199       ['enable_settings_app==1', {
2200         'defines': ['ENABLE_SETTINGS_APP=1'],
2201       }],
2202       ['disable_ftp_support==1', {
2203         'defines': ['DISABLE_FTP_SUPPORT=1'],
2204       }],
2205       ['enable_managed_users==1', {
2206         'defines': ['ENABLE_MANAGED_USERS=1'],
2207       }],
2208       ['spdy_proxy_auth_origin != ""', {
2209         'defines': ['SPDY_PROXY_AUTH_ORIGIN="<(spdy_proxy_auth_origin)"'],
2210       }],
2211       ['spdy_proxy_auth_property != ""', {
2212         'defines': ['SPDY_PROXY_AUTH_PROPERTY="<(spdy_proxy_auth_property)"'],
2213       }],
2214       ['spdy_proxy_auth_value != ""', {
2215         'defines': ['SPDY_PROXY_AUTH_VALUE="<(spdy_proxy_auth_value)"'],
2216       }],
2217       ['enable_mdns==1', {
2218         'defines': ['ENABLE_MDNS=1'],
2219       }]
2220     ],  # conditions for 'target_defaults'
2221     'target_conditions': [
2222       ['enable_wexit_time_destructors==1', {
2223         'conditions': [
2224           [ 'clang==1', {
2225             'cflags': [
2226               '-Wexit-time-destructors',
2227             ],
2228             'xcode_settings': {
2229               'WARNING_CFLAGS': [
2230                 '-Wexit-time-destructors',
2231               ],
2232             },
2233           }],
2234         ],
2235       }],
2236       ['chromium_code==0', {
2237         'conditions': [
2238           [ 'os_posix==1 and OS!="mac" and OS!="ios"', {
2239             # We don't want to get warnings from third-party code,
2240             # so remove any existing warning-enabling flags like -Wall.
2241             'cflags!': [
2242               '-Wall',
2243               '-Wextra',
2244             ],
2245             'cflags_cc': [
2246               # Don't warn about hash_map in third-party code.
2247               '-Wno-deprecated',
2248             ],
2249             'cflags': [
2250               # Don't warn about printf format problems.
2251               # This is off by default in gcc but on in Ubuntu's gcc(!).
2252               '-Wno-format',
2253             ],
2254             'cflags_cc!': [
2255               # TODO(fischman): remove this.
2256               # http://code.google.com/p/chromium/issues/detail?id=90453
2257               '-Wsign-compare',
2258             ]
2259           }],
2260           # TODO: Fix all warnings on chromeos too.
2261           [ 'os_posix==1 and OS!="mac" and OS!="ios" and (clang!=1 or chromeos==1)', {
2262             'cflags!': [
2263               '-Werror',
2264             ],
2265           }],
2266           [ 'os_posix==1 and os_bsd!=1 and OS!="mac" and OS!="android"', {
2267             'cflags': [
2268               # Don't warn about ignoring the return value from e.g. close().
2269               # This is off by default in some gccs but on by default in others.
2270               # BSD systems do not support this option, since they are usually
2271               # using gcc 4.2.1, which does not have this flag yet.
2272               '-Wno-unused-result',
2273             ],
2274           }],
2275           [ 'OS=="win"', {
2276             'defines': [
2277               '_CRT_SECURE_NO_DEPRECATE',
2278               '_CRT_NONSTDC_NO_WARNINGS',
2279               '_CRT_NONSTDC_NO_DEPRECATE',
2280               '_SCL_SECURE_NO_DEPRECATE',
2281             ],
2282             'msvs_disabled_warnings': [4800],
2283             'msvs_settings': {
2284               'VCCLCompilerTool': {
2285                 'WarningLevel': '3',
2286                 'WarnAsError': '<(win_third_party_warn_as_error)',
2287                 'Detect64BitPortabilityProblems': 'false',
2288               },
2289             },
2290             'conditions': [
2291               ['buildtype=="Official"', {
2292                 'msvs_settings': {
2293                   'VCCLCompilerTool': { 'WarnAsError': 'false' },
2294                 }
2295               }],
2296             ],
2297           }],
2298           # TODO(darin): Unfortunately, some third_party code depends on base.
2299           [ 'OS=="win" and component=="shared_library"', {
2300             'msvs_disabled_warnings': [
2301               4251,  # class 'std::xx' needs to have dll-interface.
2302             ],
2303           }],
2304           [ 'OS=="mac" or OS=="ios"', {
2305             'xcode_settings': {
2306               'WARNING_CFLAGS!': ['-Wall', '-Wextra'],
2307             },
2308             'conditions': [
2309               ['buildtype=="Official"', {
2310                 'xcode_settings': {
2311                   'GCC_TREAT_WARNINGS_AS_ERRORS': 'NO',    # -Werror
2312                 },
2313               }],
2314             ],
2315           }],
2316           [ 'OS=="ios"', {
2317             'xcode_settings': {
2318               # TODO(ios): Fix remaining warnings in third-party code, then
2319               # remove this; the Mac cleanup didn't get everything that's
2320               # flagged in an iOS build.
2321               'GCC_TREAT_WARNINGS_AS_ERRORS': 'NO',
2322               'RUN_CLANG_STATIC_ANALYZER': 'NO',
2323             },
2324           }],
2325         ],
2326       }, {
2327         'includes': [
2328            # Rules for excluding e.g. foo_win.cc from the build on non-Windows.
2329           'filename_rules.gypi',
2330         ],
2331         # In Chromium code, we define __STDC_foo_MACROS in order to get the
2332         # C99 macros on Mac and Linux.
2333         'defines': [
2334           '__STDC_CONSTANT_MACROS',
2335           '__STDC_FORMAT_MACROS',
2336         ],
2337         'conditions': [
2338           ['OS=="win"', {
2339             # turn on warnings for signed/unsigned mismatch on chromium code.
2340             'msvs_settings': {
2341               'VCCLCompilerTool': {
2342                 'AdditionalOptions': ['/we4389'],
2343               },
2344             },
2345           }],
2346           ['OS=="win" and component=="shared_library"', {
2347             'msvs_disabled_warnings': [
2348               4251,  # class 'std::xx' needs to have dll-interface.
2349             ],
2350           }],
2351         ],
2352       }],
2353     ],  # target_conditions for 'target_defaults'
2354     'default_configuration': 'Debug',
2355     'configurations': {
2356       # VCLinkerTool LinkIncremental values below:
2357       #   0 == default
2358       #   1 == /INCREMENTAL:NO
2359       #   2 == /INCREMENTAL
2360       # Debug links incremental, Release does not.
2361       #
2362       # Abstract base configurations to cover common attributes.
2363       #
2364       'Common_Base': {
2365         'abstract': 1,
2366         'msvs_configuration_attributes': {
2367           'OutputDirectory': '<(DEPTH)\\build\\<(build_dir_prefix)$(ConfigurationName)',
2368           'IntermediateDirectory': '$(OutDir)\\obj\\$(ProjectName)',
2369           'CharacterSet': '1',
2370         },
2371         # Add the default import libs.
2372         'msvs_settings':{
2373           'VCLinkerTool': {
2374             'AdditionalDependencies': [
2375               'kernel32.lib',
2376               'gdi32.lib',
2377               'winspool.lib',
2378               'comdlg32.lib',
2379               'advapi32.lib',
2380               'shell32.lib',
2381               'ole32.lib',
2382               'oleaut32.lib',
2383               'user32.lib',
2384               'uuid.lib',
2385               'odbc32.lib',
2386               'odbccp32.lib',
2387               'delayimp.lib',
2388             ],
2389           },
2390         },
2391       },
2392       'x86_Base': {
2393         'abstract': 1,
2394         'msvs_settings': {
2395           'VCLinkerTool': {
2396             'TargetMachine': '1',
2397           },
2398         },
2399         'msvs_configuration_platform': 'Win32',
2400       },
2401       'x64_Base': {
2402         'abstract': 1,
2403         'msvs_configuration_platform': 'x64',
2404         'msvs_settings': {
2405           'VCLinkerTool': {
2406             'TargetMachine': '17', # x86 - 64
2407             'AdditionalLibraryDirectories!':
2408               ['<(windows_sdk_path)/Lib/win8/um/x86'],
2409             'AdditionalLibraryDirectories':
2410               ['<(windows_sdk_path)/Lib/win8/um/x64'],
2411             # Doesn't exist x64 SDK. Should use oleaut32 in any case.
2412             'IgnoreDefaultLibraryNames': [ 'olepro32.lib' ],
2413           },
2414           'VCLibrarianTool': {
2415             'AdditionalLibraryDirectories!':
2416               ['<(windows_sdk_path)/Lib/win8/um/x86'],
2417             'AdditionalLibraryDirectories':
2418               ['<(windows_sdk_path)/Lib/win8/um/x64'],
2419           },
2420         },
2421       },
2422       'Debug_Base': {
2423         'abstract': 1,
2424         'defines': [
2425           'DYNAMIC_ANNOTATIONS_ENABLED=1',
2426           'WTF_USE_DYNAMIC_ANNOTATIONS=1',
2427         ],
2428         'xcode_settings': {
2429           'COPY_PHASE_STRIP': 'NO',
2430           'GCC_OPTIMIZATION_LEVEL': '<(mac_debug_optimization)',
2431           'OTHER_CFLAGS': [
2432             '<@(debug_extra_cflags)',
2433           ],
2434         },
2435         'msvs_settings': {
2436           'VCCLCompilerTool': {
2437             'Optimization': '<(win_debug_Optimization)',
2438             'PreprocessorDefinitions': ['_DEBUG'],
2439             'BasicRuntimeChecks': '<(win_debug_RuntimeChecks)',
2440             'RuntimeLibrary': '<(win_debug_RuntimeLibrary)',
2441             'conditions': [
2442               # According to MSVS, InlineFunctionExpansion=0 means
2443               # "default inlining", not "/Ob0".
2444               # Thus, we have to handle InlineFunctionExpansion==0 separately.
2445               ['win_debug_InlineFunctionExpansion==0', {
2446                 'AdditionalOptions': ['/Ob0'],
2447               }],
2448               ['win_debug_InlineFunctionExpansion!=""', {
2449                 'InlineFunctionExpansion':
2450                   '<(win_debug_InlineFunctionExpansion)',
2451               }],
2452               ['win_debug_disable_iterator_debugging==1', {
2453                 'PreprocessorDefinitions': ['_HAS_ITERATOR_DEBUGGING=0'],
2454               }],
2456               # if win_debug_OmitFramePointers is blank, leave as default
2457               ['win_debug_OmitFramePointers==1', {
2458                 'OmitFramePointers': 'true',
2459               }],
2460               ['win_debug_OmitFramePointers==0', {
2461                 'OmitFramePointers': 'false',
2462                 # The above is not sufficient (http://crbug.com/106711): it
2463                 # simply eliminates an explicit "/Oy", but both /O2 and /Ox
2464                 # perform FPO regardless, so we must explicitly disable.
2465                 # We still want the false setting above to avoid having
2466                 # "/Oy /Oy-" and warnings about overriding.
2467                 'AdditionalOptions': ['/Oy-'],
2468               }],
2469             ],
2470             'AdditionalOptions': [ '<@(win_debug_extra_cflags)', ],
2471           },
2472           'VCLinkerTool': {
2473             'LinkIncremental': '<(msvs_debug_link_incremental)',
2474             # ASLR makes debugging with windbg difficult because Chrome.exe and
2475             # Chrome.dll share the same base name. As result, windbg will
2476             # name the Chrome.dll module like chrome_<base address>, where
2477             # <base address> typically changes with each launch. This in turn
2478             # means that breakpoints in Chrome.dll don't stick from one launch
2479             # to the next. For this reason, we turn ASLR off in debug builds.
2480             # Note that this is a three-way bool, where 0 means to pick up
2481             # the default setting, 1 is off and 2 is on.
2482             'RandomizedBaseAddress': 1,
2483           },
2484           'VCResourceCompilerTool': {
2485             'PreprocessorDefinitions': ['_DEBUG'],
2486           },
2487         },
2488         'conditions': [
2489           ['OS=="linux" or OS=="android"', {
2490             'target_conditions': [
2491               ['_toolset=="target"', {
2492                 'cflags': [
2493                   '<@(debug_extra_cflags)',
2494                 ],
2495               }],
2496             ],
2497           }],
2498           # Disabled on iOS because it was causing a crash on startup.
2499           # TODO(michelea): investigate, create a reduced test and possibly
2500           # submit a radar.
2501           ['release_valgrind_build==0 and OS!="ios"', {
2502             'xcode_settings': {
2503               'OTHER_CFLAGS': [
2504                 '-fstack-protector-all',  # Implies -fstack-protector
2505               ],
2506             },
2507           }],
2508         ],
2509       },
2510       'Release_Base': {
2511         'abstract': 1,
2512         'defines': [
2513           'NDEBUG',
2514         ],
2515         'xcode_settings': {
2516           'DEAD_CODE_STRIPPING': 'YES',  # -Wl,-dead_strip
2517           'GCC_OPTIMIZATION_LEVEL': '<(mac_release_optimization)',
2518           'OTHER_CFLAGS': [ '<@(release_extra_cflags)', ],
2519         },
2520         'msvs_settings': {
2521           'VCCLCompilerTool': {
2522             'RuntimeLibrary': '<(win_release_RuntimeLibrary)',
2523             'conditions': [
2524               # In official builds, each target will self-select
2525               # an optimization level.
2526               ['buildtype!="Official"', {
2527                   'Optimization': '<(win_release_Optimization)',
2528                 },
2529               ],
2530               # According to MSVS, InlineFunctionExpansion=0 means
2531               # "default inlining", not "/Ob0".
2532               # Thus, we have to handle InlineFunctionExpansion==0 separately.
2533               ['win_release_InlineFunctionExpansion==0', {
2534                 'AdditionalOptions': ['/Ob0'],
2535               }],
2536               ['win_release_InlineFunctionExpansion!=""', {
2537                 'InlineFunctionExpansion':
2538                   '<(win_release_InlineFunctionExpansion)',
2539               }],
2541               # if win_release_OmitFramePointers is blank, leave as default
2542               ['win_release_OmitFramePointers==1', {
2543                 'OmitFramePointers': 'true',
2544               }],
2545               ['win_release_OmitFramePointers==0', {
2546                 'OmitFramePointers': 'false',
2547                 # The above is not sufficient (http://crbug.com/106711): it
2548                 # simply eliminates an explicit "/Oy", but both /O2 and /Ox
2549                 # perform FPO regardless, so we must explicitly disable.
2550                 # We still want the false setting above to avoid having
2551                 # "/Oy /Oy-" and warnings about overriding.
2552                 'AdditionalOptions': ['/Oy-'],
2553               }],
2554             ],
2555             'AdditionalOptions': [ '<@(win_release_extra_cflags)', ],
2556           },
2557           'VCLinkerTool': {
2558             # LinkIncremental is a tri-state boolean, where 0 means default
2559             # (i.e., inherit from parent solution), 1 means false, and
2560             # 2 means true.
2561             'LinkIncremental': '1',
2562             # This corresponds to the /PROFILE flag which ensures the PDB
2563             # file contains FIXUP information (growing the PDB file by about
2564             # 5%) but does not otherwise alter the output binary. This
2565             # information is used by the Syzygy optimization tool when
2566             # decomposing the release image.
2567             'Profile': 'true',
2568           },
2569         },
2570         'conditions': [
2571           ['msvs_use_common_release', {
2572             'includes': ['release.gypi'],
2573           }],
2574           ['release_valgrind_build==0 and tsan==0', {
2575             'defines': [
2576               'NVALGRIND',
2577               'DYNAMIC_ANNOTATIONS_ENABLED=0',
2578             ],
2579           }, {
2580             'defines': [
2581               'DYNAMIC_ANNOTATIONS_ENABLED=1',
2582               'WTF_USE_DYNAMIC_ANNOTATIONS=1',
2583             ],
2584           }],
2585           ['win_use_allocator_shim==0', {
2586             'defines': ['NO_TCMALLOC'],
2587           }],
2588           ['os_posix==1 and chromium_code==1', {
2589             # Non-chromium code is not guaranteed to compile cleanly
2590             # with _FORTIFY_SOURCE. Also, fortified build may fail
2591             # when optimizations are disabled, so only do that for Release
2592             # build.
2593             'defines': [
2594               '_FORTIFY_SOURCE=2',
2595             ],
2596           }],
2597           ['OS=="linux" or OS=="android"', {
2598             'target_conditions': [
2599               ['_toolset=="target"', {
2600                 'cflags': [
2601                   '<@(release_extra_cflags)',
2602                 ],
2603               }],
2604             ],
2605           }],
2606           ['OS=="ios"', {
2607             'defines': [
2608               'NS_BLOCK_ASSERTIONS=1',
2609             ],
2610           }],
2611         ],
2612       },
2613       #
2614       # Concrete configurations
2615       #
2616       'Debug': {
2617         'inherit_from': ['Common_Base', 'x86_Base', 'Debug_Base'],
2618       },
2619       'Release': {
2620         'inherit_from': ['Common_Base', 'x86_Base', 'Release_Base'],
2621       },
2622       'conditions': [
2623         [ 'OS=="win"', {
2624           # TODO(bradnelson): add a gyp mechanism to make this more graceful.
2625           'Debug_x64': {
2626             'inherit_from': ['Common_Base', 'x64_Base', 'Debug_Base'],
2627           },
2628           'Release_x64': {
2629             'inherit_from': ['Common_Base', 'x64_Base', 'Release_Base'],
2630           },
2631         }],
2632       ],
2633     },
2634   },
2635   'conditions': [
2636     ['os_posix==1', {
2637       'target_defaults': {
2638         'ldflags': [
2639           '-Wl,-z,now',
2640           '-Wl,-z,relro',
2641         ],
2642       },
2643     }],
2644     ['os_posix==1 and chromeos==0', {
2645       # Chrome OS enables -fstack-protector-strong via its build wrapper,
2646       # and we want to avoid overriding this, so stack-protector is only
2647       # enabled when not building on Chrome OS.
2648       # TODO(phajdan.jr): Use -fstack-protector-strong when our gcc
2649       # supports it.
2650       'target_defaults': {
2651         'cflags': [
2652           '-fstack-protector',
2653           '--param=ssp-buffer-size=4',
2654         ],
2655       },
2656     }],
2657     ['os_posix==1 and OS!="mac" and OS!="ios"', {
2658       'target_defaults': {
2659         # Enable -Werror by default, but put it in a variable so it can
2660         # be disabled in ~/.gyp/include.gypi on the valgrind builders.
2661         'variables': {
2662           'werror%': '-Werror',
2663           'libraries_for_target%': '',
2664         },
2665         'defines': [
2666           '_FILE_OFFSET_BITS=64',
2667         ],
2668         'cflags': [
2669           '<(werror)',  # See note above about the werror variable.
2670           '-pthread',
2671           '-fno-exceptions',
2672           '-fno-strict-aliasing',  # See http://crbug.com/32204
2673           '-Wall',
2674           # TODO(evan): turn this back on once all the builds work.
2675           # '-Wextra',
2676           # Don't warn about unused function params.  We use those everywhere.
2677           '-Wno-unused-parameter',
2678           # Don't warn about the "struct foo f = {0};" initialization pattern.
2679           '-Wno-missing-field-initializers',
2680           # Don't export any symbols (for example, to plugins we dlopen()).
2681           # Note: this is *required* to make some plugins work.
2682           '-fvisibility=hidden',
2683           '-pipe',
2684         ],
2685         'cflags_cc': [
2686           '-fno-rtti',
2687           '-fno-threadsafe-statics',
2688           # Make inline functions have hidden visiblity by default.
2689           # Surprisingly, not covered by -fvisibility=hidden.
2690           '-fvisibility-inlines-hidden',
2691           # GCC turns on -Wsign-compare for C++ under -Wall, but clang doesn't,
2692           # so we specify it explicitly.
2693           # TODO(fischman): remove this if http://llvm.org/PR10448 obsoletes it.
2694           # http://code.google.com/p/chromium/issues/detail?id=90453
2695           '-Wsign-compare',
2696         ],
2697         'ldflags': [
2698           '-pthread', '-Wl,-z,noexecstack',
2699         ],
2700         'libraries' : [
2701           '<(libraries_for_target)',
2702         ],
2703         'configurations': {
2704           'Debug_Base': {
2705             'variables': {
2706               'debug_optimize%': '0',
2707             },
2708             'defines': [
2709               '_DEBUG',
2710             ],
2711             'cflags': [
2712               '-O>(debug_optimize)',
2713               '-g',
2714             ],
2715             'conditions' : [
2716               ['OS=="android"', {
2717                 # Only link with needed input sections. This is to avoid getting
2718                 # undefined reference to __cxa_bad_typeid in the CDU library.
2719                 'ldflags': [
2720                   '-Wl,--gc-sections',
2721                 ],
2722               }],
2723               ['OS=="android" and android_full_debug==0', {
2724                 # Some configurations are copied from Release_Base to reduce
2725                 # the binary size.
2726                 'variables': {
2727                   'debug_optimize%': 's',
2728                 },
2729                 'cflags': [
2730                   '-fomit-frame-pointer',
2731                   '-fdata-sections',
2732                   '-ffunction-sections',
2733                 ],
2734                 'ldflags': [
2735                   '-Wl,-O1',
2736                   '-Wl,--as-needed',
2737                 ],
2738               }],
2739               ['OS=="linux" and target_arch=="ia32"', {
2740                 'ldflags': [
2741                   '-Wl,--no-as-needed',
2742                 ],
2743               }],
2744             ],
2745           },
2746           'Release_Base': {
2747             'variables': {
2748               'release_optimize%': '2',
2749               # Binaries become big and gold is unable to perform GC
2750               # and remove unused sections for some of test targets
2751               # on 32 bit platform.
2752               # (This is currently observed only in chromeos valgrind bots)
2753               # The following flag is to disable --gc-sections linker
2754               # option for these bots.
2755               'no_gc_sections%': 0,
2757               # TODO(bradnelson): reexamine how this is done if we change the
2758               # expansion of configurations
2759               'release_valgrind_build%': 0,
2760             },
2761             'cflags': [
2762               '-O<(release_optimize)',
2763               # Don't emit the GCC version ident directives, they just end up
2764               # in the .comment section taking up binary size.
2765               '-fno-ident',
2766               # Put data and code in their own sections, so that unused symbols
2767               # can be removed at link time with --gc-sections.
2768               '-fdata-sections',
2769               '-ffunction-sections',
2770             ],
2771             'ldflags': [
2772               # Specifically tell the linker to perform optimizations.
2773               # See http://lwn.net/Articles/192624/ .
2774               '-Wl,-O1',
2775               '-Wl,--as-needed',
2776             ],
2777             'conditions' : [
2778               ['no_gc_sections==0', {
2779                 'ldflags': [
2780                   '-Wl,--gc-sections',
2781                 ],
2782               }],
2783               ['OS=="android"', {
2784                 'variables': {
2785                   'release_optimize%': 's',
2786                 },
2787                 'cflags': [
2788                   '-fomit-frame-pointer',
2789                 ],
2790               }],
2791               ['clang==1', {
2792                 'cflags!': [
2793                   '-fno-ident',
2794                 ],
2795               }],
2796               ['profiling==1', {
2797                 'cflags': [
2798                   '-fno-omit-frame-pointer',
2799                   '-g',
2800                 ],
2801               }],
2802               # Can be omitted to reduce output size. Does not seem to affect
2803               # crash reporting.
2804               ['target_arch=="ia32"', {
2805                 'cflags': [
2806                   '-fno-unwind-tables',
2807                   '-fno-asynchronous-unwind-tables',
2808                 ],
2809               }],
2810             ],
2811           },
2812         },
2813         'variants': {
2814           'coverage': {
2815             'cflags': ['-fprofile-arcs', '-ftest-coverage'],
2816             'ldflags': ['-fprofile-arcs'],
2817           },
2818           'profile': {
2819             'cflags': ['-pg', '-g'],
2820             'ldflags': ['-pg'],
2821           },
2822           'symbols': {
2823             'cflags': ['-g'],
2824           },
2825         },
2826         'conditions': [
2827           ['target_arch=="ia32"', {
2828             'target_conditions': [
2829               ['_toolset=="target"', {
2830                 'asflags': [
2831                   # Needed so that libs with .s files (e.g. libicudata.a)
2832                   # are compatible with the general 32-bit-ness.
2833                   '-32',
2834                 ],
2835                 # All floating-point computations on x87 happens in 80-bit
2836                 # precision.  Because the C and C++ language standards allow
2837                 # the compiler to keep the floating-point values in higher
2838                 # precision than what's specified in the source and doing so
2839                 # is more efficient than constantly rounding up to 64-bit or
2840                 # 32-bit precision as specified in the source, the compiler,
2841                 # especially in the optimized mode, tries very hard to keep
2842                 # values in x87 floating-point stack (in 80-bit precision)
2843                 # as long as possible. This has important side effects, that
2844                 # the real value used in computation may change depending on
2845                 # how the compiler did the optimization - that is, the value
2846                 # kept in 80-bit is different than the value rounded down to
2847                 # 64-bit or 32-bit. There are possible compiler options to
2848                 # make this behavior consistent (e.g. -ffloat-store would keep
2849                 # all floating-values in the memory, thus force them to be
2850                 # rounded to its original precision) but they have significant
2851                 # runtime performance penalty.
2852                 #
2853                 # -mfpmath=sse -msse2 makes the compiler use SSE instructions
2854                 # which keep floating-point values in SSE registers in its
2855                 # native precision (32-bit for single precision, and 64-bit
2856                 # for double precision values). This means the floating-point
2857                 # value used during computation does not change depending on
2858                 # how the compiler optimized the code, since the value is
2859                 # always kept in its specified precision.
2860                 'conditions': [
2861                   ['branding=="Chromium" and disable_sse2==0', {
2862                     'cflags': [
2863                       '-march=pentium4',
2864                       '-msse2',
2865                       '-mfpmath=sse',
2866                     ],
2867                   }],
2868                   # ChromeOS targets Pinetrail, which is sse3, but most of the
2869                   # benefit comes from sse2 so this setting allows ChromeOS
2870                   # to build on other CPUs.  In the future -march=atom would
2871                   # help but requires a newer compiler.
2872                   ['chromeos==1 and disable_sse2==0', {
2873                     'cflags': [
2874                       '-msse2',
2875                     ],
2876                   }],
2877                   # Use gold linker for Android ia32 target.
2878                   ['OS=="android"', {
2879                     'cflags': [
2880                       '-fuse-ld=gold',
2881                     ],
2882                     'ldflags': [
2883                       '-fuse-ld=gold',
2884                     ],
2885                   }],
2886                   # Install packages have started cropping up with
2887                   # different headers between the 32-bit and 64-bit
2888                   # versions, so we have to shadow those differences off
2889                   # and make sure a 32-bit-on-64-bit build picks up the
2890                   # right files.
2891                   # For android build, use NDK headers instead of host headers
2892                   ['host_arch!="ia32" and OS!="android"', {
2893                     'include_dirs+': [
2894                       '/usr/include32',
2895                     ],
2896                   }],
2897                 ],
2898                 # -mmmx allows mmintrin.h to be used for mmx intrinsics.
2899                 # video playback is mmx and sse2 optimized.
2900                 'cflags': [
2901                   '-m32',
2902                   '-mmmx',
2903                 ],
2904                 'ldflags': [
2905                   '-m32',
2906                 ],
2907               }],
2908             ],
2909           }],
2910           ['target_arch=="arm"', {
2911             'target_conditions': [
2912               ['_toolset=="target"', {
2913                 'cflags_cc': [
2914                   # The codesourcery arm-2009q3 toolchain warns at that the ABI
2915                   # has changed whenever it encounters a varargs function. This
2916                   # silences those warnings, as they are not helpful and
2917                   # clutter legitimate warnings.
2918                   '-Wno-abi',
2919                 ],
2920                 'conditions': [
2921                   ['arm_arch!=""', {
2922                     'cflags': [
2923                       '-march=<(arm_arch)',
2924                     ],
2925                   }],
2926                   ['arm_tune!=""', {
2927                     'cflags': [
2928                       '-mtune=<(arm_tune)',
2929                     ],
2930                   }],
2931                   ['arm_fpu!=""', {
2932                     'cflags': [
2933                       '-mfpu=<(arm_fpu)',
2934                     ],
2935                   }],
2936                   ['arm_float_abi!=""', {
2937                     'cflags': [
2938                       '-mfloat-abi=<(arm_float_abi)',
2939                     ],
2940                   }],
2941                   ['arm_thumb==1', {
2942                     'cflags': [
2943                     '-mthumb',
2944                     ]
2945                   }],
2946                   ['OS=="android"', {
2947                     # Most of the following flags are derived from what Android
2948                     # uses by default when building for arm, reference for which
2949                     # can be found in the following file in the Android NDK:
2950                     # toolchains/arm-linux-androideabi-4.4.3/setup.mk
2951                     'cflags': [
2952                       # The tree-sra optimization (scalar replacement for
2953                       # aggregates enabling subsequent optimizations) leads to
2954                       # invalid code generation when using the Android NDK's
2955                       # compiler (r5-r7). This can be verified using
2956                       # webkit_unit_tests' WTF.Checked_int8_t test.
2957                       '-fno-tree-sra',
2958                       '-fuse-ld=gold',
2959                       '-Wno-psabi',
2960                     ],
2961                     # Android now supports .relro sections properly.
2962                     # NOTE: While these flags enable the generation of .relro
2963                     # sections, the generated libraries can still be loaded on
2964                     # older Android platform versions.
2965                     'ldflags': [
2966                         '-Wl,-z,relro',
2967                         '-Wl,-z,now',
2968                         '-fuse-ld=gold',
2969                     ],
2970                     'conditions': [
2971                       ['arm_thumb==1', {
2972                         'cflags': [ '-mthumb-interwork' ],
2973                       }],
2974                       ['profiling==1', {
2975                         'cflags': [
2976                           '-marm', # Probably reduntant, but recommend by "perf" docs.
2977                           '-mapcs-frame', # Seems required by -fno-omit-frame-pointer.
2978                         ],
2979                       }],
2980                       ['clang==1', {
2981                         'cflags!': [
2982                           # Clang does not support the following options.
2983                           '-mthumb-interwork',
2984                           '-finline-limit=64',
2985                           '-fno-tree-sra',
2986                           '-fuse-ld=gold',
2987                           '-Wno-psabi',
2988                         ],
2989                       }],
2990                     ],
2991                   }],
2992                 ],
2993               }],
2994             ],
2995           }],
2996           ['target_arch=="mipsel"', {
2997             'target_conditions': [
2998               ['_toolset=="target"', {
2999                 'conditions': [
3000                   ['mips_arch_variant=="mips32r2"', {
3001                     'cflags': ['-mips32r2', '-Wa,-mips32r2'],
3002                   }, {
3003                     'cflags': ['-mips32', '-Wa,-mips32'],
3004                   }],
3005                 ],
3006                 'cflags': [
3007                   '-EL',
3008                   '-mhard-float',
3009                 ],
3010                 'ldflags': [
3011                   '-EL',
3012                   '-Wl,--no-keep-memory'
3013                 ],
3014                 'cflags_cc': [
3015                   '-Wno-uninitialized',
3016                 ],
3017               }],
3018             ],
3019           }],
3020           ['linux_fpic==1', {
3021             'cflags': [
3022               '-fPIC',
3023             ],
3024             'ldflags': [
3025               '-fPIC',
3026             ],
3027           }],
3028           ['sysroot!=""', {
3029             'target_conditions': [
3030               ['_toolset=="target"', {
3031                 'cflags': [
3032                   '--sysroot=<(sysroot)',
3033                 ],
3034                 'ldflags': [
3035                   '--sysroot=<(sysroot)',
3036                   '<!(<(DEPTH)/build/linux/sysroot_ld_path.sh <(sysroot))',
3037                 ],
3038               }]]
3039           }],
3040           ['clang==1', {
3041             'cflags': [
3042               '-Wheader-hygiene',
3044               # Don't die on dtoa code that uses a char as an array index.
3045               '-Wno-char-subscripts',
3047               # Clang spots more unused functions.
3048               '-Wno-unused-function',
3050               # Warns on switches on enums that cover all enum values but
3051               # also contain a default: branch. Chrome is full of that.
3052               '-Wno-covered-switch-default',
3054               # Warns when a const char[] is converted to bool.
3055               '-Wstring-conversion',
3056             ],
3057             'cflags!': [
3058               # Clang doesn't seem to know know this flag.
3059               '-mfpmath=sse',
3060             ],
3061           }],
3062           ['clang==1 and (OS!="android" and chromeos!=1)', {
3063             # Turn on C++11.
3064             'cflags': [
3065               # This warns on using ints as initializers for floats in
3066               # initializer lists (e.g. |int a = f(); CGSize s = { a, a };|),
3067               # which happens in several places in chrome code. Not sure if
3068               # this is worth fixing.
3069               '-Wno-c++11-narrowing',
3071               # This warns about code like |"0x%08"NACL_PRIxPTR| -- with C++11
3072               # user-defined literals, this is now a string literal with a UD
3073               # suffix. However, this is used heavily in NaCl code, so disable
3074               # the warning for now.
3075               '-Wno-reserved-user-defined-literal',
3076             ],
3077             'cflags_cc': [
3078               # See the comment in the Mac section for what it takes to move
3079               # this to -std=c++11.
3080               '-std=gnu++11',
3081             ],
3082           }],
3083           ['clang==1 and (OS=="android" or chromeos==1)', {
3084             # Android uses gcc4.4, and clang isn't compatible with gcc4.4's
3085             # libstdc++ in C++11 mode. So no C++11 mode for Android yet.
3086             # Doesn't work with asan for some reason either: crbug.com/233464
3087             'cflags': [
3088               # Especially needed for gtest macros using enum values from Mac
3089               # system headers.
3090               # TODO(pkasting): In C++11 this is legal, so this should be
3091               # removed when we change to that.  (This is also why we don't
3092               # bother fixing all these cases today.)
3093               '-Wno-unnamed-type-template-args',
3094               # This (rightfully) complains about 'override', which we use
3095               # heavily.
3096               '-Wno-c++11-extensions',
3097             ],
3098           }],
3099           ['clang==1 and clang_use_chrome_plugins==1', {
3100             'cflags': [
3101               '<@(clang_chrome_plugins_flags)',
3102             ],
3103           }],
3104           ['clang==1 and clang_load!=""', {
3105             'cflags': [
3106               '-Xclang', '-load', '-Xclang', '<(clang_load)',
3107             ],
3108           }],
3109           ['clang==1 and clang_add_plugin!=""', {
3110             'cflags': [
3111               '-Xclang', '-add-plugin', '-Xclang', '<(clang_add_plugin)',
3112             ],
3113           }],
3114           ['clang==1 and target_arch=="ia32"', {
3115             'cflags': [
3116               # Else building libyuv gives clang's register allocator issues,
3117               # see llvm.org/PR15798 / crbug.com/233709
3118               '-momit-leaf-frame-pointer',
3119             ],
3120           }],
3121           ['clang==1 and "<(GENERATOR)"=="ninja"', {
3122             'cflags': [
3123               # See http://crbug.com/110262
3124               '-fcolor-diagnostics',
3125             ],
3126           }],
3127           # Common options for AddressSanitizer, ThreadSanitizer and
3128           # MemorySanitizer.
3129           ['asan==1 or tsan==1 or msan==1', {
3130             'target_conditions': [
3131               ['_toolset=="target"', {
3132                 'cflags': [
3133                   '-fno-omit-frame-pointer',
3134                   '-gline-tables-only',
3135                 ],
3136                 'ldflags!': [
3137                   # Functions interposed by the sanitizers can make ld think
3138                   # that some libraries aren't needed when they actually are,
3139                   # http://crbug.com/234010. As workaround, disable --as-needed.
3140                   '-Wl,--as-needed',
3141                 ],
3142               }],
3143               ['_toolset=="target" and OS=="linux"', {
3144                 'ldflags': [
3145                   # http://crbug.com/234010.
3146                   '-lrt',
3147                 ],
3148               }],
3149             ],
3150           }],
3151           ['asan==1', {
3152             'target_conditions': [
3153               ['_toolset=="target"', {
3154                 'cflags': [
3155                   '-fsanitize=address',
3156                   '-w',  # http://crbug.com/162783
3157                 ],
3158                 'ldflags': [
3159                   '-fsanitize=address',
3160                 ],
3161                 'defines': [
3162                   'ADDRESS_SANITIZER',
3163                 ],
3164               }],
3165             ],
3166             'conditions': [
3167               ['OS=="mac"', {
3168                 'cflags': [
3169                   '-mllvm -asan-globals=0',  # http://crbug.com/196561
3170                 ],
3171               }],
3172             ],
3173           }],
3174           ['tsan==1', {
3175             'target_conditions': [
3176               ['_toolset=="target"', {
3177                 'cflags': [
3178                   '-fsanitize=thread',
3179                   '-fPIC',
3180                   '-mllvm', '-tsan-blacklist=<(tsan_blacklist)',
3181                 ],
3182                 'ldflags': [
3183                   '-fsanitize=thread',
3184                 ],
3185                 'defines': [
3186                   'THREAD_SANITIZER',
3187                   'DYNAMIC_ANNOTATIONS_EXTERNAL_IMPL=1',
3188                   'WTF_USE_DYNAMIC_ANNOTATIONS_NOIMPL=1',
3189                 ],
3190                 'target_conditions': [
3191                   ['_type=="executable"', {
3192                     'ldflags': [
3193                       '-pie',
3194                     ],
3195                   }],
3196                 ],
3197               }],
3198             ],
3199           }],
3200           ['msan==1', {
3201             'target_conditions': [
3202               ['_toolset=="target"', {
3203                 'cflags': [
3204                   '-fsanitize=memory',
3205                   '-fsanitize-memory-track-origins',
3206                   '-fPIC',
3207                 ],
3208                 'ldflags': [
3209                   '-fsanitize=memory',
3210                 ],
3211                 'defines': [
3212                   'MEMORY_SANITIZER',
3213                 ],
3214                 'target_conditions': [
3215                   ['_type=="executable"', {
3216                     'ldflags': [
3217                       '-pie',
3218                     ],
3219                   }],
3220                 ],
3221               }],
3222             ],
3223           }],
3224           ['order_profiling!=0 and (chromeos==1 or OS=="linux" or OS=="android")', {
3225             'target_conditions' : [
3226               ['_toolset=="target"', {
3227                 'cflags': [
3228                   '-finstrument-functions',
3229                   # Allow mmx intrinsics to inline, so that the
3230                   # compiler can expand the intrinsics.
3231                   '-finstrument-functions-exclude-file-list=mmintrin.h',
3232                 ],
3233               }],
3234             ],
3235           }],
3236           ['linux_breakpad==1', {
3237             'defines': ['USE_LINUX_BREAKPAD'],
3238           }],
3239           ['linux_dump_symbols==1', {
3240             'cflags': [ '-g' ],
3241             'conditions': [
3242               ['target_arch=="ia32" and OS!="android"', {
3243                 'target_conditions': [
3244                   ['_toolset=="target"', {
3245                     'ldflags': [
3246                       # Workaround for linker OOM.
3247                       '-Wl,--no-keep-memory',
3248                     ],
3249                   }],
3250                 ],
3251               }],
3252             ],
3253           }],
3254           ['linux_use_heapchecker==1', {
3255             'variables': {'linux_use_tcmalloc%': 1},
3256             'defines': ['USE_HEAPCHECKER'],
3257             'conditions': [
3258               ['component=="shared_library"', {
3259                 # See crbug.com/112389
3260                 # TODO(glider): replace with --dynamic-list or something
3261                 'ldflags': ['-rdynamic'],
3262               }],
3263             ],
3264           }],
3265           ['linux_use_tcmalloc==0 and android_use_tcmalloc==0', {
3266             'defines': ['NO_TCMALLOC'],
3267           }],
3268           ['linux_keep_shadow_stacks==1', {
3269             'defines': ['KEEP_SHADOW_STACKS'],
3270             'cflags': [
3271               '-finstrument-functions',
3272               # Allow mmx intrinsics to inline, so that the compiler can expand
3273               # the intrinsics.
3274               '-finstrument-functions-exclude-file-list=mmintrin.h',
3275             ],
3276           }],
3277           ['linux_use_gold_flags==1', {
3278             'ldflags': [
3279               # Experimentation found that using four linking threads
3280               # saved ~20% of link time.
3281               # https://groups.google.com/a/chromium.org/group/chromium-dev/browse_thread/thread/281527606915bb36
3282               '-Wl,--threads',
3283               '-Wl,--thread-count=4',
3284             ],
3285             'conditions': [
3286               ['release_valgrind_build==0', {
3287                 'target_conditions': [
3288                   ['_toolset=="target"', {
3289                     'ldflags': [
3290                       # There seems to be a conflict of --icf and -pie
3291                       # in gold which can generate crashy binaries. As
3292                       # a security measure, -pie takes precendence for
3293                       # now.
3294                       #'-Wl,--icf=safe',
3295                       '-Wl,--icf=none',
3296                     ],
3297                   }],
3298                 ],
3299               }],
3300             ],
3301           }],
3302           ['linux_use_gold_binary==1', {
3303             'ldflags': [
3304               # Put our gold binary in the search path for the linker.
3305               # We pass the path to gold to the compiler.  gyp leaves
3306               # unspecified what the cwd is when running the compiler,
3307               # so the normal gyp path-munging fails us.  This hack
3308               # gets the right path.
3309               '-B<(PRODUCT_DIR)/../../third_party/gold',
3310             ],
3311           }],
3312         ],
3313       },
3314     }],
3315     # FreeBSD-specific options; note that most FreeBSD options are set above,
3316     # with Linux.
3317     ['OS=="freebsd"', {
3318       'target_defaults': {
3319         'ldflags': [
3320           '-Wl,--no-keep-memory',
3321         ],
3322       },
3323     }],
3324     # Android-specific options; note that most are set above with Linux.
3325     ['OS=="android"', {
3326       'variables': {
3327         # This is a unique identifier for a given build. It's used for
3328         # identifying various build artifacts corresponding to a particular
3329         # build of chrome (e.g. where to find archived symbols).
3330         'chrome_build_id%': '',
3331         'conditions': [
3332           # Use shared stlport library when system one used.
3333           # Figure this out early since it needs symbols from libgcc.a, so it
3334           # has to be before that in the set of libraries.
3335           ['use_system_stlport==1', {
3336             'android_stlport_library': 'stlport',
3337           }, {
3338             'conditions': [
3339               ['component=="shared_library"', {
3340                   'android_stlport_library': 'stlport_shared',
3341               }, {
3342                   'android_stlport_library': 'stlport_static',
3343               }],
3344             ],
3345           }],
3346         ],
3348         # Placing this variable here prevents from forking libvpx, used
3349         # by remoting.  Remoting is off, so it needn't built,
3350         # so forking it's deps seems like overkill.
3351         # But this variable need defined to properly run gyp.
3352         # A proper solution is to have an OS==android conditional
3353         # in third_party/libvpx/libvpx.gyp to define it.
3354         'libvpx_path': 'lib/linux/arm',
3355       },
3356       'target_defaults': {
3357         'variables': {
3358           'release_extra_cflags%': '',
3359           'conditions': [
3360             # If we're using the components build, append "cr" to all shared
3361             # libraries to avoid naming collisions with android system library
3362             # versions with the same name (e.g. skia, icu).
3363             ['component=="shared_library"', {
3364               'android_product_extension': 'cr.so',
3365             }, {
3366               'android_product_extension': 'so',
3367             } ],
3368           ],
3369         },
3370         'target_conditions': [
3371           ['_type=="shared_library"', {
3372            'product_extension': '<(android_product_extension)',
3373           }],
3375           # Settings for building device targets using Android's toolchain.
3376           # These are based on the setup.mk file from the Android NDK.
3377           #
3378           # The NDK Android executable link step looks as follows:
3379           #  $LDFLAGS
3380           #  $(TARGET_CRTBEGIN_DYNAMIC_O)  <-- crtbegin.o
3381           #  $(PRIVATE_OBJECTS)            <-- The .o that we built
3382           #  $(PRIVATE_STATIC_LIBRARIES)   <-- The .a that we built
3383           #  $(TARGET_LIBGCC)              <-- libgcc.a
3384           #  $(PRIVATE_SHARED_LIBRARIES)   <-- The .so that we built
3385           #  $(PRIVATE_LDLIBS)             <-- System .so
3386           #  $(TARGET_CRTEND_O)            <-- crtend.o
3387           #
3388           # For now the above are approximated for executables by adding
3389           # crtbegin.o to the end of the ldflags and 'crtend.o' to the end
3390           # of 'libraries'.
3391           #
3392           # The NDK Android shared library link step looks as follows:
3393           #  $LDFLAGS
3394           #  $(PRIVATE_OBJECTS)            <-- The .o that we built
3395           #  -l,--whole-archive
3396           #  $(PRIVATE_WHOLE_STATIC_LIBRARIES)
3397           #  -l,--no-whole-archive
3398           #  $(PRIVATE_STATIC_LIBRARIES)   <-- The .a that we built
3399           #  $(TARGET_LIBGCC)              <-- libgcc.a
3400           #  $(PRIVATE_SHARED_LIBRARIES)   <-- The .so that we built
3401           #  $(PRIVATE_LDLIBS)             <-- System .so
3402           #
3403           # For now, assume that whole static libraries are not needed.
3404           #
3405           # For both executables and shared libraries, add the proper
3406           # libgcc.a to the start of libraries which puts it in the
3407           # proper spot after .o and .a files get linked in.
3408           #
3409           # TODO: The proper thing to do longer-tem would be proper gyp
3410           # support for a custom link command line.
3411           ['_toolset=="target"', {
3412             'cflags!': [
3413               '-pthread',  # Not supported by Android toolchain.
3414             ],
3415             'cflags': [
3416               '-ffunction-sections',
3417               '-funwind-tables',
3418               '-g',
3419               '-fstack-protector',
3420               '-fno-short-enums',
3421               '-finline-limit=64',
3422               '-Wa,--noexecstack',
3423               '<@(release_extra_cflags)',
3424             ],
3425             'defines': [
3426               'ANDROID',
3427               '__GNU_SOURCE=1',  # Necessary for clone()
3428               'USE_STLPORT=1',
3429               '_STLP_USE_PTR_SPECIALIZATIONS=1',
3430               'CHROME_BUILD_ID="<(chrome_build_id)"',
3431             ],
3432             'ldflags!': [
3433               '-pthread',  # Not supported by Android toolchain.
3434             ],
3435             'ldflags': [
3436               '-nostdlib',
3437               '-Wl,--no-undefined',
3438               # Don't export symbols from statically linked libraries.
3439               '-Wl,--exclude-libs=ALL',
3440             ],
3441             'libraries': [
3442               '-l<(android_stlport_library)',
3443               # Manually link the libgcc.a that the cross compiler uses.
3444               '<!(<(android_toolchain)/*-gcc -print-libgcc-file-name)',
3445               '-lc',
3446               '-ldl',
3447               '-lstdc++',
3448               '-lm',
3449             ],
3450             'conditions': [
3451               ['component=="shared_library"', {
3452                 'ldflags!': [
3453                   '-Wl,--exclude-libs=ALL',
3454                 ],
3455               }],
3456               ['clang==1', {
3457                 'cflags': [
3458                   # Work around incompatibilities between bionic and clang
3459                   # headers.
3460                   '-D__compiler_offsetof=__builtin_offsetof',
3461                   '-Dnan=__builtin_nan',
3462                 ],
3463                 'conditions': [
3464                   ['target_arch=="arm"', {
3465                     'cflags': [
3466                       '-target arm-linux-androideabi',
3467                       '-mllvm -arm-enable-ehabi',
3468                     ],
3469                     'ldflags': [
3470                       '-target arm-linux-androideabi',
3471                     ],
3472                   }],
3473                   ['target_arch=="ia32"', {
3474                     'cflags': [
3475                       '-target x86-linux-androideabi',
3476                     ],
3477                     'ldflags': [
3478                       '-target x86-linux-androideabi',
3479                     ],
3480                   }],
3481                 ],
3482               }],
3483               ['asan==1', {
3484                 'cflags': [
3485                   # Android build relies on -Wl,--gc-sections removing
3486                   # unreachable code. ASan instrumentation for globals inhibits
3487                   # this and results in a library with unresolvable relocations.
3488                   # TODO(eugenis): find a way to reenable this.
3489                   '-mllvm -asan-globals=0',
3490                 ],
3491               }],
3492               ['android_webview_build==0', {
3493                 'defines': [
3494                   # The NDK has these things, but doesn't define the constants
3495                   # to say that it does. Define them here instead.
3496                   'HAVE_SYS_UIO_H',
3497                 ],
3498                 'cflags': [
3499                   '--sysroot=<(android_ndk_sysroot)',
3500                 ],
3501                 'ldflags': [
3502                   '--sysroot=<(android_ndk_sysroot)',
3503                 ],
3504               }],
3505               ['android_webview_build==1', {
3506                 'include_dirs': [
3507                   # OpenAL headers from the Android tree.
3508                   '<(android_src)/frameworks/wilhelm/include',
3509                 ],
3510                 'cflags': [
3511                   # Android predefines this as 1; undefine it here so Chromium
3512                   # can redefine it later to be 2 for chromium code and unset
3513                   # for third party code. This works because cflags are added
3514                   # before defines.
3515                   '-U_FORTIFY_SOURCE',
3516                   # Disable any additional warnings enabled by the Android build system but which
3517                   # chromium does not build cleanly with (when treating warning as errors).
3518                   # Things that are part of -Wextra:
3519                   '-Wno-extra', # Enabled by -Wextra, but no specific flag
3520                   '-Wno-ignored-qualifiers',
3521                   '-Wno-type-limits',
3522                 ],
3523                 'cflags_cc': [
3524                   # Disabling c++0x-compat should be handled in WebKit, but
3525                   # this currently doesn't work because gcc_version is not set
3526                   # correctly when building with the Android build system.
3527                   # TODO(torne): Fix this in WebKit.
3528                   '-Wno-error=c++0x-compat',
3529                   # Other things unrelated to -Wextra:
3530                   '-Wno-non-virtual-dtor',
3531                   '-Wno-sign-promo',
3532                 ],
3533               }],
3534               ['android_webview_build==1 and chromium_code==0', {
3535                 'cflags': [
3536                   # There is a class of warning which:
3537                   #  1) Android always enables and also treats as errors
3538                   #  2) Chromium ignores in third party code
3539                   # So we re-enable those warnings when building Android.
3540                   '-Wno-address',
3541                   '-Wno-format-security',
3542                   '-Wno-return-type',
3543                   '-Wno-sequence-point',
3544                 ],
3545                 'cflags_cc': [
3546                   '-Wno-non-virtual-dtor',
3547                 ]
3548               }],
3549               ['target_arch == "arm"', {
3550                 'ldflags': [
3551                   # Enable identical code folding to reduce size.
3552                   '-Wl,--icf=safe',
3553                 ],
3554               }],
3555               # NOTE: The stlport header include paths below are specified in
3556               # cflags rather than include_dirs because they need to come
3557               # after include_dirs. Think of them like system headers, but
3558               # don't use '-isystem' because the arm-linux-androideabi-4.4.3
3559               # toolchain (circa Gingerbread) will exhibit strange errors.
3560               # The include ordering here is important; change with caution.
3561               ['use_system_stlport==1', {
3562                 'cflags': [
3563                   # For libstdc++/include, which is used by stlport.
3564                   '-I<(android_src)/bionic',
3565                   '-I<(android_src)/external/stlport/stlport',
3566                 ],
3567               }, { # else: use_system_stlport!=1
3568                 'cflags': [
3569                   '-I<(android_stlport_include)',
3570                 ],
3571                 'ldflags': [
3572                   '-L<(android_stlport_libs_dir)',
3573                 ],
3574               }],
3575               ['target_arch=="ia32"', {
3576                 # The x86 toolchain currently has problems with stack-protector.
3577                 'cflags!': [
3578                   '-fstack-protector',
3579                 ],
3580                 'cflags': [
3581                   '-fno-stack-protector',
3582                 ],
3583               }],
3584             ],
3585             'target_conditions': [
3586               ['_type=="executable"', {
3587                 'ldflags': [
3588                   '-Bdynamic',
3589                   '-Wl,-dynamic-linker,/system/bin/linker',
3590                   '-Wl,--gc-sections',
3591                   '-Wl,-z,nocopyreloc',
3592                   # crtbegin_dynamic.o should be the last item in ldflags.
3593                   '<(android_ndk_lib)/crtbegin_dynamic.o',
3594                 ],
3595                 'libraries': [
3596                   # crtend_android.o needs to be the last item in libraries.
3597                   # Do not add any libraries after this!
3598                   '<(android_ndk_lib)/crtend_android.o',
3599                 ],
3600                 'conditions': [
3601                   ['asan==1', {
3602                     'cflags': [
3603                       '-fPIE',
3604                     ],
3605                     'ldflags': [
3606                       '-pie',
3607                     ],
3608                   }],
3609                 ],
3610               }],
3611               ['_type=="shared_library" or _type=="loadable_module"', {
3612                 'ldflags': [
3613                   '-Wl,-shared,-Bsymbolic',
3614                 ],
3615                 'conditions': [
3616                   ['android_webview_build==0', {
3617                     'ldflags': [
3618                       # crtbegin_so.o should be the last item in ldflags.
3619                       '<(android_ndk_lib)/crtbegin_so.o',
3620                     ],
3621                     'libraries': [
3622                       # crtend_so.o needs to be the last item in libraries.
3623                       # Do not add any libraries after this!
3624                       '<(android_ndk_lib)/crtend_so.o',
3625                     ],
3626                   }],
3627                 ],
3628               }],
3629               # ndk-build copies .a's around the filesystem, breaking
3630               # relative paths in thin archives.  Disable using thin
3631               # archives to avoid problems until one of these is fixed:
3632               # http://code.google.com/p/android/issues/detail?id=40302
3633               # http://code.google.com/p/android/issues/detail?id=40303
3634               ['_type=="static_library"', {
3635                 'standalone_static_library': 1,
3636               }],
3637             ],
3638           }],
3639           # Settings for building host targets using the system toolchain.
3640           ['_toolset=="host"', {
3641             'cflags!': [
3642               # Due to issues in Clang build system, using ASan on 32-bit
3643               # binaries on x86_64 host is problematic.
3644               # TODO(eugenis): re-enable.
3645               '-fsanitize=address',
3646               '-w',  # http://crbug.com/162783
3647             ],
3648             'ldflags!': [
3649               '-fsanitize=address',
3650               '-Wl,-z,noexecstack',
3651               '-Wl,--gc-sections',
3652               '-Wl,-O1',
3653               '-Wl,--as-needed',
3654             ],
3655             'sources/': [
3656               ['exclude', '_android(_unittest)?\\.cc$'],
3657               ['exclude', '(^|/)android/']
3658             ],
3659           }],
3660           # Settings for building host targets on mac.
3661           ['_toolset=="host" and host_os=="mac"', {
3662             'ldflags!': [
3663               '-Wl,-z,now',
3664               '-Wl,-z,relro',
3665             ],
3666           }],
3667         ],
3668       },
3669     }],
3670     ['OS=="solaris"', {
3671       'cflags!': ['-fvisibility=hidden'],
3672       'cflags_cc!': ['-fvisibility-inlines-hidden'],
3673     }],
3674     ['OS=="mac" or OS=="ios"', {
3675       'target_defaults': {
3676         'mac_bundle': 0,
3677         'xcode_settings': {
3678           'ALWAYS_SEARCH_USER_PATHS': 'NO',
3679           # Don't link in libarclite_macosx.a, see http://crbug.com/156530.
3680           'CLANG_LINK_OBJC_RUNTIME': 'NO',          # -fno-objc-link-runtime
3681           'GCC_C_LANGUAGE_STANDARD': 'c99',         # -std=c99
3682           'GCC_CW_ASM_SYNTAX': 'NO',                # No -fasm-blocks
3683           'GCC_ENABLE_CPP_EXCEPTIONS': 'NO',        # -fno-exceptions
3684           'GCC_ENABLE_CPP_RTTI': 'NO',              # -fno-rtti
3685           'GCC_ENABLE_PASCAL_STRINGS': 'NO',        # No -mpascal-strings
3686           # GCC_INLINES_ARE_PRIVATE_EXTERN maps to -fvisibility-inlines-hidden
3687           'GCC_INLINES_ARE_PRIVATE_EXTERN': 'YES',
3688           'GCC_OBJC_CALL_CXX_CDTORS': 'YES',        # -fobjc-call-cxx-cdtors
3689           'GCC_SYMBOLS_PRIVATE_EXTERN': 'YES',      # -fvisibility=hidden
3690           'GCC_THREADSAFE_STATICS': 'NO',           # -fno-threadsafe-statics
3691           'GCC_TREAT_WARNINGS_AS_ERRORS': 'YES',    # -Werror
3692           'GCC_VERSION': '4.2',
3693           'GCC_WARN_ABOUT_MISSING_NEWLINE': 'YES',  # -Wnewline-eof
3694           'USE_HEADERMAP': 'NO',
3695           'WARNING_CFLAGS': [
3696             '-Wall',
3697             '-Wendif-labels',
3698             '-Wextra',
3699             # Don't warn about unused function parameters.
3700             '-Wno-unused-parameter',
3701             # Don't warn about the "struct foo f = {0};" initialization
3702             # pattern.
3703             '-Wno-missing-field-initializers',
3704           ],
3705           'conditions': [
3706             ['chromium_mac_pch', {'GCC_PRECOMPILE_PREFIX_HEADER': 'YES'},
3707                                  {'GCC_PRECOMPILE_PREFIX_HEADER': 'NO'}
3708             ],
3709             # Note that the prebuilt Clang binaries should not be used for iOS
3710             # development except for ASan builds.
3711             ['clang==1', {
3712               'CC': '$(SOURCE_ROOT)/<(clang_dir)/clang',
3713               'LDPLUSPLUS': '$(SOURCE_ROOT)/<(clang_dir)/clang++',
3715               # Don't use -Wc++0x-extensions, which Xcode 4 enables by default
3716               # when building with clang. This warning is triggered when the
3717               # override keyword is used via the OVERRIDE macro from
3718               # base/compiler_specific.h.
3719               'CLANG_WARN_CXX0X_EXTENSIONS': 'NO',
3720               # Warn if automatic synthesis is triggered with
3721               # the -Wobjc-missing-property-synthesis flag.
3722               'CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS': 'YES',
3723               'GCC_VERSION': 'com.apple.compilers.llvm.clang.1_0',
3724               'WARNING_CFLAGS': [
3725                 '-Wheader-hygiene',
3727                 # This warns on using ints as initializers for floats in
3728                 # initializer lists (e.g. |int a = f(); CGSize s = { a, a };|),
3729                 # which happens in several places in chrome code. Not sure if
3730                 # this is worth fixing.
3731                 '-Wno-c++11-narrowing',
3733                 # This warns about code like |"0x%08"NACL_PRIxPTR| -- with C++11
3734                 # user-defined literals, this is now a string literal with a UD
3735                 # suffix. However, this is used heavily in NaCl code, so disable
3736                 # the warning for now.
3737                 '-Wno-reserved-user-defined-literal',
3739                 # Don't die on dtoa code that uses a char as an array index.
3740                 # This is required solely for base/third_party/dmg_fp/dtoa.cc.
3741                 '-Wno-char-subscripts',
3743                 # Clang spots more unused functions.
3744                 '-Wno-unused-function',
3746                 # Warns on switches on enums that cover all enum values but
3747                 # also contain a default: branch. Chrome is full of that.
3748                 '-Wno-covered-switch-default',
3750                 # Warns when a const char[] is converted to bool.
3751                 '-Wstring-conversion',
3752               ],
3753               'OTHER_CPLUSPLUSFLAGS': [
3754                 # gnu++11 instead of c++11 is needed because some code uses
3755                 # typeof() (a GNU extension).
3756                 # TODO(thakis): Eventually switch this to c++11 instead of
3757                 # gnu++11 (once typeof can be removed, which is blocked on c++11
3758                 # being available everywhere).
3759                 # TODO(thakis): Use CLANG_CXX_LANGUAGE_STANDARD instead once all
3760                 # bots use xcode 4 -- http://crbug.com/147515).
3761                 '$(inherited)', '-std=gnu++11',
3762               ],
3763             }],
3764             ['clang==1 and clang_use_chrome_plugins==1', {
3765               'OTHER_CFLAGS': [
3766                 '<@(clang_chrome_plugins_flags)',
3767               ],
3768             }],
3769             ['clang==1 and clang_load!=""', {
3770               'OTHER_CFLAGS': [
3771                 '-Xclang', '-load', '-Xclang', '<(clang_load)',
3772               ],
3773             }],
3774             ['clang==1 and clang_add_plugin!=""', {
3775               'OTHER_CFLAGS': [
3776                 '-Xclang', '-add-plugin', '-Xclang', '<(clang_add_plugin)',
3777               ],
3778             }],
3779             ['clang==1 and "<(GENERATOR)"=="ninja"', {
3780               'OTHER_CFLAGS': [
3781                 # See http://crbug.com/110262
3782                 '-fcolor-diagnostics',
3783               ],
3784             }],
3785           ],
3786         },
3787         'conditions': [
3788           ['clang==1', {
3789             'variables': {
3790               'clang_dir': '../third_party/llvm-build/Release+Asserts/bin',
3791             },
3792           }],
3793           ['asan==1', {
3794             'xcode_settings': {
3795               'OTHER_CFLAGS': [
3796                 '-fsanitize=address',
3797                 '-mllvm -asan-globals=0',  # http://crbug.com/196561
3798                 '-w',  # http://crbug.com/162783
3799               ],
3800             },
3801             'defines': [
3802               'ADDRESS_SANITIZER',
3803             ],
3804           }],
3805         ],
3806         'target_conditions': [
3807           ['_type!="static_library"', {
3808             'xcode_settings': {'OTHER_LDFLAGS': ['-Wl,-search_paths_first']},
3809             'conditions': [
3810               ['asan==1', {
3811                 'xcode_settings': {
3812                   'OTHER_LDFLAGS': [
3813                     '-fsanitize=address',
3814                   ],
3815                 },
3816               }],
3817             ],
3818           }],
3819           ['_mac_bundle', {
3820             'xcode_settings': {'OTHER_LDFLAGS': ['-Wl,-ObjC']},
3821             'target_conditions': [
3822               ['_type=="executable"', {
3823                 'conditions': [
3824                   ['asan==1', {
3825                     'postbuilds': [
3826                       {
3827                         'variables': {
3828                           # Define copy_asan_dylib_path in a variable ending in
3829                           # _path so that gyp understands it's a path and
3830                           # performs proper relativization during dict merging.
3831                           'copy_asan_dylib_path':
3832                             'mac/copy_asan_runtime_dylib.sh',
3833                         },
3834                         'postbuild_name': 'Copy ASan runtime dylib',
3835                         'action': [
3836                           '<(copy_asan_dylib_path)',
3837                         ],
3838                       },
3839                     ],
3840                   }],
3841                 ],
3842               }],
3843             ],
3844           }],
3845         ],  # target_conditions
3846       },  # target_defaults
3847     }],  # OS=="mac" or OS=="ios"
3848     ['OS=="mac"', {
3849       'target_defaults': {
3850         'variables': {
3851           # These should end with %, but there seems to be a bug with % in
3852           # variables that are intended to be set to different values in
3853           # different targets, like these.
3854           'mac_pie': 1,        # Most executables can be position-independent.
3855           # Strip debugging symbols from the target.
3856           'mac_strip': '<(mac_strip_release)',
3857           'conditions': [
3858             ['asan==1', {
3859               'conditions': [
3860                 ['mac_want_real_dsym=="default"', {
3861                   'mac_real_dsym': 1,
3862                 }, {
3863                   'mac_real_dsym': '<(mac_want_real_dsym)'
3864                 }],
3865               ],
3866             }, {
3867               'conditions': [
3868                 ['mac_want_real_dsym=="default"', {
3869                   'mac_real_dsym': 0, # Fake .dSYMs are fine in most cases.
3870                 }, {
3871                   'mac_real_dsym': '<(mac_want_real_dsym)'
3872                 }],
3873               ],
3874             }],
3875           ],
3876         },
3877         'xcode_settings': {
3878           'GCC_DYNAMIC_NO_PIC': 'NO',               # No -mdynamic-no-pic
3879                                                     # (Equivalent to -fPIC)
3880           # MACOSX_DEPLOYMENT_TARGET maps to -mmacosx-version-min
3881           'MACOSX_DEPLOYMENT_TARGET': '<(mac_deployment_target)',
3882           # Keep pch files below xcodebuild/.
3883           'SHARED_PRECOMPS_DIR': '$(CONFIGURATION_BUILD_DIR)/SharedPrecompiledHeaders',
3884           'OTHER_CFLAGS': [
3885             '-fno-strict-aliasing',  # See http://crbug.com/32204
3886           ],
3887         },
3888         'target_conditions': [
3889           ['_type=="executable"', {
3890             'postbuilds': [
3891               {
3892                 # Arranges for data (heap) pages to be protected against
3893                 # code execution when running on Mac OS X 10.7 ("Lion"), and
3894                 # ensures that the position-independent executable (PIE) bit
3895                 # is set for ASLR when running on Mac OS X 10.5 ("Leopard").
3896                 'variables': {
3897                   # Define change_mach_o_flags in a variable ending in _path
3898                   # so that GYP understands it's a path and performs proper
3899                   # relativization during dict merging.
3900                   'change_mach_o_flags_path':
3901                       'mac/change_mach_o_flags_from_xcode.sh',
3902                   'change_mach_o_flags_options%': [
3903                   ],
3904                   'target_conditions': [
3905                     ['mac_pie==0 or release_valgrind_build==1', {
3906                       # Don't enable PIE if it's unwanted. It's unwanted if
3907                       # the target specifies mac_pie=0 or if building for
3908                       # Valgrind, because Valgrind doesn't understand slide.
3909                       # See the similar mac_pie/release_valgrind_build check
3910                       # below.
3911                       'change_mach_o_flags_options': [
3912                         '--no-pie',
3913                       ],
3914                     }],
3915                   ],
3916                 },
3917                 'postbuild_name': 'Change Mach-O Flags',
3918                 'action': [
3919                   '<(change_mach_o_flags_path)',
3920                   '>@(change_mach_o_flags_options)',
3921                 ],
3922               },
3923             ],
3924             'conditions': [
3925               ['asan==1', {
3926                 'variables': {
3927                  'asan_saves_file': 'asan.saves',
3928                 },
3929                 'xcode_settings': {
3930                   'CHROMIUM_STRIP_SAVE_FILE': '<(asan_saves_file)',
3931                 },
3932               }],
3933             ],
3934             'target_conditions': [
3935               ['mac_pie==1 and release_valgrind_build==0', {
3936                 # Turn on position-independence (ASLR) for executables. When
3937                 # PIE is on for the Chrome executables, the framework will
3938                 # also be subject to ASLR.
3939                 # Don't do this when building for Valgrind, because Valgrind
3940                 # doesn't understand slide. TODO: Make Valgrind on Mac OS X
3941                 # understand slide, and get rid of the Valgrind check.
3942                 'xcode_settings': {
3943                   'OTHER_LDFLAGS': [
3944                     '-Wl,-pie',  # Position-independent executable (MH_PIE)
3945                   ],
3946                 },
3947               }],
3948             ],
3949           }],
3950           ['(_type=="executable" or _type=="shared_library" or \
3951              _type=="loadable_module") and mac_strip!=0', {
3952             'target_conditions': [
3953               ['mac_real_dsym == 1', {
3954                 # To get a real .dSYM bundle produced by dsymutil, set the
3955                 # debug information format to dwarf-with-dsym.  Since
3956                 # strip_from_xcode will not be used, set Xcode to do the
3957                 # stripping as well.
3958                 'configurations': {
3959                   'Release_Base': {
3960                     'xcode_settings': {
3961                       'DEBUG_INFORMATION_FORMAT': 'dwarf-with-dsym',
3962                       'DEPLOYMENT_POSTPROCESSING': 'YES',
3963                       'STRIP_INSTALLED_PRODUCT': 'YES',
3964                       'target_conditions': [
3965                         ['_type=="shared_library" or _type=="loadable_module"', {
3966                           # The Xcode default is to strip debugging symbols
3967                           # only (-S).  Local symbols should be stripped as
3968                           # well, which will be handled by -x.  Xcode will
3969                           # continue to insert -S when stripping even when
3970                           # additional flags are added with STRIPFLAGS.
3971                           'STRIPFLAGS': '-x',
3972                         }],  # _type=="shared_library" or _type=="loadable_module"
3973                         ['_type=="executable"', {
3974                           'conditions': [
3975                             ['asan==1', {
3976                               'STRIPFLAGS': '-s $(CHROMIUM_STRIP_SAVE_FILE)',
3977                             }]
3978                           ],
3979                         }],  # _type=="executable" and asan==1
3980                       ],  # target_conditions
3981                     },  # xcode_settings
3982                   },  # configuration "Release"
3983                 },  # configurations
3984               }, {  # mac_real_dsym != 1
3985                 # To get a fast fake .dSYM bundle, use a post-build step to
3986                 # produce the .dSYM and strip the executable.  strip_from_xcode
3987                 # only operates in the Release configuration.
3988                 'postbuilds': [
3989                   {
3990                     'variables': {
3991                       # Define strip_from_xcode in a variable ending in _path
3992                       # so that gyp understands it's a path and performs proper
3993                       # relativization during dict merging.
3994                       'strip_from_xcode_path': 'mac/strip_from_xcode',
3995                     },
3996                     'postbuild_name': 'Strip If Needed',
3997                     'action': ['<(strip_from_xcode_path)'],
3998                   },
3999                 ],  # postbuilds
4000               }],  # mac_real_dsym
4001             ],  # target_conditions
4002           }],  # (_type=="executable" or _type=="shared_library" or
4003                #  _type=="loadable_module") and mac_strip!=0
4004         ],  # target_conditions
4005       },  # target_defaults
4006     }],  # OS=="mac"
4007     ['OS=="ios"', {
4008       'target_defaults': {
4009         'xcode_settings' : {
4010           'GCC_VERSION': 'com.apple.compilers.llvm.clang.1_0',
4012           # This next block is mostly common with the 'mac' section above,
4013           # but keying off (or setting) 'clang' isn't valid for iOS as it
4014           # also seems to mean using the custom build of clang.
4016           # TODO(stuartmorgan): switch to c++0x (see TODOs in the clang
4017           # section above).
4018           'CLANG_CXX_LANGUAGE_STANDARD': 'gnu++0x',
4019           # Don't use -Wc++0x-extensions, which Xcode 4 enables by default
4020           # when building with clang. This warning is triggered when the
4021           # override keyword is used via the OVERRIDE macro from
4022           # base/compiler_specific.h.
4023           'CLANG_WARN_CXX0X_EXTENSIONS': 'NO',
4024           # Warn if automatic synthesis is triggered with
4025           # the -Wobjc-missing-property-synthesis flag.
4026           'CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS': 'YES',
4027           'WARNING_CFLAGS': [
4028             '-Wheader-hygiene',
4029             # Don't die on dtoa code that uses a char as an array index.
4030             # This is required solely for base/third_party/dmg_fp/dtoa.cc.
4031             '-Wno-char-subscripts',
4032             # Clang spots more unused functions.
4033             '-Wno-unused-function',
4034             # See comments on this flag higher up in this file.
4035             '-Wno-unnamed-type-template-args',
4036             # Match OS X clang C++11 warning settings.
4037             '-Wno-c++11-narrowing',
4038             '-Wno-reserved-user-defined-literal',
4039           ],
4040         },
4041         'target_conditions': [
4042           ['_toolset=="host"', {
4043             'xcode_settings': {
4044               'SDKROOT': 'macosx<(mac_sdk)',  # -isysroot
4045               'MACOSX_DEPLOYMENT_TARGET': '<(mac_deployment_target)',
4046             },
4047           }],
4048           ['_toolset=="target"', {
4049             'xcode_settings': {
4050               # This section should be for overriding host settings. But,
4051               # since we can't negate the iphone deployment target above, we
4052               # instead set it here for target only.
4053               'IPHONEOS_DEPLOYMENT_TARGET': '<(ios_deployment_target)',
4054             },
4055           }],
4056           ['_type=="executable"', {
4057             'configurations': {
4058               'Release_Base': {
4059                 'xcode_settings': {
4060                   'DEPLOYMENT_POSTPROCESSING': 'YES',
4061                   'STRIP_INSTALLED_PRODUCT': 'YES',
4062                 },
4063               },
4064               'Debug_Base': {
4065                 'xcode_settings': {
4066                   # Remove dSYM to reduce build time.
4067                   'DEBUG_INFORMATION_FORMAT': 'dwarf',
4068                 },
4069               },
4070             },
4071             'conditions': [
4072               ['"<(GENERATOR)"=="xcode"', {
4073                 'xcode_settings': {
4074                   # TODO(justincohen): ninja builds don't support signing yet.
4075                   'conditions': [
4076                     ['chromium_ios_signing', {
4077                       # iOS SDK wants everything for device signed.
4078                       'CODE_SIGN_IDENTITY[sdk=iphoneos*]': 'iPhone Developer',
4079                     }, {
4080                       'CODE_SIGNING_REQUIRED': 'NO',
4081                       'CODE_SIGN_IDENTITY[sdk=iphoneos*]': '',
4082                     }],
4083                   ],
4084                 },
4085               }],
4086               ['"<(GENERATOR)"=="xcode" and clang!=1', {
4087                 'xcode_settings': {
4088                   # It is necessary to link with the -fobjc-arc flag to use
4089                   # subscripting on iOS < 6.
4090                   'OTHER_LDFLAGS': [
4091                     '-fobjc-arc',
4092                   ],
4093                 },
4094               }],
4095               ['clang==1', {
4096                 'target_conditions': [
4097                   ['_toolset=="target"', {
4098                     'variables': {
4099                       'developer_dir': '<!(xcode-select -print-path)',
4100                       'arc_toolchain_path': '<(developer_dir)/Toolchains/XcodeDefault.xctoolchain/usr/lib/arc',
4101                     },
4102                     # It is necessary to force load libarclite from Xcode for
4103                     # third_party/llvm-build because libarclite_* is only
4104                     # distributed by Xcode.
4105                     'conditions': [
4106                       ['"<(GENERATOR)"=="ninja" and target_arch=="armv7"', {
4107                         'xcode_settings': {
4108                           'OTHER_LDFLAGS': [
4109                             '-force_load',
4110                             '<(arc_toolchain_path)/libarclite_iphoneos.a',
4111                           ],
4112                         },
4113                       }],
4114                       ['"<(GENERATOR)"=="ninja" and target_arch!="armv7"', {
4115                         'xcode_settings': {
4116                           'OTHER_LDFLAGS': [
4117                             '-force_load',
4118                             '<(arc_toolchain_path)/libarclite_iphonesimulator.a',
4119                           ],
4120                         },
4121                       }],
4122                       # Xcode sets target_arch at compile-time.
4123                       ['"<(GENERATOR)"=="xcode"', {
4124                         'xcode_settings': {
4125                           'OTHER_LDFLAGS[arch=armv7]': [
4126                             '-force_load',
4127                             '<(arc_toolchain_path)/libarclite_iphoneos.a',
4128                           ],
4129                           'OTHER_LDFLAGS[arch=i386]': [
4130                             '-force_load',
4131                             '<(arc_toolchain_path)/libarclite_iphonesimulator.a',
4132                           ],
4133                         },
4134                       }],
4135                     ],
4136                   }],
4137                 ],
4138               }],
4139             ],
4140           }],
4141         ],  # target_conditions
4142       },  # target_defaults
4143     }],  # OS=="ios"
4144     ['OS=="win"', {
4145       'target_defaults': {
4146         'defines': [
4147           '_WIN32_WINNT=0x0602',
4148           'WINVER=0x0602',
4149           'WIN32',
4150           '_WINDOWS',
4151           'NOMINMAX',
4152           'PSAPI_VERSION=1',
4153           '_CRT_RAND_S',
4154           'CERT_CHAIN_PARA_HAS_EXTRA_FIELDS',
4155           'WIN32_LEAN_AND_MEAN',
4156           '_ATL_NO_OPENGL',
4157         ],
4158         'conditions': [
4159           ['buildtype=="Official"', {
4160               # In official builds, targets can self-select an optimization
4161               # level by defining a variable named 'optimize', and setting it
4162               # to one of
4163               # - "size", optimizes for minimal code size - the default.
4164               # - "speed", optimizes for speed over code size.
4165               # - "max", whole program optimization and link-time code
4166               #   generation. This is very expensive and should be used
4167               #   sparingly.
4168               'variables': {
4169                 'optimize%': 'size',
4170               },
4171               'target_conditions': [
4172                 ['optimize=="size"', {
4173                     'msvs_settings': {
4174                       'VCCLCompilerTool': {
4175                         # 1, optimizeMinSpace, Minimize Size (/O1)
4176                         'Optimization': '1',
4177                         # 2, favorSize - Favor small code (/Os)
4178                         'FavorSizeOrSpeed': '2',
4179                       },
4180                     },
4181                   },
4182                 ],
4183                 ['optimize=="speed"', {
4184                     'msvs_settings': {
4185                       'VCCLCompilerTool': {
4186                         # 2, optimizeMaxSpeed, Maximize Speed (/O2)
4187                         'Optimization': '2',
4188                         # 1, favorSpeed - Favor fast code (/Ot)
4189                         'FavorSizeOrSpeed': '1',
4190                       },
4191                     },
4192                   },
4193                 ],
4194                 ['optimize=="max"', {
4195                     'msvs_settings': {
4196                       'VCCLCompilerTool': {
4197                         # 2, optimizeMaxSpeed, Maximize Speed (/O2)
4198                         'Optimization': '2',
4199                         # 1, favorSpeed - Favor fast code (/Ot)
4200                         'FavorSizeOrSpeed': '1',
4201                         # This implies link time code generation.
4202                         'WholeProgramOptimization': 'true',
4203                       },
4204                     },
4205                   },
4206                 ],
4207               ],
4208             },
4209           ],
4210           ['component=="static_library"', {
4211             'defines': [
4212               '_HAS_EXCEPTIONS=0',
4213             ],
4214           }],
4215           ['secure_atl', {
4216             'defines': [
4217               '_SECURE_ATL',
4218             ],
4219           }],
4220           ['msvs_express', {
4221             'configurations': {
4222               'x86_Base': {
4223                 'msvs_settings': {
4224                   'VCLinkerTool': {
4225                     'AdditionalLibraryDirectories':
4226                       ['<(windows_driver_kit_path)/lib/ATL/i386'],
4227                   },
4228                   'VCLibrarianTool': {
4229                     'AdditionalLibraryDirectories':
4230                       ['<(windows_driver_kit_path)/lib/ATL/i386'],
4231                   },
4232                 },
4233               },
4234               'x64_Base': {
4235                 'msvs_settings': {
4236                   'VCLibrarianTool': {
4237                     'AdditionalLibraryDirectories':
4238                       ['<(windows_driver_kit_path)/lib/ATL/amd64'],
4239                   },
4240                   'VCLinkerTool': {
4241                     'AdditionalLibraryDirectories':
4242                       ['<(windows_driver_kit_path)/lib/ATL/amd64'],
4243                   },
4244                 },
4245               },
4246             },
4247             'msvs_settings': {
4248               'VCLinkerTool': {
4249                 # Explicitly required when using the ATL with express
4250                 'AdditionalDependencies': ['atlthunk.lib'],
4252                 # ATL 8.0 included in WDK 7.1 makes the linker to generate
4253                 # almost eight hundred LNK4254 and LNK4078 warnings:
4254                 #   - warning LNK4254: section 'ATL' (50000040) merged into
4255                 #     '.rdata' (40000040) with different attributes
4256                 #   - warning LNK4078: multiple 'ATL' sections found with
4257                 #     different attributes
4258                 'AdditionalOptions': ['/ignore:4254', '/ignore:4078'],
4259               },
4260             },
4261             'msvs_system_include_dirs': [
4262               '<(windows_driver_kit_path)/inc/atl71',
4263               '<(windows_driver_kit_path)/inc/mfc42',
4264             ],
4265           }],
4266         ],
4267         'msvs_system_include_dirs': [
4268           '<(windows_sdk_path)/Include/shared',
4269           '<(windows_sdk_path)/Include/um',
4270           '<(windows_sdk_path)/Include/winrt',
4271           '$(VSInstallDir)/VC/atlmfc/include',
4272         ],
4273         'msvs_cygwin_dirs': ['<(DEPTH)/third_party/cygwin'],
4274         'msvs_disabled_warnings': [4351, 4355, 4396, 4503, 4819,
4275           # TODO(maruel): These warnings are level 4. They will be slowly
4276           # removed as code is fixed.
4277           4100, 4121, 4125, 4127, 4130, 4131, 4189, 4201, 4238, 4244, 4245,
4278           4310, 4428, 4481, 4505, 4510, 4512, 4530, 4610, 4611, 4701, 4702,
4279           4706,
4280         ],
4281         'msvs_settings': {
4282           'VCCLCompilerTool': {
4283             'AdditionalOptions': ['/MP'],
4284             'MinimalRebuild': 'false',
4285             'BufferSecurityCheck': 'true',
4286             'EnableFunctionLevelLinking': 'true',
4287             'RuntimeTypeInfo': 'false',
4288             'WarningLevel': '4',
4289             'WarnAsError': 'true',
4290             'DebugInformationFormat': '3',
4291             'conditions': [
4292               ['component=="shared_library"', {
4293                 'ExceptionHandling': '1',  # /EHsc
4294               }, {
4295                 'ExceptionHandling': '0',
4296               }],
4297             ],
4298           },
4299           'VCLibrarianTool': {
4300             'AdditionalOptions': ['/ignore:4221'],
4301             'AdditionalLibraryDirectories': [
4302               '<(windows_sdk_path)/Lib/win8/um/x86',
4303             ],
4304           },
4305           'VCLinkerTool': {
4306             'AdditionalDependencies': [
4307               'wininet.lib',
4308               'dnsapi.lib',
4309               'version.lib',
4310               'msimg32.lib',
4311               'ws2_32.lib',
4312               'usp10.lib',
4313               'psapi.lib',
4314               'dbghelp.lib',
4315               'winmm.lib',
4316               'shlwapi.lib',
4317             ],
4318             'AdditionalLibraryDirectories': [
4319               '<(windows_sdk_path)/Lib/win8/um/x86',
4320             ],
4321             'GenerateDebugInformation': 'true',
4322             'MapFileName': '$(OutDir)\\$(TargetName).map',
4323             'ImportLibrary': '$(OutDir)\\lib\\$(TargetName).lib',
4324             'FixedBaseAddress': '1',
4325             # SubSystem values:
4326             #   0 == not set
4327             #   1 == /SUBSYSTEM:CONSOLE
4328             #   2 == /SUBSYSTEM:WINDOWS
4329             # Most of the executables we'll ever create are tests
4330             # and utilities with console output.
4331             'SubSystem': '1',
4332           },
4333           'VCMIDLTool': {
4334             'GenerateStublessProxies': 'true',
4335             'TypeLibraryName': '$(InputName).tlb',
4336             'OutputDirectory': '$(IntDir)',
4337             'HeaderFileName': '$(InputName).h',
4338             'DLLDataFileName': '$(InputName).dlldata.c',
4339             'InterfaceIdentifierFileName': '$(InputName)_i.c',
4340             'ProxyFileName': '$(InputName)_p.c',
4341           },
4342           'VCResourceCompilerTool': {
4343             'Culture' : '1033',
4344             'AdditionalIncludeDirectories': [
4345               '<(DEPTH)',
4346               '<(SHARED_INTERMEDIATE_DIR)',
4347             ],
4348           },
4349         },
4350       },
4351     }],
4352     ['disable_nacl==1', {
4353       'target_defaults': {
4354         'defines': [
4355           'DISABLE_NACL',
4356         ],
4357       },
4358     }],
4359     ['OS=="win" and msvs_use_common_linker_extras', {
4360       'target_defaults': {
4361         'msvs_settings': {
4362           'VCLinkerTool': {
4363             'DelayLoadDLLs': [
4364               'dbghelp.dll',
4365               'dwmapi.dll',
4366               'shell32.dll',
4367               'uxtheme.dll',
4368             ],
4369           },
4370         },
4371         'configurations': {
4372           'x86_Base': {
4373             'msvs_settings': {
4374               'VCLinkerTool': {
4375                 'AdditionalOptions': [
4376                   '/safeseh',
4377                   '/dynamicbase',
4378                   '/ignore:4199',
4379                   '/ignore:4221',
4380                   '/nxcompat',
4381                 ],
4382               },
4383             },
4384           },
4385           'x64_Base': {
4386             'msvs_settings': {
4387               'VCLinkerTool': {
4388                 'AdditionalOptions': [
4389                   # safeseh is not compatible with x64
4390                   '/dynamicbase',
4391                   '/ignore:4199',
4392                   '/ignore:4221',
4393                   '/nxcompat',
4394                 ],
4395               },
4396             },
4397           },
4398         },
4399       },
4400     }],
4401     ['enable_new_npdevice_api==1', {
4402       'target_defaults': {
4403         'defines': [
4404           'ENABLE_NEW_NPDEVICE_API',
4405         ],
4406       },
4407     }],
4408     # Don't warn about the "typedef 'foo' locally defined but not used"
4409     # for gcc 4.8.
4410     # TODO: remove this flag once all builds work. See crbug.com/227506
4411     ['gcc_version>=48', {
4412       'target_defaults': {
4413         'cflags': [
4414           '-Wno-unused-local-typedefs',
4415         ],
4416       },
4417     }],
4418     ['clang==1', {
4419       'conditions': [
4420         ['OS=="android"', {
4421           # Android could use the goma with clang.
4422           'make_global_settings': [
4423             ['CC', '<!(/bin/echo -n ${ANDROID_GOMA_WRAPPER} ${CHROME_SRC}/<(make_clang_dir)/bin/clang)'],
4424             ['CXX', '<!(/bin/echo -n ${ANDROID_GOMA_WRAPPER} ${CHROME_SRC}/<(make_clang_dir)/bin/clang++)'],
4425             ['LINK', '<!(/bin/echo -n ${ANDROID_GOMA_WRAPPER} ${CHROME_SRC}/<(make_clang_dir)/bin/clang++)'],
4426             ['CC.host', '$(CC)'],
4427             ['CXX.host', '$(CXX)'],
4428             ['LINK.host', '$(LINK)'],
4429           ],
4430         }, {
4431           'make_global_settings': [
4432             ['CC', '<(make_clang_dir)/bin/clang'],
4433             ['CXX', '<(make_clang_dir)/bin/clang++'],
4434             ['LINK', '$(CXX)'],
4435             ['CC.host', '$(CC)'],
4436             ['CXX.host', '$(CXX)'],
4437             ['LINK.host', '$(LINK)'],
4438           ],
4439         }],
4440       ],
4441     }],
4442     ['OS=="android" and clang==0', {
4443       # Hardcode the compiler names in the Makefile so that
4444       # it won't depend on the environment at make time.
4445       'make_global_settings': [
4446         ['CC', '<!(/bin/echo -n ${ANDROID_GOMA_WRAPPER} <(android_toolchain)/*-gcc)'],
4447         ['CXX', '<!(/bin/echo -n ${ANDROID_GOMA_WRAPPER} <(android_toolchain)/*-g++)'],
4448         ['LINK', '<!(/bin/echo -n ${ANDROID_GOMA_WRAPPER} <(android_toolchain)/*-gcc)'],
4449         ['CC.host', '<!(/bin/echo -n ${ANDROID_GOMA_WRAPPER} <!(which gcc))'],
4450         ['CXX.host', '<!(/bin/echo -n ${ANDROID_GOMA_WRAPPER} <!(which g++))'],
4451         ['LINK.host', '<!(/bin/echo -n ${ANDROID_GOMA_WRAPPER} <!(which g++))'],
4452       ],
4453     }],
4454     ['OS=="linux" and target_arch=="mipsel"', {
4455       'make_global_settings': [
4456         ['CC', '<(sysroot)/../bin/mipsel-linux-gnu-gcc'],
4457         ['CXX', '<(sysroot)/../bin/mipsel-linux-gnu-g++'],
4458         ['LINK', '$(CXX)'],
4459         ['CC.host', '<!(which gcc)'],
4460         ['CXX.host', '<!(which g++)'],
4461         ['LINK.host', '<!(which g++)'],
4462       ],
4463     }],
4464   ],
4465   'xcode_settings': {
4466     # DON'T ADD ANYTHING NEW TO THIS BLOCK UNLESS YOU REALLY REALLY NEED IT!
4467     # This block adds *project-wide* configuration settings to each project
4468     # file.  It's almost always wrong to put things here.  Specify your
4469     # custom xcode_settings in target_defaults to add them to targets instead.
4471     'conditions': [
4472       # In an Xcode Project Info window, the "Base SDK for All Configurations"
4473       # setting sets the SDK on a project-wide basis. In order to get the
4474       # configured SDK to show properly in the Xcode UI, SDKROOT must be set
4475       # here at the project level.
4476       ['OS=="mac"', {
4477         'conditions': [
4478           ['mac_sdk_path==""', {
4479             'SDKROOT': 'macosx<(mac_sdk)',  # -isysroot
4480           }, {
4481             'SDKROOT': '<(mac_sdk_path)',  # -isysroot
4482           }],
4483         ],
4484       }],
4485       ['OS=="ios"', {
4486         'conditions': [
4487           ['ios_sdk_path==""', {
4488             'conditions': [
4489               # TODO(justincohen): Ninja only supports simulator for now.
4490               ['"<(GENERATOR)"=="ninja"', {
4491                 'SDKROOT': 'iphonesimulator<(ios_sdk)',  # -isysroot
4492               }, {
4493                 'SDKROOT': 'iphoneos<(ios_sdk)',  # -isysroot
4494               }],
4495             ],
4496           }, {
4497             'SDKROOT': '<(ios_sdk_path)',  # -isysroot
4498           }],
4499         ],
4500       }],
4501       ['OS=="ios"', {
4502         'ARCHS': '$(ARCHS_UNIVERSAL_IPHONE_OS)',
4503         # Just build armv7, until armv7s is correctly tested.
4504         'VALID_ARCHS': 'armv7 i386',
4505         # Target both iPhone and iPad.
4506         'TARGETED_DEVICE_FAMILY': '1,2',
4507       }],
4508       ['target_arch=="x64"', {
4509         'ARCHS': [
4510           'x86_64'
4511          ],
4512       }],
4513     ],
4515     # The Xcode generator will look for an xcode_settings section at the root
4516     # of each dict and use it to apply settings on a file-wide basis.  Most
4517     # settings should not be here, they should be in target-specific
4518     # xcode_settings sections, or better yet, should use non-Xcode-specific
4519     # settings in target dicts.  SYMROOT is a special case, because many other
4520     # Xcode variables depend on it, including variables such as
4521     # PROJECT_DERIVED_FILE_DIR.  When a source group corresponding to something
4522     # like PROJECT_DERIVED_FILE_DIR is added to a project, in order for the
4523     # files to appear (when present) in the UI as actual files and not red
4524     # red "missing file" proxies, the correct path to PROJECT_DERIVED_FILE_DIR,
4525     # and therefore SYMROOT, needs to be set at the project level.
4526     'SYMROOT': '<(DEPTH)/xcodebuild',
4527   },