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