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