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