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