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