2ff9ceb9a849ae6991799611513a98ffa74b86af
[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_ndk_experimental_root%': '<!(cd <(DEPTH) && pwd -P)/third_party/android_tools/ndk_experimental/',
1613             'android_sdk_root%': '<!(cd <(DEPTH) && pwd -P)/third_party/android_tools/sdk/',
1614             'android_host_arch%': '<!(uname -m)',
1615             # Android API-level of the SDK used for compilation.
1616             'android_sdk_version%': '19',
1617             'android_sdk_build_tools_version%': '19.0.0',
1618             'host_os%': "<!(uname -s | sed -e 's/Linux/linux/;s/Darwin/mac/')",
1619           },
1620           # Copy conditionally-set variables out one scope.
1621           'android_ndk_root%': '<(android_ndk_root)',
1622           'android_sdk_root%': '<(android_sdk_root)',
1623           'android_sdk_version%': '<(android_sdk_version)',
1624           'android_stlport_root': '<(android_ndk_root)/sources/cxx-stl/stlport',
1625           'host_os%': '<(host_os)',
1626
1627           'android_sdk%': '<(android_sdk_root)/platforms/android-<(android_sdk_version)',
1628           # Android SDK build tools (e.g. dx, aapt, aidl)
1629           'android_sdk_tools%': '<(android_sdk_root)/build-tools/<(android_sdk_build_tools_version)',
1630
1631           # Android API level 14 is ICS (Android 4.0) which is the minimum
1632           # platform requirement for Chrome on Android, we use it for native
1633           # code compilation.
1634           'conditions': [
1635             ['target_arch == "ia32"', {
1636               'android_app_abi%': 'x86',
1637               'android_gdbserver%': '<(android_ndk_root)/prebuilt/android-x86/gdbserver/gdbserver',
1638               'android_ndk_sysroot%': '<(android_ndk_root)/platforms/android-14/arch-x86',
1639               'android_ndk_lib_dir%': 'usr/lib',
1640               'android_toolchain%': '<(android_ndk_root)/toolchains/x86-4.8/prebuilt/<(host_os)-<(android_host_arch)/bin',
1641             }],
1642             ['target_arch == "x64"', {
1643               'android_app_abi%': 'x86_64',
1644               'android_gdbserver%': '<(android_ndk_experimental_root)/prebuilt/android-x86_64/gdbserver/gdbserver',
1645               'android_ndk_sysroot%': '<(android_ndk_experimental_root)/platforms/android-L/arch-x86_64',
1646               'android_ndk_lib_dir%': 'usr/lib64',
1647               'android_toolchain%': '<(android_ndk_experimental_root)/toolchains/x86_64-4.9/prebuilt/<(host_os)-<(android_host_arch)/bin',
1648               'android_stlport_root': '<(android_ndk_experimental_root)/sources/cxx-stl/stlport',
1649             }],
1650             ['target_arch=="arm"', {
1651               'conditions': [
1652                 ['arm_version<7', {
1653                   'android_app_abi%': 'armeabi',
1654                 }, {
1655                   'android_app_abi%': 'armeabi-v7a',
1656                 }],
1657               ],
1658               'android_gdbserver%': '<(android_ndk_root)/prebuilt/android-arm/gdbserver/gdbserver',
1659               'android_ndk_sysroot%': '<(android_ndk_root)/platforms/android-14/arch-arm',
1660               'android_ndk_lib_dir%': 'usr/lib',
1661               'android_toolchain%': '<(android_ndk_root)/toolchains/arm-linux-androideabi-4.8/prebuilt/<(host_os)-<(android_host_arch)/bin',
1662             }],
1663             ['target_arch == "arm64"', {
1664               'android_app_abi%': 'arm64-v8a',
1665               'android_gdbserver%': '<(android_ndk_experimental_root)/prebuilt/android-arm64/gdbserver/gdbserver',
1666               'android_ndk_sysroot%': '<(android_ndk_experimental_root)/platforms/android-L/arch-arm64',
1667               'android_ndk_lib_dir%': 'usr/lib',
1668               'android_toolchain%': '<(android_ndk_experimental_root)/toolchains/aarch64-linux-android-4.9/prebuilt/<(host_os)-<(android_host_arch)/bin',
1669               'android_stlport_root': '<(android_ndk_experimental_root)/sources/cxx-stl/stlport',
1670             }],
1671             ['target_arch == "mipsel"', {
1672               'android_app_abi%': 'mips',
1673               'android_gdbserver%': '<(android_ndk_root)/prebuilt/android-mips/gdbserver/gdbserver',
1674               'android_ndk_sysroot%': '<(android_ndk_root)/platforms/android-14/arch-mips',
1675               'android_ndk_lib_dir%': 'usr/lib',
1676               'android_toolchain%': '<(android_ndk_root)/toolchains/mipsel-linux-android-4.8/prebuilt/<(host_os)-<(android_host_arch)/bin',
1677             }],
1678           ],
1679         },
1680         # Copy conditionally-set variables out one scope.
1681         'android_app_abi%': '<(android_app_abi)',
1682         'android_gdbserver%': '<(android_gdbserver)',
1683         'android_ndk_root%': '<(android_ndk_root)',
1684         'android_ndk_sysroot%': '<(android_ndk_sysroot)',
1685         'android_sdk_root%': '<(android_sdk_root)',
1686         'android_sdk_version%': '<(android_sdk_version)',
1687         'android_toolchain%': '<(android_toolchain)',
1688
1689         'android_ndk_include': '<(android_ndk_sysroot)/usr/include',
1690         'android_ndk_lib': '<(android_ndk_sysroot)/<(android_ndk_lib_dir)',
1691         'android_sdk_tools%': '<(android_sdk_tools)',
1692         'android_sdk%': '<(android_sdk)',
1693         'android_sdk_jar%': '<(android_sdk)/android.jar',
1694
1695         'android_stlport_root': '<(android_stlport_root)',
1696         'android_stlport_include': '<(android_stlport_root)/stlport',
1697         'android_stlport_libs_dir': '<(android_stlport_root)/libs/<(android_app_abi)',
1698         'host_os%': '<(host_os)',
1699
1700         # Location of the "strip" binary, used by both gyp and scripts.
1701         'android_strip%' : '<!(/bin/echo -n <(android_toolchain)/*-strip)',
1702
1703         # Location of the "readelf" binary.
1704         'android_readelf%' : '<!(/bin/echo -n <(android_toolchain)/*-readelf)',
1705
1706         # Determines whether we should optimize JNI generation at the cost of
1707         # breaking assumptions in the build system that when inputs have changed
1708         # the outputs should always change as well.  This is meant purely for
1709         # developer builds, to avoid spurious re-linking of native files.
1710         'optimize_jni_generation%': 0,
1711
1712         # Always uses openssl.
1713         'use_openssl%': 1,
1714         'use_openssl_certs%': 1,
1715
1716         'proprietary_codecs%': '<(proprietary_codecs)',
1717         'safe_browsing%': 2,
1718         'input_speech%': 0,
1719         'java_bridge%': 1,
1720         'build_ffmpegsumo%': 0,
1721         'use_allocator%': 'none',
1722
1723         # Disable Native Client.
1724         'disable_nacl%': 1,
1725
1726         # Android does not support background apps.
1727         'enable_background%': 0,
1728
1729         # Sessions are store separately in the Java side.
1730         'enable_session_service%': 0,
1731
1732         'p2p_apis%' : 0,
1733
1734         'gtest_target_type%': 'shared_library',
1735
1736         # Uses system APIs for decoding audio and video.
1737         'use_libffmpeg%': '0',
1738
1739         # When building as part of the Android system, use system libraries
1740         # where possible to reduce ROM size.
1741         # TODO(steveblock): Investigate using the system version of sqlite.
1742         'use_system_sqlite%': 0,  # '<(android_webview_build)',
1743         'use_system_expat%': '<(android_webview_build)',
1744         'use_system_icu%': '<(android_webview_build)',
1745         'use_system_stlport%': '<(android_webview_build)',
1746
1747         # Copy it out one scope.
1748         'android_webview_build%': '<(android_webview_build)',
1749       }],  # OS=="android"
1750       ['android_webview_build==1', {
1751         # When building the WebView in the Android tree, jarjar will remap all
1752         # the class names, so the JNI generator needs to know this.
1753         'jni_generator_jarjar_file': '../android_webview/build/jarjar-rules.txt',
1754       }],
1755       ['OS=="mac"', {
1756         'conditions': [
1757           # All Chrome builds have breakpad symbols, but only process the
1758           # symbols from official builds.
1759           ['(branding=="Chrome" and buildtype=="Official")', {
1760             'mac_strip_release%': 1,
1761           }],
1762         ],
1763       }],  # OS=="mac"
1764       ['OS=="mac" or OS=="ios"', {
1765         'clang%': 1,
1766
1767         'variables': {
1768           # Mac OS X SDK and deployment target support.  The SDK identifies
1769           # the version of the system headers that will be used, and
1770           # corresponds to the MAC_OS_X_VERSION_MAX_ALLOWED compile-time
1771           # macro.  "Maximum allowed" refers to the operating system version
1772           # whose APIs are available in the headers.  The deployment target
1773           # identifies the minimum system version that the built products are
1774           # expected to function on.  It corresponds to the
1775           # MAC_OS_X_VERSION_MIN_REQUIRED compile-time macro.  To ensure these
1776           # macros are available, #include <AvailabilityMacros.h>.  Additional
1777           # documentation on these macros is available at
1778           # http://developer.apple.com/mac/library/technotes/tn2002/tn2064.html#SECTION3
1779           # Chrome normally builds with the Mac OS X 10.6 SDK and sets the
1780           # deployment target to 10.6.  Other projects, such as O3D, may
1781           # override these defaults.
1782
1783           # Normally, mac_sdk_min is used to find an SDK that Xcode knows
1784           # about that is at least the specified version. In official builds,
1785           # the SDK must match mac_sdk_min exactly. If the SDK is installed
1786           # someplace that Xcode doesn't know about, set mac_sdk_path to the
1787           # path to the SDK; when set to a non-empty string, SDK detection
1788           # based on mac_sdk_min will be bypassed entirely.
1789           'mac_sdk_min%': '10.6',
1790           'mac_sdk_path%': '',
1791
1792           'mac_deployment_target%': '10.6',
1793         },
1794
1795         'mac_sdk_min': '<(mac_sdk_min)',
1796         'mac_sdk_path': '<(mac_sdk_path)',
1797         'mac_deployment_target': '<(mac_deployment_target)',
1798
1799         # Compile in Breakpad support by default so that it can be
1800         # tested, even if it is not enabled by default at runtime.
1801         'mac_breakpad_compiled_in%': 1,
1802         'conditions': [
1803           # mac_product_name is set to the name of the .app bundle as it should
1804           # appear on disk.  This duplicates data from
1805           # chrome/app/theme/chromium/BRANDING and
1806           # chrome/app/theme/google_chrome/BRANDING, but is necessary to get
1807           # these names into the build system.
1808           ['branding=="Chrome"', {
1809             'mac_product_name%': 'Google Chrome',
1810           }, { # else: branding!="Chrome"
1811             'mac_product_name%': 'Chromium',
1812           }],
1813
1814           ['branding=="Chrome" and buildtype=="Official"', {
1815             'mac_sdk%': '<!(python <(DEPTH)/build/mac/find_sdk.py --verify <(mac_sdk_min) --sdk_path=<(mac_sdk_path))',
1816             # Enable uploading crash dumps.
1817             'mac_breakpad_uploads%': 1,
1818             # Enable dumping symbols at build time for use by Mac Breakpad.
1819             'mac_breakpad%': 1,
1820             # Enable Keystone auto-update support.
1821             'mac_keystone%': 1,
1822           }, { # else: branding!="Chrome" or buildtype!="Official"
1823             'mac_sdk%': '<!(python <(DEPTH)/build/mac/find_sdk.py <(mac_sdk_min))',
1824             'mac_breakpad_uploads%': 0,
1825             'mac_breakpad%': 0,
1826             'mac_keystone%': 0,
1827           }],
1828         ],
1829       }],  # OS=="mac" or OS=="ios"
1830       ['OS=="win"', {
1831         'conditions': [
1832           # This is the architecture convention used in WinSDK paths.
1833           ['target_arch=="ia32"', {
1834             'winsdk_arch%': 'x86',
1835           },{
1836             'winsdk_arch%': '<(target_arch)',
1837           }],
1838           ['component=="shared_library"', {
1839             'win_use_allocator_shim%': 0,
1840           },{
1841             # Turn on multiple dll by default on Windows when in static_library.
1842             'chrome_multiple_dll%': 1,
1843           }],
1844           ['asan==1', {
1845             'win_use_allocator_shim%': 0,
1846           }],
1847           ['component=="shared_library" and "<(GENERATOR)"=="ninja"', {
1848             # Only enabled by default for ninja because it's buggy in VS.
1849             # Not enabled for component=static_library because some targets
1850             # are too large and the toolchain fails due to the size of the
1851             # .obj files.
1852             'incremental_chrome_dll%': 1,
1853           }],
1854           # Don't do incremental linking for large modules on 32-bit or when
1855           # component=static_library as the toolchain fails due to the size of
1856           # the .ilk files.
1857           ['MSVS_OS_BITS==32 or component=="static_library"', {
1858             'msvs_large_module_debug_link_mode%': '1',  # No
1859           },{
1860             'msvs_large_module_debug_link_mode%': '2',  # Yes
1861           }],
1862           ['MSVS_VERSION=="2013e"', {
1863             'msvs_express%': 1,
1864             'secure_atl%': 0,
1865           },{
1866             'msvs_express%': 0,
1867             'secure_atl%': 1,
1868           }],
1869         ],
1870         'nacl_win64_defines': [
1871           # This flag is used to minimize dependencies when building
1872           # Native Client loader for 64-bit Windows.
1873           'NACL_WIN64',
1874         ],
1875       }],
1876
1877       ['os_posix==1 and chromeos==0 and OS!="android" and OS!="ios"', {
1878         'use_cups%': 1,
1879       }, {
1880         'use_cups%': 0,
1881       }],
1882
1883       ['enable_plugins==1 and (OS=="linux" or OS=="mac" or OS=="win")', {
1884         'enable_pepper_cdms%': 1,
1885       }, {
1886         'enable_pepper_cdms%': 0,
1887       }],
1888
1889       ['OS=="android"', {
1890         'enable_browser_cdms%': 1,
1891       }, {
1892         'enable_browser_cdms%': 0,
1893       }],
1894
1895       # Native Client glibc toolchain is enabled
1896       # by default except on arm and mips.
1897       ['target_arch=="arm" or target_arch=="mipsel"', {
1898         'disable_glibc%': 1,
1899       }, {
1900         'disable_glibc%': 0,
1901       }],
1902
1903       # Set the relative path from this file to the GYP file of the JPEG
1904       # library used by Chromium.
1905       ['use_system_libjpeg==1 or use_libjpeg_turbo==0', {
1906         # Configuration for using the system libjeg is here.
1907         'libjpeg_gyp_path': '../third_party/libjpeg/libjpeg.gyp',
1908       }, {
1909         'libjpeg_gyp_path': '../third_party/libjpeg_turbo/libjpeg.gyp',
1910       }],
1911
1912       # Options controlling the use of GConf (the classic GNOME configuration
1913       # system) and GIO, which contains GSettings (the new GNOME config system).
1914       ['chromeos==1 or embedded==1', {
1915         'use_gconf%': 0,
1916         'use_gio%': 0,
1917       }, {
1918         'use_gconf%': 1,
1919         'use_gio%': 1,
1920       }],
1921
1922       # Set up -D and -E flags passed into grit.
1923       ['branding=="Chrome"', {
1924         # TODO(mmoss) The .grd files look for _google_chrome, but for
1925         # consistency they should look for google_chrome_build like C++.
1926         'grit_defines': ['-D', '_google_chrome',
1927                          '-E', 'CHROMIUM_BUILD=google_chrome'],
1928       }, {
1929         'grit_defines': ['-D', '_chromium',
1930                          '-E', 'CHROMIUM_BUILD=chromium'],
1931       }],
1932       ['chromeos==1', {
1933         'grit_defines': ['-D', 'chromeos', '-D', 'scale_factors=2x'],
1934       }],
1935       ['desktop_linux==1', {
1936         'grit_defines': ['-D', 'desktop_linux'],
1937       }],
1938       ['toolkit_views==1', {
1939         'grit_defines': ['-D', 'toolkit_views'],
1940       }],
1941       ['use_aura==1', {
1942         'grit_defines': ['-D', 'use_aura'],
1943       }],
1944       ['use_ash==1', {
1945         'grit_defines': ['-D', 'use_ash'],
1946       }],
1947       ['use_nss==1', {
1948         'grit_defines': ['-D', 'use_nss'],
1949       }],
1950       ['use_ozone==1', {
1951         'grit_defines': ['-D', 'use_ozone'],
1952       }],
1953       ['image_loader_extension==1', {
1954         'grit_defines': ['-D', 'image_loader_extension'],
1955       }],
1956       ['remoting==1', {
1957         'grit_defines': ['-D', 'remoting'],
1958       }],
1959       ['use_titlecase_in_grd_files==1', {
1960         'grit_defines': ['-D', 'use_titlecase'],
1961       }],
1962       ['use_third_party_translations==1', {
1963         'grit_defines': ['-D', 'use_third_party_translations'],
1964         'locales': [
1965           'ast', 'bs', 'ca@valencia', 'en-AU', 'eo', 'eu', 'gl', 'hy', 'ia',
1966           'ka', 'ku', 'kw', 'ms', 'ug'
1967         ],
1968       }],
1969       ['OS=="android"', {
1970         'grit_defines': ['-t', 'android',
1971                          '-E', 'ANDROID_JAVA_TAGGED_ONLY=true'],
1972       }],
1973       ['OS=="mac" or OS=="ios"', {
1974         'grit_defines': ['-D', 'scale_factors=2x'],
1975       }],
1976       ['OS == "ios"', {
1977         'grit_defines': [
1978           '-t', 'ios',
1979           # iOS uses a whitelist to filter resources.
1980           '-w', '<(DEPTH)/build/ios/grit_whitelist.txt'
1981         ],
1982
1983         # Enable host builds when generating with ninja-ios.
1984         'conditions': [
1985           ['"<(GENERATOR)"=="ninja"', {
1986             'host_os%': "mac",
1987           }],
1988
1989           # TODO(sdefresne): Remove the target_subarch check once Apple has
1990           # upstreamed the support for "arm64". http://crbug.com/341453
1991           ['target_subarch!="arm32" or "<(GENERATOR)"=="xcode"', {
1992             'clang_xcode%': 1,
1993           }],
1994         ],
1995       }],
1996       ['enable_extensions==1', {
1997         'grit_defines': ['-D', 'enable_extensions'],
1998       }],
1999       ['enable_plugins!=0', {
2000         'grit_defines': ['-D', 'enable_plugins'],
2001       }],
2002       ['enable_printing!=0', {
2003         'grit_defines': ['-D', 'enable_printing'],
2004       }],
2005       ['enable_printing==1', {
2006         'grit_defines': ['-D', 'enable_full_printing'],
2007       }],
2008       ['enable_themes==1', {
2009         'grit_defines': ['-D', 'enable_themes'],
2010       }],
2011       ['enable_app_list==1', {
2012         'grit_defines': ['-D', 'enable_app_list'],
2013       }],
2014       ['enable_settings_app==1', {
2015         'grit_defines': ['-D', 'enable_settings_app'],
2016       }],
2017       ['enable_google_now==1', {
2018         'grit_defines': ['-D', 'enable_google_now'],
2019       }],
2020       ['use_concatenated_impulse_responses==1', {
2021         'grit_defines': ['-D', 'use_concatenated_impulse_responses'],
2022       }],
2023       ['enable_webrtc==1', {
2024         'grit_defines': ['-D', 'enable_webrtc'],
2025       }],
2026       ['enable_hangout_services_extension==1', {
2027         'grit_defines': ['-D', 'enable_hangout_services_extension'],
2028       }],
2029       ['enable_task_manager==1', {
2030         'grit_defines': ['-D', 'enable_task_manager'],
2031       }],
2032       ['notifications==1', {
2033         'grit_defines': ['-D', 'enable_notifications'],
2034       }],
2035       ['enable_wifi_bootstrapping==1', {
2036         'grit_defines': ['-D', 'enable_wifi_bootstrapping'],
2037       }],
2038       ['enable_resource_whitelist_generation==1 and OS!="win"', {
2039         'grit_rc_header_format': ['-h', '#define {textual_id} _Pragma("whitelisted_resource_{numeric_id}") {numeric_id}'],
2040       }],
2041       ['enable_resource_whitelist_generation==1 and OS=="win"', {
2042         'grit_rc_header_format': ['-h', '#define {textual_id} __pragma(message("whitelisted_resource_{numeric_id}")) {numeric_id}'],
2043       }],
2044       ['enable_mdns==1 or OS=="mac"', {
2045         'grit_defines': ['-D', 'enable_service_discovery'],
2046         'enable_service_discovery%': 1
2047       }],
2048       ['clang_use_chrome_plugins==1 and OS!="win"', {
2049         'clang_chrome_plugins_flags': [
2050           '<!@(<(DEPTH)/tools/clang/scripts/plugin_flags.sh)'
2051         ],
2052       }],
2053
2054       ['asan==1 or msan==1 or lsan==1 or tsan==1', {
2055         'clang%': 1,
2056         'use_allocator%': 'none',
2057       }],
2058       ['ubsan==1', {
2059         'clang%': 1,
2060       }],
2061       ['asan==1 and OS=="mac"', {
2062         # TODO(glider): we do not strip ASan binaries until the dynamic ASan
2063         # runtime is fully adopted. See http://crbug.com/242503.
2064         'mac_strip_release': 0,
2065       }],
2066       ['tsan==1', {
2067         'use_custom_libcxx%': 1,
2068       }],
2069       ['msan==1', {
2070         # Use a just-built, MSan-instrumented libc++ instead of the system-wide
2071         # libstdc++. This is required to avoid false positive reports whenever
2072         # the C++ standard library is used.
2073         'use_custom_libcxx%': 1,
2074         # Running the V8-generated code on an ARM simulator is a powerful hack
2075         # that allows the tool to see the memory accesses from JITted code.
2076         # Without this flag, JS code causes false positive reports from MSan.
2077         'v8_target_arch': 'arm64',
2078       }],
2079
2080       ['OS=="linux" and clang_type_profiler==1', {
2081         'clang%': 1,
2082         'clang_use_chrome_plugins%': 0,
2083         'conditions': [
2084           ['host_arch=="x64"', {
2085             'make_clang_dir%': 'third_party/llvm-allocated-type/Linux_x64',
2086           }],
2087           ['host_arch=="ia32"', {
2088             # 32-bit Clang is unsupported.  It may not build.  Put your 32-bit
2089             # Clang in this directory at your own risk if needed for some
2090             # purpose (e.g. to compare 32-bit and 64-bit behavior like memory
2091             # usage).  Any failure by this compiler should not close the tree.
2092             'make_clang_dir%': 'third_party/llvm-allocated-type/Linux_ia32',
2093           }],
2094         ],
2095       }],
2096
2097       ['OS=="win"', {
2098         # The Clang plugins don't currently work on Windows.
2099         # TODO(hans): One day, this will work. (crbug.com/82385)
2100         'clang_use_chrome_plugins%': 0,
2101       }],
2102
2103       # On valgrind bots, override the optimizer settings so we don't inline too
2104       # much and make the stacks harder to figure out.
2105       #
2106       # TODO(rnk): Kill off variables that no one else uses and just implement
2107       # them under a build_for_tool== condition.
2108       ['build_for_tool=="memcheck" or build_for_tool=="tsan"', {
2109         # gcc flags
2110         'mac_debug_optimization': '1',
2111         'mac_release_optimization': '1',
2112         'release_optimize': '1',
2113         'no_gc_sections': 1,
2114         'debug_extra_cflags': '-g -fno-inline -fno-omit-frame-pointer '
2115                               '-fno-builtin -fno-optimize-sibling-calls',
2116         'release_extra_cflags': '-g -fno-inline -fno-omit-frame-pointer '
2117                                 '-fno-builtin -fno-optimize-sibling-calls',
2118
2119         # MSVS flags for TSan on Pin and Windows.
2120         'win_debug_RuntimeChecks': '0',
2121         'win_debug_disable_iterator_debugging': '1',
2122         'win_debug_Optimization': '1',
2123         'win_debug_InlineFunctionExpansion': '0',
2124         'win_release_InlineFunctionExpansion': '0',
2125         'win_release_OmitFramePointers': '0',
2126
2127         'use_allocator': 'tcmalloc',
2128         'release_valgrind_build': 1,
2129         'werror': '',
2130         'component': 'static_library',
2131         'use_system_zlib': 0,
2132       }],
2133
2134       # Build tweaks for DrMemory.
2135       # TODO(rnk): Combine with tsan config to share the builder.
2136       # http://crbug.com/108155
2137       ['build_for_tool=="drmemory"', {
2138         # These runtime checks force initialization of stack vars which blocks
2139         # DrMemory's uninit detection.
2140         'win_debug_RuntimeChecks': '0',
2141         # Iterator debugging is slow.
2142         'win_debug_disable_iterator_debugging': '1',
2143         # Try to disable optimizations that mess up stacks in a release build.
2144         # DrM-i#1054 (http://code.google.com/p/drmemory/issues/detail?id=1054)
2145         # /O2 and /Ob0 (disable inline) cannot be used together because of a
2146         # compiler bug, so we use /Ob1 instead.
2147         'win_release_InlineFunctionExpansion': '1',
2148         'win_release_OmitFramePointers': '0',
2149         # Ditto for debug, to support bumping win_debug_Optimization.
2150         'win_debug_InlineFunctionExpansion': 0,
2151         'win_debug_OmitFramePointers': 0,
2152         # Keep the code under #ifndef NVALGRIND.
2153         'release_valgrind_build': 1,
2154       }],
2155
2156       # Enable RLZ on Win, Mac, iOS and ChromeOS.
2157       ['branding=="Chrome" and (OS=="win" or OS=="mac" or OS=="ios" or chromeos==1)', {
2158         'enable_rlz%': 1,
2159       }],
2160
2161       # Set default compiler flags depending on ARM version.
2162       ['arm_version==6 and android_webview_build==0', {
2163         'arm_arch%': 'armv6',
2164         'arm_tune%': '',
2165         'arm_fpu%': 'vfp',
2166         'arm_float_abi%': 'softfp',
2167         'arm_thumb%': 0,
2168       }],
2169       ['arm_version==7 and android_webview_build==0', {
2170         'arm_arch%': 'armv7-a',
2171         'arm_tune%': 'generic-armv7-a',
2172         'conditions': [
2173           ['arm_neon==1', {
2174             'arm_fpu%': 'neon',
2175           }, {
2176             'arm_fpu%': 'vfpv3-d16',
2177           }],
2178         ],
2179         # Change the default to hard once the armhf transition is complete.
2180         'arm_float_abi%': 'softfp',
2181         'arm_thumb%': 1,
2182       }],
2183
2184       ['android_webview_build==1', {
2185         # The WebView build gets its cpu-specific flags from the Android build system.
2186         'arm_arch%': '',
2187         'arm_tune%': '',
2188         'arm_fpu%': '',
2189         'arm_float_abi%': '',
2190         'arm_thumb%': 0,
2191       }],
2192
2193       # Enable brlapi by default for chromeos.
2194       [ 'chromeos==1', {
2195         'use_brlapi%': 1,
2196       }],
2197
2198       ['use_ozone==1 and ozone_auto_platforms==1', {
2199         # Use test as the default platform.
2200         'ozone_platform%': 'test',
2201
2202         # Build all platforms whose deps are in install-build-deps.sh.
2203         # Only these platforms will be compile tested by buildbots.
2204         'ozone_platform_dri%': 1,
2205         'ozone_platform_test%': 1,
2206         'ozone_platform_egltest%': 1,
2207       }],
2208
2209       ['use_ozone==1 and ozone_auto_platforms==1 and chromeos==1', {
2210         # Use dri as the default platform.
2211         'ozone_platform%': 'dri',
2212       }],
2213
2214       ['desktop_linux==1 and use_aura==1 and use_x11==1', {
2215         'use_clipboard_aurax11%': 1,
2216       }],
2217
2218       ['OS=="win" and use_goma==1', {
2219         # goma doesn't support pch yet.
2220         'chromium_win_pch': 0,
2221         # goma doesn't support PDB yet, so win_z7=1 or fastbuild=1.
2222         'conditions': [
2223           ['win_z7==0', {
2224             'fastbuild': 1,
2225           }],
2226         ],
2227       }],
2228
2229       ['OS=="win" and (clang==1 or asan==1)', {
2230         'chromium_win_pch': 0,
2231       }],
2232
2233       # The seccomp-bpf sandbox is only supported on three architectures
2234       # currently.
2235       # Do not disable seccomp_bpf anywhere without talking to
2236       # security@chromium.org!
2237       ['((OS=="linux" or OS=="android") and '
2238            '(target_arch=="ia32" or target_arch=="x64" or '
2239              'target_arch=="arm"))', {
2240          'use_seccomp_bpf%': 1,
2241       }, {
2242          'use_seccomp_bpf%': 0,
2243       }],
2244     ],
2245
2246     # The path to the ANGLE library.
2247     'angle_path': '<(DEPTH)/third_party/angle',
2248
2249     # List of default apps to install in new profiles.  The first list contains
2250     # the source files as found in svn.  The second list, used only for linux,
2251     # contains the destination location for each of the files.  When a crx
2252     # is added or removed from the list, the chrome/browser/resources/
2253     # default_apps/external_extensions.json file must also be updated.
2254     'default_apps_list': [
2255       'browser/resources/default_apps/external_extensions.json',
2256       'browser/resources/default_apps/gmail.crx',
2257       'browser/resources/default_apps/search.crx',
2258       'browser/resources/default_apps/youtube.crx',
2259       'browser/resources/default_apps/drive.crx',
2260       'browser/resources/default_apps/docs.crx',
2261     ],
2262     'default_apps_list_linux_dest': [
2263       '<(PRODUCT_DIR)/default_apps/external_extensions.json',
2264       '<(PRODUCT_DIR)/default_apps/gmail.crx',
2265       '<(PRODUCT_DIR)/default_apps/search.crx',
2266       '<(PRODUCT_DIR)/default_apps/youtube.crx',
2267       '<(PRODUCT_DIR)/default_apps/drive.crx',
2268       '<(PRODUCT_DIR)/default_apps/docs.crx',
2269     ],
2270   },
2271   'target_defaults': {
2272     'variables': {
2273       # The condition that operates on chromium_code is in a target_conditions
2274       # section, and will not have access to the default fallback value of
2275       # chromium_code at the top of this file, or to the chromium_code
2276       # variable placed at the root variables scope of .gyp files, because
2277       # those variables are not set at target scope.  As a workaround,
2278       # if chromium_code is not set at target scope, define it in target scope
2279       # to contain whatever value it has during early variable expansion.
2280       # That's enough to make it available during target conditional
2281       # processing.
2282       'chromium_code%': '<(chromium_code)',
2283
2284       'component%': '<(component)',
2285
2286       # See http://msdn.microsoft.com/en-us/library/aa652360(VS.71).aspx
2287       'win_release_Optimization%': '2', # 2 = /Os
2288       'win_debug_Optimization%': '0',   # 0 = /Od
2289
2290       # See http://msdn.microsoft.com/en-us/library/2kxx5t2c(v=vs.80).aspx
2291       # Tri-state: blank is default, 1 on, 0 off
2292       'win_release_OmitFramePointers%': '0',
2293       # Tri-state: blank is default, 1 on, 0 off
2294       'win_debug_OmitFramePointers%': '',
2295
2296       # See http://msdn.microsoft.com/en-us/library/8wtf2dfz(VS.71).aspx
2297       'win_debug_RuntimeChecks%': '3',    # 3 = all checks enabled, 0 = off
2298
2299       # See http://msdn.microsoft.com/en-us/library/47238hez(VS.71).aspx
2300       'win_debug_InlineFunctionExpansion%': '',    # empty = default, 0 = off,
2301       'win_release_InlineFunctionExpansion%': '2', # 1 = only __inline, 2 = max
2302
2303       # VS inserts quite a lot of extra checks to algorithms like
2304       # std::partial_sort in Debug build which make them O(N^2)
2305       # instead of O(N*logN). This is particularly slow under memory
2306       # tools like ThreadSanitizer so we want it to be disablable.
2307       # See http://msdn.microsoft.com/en-us/library/aa985982(v=VS.80).aspx
2308       'win_debug_disable_iterator_debugging%': '0',
2309
2310       # An application manifest fragment to declare compatibility settings for
2311       # 'executable' targets. Ignored in other target type.
2312       'win_exe_compatibility_manifest%':
2313           '<(DEPTH)\\build\\win\\compatibility.manifest',
2314
2315       'release_extra_cflags%': '',
2316       'debug_extra_cflags%': '',
2317
2318       'release_valgrind_build%': '<(release_valgrind_build)',
2319
2320       # the non-qualified versions are widely assumed to be *nix-only
2321       'win_release_extra_cflags%': '',
2322       'win_debug_extra_cflags%': '',
2323
2324       # TODO(thakis): Make this a blacklist instead, http://crbug.com/101600
2325       'enable_wexit_time_destructors%': '<(enable_wexit_time_destructors)',
2326
2327       # Only used by Windows build for now.  Can be used to build into a
2328       # differet output directory, e.g., a build_dir_prefix of VS2010_ would
2329       # output files in src/build/VS2010_{Debug,Release}.
2330       'build_dir_prefix%': '',
2331
2332       # Targets are by default not nacl untrusted code.
2333       'nacl_untrusted_build%': 0,
2334
2335       'pnacl_compile_flags': [
2336         # pnacl uses the clang compiler so we need to suppress all the
2337         # same warnings as we do for clang.
2338         # TODO(sbc): Remove these if/when they are removed from the clang
2339         # build.
2340         '-Wno-unused-function',
2341         '-Wno-char-subscripts',
2342         '-Wno-c++11-extensions',
2343         '-Wno-unnamed-type-template-args',
2344       ],
2345
2346       'conditions': [
2347         ['OS=="win" and component=="shared_library"', {
2348           # See http://msdn.microsoft.com/en-us/library/aa652367.aspx
2349           'win_release_RuntimeLibrary%': '2', # 2 = /MD (nondebug DLL)
2350           'win_debug_RuntimeLibrary%': '3',   # 3 = /MDd (debug DLL)
2351         }, {
2352           # See http://msdn.microsoft.com/en-us/library/aa652367.aspx
2353           'win_release_RuntimeLibrary%': '0', # 0 = /MT (nondebug static)
2354           'win_debug_RuntimeLibrary%': '1',   # 1 = /MTd (debug static)
2355         }],
2356         ['OS=="ios"', {
2357           # See http://gcc.gnu.org/onlinedocs/gcc-4.4.2/gcc/Optimize-Options.html
2358           'mac_release_optimization%': 's', # Use -Os unless overridden
2359           'mac_debug_optimization%': '0',   # Use -O0 unless overridden
2360         }, {
2361           # See http://gcc.gnu.org/onlinedocs/gcc-4.4.2/gcc/Optimize-Options.html
2362           'mac_release_optimization%': '3', # Use -O3 unless overridden
2363           'mac_debug_optimization%': '0',   # Use -O0 unless overridden
2364         }],
2365         ['OS=="android"', {
2366           'host_os%': '<(host_os)',  # See comment above chromium_code.
2367         }],
2368       ],
2369     },
2370     'defines': [
2371       # Don't use deprecated V8 APIs anywhere.
2372       'V8_DEPRECATION_WARNINGS',
2373       # Temporary suppression until Blink code can be removed.
2374       'BLINK_SCALE_FILTERS_AT_RECORD_TIME',
2375     ],
2376     'include_dirs': [
2377       '<(SHARED_INTERMEDIATE_DIR)',
2378     ],
2379     'conditions': [
2380       ['(OS=="mac" or OS=="ios") and asan==1', {
2381         'dependencies': [
2382           '<(DEPTH)/build/mac/asan.gyp:asan_dynamic_runtime',
2383         ],
2384       }],
2385       ['OS=="linux" and use_allocator!="none" and clang_type_profiler==1', {
2386         'cflags_cc!': ['-fno-rtti'],
2387         'cflags_cc+': [
2388           '-frtti',
2389           '-gline-tables-only',
2390           '-fintercept-allocation-functions',
2391         ],
2392         'defines': ['TYPE_PROFILING'],
2393         'dependencies': [
2394           '<(DEPTH)/base/allocator/allocator.gyp:type_profiler',
2395         ],
2396       }],
2397       ['OS=="linux" and clang==1 and host_arch=="ia32"', {
2398         # TODO(dmikurube): Remove -Wno-sentinel when Clang/LLVM is fixed.
2399         # See http://crbug.com/162818.
2400         'cflags+': ['-Wno-sentinel'],
2401       }],
2402       ['branding=="Chrome"', {
2403         'defines': ['GOOGLE_CHROME_BUILD'],
2404       }, {  # else: branding!="Chrome"
2405         'defines': ['CHROMIUM_BUILD'],
2406       }],
2407       ['OS=="mac" and component=="shared_library"', {
2408         'xcode_settings': {
2409           'DYLIB_INSTALL_NAME_BASE': '@rpath',
2410           'LD_RUNPATH_SEARCH_PATHS': [
2411             # For unbundled binaries.
2412             '@loader_path/.',
2413             # For bundled binaries, to get back from Binary.app/Contents/MacOS.
2414             '@loader_path/../../..',
2415           ],
2416         },
2417       }],
2418       ['clang==1 and OS!="win"', {
2419         # This is here so that all files get recompiled after a clang roll and
2420         # when turning clang on or off.
2421         # (defines are passed via the command line, and build systems rebuild
2422         # things when their commandline changes). Nothing should ever read this
2423         # define.
2424         'defines': ['CR_CLANG_REVISION=<!(<(DEPTH)/tools/clang/scripts/update.sh --print-revision)'],
2425       }],
2426       ['enable_rlz==1', {
2427         'defines': ['ENABLE_RLZ'],
2428       }],
2429       ['component=="shared_library"', {
2430         'defines': ['COMPONENT_BUILD'],
2431       }],
2432       ['toolkit_views==1', {
2433         'defines': ['TOOLKIT_VIEWS=1'],
2434       }],
2435       ['ui_compositor_image_transport==1', {
2436         'defines': ['UI_COMPOSITOR_IMAGE_TRANSPORT'],
2437       }],
2438       ['use_aura==1', {
2439         'defines': ['USE_AURA=1'],
2440       }],
2441       ['use_ash==1', {
2442         'defines': ['USE_ASH=1'],
2443       }],
2444       ['use_cairo==1', {
2445         'defines': ['USE_CAIRO=1'],
2446       }],
2447       ['use_cras==1', {
2448         'defines': ['USE_CRAS=1'],
2449       }],
2450       ['use_glib==1', {
2451         'defines': ['USE_GLIB=1'],
2452       }],
2453       ['use_ozone==1', {
2454         'defines': ['USE_OZONE=1'],
2455       }],
2456       ['use_default_render_theme==1', {
2457         'defines': ['USE_DEFAULT_RENDER_THEME=1'],
2458       }],
2459       ['use_libjpeg_turbo==1', {
2460         'defines': ['USE_LIBJPEG_TURBO=1'],
2461       }],
2462       ['use_x11==1', {
2463         'defines': ['USE_X11=1'],
2464       }],
2465       ['use_clipboard_aurax11==1', {
2466         'defines': ['USE_CLIPBOARD_AURAX11=1'],
2467       }],
2468       ['enable_one_click_signin==1', {
2469         'defines': ['ENABLE_ONE_CLICK_SIGNIN'],
2470       }],
2471       ['enable_pre_sync_backup==1', {
2472         'defines': ['ENABLE_PRE_SYNC_BACKUP'],
2473       }],
2474       ['use_xi2_mt!=0 and use_x11==1', {
2475         'defines': ['USE_XI2_MT=<(use_xi2_mt)'],
2476       }],
2477       ['image_loader_extension==1', {
2478         'defines': ['IMAGE_LOADER_EXTENSION=1'],
2479       }],
2480       ['profiling==1', {
2481         'defines': ['ENABLE_PROFILING=1'],
2482       }],
2483       ['remoting==1', {
2484         'defines': ['ENABLE_REMOTING=1'],
2485       }],
2486       ['enable_webrtc==1', {
2487         'defines': ['ENABLE_WEBRTC=1'],
2488       }],
2489       ['proprietary_codecs==1', {
2490         'defines': ['USE_PROPRIETARY_CODECS'],
2491       }],
2492       ['enable_viewport==1', {
2493         'defines': ['ENABLE_VIEWPORT'],
2494       }],
2495       ['enable_pepper_cdms==1', {
2496         'defines': ['ENABLE_PEPPER_CDMS'],
2497       }],
2498       ['enable_browser_cdms==1', {
2499         'defines': ['ENABLE_BROWSER_CDMS'],
2500       }],
2501       ['configuration_policy==1', {
2502         'defines': ['ENABLE_CONFIGURATION_POLICY'],
2503       }],
2504       ['notifications==1', {
2505         'defines': ['ENABLE_NOTIFICATIONS'],
2506       }],
2507       ['enable_hidpi==1', {
2508         'defines': ['ENABLE_HIDPI=1'],
2509       }],
2510       ['native_discardable_memory==1', {
2511         'defines': ['DISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY'],
2512       }],
2513       ['native_memory_pressure_signals==1', {
2514         'defines': ['SYSTEM_NATIVELY_SIGNALS_MEMORY_PRESSURE'],
2515       }],
2516       ['use_udev==1', {
2517         'defines': ['USE_UDEV'],
2518       }],
2519       ['fastbuild!=0', {
2520         'xcode_settings': {
2521           'GCC_GENERATE_DEBUGGING_SYMBOLS': 'NO',
2522         },
2523         'conditions': [
2524           ['clang==1 and asan==0 and msan==0 and tsan==0', {
2525             # Clang creates chubby debug information, which makes linking very
2526             # slow. For now, don't create debug information with clang.  See
2527             # http://crbug.com/70000
2528             'conditions': [
2529               ['OS=="linux"', {
2530                 'variables': {
2531                   'debug_extra_cflags': '-g0',
2532                 },
2533               }],
2534               # Android builds symbols on release by default, disable them.
2535               ['OS=="android"', {
2536                 'variables': {
2537                   'debug_extra_cflags': '-g0',
2538                   'release_extra_cflags': '-g0',
2539                 },
2540               }],
2541             ],
2542           }, { # else clang!=1
2543             'conditions': [
2544               ['OS=="win" and fastbuild==2', {
2545                 # Completely disable debug information.
2546                 'msvs_settings': {
2547                   'VCLinkerTool': {
2548                     'GenerateDebugInformation': 'false',
2549                   },
2550                   'VCCLCompilerTool': {
2551                     'DebugInformationFormat': '0',
2552                   },
2553                 },
2554               }],
2555               ['OS=="win" and fastbuild==1', {
2556                 'msvs_settings': {
2557                   'VCLinkerTool': {
2558                     # This tells the linker to generate .pdbs, so that
2559                     # we can get meaningful stack traces.
2560                     'GenerateDebugInformation': 'true',
2561                   },
2562                   'VCCLCompilerTool': {
2563                     # No debug info to be generated by compiler.
2564                     'DebugInformationFormat': '0',
2565                   },
2566                 },
2567               }],
2568               ['OS=="linux" and fastbuild==2', {
2569                 'variables': {
2570                   'debug_extra_cflags': '-g0',
2571                 },
2572               }],
2573               ['OS=="linux" and fastbuild==1', {
2574                 'variables': {
2575                   'debug_extra_cflags': '-g1',
2576                 },
2577               }],
2578               ['OS=="android" and fastbuild==2', {
2579                 'variables': {
2580                   'debug_extra_cflags': '-g0',
2581                   'release_extra_cflags': '-g0',
2582                 },
2583               }],
2584               ['OS=="android" and fastbuild==1', {
2585                 'variables': {
2586                   'debug_extra_cflags': '-g1',
2587                   'release_extra_cflags': '-g1',
2588                 },
2589               }],
2590             ],
2591           }], # clang!=1
2592         ],
2593       }],  # fastbuild!=0
2594       ['dont_embed_build_metadata==1', {
2595         'defines': [
2596           'DONT_EMBED_BUILD_METADATA',
2597         ],
2598       }],  # dont_embed_build_metadata==1
2599       ['dcheck_always_on!=0', {
2600         'defines': ['DCHECK_ALWAYS_ON=1'],
2601       }],  # dcheck_always_on!=0
2602       ['tracing_like_official_build!=0', {
2603         'defines': ['TRACING_IS_OFFICIAL_BUILD=1'],
2604       }],  # tracing_like_official_build!=0
2605       ['win_use_allocator_shim==0', {
2606         'conditions': [
2607           ['OS=="win"', {
2608             'defines': ['NO_TCMALLOC'],
2609           }],
2610         ],
2611       }],
2612       ['enable_eglimage==1', {
2613         'defines': [
2614           'ENABLE_EGLIMAGE=1',
2615         ],
2616       }],
2617       ['asan==1', {
2618         'defines': [
2619           'ADDRESS_SANITIZER',
2620           'MEMORY_TOOL_REPLACES_ALLOCATOR',
2621         ],
2622       }],
2623       ['syzyasan==1', {
2624         # SyzyAsan needs /PROFILE turned on to produce appropriate pdbs.
2625         'msvs_settings': {
2626           'VCLinkerTool': {
2627             'Profile': 'true',
2628           },
2629         },
2630         'defines': [
2631             'SYZYASAN',
2632             'MEMORY_TOOL_REPLACES_ALLOCATOR',
2633         ],
2634       }],
2635       ['OS=="win"', {
2636         'defines': [
2637           '__STD_C',
2638           '_CRT_SECURE_NO_DEPRECATE',
2639           '_SCL_SECURE_NO_DEPRECATE',
2640           # This define is required to pull in the new Win8 interfaces from
2641           # system headers like ShObjIdl.h.
2642           'NTDDI_VERSION=0x06020000',
2643           # This is required for ATL to use XP-safe versions of its functions.
2644           '_USING_V110_SDK71_',
2645         ],
2646         'include_dirs': [
2647           '<(DEPTH)/third_party/wtl/include',
2648         ],
2649         'conditions': [
2650           ['win_z7!=0', {
2651             'msvs_settings': {
2652               # Generates debug info when win_z7=1
2653               # even if fastbuild=1 (that makes GenerateDebugInformation false).
2654               'VCLinkerTool': {
2655                 'GenerateDebugInformation': 'true',
2656               },
2657               'VCCLCompilerTool': {
2658                 'DebugInformationFormat': '1',
2659               }
2660             }
2661           }],
2662         ],  # win_z7!=0
2663       }],  # OS==win
2664       ['enable_task_manager==1', {
2665         'defines': [
2666           'ENABLE_TASK_MANAGER=1',
2667         ],
2668       }],
2669       ['enable_extensions==1', {
2670         'defines': [
2671           'ENABLE_EXTENSIONS=1',
2672         ],
2673       }],
2674       ['OS=="win" and branding=="Chrome"', {
2675         'defines': ['ENABLE_SWIFTSHADER'],
2676       }],
2677       ['enable_dart==1', {
2678         'defines': ['WEBKIT_USING_DART=1'],
2679       }],
2680       ['enable_plugin_installation==1', {
2681         'defines': ['ENABLE_PLUGIN_INSTALLATION=1'],
2682       }],
2683       ['enable_plugins==1', {
2684         'defines': ['ENABLE_PLUGINS=1'],
2685       }],
2686       ['enable_session_service==1', {
2687         'defines': ['ENABLE_SESSION_SERVICE=1'],
2688       }],
2689       ['enable_themes==1', {
2690         'defines': ['ENABLE_THEMES=1'],
2691       }],
2692       ['enable_autofill_dialog==1', {
2693         'defines': ['ENABLE_AUTOFILL_DIALOG=1'],
2694       }],
2695       ['enable_prod_wallet_service==1', {
2696         'defines': ['ENABLE_PROD_WALLET_SERVICE=1'],
2697       }],
2698       ['enable_background==1', {
2699         'defines': ['ENABLE_BACKGROUND=1'],
2700       }],
2701       ['enable_google_now==1', {
2702         'defines': ['ENABLE_GOOGLE_NOW=1'],
2703       }],
2704       ['cld_version!=0', {
2705         'defines': ['CLD_VERSION=<(cld_version)'],
2706       }],
2707       ['cld2_dynamic!=0', {
2708         'defines': ['CLD2_DYNAMIC_MODE=1'],
2709       }],
2710       ['cld2_is_component!=0', {
2711         'defines': ['CLD2_IS_COMPONENT=1'],
2712       }],
2713       ['enable_printing==1', {
2714         'defines': ['ENABLE_FULL_PRINTING=1', 'ENABLE_PRINTING=1'],
2715       }],
2716       ['enable_printing==2', {
2717         'defines': ['ENABLE_PRINTING=1'],
2718       }],
2719       ['OS=="win" and win_pdf_metafile_for_printing==1', {
2720         'defines': ['WIN_PDF_METAFILE_FOR_PRINTING=1'],
2721       }],
2722       ['enable_spellcheck==1', {
2723         'defines': ['ENABLE_SPELLCHECK=1'],
2724       }],
2725       ['enable_captive_portal_detection==1', {
2726         'defines': ['ENABLE_CAPTIVE_PORTAL_DETECTION=1'],
2727       }],
2728       ['enable_app_list==1', {
2729         'defines': ['ENABLE_APP_LIST=1'],
2730       }],
2731       ['enable_settings_app==1', {
2732         'defines': ['ENABLE_SETTINGS_APP=1'],
2733       }],
2734       ['disable_file_support==1', {
2735         'defines': ['DISABLE_FILE_SUPPORT=1'],
2736       }],
2737       ['disable_ftp_support==1', {
2738         'defines': ['DISABLE_FTP_SUPPORT=1'],
2739       }],
2740       ['use_icu_alternatives_on_android==1', {
2741         'defines': ['USE_ICU_ALTERNATIVES_ON_ANDROID=1'],
2742       }],
2743       ['enable_managed_users==1', {
2744         'defines': ['ENABLE_MANAGED_USERS=1'],
2745       }],
2746       ['data_reduction_fallback_host != ""', {
2747         'defines': [
2748           'DATA_REDUCTION_FALLBACK_HOST="<(data_reduction_fallback_host)"'],
2749       }],
2750       ['data_reduction_dev_host != ""', {
2751         'defines': [
2752           'DATA_REDUCTION_DEV_HOST="<(data_reduction_dev_host)"'],
2753       }],
2754       ['spdy_proxy_auth_origin != ""', {
2755         'defines': ['SPDY_PROXY_AUTH_ORIGIN="<(spdy_proxy_auth_origin)"'],
2756       }],
2757       ['spdy_proxy_auth_property != ""', {
2758         'defines': ['SPDY_PROXY_AUTH_PROPERTY="<(spdy_proxy_auth_property)"'],
2759       }],
2760       ['spdy_proxy_auth_value != ""', {
2761         'defines': ['SPDY_PROXY_AUTH_VALUE="<(spdy_proxy_auth_value)"'],
2762       }],
2763       ['data_reduction_proxy_probe_url != ""', {
2764         'defines': [
2765           'DATA_REDUCTION_PROXY_PROBE_URL="<(data_reduction_proxy_probe_url)"'],
2766       }],
2767       ['data_reduction_proxy_warmup_url != ""', {
2768         'defines': [
2769           'DATA_REDUCTION_PROXY_WARMUP_URL="<(data_reduction_proxy_warmup_url)"'],
2770       }],
2771       ['data_reduction_proxy_ssl_origin != ""', {
2772         'defines': [
2773           'DATA_REDUCTION_PROXY_SSL_ORIGIN="<(data_reduction_proxy_ssl_origin)"'],
2774       }],
2775       ['data_reduction_proxy_alt_origin != ""', {
2776         'defines': [
2777           'DATA_REDUCTION_PROXY_ALT_ORIGIN="<(data_reduction_proxy_alt_origin)"'],
2778       }],
2779       ['data_reduction_proxy_alt_fallback_origin != ""', {
2780         'defines': [
2781           'DATA_REDUCTION_PROXY_ALT_FALLBACK_ORIGIN="<(data_reduction_proxy_alt_fallback_origin)"'],
2782       }],
2783       ['enable_mdns==1', {
2784         'defines': ['ENABLE_MDNS=1'],
2785       }],
2786       ['enable_service_discovery==1', {
2787         'defines' : [ 'ENABLE_SERVICE_DISCOVERY=1' ],
2788       }],
2789       ['enable_wifi_bootstrapping==1', {
2790         'defines' : [ 'ENABLE_WIFI_BOOTSTRAPPING=1' ],
2791       }],
2792       ['enable_hangout_services_extension==1', {
2793         'defines': ['ENABLE_HANGOUT_SERVICES_EXTENSION=1'],
2794       }],
2795       ['enable_ipc_fuzzer==1', {
2796         'defines': ['ENABLE_IPC_FUZZER=1'],
2797       }],
2798       ['video_hole==1', {
2799         'defines': ['VIDEO_HOLE=1'],
2800       }],
2801     ],  # conditions for 'target_defaults'
2802     'target_conditions': [
2803       ['<(use_openssl)==1', {
2804         'defines': ['USE_OPENSSL=1'],
2805       }],
2806       ['<(use_openssl_certs)==1', {
2807         'defines': ['USE_OPENSSL_CERTS=1'],
2808       }],
2809       ['>(nacl_untrusted_build)==1', {
2810         'defines': [
2811           'USE_OPENSSL=1',
2812           'USE_OPENSSL_CERTS=1',
2813         ],
2814       }],
2815       ['<(use_nss)==1 and >(nacl_untrusted_build)==0', {
2816         'defines': ['USE_NSS=1'],
2817       }],
2818       ['<(chromeos)==1 and >(nacl_untrusted_build)==0', {
2819         'defines': ['OS_CHROMEOS=1'],
2820       }],
2821       ['enable_wexit_time_destructors==1', {
2822         'conditions': [
2823           [ 'clang==1', {
2824             'cflags': [
2825               '-Wexit-time-destructors',
2826             ],
2827             'xcode_settings': {
2828               'WARNING_CFLAGS': [
2829                 '-Wexit-time-destructors',
2830               ],
2831             },
2832           }],
2833         ],
2834       }],
2835       ['chromium_code==0', {
2836         'conditions': [
2837           [ 'os_posix==1 and OS!="mac" and OS!="ios"', {
2838             # We don't want to get warnings from third-party code,
2839             # so remove any existing warning-enabling flags like -Wall.
2840             'cflags!': [
2841               '-Wall',
2842               '-Wextra',
2843             ],
2844             'cflags_cc': [
2845               # Don't warn about hash_map in third-party code.
2846               '-Wno-deprecated',
2847             ],
2848             'cflags': [
2849               # Don't warn about printf format problems.
2850               # This is off by default in gcc but on in Ubuntu's gcc(!).
2851               '-Wno-format',
2852             ],
2853             'cflags_cc!': [
2854               # Necessary because llvm.org/PR10448 is WONTFIX (crbug.com/90453).
2855               '-Wsign-compare',
2856             ]
2857           }],
2858           # TODO: Fix all warnings on chromeos too.
2859           [ 'os_posix==1 and OS!="mac" and OS!="ios" and (clang!=1 or chromeos==1)', {
2860             'cflags!': [
2861               '-Werror',
2862             ],
2863           }],
2864           [ 'os_posix==1 and os_bsd!=1 and OS!="mac" and OS!="android"', {
2865             'cflags': [
2866               # Don't warn about ignoring the return value from e.g. close().
2867               # This is off by default in some gccs but on by default in others.
2868               # BSD systems do not support this option, since they are usually
2869               # using gcc 4.2.1, which does not have this flag yet.
2870               '-Wno-unused-result',
2871             ],
2872           }],
2873           [ 'OS=="win"', {
2874             'defines': [
2875               '_CRT_SECURE_NO_DEPRECATE',
2876               '_CRT_NONSTDC_NO_WARNINGS',
2877               '_CRT_NONSTDC_NO_DEPRECATE',
2878               '_SCL_SECURE_NO_DEPRECATE',
2879             ],
2880             'msvs_disabled_warnings': [4800],
2881             'msvs_settings': {
2882               'VCCLCompilerTool': {
2883                 'WarningLevel': '3',
2884                 'WarnAsError': '<(win_third_party_warn_as_error)',
2885                 'Detect64BitPortabilityProblems': 'false',
2886               },
2887             },
2888             'conditions': [
2889               ['buildtype=="Official"', {
2890                 'msvs_settings': {
2891                   'VCCLCompilerTool': { 'WarnAsError': 'false' },
2892                 }
2893               }],
2894               ['clang==1', {
2895                 'msvs_settings': {
2896                   'VCCLCompilerTool': { 'WarnAsError': 'false' },
2897                 }
2898               }],
2899             ],
2900           }],
2901           # TODO(darin): Unfortunately, some third_party code depends on base.
2902           [ 'OS=="win" and component=="shared_library"', {
2903             'msvs_disabled_warnings': [
2904               4251,  # class 'std::xx' needs to have dll-interface.
2905             ],
2906           }],
2907           [ 'OS=="mac" or OS=="ios"', {
2908             'xcode_settings': {
2909               'WARNING_CFLAGS!': ['-Wall', '-Wextra'],
2910             },
2911             'conditions': [
2912               ['buildtype=="Official"', {
2913                 'xcode_settings': {
2914                   'GCC_TREAT_WARNINGS_AS_ERRORS': 'NO',    # -Werror
2915                 },
2916               }],
2917             ],
2918           }],
2919           [ 'OS=="ios"', {
2920             'xcode_settings': {
2921               # TODO(ios): Fix remaining warnings in third-party code, then
2922               # remove this; the Mac cleanup didn't get everything that's
2923               # flagged in an iOS build.
2924               'GCC_TREAT_WARNINGS_AS_ERRORS': 'NO',
2925               'RUN_CLANG_STATIC_ANALYZER': 'NO',
2926               # Several internal ios directories generate numerous warnings for
2927               # -Wobjc-missing-property-synthesis.
2928               'CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS': 'NO',
2929             },
2930           }],
2931         ],
2932       }, {
2933         'includes': [
2934            # Rules for excluding e.g. foo_win.cc from the build on non-Windows.
2935           'filename_rules.gypi',
2936         ],
2937         # In Chromium code, we define __STDC_foo_MACROS in order to get the
2938         # C99 macros on Mac and Linux.
2939         'defines': [
2940           '__STDC_CONSTANT_MACROS',
2941           '__STDC_FORMAT_MACROS',
2942         ],
2943         'conditions': [
2944           ['OS=="win"', {
2945             # turn on warnings for signed/unsigned mismatch on chromium code.
2946             'msvs_settings': {
2947               'VCCLCompilerTool': {
2948                 'AdditionalOptions': ['/we4389'],
2949               },
2950             },
2951           }],
2952           ['OS=="win" and component=="shared_library"', {
2953             'msvs_disabled_warnings': [
2954               4251,  # class 'std::xx' needs to have dll-interface.
2955             ],
2956           }],
2957         ],
2958       }],
2959     ],  # target_conditions for 'target_defaults'
2960     'default_configuration': 'Debug',
2961     'configurations': {
2962       # VCLinkerTool LinkIncremental values below:
2963       #   0 == default
2964       #   1 == /INCREMENTAL:NO
2965       #   2 == /INCREMENTAL
2966       # Debug links incremental, Release does not.
2967       #
2968       # Abstract base configurations to cover common attributes.
2969       #
2970       'Common_Base': {
2971         'abstract': 1,
2972         'msvs_configuration_attributes': {
2973           'OutputDirectory': '<(DEPTH)\\build\\<(build_dir_prefix)$(ConfigurationName)',
2974           'IntermediateDirectory': '$(OutDir)\\obj\\$(ProjectName)',
2975           'CharacterSet': '1',
2976         },
2977         # Add the default import libs.
2978         'msvs_settings':{
2979           'VCLinkerTool': {
2980             'AdditionalDependencies': [
2981               'kernel32.lib',
2982               'gdi32.lib',
2983               'winspool.lib',
2984               'comdlg32.lib',
2985               'advapi32.lib',
2986               'shell32.lib',
2987               'ole32.lib',
2988               'oleaut32.lib',
2989               'user32.lib',
2990               'uuid.lib',
2991               'odbc32.lib',
2992               'odbccp32.lib',
2993               'delayimp.lib',
2994               'credui.lib',
2995               'netapi32.lib',
2996             ],
2997           },
2998         },
2999       },
3000       'x86_Base': {
3001         'abstract': 1,
3002         'msvs_settings': {
3003           'VCLinkerTool': {
3004             'MinimumRequiredVersion': '5.01',  # XP.
3005             'TargetMachine': '1',
3006           },
3007           'VCLibrarianTool': {
3008             'TargetMachine': '1',
3009           },
3010         },
3011         'msvs_configuration_platform': 'Win32',
3012       },
3013       'x64_Base': {
3014         'abstract': 1,
3015         'msvs_configuration_platform': 'x64',
3016         'msvs_settings': {
3017           'VCLinkerTool': {
3018             # Make sure to understand http://crbug.com/361720 if you want to
3019             # increase this.
3020             'MinimumRequiredVersion': '5.02',  # Server 2003.
3021             'TargetMachine': '17', # x86 - 64
3022             'AdditionalLibraryDirectories!':
3023               ['<(windows_sdk_path)/Lib/win8/um/x86'],
3024             'AdditionalLibraryDirectories':
3025               ['<(windows_sdk_path)/Lib/win8/um/x64'],
3026             # Doesn't exist x64 SDK. Should use oleaut32 in any case.
3027             'IgnoreDefaultLibraryNames': [ 'olepro32.lib' ],
3028           },
3029           'VCLibrarianTool': {
3030             'AdditionalLibraryDirectories!':
3031               ['<(windows_sdk_path)/Lib/win8/um/x86'],
3032             'AdditionalLibraryDirectories':
3033               ['<(windows_sdk_path)/Lib/win8/um/x64'],
3034             'TargetMachine': '17', # x64
3035           },
3036         },
3037       },
3038       'Debug_Base': {
3039         'abstract': 1,
3040         'defines': [
3041           'DYNAMIC_ANNOTATIONS_ENABLED=1',
3042           'WTF_USE_DYNAMIC_ANNOTATIONS=1',
3043         ],
3044         'xcode_settings': {
3045           'GCC_OPTIMIZATION_LEVEL': '<(mac_debug_optimization)',
3046           'OTHER_CFLAGS': [
3047             '<@(debug_extra_cflags)',
3048           ],
3049         },
3050         'msvs_settings': {
3051           'VCCLCompilerTool': {
3052             'Optimization': '<(win_debug_Optimization)',
3053             'PreprocessorDefinitions': ['_DEBUG'],
3054             'BasicRuntimeChecks': '<(win_debug_RuntimeChecks)',
3055             'RuntimeLibrary': '<(win_debug_RuntimeLibrary)',
3056             'conditions': [
3057               # According to MSVS, InlineFunctionExpansion=0 means
3058               # "default inlining", not "/Ob0".
3059               # Thus, we have to handle InlineFunctionExpansion==0 separately.
3060               ['win_debug_InlineFunctionExpansion==0', {
3061                 'AdditionalOptions': ['/Ob0'],
3062               }],
3063               ['win_debug_InlineFunctionExpansion!=""', {
3064                 'InlineFunctionExpansion':
3065                   '<(win_debug_InlineFunctionExpansion)',
3066               }],
3067               ['win_debug_disable_iterator_debugging==1', {
3068                 'PreprocessorDefinitions': ['_HAS_ITERATOR_DEBUGGING=0'],
3069               }],
3070
3071               # if win_debug_OmitFramePointers is blank, leave as default
3072               ['win_debug_OmitFramePointers==1', {
3073                 'OmitFramePointers': 'true',
3074               }],
3075               ['win_debug_OmitFramePointers==0', {
3076                 'OmitFramePointers': 'false',
3077                 # The above is not sufficient (http://crbug.com/106711): it
3078                 # simply eliminates an explicit "/Oy", but both /O2 and /Ox
3079                 # perform FPO regardless, so we must explicitly disable.
3080                 # We still want the false setting above to avoid having
3081                 # "/Oy /Oy-" and warnings about overriding.
3082                 'AdditionalOptions': ['/Oy-'],
3083               }],
3084             ],
3085             'AdditionalOptions': [ '<@(win_debug_extra_cflags)', ],
3086           },
3087           'VCLinkerTool': {
3088             'LinkIncremental': '<(msvs_debug_link_incremental)',
3089             # ASLR makes debugging with windbg difficult because Chrome.exe and
3090             # Chrome.dll share the same base name. As result, windbg will
3091             # name the Chrome.dll module like chrome_<base address>, where
3092             # <base address> typically changes with each launch. This in turn
3093             # means that breakpoints in Chrome.dll don't stick from one launch
3094             # to the next. For this reason, we turn ASLR off in debug builds.
3095             # Note that this is a three-way bool, where 0 means to pick up
3096             # the default setting, 1 is off and 2 is on.
3097             'RandomizedBaseAddress': 1,
3098           },
3099           'VCResourceCompilerTool': {
3100             'PreprocessorDefinitions': ['_DEBUG'],
3101           },
3102         },
3103         'conditions': [
3104           ['OS=="linux" or OS=="android"', {
3105             'target_conditions': [
3106               ['_toolset=="target"', {
3107                 'cflags': [
3108                   '<@(debug_extra_cflags)',
3109                 ],
3110               }],
3111             ],
3112           }],
3113           ['OS=="linux" and target_arch!="ia32" and disable_glibcxx_debug==0', {
3114             # Enable libstdc++ debugging facilities to help catch problems
3115             # early, see http://crbug.com/65151 .
3116             # TODO(phajdan.jr): Should we enable this for all of POSIX?
3117             'defines': ['_GLIBCXX_DEBUG=1',],
3118           }],
3119           ['release_valgrind_build==0', {
3120             'xcode_settings': {
3121               'OTHER_CFLAGS': [
3122                 '-fstack-protector-all',  # Implies -fstack-protector
3123               ],
3124             },
3125           }],
3126         ],
3127       },
3128       'Release_Base': {
3129         'abstract': 1,
3130         'defines': [
3131           'NDEBUG',
3132         ],
3133         'xcode_settings': {
3134           'DEAD_CODE_STRIPPING': 'YES',  # -Wl,-dead_strip
3135           'GCC_OPTIMIZATION_LEVEL': '<(mac_release_optimization)',
3136           'OTHER_CFLAGS': [ '<@(release_extra_cflags)', ],
3137         },
3138         'msvs_settings': {
3139           'VCCLCompilerTool': {
3140             'RuntimeLibrary': '<(win_release_RuntimeLibrary)',
3141             'conditions': [
3142               # In official builds, each target will self-select
3143               # an optimization level.
3144               ['buildtype!="Official"', {
3145                   'Optimization': '<(win_release_Optimization)',
3146                 },
3147               ],
3148               # According to MSVS, InlineFunctionExpansion=0 means
3149               # "default inlining", not "/Ob0".
3150               # Thus, we have to handle InlineFunctionExpansion==0 separately.
3151               ['win_release_InlineFunctionExpansion==0', {
3152                 'AdditionalOptions': ['/Ob0'],
3153               }],
3154               ['win_release_InlineFunctionExpansion!=""', {
3155                 'InlineFunctionExpansion':
3156                   '<(win_release_InlineFunctionExpansion)',
3157               }],
3158
3159               # if win_release_OmitFramePointers is blank, leave as default
3160               ['win_release_OmitFramePointers==1', {
3161                 'OmitFramePointers': 'true',
3162               }],
3163               ['win_release_OmitFramePointers==0', {
3164                 'OmitFramePointers': 'false',
3165                 # The above is not sufficient (http://crbug.com/106711): it
3166                 # simply eliminates an explicit "/Oy", but both /O2 and /Ox
3167                 # perform FPO regardless, so we must explicitly disable.
3168                 # We still want the false setting above to avoid having
3169                 # "/Oy /Oy-" and warnings about overriding.
3170                 'AdditionalOptions': ['/Oy-'],
3171               }],
3172             ],
3173             'AdditionalOptions': [ '<@(win_release_extra_cflags)', ],
3174           },
3175           'VCLinkerTool': {
3176             # LinkIncremental is a tri-state boolean, where 0 means default
3177             # (i.e., inherit from parent solution), 1 means false, and
3178             # 2 means true.
3179             'LinkIncremental': '1',
3180             # This corresponds to the /PROFILE flag which ensures the PDB
3181             # file contains FIXUP information (growing the PDB file by about
3182             # 5%) but does not otherwise alter the output binary. This
3183             # information is used by the Syzygy optimization tool when
3184             # decomposing the release image.
3185             'Profile': 'true',
3186           },
3187         },
3188         'conditions': [
3189           ['msvs_use_common_release', {
3190             'includes': ['release.gypi'],
3191           }],
3192           ['release_valgrind_build==0 and tsan==0', {
3193             'defines': [
3194               'NVALGRIND',
3195               'DYNAMIC_ANNOTATIONS_ENABLED=0',
3196             ],
3197           }, {
3198             'defines': [
3199               'MEMORY_TOOL_REPLACES_ALLOCATOR',
3200               'DYNAMIC_ANNOTATIONS_ENABLED=1',
3201               'WTF_USE_DYNAMIC_ANNOTATIONS=1',
3202             ],
3203           }],
3204           ['win_use_allocator_shim==0', {
3205             'defines': ['NO_TCMALLOC'],
3206           }],
3207           # _FORTIFY_SOURCE isn't really supported by Clang now, see
3208           # http://llvm.org/bugs/show_bug.cgi?id=16821.
3209           # TODO(glider): once the bug is fixed, disable source fortification
3210           # under the sanitizer tools only.
3211           ['os_posix==1 and (OS!="linux" or clang!=1)', {
3212             'target_conditions': [
3213               ['chromium_code==1', {
3214                 # Non-chromium code is not guaranteed to compile cleanly
3215                 # with _FORTIFY_SOURCE. Also, fortified build may fail
3216                 # when optimizations are disabled, so only do that for Release
3217                 # build.
3218                 'defines': [
3219                   '_FORTIFY_SOURCE=2',
3220                 ],
3221               }],
3222             ],
3223           }],
3224           ['OS=="linux" or OS=="android"', {
3225             'target_conditions': [
3226               ['_toolset=="target"', {
3227                 'cflags': [
3228                   '<@(release_extra_cflags)',
3229                 ],
3230                 'conditions': [
3231                   ['enable_resource_whitelist_generation==1', {
3232                     'cflags': [
3233                       '-Wunknown-pragmas -Wno-error=unknown-pragmas',
3234                     ],
3235                   }],
3236                 ],
3237               }],
3238             ],
3239           }],
3240           ['OS=="ios"', {
3241             'defines': [
3242               'NS_BLOCK_ASSERTIONS=1',
3243             ],
3244           }],
3245         ],
3246       },
3247       #
3248       # Concrete configurations
3249       #
3250       'Debug': {
3251         'inherit_from': ['Common_Base', 'x86_Base', 'Debug_Base'],
3252       },
3253       'Release': {
3254         'inherit_from': ['Common_Base', 'x86_Base', 'Release_Base'],
3255       },
3256       'conditions': [
3257         [ 'OS=="ios"', {
3258           'Profile': {
3259             'inherit_from': ['Common_Base', 'x86_Base', 'Release_Base'],
3260             'target_conditions': [
3261               [ '_type=="executable"', {
3262                 # To get a real .dSYM bundle produced by dsymutil, set the
3263                 # debug information format to dwarf-with-dsym.  Since
3264                 # strip_from_xcode will not be used, set Xcode to do the
3265                 # stripping as well.
3266                 'xcode_settings': {
3267                   'DEBUG_INFORMATION_FORMAT': 'dwarf-with-dsym',
3268                   'DEPLOYMENT_POSTPROCESSING': 'YES',
3269                   'STRIP_INSTALLED_PRODUCT': 'YES',
3270                 },
3271               }],
3272             ],
3273           },
3274         }],
3275         [ 'OS=="win"', {
3276           # TODO(bradnelson): add a gyp mechanism to make this more graceful.
3277           'Debug_x64': {
3278             'inherit_from': ['Common_Base', 'x64_Base', 'Debug_Base'],
3279           },
3280           'Release_x64': {
3281             'inherit_from': ['Common_Base', 'x64_Base', 'Release_Base'],
3282           },
3283         }],
3284       ],
3285     },
3286   },
3287   'conditions': [
3288     ['os_posix==1', {
3289       'target_defaults': {
3290         'ldflags': [
3291           '-Wl,-z,now',
3292           '-Wl,-z,relro',
3293         ],
3294       },
3295     }],
3296     # TODO(jochen): Enable this on chromeos on arm. http://crbug.com/356580
3297     ['os_posix==1 and disable_fatal_linker_warnings==0 and use_evdev_gestures==0 and (chromeos==0 or target_arch!="arm")', {
3298       'target_defaults': {
3299         'ldflags': [
3300           '-Wl,--fatal-warnings',
3301         ],
3302       },
3303     }],
3304     ['os_posix==1 and chromeos==0', {
3305       # Chrome OS enables -fstack-protector-strong via its build wrapper,
3306       # and we want to avoid overriding this, so stack-protector is only
3307       # enabled when not building on Chrome OS.
3308       # TODO(phajdan.jr): Use -fstack-protector-strong when our gcc
3309       # supports it.
3310       'target_defaults': {
3311         'cflags': [
3312           '-fstack-protector',
3313           '--param=ssp-buffer-size=4',
3314         ],
3315       },
3316     }],
3317     ['os_posix==1 and OS!="mac" and OS!="ios"', {
3318       'target_defaults': {
3319         # Enable -Werror by default, but put it in a variable so it can
3320         # be disabled in ~/.gyp/include.gypi on the valgrind builders.
3321         'variables': {
3322           'werror%': '-Werror',
3323           'libraries_for_target%': '',
3324         },
3325         'defines': [
3326           '_FILE_OFFSET_BITS=64',
3327         ],
3328         'cflags': [
3329           '<(werror)',  # See note above about the werror variable.
3330           '-pthread',
3331           '-fno-exceptions',
3332           '-fno-strict-aliasing',  # See http://crbug.com/32204
3333           '-Wall',
3334           # TODO(evan): turn this back on once all the builds work.
3335           # '-Wextra',
3336           # Don't warn about unused function params.  We use those everywhere.
3337           '-Wno-unused-parameter',
3338           # Don't warn about the "struct foo f = {0};" initialization pattern.
3339           '-Wno-missing-field-initializers',
3340           # Don't export any symbols (for example, to plugins we dlopen()).
3341           # Note: this is *required* to make some plugins work.
3342           '-fvisibility=hidden',
3343           '-pipe',
3344         ],
3345         'cflags_cc': [
3346           '-fno-rtti',
3347           '-fno-threadsafe-statics',
3348           # Make inline functions have hidden visiblity by default.
3349           # Surprisingly, not covered by -fvisibility=hidden.
3350           '-fvisibility-inlines-hidden',
3351           # GCC turns on -Wsign-compare for C++ under -Wall, but clang doesn't,
3352           # so we specify it explicitly.  (llvm.org/PR10448, crbug.com/90453)
3353           '-Wsign-compare',
3354         ],
3355         'ldflags': [
3356           '-pthread', '-Wl,-z,noexecstack',
3357         ],
3358         'libraries' : [
3359           '<(libraries_for_target)',
3360         ],
3361         'configurations': {
3362           'Debug_Base': {
3363             'variables': {
3364               'debug_optimize%': '0',
3365             },
3366             'defines': [
3367               '_DEBUG',
3368             ],
3369             'cflags': [
3370               '-O>(debug_optimize)',
3371               '-g',
3372             ],
3373             'conditions' : [
3374               ['OS=="android"', {
3375                 'ldflags': [
3376                   # Warn in case of text relocations.
3377                   '-Wl,--warn-shared-textrel',
3378                 ],
3379               }],
3380               ['OS=="android" and android_full_debug==0', {
3381                 # Some configurations are copied from Release_Base to reduce
3382                 # the binary size.
3383                 'variables': {
3384                   'debug_optimize%': 's',
3385                 },
3386                 'cflags': [
3387                   '-fomit-frame-pointer',
3388                   '-fdata-sections',
3389                   '-ffunction-sections',
3390                 ],
3391                 'ldflags': [
3392                   '-Wl,-O1',
3393                   '-Wl,--as-needed',
3394                 ],
3395               }],
3396               ['OS=="linux" and target_arch=="ia32"', {
3397                 'ldflags': [
3398                   '-Wl,--no-as-needed',
3399                 ],
3400               }],
3401               ['debug_unwind_tables==1', {
3402                 'cflags': ['-funwind-tables'],
3403               }, {
3404                 'cflags': ['-fno-unwind-tables', '-fno-asynchronous-unwind-tables'],
3405               }],
3406               # TODO(mostynb): shuffle clang/gcc_version/binutils_version
3407               # definitions in to the right scope to use them when setting
3408               # linux_use_debug_fission, so it can be used here alone.
3409               ['linux_use_debug_fission==1 and linux_use_gold_flags==1 and (clang==1 or gcc_version>=48) and binutils_version>=223', {
3410                 'cflags': ['-gsplit-dwarf'],
3411               }],
3412             ],
3413           },
3414           'Release_Base': {
3415             'variables': {
3416               'release_optimize%': '2',
3417               # Binaries become big and gold is unable to perform GC
3418               # and remove unused sections for some of test targets
3419               # on 32 bit platform.
3420               # (This is currently observed only in chromeos valgrind bots)
3421               # The following flag is to disable --gc-sections linker
3422               # option for these bots.
3423               'no_gc_sections%': 0,
3424
3425               # TODO(bradnelson): reexamine how this is done if we change the
3426               # expansion of configurations
3427               'release_valgrind_build%': 0,
3428             },
3429             'cflags': [
3430               '-O>(release_optimize)',
3431               # Don't emit the GCC version ident directives, they just end up
3432               # in the .comment section taking up binary size.
3433               '-fno-ident',
3434               # Put data and code in their own sections, so that unused symbols
3435               # can be removed at link time with --gc-sections.
3436               '-fdata-sections',
3437               '-ffunction-sections',
3438             ],
3439             'ldflags': [
3440               # Specifically tell the linker to perform optimizations.
3441               # See http://lwn.net/Articles/192624/ .
3442               '-Wl,-O1',
3443               '-Wl,--as-needed',
3444             ],
3445             'conditions' : [
3446               ['no_gc_sections==0', {
3447                 'ldflags': [
3448                   '-Wl,--gc-sections',
3449                 ],
3450               }],
3451               ['OS=="android"', {
3452                 'variables': {
3453                   'release_optimize%': 's',
3454                 },
3455                 'cflags': [
3456                   '-fomit-frame-pointer',
3457                 ],
3458                 'ldflags': [
3459                   # Warn in case of text relocations.
3460                   '-Wl,--warn-shared-textrel',
3461                 ],
3462               }],
3463               ['clang==1', {
3464                 'cflags!': [
3465                   '-fno-ident',
3466                 ],
3467               }],
3468               ['profiling==1', {
3469                 'cflags': [
3470                   '-fno-omit-frame-pointer',
3471                   '-g',
3472                 ],
3473                 'conditions' : [
3474                   ['profiling_full_stack_frames==1', {
3475                     'cflags': [
3476                       '-fno-inline',
3477                       '-fno-optimize-sibling-calls',
3478                     ],
3479                   }],
3480                 ],
3481               }],
3482               ['release_unwind_tables==1', {
3483                 'cflags': ['-funwind-tables'],
3484               }, {
3485                 'cflags': ['-fno-unwind-tables', '-fno-asynchronous-unwind-tables'],
3486               }],
3487             ],
3488           },
3489         },
3490         'conditions': [
3491           ['target_arch=="ia32"', {
3492             'target_conditions': [
3493               ['_toolset=="target"', {
3494                 'asflags': [
3495                   # Needed so that libs with .s files (e.g. libicudata.a)
3496                   # are compatible with the general 32-bit-ness.
3497                   '-32',
3498                 ],
3499                 # All floating-point computations on x87 happens in 80-bit
3500                 # precision.  Because the C and C++ language standards allow
3501                 # the compiler to keep the floating-point values in higher
3502                 # precision than what's specified in the source and doing so
3503                 # is more efficient than constantly rounding up to 64-bit or
3504                 # 32-bit precision as specified in the source, the compiler,
3505                 # especially in the optimized mode, tries very hard to keep
3506                 # values in x87 floating-point stack (in 80-bit precision)
3507                 # as long as possible. This has important side effects, that
3508                 # the real value used in computation may change depending on
3509                 # how the compiler did the optimization - that is, the value
3510                 # kept in 80-bit is different than the value rounded down to
3511                 # 64-bit or 32-bit. There are possible compiler options to
3512                 # make this behavior consistent (e.g. -ffloat-store would keep
3513                 # all floating-values in the memory, thus force them to be
3514                 # rounded to its original precision) but they have significant
3515                 # runtime performance penalty.
3516                 #
3517                 # -mfpmath=sse -msse2 makes the compiler use SSE instructions
3518                 # which keep floating-point values in SSE registers in its
3519                 # native precision (32-bit for single precision, and 64-bit
3520                 # for double precision values). This means the floating-point
3521                 # value used during computation does not change depending on
3522                 # how the compiler optimized the code, since the value is
3523                 # always kept in its specified precision.
3524                 #
3525                 # Refer to http://crbug.com/348761 for rationale behind SSE2
3526                 # being a minimum requirement for 32-bit Linux builds and
3527                 # http://crbug.com/313032 for an example where this has "bit"
3528                 # us in the past.
3529                 'cflags': [
3530                   '-msse2',
3531                   '-mfpmath=sse',
3532                   '-mmmx',  # Allows mmintrin.h for MMX intrinsics.
3533                   '-m32',
3534                 ],
3535                 'ldflags': [
3536                   '-m32',
3537                 ],
3538                 'conditions': [
3539                   # Use gold linker for Android ia32 target.
3540                   ['OS=="android"', {
3541                     'ldflags': [
3542                       '-fuse-ld=gold',
3543                     ],
3544                   }],
3545                   # Install packages have started cropping up with
3546                   # different headers between the 32-bit and 64-bit
3547                   # versions, so we have to shadow those differences off
3548                   # and make sure a 32-bit-on-64-bit build picks up the
3549                   # right files.
3550                   # For android build, use NDK headers instead of host headers
3551                   ['host_arch!="ia32" and OS!="android"', {
3552                     'include_dirs+': [
3553                       '/usr/include32',
3554                     ],
3555                   }],
3556                 ],
3557               }],
3558             ],
3559           }],
3560           ['target_arch=="x64"', {
3561             'target_conditions': [
3562               ['_toolset=="target"', {
3563                 'conditions': [
3564                   # Use gold linker for Android x64 target.
3565                   ['OS=="android"', {
3566                     'ldflags': [
3567                       '-fuse-ld=gold',
3568                     ],
3569                   }],
3570                 ],
3571                 'cflags': [
3572                   '-m64',
3573                   '-march=x86-64',
3574                 ],
3575                 'ldflags': [
3576                   '-m64',
3577                 ],
3578               }],
3579             ],
3580           }],
3581           ['target_arch=="arm"', {
3582             'target_conditions': [
3583               ['_toolset=="target"', {
3584                 'cflags_cc': [
3585                   # The codesourcery arm-2009q3 toolchain warns at that the ABI
3586                   # has changed whenever it encounters a varargs function. This
3587                   # silences those warnings, as they are not helpful and
3588                   # clutter legitimate warnings.
3589                   '-Wno-abi',
3590                 ],
3591                 'conditions': [
3592                   ['arm_arch!=""', {
3593                     'cflags': [
3594                       '-march=<(arm_arch)',
3595                     ],
3596                   }],
3597                   ['arm_tune!=""', {
3598                     'cflags': [
3599                       '-mtune=<(arm_tune)',
3600                     ],
3601                   }],
3602                   ['arm_fpu!=""', {
3603                     'cflags': [
3604                       '-mfpu=<(arm_fpu)',
3605                     ],
3606                   }],
3607                   ['arm_float_abi!=""', {
3608                     'cflags': [
3609                       '-mfloat-abi=<(arm_float_abi)',
3610                     ],
3611                   }],
3612                   ['arm_thumb==1', {
3613                     'cflags': [
3614                     '-mthumb',
3615                     ]
3616                   }],
3617                   ['OS=="android"', {
3618                     # Most of the following flags are derived from what Android
3619                     # uses by default when building for arm, reference for which
3620                     # can be found in the following file in the Android NDK:
3621                     # toolchains/arm-linux-androideabi-4.8/setup.mk
3622                     'cflags': [
3623                       # The tree-sra optimization (scalar replacement for
3624                       # aggregates enabling subsequent optimizations) leads to
3625                       # invalid code generation when using the Android NDK's
3626                       # compiler (r5-r7). This can be verified using
3627                       # webkit_unit_tests' WTF.Checked_int8_t test.
3628                       '-fno-tree-sra',
3629                       # The following 6 options are disabled to save on
3630                       # binary size in gcc 4.8.
3631                       # TODO(fdegans) Reevaluate when we upgrade GCC.
3632                       '-fno-partial-inlining',
3633                       '-fno-early-inlining',
3634                       '-fno-tree-copy-prop',
3635                       '-fno-tree-loop-optimize',
3636                       '-fno-move-loop-invariants',
3637                       '-fno-caller-saves',
3638                       '-Wno-psabi',
3639                     ],
3640                     # Android now supports .relro sections properly.
3641                     # NOTE: While these flags enable the generation of .relro
3642                     # sections, the generated libraries can still be loaded on
3643                     # older Android platform versions.
3644                     'ldflags': [
3645                         '-Wl,-z,relro',
3646                         '-Wl,-z,now',
3647                         '-fuse-ld=gold',
3648                     ],
3649                     'conditions': [
3650                       ['arm_thumb==1', {
3651                         'cflags': [ '-mthumb-interwork' ],
3652                       }],
3653                       ['profiling==1', {
3654                         'cflags': [
3655                           # Thumb code with frame pointer makes chrome crash
3656                           # early.
3657                           '-marm',
3658                           '-mapcs-frame', # Required by -fno-omit-frame-pointer.
3659                           # The perf report sometimes incorrectly attributes
3660                           # code from tail calls.
3661                           '-fno-optimize-sibling-calls',
3662                         ],
3663                         'cflags!': [
3664                           '-fomit-frame-pointer',
3665                         ],
3666                       }],
3667                       ['clang==1', {
3668                         'cflags!': [
3669                           # Clang does not support the following options.
3670                           '-mthumb-interwork',
3671                           '-finline-limit=64',
3672                           '-fno-tree-sra',
3673                           '-fno-partial-inlining',
3674                           '-fno-early-inlining',
3675                           '-fno-tree-copy-prop',
3676                           '-fno-tree-loop-optimize',
3677                           '-fno-move-loop-invariants',
3678                           '-fno-caller-saves',
3679                           '-Wno-psabi',
3680                         ],
3681                         'cflags': [
3682                           # TODO(hans) Enable integrated-as (crbug.com/124610).
3683                           '-no-integrated-as',
3684                           '-B<(android_toolchain)',  # Else /usr/bin/as gets picked up.
3685                         ],
3686
3687                         'ldflags!': [
3688                           # Clang does not support the following options.
3689                           '-fuse-ld=gold',
3690                         ],
3691                         'ldflags': [
3692                           # As long as -fuse-ld=gold doesn't work, add a dummy directory
3693                           # with an 'ld' that redirects to gold, so that clang uses gold.
3694                           '-B<!(cd <(DEPTH) && pwd -P)/build/android/arm-linux-androideabi-gold',
3695                         ],
3696                       }],
3697                       ['asan==1', {
3698                         'cflags': [
3699                           '-marm', # Required for frame pointer based stack traces.
3700                         ],
3701                       }],
3702                     ],
3703                   }],
3704                 ],
3705               }],
3706             ],
3707           }],
3708           ['target_arch=="arm64"', {
3709             'target_conditions': [
3710               ['_toolset=="target"', {
3711                 'conditions': [
3712                   ['OS=="android"', {
3713                     'cflags!': [
3714                        '-fstack-protector',  # stack protector is always enabled on arm64.
3715                     ],
3716                   }],
3717                 ],
3718               }],
3719             ],
3720           }],
3721           ['target_arch=="mipsel"', {
3722             'target_conditions': [
3723               ['_toolset=="target"', {
3724                 'conditions': [
3725                   ['android_webview_build==0 and mips_arch_variant=="mips32r2"', {
3726                     'cflags': ['-mips32r2', '-Wa,-mips32r2'],
3727                   }],
3728                   ['android_webview_build==0 and mips_arch_variant!="mips32r2"', {
3729                     'cflags': ['-mips32', '-Wa,-mips32'],
3730                   }],
3731                 ],
3732                 'cflags': [
3733                   '-EL',
3734                   '-mhard-float',
3735                 ],
3736                 'ldflags': [
3737                   '-EL',
3738                   '-Wl,--no-keep-memory'
3739                 ],
3740                 'cflags_cc': [
3741                   '-Wno-uninitialized',
3742                 ],
3743               }],
3744             ],
3745           }],
3746           ['linux_fpic==1', {
3747             'cflags': [
3748               '-fPIC',
3749             ],
3750             'ldflags': [
3751               '-fPIC',
3752             ],
3753           }],
3754           ['sysroot!=""', {
3755             'target_conditions': [
3756               ['_toolset=="target"', {
3757                 'cflags': [
3758                   '--sysroot=<(sysroot)',
3759                 ],
3760                 'ldflags': [
3761                   '--sysroot=<(sysroot)',
3762                   '<!(<(DEPTH)/build/linux/sysroot_ld_path.sh <(sysroot))',
3763                 ],
3764               }]]
3765           }],
3766           ['clang==1', {
3767             'cflags': [
3768               '-Wheader-hygiene',
3769
3770               # Don't die on dtoa code that uses a char as an array index.
3771               '-Wno-char-subscripts',
3772
3773               # TODO(thakis): This used to be implied by -Wno-unused-function,
3774               # which we no longer use. Check if it makes sense to remove
3775               # this as well. http://crbug.com/316352
3776               '-Wno-unneeded-internal-declaration',
3777
3778               # Warns on switches on enums that cover all enum values but
3779               # also contain a default: branch. Chrome is full of that.
3780               '-Wno-covered-switch-default',
3781
3782               # Warns when a const char[] is converted to bool.
3783               '-Wstring-conversion',
3784
3785               # C++11-related flags:
3786
3787               # This warns on using ints as initializers for floats in
3788               # initializer lists (e.g. |int a = f(); CGSize s = { a, a };|),
3789               # which happens in several places in chrome code. Not sure if
3790               # this is worth fixing.
3791               '-Wno-c++11-narrowing',
3792
3793               # TODO(thakis): Remove, http://crbug.com/263960
3794               '-Wno-reserved-user-defined-literal',
3795
3796               # Clang considers the `register` keyword as deprecated, but e.g.
3797               # code generated by flex (used in angle) contains that keyword.
3798               # http://crbug.com/255186
3799               '-Wno-deprecated-register',
3800             ],
3801             'cflags!': [
3802               # Clang doesn't seem to know know this flag.
3803               '-mfpmath=sse',
3804             ],
3805             'cflags_cc': [
3806               # See the comment in the Mac section for what it takes to move
3807               # this to -std=c++11.
3808               '-std=gnu++11',
3809             ],
3810           }],
3811           ['clang==1 and OS=="android"', {
3812             # Android uses stlport, whose include/new defines
3813             # `void  operator delete[](void* ptr) throw();`, which
3814             # clang's -Wimplicit-exception-spec-mismatch warns about for some
3815             # reason -- http://llvm.org/PR16638. TODO(thakis): Include stlport
3816             # via -isystem instead.
3817             'cflags_cc': [
3818               '-Wno-implicit-exception-spec-mismatch',
3819             ],
3820           }],
3821           ['clang==1 and clang_use_chrome_plugins==1', {
3822             'cflags': [
3823               '<@(clang_chrome_plugins_flags)',
3824             ],
3825           }],
3826           ['clang==1 and clang_load!=""', {
3827             'cflags': [
3828               '-Xclang', '-load', '-Xclang', '<(clang_load)',
3829             ],
3830           }],
3831           ['clang==1 and clang_add_plugin!=""', {
3832             'cflags': [
3833               '-Xclang', '-add-plugin', '-Xclang', '<(clang_add_plugin)',
3834             ],
3835           }],
3836           ['clang==1 and target_arch=="ia32"', {
3837             'cflags': [
3838               # Else building libyuv gives clang's register allocator issues,
3839               # see llvm.org/PR15798 / crbug.com/233709
3840               '-momit-leaf-frame-pointer',
3841             ],
3842           }],
3843           ['clang==1 and "<(GENERATOR)"=="ninja"', {
3844             'cflags': [
3845               # See http://crbug.com/110262
3846               '-fcolor-diagnostics',
3847             ],
3848           }],
3849           # Common options for AddressSanitizer, LeakSanitizer,
3850           # ThreadSanitizer and MemorySanitizer.
3851           ['asan==1 or lsan==1 or tsan==1 or msan==1 or ubsan==1', {
3852             'target_conditions': [
3853               ['_toolset=="target"', {
3854                 'cflags': [
3855                   '-fno-omit-frame-pointer',
3856                   '-gline-tables-only',
3857                 ],
3858                 'cflags!': [
3859                   '-fomit-frame-pointer',
3860                 ],
3861               }],
3862             ],
3863           }],
3864           ['asan==1 or lsan==1 or tsan==1 or msan==1', {
3865             'target_conditions': [
3866               ['_toolset=="target"', {
3867                 'ldflags!': [
3868                   # Functions interposed by the sanitizers can make ld think
3869                   # that some libraries aren't needed when they actually are,
3870                   # http://crbug.com/234010. As workaround, disable --as-needed.
3871                   '-Wl,--as-needed',
3872                 ],
3873                 'defines': [
3874                   'MEMORY_TOOL_REPLACES_ALLOCATOR',
3875                 ],
3876               }],
3877             ],
3878             # TODO(glider): enable the default options on other systems.
3879             'conditions': [
3880               ['use_sanitizer_options==1 and OS=="linux" and (chromeos==0 or target_arch!="ia32")', {
3881                 'dependencies': [
3882                   '<(DEPTH)/base/base.gyp:sanitizer_options',
3883                 ],
3884               }],
3885             ],
3886           }],
3887           ['asan==1', {
3888             'target_conditions': [
3889               ['_toolset=="target"', {
3890                 'cflags': [
3891                   '-fsanitize=address',
3892                   '-w',  # http://crbug.com/162783
3893                 ],
3894                 'ldflags': [
3895                   '-fsanitize=address',
3896                 ],
3897               }],
3898             ],
3899             'conditions': [
3900               ['OS=="mac"', {
3901                 'cflags': [
3902                   '-mllvm -asan-globals=0',  # http://crbug.com/352073
3903                 ],
3904               }],
3905             ],
3906           }],
3907           ['ubsan==1', {
3908             'target_conditions': [
3909               ['_toolset=="target"', {
3910                 'cflags': [
3911                   '-fsanitize=undefined',
3912                   # -fsanitize=vptr is incompatible with -fno-rtti.
3913                   '-fno-sanitize=vptr',
3914                   '-w',  # http://crbug.com/162783
3915                 ],
3916                 'ldflags': [
3917                   '-fsanitize=undefined',
3918                   # -fsanitize=vptr is incompatible with -fno-rtti.
3919                   '-fno-sanitize=vptr',
3920                 ],
3921               }],
3922             ],
3923           }],
3924           ['asan_coverage!=0', {
3925             'target_conditions': [
3926               ['_toolset=="target"', {
3927                 'cflags': [
3928                   '-mllvm -asan-coverage=<(asan_coverage)',
3929                 ],
3930               }],
3931             ],
3932           }],
3933           ['lsan==1', {
3934             'target_conditions': [
3935               ['_toolset=="target"', {
3936                 'cflags': [
3937                   '-fsanitize=leak',
3938                 ],
3939                 'ldflags': [
3940                   '-fsanitize=leak',
3941                 ],
3942                 'defines': [
3943                   'LEAK_SANITIZER',
3944                   'WTF_USE_LEAK_SANITIZER=1',
3945                 ],
3946               }],
3947             ],
3948           }],
3949           ['tsan==1', {
3950             'target_conditions': [
3951               ['_toolset=="target"', {
3952                 'cflags': [
3953                   '-fsanitize=thread',
3954                   '-fPIC',
3955                   '-fsanitize-blacklist=<(tsan_blacklist)',
3956                 ],
3957                 'ldflags': [
3958                   '-fsanitize=thread',
3959                 ],
3960                 'defines': [
3961                   'THREAD_SANITIZER',
3962                   'DYNAMIC_ANNOTATIONS_EXTERNAL_IMPL=1',
3963                   'WTF_USE_DYNAMIC_ANNOTATIONS_NOIMPL=1',
3964                 ],
3965                 'target_conditions': [
3966                   ['_type=="executable"', {
3967                     'ldflags': [
3968                       '-pie',
3969                     ],
3970                   }],
3971                 ],
3972               }],
3973             ],
3974           }],
3975           ['msan==1', {
3976             'target_conditions': [
3977               ['_toolset=="target"', {
3978                 'cflags': [
3979                   '-fsanitize=memory',
3980                   '-fsanitize-memory-track-origins',
3981                   '-fPIC',
3982                   '-fsanitize-blacklist=<(msan_blacklist)',
3983                 ],
3984                 'ldflags': [
3985                   '-fsanitize=memory',
3986                 ],
3987                 'defines': [
3988                   'MEMORY_SANITIZER',
3989                 ],
3990                 'target_conditions': [
3991                   ['_type=="executable"', {
3992                     'ldflags': [
3993                       '-pie',
3994                     ],
3995                   }],
3996                 ],
3997               }],
3998             ],
3999           }],
4000           ['use_instrumented_libraries==1', {
4001             'dependencies': [
4002               '<(DEPTH)/third_party/instrumented_libraries/instrumented_libraries.gyp:instrumented_libraries',
4003             ],
4004           }],
4005           ['use_custom_libcxx==1', {
4006             'dependencies': [
4007               '<(DEPTH)/third_party/libc++/libc++.gyp:libcxx_proxy',
4008             ],
4009           }],
4010           ['order_profiling!=0 and (chromeos==1 or OS=="linux" or OS=="android")', {
4011             'target_conditions' : [
4012               # crazy_linker has an upstream gyp file we can't edit, and we
4013               # don't want to instrument it.
4014               ['_toolset=="target" and _target_name!="crazy_linker"', {
4015                 'cflags': [
4016                   '-finstrument-functions',
4017                   # Allow mmx intrinsics to inline, so that the
4018                   #0 compiler can expand the intrinsics.
4019                   '-finstrument-functions-exclude-file-list=mmintrin.h',
4020                 ],
4021               }],
4022               ['_toolset=="target" and OS=="android"', {
4023                 'cflags': [
4024                   # Avoids errors with current NDK:
4025                   # "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"
4026                   '-finstrument-functions-exclude-file-list=arm_neon.h',
4027                 ],
4028               }],
4029             ],
4030           }],
4031           ['linux_dump_symbols==1', {
4032             'cflags': [ '-g' ],
4033             'conditions': [
4034               ['OS=="linux" and host_arch=="ia32" and linux_use_bundled_gold==0', {
4035                 'target_conditions': [
4036                   ['_toolset=="target"', {
4037                     'ldflags': [
4038                       # Attempt to use less memory to prevent the linker from
4039                       # running out of address space. Considering installing a
4040                       # 64-bit kernel and switching to a 64-bit linker.
4041                       '-Wl,--no-keep-memory',
4042                     ],
4043                   }],
4044                 ],
4045               }],
4046             ],
4047           }],
4048           ['use_allocator!="tcmalloc"', {
4049             'defines': ['NO_TCMALLOC'],
4050           }],
4051           ['linux_use_gold_flags==1', {
4052             'target_conditions': [
4053               ['_toolset=="target"', {
4054                 'ldflags': [
4055                   # Experimentation found that using four linking threads
4056                   # saved ~20% of link time.
4057                   # https://groups.google.com/a/chromium.org/group/chromium-dev/browse_thread/thread/281527606915bb36
4058                   # Only apply this to the target linker, since the host
4059                   # linker might not be gold, but isn't used much anyway.
4060                   # TODO(raymes): Disable threading because gold is frequently
4061                   # crashing on the bots: crbug.com/161942.
4062                   # '-Wl,--threads',
4063                   # '-Wl,--thread-count=4',
4064                 ],
4065               }],
4066             ],
4067             'conditions': [
4068               ['release_valgrind_build==0', {
4069                 'target_conditions': [
4070                   ['_toolset=="target"', {
4071                     'ldflags': [
4072                       # There seems to be a conflict of --icf and -pie
4073                       # in gold which can generate crashy binaries. As
4074                       # a security measure, -pie takes precedence for
4075                       # now.
4076                       #'-Wl,--icf=safe',
4077                       '-Wl,--icf=none',
4078                     ],
4079                   }],
4080                 ],
4081               }],
4082               # Newer gcc's support -fuse-ld, use the flag to force gold
4083               # selection.
4084               # gcc -- http://gcc.gnu.org/onlinedocs/gcc-4.8.0/gcc/Optimize-Options.html
4085               # TODO(mithro): Watch for clang support at following thread:
4086               # http://clang-developers.42468.n3.nabble.com/Adding-fuse-ld-support-to-clang-td4032180.html
4087               ['gcc_version>=48', {
4088                 'target_conditions': [
4089                   ['_toolset=="target"', {
4090                     'ldflags': [
4091                       '-fuse-ld=gold',
4092                     ],
4093                   }],
4094                 ],
4095               }],
4096               ['host_gcc_version>=48', {
4097                 'target_conditions': [
4098                   ['_toolset=="host"', {
4099                     'ldflags': [
4100                       '-fuse-ld=gold',
4101                     ],
4102                   }],
4103                 ],
4104               }],
4105             ],
4106           }],
4107           ['linux_use_bundled_binutils==1', {
4108             'cflags': [
4109               '-B<!(cd <(DEPTH) && pwd -P)/<(binutils_dir)',
4110             ],
4111           }],
4112           ['linux_use_bundled_gold==1', {
4113             # Put our binutils, which contains gold in the search path. We pass
4114             # the path to gold to the compiler. gyp leaves unspecified what the
4115             # cwd is when running the compiler, so the normal gyp path-munging
4116             # fails us. This hack gets the right path.
4117             'ldflags': [
4118               '-B<!(cd <(DEPTH) && pwd -P)/<(binutils_dir)',
4119             ],
4120           }],
4121           # Some binutils 2.23 releases may or may not have new dtags enabled,
4122           # but they are all compatible with --disable-new-dtags,
4123           # because the new dynamic tags are not created by default.
4124           ['binutils_version>=223', {
4125             # Newer binutils don't set DT_RPATH unless you disable "new" dtags
4126             # and the new DT_RUNPATH doesn't work without --no-as-needed flag.
4127             # FIXME(mithro): Figure out the --as-needed/--no-as-needed flags
4128             # inside this file to allow usage of --no-as-needed and removal of
4129             # this flag.
4130             'ldflags': [
4131               '-Wl,--disable-new-dtags',
4132             ],
4133           }]
4134         ],
4135       },
4136     }],
4137     # FreeBSD-specific options; note that most FreeBSD options are set above,
4138     # with Linux.
4139     ['OS=="freebsd"', {
4140       'target_defaults': {
4141         'ldflags': [
4142           '-Wl,--no-keep-memory',
4143         ],
4144       },
4145     }],
4146     # Android-specific options; note that most are set above with Linux.
4147     ['OS=="android"', {
4148       'variables': {
4149         # This is a unique identifier for a given build. It's used for
4150         # identifying various build artifacts corresponding to a particular
4151         # build of chrome (e.g. where to find archived symbols).
4152         'chrome_build_id%': '',
4153         'conditions': [
4154           # Use shared stlport library when system one used.
4155           # Figure this out early since it needs symbols from libgcc.a, so it
4156           # has to be before that in the set of libraries.
4157           ['use_system_stlport==1', {
4158             'android_stlport_library': 'stlport',
4159           }, {
4160             'conditions': [
4161               ['component=="shared_library"', {
4162                   'android_stlport_library': 'stlport_shared',
4163               }, {
4164                   'android_stlport_library': 'stlport_static',
4165               }],
4166             ],
4167           }],
4168         ],
4169
4170         # Placing this variable here prevents from forking libvpx, used
4171         # by remoting.  Remoting is off, so it needn't built,
4172         # so forking it's deps seems like overkill.
4173         # But this variable need defined to properly run gyp.
4174         # A proper solution is to have an OS==android conditional
4175         # in third_party/libvpx/libvpx.gyp to define it.
4176         'libvpx_path': 'lib/linux/arm',
4177       },
4178       'target_defaults': {
4179         'variables': {
4180           'release_extra_cflags%': '',
4181           'conditions': [
4182             # If we're using the components build, append "cr" to all shared
4183             # libraries to avoid naming collisions with android system library
4184             # versions with the same name (e.g. skia, icu).
4185             ['component=="shared_library"', {
4186               'android_product_extension': 'cr.so',
4187             }, {
4188               'android_product_extension': 'so',
4189             } ],
4190           ],
4191         },
4192         'target_conditions': [
4193           ['_type=="shared_library"', {
4194            'product_extension': '<(android_product_extension)',
4195           }],
4196
4197           # Settings for building device targets using Android's toolchain.
4198           # These are based on the setup.mk file from the Android NDK.
4199           #
4200           # The NDK Android executable link step looks as follows:
4201           #  $LDFLAGS
4202           #  $(TARGET_CRTBEGIN_DYNAMIC_O)  <-- crtbegin.o
4203           #  $(PRIVATE_OBJECTS)            <-- The .o that we built
4204           #  $(PRIVATE_STATIC_LIBRARIES)   <-- The .a that we built
4205           #  $(TARGET_LIBGCC)              <-- libgcc.a
4206           #  $(PRIVATE_SHARED_LIBRARIES)   <-- The .so that we built
4207           #  $(PRIVATE_LDLIBS)             <-- System .so
4208           #  $(TARGET_CRTEND_O)            <-- crtend.o
4209           #
4210           # For now the above are approximated for executables by adding
4211           # crtbegin.o to the end of the ldflags and 'crtend.o' to the end
4212           # of 'libraries'.
4213           #
4214           # The NDK Android shared library link step looks as follows:
4215           #  $LDFLAGS
4216           #  $(PRIVATE_OBJECTS)            <-- The .o that we built
4217           #  -l,--whole-archive
4218           #  $(PRIVATE_WHOLE_STATIC_LIBRARIES)
4219           #  -l,--no-whole-archive
4220           #  $(PRIVATE_STATIC_LIBRARIES)   <-- The .a that we built
4221           #  $(TARGET_LIBGCC)              <-- libgcc.a
4222           #  $(PRIVATE_SHARED_LIBRARIES)   <-- The .so that we built
4223           #  $(PRIVATE_LDLIBS)             <-- System .so
4224           #
4225           # For now, assume that whole static libraries are not needed.
4226           #
4227           # For both executables and shared libraries, add the proper
4228           # libgcc.a to the start of libraries which puts it in the
4229           # proper spot after .o and .a files get linked in.
4230           #
4231           # TODO: The proper thing to do longer-tem would be proper gyp
4232           # support for a custom link command line.
4233           ['_toolset=="target"', {
4234             'cflags!': [
4235               '-pthread',  # Not supported by Android toolchain.
4236             ],
4237             'cflags': [
4238               '-ffunction-sections',
4239               '-funwind-tables',
4240               '-g',
4241               '-fstack-protector',
4242               '-fno-short-enums',
4243               '-finline-limit=64',
4244               '-Wa,--noexecstack',
4245               '<@(release_extra_cflags)',
4246             ],
4247             'defines': [
4248               'ANDROID',
4249               '__GNU_SOURCE=1',  # Necessary for clone()
4250               'USE_STLPORT=1',
4251               '_STLP_USE_PTR_SPECIALIZATIONS=1',
4252               'CHROME_BUILD_ID="<(chrome_build_id)"',
4253             ],
4254             'ldflags!': [
4255               '-pthread',  # Not supported by Android toolchain.
4256             ],
4257             'ldflags': [
4258               '-nostdlib',
4259               '-Wl,--no-undefined',
4260               # Don't export symbols from statically linked libraries.
4261               '-Wl,--exclude-libs=ALL',
4262             ],
4263             'libraries': [
4264               '-l<(android_stlport_library)',
4265               # Manually link the libgcc.a that the cross compiler uses.
4266               '<!(<(android_toolchain)/*-gcc -print-libgcc-file-name)',
4267               '-lc',
4268               '-ldl',
4269               '-lm',
4270             ],
4271             'conditions': [
4272               ['component=="shared_library"', {
4273                 'ldflags!': [
4274                   '-Wl,--exclude-libs=ALL',
4275                 ],
4276               }],
4277               ['clang==1', {
4278                 'cflags': [
4279                   # Work around incompatibilities between bionic and clang
4280                   # headers.
4281                   '-D__compiler_offsetof=__builtin_offsetof',
4282                   '-Dnan=__builtin_nan',
4283                 ],
4284                 'conditions': [
4285                   ['target_arch=="arm"', {
4286                     'cflags': [
4287                       '-target arm-linux-androideabi',
4288                     ],
4289                     'ldflags': [
4290                       '-target arm-linux-androideabi',
4291                     ],
4292                   }],
4293                   ['target_arch=="ia32"', {
4294                     'cflags': [
4295                       '-target x86-linux-androideabi',
4296                     ],
4297                     'ldflags': [
4298                       '-target x86-linux-androideabi',
4299                     ],
4300                   }],
4301                   # Place holder for x64 support, not tested.
4302                   # TODO: Enable clang support for Android x64. http://crbug.com/346626
4303                   ['target_arch=="x64"', {
4304                     'cflags': [
4305                       '-target x86_64-linux-androideabi',
4306                     ],
4307                     'ldflags': [
4308                       '-target x86_64-linux-androideabi',
4309                     ],
4310                   }],
4311                 ],
4312               }],
4313               ['asan==1', {
4314                 'cflags': [
4315                   # Android build relies on -Wl,--gc-sections removing
4316                   # unreachable code. ASan instrumentation for globals inhibits
4317                   # this and results in a library with unresolvable relocations.
4318                   # TODO(eugenis): find a way to reenable this.
4319                   '-mllvm -asan-globals=0',
4320                 ],
4321               }],
4322               ['android_webview_build==0', {
4323                 'defines': [
4324                   # The NDK has these things, but doesn't define the constants
4325                   # to say that it does. Define them here instead.
4326                   'HAVE_SYS_UIO_H',
4327                 ],
4328                 'cflags': [
4329                   '--sysroot=<(android_ndk_sysroot)',
4330                 ],
4331                 'ldflags': [
4332                   '--sysroot=<(android_ndk_sysroot)',
4333                 ],
4334               }],
4335               ['android_webview_build==1', {
4336                 'include_dirs': [
4337                   # OpenAL headers from the Android tree.
4338                   '<(android_src)/frameworks/wilhelm/include',
4339                 ],
4340                 'cflags': [
4341                   # Android predefines this as 1; undefine it here so Chromium
4342                   # can redefine it later to be 2 for chromium code and unset
4343                   # for third party code. This works because cflags are added
4344                   # before defines.
4345                   '-U_FORTIFY_SOURCE',
4346                   # Disable any additional warnings enabled by the Android build system but which
4347                   # chromium does not build cleanly with (when treating warning as errors).
4348                   # Things that are part of -Wextra:
4349                   '-Wno-extra', # Enabled by -Wextra, but no specific flag
4350                   '-Wno-ignored-qualifiers',
4351                   '-Wno-type-limits',
4352                   '-Wno-unused-but-set-variable',
4353                 ],
4354                 'cflags_cc': [
4355                   # Other things unrelated to -Wextra:
4356                   '-Wno-non-virtual-dtor',
4357                   '-Wno-sign-promo',
4358                 ],
4359               }],
4360               ['android_webview_build==1', {
4361                 'target_conditions': [
4362                   ['chromium_code==0', {
4363                     'cflags': [
4364                       # There is a class of warning which:
4365                       #  1) Android always enables and also treats as errors
4366                       #  2) Chromium ignores in third party code
4367                       # So we re-enable those warnings when building Android.
4368                       '-Wno-address',
4369                       '-Wno-format-security',
4370                       '-Wno-return-type',
4371                       '-Wno-sequence-point',
4372                     ],
4373                     'cflags_cc': [
4374                       '-Wno-non-virtual-dtor',
4375                     ],
4376                   }],
4377                 ],
4378               }],
4379               ['target_arch == "arm"', {
4380                 'ldflags': [
4381                   # Enable identical code folding to reduce size.
4382                   '-Wl,--icf=safe',
4383                 ],
4384               }],
4385               # NOTE: The stlport header include paths below are specified in
4386               # cflags rather than include_dirs because they need to come
4387               # after include_dirs. Think of them like system headers, but
4388               # don't use '-isystem' because the arm-linux-androideabi-4.4.3
4389               # toolchain (circa Gingerbread) will exhibit strange errors.
4390               # The include ordering here is important; change with caution.
4391               ['use_system_stlport==1', {
4392                 'cflags': [
4393                   # For libstdc++/include, which is used by stlport.
4394                   '-I<(android_src)/bionic',
4395                   '-I<(android_src)/external/stlport/stlport',
4396                 ],
4397               }, { # else: use_system_stlport!=1
4398                 'cflags': [
4399                   '-I<(android_stlport_include)',
4400                 ],
4401                 'ldflags': [
4402                   '-L<(android_stlport_libs_dir)',
4403                 ],
4404               }],
4405               ['target_arch=="ia32"', {
4406                 # The x86 toolchain currently has problems with stack-protector.
4407                 'cflags!': [
4408                   '-fstack-protector',
4409                 ],
4410                 'cflags': [
4411                   '-fno-stack-protector',
4412                 ],
4413               }],
4414             ],
4415             'target_conditions': [
4416               ['_type=="executable"', {
4417                 # Force android tools to export the "main" symbol so they can be
4418                 # loaded on ICS using the run_pie wrapper. See crbug.com/373219.
4419                 # TODO(primiano): remove -fvisibility and -rdynamic flags below
4420                 # when ICS support will be dropped.
4421                 'cflags': [
4422                   '-fPIE',
4423                   '-fvisibility=default',
4424                 ],
4425                 'ldflags': [
4426                   '-Bdynamic',
4427                   '-Wl,--gc-sections',
4428                   '-Wl,-z,nocopyreloc',
4429                   '-pie',
4430                   '-rdynamic',
4431                   # crtbegin_dynamic.o should be the last item in ldflags.
4432                   '<(android_ndk_lib)/crtbegin_dynamic.o',
4433                 ],
4434                 'libraries': [
4435                   # crtend_android.o needs to be the last item in libraries.
4436                   # Do not add any libraries after this!
4437                   '<(android_ndk_lib)/crtend_android.o',
4438                 ],
4439               }],
4440               ['_type=="shared_library" or _type=="loadable_module"', {
4441                 'ldflags!': [
4442                   '-Wl,--exclude-libs=ALL',
4443                 ],
4444                 'ldflags': [
4445                   '-Wl,-shared,-Bsymbolic',
4446                 ],
4447                 'conditions': [
4448                   ['android_webview_build==0', {
4449                     'ldflags': [
4450                       # crtbegin_so.o should be the last item in ldflags.
4451                       '<(android_ndk_lib)/crtbegin_so.o',
4452                     ],
4453                     'libraries': [
4454                       # crtend_so.o needs to be the last item in libraries.
4455                       # Do not add any libraries after this!
4456                       '<(android_ndk_lib)/crtend_so.o',
4457                     ],
4458                   }],
4459                 ],
4460               }],
4461             ],
4462           }],
4463           # Settings for building host targets using the system toolchain.
4464           ['_toolset=="host"', {
4465             'cflags!': [
4466               # Due to issues in Clang build system, using ASan on 32-bit
4467               # binaries on x86_64 host is problematic.
4468               # TODO(eugenis): re-enable.
4469               '-fsanitize=address',
4470               '-w',  # http://crbug.com/162783
4471             ],
4472             'ldflags!': [
4473               '-fsanitize=address',
4474               '-Wl,-z,noexecstack',
4475               '-Wl,--gc-sections',
4476               '-Wl,-O1',
4477               '-Wl,--as-needed',
4478               '-Wl,--warn-shared-textrel',
4479               '-Wl,--fatal-warnings',
4480             ],
4481           }],
4482           # Settings for building host targets on mac.
4483           ['_toolset=="host" and host_os=="mac"', {
4484             'ldflags!': [
4485               '-Wl,-z,now',
4486               '-Wl,-z,relro',
4487             ],
4488           }],
4489         ],
4490       },
4491     }],
4492     ['OS=="solaris"', {
4493       'cflags!': ['-fvisibility=hidden'],
4494       'cflags_cc!': ['-fvisibility-inlines-hidden'],
4495     }],
4496     ['OS=="mac" or OS=="ios"', {
4497       'target_defaults': {
4498         'mac_bundle': 0,
4499         'xcode_settings': {
4500           'ALWAYS_SEARCH_USER_PATHS': 'NO',
4501           # Don't link in libarclite_macosx.a, see http://crbug.com/156530.
4502           'CLANG_LINK_OBJC_RUNTIME': 'NO',          # -fno-objc-link-runtime
4503           'COPY_PHASE_STRIP': 'NO',
4504           'GCC_C_LANGUAGE_STANDARD': 'c99',         # -std=c99
4505           'GCC_CW_ASM_SYNTAX': 'NO',                # No -fasm-blocks
4506           'GCC_ENABLE_CPP_EXCEPTIONS': 'NO',        # -fno-exceptions
4507           'GCC_ENABLE_CPP_RTTI': 'NO',              # -fno-rtti
4508           'GCC_ENABLE_PASCAL_STRINGS': 'NO',        # No -mpascal-strings
4509           # GCC_INLINES_ARE_PRIVATE_EXTERN maps to -fvisibility-inlines-hidden
4510           'GCC_INLINES_ARE_PRIVATE_EXTERN': 'YES',
4511           'GCC_OBJC_CALL_CXX_CDTORS': 'YES',        # -fobjc-call-cxx-cdtors
4512           'GCC_SYMBOLS_PRIVATE_EXTERN': 'YES',      # -fvisibility=hidden
4513           'GCC_THREADSAFE_STATICS': 'NO',           # -fno-threadsafe-statics
4514           'GCC_TREAT_WARNINGS_AS_ERRORS': 'YES',    # -Werror
4515           'GCC_VERSION': '4.2',
4516           'GCC_WARN_ABOUT_MISSING_NEWLINE': 'YES',  # -Wnewline-eof
4517           'USE_HEADERMAP': 'NO',
4518           'WARNING_CFLAGS': [
4519             '-Wall',
4520             '-Wendif-labels',
4521             '-Wextra',
4522             # Don't warn about unused function parameters.
4523             '-Wno-unused-parameter',
4524             # Don't warn about the "struct foo f = {0};" initialization
4525             # pattern.
4526             '-Wno-missing-field-initializers',
4527           ],
4528           'conditions': [
4529             ['chromium_mac_pch', {'GCC_PRECOMPILE_PREFIX_HEADER': 'YES'},
4530                                  {'GCC_PRECOMPILE_PREFIX_HEADER': 'NO'}
4531             ],
4532             # Note that the prebuilt Clang binaries should not be used for iOS
4533             # development except for ASan builds.
4534             ['clang==1', {
4535               # gnu++11 instead of c++11 is needed because some code uses
4536               # typeof() (a GNU extension).
4537               # TODO(thakis): Eventually switch this to c++11 instead of
4538               # gnu++11 (once typeof can be removed, which is blocked on c++11
4539               # being available everywhere).
4540               'CLANG_CXX_LANGUAGE_STANDARD': 'gnu++11',  # -std=gnu++11
4541               # Warn if automatic synthesis is triggered with
4542               # the -Wobjc-missing-property-synthesis flag.
4543               'CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS': 'YES',
4544               'GCC_VERSION': 'com.apple.compilers.llvm.clang.1_0',
4545               'WARNING_CFLAGS': [
4546                 '-Wheader-hygiene',
4547
4548                 # This warns on using ints as initializers for floats in
4549                 # initializer lists (e.g. |int a = f(); CGSize s = { a, a };|),
4550                 # which happens in several places in chrome code. Not sure if
4551                 # this is worth fixing.
4552                 '-Wno-c++11-narrowing',
4553
4554                 # Don't die on dtoa code that uses a char as an array index.
4555                 # This is required solely for base/third_party/dmg_fp/dtoa.cc.
4556                 '-Wno-char-subscripts',
4557
4558                 # TODO(thakis): This used to be implied by -Wno-unused-function,
4559                 # which we no longer use. Check if it makes sense to remove
4560                 # this as well. http://crbug.com/316352
4561                 '-Wno-unneeded-internal-declaration',
4562
4563                 # Warns on switches on enums that cover all enum values but
4564                 # also contain a default: branch. Chrome is full of that.
4565                 '-Wno-covered-switch-default',
4566
4567                 # Warns when a const char[] is converted to bool.
4568                 '-Wstring-conversion',
4569
4570                 # Clang considers the `register` keyword as deprecated, but
4571                 # e.g. code generated by flex (used in angle) contains that
4572                 # keyword. http://crbug.com/255186
4573                 '-Wno-deprecated-register',
4574
4575                 # This warns on selectors from Cocoa headers (-length, -set).
4576                 # cfe-dev is currently discussing the merits of this warning.
4577                 # TODO(thakis): Reevaluate what to do with this, based one
4578                 # cfe-dev discussion.
4579                 '-Wno-selector-type-mismatch',
4580               ],
4581
4582               'conditions': [
4583                 ['clang_xcode==0', {
4584                   'CC': '$(SOURCE_ROOT)/<(clang_dir)/clang',
4585                   'LDPLUSPLUS': '$(SOURCE_ROOT)/<(clang_dir)/clang++',
4586                 }],
4587               ],
4588             }],
4589             ['clang==1 and clang_xcode==0 and clang_use_chrome_plugins==1', {
4590               'OTHER_CFLAGS': [
4591                 '<@(clang_chrome_plugins_flags)',
4592               ],
4593             }],
4594             ['clang==1 and clang_xcode==0 and clang_load!=""', {
4595               'OTHER_CFLAGS': [
4596                 '-Xclang', '-load', '-Xclang', '<(clang_load)',
4597               ],
4598             }],
4599             ['clang==1 and clang_xcode==0 and clang_add_plugin!=""', {
4600               'OTHER_CFLAGS': [
4601                 '-Xclang', '-add-plugin', '-Xclang', '<(clang_add_plugin)',
4602               ],
4603             }],
4604             ['clang==1 and "<(GENERATOR)"=="ninja"', {
4605               'OTHER_CFLAGS': [
4606                 # See http://crbug.com/110262
4607                 '-fcolor-diagnostics',
4608               ],
4609             }],
4610             ['OS=="ios" and target_subarch!="arm32" and \
4611               "<(GENERATOR)"=="xcode"', {
4612               'OTHER_CFLAGS': [
4613                 # TODO(ios): when building Chrome for iOS on 64-bit platform
4614                 # with Xcode, the -Wshorted-64-to-32 warning is automatically
4615                 # enabled. This cause failures when compiling protobuf code,
4616                 # so disable the warning. http://crbug.com/359107
4617                 '-Wno-shorten-64-to-32',
4618               ],
4619             }],
4620           ],
4621         },
4622         'conditions': [
4623           ['clang==1', {
4624             'variables': {
4625               'clang_dir': '../third_party/llvm-build/Release+Asserts/bin',
4626             },
4627           }],
4628           ['asan==1', {
4629             'xcode_settings': {
4630               'OTHER_CFLAGS': [
4631                 '-fsanitize=address',
4632                 '-mllvm -asan-globals=0',  # http://crbug.com/352073
4633                 '-w',  # http://crbug.com/162783
4634                 '-gline-tables-only',
4635               ],
4636             },
4637           }],
4638           ['asan_coverage!=0', {
4639             'target_conditions': [
4640               ['_toolset=="target"', {
4641                 'cflags': [
4642                   '-mllvm -asan-coverage=<(asan_coverage)',
4643                 ],
4644               }],
4645             ],
4646           }],
4647         ],
4648         'target_conditions': [
4649           ['_type!="static_library"', {
4650             'xcode_settings': {'OTHER_LDFLAGS': ['-Wl,-search_paths_first']},
4651             'conditions': [
4652               ['asan==1', {
4653                 'xcode_settings': {
4654                   'OTHER_LDFLAGS': [
4655                     '-fsanitize=address',
4656                   ],
4657                 },
4658               }],
4659               ['mac_write_linker_maps==1', {
4660                 'xcode_settings': {
4661                   'OTHER_LDFLAGS': [
4662                     '-Wl,-map,>(_target_name).map',
4663                   ],
4664                 },
4665               }],
4666             ],
4667           }],
4668           ['_mac_bundle', {
4669             'xcode_settings': {'OTHER_LDFLAGS': ['-Wl,-ObjC']},
4670             'target_conditions': [
4671               ['_type=="executable"', {
4672                 'conditions': [
4673                   ['asan==1', {
4674                     'postbuilds': [
4675                       {
4676                         'variables': {
4677                           # Define copy_asan_dylib_path in a variable ending in
4678                           # _path so that gyp understands it's a path and
4679                           # performs proper relativization during dict merging.
4680                           'copy_asan_dylib_path':
4681                             'mac/copy_asan_runtime_dylib.sh',
4682                         },
4683                         'postbuild_name': 'Copy ASan runtime dylib',
4684                         'action': [
4685                           '<(copy_asan_dylib_path)',
4686                         ],
4687                       },
4688                     ],
4689                   }],
4690                 ],
4691               }],
4692             ],
4693           }],
4694         ],  # target_conditions
4695       },  # target_defaults
4696     }],  # OS=="mac" or OS=="ios"
4697     ['OS=="mac"', {
4698       'target_defaults': {
4699         'defines': [
4700           # Prevent Mac OS X AssertMacros.h from defining macros that collide
4701           # with common names, like 'check', 'require', and 'verify'.
4702           # (Included by system header. Also exists on iOS but not included.)
4703           # http://opensource.apple.com/source/CarbonHeaders/CarbonHeaders-18.1/AssertMacros.h
4704           '__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORE=0',
4705         ],
4706         'variables': {
4707           # These should end with %, but there seems to be a bug with % in
4708           # variables that are intended to be set to different values in
4709           # different targets, like these.
4710           'mac_pie': 1,        # Most executables can be position-independent.
4711           # Strip debugging symbols from the target.
4712           'mac_strip': '<(mac_strip_release)',
4713           'conditions': [
4714             ['asan==1', {
4715               'conditions': [
4716                 ['mac_want_real_dsym=="default"', {
4717                   'mac_real_dsym': 1,
4718                 }, {
4719                   'mac_real_dsym': '<(mac_want_real_dsym)'
4720                 }],
4721               ],
4722             }, {
4723               'conditions': [
4724                 ['mac_want_real_dsym=="default"', {
4725                   'mac_real_dsym': 0, # Fake .dSYMs are fine in most cases.
4726                 }, {
4727                   'mac_real_dsym': '<(mac_want_real_dsym)'
4728                 }],
4729               ],
4730             }],
4731           ],
4732         },
4733         'xcode_settings': {
4734           'GCC_DYNAMIC_NO_PIC': 'NO',               # No -mdynamic-no-pic
4735                                                     # (Equivalent to -fPIC)
4736           # MACOSX_DEPLOYMENT_TARGET maps to -mmacosx-version-min
4737           'MACOSX_DEPLOYMENT_TARGET': '<(mac_deployment_target)',
4738           # Keep pch files below xcodebuild/.
4739           'SHARED_PRECOMPS_DIR': '$(CONFIGURATION_BUILD_DIR)/SharedPrecompiledHeaders',
4740           'OTHER_CFLAGS': [
4741             # Someday this can be replaced by an 'GCC_STRICT_ALIASING': 'NO'
4742             # xcode_setting, but not until all downstream projects' mac bots are
4743             # using xcode >= 4.6, because that's when the default value of the
4744             # flag in the compiler switched.  Pre-4.6, the value 'NO' for that
4745             # setting is a no-op as far as xcode is concerned, but the compiler
4746             # behaves differently based on whether -fno-strict-aliasing is
4747             # specified or not.
4748             '-fno-strict-aliasing',  # See http://crbug.com/32204.
4749           ],
4750         },
4751         'target_conditions': [
4752           ['_type=="executable"', {
4753             'postbuilds': [
4754               {
4755                 # Arranges for data (heap) pages to be protected against
4756                 # code execution when running on Mac OS X 10.7 ("Lion"), and
4757                 # ensures that the position-independent executable (PIE) bit
4758                 # is set for ASLR when running on Mac OS X 10.5 ("Leopard").
4759                 'variables': {
4760                   # Define change_mach_o_flags in a variable ending in _path
4761                   # so that GYP understands it's a path and performs proper
4762                   # relativization during dict merging.
4763                   'change_mach_o_flags_path':
4764                       'mac/change_mach_o_flags_from_xcode.sh',
4765                   'change_mach_o_flags_options%': [
4766                   ],
4767                   'target_conditions': [
4768                     ['mac_pie==0 or release_valgrind_build==1', {
4769                       # Don't enable PIE if it's unwanted. It's unwanted if
4770                       # the target specifies mac_pie=0 or if building for
4771                       # Valgrind, because Valgrind doesn't understand slide.
4772                       # See the similar mac_pie/release_valgrind_build check
4773                       # below.
4774                       'change_mach_o_flags_options': [
4775                         '--no-pie',
4776                       ],
4777                     }],
4778                   ],
4779                 },
4780                 'postbuild_name': 'Change Mach-O Flags',
4781                 'action': [
4782                   '<(change_mach_o_flags_path)',
4783                   '>@(change_mach_o_flags_options)',
4784                 ],
4785               },
4786             ],
4787             'conditions': [
4788               ['asan==1', {
4789                 'variables': {
4790                  'asan_saves_file': 'asan.saves',
4791                 },
4792                 'xcode_settings': {
4793                   'CHROMIUM_STRIP_SAVE_FILE': '<(asan_saves_file)',
4794                 },
4795               }],
4796             ],
4797             'target_conditions': [
4798               ['mac_pie==1 and release_valgrind_build==0', {
4799                 # Turn on position-independence (ASLR) for executables. When
4800                 # PIE is on for the Chrome executables, the framework will
4801                 # also be subject to ASLR.
4802                 # Don't do this when building for Valgrind, because Valgrind
4803                 # doesn't understand slide. TODO: Make Valgrind on Mac OS X
4804                 # understand slide, and get rid of the Valgrind check.
4805                 'xcode_settings': {
4806                   'OTHER_LDFLAGS': [
4807                     '-Wl,-pie',  # Position-independent executable (MH_PIE)
4808                   ],
4809                 },
4810               }],
4811             ],
4812           }],
4813           ['(_type=="executable" or _type=="shared_library" or \
4814              _type=="loadable_module") and mac_strip!=0', {
4815             'target_conditions': [
4816               ['mac_real_dsym == 1', {
4817                 # To get a real .dSYM bundle produced by dsymutil, set the
4818                 # debug information format to dwarf-with-dsym.  Since
4819                 # strip_from_xcode will not be used, set Xcode to do the
4820                 # stripping as well.
4821                 'configurations': {
4822                   'Release_Base': {
4823                     'xcode_settings': {
4824                       'DEBUG_INFORMATION_FORMAT': 'dwarf-with-dsym',
4825                       'DEPLOYMENT_POSTPROCESSING': 'YES',
4826                       'STRIP_INSTALLED_PRODUCT': 'YES',
4827                       'target_conditions': [
4828                         ['_type=="shared_library" or _type=="loadable_module"', {
4829                           # The Xcode default is to strip debugging symbols
4830                           # only (-S).  Local symbols should be stripped as
4831                           # well, which will be handled by -x.  Xcode will
4832                           # continue to insert -S when stripping even when
4833                           # additional flags are added with STRIPFLAGS.
4834                           'STRIPFLAGS': '-x',
4835                         }],  # _type=="shared_library" or _type=="loadable_module"
4836                         ['_type=="executable"', {
4837                           'conditions': [
4838                             ['asan==1', {
4839                               'STRIPFLAGS': '-s $(CHROMIUM_STRIP_SAVE_FILE)',
4840                             }]
4841                           ],
4842                         }],  # _type=="executable" and asan==1
4843                       ],  # target_conditions
4844                     },  # xcode_settings
4845                   },  # configuration "Release"
4846                 },  # configurations
4847               }, {  # mac_real_dsym != 1
4848                 # To get a fast fake .dSYM bundle, use a post-build step to
4849                 # produce the .dSYM and strip the executable.  strip_from_xcode
4850                 # only operates in the Release configuration.
4851                 'postbuilds': [
4852                   {
4853                     'variables': {
4854                       # Define strip_from_xcode in a variable ending in _path
4855                       # so that gyp understands it's a path and performs proper
4856                       # relativization during dict merging.
4857                       'strip_from_xcode_path': 'mac/strip_from_xcode',
4858                     },
4859                     'postbuild_name': 'Strip If Needed',
4860                     'action': ['<(strip_from_xcode_path)'],
4861                   },
4862                 ],  # postbuilds
4863               }],  # mac_real_dsym
4864             ],  # target_conditions
4865           }],  # (_type=="executable" or _type=="shared_library" or
4866                #  _type=="loadable_module") and mac_strip!=0
4867         ],  # target_conditions
4868       },  # target_defaults
4869     }],  # OS=="mac"
4870     ['OS=="ios"', {
4871       'target_defaults': {
4872         'xcode_settings' : {
4873           # TODO(stuartmorgan): switch to c++0x (see TODOs in the clang
4874           # section above).
4875           'CLANG_CXX_LANGUAGE_STANDARD': 'gnu++0x',
4876
4877           'conditions': [
4878             # Older Xcodes do not support -Wno-deprecated-register, so pass an
4879             # additional flag to suppress the "unknown compiler option" error.
4880             # Restrict this flag to builds that are either compiling with Xcode
4881             # or compiling with Xcode's Clang.  This will allow Ninja builds to
4882             # continue failing on unknown compiler options.
4883             # TODO(rohitrao): This flag is temporary and should be removed as
4884             # soon as the iOS bots are updated to use Xcode 5.1.
4885             ['clang_xcode==1', {
4886               'WARNING_CFLAGS': [
4887                 '-Wno-unknown-warning-option',
4888               ],
4889             }],
4890
4891             # Limit the valid architectures depending on "target_subarch".
4892             # This need to include the "arm" architectures but also the "x86"
4893             # ones (they are used when building for the simulator).
4894             ['target_subarch=="arm32"', {
4895               'VALID_ARCHS': ['armv7', 'i386'],
4896             }],
4897             ['target_subarch=="arm64"', {
4898               'VALID_ARCHS': ['arm64', 'x86_64'],
4899             }],
4900             ['target_subarch=="both"', {
4901               'VALID_ARCHS': ['arm64', 'armv7', 'x86_64', 'i386'],
4902             }],
4903           ],
4904         },
4905         'target_conditions': [
4906           ['_toolset=="host"', {
4907             'xcode_settings': {
4908               'SDKROOT': 'macosx<(mac_sdk)',  # -isysroot
4909               'MACOSX_DEPLOYMENT_TARGET': '<(mac_deployment_target)',
4910               'VALID_ARCHS': [
4911                 'x86_64',
4912               ],
4913               'ARCHS': [
4914                 'x86_64',
4915               ],
4916             },
4917           }],
4918           ['_toolset=="target"', {
4919             'xcode_settings': {
4920               # This section should be for overriding host settings. But,
4921               # since we can't negate the iphone deployment target above, we
4922               # instead set it here for target only.
4923               'IPHONEOS_DEPLOYMENT_TARGET': '<(ios_deployment_target)',
4924               'ARCHS': ['$(ARCHS_STANDARD_INCLUDING_64_BIT)'],
4925             },
4926           }],
4927           ['_type=="executable"', {
4928             'configurations': {
4929               'Release_Base': {
4930                 'xcode_settings': {
4931                   'DEPLOYMENT_POSTPROCESSING': 'YES',
4932                   'STRIP_INSTALLED_PRODUCT': 'YES',
4933                 },
4934               },
4935               'Debug_Base': {
4936                 'xcode_settings': {
4937                   # Remove dSYM to reduce build time.
4938                   'DEBUG_INFORMATION_FORMAT': 'dwarf',
4939                 },
4940               },
4941             },
4942             'xcode_settings': {
4943               'conditions': [
4944                 ['chromium_ios_signing', {
4945                   # iOS SDK wants everything for device signed.
4946                   'CODE_SIGN_IDENTITY[sdk=iphoneos*]': 'iPhone Developer',
4947                 }, {
4948                   'CODE_SIGNING_REQUIRED': 'NO',
4949                   'CODE_SIGN_IDENTITY[sdk=iphoneos*]': '',
4950                 }],
4951               ],
4952             },
4953           }],
4954         ],  # target_conditions
4955       },  # target_defaults
4956     }],  # OS=="ios"
4957     ['OS=="win"', {
4958       'target_defaults': {
4959         'defines': [
4960           '_WIN32_WINNT=0x0602',
4961           'WINVER=0x0602',
4962           'WIN32',
4963           '_WINDOWS',
4964           'NOMINMAX',
4965           'PSAPI_VERSION=1',
4966           '_CRT_RAND_S',
4967           'CERT_CHAIN_PARA_HAS_EXTRA_FIELDS',
4968           'WIN32_LEAN_AND_MEAN',
4969           '_ATL_NO_OPENGL',
4970         ],
4971         'conditions': [
4972           ['buildtype=="Official"', {
4973               # In official builds, targets can self-select an optimization
4974               # level by defining a variable named 'optimize', and setting it
4975               # to one of
4976               # - "size", optimizes for minimal code size - the default.
4977               # - "speed", optimizes for speed over code size.
4978               # - "max", whole program optimization and link-time code
4979               #   generation. This is very expensive and should be used
4980               #   sparingly.
4981               'variables': {
4982                 'optimize%': 'size',
4983               },
4984               'msvs_settings': {
4985                 'VCLinkerTool': {
4986                   # Set /LTCG for the official builds.
4987                   'LinkTimeCodeGeneration': '1',
4988                 },
4989               },
4990               'target_conditions': [
4991                 ['optimize=="size"', {
4992                     'msvs_settings': {
4993                       'VCCLCompilerTool': {
4994                         # 1, optimizeMinSpace, Minimize Size (/O1)
4995                         'Optimization': '1',
4996                         # 2, favorSize - Favor small code (/Os)
4997                         'FavorSizeOrSpeed': '2',
4998                       },
4999                     },
5000                   },
5001                 ],
5002                 ['optimize=="speed"', {
5003                     'msvs_settings': {
5004                       'VCCLCompilerTool': {
5005                         # 2, optimizeMaxSpeed, Maximize Speed (/O2)
5006                         'Optimization': '2',
5007                         # 1, favorSpeed - Favor fast code (/Ot)
5008                         'FavorSizeOrSpeed': '1',
5009                       },
5010                     },
5011                   },
5012                 ],
5013                 ['optimize=="max"', {
5014                     # Disable Warning 4702 ("Unreachable code") for the WPO/PGO
5015                     # builds. Probably anything that this would catch that
5016                     # wouldn't be caught in a normal build isn't going to
5017                     # actually be a bug, so the incremental value of C4702 for
5018                     # PGO builds is likely very small.
5019                     'msvs_disabled_warnings': [
5020                       4702
5021                     ],
5022                     'msvs_settings': {
5023                       'VCCLCompilerTool': {
5024                         # 2, optimizeMaxSpeed, Maximize Speed (/O2)
5025                         'Optimization': '2',
5026                         # 1, favorSpeed - Favor fast code (/Ot)
5027                         'FavorSizeOrSpeed': '1',
5028                         # This implies link time code generation.
5029                         'WholeProgramOptimization': 'true',
5030                       },
5031                     },
5032                   },
5033                 ],
5034               ],
5035             },
5036           ],
5037           ['component=="static_library"', {
5038             'defines': [
5039               '_HAS_EXCEPTIONS=0',
5040             ],
5041           }],
5042           ['secure_atl', {
5043             'defines': [
5044               '_SECURE_ATL',
5045             ],
5046           }],
5047           ['msvs_express', {
5048             'configurations': {
5049               'x86_Base': {
5050                 'msvs_settings': {
5051                   'VCLinkerTool': {
5052                     'AdditionalLibraryDirectories':
5053                       ['<(windows_driver_kit_path)/lib/ATL/i386'],
5054                   },
5055                   'VCLibrarianTool': {
5056                     'AdditionalLibraryDirectories':
5057                       ['<(windows_driver_kit_path)/lib/ATL/i386'],
5058                   },
5059                 },
5060               },
5061               'x64_Base': {
5062                 'msvs_settings': {
5063                   'VCLibrarianTool': {
5064                     'AdditionalLibraryDirectories':
5065                       ['<(windows_driver_kit_path)/lib/ATL/amd64'],
5066                   },
5067                   'VCLinkerTool': {
5068                     'AdditionalLibraryDirectories':
5069                       ['<(windows_driver_kit_path)/lib/ATL/amd64'],
5070                   },
5071                 },
5072               },
5073             },
5074             # https://code.google.com/p/chromium/issues/detail?id=372451#c20
5075             # Warning 4702 ("Unreachable code") should be re-enabled once
5076             # Express users are updated to VS2013 Update 2.
5077             'msvs_disabled_warnings': [
5078               4702
5079             ],
5080             'msvs_settings': {
5081               'VCLinkerTool': {
5082                 # Explicitly required when using the ATL with express
5083                 'AdditionalDependencies': ['atlthunk.lib'],
5084
5085                 # ATL 8.0 included in WDK 7.1 makes the linker to generate
5086                 # almost eight hundred LNK4254 and LNK4078 warnings:
5087                 #   - warning LNK4254: section 'ATL' (50000040) merged into
5088                 #     '.rdata' (40000040) with different attributes
5089                 #   - warning LNK4078: multiple 'ATL' sections found with
5090                 #     different attributes
5091                 'AdditionalOptions': ['/ignore:4254', '/ignore:4078'],
5092               },
5093             },
5094             'msvs_system_include_dirs': [
5095               '<(windows_driver_kit_path)/inc/atl71',
5096               '<(windows_driver_kit_path)/inc/mfc42',
5097             ],
5098           }],
5099         ],
5100         'msvs_system_include_dirs': [
5101           '<(windows_sdk_path)/Include/shared',
5102           '<(windows_sdk_path)/Include/um',
5103           '<(windows_sdk_path)/Include/winrt',
5104           '$(VSInstallDir)/VC/atlmfc/include',
5105         ],
5106         'msvs_cygwin_shell': 0,
5107         'msvs_disabled_warnings': [
5108           4351, 4355, 4396, 4503, 4819,
5109           # TODO(maruel): These warnings are level 4. They will be slowly
5110           # removed as code is fixed.
5111           4100, 4121, 4125, 4127, 4130, 4131, 4189, 4201, 4238, 4244, 4245,
5112           4310, 4428, 4481, 4505, 4510, 4512, 4530, 4610, 4611, 4701, 4706,
5113         ],
5114         'msvs_settings': {
5115           'VCCLCompilerTool': {
5116             'AdditionalOptions': ['/MP'],
5117             'MinimalRebuild': 'false',
5118             'BufferSecurityCheck': 'true',
5119             'EnableFunctionLevelLinking': 'true',
5120             'RuntimeTypeInfo': 'false',
5121             'WarningLevel': '4',
5122             'WarnAsError': 'true',
5123             'DebugInformationFormat': '3',
5124             'conditions': [
5125               ['component=="shared_library"', {
5126                 'ExceptionHandling': '1',  # /EHsc
5127               }, {
5128                 'ExceptionHandling': '0',
5129               }],
5130             ],
5131           },
5132           'VCLibrarianTool': {
5133             'AdditionalOptions': ['/ignore:4221'],
5134             'AdditionalLibraryDirectories': [
5135               '<(windows_sdk_path)/Lib/win8/um/x86',
5136             ],
5137           },
5138           'VCLinkerTool': {
5139             'AdditionalDependencies': [
5140               'wininet.lib',
5141               'dnsapi.lib',
5142               'version.lib',
5143               'msimg32.lib',
5144               'ws2_32.lib',
5145               'usp10.lib',
5146               'psapi.lib',
5147               'dbghelp.lib',
5148               'winmm.lib',
5149               'shlwapi.lib',
5150             ],
5151             'AdditionalLibraryDirectories': [
5152               '<(windows_sdk_path)/Lib/win8/um/x86',
5153             ],
5154             'GenerateDebugInformation': 'true',
5155             'MapFileName': '$(OutDir)\\$(TargetName).map',
5156             'ImportLibrary': '$(OutDir)\\lib\\$(TargetName).lib',
5157             'FixedBaseAddress': '1',
5158             # SubSystem values:
5159             #   0 == not set
5160             #   1 == /SUBSYSTEM:CONSOLE
5161             #   2 == /SUBSYSTEM:WINDOWS
5162             # Most of the executables we'll ever create are tests
5163             # and utilities with console output.
5164             'SubSystem': '1',
5165           },
5166           'VCMIDLTool': {
5167             'GenerateStublessProxies': 'true',
5168             'TypeLibraryName': '$(InputName).tlb',
5169             'OutputDirectory': '$(IntDir)',
5170             'HeaderFileName': '$(InputName).h',
5171             'DLLDataFileName': '$(InputName).dlldata.c',
5172             'InterfaceIdentifierFileName': '$(InputName)_i.c',
5173             'ProxyFileName': '$(InputName)_p.c',
5174           },
5175           'VCResourceCompilerTool': {
5176             'Culture' : '1033',
5177             'AdditionalIncludeDirectories': [
5178               '<(DEPTH)',
5179               '<(SHARED_INTERMEDIATE_DIR)',
5180             ],
5181           },
5182           'target_conditions': [
5183             ['_type=="executable"', {
5184               'VCManifestTool': {
5185                 'EmbedManifest': 'true',
5186               },
5187             }],
5188             ['_type=="executable" and ">(win_exe_compatibility_manifest)"!=""', {
5189               'VCManifestTool': {
5190                 'AdditionalManifestFiles': [
5191                   '>(win_exe_compatibility_manifest)',
5192                 ],
5193               },
5194             }],
5195           ],
5196           'conditions': [
5197             ['clang==1', {
5198               # Building with Clang on Windows is a work in progress and very
5199               # experimental. See crbug.com/82385.
5200               'VCCLCompilerTool': {
5201                 'WarnAsError': 'false',
5202                 'RuntimeTypeInfo': 'false',
5203                 'AdditionalOptions': [
5204                   '-fmsc-version=1800',
5205                   '/fallback',
5206
5207                   # Many files use intrinsics without including this header.
5208                   # TODO(hans): Fix those files, or move this to sub-GYPs.
5209                   '/FIIntrin.h',
5210
5211                   # TODO(hans): Make this list shorter eventually.
5212                   '-Qunused-arguments',
5213                   '-Wno-c++11-compat-deprecated-writable-strings',
5214                   '-Wno-char-subscripts',
5215                   '-Wno-deprecated-declarations',
5216                   '-Wno-deprecated-register',
5217                   '-Wno-empty-body',
5218                   '-Wno-enum-conversion',
5219                   '-Wno-extra-tokens',
5220                   '-Wno-ignored-attributes',
5221                   '-Wno-incompatible-pointer-types',
5222                   '-Wno-int-to-void-pointer-cast',
5223                   '-Wno-invalid-noreturn',
5224                   '-Wno-logical-op-parentheses',
5225                   '-Wno-microsoft',
5226                   '-Wno-missing-braces',
5227                   '-Wno-missing-declarations',
5228                   '-Wno-msvc-include',
5229                   '-Wno-null-dereference',
5230                   '-Wno-overloaded-virtual',
5231                   '-Wno-parentheses',
5232                   '-Wno-pointer-sign',
5233                   '-Wno-reorder',
5234                   '-Wno-return-type-c-linkage',
5235                   '-Wno-self-assign',
5236                   '-Wno-sometimes-uninitialized',
5237                   '-Wno-switch',
5238                   '-Wno-tautological-compare',
5239                   '-Wno-unknown-pragmas',
5240                   '-Wno-unsequenced',
5241                   '-Wno-unused-function',
5242                   '-Wno-unused-private-field',
5243                   '-Wno-unused-value',
5244                   '-Wno-unused-variable',
5245                   '-ferror-limit=1',
5246                 ],
5247               },
5248             }],
5249             ['asan==1', {
5250               # ASan on Windows is a work in progress and very experimental.
5251               # See crbug.com/345874.
5252               'VCCLCompilerTool': {
5253                 'AdditionalOptions': [
5254                   '-fsanitize=address',
5255                 ],
5256                 'AdditionalIncludeDirectories': [
5257                   # MSVC needs to be able to find the sanitizer headers when
5258                   # invoked via /fallback. This is critical for using macros
5259                   # like ASAN_UNPOISON_MEMORY_REGION in files where we fall
5260                   # back.
5261                   '<(DEPTH)/<(make_clang_dir)/lib/clang/3.5.0/include_sanitizer',
5262                 ],
5263               },
5264               'VCLinkerTool': {
5265                 'AdditionalLibraryDirectories': [
5266                   # TODO(hans): If make_clang_dir is absolute, this breaks.
5267                   '<(DEPTH)/<(make_clang_dir)/lib/clang/3.5.0/lib/windows',
5268                 ],
5269               },
5270               'target_conditions': [
5271                 ['_type=="executable"', {
5272                   'VCLinkerTool': {
5273                     'AdditionalDependencies': [
5274                        'clang_rt.asan-i386.lib',
5275                     ],
5276                   },
5277                 }],
5278                 ['_type=="shared_library" or _type=="loadable_module"', {
5279                   'VCLinkerTool': {
5280                     'AdditionalDependencies': [
5281                        'clang_rt.asan_dll_thunk-i386.lib',
5282                     ],
5283                   },
5284                 }],
5285               ],
5286             }],
5287           ],
5288         },
5289       },
5290     }],
5291     ['disable_nacl==1', {
5292       'target_defaults': {
5293         'defines': [
5294           'DISABLE_NACL',
5295         ],
5296       },
5297     }],
5298     ['OS=="win" and msvs_use_common_linker_extras', {
5299       'target_defaults': {
5300         'msvs_settings': {
5301           'VCLinkerTool': {
5302             'DelayLoadDLLs': [
5303               'dbghelp.dll',
5304               'dwmapi.dll',
5305               'shell32.dll',
5306               'uxtheme.dll',
5307             ],
5308           },
5309         },
5310         'configurations': {
5311           'x86_Base': {
5312             'msvs_settings': {
5313               'VCLinkerTool': {
5314                 'AdditionalOptions': [
5315                   '/safeseh',
5316                   '/dynamicbase',
5317                   '/ignore:4199',
5318                   '/ignore:4221',
5319                   '/nxcompat',
5320                 ],
5321                 'conditions': [
5322                   ['syzyasan==0', {
5323                     'AdditionalOptions': ['/largeaddressaware'],
5324                   }],
5325                 ],
5326               },
5327             },
5328           },
5329           'x64_Base': {
5330             'msvs_settings': {
5331               'VCLinkerTool': {
5332                 'AdditionalOptions': [
5333                   # safeseh is not compatible with x64
5334                   '/dynamicbase',
5335                   '/ignore:4199',
5336                   '/ignore:4221',
5337                   '/nxcompat',
5338                 ],
5339               },
5340             },
5341           },
5342         },
5343       },
5344     }],
5345     ['enable_new_npdevice_api==1', {
5346       'target_defaults': {
5347         'defines': [
5348           'ENABLE_NEW_NPDEVICE_API',
5349         ],
5350       },
5351     }],
5352     # Don't warn about the "typedef 'foo' locally defined but not used"
5353     # for gcc 4.8.
5354     # TODO: remove this flag once all builds work. See crbug.com/227506
5355     ['gcc_version>=48', {
5356       'target_defaults': {
5357         'cflags': [
5358           '-Wno-unused-local-typedefs',
5359         ],
5360       },
5361     }],
5362     # We need a special case to handle the android webview build on mac because
5363     # the host gcc there doesn't accept this flag, but the target gcc may
5364     # require it.
5365     ['gcc_version>=48 and android_webview_build==1 and host_os=="mac"', {
5366       'target_defaults': {
5367         'target_conditions': [
5368           ['_toolset=="host"', {
5369             'cflags!': [
5370               '-Wno-unused-local-typedefs',
5371             ],
5372           }],
5373         ],
5374       },
5375     }],
5376     ['clang==1 and ((OS!="mac" and OS!="ios") or clang_xcode==0) '
5377         'and OS!="win"', {
5378       'make_global_settings': [
5379         ['CC', '<(make_clang_dir)/bin/clang'],
5380         ['CXX', '<(make_clang_dir)/bin/clang++'],
5381         ['CC.host', '$(CC)'],
5382         ['CXX.host', '$(CXX)'],
5383       ],
5384     }],
5385     ['clang==1 and OS=="win"', {
5386       'make_global_settings': [
5387         # On Windows, gyp's ninja generator only looks at CC.
5388         ['CC', '<(make_clang_dir)/bin/clang-cl'],
5389       ],
5390     }],
5391     ['OS=="android" and clang==0', {
5392       # Hardcode the compiler names in the Makefile so that
5393       # it won't depend on the environment at make time.
5394       'make_global_settings': [
5395         ['CC', '<!(/bin/echo -n <(android_toolchain)/*-gcc)'],
5396         ['CXX', '<!(/bin/echo -n <(android_toolchain)/*-g++)'],
5397         ['CC.host', '<!(which gcc)'],
5398         ['CXX.host', '<!(which g++)'],
5399       ],
5400     }],
5401     ['OS=="linux" and target_arch=="mipsel"', {
5402       'make_global_settings': [
5403         ['CC', '<(sysroot)/../bin/mipsel-linux-gnu-gcc'],
5404         ['CXX', '<(sysroot)/../bin/mipsel-linux-gnu-g++'],
5405         ['CC.host', '<!(which gcc)'],
5406         ['CXX.host', '<!(which g++)'],
5407       ],
5408     }],
5409
5410     # TODO(yyanagisawa): supports GENERATOR==make
5411     #  make generator doesn't support CC_wrapper without CC
5412     #  in make_global_settings yet.
5413     ['use_goma==1 and ("<(GENERATOR)"=="ninja" or clang==1)', {
5414       'make_global_settings': [
5415        ['CC_wrapper', '<(gomadir)/gomacc'],
5416        ['CXX_wrapper', '<(gomadir)/gomacc'],
5417        ['CC.host_wrapper', '<(gomadir)/gomacc'],
5418        ['CXX.host_wrapper', '<(gomadir)/gomacc'],
5419       ],
5420     }],
5421   ],
5422   'xcode_settings': {
5423     # DON'T ADD ANYTHING NEW TO THIS BLOCK UNLESS YOU REALLY REALLY NEED IT!
5424     # This block adds *project-wide* configuration settings to each project
5425     # file.  It's almost always wrong to put things here.  Specify your
5426     # custom xcode_settings in target_defaults to add them to targets instead.
5427
5428     'conditions': [
5429       # In an Xcode Project Info window, the "Base SDK for All Configurations"
5430       # setting sets the SDK on a project-wide basis. In order to get the
5431       # configured SDK to show properly in the Xcode UI, SDKROOT must be set
5432       # here at the project level.
5433       ['OS=="mac"', {
5434         'conditions': [
5435           ['mac_sdk_path==""', {
5436             'SDKROOT': 'macosx<(mac_sdk)',  # -isysroot
5437           }, {
5438             'SDKROOT': '<(mac_sdk_path)',  # -isysroot
5439           }],
5440         ],
5441       }],
5442       ['OS=="ios"', {
5443         'conditions': [
5444           ['ios_sdk_path==""', {
5445             'conditions': [
5446               # TODO(justincohen): Ninja only supports simulator for now.
5447               ['"<(GENERATOR)"=="xcode"', {
5448                 'SDKROOT': 'iphoneos<(ios_sdk)',  # -isysroot
5449               }, {
5450                 'SDKROOT': 'iphonesimulator<(ios_sdk)',  # -isysroot
5451               }],
5452             ],
5453           }, {
5454             'SDKROOT': '<(ios_sdk_path)',  # -isysroot
5455           }],
5456         ],
5457       }],
5458       ['OS=="ios"', {
5459         # Target both iPhone and iPad.
5460         'TARGETED_DEVICE_FAMILY': '1,2',
5461       }, {  # OS!="ios"
5462         'conditions': [
5463           ['target_arch=="x64"', {
5464             'ARCHS': [
5465               'x86_64'
5466             ],
5467           }],
5468           ['target_arch=="ia32"', {
5469             'ARCHS': [
5470               'i386'
5471             ],
5472           }],
5473         ],
5474       }],
5475     ],
5476
5477     # The Xcode generator will look for an xcode_settings section at the root
5478     # of each dict and use it to apply settings on a file-wide basis.  Most
5479     # settings should not be here, they should be in target-specific
5480     # xcode_settings sections, or better yet, should use non-Xcode-specific
5481     # settings in target dicts.  SYMROOT is a special case, because many other
5482     # Xcode variables depend on it, including variables such as
5483     # PROJECT_DERIVED_FILE_DIR.  When a source group corresponding to something
5484     # like PROJECT_DERIVED_FILE_DIR is added to a project, in order for the
5485     # files to appear (when present) in the UI as actual files and not red
5486     # red "missing file" proxies, the correct path to PROJECT_DERIVED_FILE_DIR,
5487     # and therefore SYMROOT, needs to be set at the project level.
5488     'SYMROOT': '<(DEPTH)/xcodebuild',
5489   },
5490 }