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