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