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