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