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