Backed out changeset 2450366cf7ca (bug 1891629) for causing win msix mochitest failures
[gecko.git] / build / gyp_includes / common.gypi
blob8acb3262786da222988d8d90e69c7d10a0308286
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
5 # IMPORTANT:
6 # Please don't directly include this file if you are building via gyp_chromium,
7 # since gyp_chromium is automatically forcing its inclusion.
9   # Variables expected to be overriden on the GYP command line (-D) or by
10   # ~/.gyp/include.gypi.
11   'variables': {
12     # Putting a variables dict inside another variables dict looks kind of
13     # weird.  This is done so that 'host_arch', 'chromeos', etc are defined as
14     # variables within the outer variables dict here.  This is necessary
15     # to get these variables defined for the conditions within this variables
16     # dict that operate on these variables.
17     'variables': {
18       'variables': {
19         'variables': {
20           'variables': {
21             # Whether we're building a ChromeOS build.
22             'chromeos%': 0,
24             # Whether or not we are using the Aura windowing framework.
25             'use_aura%': 0,
27             # Whether or not we are building the Ash shell.
28             'use_ash%': 0,
29           },
30           # Copy conditionally-set variables out one scope.
31           'chromeos%': '<(chromeos)',
32           'use_aura%': '<(use_aura)',
33           'use_ash%': '<(use_ash)',
35           # Whether we are using Views Toolkit
36           'toolkit_views%': 0,
38           # Use OpenSSL instead of NSS. Under development: see http://crbug.com/62803
39           'use_openssl%': 0,
41           'use_ibus%': 0,
43           # Disable viewport meta tag by default.
44           'enable_viewport%': 0,
46           # Enable HiDPI support.
47           'enable_hidpi%': 0,
49           # Enable touch optimized art assets and metrics.
50           'enable_touch_ui%': 0,
52           # Is this change part of the android upstream bringup?
53           # Allows us to *temporarily* disable certain things for
54           # staging.  Only set to 1 in a GYP_DEFINES.
55           'android_upstream_bringup%': 0,
57           # Override buildtype to select the desired build flavor.
58           # Dev - everyday build for development/testing
59           # Official - release build (generally implies additional processing)
60           # TODO(mmoss) Once 'buildtype' is fully supported (e.g. Windows gyp
61           # conversion is done), some of the things which are now controlled by
62           # 'branding', such as symbol generation, will need to be refactored
63           # based on 'buildtype' (i.e. we don't care about saving symbols for
64           # non-Official # builds).
65           'buildtype%': 'Dev',
67           'conditions': [
68             # ChromeOS implies ash.
69             ['chromeos==1', {
70               'use_ash%': 1,
71               'use_aura%': 1,
72             }],
74             # For now, Windows builds that |use_aura| should also imply using
75             # ash. This rule should be removed for the future when Windows is
76             # using the aura windows without the ash interface.
77             ['use_aura==1 and OS=="win"', {
78               'use_ash%': 1,
79             }],
80             ['use_ash==1', {
81               'use_aura%': 1,
82             }],
84             # A flag for BSD platforms
85             ['OS=="dragonfly" or OS=="freebsd" or OS=="netbsd" or \
86               OS=="openbsd"', {
87               'os_bsd%': 1,
88             }, {
89               'os_bsd%': 0,
90             }],
91           ],
92         },
93         # Copy conditionally-set variables out one scope.
94         'chromeos%': '<(chromeos)',
95         'use_aura%': '<(use_aura)',
96         'use_ash%': '<(use_ash)',
97         'os_bsd%': '<(os_bsd)',
98         'use_openssl%': '<(use_openssl)',
99         'use_ibus%': '<(use_ibus)',
100         'enable_viewport%': '<(enable_viewport)',
101         'enable_hidpi%': '<(enable_hidpi)',
102         'enable_touch_ui%': '<(enable_touch_ui)',
103         'android_upstream_bringup%': '<(android_upstream_bringup)',
104         'buildtype%': '<(buildtype)',
106         # Sets whether we're building with the Android SDK/NDK (and hence with
107         # Ant, value 0), or as part of the Android system (and hence with the
108         # Android build system, value 1).
109         'android_build_type%': 0,
111         # Compute the architecture that we're building on.
112         'conditions': [
113           ['OS=="win" or OS=="ios"', {
114             'host_arch%': 'ia32',
115           }, {
116             # This handles the Unix platforms for which there is some support.
117             # Anything else gets passed through, which probably won't work very
118             # well; such hosts should pass an explicit target_arch to gyp.
119             'host_arch%':
120               '<!(uname -m | sed -e "s/i.86/ia32/;s/x86_64/x64/;s/amd64/x64/;s/arm.*/arm/;s/i86pc/ia32/")',
121           }],
123           # Set default value of toolkit_views based on OS.
124           ['OS=="win" or chromeos==1 or use_aura==1', {
125             'toolkit_views%': 1,
126           }, {
127             'toolkit_views%': 0,
128           }],
130           # Set toolkit_uses_gtk for the Chromium browser on Linux.
131           ['(OS=="linux" or OS=="solaris" or os_bsd==1) and use_aura==0', {
132             'toolkit_uses_gtk%': 1,
133           }, {
134             'toolkit_uses_gtk%': 0,
135           }],
137           # Enable HiDPI on Mac OS and Chrome OS.
138           ['OS=="mac" or chromeos==1', {
139             'enable_hidpi%': 1,
140           }],
142           # Enable touch UI on Metro.
143           ['OS=="win"', {
144             'enable_touch_ui%': 1,
145           }],
146         ],
147       },
149       # Copy conditionally-set variables out one scope.
150       'chromeos%': '<(chromeos)',
151       'host_arch%': '<(host_arch)',
152       'toolkit_views%': '<(toolkit_views)',
153       'toolkit_uses_gtk%': '<(toolkit_uses_gtk)',
154       'use_aura%': '<(use_aura)',
155       'use_ash%': '<(use_ash)',
156       'os_bsd%': '<(os_bsd)',
157       'use_openssl%': '<(use_openssl)',
158       'use_ibus%': '<(use_ibus)',
159       'enable_viewport%': '<(enable_viewport)',
160       'enable_hidpi%': '<(enable_hidpi)',
161       'enable_touch_ui%': '<(enable_touch_ui)',
162       'android_upstream_bringup%': '<(android_upstream_bringup)',
163       'android_build_type%': '<(android_build_type)',
165       # We used to provide a variable for changing how libraries were built.
166       # This variable remains until we can clean up all the users.
167       # This needs to be one nested variables dict in so that dependent
168       # gyp files can make use of it in their outer variables.  (Yikes!)
169       # http://code.google.com/p/chromium/issues/detail?id=83308
170       'library%': 'static_library',
172       # Override branding to select the desired branding flavor.
173       'branding%': 'Chromium',
175       'buildtype%': '<(buildtype)',
177       # Default architecture we're building for is the architecture we're
178       # building on.
179       'target_arch%': '<(host_arch)',
181       # This variable tells WebCore.gyp and JavaScriptCore.gyp whether they are
182       # are built under a chromium full build (1) or a webkit.org chromium
183       # build (0).
184       'inside_chromium_build%': 1,
186       # Set to 1 to enable fast builds. It disables debug info for fastest
187       # compilation.
188       'fastbuild%': 0,
190       # Set to 1 to enable dcheck in release without having to use the flag.
191       'dcheck_always_on%': 0,
193       # Disable file manager component extension by default.
194       'file_manager_extension%': 0,
196       # Python version.
197       'python_ver%': '2.6',
199       # Set ARM version (for libyuv)
200       'arm_version%': 6,
202       # Set ARM-v7 compilation flags
203       'armv7%': 0,
205       # Set Neon compilation flags (only meaningful if armv7==1).
206       'arm_neon%': 1,
207       'arm_neon_optional%': 0,
209       # The system root for cross-compiles. Default: none.
210       'sysroot%': '',
212       # The system libdir used for this ABI.
213       'system_libdir%': 'lib',
215       # On Linux, we build with sse2 for Chromium builds.
216       'disable_sse2%': 0,
218       # Use libjpeg-turbo as the JPEG codec used by Chromium.
219       'use_libjpeg_turbo%': 1,
221       # Use system libjpeg. Note that the system's libjepg will be used even if
222       # use_libjpeg_turbo is set.
223       'use_system_libjpeg%': 0,
225       # Use system libvpx
226       'use_system_libvpx%': 0,
228       # Variable 'component' is for cases where we would like to build some
229       # components as dynamic shared libraries but still need variable
230       # 'library' for static libraries.
231       # By default, component is set to whatever library is set to and
232       # it can be overriden by the GYP command line or by ~/.gyp/include.gypi.
233       'component%': 'static_library',
235       # Set to select the Title Case versions of strings in GRD files.
236       'use_titlecase_in_grd_files%': 0,
238       # Use translations provided by volunteers at launchpad.net.  This
239       # currently only works on Linux.
240       'use_third_party_translations%': 0,
242       # Remoting compilation is enabled by default. Set to 0 to disable.
243       'remoting%': 1,
245       # Configuration policy is enabled by default. Set to 0 to disable.
246       'configuration_policy%': 1,
248       # Safe browsing is compiled in by default. Set to 0 to disable.
249       'safe_browsing%': 1,
251       # Speech input is compiled in by default. Set to 0 to disable.
252       'input_speech%': 1,
254       # Notifications are compiled in by default. Set to 0 to disable.
255       'notifications%' : 1,
257       # If this is set, the clang plugins used on the buildbot will be used.
258       # Run tools/clang/scripts/update.sh to make sure they are compiled.
259       # This causes 'clang_chrome_plugins_flags' to be set.
260       # Has no effect if 'clang' is not set as well.
261       'clang_use_chrome_plugins%': 1,
263       # Enable building with ASAN (Clang's -faddress-sanitizer option).
264       # -faddress-sanitizer only works with clang, but asan=1 implies clang=1
265       # See https://sites.google.com/a/chromium.org/dev/developers/testing/addresssanitizer
266       'asan%': 0,
268       # Enable building with TSAN (Clang's -fthread-sanitizer option).
269       # -fthread-sanitizer only works with clang, but tsan=1 implies clang=1
270       # See http://clang.llvm.org/docs/ThreadSanitizer.html
271       'tsan%': 0,
273       # Use a modified version of Clang to intercept allocated types and sizes
274       # for allocated objects. clang_type_profiler=1 implies clang=1.
275       # See http://dev.chromium.org/developers/deep-memory-profiler/cpp-object-type-identifier
276       # TODO(dmikurube): Support mac.  See http://crbug.com/123758#c11
277       'clang_type_profiler%': 0,
279       # Set to true to instrument the code with function call logger.
280       # See src/third_party/cygprofile/cyg-profile.cc for details.
281       'order_profiling%': 0,
283       # Use the provided profiled order file to link Chrome image with it.
284       # This makes Chrome faster by better using CPU cache when executing code.
285       # This is known as PGO (profile guided optimization).
286       # See https://sites.google.com/a/google.com/chrome-msk/dev/boot-speed-up-effort
287       'order_text_section%' : "",
289       # Set to 1 compile with -fPIC cflag on linux. This is a must for shared
290       # libraries on linux x86-64 and arm, plus ASLR.
291       'linux_fpic%': 1,
293       # Whether one-click signin is enabled or not.
294       'enable_one_click_signin%': 0,
296       # Enable Web Intents support in WebKit.
297       'enable_web_intents%': 1,
299       # Enable Chrome browser extensions
300       'enable_extensions%': 1,
302       # Enable browser automation.
303       'enable_automation%': 1,
305       # Enable printing support and UI.
306       'enable_printing%': 1,
308       # Enable Web Intents web content registration via HTML element
309       # and WebUI managing such registrations.
310       'enable_web_intents_tag%': 0,
312       # Webrtc compilation is enabled by default. Set to 0 to disable.
313       'enable_webrtc%': 1,
315       # PPAPI by default does not support plugins making calls off the main
316       # thread. Set to 1 to turn on experimental support for out-of-process
317       # plugins to make call of the main thread.
318       'enable_pepper_threading%': 0,
320       # Enables use of the session service, which is enabled by default.
321       # Support for disabling depends on the platform.
322       'enable_session_service%': 1,
324       # Enables theme support, which is enabled by default.  Support for
325       # disabling depends on the platform.
326       'enable_themes%': 1,
328       # Uses OEM-specific wallpaper resources on Chrome OS.
329       'use_oem_wallpaper%': 0,
331       # Enables support for background apps.
332       'enable_background%': 1,
334       # Enable the task manager by default.
335       'enable_task_manager%': 1,
337       # Enable FTP support by default.
338       'disable_ftp_support%': 0,
340       # XInput2 multitouch support is disabled by default (use_xi2_mt=0).
341       # Setting to non-zero value enables XI2 MT. When XI2 MT is enabled,
342       # the input value also defines the required XI2 minor minimum version.
343       # For example, use_xi2_mt=2 means XI2.2 or above version is required.
344       'use_xi2_mt%': 0,
346       # Use of precompiled headers on Windows.
347       #
348       # This is on by default in VS 2010, but off by default for VS
349       # 2008 because of complications that it can cause with our
350       # trybots etc.
351       #
352       # This variable may be explicitly set to 1 (enabled) or 0
353       # (disabled) in ~/.gyp/include.gypi or via the GYP command line.
354       # This setting will override the default.
355       #
356       # Note that a setting of 1 is probably suitable for most or all
357       # Windows developers using VS 2008, since precompiled headers
358       # provide a build speedup of 20-25%.  There are a couple of
359       # small workarounds you may need to use when using VS 2008 (but
360       # not 2010), see
361       # http://code.google.com/p/chromium/wiki/WindowsPrecompiledHeaders
362       # for details.
363       'chromium_win_pch%': 0,
365       # Set this to true when building with Clang.
366       # See http://code.google.com/p/chromium/wiki/Clang for details.
367       'clang%': 0,
369       # Enable plug-in installation by default.
370       'enable_plugin_installation%': 1,
372       # Enable protector service by default.
373       'enable_protector_service%': 1,
375       # Specifies whether to use canvas_skia.cc in place of platform
376       # specific implementations of gfx::Canvas. Affects text drawing in the
377       # Chrome UI.
378       # TODO(asvitkine): Enable this on all platforms and delete this flag.
379       #                  http://crbug.com/105550
380       'use_canvas_skia%': 0,
382       # Set to "tsan", "memcheck", or "drmemory" to configure the build to work
383       # with one of those tools.
384       'build_for_tool%': '',
386       # Whether tests targets should be run, archived or just have the
387       # dependencies verified. All the tests targets have the '_run' suffix,
388       # e.g. base_unittests_run runs the target base_unittests. The test target
389       # always calls tools/swarm_client/isolate.py. See the script's --help for
390       # more information and the valid --mode values. Meant to be overriden with
391       # GYP_DEFINES.
392       # TODO(maruel): Converted the default from 'check' to 'noop' so work can
393       # be done while the builders are being reconfigured to check out test data
394       # files.
395       'test_isolation_mode%': 'noop',
396       # It must not be '<(PRODUCT_DIR)' alone, the '/' is necessary otherwise
397       # gyp will remove duplicate flags, causing isolate.py to be confused.
398       'test_isolation_outdir%': '<(PRODUCT_DIR)/isolate',
400        # Force rlz to use chrome's networking stack.
401       'force_rlz_use_chrome_net%': 1,
403       'sas_dll_path%': '<(DEPTH)/third_party/platformsdk_win7/files/redist/x86',
404       'wix_path%': '<(DEPTH)/third_party/wix',
406       'conditions': [
407         # TODO(epoger): Figure out how to set use_skia=1 for Mac outside of
408         # the 'conditions' clause.  Initial attempts resulted in chromium and
409         # webkit disagreeing on its setting.
410         ['OS=="mac"', {
411           'use_skia%': 1,
412         }, {
413           'use_skia%': 1,
414         }],
416         # A flag for POSIX platforms
417         ['OS=="win"', {
418           'os_posix%': 0,
419         }, {
420           'os_posix%': 1,
421         }],
423         # NSS usage.
424         ['(OS=="linux" or OS=="solaris" or os_bsd==1) and use_openssl==0', {
425           'use_nss%': 1,
426         }, {
427           'use_nss%': 0,
428         }],
430         # Flags to use X11 on non-Mac POSIX platforms
431         ['OS=="win" or OS=="mac" or OS=="ios" or OS=="android"', {
432           'use_glib%': 0,
433           'use_x11%': 0,
434         }, {
435           'use_glib%': 1,
436           'use_x11%': 1,
437         }],
439         # We always use skia text rendering in Aura on Windows, since GDI
440         # doesn't agree with our BackingStore.
441         # TODO(beng): remove once skia text rendering is on by default.
442         ['use_aura==1 and OS=="win"', {
443           'enable_skia_text%': 1,
444         }],
446         # A flag to enable or disable our compile-time dependency
447         # on gnome-keyring. If that dependency is disabled, no gnome-keyring
448         # support will be available. This option is useful
449         # for Linux distributions and for Aura.
450         ['chromeos==1 or use_aura==1', {
451           'use_gnome_keyring%': 0,
452         }, {
453           'use_gnome_keyring%': 1,
454         }],
456         ['toolkit_uses_gtk==1 or OS=="mac" or OS=="ios"', {
457           # GTK+, Mac and iOS want Title Case strings
458           'use_titlecase_in_grd_files%': 1,
459         }],
461         # Enable file manager extension on Chrome OS.
462         ['chromeos==1', {
463           'file_manager_extension%': 1,
464         }, {
465           'file_manager_extension%': 0,
466         }],
468         ['OS=="win" or OS=="mac" or (OS=="linux" and use_aura==0)', {
469           'enable_one_click_signin%': 1,
470         }],
472         ['OS=="android"', {
473           'enable_extensions%': 0,
474           'enable_printing%': 0,
475           'enable_themes%': 0,
476           'enable_webrtc%': 0,
477           'proprietary_codecs%': 1,
478           'remoting%': 0,
479         }],
481         ['OS=="ios"', {
482           'configuration_policy%': 0,
483           'disable_ftp_support%': 1,
484           'enable_automation%': 0,
485           'enable_extensions%': 0,
486           'enable_printing%': 0,
487           'enable_themes%': 0,
488           'enable_webrtc%': 0,
489           'notifications%': 0,
490           'remoting%': 0,
491         }],
493         # Use GPU accelerated cross process image transport by default
494         # on linux builds with the Aura window manager
495         ['use_aura==1 and OS=="linux"', {
496           'ui_compositor_image_transport%': 1,
497         }, {
498           'ui_compositor_image_transport%': 0,
499         }],
501         # Turn precompiled headers on by default for VS 2010.
502         ['OS=="win" and MSVS_VERSION=="2010" and buildtype!="Official"', {
503           'chromium_win_pch%': 1
504         }],
506         ['use_aura==1 or chromeos==1 or OS=="android"', {
507           'enable_plugin_installation%': 0,
508         }, {
509           'enable_plugin_installation%': 1,
510         }],
512         ['OS=="android" or OS=="ios"', {
513           'enable_protector_service%': 0,
514         }, {
515           'enable_protector_service%': 1,
516         }],
518         # linux_use_gold_binary: whether to use the binary checked into
519         # third_party/gold.
520         ['OS=="linux"', {
521           'linux_use_gold_binary%': 1,
522         }, {
523           'linux_use_gold_binary%': 0,
524         }],
526         # linux_use_gold_flags: whether to use build flags that rely on gold.
527         # On by default for x64 Linux.  Temporarily off for ChromeOS as
528         # it failed on a buildbot.
529         ['OS=="linux" and chromeos==0', {
530           'linux_use_gold_flags%': 1,
531         }, {
532           'linux_use_gold_flags%': 0,
533         }],
535         ['OS=="android"', {
536           'enable_captive_portal_detection%': 0,
537         }, {
538           'enable_captive_portal_detection%': 1,
539         }],
541         # Enable Skia UI text drawing incrementally on different platforms.
542         # http://crbug.com/105550
543         #
544         # On Aura, this allows per-tile painting to be used in the browser
545         # compositor.
546         ['OS!="mac" and OS!="android"', {
547           'use_canvas_skia%': 1,
548         }],
550         ['chromeos==1', {
551           # When building for ChromeOS we dont want Chromium to use libjpeg_turbo.
552           'use_libjpeg_turbo%': 0,
553         }],
555         ['OS=="android"', {
556           # When building as part of the Android system, use system libraries
557           # where possible to reduce ROM size.
558           'use_system_libjpeg%': '<(android_build_type)',
559         }],
560       ],
562       # Set this to 1 to use the Google-internal file containing
563       # official API keys for Google Chrome even in a developer build.
564       # Setting this variable explicitly to 1 will cause your build to
565       # fail if the internal file is missing.
566       #
567       # Set this to 0 to not use the internal file, even when it
568       # exists in your checkout.
569       #
570       # Leave set to 2 to have this variable implicitly set to 1 if
571       # you have src/google_apis/internal/google_chrome_api_keys.h in
572       # your checkout, and implicitly set to 0 if not.
573       #
574       # Note that official builds always behave as if this variable
575       # was explicitly set to 1, i.e. they always use official keys,
576       # and will fail to build if the internal file is missing.
577       'use_official_google_api_keys%': 2,
579       # Set these to bake the specified API keys and OAuth client
580       # IDs/secrets into your build.
581       #
582       # If you create a build without values baked in, you can instead
583       # set environment variables to provide the keys at runtime (see
584       # src/google_apis/google_api_keys.h for details).  Features that
585       # require server-side APIs may fail to work if no keys are
586       # provided.
587       #
588       # Note that if you are building an official build or if
589       # use_official_google_api_keys has been set to 1 (explicitly or
590       # implicitly), these values will be ignored and the official
591       # keys will be used instead.
592       'google_api_key%': '',
593       'google_default_client_id%': '',
594       'google_default_client_secret%': '',
595     },
597     # Copy conditionally-set variables out one scope.
598     'branding%': '<(branding)',
599     'buildtype%': '<(buildtype)',
600     'target_arch%': '<(target_arch)',
601     'host_arch%': '<(host_arch)',
602     'library%': 'static_library',
603     'toolkit_views%': '<(toolkit_views)',
604     'ui_compositor_image_transport%': '<(ui_compositor_image_transport)',
605     'use_aura%': '<(use_aura)',
606     'use_ash%': '<(use_ash)',
607     'use_openssl%': '<(use_openssl)',
608     'use_ibus%': '<(use_ibus)',
609     'use_nss%': '<(use_nss)',
610     'os_bsd%': '<(os_bsd)',
611     'os_posix%': '<(os_posix)',
612     'use_glib%': '<(use_glib)',
613     'toolkit_uses_gtk%': '<(toolkit_uses_gtk)',
614     'use_skia%': '<(use_skia)',
615     'use_x11%': '<(use_x11)',
616     'use_gnome_keyring%': '<(use_gnome_keyring)',
617     'linux_fpic%': '<(linux_fpic)',
618     'enable_pepper_threading%': '<(enable_pepper_threading)',
619     'chromeos%': '<(chromeos)',
620     'enable_viewport%': '<(enable_viewport)',
621     'enable_hidpi%': '<(enable_hidpi)',
622     'enable_touch_ui%': '<(enable_touch_ui)',
623     'use_xi2_mt%':'<(use_xi2_mt)',
624     'file_manager_extension%': '<(file_manager_extension)',
625     'inside_chromium_build%': '<(inside_chromium_build)',
626     'fastbuild%': '<(fastbuild)',
627     'dcheck_always_on%': '<(dcheck_always_on)',
628     'python_ver%': '<(python_ver)',
629     'arm_version%': '<(arm_version)',
630     'armv7%': '<(armv7)',
631     'arm_neon%': '<(arm_neon)',
632     'arm_neon_optional%': '<(arm_neon_optional)',
633     'sysroot%': '<(sysroot)',
634     'system_libdir%': '<(system_libdir)',
635     'component%': '<(component)',
636     'use_titlecase_in_grd_files%': '<(use_titlecase_in_grd_files)',
637     'use_third_party_translations%': '<(use_third_party_translations)',
638     'remoting%': '<(remoting)',
639     'enable_one_click_signin%': '<(enable_one_click_signin)',
640     'enable_webrtc%': '<(enable_webrtc)',
641     'chromium_win_pch%': '<(chromium_win_pch)',
642     'configuration_policy%': '<(configuration_policy)',
643     'safe_browsing%': '<(safe_browsing)',
644     'input_speech%': '<(input_speech)',
645     'notifications%': '<(notifications)',
646     'clang_use_chrome_plugins%': '<(clang_use_chrome_plugins)',
647     'asan%': '<(asan)',
648     'tsan%': '<(tsan)',
649     'clang_type_profiler%': '<(clang_type_profiler)',
650     'order_profiling%': '<(order_profiling)',
651     'order_text_section%': '<(order_text_section)',
652     'enable_extensions%': '<(enable_extensions)',
653     'enable_web_intents%': '<(enable_web_intents)',
654     'enable_web_intents_tag%': '<(enable_web_intents_tag)',
655     'enable_plugin_installation%': '<(enable_plugin_installation)',
656     'enable_protector_service%': '<(enable_protector_service)',
657     'enable_session_service%': '<(enable_session_service)',
658     'enable_themes%': '<(enable_themes)',
659     'use_oem_wallpaper%': '<(use_oem_wallpaper)',
660     'enable_background%': '<(enable_background)',
661     'linux_use_gold_binary%': '<(linux_use_gold_binary)',
662     'linux_use_gold_flags%': '<(linux_use_gold_flags)',
663     'use_canvas_skia%': '<(use_canvas_skia)',
664     'test_isolation_mode%': '<(test_isolation_mode)',
665     'test_isolation_outdir%': '<(test_isolation_outdir)',
666     'enable_automation%': '<(enable_automation)',
667     'enable_printing%': '<(enable_printing)',
668     'enable_captive_portal_detection%': '<(enable_captive_portal_detection)',
669     'disable_ftp_support%': '<(disable_ftp_support)',
670     'force_rlz_use_chrome_net%': '<(force_rlz_use_chrome_net)',
671     'enable_task_manager%': '<(enable_task_manager)',
672     'sas_dll_path%': '<(sas_dll_path)',
673     'wix_path%': '<(wix_path)',
674     'android_upstream_bringup%': '<(android_upstream_bringup)',
675     'use_libjpeg_turbo%': '<(use_libjpeg_turbo)',
676     'use_system_libjpeg%': '<(use_system_libjpeg)',
677     'android_build_type%': '<(android_build_type)',
678     'use_official_google_api_keys%': '<(use_official_google_api_keys)',
679     'google_api_key%': '<(google_api_key)',
680     'google_default_client_id%': '<(google_default_client_id)',
681     'google_default_client_secret%': '<(google_default_client_secret)',
683     # Use system yasm instead of bundled one.
684     'use_system_yasm%': 0,
686     # Default to enabled PIE; this is important for ASLR but we may need to be
687     # able to turn it off for various reasons.
688     'linux_disable_pie%': 0,
690     # The release channel that this build targets. This is used to restrict
691     # channel-specific build options, like which installer packages to create.
692     # The default is 'all', which does no channel-specific filtering.
693     'channel%': 'all',
695     # Override chromium_mac_pch and set it to 0 to suppress the use of
696     # precompiled headers on the Mac.  Prefix header injection may still be
697     # used, but prefix headers will not be precompiled.  This is useful when
698     # using distcc to distribute a build to compile slaves that don't
699     # share the same compiler executable as the system driving the compilation,
700     # because precompiled headers rely on pointers into a specific compiler
701     # executable's image.  Setting this to 0 is needed to use an experimental
702     # Linux-Mac cross compiler distcc farm.
703     'chromium_mac_pch%': 1,
705     # The default value for mac_strip in target_defaults. This cannot be
706     # set there, per the comment about variable% in a target_defaults.
707     'mac_strip_release%': 1,
709     # Set to 1 to enable code coverage.  In addition to build changes
710     # (e.g. extra CFLAGS), also creates a new target in the src/chrome
711     # project file called "coverage".
712     # Currently ignored on Windows.
713     'coverage%': 0,
715     # Set to 1 to force Visual C++ to use legacy debug information format /Z7.
716     # This is useful for parallel compilation tools which can't support /Zi.
717     # Only used on Windows.
718     'win_z7%' : 0,
720     # Although base/allocator lets you select a heap library via an
721     # environment variable, the libcmt shim it uses sometimes gets in
722     # the way.  To disable it entirely, and switch to normal msvcrt, do e.g.
723     #  'win_use_allocator_shim': 0,
724     #  'win_release_RuntimeLibrary': 2
725     # to ~/.gyp/include.gypi, gclient runhooks --force, and do a release build.
726     'win_use_allocator_shim%': 1, # 1 = shim allocator via libcmt; 0 = msvcrt
728     # Whether usage of OpenMAX is enabled.
729     'enable_openmax%': 0,
731     # Whether proprietary audio/video codecs are assumed to be included with
732     # this build (only meaningful if branding!=Chrome).
733     'proprietary_codecs%': 0,
735     # TODO(bradnelson): eliminate this when possible.
736     # To allow local gyp files to prevent release.vsprops from being included.
737     # Yes(1) means include release.vsprops.
738     # Once all vsprops settings are migrated into gyp, this can go away.
739     'msvs_use_common_release%': 1,
741     # TODO(bradnelson): eliminate this when possible.
742     # To allow local gyp files to override additional linker options for msvs.
743     # Yes(1) means set use the common linker options.
744     'msvs_use_common_linker_extras%': 1,
746     # TODO(sgk): eliminate this if possible.
747     # It would be nicer to support this via a setting in 'target_defaults'
748     # in chrome/app/locales/locales.gypi overriding the setting in the
749     # 'Debug' configuration in the 'target_defaults' dict below,
750     # but that doesn't work as we'd like.
751     'msvs_debug_link_incremental%': '2',
753     # Needed for some of the largest modules.
754     'msvs_debug_link_nonincremental%': '1',
756     # Turns on Use Library Dependency Inputs for linking chrome.dll on Windows
757     # to get incremental linking to be faster in debug builds.
758     'incremental_chrome_dll%': '0',
760     # The default settings for third party code for treating
761     # warnings-as-errors. Ideally, this would not be required, however there
762     # is some third party code that takes a long time to fix/roll. So, this
763     # flag allows us to have warnings as errors in general to prevent
764     # regressions in most modules, while working on the bits that are
765     # remaining.
766     'win_third_party_warn_as_error%': 'true',
768     # This is the location of the sandbox binary. Chrome looks for this before
769     # running the zygote process. If found, and SUID, it will be used to
770     # sandbox the zygote process and, thus, all renderer processes.
771     'linux_sandbox_path%': '',
773     # Set this to true to enable SELinux support.
774     'selinux%': 0,
776     # Clang stuff.
777     'clang%': '<(clang)',
778     'make_clang_dir%': 'third_party/llvm-build/Release+Asserts',
780     # These two variables can be set in GYP_DEFINES while running
781     # |gclient runhooks| to let clang run a plugin in every compilation.
782     # Only has an effect if 'clang=1' is in GYP_DEFINES as well.
783     # Example:
784     #     GYP_DEFINES='clang=1 clang_load=/abs/path/to/libPrintFunctionNames.dylib clang_add_plugin=print-fns' gclient runhooks
786     'clang_load%': '',
787     'clang_add_plugin%': '',
789     # The default type of gtest.
790     'gtest_target_type%': 'executable',
792     # Enable sampling based profiler.
793     # See http://google-perftools.googlecode.com/svn/trunk/doc/cpuprofile.html
794     'profiling%': '0',
796     # Enable strict glibc debug mode.
797     'glibcxx_debug%': 0,
799     # Override whether we should use Breakpad on Linux. I.e. for Chrome bot.
800     'linux_breakpad%': 0,
801     # And if we want to dump symbols for Breakpad-enabled builds.
802     'linux_dump_symbols%': 0,
803     # And if we want to strip the binary after dumping symbols.
804     'linux_strip_binary%': 0,
805     # Strip the test binaries needed for Linux reliability tests.
806     'linux_strip_reliability_tests%': 0,
808     # Enable TCMalloc.
809     'linux_use_tcmalloc%': 1,
811     # Disable TCMalloc's debugallocation.
812     'linux_use_debugallocation%': 0,
814     # Disable TCMalloc's heapchecker.
815     'linux_use_heapchecker%': 0,
817     # Disable shadow stack keeping used by heapcheck to unwind the stacks
818     # better.
819     'linux_keep_shadow_stacks%': 0,
821     # Set to 1 to link against libgnome-keyring instead of using dlopen().
822     'linux_link_gnome_keyring%': 0,
823     # Set to 1 to link against gsettings APIs instead of using dlopen().
824     'linux_link_gsettings%': 0,
826     # Set Thumb compilation flags.
827     'arm_thumb%': 0,
829     # Set ARM fpu compilation flags (only meaningful if armv7==1 and
830     # arm_neon==0).
831     'arm_fpu%': 'vfpv3',
833     # Set ARM float abi compilation flag.
834     'arm_float_abi%': 'softfp',
836     # Enable new NPDevice API.
837     'enable_new_npdevice_api%': 0,
839     # Enable EGLImage support in OpenMAX
840     'enable_eglimage%': 1,
842     # Enable a variable used elsewhere throughout the GYP files to determine
843     # whether to compile in the sources for the GPU plugin / process.
844     'enable_gpu%': 1,
846     # .gyp files or targets should set chromium_code to 1 if they build
847     # Chromium-specific code, as opposed to external code.  This variable is
848     # used to control such things as the set of warnings to enable, and
849     # whether warnings are treated as errors.
850     'chromium_code%': 0,
852     'release_valgrind_build%': 0,
854     # TODO(thakis): Make this a blacklist instead, http://crbug.com/101600
855     'enable_wexit_time_destructors%': 0,
857     # Set to 1 to compile with the built in pdf viewer.
858     'internal_pdf%': 0,
860     # Set to 1 to compile with the OpenGL ES 2.0 conformance tests.
861     'internal_gles2_conform_tests%': 0,
863     # NOTE: When these end up in the Mac bundle, we need to replace '-' for '_'
864     # so Cocoa is happy (http://crbug.com/20441).
865     'locales': [
866       'am', 'ar', 'bg', 'bn', 'ca', 'cs', 'da', 'de', 'el', 'en-GB',
867       'en-US', 'es-419', 'es', 'et', 'fa', 'fi', 'fil', 'fr', 'gu', 'he',
868       'hi', 'hr', 'hu', 'id', 'it', 'ja', 'kn', 'ko', 'lt', 'lv',
869       'ml', 'mr', 'ms', 'nb', 'nl', 'pl', 'pt-BR', 'pt-PT', 'ro', 'ru',
870       'sk', 'sl', 'sr', 'sv', 'sw', 'ta', 'te', 'th', 'tr', 'uk',
871       'vi', 'zh-CN', 'zh-TW',
872     ],
874     # Pseudo locales are special locales which are used for testing and
875     # debugging. They don't get copied to the final app. For more info,
876     # check out https://sites.google.com/a/chromium.org/dev/Home/fake-bidi
877     'pseudo_locales': [
878       'fake-bidi',
879     ],
881     'grit_defines': [],
883     # If debug_devtools is set to 1, JavaScript files for DevTools are
884     # stored as is and loaded from disk. Otherwise, a concatenated file
885     # is stored in resources.pak. It is still possible to load JS files
886     # from disk by passing --debug-devtools cmdline switch.
887     'debug_devtools%': 0,
889     # The Java Bridge is not compiled in by default.
890     'java_bridge%': 0,
892     # Code signing for iOS binaries.  The bots need to be able to disable this.
893     'chromium_ios_signing%': 1,
895     # This flag is only used when disable_nacl==0 and disables all those
896     # subcomponents which would require the installation of a native_client
897     # untrusted toolchain.
898     'disable_nacl_untrusted%': 0,
900     # Disable Dart by default.
901     'enable_dart%': 0,
903     # The desired version of Windows SDK can be set in ~/.gyp/include.gypi.
904     'msbuild_toolset%': '',
906     # Native Client is enabled by default.
907     'disable_nacl%': 0,
909     # Whether to build full debug version for Debug configuration on Android.
910     # Compared to full debug version, the default Debug configuration on Android
911     # has no full v8 debug, has size optimization and linker gc section, so that
912     # we can build a debug version with acceptable size and performance.
913     'android_full_debug%': 0,
915     # Sets the default version name and code for Android app, by default we
916     # do a developer build.
917     'android_app_version_name%': 'Developer Build',
918     'android_app_version_code%': 0,
920     'sas_dll_exists': 0, # '<!(<(PYTHON) <(DEPTH)/build/dir_exists.py <(sas_dll_path))',
921     'wix_exists': 0, # '<!(<(PYTHON) <(DEPTH)/build/dir_exists.py <(wix_path))',
923     'windows_sdk_default_path': '<(DEPTH)/third_party/platformsdk_win8/files',
924 #    'directx_sdk_default_path': '<(DEPTH)/third_party/directxsdk/files',
925     'windows_sdk_path%': '<(windows_sdk_default_path)',
927     'conditions': [
928       #['"<!(<(PYTHON) <(DEPTH)/build/dir_exists.py <(windows_sdk_default_path))"=="True"', {
929       #  'windows_sdk_path%': '<(windows_sdk_default_path)',
930       #}, {
931       #  'windows_sdk_path%': 'C:/Program Files (x86)/Windows Kits/8.0',
932       #}],
933       #['OS=="win" and "<!(<(PYTHON) <(DEPTH)/build/dir_exists.py <(directx_sdk_default_path))"=="True"', {
934       #  'directx_sdk_path%': '<(directx_sdk_default_path)',
935       #}, {
936       #  'directx_sdk_path%': '$(DXSDK_DIR)',
937       #}],
938       # If use_official_google_api_keys is already set (to 0 or 1), we
939       # do none of the implicit checking.  If it is set to 1 and the
940       # internal keys file is missing, the build will fail at compile
941       # time.  If it is set to 0 and keys are not provided by other
942       # means, a warning will be printed at compile time.
943       ['use_official_google_api_keys==2', {
944         'use_official_google_api_keys%':
945             '<!(<(PYTHON) <(DEPTH)/google_apis/build/check_internal.py <(DEPTH)/google_apis/internal/google_chrome_api_keys.h)',
946       }],
947       ['os_posix==1 and OS!="mac" and OS!="ios"', {
948         # Figure out the python architecture to decide if we build pyauto.
949         # disabled for mozilla because windows != mac and this runs a shell script
950         #        'python_arch%': '<!(<(DEPTH)/build/linux/python_arch.sh <(sysroot)/usr/<(system_libdir)/libpython<(python_ver).so.1.0)',
951         'conditions': [
952           # TODO(glider): set clang to 1 earlier for ASan and TSan builds so
953           # that it takes effect here.
954           # disabled for Mozilla since it doesn't use this, and 'msys' messes $(CXX) up
955           ['build_with_mozilla==0 and clang==0 and asan==0 and tsan==0', {
956             # This will set gcc_version to XY if you are running gcc X.Y.*.
957             'gcc_version%': '<!(<(PYTHON) <(DEPTH)/build/compiler_version.py)',
958           }, {
959             'gcc_version%': 0,
960           }],
961           ['branding=="Chrome"', {
962             'linux_breakpad%': 1,
963           }],
964           # All Chrome builds have breakpad symbols, but only process the
965           # symbols from official builds.
966           ['(branding=="Chrome" and buildtype=="Official")', {
967             'linux_dump_symbols%': 1,
968           }],
969         ],
970       }],  # os_posix==1 and OS!="mac" and OS!="ios"
971       ['OS=="ios"', {
972         'disable_nacl%': 1,
973         'enable_gpu%': 0,
974         'icu_use_data_file_flag%': 1,
975         'use_system_bzip2%': 1,
976         'use_system_libxml%': 1,
977         'use_system_sqlite%': 1,
979         # The Mac SDK is set for iOS builds and passed through to Mac
980         # sub-builds. This allows the Mac sub-build SDK in an iOS build to be
981         # overridden from the command line the same way it is for a Mac build.
982         'mac_sdk%': '',
984         # iOS SDK and deployment target support.  The iOS 5.0 SDK is actually
985         # what is required, but the value is left blank so when it is set in
986         # the project files it will be the "current" iOS SDK.  Forcing 5.0
987         # even though it is "current" causes Xcode to spit out a warning for
988         # every single project file for not using the "current" SDK.
989         'ios_sdk%': '',
990         'ios_sdk_path%': '',
991         'ios_deployment_target%': '4.3',
993         'conditions': [
994           # ios_product_name is set to the name of the .app bundle as it should
995           # appear on disk.
996           ['branding=="Chrome"', {
997             'ios_product_name%': 'Chrome',
998           }, { # else: branding!="Chrome"
999             'ios_product_name%': 'Chromium',
1000           }],
1001           ['branding=="Chrome" and buildtype=="Official"', {
1002             'ios_breakpad%': 1,
1003           }, { # else: branding!="Chrome" or buildtype!="Official"
1004             'ios_breakpad%': 0,
1005           }],
1006         ],
1007       }],  # OS=="ios"
1008       ['OS=="android"', {
1009         # Provides an absolute path to PRODUCT_DIR (e.g. out/Release). Used
1010         # to specify the output directory for Ant in the Android build.
1011         'ant_build_out': '`cd <(PRODUCT_DIR) && pwd -P`',
1013         # Uses Android's crash report system
1014         'linux_breakpad%': 0,
1016         # Always uses openssl.
1017         'use_openssl%': 1,
1019         'proprietary_codecs%': '<(proprietary_codecs)',
1020         'enable_task_manager%': 0,
1021         'safe_browsing%': 0,
1022         'configuration_policy%': 0,
1023         'input_speech%': 0,
1024         'enable_web_intents%': 0,
1025         'enable_automation%': 0,
1026         'java_bridge%': 1,
1027         'build_ffmpegsumo%': 0,
1028         'linux_use_tcmalloc%': 0,
1030         # Disable Native Client.
1031         'disable_nacl%': 1,
1033         # Android does not support background apps.
1034         'enable_background%': 0,
1036         # Sessions are store separately in the Java side.
1037         'enable_session_service%': 0,
1039         # Set to 1 once we have a notification system for Android.
1040         # http://crbug.com/115320
1041         'notifications%': 0,
1043         'p2p_apis%' : 0,
1045         # TODO(jrg): when 'gtest_target_type'=='shared_library' and
1046         # OS==android, make all gtest_targets depend on
1047         # testing/android/native_test.gyp:native_test_apk.
1048         'gtest_target_type%': 'shared_library',
1050         # Uses system APIs for decoding audio and video.
1051         'use_libffmpeg%': '0',
1053         # Always use the chromium skia. The use_system_harfbuzz needs to
1054         # match use_system_skia.
1055         'use_system_skia%': '0',
1056         'use_system_harfbuzz%': '0',
1058         # Configure crash reporting and build options based on release type.
1059         'conditions': [
1060           ['buildtype=="Official"', {
1061             # Only report crash dumps for Official builds.
1062             'linux_breakpad%': 1,
1063           }, {
1064             'linux_breakpad%': 0,
1065           }],
1066         ],
1068         # When building as part of the Android system, use system libraries
1069         # where possible to reduce ROM size.
1070         # TODO(steveblock): Investigate using the system version of sqlite.
1071         'use_system_sqlite%': 0,  # '<(android_build_type)',
1072         'use_system_expat%': '<(android_build_type)',
1073         'use_system_icu%': '<(android_build_type)',
1074         'use_system_stlport%': '<(android_build_type)',
1076         # Copy it out one scope.
1077         'android_build_type%': '<(android_build_type)',
1078       }],  # OS=="android"
1079       ['OS=="mac"', {
1080         'variables': {
1081           # Mac OS X SDK and deployment target support.  The SDK identifies
1082           # the version of the system headers that will be used, and
1083           # corresponds to the MAC_OS_X_VERSION_MAX_ALLOWED compile-time
1084           # macro.  "Maximum allowed" refers to the operating system version
1085           # whose APIs are available in the headers.  The deployment target
1086           # identifies the minimum system version that the built products are
1087           # expected to function on.  It corresponds to the
1088           # MAC_OS_X_VERSION_MIN_REQUIRED compile-time macro.  To ensure these
1089           # macros are available, #include <AvailabilityMacros.h>.  Additional
1090           # documentation on these macros is available at
1091           # http://developer.apple.com/mac/library/technotes/tn2002/tn2064.html#SECTION3
1092           # Chrome normally builds with the Mac OS X 10.6 SDK and sets the
1093           # deployment target to 10.6.  Other projects, such as O3D, may
1094           # override these defaults.
1096           # Normally, mac_sdk_min is used to find an SDK that Xcode knows
1097           # about that is at least the specified version. In official builds,
1098           # the SDK must match mac_sdk_min exactly. If the SDK is installed
1099           # someplace that Xcode doesn't know about, set mac_sdk_path to the
1100           # path to the SDK; when set to a non-empty string, SDK detection
1101           # based on mac_sdk_min will be bypassed entirely.
1102           'mac_sdk_min%': '10.6',
1103           'mac_sdk_path%': '',
1105           'mac_deployment_target%': '10.6',
1106         },
1108         'mac_sdk_min': '<(mac_sdk_min)',
1109         'mac_sdk_path': '<(mac_sdk_path)',
1110         'mac_deployment_target': '<(mac_deployment_target)',
1112         # Enable clang on mac by default!
1113         'clang%': 1,
1115         # Compile in Breakpad support by default so that it can be
1116         # tested, even if it is not enabled by default at runtime.
1117         'mac_breakpad_compiled_in%': 1,
1118         'conditions': [
1119           # mac_product_name is set to the name of the .app bundle as it should
1120           # appear on disk.  This duplicates data from
1121           # chrome/app/theme/chromium/BRANDING and
1122           # chrome/app/theme/google_chrome/BRANDING, but is necessary to get
1123           # these names into the build system.
1124           ['branding=="Chrome"', {
1125             'mac_product_name%': 'Google Chrome',
1126           }, { # else: branding!="Chrome"
1127             'mac_product_name%': 'Chromium',
1128           }],
1130           ['branding=="Chrome" and buildtype=="Official"', {
1131             'mac_sdk%': '<!(<(PYTHON) <(DEPTH)/build/mac/find_sdk.py --verify <(mac_sdk_min) --sdk_path=<(mac_sdk_path))',
1132             # Enable uploading crash dumps.
1133             'mac_breakpad_uploads%': 1,
1134             # Enable dumping symbols at build time for use by Mac Breakpad.
1135             'mac_breakpad%': 1,
1136             # Enable Keystone auto-update support.
1137             'mac_keystone%': 1,
1138           }, { # else: branding!="Chrome" or buildtype!="Official"
1139             'mac_sdk%': '', #'<!(<(PYTHON) <(DEPTH)/build/mac/find_sdk.py <(mac_sdk_min))',
1140             'mac_breakpad_uploads%': 0,
1141             'mac_breakpad%': 0,
1142             'mac_keystone%': 0,
1143           }],
1144         ],
1145       }],  # OS=="mac"
1147       ['OS=="win"', {
1148         'conditions': [
1149           ['component=="shared_library"', {
1150             'win_use_allocator_shim%': 0,
1151           }],
1152           ['component=="shared_library" and "<(GENERATOR)"=="ninja"', {
1153             # Only enabled by default for ninja because it's buggy in VS.
1154             # Not enabled for component=static_library because some targets
1155             # are too large and the toolchain fails due to the size of the
1156             # .obj files.
1157             'incremental_chrome_dll%': 1,
1158           }],
1159           # Don't do incremental linking for large modules on 32-bit.
1160           ['MSVS_OS_BITS==32', {
1161             'msvs_large_module_debug_link_mode%': '1',  # No
1162           },{
1163             'msvs_large_module_debug_link_mode%': '2',  # Yes
1164           }],
1165           ['MSVS_VERSION=="2010e" or MSVS_VERSION=="2008e" or MSVS_VERSION=="2005e"', {
1166             'msvs_express%': 1,
1167             'secure_atl%': 0,
1168           },{
1169             'msvs_express%': 0,
1170             'secure_atl%': 1,
1171           }],
1172         ],
1173         'nacl_win64_defines': [
1174           # This flag is used to minimize dependencies when building
1175           # Native Client loader for 64-bit Windows.
1176           'NACL_WIN64',
1177         ],
1178       }],
1180       ['os_posix==1 and chromeos==0 and OS!="android"', {
1181         'use_cups%': 1,
1182       }, {
1183         'use_cups%': 0,
1184       }],
1186       # Native Client glibc toolchain is enabled by default except on arm.
1187       ['target_arch=="arm"', {
1188         'disable_glibc%': 1,
1189       }, {
1190         'disable_glibc%': 0,
1191       }],
1193       # Disable SSE2 when building for ARM or MIPS.
1194       ['target_arch=="arm" or target_arch=="mipsel"', {
1195         'disable_sse2%': 1,
1196       }, {
1197         'disable_sse2%': '<(disable_sse2)',
1198       }],
1200       # Set the relative path from this file to the GYP file of the JPEG
1201       # library used by Chromium.
1202       ['use_system_libjpeg==1 or use_libjpeg_turbo==0', {
1203         # Configuration for using the system libjeg is here.
1204         'libjpeg_gyp_path': '../third_party/libjpeg/libjpeg.gyp',
1205       }, {
1206         'libjpeg_gyp_path': '../third_party/libjpeg_turbo/libjpeg.gyp',
1207       }],
1209       # Options controlling the use of GConf (the classic GNOME configuration
1210       # system) and GIO, which contains GSettings (the new GNOME config system).
1211       ['chromeos==1', {
1212         'use_gconf%': 0,
1213         'use_gio%': 0,
1214       }, {
1215         'use_gconf%': 1,
1216         'use_gio%': 1,
1217       }],
1219       # Set up -D and -E flags passed into grit.
1220       ['branding=="Chrome"', {
1221         # TODO(mmoss) The .grd files look for _google_chrome, but for
1222         # consistency they should look for google_chrome_build like C++.
1223         'grit_defines': ['-D', '_google_chrome',
1224                          '-E', 'CHROMIUM_BUILD=google_chrome'],
1225       }, {
1226         'grit_defines': ['-D', '_chromium',
1227                          '-E', 'CHROMIUM_BUILD=chromium'],
1228       }],
1229       ['chromeos==1', {
1230         'grit_defines': ['-D', 'chromeos', '-D', 'scale_factors=2x'],
1231       }],
1232       ['toolkit_views==1', {
1233         'grit_defines': ['-D', 'toolkit_views'],
1234       }],
1235       ['use_aura==1', {
1236         'grit_defines': ['-D', 'use_aura'],
1237       }],
1238       ['use_ash==1', {
1239         'grit_defines': ['-D', 'use_ash'],
1240       }],
1241       ['use_nss==1', {
1242         'grit_defines': ['-D', 'use_nss'],
1243       }],
1244       ['file_manager_extension==1', {
1245         'grit_defines': ['-D', 'file_manager_extension'],
1246       }],
1247       ['remoting==1', {
1248         'grit_defines': ['-D', 'remoting'],
1249       }],
1250       ['use_titlecase_in_grd_files==1', {
1251         'grit_defines': ['-D', 'use_titlecase'],
1252       }],
1253       ['use_third_party_translations==1', {
1254         'grit_defines': ['-D', 'use_third_party_translations'],
1255         'locales': [
1256           'ast', 'bs', 'ca@valencia', 'en-AU', 'eo', 'eu', 'gl', 'hy', 'ia',
1257           'ka', 'ku', 'kw', 'ms', 'ug'
1258         ],
1259       }],
1260       ['OS=="android"', {
1261         'grit_defines': ['-D', 'android'],
1262       }],
1263       ['OS=="mac"', {
1264         'grit_defines': ['-D', 'scale_factors=2x'],
1265       }],
1266       ['OS == "ios"', {
1267         'grit_defines': [
1268           # define for iOS specific resources.
1269           '-D', 'ios',
1270           # iOS uses a whitelist to filter resources.
1271           '-w', '<(DEPTH)/build/ios/grit_whitelist.txt'
1272         ],
1273       }],
1274       ['enable_extensions==1', {
1275         'grit_defines': ['-D', 'enable_extensions'],
1276       }],
1277       ['enable_printing==1', {
1278         'grit_defines': ['-D', 'enable_printing'],
1279       }],
1280       ['enable_themes==1', {
1281         'grit_defines': ['-D', 'enable_themes'],
1282       }],
1283       ['use_oem_wallpaper==1', {
1284         'grit_defines': ['-D', 'use_oem_wallpaper'],
1285       }],
1286       ['clang_use_chrome_plugins==1 and OS!="win"', {
1287         'clang_chrome_plugins_flags': [
1288           '<!@(<(DEPTH)/tools/clang/scripts/plugin_flags.sh)'
1289         ],
1290       }],
1292       ['enable_web_intents_tag==1', {
1293         'grit_defines': ['-D', 'enable_web_intents_tag'],
1294       }],
1296       ['asan==1', {
1297         'clang%': 1,
1298       }],
1299       ['asan==1 and OS=="mac"', {
1300         # See http://crbug.com/145503.
1301         'component': "static_library",
1302       }],
1303       ['tsan==1', {
1304         'clang%': 1,
1305       }],
1307       ['OS=="linux" and clang_type_profiler==1', {
1308         'clang%': 1,
1309         'clang_use_chrome_plugins%': 0,
1310         'make_clang_dir%': 'third_party/llvm-allocated-type/Linux_x64',
1311       }],
1313       # On valgrind bots, override the optimizer settings so we don't inline too
1314       # much and make the stacks harder to figure out.
1315       #
1316       # TODO(rnk): Kill off variables that no one else uses and just implement
1317       # them under a build_for_tool== condition.
1318       ['build_for_tool=="memcheck" or build_for_tool=="tsan"', {
1319         # gcc flags
1320         'mac_debug_optimization': '1',
1321         'mac_release_optimization': '1',
1322         'release_optimize': '1',
1323         'no_gc_sections': 1,
1324         'debug_extra_cflags': '-g -fno-inline -fno-omit-frame-pointer '
1325                               '-fno-builtin -fno-optimize-sibling-calls',
1326         'release_extra_cflags': '-g -fno-inline -fno-omit-frame-pointer '
1327                                 '-fno-builtin -fno-optimize-sibling-calls',
1329         # MSVS flags for TSan on Pin and Windows.
1330         'win_debug_RuntimeChecks': '0',
1331         'win_debug_disable_iterator_debugging': '1',
1332         'win_debug_Optimization': '1',
1333         'win_debug_InlineFunctionExpansion': '0',
1334         'win_release_InlineFunctionExpansion': '0',
1335         'win_release_OmitFramePointers': '0',
1337         'linux_use_tcmalloc': 1,
1338         'release_valgrind_build': 1,
1339         'werror': '',
1340         'component': 'static_library',
1341         'use_system_zlib': 0,
1342       }],
1344       # Build tweaks for DrMemory.
1345       # TODO(rnk): Combine with tsan config to share the builder.
1346       # http://crbug.com/108155
1347       ['build_for_tool=="drmemory"', {
1348         # These runtime checks force initialization of stack vars which blocks
1349         # DrMemory's uninit detection.
1350         'win_debug_RuntimeChecks': '0',
1351         # Iterator debugging is slow.
1352         'win_debug_disable_iterator_debugging': '1',
1353         # Try to disable optimizations that mess up stacks in a release build.
1354         'win_release_InlineFunctionExpansion': '0',
1355         'win_release_OmitFramePointers': '0',
1356         # Ditto for debug, to support bumping win_debug_Optimization.
1357         'win_debug_InlineFunctionExpansion': 0,
1358         'win_debug_OmitFramePointers': 0,
1359         # Keep the code under #ifndef NVALGRIND.
1360         'release_valgrind_build': 1,
1361       }],
1362     ],
1364     # List of default apps to install in new profiles.  The first list contains
1365     # the source files as found in svn.  The second list, used only for linux,
1366     # contains the destination location for each of the files.  When a crx
1367     # is added or removed from the list, the chrome/browser/resources/
1368     # default_apps/external_extensions.json file must also be updated.
1369     'default_apps_list': [
1370       'browser/resources/default_apps/external_extensions.json',
1371       'browser/resources/default_apps/gmail.crx',
1372       'browser/resources/default_apps/search.crx',
1373       'browser/resources/default_apps/youtube.crx',
1374       'browser/resources/default_apps/drive.crx',
1375       'browser/resources/default_apps/docs.crx',
1376     ],
1377     'default_apps_list_linux_dest': [
1378       '<(PRODUCT_DIR)/default_apps/external_extensions.json',
1379       '<(PRODUCT_DIR)/default_apps/gmail.crx',
1380       '<(PRODUCT_DIR)/default_apps/search.crx',
1381       '<(PRODUCT_DIR)/default_apps/youtube.crx',
1382       '<(PRODUCT_DIR)/default_apps/drive.crx',
1383       '<(PRODUCT_DIR)/default_apps/docs.crx',
1384     ],
1385   },
1386   'target_defaults': {
1387     'variables': {
1388       # The condition that operates on chromium_code is in a target_conditions
1389       # section, and will not have access to the default fallback value of
1390       # chromium_code at the top of this file, or to the chromium_code
1391       # variable placed at the root variables scope of .gyp files, because
1392       # those variables are not set at target scope.  As a workaround,
1393       # if chromium_code is not set at target scope, define it in target scope
1394       # to contain whatever value it has during early variable expansion.
1395       # That's enough to make it available during target conditional
1396       # processing.
1397       'chromium_code%': '<(chromium_code)',
1399       # See http://msdn.microsoft.com/en-us/library/aa652360(VS.71).aspx
1400       'win_release_Optimization%': '2', # 2 = /Os
1401       'win_debug_Optimization%': '0',   # 0 = /Od
1403       # See http://msdn.microsoft.com/en-us/library/2kxx5t2c(v=vs.80).aspx
1404       # Tri-state: blank is default, 1 on, 0 off
1405       'win_release_OmitFramePointers%': '0',
1406       # Tri-state: blank is default, 1 on, 0 off
1407       'win_debug_OmitFramePointers%': '',
1409       # See http://msdn.microsoft.com/en-us/library/8wtf2dfz(VS.71).aspx
1410       'win_debug_RuntimeChecks%': '3',    # 3 = all checks enabled, 0 = off
1412       # See http://msdn.microsoft.com/en-us/library/47238hez(VS.71).aspx
1413       'win_debug_InlineFunctionExpansion%': '',    # empty = default, 0 = off,
1414       'win_release_InlineFunctionExpansion%': '2', # 1 = only __inline, 2 = max
1416       # VS inserts quite a lot of extra checks to algorithms like
1417       # std::partial_sort in Debug build which make them O(N^2)
1418       # instead of O(N*logN). This is particularly slow under memory
1419       # tools like ThreadSanitizer so we want it to be disablable.
1420       # See http://msdn.microsoft.com/en-us/library/aa985982(v=VS.80).aspx
1421       'win_debug_disable_iterator_debugging%': '0',
1423       'release_extra_cflags%': '',
1424       'debug_extra_cflags%': '',
1426       'release_valgrind_build%': '<(release_valgrind_build)',
1428       # the non-qualified versions are widely assumed to be *nix-only
1429       'win_release_extra_cflags%': '',
1430       'win_debug_extra_cflags%': '',
1432       # TODO(thakis): Make this a blacklist instead, http://crbug.com/101600
1433       'enable_wexit_time_destructors%': '<(enable_wexit_time_destructors)',
1435       # Only used by Windows build for now.  Can be used to build into a
1436       # differet output directory, e.g., a build_dir_prefix of VS2010_ would
1437       # output files in src/build/VS2010_{Debug,Release}.
1438       'build_dir_prefix%': '',
1440       # Targets are by default not nacl untrusted code.
1441       'nacl_untrusted_build%': 0,
1443       'conditions': [
1444         ['OS=="win" and component=="shared_library"', {
1445           # See http://msdn.microsoft.com/en-us/library/aa652367.aspx
1446           'win_release_RuntimeLibrary%': '2', # 2 = /MD (nondebug DLL)
1447           'win_debug_RuntimeLibrary%': '3',   # 3 = /MDd (debug DLL)
1448         }, {
1449           # See http://msdn.microsoft.com/en-us/library/aa652367.aspx
1450           'win_release_RuntimeLibrary%': '0', # 0 = /MT (nondebug static)
1451           'win_debug_RuntimeLibrary%': '1',   # 1 = /MTd (debug static)
1452         }],
1453         ['OS=="ios"', {
1454           # See http://gcc.gnu.org/onlinedocs/gcc-4.4.2/gcc/Optimize-Options.html
1455           'mac_release_optimization%': 's', # Use -Os unless overridden
1456           'mac_debug_optimization%': '0',   # Use -O0 unless overridden
1457         }, {
1458           # See http://gcc.gnu.org/onlinedocs/gcc-4.4.2/gcc/Optimize-Options.html
1459           'mac_release_optimization%': '3', # Use -O3 unless overridden
1460           'mac_debug_optimization%': '0',   # Use -O0 unless overridden
1461         }],
1462       ],
1463     },
1464     'conditions': [
1465       ['OS=="linux" and linux_use_tcmalloc==1 and clang_type_profiler==1', {
1466         'cflags_cc!': ['-fno-rtti'],
1467         'cflags_cc+': [
1468           '-frtti',
1469           '-gline-tables-only',
1470           '-fintercept-allocation-functions',
1471         ],
1472         'defines': ['TYPE_PROFILING'],
1473         'dependencies': [
1474           '<(DEPTH)/base/allocator/allocator.gyp:type_profiler',
1475         ],
1476       }],
1477       ['OS=="win" and "<(msbuild_toolset)"!=""', {
1478         'msbuild_toolset': '<(msbuild_toolset)',
1479       }],
1480       ['branding=="Chrome"', {
1481         'defines': ['GOOGLE_CHROME_BUILD'],
1482       }, {  # else: branding!="Chrome"
1483         'defines': ['CHROMIUM_BUILD'],
1484       }],
1485       ['OS=="mac" and component=="shared_library"', {
1486         'xcode_settings': {
1487           'DYLIB_INSTALL_NAME_BASE': '@rpath',
1488           'LD_RUNPATH_SEARCH_PATHS': [
1489             # For unbundled binaries.
1490             '@loader_path/.',
1491             # For bundled binaries, to get back from Binary.app/Contents/MacOS.
1492             '@loader_path/../../..',
1493           ],
1494         },
1495       }],
1496       ['branding=="Chrome" and (OS=="win" or OS=="mac")', {
1497         'defines': ['ENABLE_RLZ'],
1498       }],
1499       ['component=="shared_library"', {
1500         'defines': ['COMPONENT_BUILD'],
1501       }],
1502       ['toolkit_views==1', {
1503         'defines': ['TOOLKIT_VIEWS=1'],
1504       }],
1505       ['ui_compositor_image_transport==1', {
1506         'defines': ['UI_COMPOSITOR_IMAGE_TRANSPORT'],
1507       }],
1508       ['use_aura==1', {
1509         'defines': ['USE_AURA=1'],
1510       }],
1511       ['use_ash==1', {
1512         'defines': ['USE_ASH=1'],
1513       }],
1514       ['use_libjpeg_turbo==1', {
1515         'defines': ['USE_LIBJPEG_TURBO=1'],
1516       }],
1517       ['use_nss==1', {
1518         'defines': ['USE_NSS=1'],
1519       }],
1520       ['enable_one_click_signin==1', {
1521         'defines': ['ENABLE_ONE_CLICK_SIGNIN'],
1522       }],
1523       ['toolkit_uses_gtk==1 and toolkit_views==0', {
1524         # TODO(erg): We are progressively sealing up use of deprecated features
1525         # in gtk in preparation for an eventual porting to gtk3.
1526         'defines': ['GTK_DISABLE_SINGLE_INCLUDES=1'],
1527       }],
1528       ['chromeos==1', {
1529         'defines': ['OS_CHROMEOS=1'],
1530       }],
1531       ['use_xi2_mt!=0', {
1532         'defines': ['USE_XI2_MT=<(use_xi2_mt)'],
1533       }],
1534       ['file_manager_extension==1', {
1535         'defines': ['FILE_MANAGER_EXTENSION=1'],
1536       }],
1537       ['profiling==1', {
1538         'defines': ['ENABLE_PROFILING=1'],
1539       }],
1540       ['OS=="linux" and glibcxx_debug==1', {
1541         'defines': ['_GLIBCXX_DEBUG=1',],
1542         'cflags_cc!': ['-fno-rtti'],
1543         'cflags_cc+': ['-frtti', '-g'],
1544       }],
1545       ['OS=="linux"', {
1546         # we need lrint(), which is ISOC99, and Xcode
1547         # already forces -std=c99 for mac below
1548         'defines': ['_ISOC99_SOURCE=1'],
1549       }],
1550       ['remoting==1', {
1551         'defines': ['ENABLE_REMOTING=1'],
1552       }],
1553       ['enable_webrtc==1', {
1554         'defines': ['ENABLE_WEBRTC=1'],
1555       }],
1556       ['proprietary_codecs==1', {
1557         'defines': ['USE_PROPRIETARY_CODECS'],
1558       }],
1559       ['enable_pepper_threading==1', {
1560         'defines': ['ENABLE_PEPPER_THREADING'],
1561       }],
1562       ['enable_viewport==1', {
1563         'defines': ['ENABLE_VIEWPORT'],
1564       }],
1565       ['configuration_policy==1', {
1566         'defines': ['ENABLE_CONFIGURATION_POLICY'],
1567       }],
1568       ['input_speech==1', {
1569         'defines': ['ENABLE_INPUT_SPEECH'],
1570       }],
1571       ['notifications==1', {
1572         'defines': ['ENABLE_NOTIFICATIONS'],
1573       }],
1574       ['enable_hidpi==1', {
1575         'defines': ['ENABLE_HIDPI=1'],
1576       }],
1577       ['fastbuild!=0', {
1579         'conditions': [
1580           # For Windows and Mac, we don't genererate debug information.
1581           ['OS=="win" or OS=="mac"', {
1582             'msvs_settings': {
1583               'VCLinkerTool': {
1584                 'GenerateDebugInformation': 'false',
1585               },
1586               'VCCLCompilerTool': {
1587                 'DebugInformationFormat': '0',
1588               }
1589             },
1590             'xcode_settings': {
1591               'GCC_GENERATE_DEBUGGING_SYMBOLS': 'NO',
1592             },
1593           }, { # else: OS != "win", generate less debug information.
1594             'variables': {
1595               'debug_extra_cflags': '-g1',
1596             },
1597           }],
1598           # Clang creates chubby debug information, which makes linking very
1599           # slow. For now, don't create debug information with clang.  See
1600           # http://crbug.com/70000
1601           ['(OS=="linux" or OS=="android") and clang==1', {
1602             'variables': {
1603               'debug_extra_cflags': '-g0',
1604             },
1605           }],
1606         ],  # conditions for fastbuild.
1607       }],  # fastbuild!=0
1608       ['dcheck_always_on!=0', {
1609         'defines': ['DCHECK_ALWAYS_ON=1'],
1610       }],  # dcheck_always_on!=0
1611       ['selinux==1', {
1612         'defines': ['CHROMIUM_SELINUX=1'],
1613       }],
1614       ['win_use_allocator_shim==0', {
1615         'conditions': [
1616           ['OS=="win"', {
1617             'defines': ['NO_TCMALLOC'],
1618           }],
1619         ],
1620       }],
1621       ['enable_gpu==1', {
1622         'defines': [
1623           'ENABLE_GPU=1',
1624         ],
1625       }],
1626       ['use_openssl==1', {
1627         'defines': [
1628           'USE_OPENSSL=1',
1629         ],
1630       }],
1631       ['enable_eglimage==1', {
1632         'defines': [
1633           'ENABLE_EGLIMAGE=1',
1634         ],
1635       }],
1636       ['use_skia==1', {
1637         'defines': [
1638           'USE_SKIA=1',
1639         ],
1640       }],
1641       ['coverage!=0', {
1642         'conditions': [
1643           ['OS=="mac" or OS=="ios"', {
1644             'xcode_settings': {
1645               'GCC_INSTRUMENT_PROGRAM_FLOW_ARCS': 'YES',  # -fprofile-arcs
1646               'GCC_GENERATE_TEST_COVERAGE_FILES': 'YES',  # -ftest-coverage
1647             },
1648           }],
1649           ['OS=="mac"', {
1650             # Add -lgcov for types executable, shared_library, and
1651             # loadable_module; not for static_library.
1652             # This is a delayed conditional.
1653             'target_conditions': [
1654               ['_type!="static_library"', {
1655                 'xcode_settings': { 'OTHER_LDFLAGS': [ '-lgcov' ] },
1656               }],
1657             ],
1658           }],
1659           ['OS=="linux" or OS=="android"', {
1660             'cflags': [ '-ftest-coverage',
1661                         '-fprofile-arcs' ],
1662             'link_settings': { 'libraries': [ '-lgcov' ] },
1663           }],
1664           # Finally, for Windows, we simply turn on profiling.
1665           ['OS=="win"', {
1666             'msvs_settings': {
1667               'VCLinkerTool': {
1668                 'Profile': 'true',
1669               },
1670               'VCCLCompilerTool': {
1671                 # /Z7, not /Zi, so coverage is happyb
1672                 'DebugInformationFormat': '1',
1673                 'AdditionalOptions': ['/Yd'],
1674               }
1675             }
1676          }],  # OS==win
1677         ],  # conditions for coverage
1678       }],  # coverage!=0
1679       ['OS=="win"', {
1680         'defines': [
1681           '__STD_C',
1682           '_CRT_SECURE_NO_DEPRECATE',
1683           '_SCL_SECURE_NO_DEPRECATE',
1684         ],
1685         'include_dirs': [
1686           '<(DEPTH)/third_party/wtl/include',
1687         ],
1688         'conditions': [
1689           ['win_z7!=0', {
1690             'msvs_settings': {
1691               # Generates debug info when win_z7=1
1692               # even if fastbuild=1 (that makes GenerateDebugInformation false).
1693               'VCLinkerTool': {
1694                 'GenerateDebugInformation': 'true',
1695               },
1696               'VCCLCompilerTool': {
1697                 'DebugInformationFormat': '1',
1698               }
1699             }
1700           }],
1701         ],  # win_z7!=0
1702       }],  # OS==win
1703       ['enable_task_manager==1', {
1704         'defines': [
1705           'ENABLE_TASK_MANAGER=1',
1706         ],
1707       }],
1708       ['enable_web_intents==1', {
1709         'defines': [
1710           'ENABLE_WEB_INTENTS=1',
1711         ],
1712       }],
1713       ['enable_extensions==1', {
1714         'defines': [
1715           'ENABLE_EXTENSIONS=1',
1716         ],
1717       }],
1718       ['OS=="win" and branding=="Chrome"', {
1719         'defines': ['ENABLE_SWIFTSHADER'],
1720       }],
1721       ['enable_dart==1', {
1722         'defines': ['WEBKIT_USING_DART=1'],
1723       }],
1724       ['enable_plugin_installation==1', {
1725         'defines': ['ENABLE_PLUGIN_INSTALLATION=1'],
1726       }],
1727       ['enable_protector_service==1', {
1728         'defines': ['ENABLE_PROTECTOR_SERVICE=1'],
1729       }],
1730       ['enable_session_service==1', {
1731         'defines': ['ENABLE_SESSION_SERVICE=1'],
1732       }],
1733       ['enable_themes==1', {
1734         'defines': ['ENABLE_THEMES=1'],
1735       }],
1736       ['enable_background==1', {
1737         'defines': ['ENABLE_BACKGROUND=1'],
1738       }],
1739       ['enable_automation==1', {
1740         'defines': ['ENABLE_AUTOMATION=1'],
1741       }],
1742       ['enable_printing==1', {
1743         'defines': ['ENABLE_PRINTING=1'],
1744       }],
1745       ['enable_captive_portal_detection==1', {
1746         'defines': ['ENABLE_CAPTIVE_PORTAL_DETECTION=1'],
1747       }],
1748       ['disable_ftp_support==1', {
1749         'defines': ['DISABLE_FTP_SUPPORT=1'],
1750       }],
1751     ],  # conditions for 'target_defaults'
1752     'target_conditions': [
1753       ['enable_wexit_time_destructors==1', {
1754         'conditions': [
1755           [ 'clang==1', {
1756             'cflags': [
1757               '-Wexit-time-destructors',
1758             ],
1759             'xcode_settings': {
1760               'WARNING_CFLAGS': [
1761                 '-Wexit-time-destructors',
1762               ],
1763             },
1764           }],
1765         ],
1766       }],
1767       ['chromium_code==0', {
1768         'conditions': [
1769           [ 'os_posix==1 and OS!="mac" and OS!="ios"', {
1770             # We don't want to get warnings from third-party code,
1771             # so remove any existing warning-enabling flags like -Wall.
1772             'cflags!': [
1773               '-Wall',
1774               '-Wextra',
1775             ],
1776             'cflags_cc': [
1777               # Don't warn about hash_map in third-party code.
1778               '-Wno-deprecated',
1779             ],
1780             'cflags': [
1781               # Don't warn about printf format problems.
1782               # This is off by default in gcc but on in Ubuntu's gcc(!).
1783               '-Wno-format',
1784             ],
1785             'cflags_cc!': [
1786               # TODO(fischman): remove this.
1787               # http://code.google.com/p/chromium/issues/detail?id=90453
1788               '-Wsign-compare',
1789             ]
1790           }],
1791           # TODO: Fix all warnings on chromeos too.
1792           [ 'os_posix==1 and OS!="mac" and OS!="ios" and (clang!=1 or chromeos==1)', {
1793             'cflags!': [
1794               '-Werror',
1795             ],
1796           }],
1797           [ 'os_posix==1 and os_bsd!=1 and OS!="mac" and OS!="android"', {
1798             'cflags': [
1799               # Don't warn about ignoring the return value from e.g. close().
1800               # This is off by default in some gccs but on by default in others.
1801               # BSD systems do not support this option, since they are usually
1802               # using gcc 4.2.1, which does not have this flag yet.
1803               '-Wno-unused-result',
1804             ],
1805           }],
1806           [ 'OS=="win"', {
1807             'defines': [
1808               '_CRT_SECURE_NO_DEPRECATE',
1809               '_CRT_NONSTDC_NO_WARNINGS',
1810               '_CRT_NONSTDC_NO_DEPRECATE',
1811               '_SCL_SECURE_NO_DEPRECATE',
1812             ],
1813             'msvs_disabled_warnings': [4800],
1814             'msvs_settings': {
1815               'VCCLCompilerTool': {
1816                 'WarningLevel': '3',
1817                 'WarnAsError': '<(win_third_party_warn_as_error)',
1818                 'Detect64BitPortabilityProblems': 'false',
1819               },
1820             },
1821             'conditions': [
1822               ['buildtype=="Official"', {
1823                 'msvs_settings': {
1824                   'VCCLCompilerTool': { 'WarnAsError': 'false' },
1825                 }
1826               }],
1827             ],
1828           }],
1829           # TODO(darin): Unfortunately, some third_party code depends on base/
1830           [ 'OS=="win" and component=="shared_library"', {
1831             'msvs_disabled_warnings': [
1832               4251,  # class 'std::xx' needs to have dll-interface.
1833             ],
1834           }],
1835           [ 'OS=="mac" or OS=="ios"', {
1836             'xcode_settings': {
1837               'WARNING_CFLAGS!': ['-Wall', '-Wextra'],
1838             },
1839             'conditions': [
1840               ['buildtype=="Official"', {
1841                 'xcode_settings': {
1842                   'GCC_TREAT_WARNINGS_AS_ERRORS': 'NO',    # -Werror
1843                 },
1844               }],
1845             ],
1846           }],
1847           [ 'OS=="ios"', {
1848             'xcode_settings': {
1849               # TODO(ios): Fix remaining warnings in third-party code, then
1850               # remove this; the Mac cleanup didn't get everything that's
1851               # flagged in an iOS build.
1852               'GCC_TREAT_WARNINGS_AS_ERRORS': 'NO',
1853               'RUN_CLANG_STATIC_ANALYZER': 'NO',
1854             },
1855           }],
1856         ],
1857       }, {
1858         'includes': [
1859            # Rules for excluding e.g. foo_win.cc from the build on non-Windows.
1860           'filename_rules.gypi',
1861         ],
1862         # In Chromium code, we define __STDC_FORMAT_MACROS in order to get the
1863         # C99 macros on Mac and Linux.
1864         'defines': [
1865           '__STDC_FORMAT_MACROS',
1866         ],
1867         'conditions': [
1868           ['OS=="win"', {
1869             # turn on warnings for signed/unsigned mismatch on chromium code.
1870             'msvs_settings': {
1871               'VCCLCompilerTool': {
1872                 'AdditionalOptions': ['/we4389'],
1873               },
1874             },
1875           }],
1876           ['OS=="win" and component=="shared_library"', {
1877             'msvs_disabled_warnings': [
1878               4251,  # class 'std::xx' needs to have dll-interface.
1879             ],
1880           }],
1881         ],
1882       }],
1883     ],  # target_conditions for 'target_defaults'
1884     'default_configuration': 'Debug',
1885     'configurations': {
1886       # VCLinkerTool LinkIncremental values below:
1887       #   0 == default
1888       #   1 == /INCREMENTAL:NO
1889       #   2 == /INCREMENTAL
1890       # Debug links incremental, Release does not.
1891       #
1892       # Abstract base configurations to cover common attributes.
1893       #
1894       'Common_Base': {
1895         'abstract': 1,
1896         'msvs_configuration_attributes': {
1897           'OutputDirectory': '<(DEPTH)\\build\\<(build_dir_prefix)$(ConfigurationName)',
1898           'IntermediateDirectory': '$(OutDir)\\obj\\$(ProjectName)',
1899           'CharacterSet': '1',
1900         },
1901       },
1902       'x86_Base': {
1903         'abstract': 1,
1904         'msvs_settings': {
1905           'VCLinkerTool': {
1906             'TargetMachine': '1',
1907           },
1908         },
1909         'msvs_configuration_platform': 'Win32',
1910       },
1911       'x64_Base': {
1912         'abstract': 1,
1913         'msvs_configuration_platform': 'x64',
1914         'msvs_settings': {
1915           'VCLinkerTool': {
1916             'TargetMachine': '17', # x86 - 64
1917             'AdditionalLibraryDirectories!':
1918               ['<(windows_sdk_path)/Lib/win8/um/x86'],
1919             'AdditionalLibraryDirectories':
1920               ['<(windows_sdk_path)/Lib/win8/um/x64'],
1921           },
1922           'VCLibrarianTool': {
1923             'AdditionalLibraryDirectories!':
1924               ['<(windows_sdk_path)/Lib/win8/um/x86'],
1925             'AdditionalLibraryDirectories':
1926               ['<(windows_sdk_path)/Lib/win8/um/x64'],
1927           },
1928         },
1929         'defines': [
1930           # Not sure if tcmalloc works on 64-bit Windows.
1931           'NO_TCMALLOC',
1932         ],
1933       },
1934       'Debug_Base': {
1935         'abstract': 1,
1936         'defines': [
1937           'DYNAMIC_ANNOTATIONS_ENABLED=1',
1938           'WTF_USE_DYNAMIC_ANNOTATIONS=1',
1939         ],
1940         'xcode_settings': {
1941           'COPY_PHASE_STRIP': 'NO',
1942           'GCC_OPTIMIZATION_LEVEL': '<(mac_debug_optimization)',
1943           'OTHER_CFLAGS': [
1944             '<@(debug_extra_cflags)',
1945           ],
1946         },
1947         'msvs_settings': {
1948           'VCCLCompilerTool': {
1949             'Optimization': '<(win_debug_Optimization)',
1950             'PreprocessorDefinitions': ['_DEBUG'],
1951             'BasicRuntimeChecks': '<(win_debug_RuntimeChecks)',
1952             'RuntimeLibrary': '<(win_debug_RuntimeLibrary)',
1953             'conditions': [
1954               # According to MSVS, InlineFunctionExpansion=0 means
1955               # "default inlining", not "/Ob0".
1956               # Thus, we have to handle InlineFunctionExpansion==0 separately.
1957               ['win_debug_InlineFunctionExpansion==0', {
1958                 'AdditionalOptions': ['/Ob0'],
1959               }],
1960               ['win_debug_InlineFunctionExpansion!=""', {
1961                 'InlineFunctionExpansion':
1962                   '<(win_debug_InlineFunctionExpansion)',
1963               }],
1964               ['win_debug_disable_iterator_debugging==1', {
1965                 'PreprocessorDefinitions': ['_HAS_ITERATOR_DEBUGGING=0'],
1966               }],
1968               # if win_debug_OmitFramePointers is blank, leave as default
1969               ['win_debug_OmitFramePointers==1', {
1970                 'OmitFramePointers': 'true',
1971               }],
1972               ['win_debug_OmitFramePointers==0', {
1973                 'OmitFramePointers': 'false',
1974                 # The above is not sufficient (http://crbug.com/106711): it
1975                 # simply eliminates an explicit "/Oy", but both /O2 and /Ox
1976                 # perform FPO regardless, so we must explicitly disable.
1977                 # We still want the false setting above to avoid having
1978                 # "/Oy /Oy-" and warnings about overriding.
1979                 'AdditionalOptions': ['/Oy-'],
1980               }],
1981             ],
1982             'AdditionalOptions': [ '<@(win_debug_extra_cflags)', ],
1983           },
1984           'VCLinkerTool': {
1985             'LinkIncremental': '<(msvs_debug_link_incremental)',
1986             # ASLR makes debugging with windbg difficult because Chrome.exe and
1987             # Chrome.dll share the same base name. As result, windbg will
1988             # name the Chrome.dll module like chrome_<base address>, where
1989             # <base address> typically changes with each launch. This in turn
1990             # means that breakpoints in Chrome.dll don't stick from one launch
1991             # to the next. For this reason, we turn ASLR off in debug builds.
1992             # Note that this is a three-way bool, where 0 means to pick up
1993             # the default setting, 1 is off and 2 is on.
1994             'RandomizedBaseAddress': 1,
1995           },
1996           'VCResourceCompilerTool': {
1997             'PreprocessorDefinitions': ['_DEBUG'],
1998           },
1999         },
2000         'conditions': [
2001           ['OS=="linux" or OS=="android"', {
2002             'target_conditions': [
2003               ['_toolset=="target"', {
2004                 'cflags': [
2005                   '<@(debug_extra_cflags)',
2006                 ],
2007               }],
2008             ],
2009           }],
2010           # Disabled on iOS because it was causing a crash on startup.
2011           # TODO(michelea): investigate, create a reduced test and possibly
2012           # submit a radar.
2013           ['release_valgrind_build==0 and OS!="ios"', {
2014             'xcode_settings': {
2015               'OTHER_CFLAGS': [
2016                 '-fstack-protector-all',  # Implies -fstack-protector
2017               ],
2018             },
2019           }],
2020         ],
2021       },
2022       'Release_Base': {
2023         'abstract': 1,
2024         'defines': [
2025           'NDEBUG',
2026         ],
2027         'xcode_settings': {
2028           'DEAD_CODE_STRIPPING': 'YES',  # -Wl,-dead_strip
2029           'GCC_OPTIMIZATION_LEVEL': '<(mac_release_optimization)',
2030           'OTHER_CFLAGS': [ '<@(release_extra_cflags)', ],
2031         },
2032         'msvs_settings': {
2033           'VCCLCompilerTool': {
2034             'RuntimeLibrary': '<(win_release_RuntimeLibrary)',
2035             'conditions': [
2036               # In official builds, each target will self-select
2037               # an optimization level.
2038               ['buildtype!="Official"', {
2039                   'Optimization': '<(win_release_Optimization)',
2040                 },
2041               ],
2042               # According to MSVS, InlineFunctionExpansion=0 means
2043               # "default inlining", not "/Ob0".
2044               # Thus, we have to handle InlineFunctionExpansion==0 separately.
2045               ['win_release_InlineFunctionExpansion==0', {
2046                 'AdditionalOptions': ['/Ob0'],
2047               }],
2048               ['win_release_InlineFunctionExpansion!=""', {
2049                 'InlineFunctionExpansion':
2050                   '<(win_release_InlineFunctionExpansion)',
2051               }],
2053               # if win_release_OmitFramePointers is blank, leave as default
2054               ['win_release_OmitFramePointers==1', {
2055                 'OmitFramePointers': 'true',
2056               }],
2057               ['win_release_OmitFramePointers==0', {
2058                 'OmitFramePointers': 'false',
2059                 # The above is not sufficient (http://crbug.com/106711): it
2060                 # simply eliminates an explicit "/Oy", but both /O2 and /Ox
2061                 # perform FPO regardless, so we must explicitly disable.
2062                 # We still want the false setting above to avoid having
2063                 # "/Oy /Oy-" and warnings about overriding.
2064                 'AdditionalOptions': ['/Oy-'],
2065               }],
2066             ],
2067             'AdditionalOptions': [ '<@(win_release_extra_cflags)', ],
2068           },
2069           'VCLinkerTool': {
2070             # LinkIncremental is a tri-state boolean, where 0 means default
2071             # (i.e., inherit from parent solution), 1 means false, and
2072             # 2 means true.
2073             'LinkIncremental': '1',
2074             # This corresponds to the /PROFILE flag which ensures the PDB
2075             # file contains FIXUP information (growing the PDB file by about
2076             # 5%) but does not otherwise alter the output binary. This
2077             # information is used by the Syzygy optimization tool when
2078             # decomposing the release image.
2079             'Profile': 'true',
2080           },
2081         },
2082         'conditions': [
2083           ['msvs_use_common_release', {
2084             'includes': ['release.gypi'],
2085           }],
2086           ['release_valgrind_build==0', {
2087             'defines': [
2088               'NVALGRIND',
2089               'DYNAMIC_ANNOTATIONS_ENABLED=0',
2090             ],
2091           }, {
2092             'defines': [
2093               'DYNAMIC_ANNOTATIONS_ENABLED=1',
2094               'WTF_USE_DYNAMIC_ANNOTATIONS=1',
2095             ],
2096           }],
2097           ['win_use_allocator_shim==0', {
2098             'defines': ['NO_TCMALLOC'],
2099           }],
2100           ['OS=="linux"', {
2101             'target_conditions': [
2102               ['_toolset=="target"', {
2103                 'cflags': [
2104                   '<@(release_extra_cflags)',
2105                 ],
2106               }],
2107             ],
2108           }],
2109         ],
2110       },
2111       #
2112       # Concrete configurations
2113       #
2114       'Debug': {
2115         'inherit_from': ['Common_Base', 'x86_Base', 'Debug_Base'],
2116       },
2117       'Release': {
2118         'inherit_from': ['Common_Base', 'x86_Base', 'Release_Base'],
2119       },
2120       'conditions': [
2121         [ 'OS=="win"', {
2122           # TODO(bradnelson): add a gyp mechanism to make this more graceful.
2123           'Debug_x64': {
2124             'inherit_from': ['Common_Base', 'x64_Base', 'Debug_Base'],
2125           },
2126           'Release_x64': {
2127             'inherit_from': ['Common_Base', 'x64_Base', 'Release_Base'],
2128           },
2129         }],
2130       ],
2131     },
2132   },
2133   'conditions': [
2134     ['os_posix==1 and OS!="mac" and OS!="ios"', {
2135       'target_defaults': {
2136         # Enable -Werror by default, but put it in a variable so it can
2137         # be disabled in ~/.gyp/include.gypi on the valgrind builders.
2138         'variables': {
2139           'werror%': '-Werror',
2140           'libraries_for_target%': '',
2141         },
2142         'defines': [
2143           '_FILE_OFFSET_BITS=64',
2144         ],
2145         'cflags': [
2146           '<(werror)',  # See note above about the werror variable.
2147           '-pthread',
2148           '-fno-exceptions',
2149           '-fno-strict-aliasing',  # See http://crbug.com/32204
2150           '-Wall',
2151           # TODO(evan): turn this back on once all the builds work.
2152           # '-Wextra',
2153           # Don't warn about unused function params.  We use those everywhere.
2154           '-Wno-unused-parameter',
2155           # Don't warn about the "struct foo f = {0};" initialization pattern.
2156           '-Wno-missing-field-initializers',
2157           # Don't export any symbols (for example, to plugins we dlopen()).
2158           # Note: this is *required* to make some plugins work.
2159           '-fvisibility=hidden',
2160           '-pipe',
2161         ],
2162         'cflags_cc': [
2163           '-fno-rtti',
2164           '-fno-threadsafe-statics',
2165           # Make inline functions have hidden visiblity by default.
2166           # Surprisingly, not covered by -fvisibility=hidden.
2167           '-fvisibility-inlines-hidden',
2168           # GCC turns on -Wsign-compare for C++ under -Wall, but clang doesn't,
2169           # so we specify it explicitly.
2170           # TODO(fischman): remove this if http://llvm.org/PR10448 obsoletes it.
2171           # http://code.google.com/p/chromium/issues/detail?id=90453
2172           '-Wsign-compare',
2173         ],
2174         'ldflags': [
2175           '-pthread', '-Wl,-z,noexecstack',
2176         ],
2177         'libraries' : [
2178           '<(libraries_for_target)',
2179         ],
2180         'configurations': {
2181           'Debug_Base': {
2182             'variables': {
2183               'debug_optimize%': '0',
2184             },
2185             'defines': [
2186               '_DEBUG',
2187             ],
2188             'cflags': [
2189               '-O>(debug_optimize)',
2190               '-g',
2191             ],
2192             'conditions' : [
2193               ['OS=="android" and android_full_debug==0', {
2194                 # Some configurations are copied from Release_Base to reduce
2195                 # the binary size.
2196                 'variables': {
2197                   'debug_optimize%': 's',
2198                 },
2199                 'cflags': [
2200                   '-fomit-frame-pointer',
2201                   '-fdata-sections',
2202                   '-ffunction-sections',
2203                 ],
2204                 'ldflags': [
2205                   '-Wl,-O1',
2206                   '-Wl,--as-needed',
2207                   '-Wl,--gc-sections',
2208                 ],
2209               }],
2210             ],
2211           },
2212           'Release_Base': {
2213             'variables': {
2214               'release_optimize%': '2',
2215               # Binaries become big and gold is unable to perform GC
2216               # and remove unused sections for some of test targets
2217               # on 32 bit platform.
2218               # (This is currently observed only in chromeos valgrind bots)
2219               # The following flag is to disable --gc-sections linker
2220               # option for these bots.
2221               'no_gc_sections%': 0,
2223               # TODO(bradnelson): reexamine how this is done if we change the
2224               # expansion of configurations
2225               'release_valgrind_build%': 0,
2226             },
2227             'cflags': [
2228               '-O<(release_optimize)',
2229               # Don't emit the GCC version ident directives, they just end up
2230               # in the .comment section taking up binary size.
2231               '-fno-ident',
2232               # Put data and code in their own sections, so that unused symbols
2233               # can be removed at link time with --gc-sections.
2234               '-fdata-sections',
2235               '-ffunction-sections',
2236             ],
2237             'ldflags': [
2238               # Specifically tell the linker to perform optimizations.
2239               # See http://lwn.net/Articles/192624/ .
2240               '-Wl,-O1',
2241               '-Wl,--as-needed',
2242             ],
2243             'conditions' : [
2244               ['no_gc_sections==0', {
2245                 'ldflags': [
2246                   '-Wl,--gc-sections',
2247                 ],
2248               }],
2249               ['OS=="android"', {
2250                 'variables': {
2251                   'release_optimize%': 's',
2252                 },
2253                 'cflags': [
2254                   '-fomit-frame-pointer',
2255                 ],
2256               }],
2257               ['clang==1', {
2258                 'cflags!': [
2259                   '-fno-ident',
2260                 ],
2261               }],
2262               ['profiling==1', {
2263                 'cflags': [
2264                   '-fno-omit-frame-pointer',
2265                   '-g',
2266                 ],
2267               }],
2268             ],
2269           },
2270         },
2271         'variants': {
2272           'coverage': {
2273             'cflags': ['-fprofile-arcs', '-ftest-coverage'],
2274             'ldflags': ['-fprofile-arcs'],
2275           },
2276           'profile': {
2277             'cflags': ['-pg', '-g'],
2278             'ldflags': ['-pg'],
2279           },
2280           'symbols': {
2281             'cflags': ['-g'],
2282           },
2283         },
2284         'conditions': [
2285           ['target_arch=="ia32"', {
2286             'target_conditions': [
2287               ['_toolset=="target"', {
2288                 'asflags': [
2289                   # Needed so that libs with .s files (e.g. libicudata.a)
2290                   # are compatible with the general 32-bit-ness.
2291                   '-32',
2292                 ],
2293                 # All floating-point computations on x87 happens in 80-bit
2294                 # precision.  Because the C and C++ language standards allow
2295                 # the compiler to keep the floating-point values in higher
2296                 # precision than what's specified in the source and doing so
2297                 # is more efficient than constantly rounding up to 64-bit or
2298                 # 32-bit precision as specified in the source, the compiler,
2299                 # especially in the optimized mode, tries very hard to keep
2300                 # values in x87 floating-point stack (in 80-bit precision)
2301                 # as long as possible. This has important side effects, that
2302                 # the real value used in computation may change depending on
2303                 # how the compiler did the optimization - that is, the value
2304                 # kept in 80-bit is different than the value rounded down to
2305                 # 64-bit or 32-bit. There are possible compiler options to
2306                 # make this behavior consistent (e.g. -ffloat-store would keep
2307                 # all floating-values in the memory, thus force them to be
2308                 # rounded to its original precision) but they have significant
2309                 # runtime performance penalty.
2310                 #
2311                 # -mfpmath=sse -msse2 makes the compiler use SSE instructions
2312                 # which keep floating-point values in SSE registers in its
2313                 # native precision (32-bit for single precision, and 64-bit
2314                 # for double precision values). This means the floating-point
2315                 # value used during computation does not change depending on
2316                 # how the compiler optimized the code, since the value is
2317                 # always kept in its specified precision.
2318                 'conditions': [
2319                   ['branding=="Chromium" and disable_sse2==0', {
2320                     'cflags': [
2321                       '-march=pentium4',
2322                       '-msse2',
2323                       '-mfpmath=sse',
2324                     ],
2325                   }],
2326                   # ChromeOS targets Pinetrail, which is sse3, but most of the
2327                   # benefit comes from sse2 so this setting allows ChromeOS
2328                   # to build on other CPUs.  In the future -march=atom would
2329                   # help but requires a newer compiler.
2330                   ['chromeos==1 and disable_sse2==0', {
2331                     'cflags': [
2332                       '-msse2',
2333                     ],
2334                   }],
2335                   # Install packages have started cropping up with
2336                   # different headers between the 32-bit and 64-bit
2337                   # versions, so we have to shadow those differences off
2338                   # and make sure a 32-bit-on-64-bit build picks up the
2339                   # right files.
2340                   # For android build, use NDK headers instead of host headers
2341                   ['host_arch!="ia32" and OS!="android"', {
2342                     'include_dirs+': [
2343                       '/usr/include32',
2344                     ],
2345                   }],
2346                 ],
2347                'target_conditions': [
2348                  ['_toolset=="target" and OS!="android"', {
2349                     # -mmmx allows mmintrin.h to be used for mmx intrinsics.
2350                     # video playback is mmx and sse2 optimized.
2351                     'cflags': [
2352                       '-m32',
2353                       '-mmmx',
2354                     ],
2355                     'ldflags': [
2356                       '-m32',
2357                     ],
2358                     'cflags_mozilla': [
2359                       '-m32',
2360                       '-mmmx',
2361                     ],
2362                   }],
2363                 ],
2364               }],
2365             ],
2366           }],
2367           ['target_arch=="arm"', {
2368             'target_conditions': [
2369               ['_toolset=="target"', {
2370                 'cflags_cc': [
2371                   # The codesourcery arm-2009q3 toolchain warns at that the ABI
2372                   # has changed whenever it encounters a varargs function. This
2373                   # silences those warnings, as they are not helpful and
2374                   # clutter legitimate warnings.
2375                   '-Wno-abi',
2376                 ],
2377                 'conditions': [
2378                   ['arm_thumb==1', {
2379                     'cflags': [
2380                     '-mthumb',
2381                     ]
2382                   }],
2383                   ['armv7==1', {
2384                     'cflags': [
2385                       '-march=armv7-a',
2386                       '-mtune=cortex-a8',
2387                       '-mfloat-abi=<(arm_float_abi)',
2388                     ],
2389                     'conditions': [
2390                       ['arm_neon==1', {
2391                         'cflags': [ '-mfpu=neon', ],
2392                       }, {
2393                         'cflags': [ '-mfpu=<(arm_fpu)', ],
2394                       }],
2395                     ],
2396                   }],
2397                   ['OS=="android"', {
2398                     # Most of the following flags are derived from what Android
2399                     # uses by default when building for arm, reference for which
2400                     # can be found in the following file in the Android NDK:
2401                     # toolchains/arm-linux-androideabi-4.4.3/setup.mk
2402                     'cflags': [
2403                       # The tree-sra optimization (scalar replacement for
2404                       # aggregates enabling subsequent optimizations) leads to
2405                       # invalid code generation when using the Android NDK's
2406                       # compiler (r5-r7). This can be verified using
2407                       # TestWebKitAPI's WTF.Checked_int8_t test.
2408                       '-fno-tree-sra',
2409                       '-fuse-ld=gold',
2410                       '-Wno-psabi',
2411                     ],
2412                     # Android now supports .relro sections properly.
2413                     # NOTE: While these flags enable the generation of .relro
2414                     # sections, the generated libraries can still be loaded on
2415                     # older Android platform versions.
2416                     'ldflags': [
2417                         '-Wl,-z,relro',
2418                         '-Wl,-z,now',
2419                         '-fuse-ld=gold',
2420                     ],
2421                     'conditions': [
2422                       ['arm_thumb == 1', {
2423                         # Android toolchain doesn't support -mimplicit-it=thumb
2424                         'cflags!': [ '-Wa,-mimplicit-it=thumb', ],
2425                         'cflags': [ '-mthumb-interwork', ],
2426                       }],
2427                       ['armv7==0', {
2428                         # Flags suitable for Android emulator
2429                         'cflags': [
2430                           '-march=armv5te',
2431                           '-mtune=xscale',
2432                           '-msoft-float',
2433                         ],
2434                         'defines': [
2435                           '__ARM_ARCH_5__',
2436                           '__ARM_ARCH_5T__',
2437                           '__ARM_ARCH_5E__',
2438                           '__ARM_ARCH_5TE__',
2439                         ],
2440                       }],
2441                       ['clang==1', {
2442                         'cflags!': [
2443                           # Clang does not support the following options.
2444                           '-mthumb-interwork',
2445                           '-finline-limit=64',
2446                           '-fno-tree-sra',
2447                           '-fuse-ld=gold',
2448                           '-Wno-psabi',
2449                         ],
2450                       }],
2451                     ],
2452                   }],
2453                 ],
2454               }],
2455             ],
2456           }],
2457           ['linux_fpic==1', {
2458             'cflags': [
2459               '-fPIC',
2460             ],
2461             'ldflags': [
2462               '-fPIC',
2463             ],
2464           }],
2465           ['sysroot!=""', {
2466             'target_conditions': [
2467               ['_toolset=="target"', {
2468                 'cflags': [
2469                   '--sysroot=<(sysroot)',
2470                 ],
2471                 'ldflags': [
2472                   '--sysroot=<(sysroot)',
2473                 ],
2474               }]]
2475           }],
2476           ['clang==1', {
2477             'cflags': [
2478               '-Wheader-hygiene',
2479               # Clang spots more unused functions.
2480               '-Wno-unused-function',
2481               # Don't die on dtoa code that uses a char as an array index.
2482               '-Wno-char-subscripts',
2483               # Especially needed for gtest macros using enum values from Mac
2484               # system headers.
2485               # TODO(pkasting): In C++11 this is legal, so this should be
2486               # removed when we change to that.  (This is also why we don't
2487               # bother fixing all these cases today.)
2488               '-Wno-unnamed-type-template-args',
2489               # This (rightyfully) complains about 'override', which we use
2490               # heavily.
2491               '-Wno-c++11-extensions',
2493               # Warns on switches on enums that cover all enum values but
2494               # also contain a default: branch. Chrome is full of that.
2495               '-Wno-covered-switch-default',
2497               # TODO(thakis): Remove this.
2498               '-Wno-implicit-conversion-floating-point-to-bool',
2499             ],
2500             'cflags!': [
2501               # Clang doesn't seem to know know this flag.
2502               '-mfpmath=sse',
2503             ],
2504           }],
2505           ['clang==1 and clang_use_chrome_plugins==1', {
2506             'cflags': [
2507               '<@(clang_chrome_plugins_flags)',
2508             ],
2509           }],
2510           ['clang==1 and clang_load!=""', {
2511             'cflags': [
2512               '-Xclang', '-load', '-Xclang', '<(clang_load)',
2513             ],
2514           }],
2515           ['clang==1 and clang_add_plugin!=""', {
2516             'cflags': [
2517               '-Xclang', '-add-plugin', '-Xclang', '<(clang_add_plugin)',
2518             ],
2519           }],
2520           ['clang==1 and "<(GENERATOR)"=="ninja"', {
2521             'cflags': [
2522               # See http://crbug.com/110262
2523               '-fcolor-diagnostics',
2524             ],
2525           }],
2526           ['asan==1', {
2527             'target_conditions': [
2528               ['_toolset=="target"', {
2529                 'cflags': [
2530                   '-faddress-sanitizer',
2531                   '-fno-omit-frame-pointer',
2532                 ],
2533                 'ldflags': [
2534                   '-faddress-sanitizer',
2535                 ],
2536                 'defines': [
2537                   'ADDRESS_SANITIZER',
2538                 ],
2539               }],
2540             ],
2541           }],
2542           ['tsan==1', {
2543             'target_conditions': [
2544               ['_toolset=="target"', {
2545                 'cflags': [
2546                   '-fthread-sanitizer',
2547                   '-fno-omit-frame-pointer',
2548                   '-fPIE',
2549                 ],
2550                 'ldflags': [
2551                   '-fthread-sanitizer',
2552                 ],
2553                 'defines': [
2554                   'THREAD_SANITIZER',
2555                   'DYNAMIC_ANNOTATIONS_EXTERNAL_IMPL=1',
2556                 ],
2557                 'target_conditions': [
2558                   ['_type=="executable"', {
2559                     'ldflags': [
2560                       '-pie',
2561                     ],
2562                   }],
2563                 ],
2564               }],
2565             ],
2566           }],
2567           ['order_profiling!=0 and (chromeos==1 or OS=="linux")', {
2568             'target_conditions' : [
2569               ['_toolset=="target"', {
2570                 'cflags': [
2571                   '-finstrument-functions',
2572                   # Allow mmx intrinsics to inline, so that the
2573                   # compiler can expand the intrinsics.
2574                   '-finstrument-functions-exclude-file-list=mmintrin.h',
2575                 ],
2576               }],
2577             ],
2578           }],
2579           ['linux_breakpad==1', {
2580             'cflags': [ '-g' ],
2581             'defines': ['USE_LINUX_BREAKPAD'],
2582           }],
2583           ['linux_use_heapchecker==1', {
2584             'variables': {'linux_use_tcmalloc%': 1},
2585             'defines': ['USE_HEAPCHECKER'],
2586           }],
2587           ['linux_use_tcmalloc==0', {
2588             'defines': ['NO_TCMALLOC'],
2589           }],
2590           ['linux_keep_shadow_stacks==1', {
2591             'defines': ['KEEP_SHADOW_STACKS'],
2592             'cflags': [
2593               '-finstrument-functions',
2594               # Allow mmx intrinsics to inline, so that the compiler can expand
2595               # the intrinsics.
2596               '-finstrument-functions-exclude-file-list=mmintrin.h',
2597             ],
2598           }],
2599           ['linux_use_gold_flags==1', {
2600             'ldflags': [
2601               # Experimentation found that using four linking threads
2602               # saved ~20% of link time.
2603               # https://groups.google.com/a/chromium.org/group/chromium-dev/browse_thread/thread/281527606915bb36
2604               '-Wl,--threads',
2605               '-Wl,--thread-count=4',
2606             ],
2607             'conditions': [
2608               ['release_valgrind_build==0', {
2609                 'target_conditions': [
2610                   ['_toolset=="target"', {
2611                     'ldflags': [
2612                       # There seems to be a conflict of --icf and -pie
2613                       # in gold which can generate crashy binaries. As
2614                       # a security measure, -pie takes precendence for
2615                       # now.
2616                       #'-Wl,--icf=safe',
2617                       '-Wl,--icf=none',
2618                     ],
2619                   }],
2620                 ],
2621               }],
2622             ],
2623           }],
2624           ['linux_use_gold_binary==1', {
2625             'variables': {
2626               'conditions': [
2627                 ['inside_chromium_build==1', {
2628                   # We pass the path to gold to the compiler.  gyp leaves
2629                   # unspecified what the cwd is when running the compiler,
2630                   # so the normal gyp path-munging fails us.  This hack
2631                   # gets the right path.
2632                   'gold_path': '<(PRODUCT_DIR)/../../third_party/gold',
2633                 }, {
2634                   'gold_path': '<(PRODUCT_DIR)/../../Source/WebKit/chromium/third_party/gold',
2635                 }]
2636               ]
2637             },
2638             'ldflags': [
2639               # Put our gold binary in the search path for the linker.
2640               '-B<(gold_path)',
2641             ],
2642           }],
2643         ],
2644       },
2645     }],
2646     # FreeBSD-specific options; note that most FreeBSD options are set above,
2647     # with Linux.
2648     ['OS=="freebsd"', {
2649       'target_defaults': {
2650         'ldflags': [
2651           '-Wl,--no-keep-memory',
2652         ],
2653       },
2654     }],
2655     # Android-specific options; note that most are set above with Linux.
2656     ['OS=="android"', {
2657       'variables': {
2658         # This is the id for the archived chrome symbols. Each build that
2659         # archives symbols is assigned an id which is then added to GYP_DEFINES.
2660         # This is written to the device log on crashes just prior to dropping a
2661         # tombstone. Tools can determine the location of the archived symbols
2662         # from the id.
2663         'chrome_symbols_id%': '',
2664         'conditions': [
2665           # Use shared stlport library when system one used.
2666           # Figure this out early since it needs symbols from libgcc.a, so it
2667           # has to be before that in the set of libraries.
2668           ['use_system_stlport==1', {
2669             'android_stlport_library': 'stlport',
2670           }, {
2671             'android_stlport_library': 'stlport_static',
2672           }],
2673         ],
2675         # Placing this variable here prevents from forking libvpx, used
2676         # by remoting.  Remoting is off, so it needn't built,
2677         # so forking it's deps seems like overkill.
2678         # But this variable need defined to properly run gyp.
2679         # A proper solution is to have an OS==android conditional
2680         # in third_party/libvpx/libvpx.gyp to define it.
2681         'libvpx_path': 'lib/linux/arm',
2682       },
2683       'target_defaults': {
2684         'variables': {
2685           'release_extra_cflags%': '',
2686         },
2688         'target_conditions': [
2689           # Settings for building device targets using Android's toolchain.
2690           # These are based on the setup.mk file from the Android NDK.
2691           #
2692           # The NDK Android executable link step looks as follows:
2693           #  $LDFLAGS
2694           #  $(TARGET_CRTBEGIN_DYNAMIC_O)  <-- crtbegin.o
2695           #  $(PRIVATE_OBJECTS)            <-- The .o that we built
2696           #  $(PRIVATE_STATIC_LIBRARIES)   <-- The .a that we built
2697           #  $(TARGET_LIBGCC)              <-- libgcc.a
2698           #  $(PRIVATE_SHARED_LIBRARIES)   <-- The .so that we built
2699           #  $(PRIVATE_LDLIBS)             <-- System .so
2700           #  $(TARGET_CRTEND_O)            <-- crtend.o
2701           #
2702           # For now the above are approximated for executables by adding
2703           # crtbegin.o to the end of the ldflags and 'crtend.o' to the end
2704           # of 'libraries'.
2705           #
2706           # The NDK Android shared library link step looks as follows:
2707           #  $LDFLAGS
2708           #  $(PRIVATE_OBJECTS)            <-- The .o that we built
2709           #  -l,--whole-archive
2710           #  $(PRIVATE_WHOLE_STATIC_LIBRARIES)
2711           #  -l,--no-whole-archive
2712           #  $(PRIVATE_STATIC_LIBRARIES)   <-- The .a that we built
2713           #  $(TARGET_LIBGCC)              <-- libgcc.a
2714           #  $(PRIVATE_SHARED_LIBRARIES)   <-- The .so that we built
2715           #  $(PRIVATE_LDLIBS)             <-- System .so
2716           #
2717           # For now, assume that whole static libraries are not needed.
2718           #
2719           # For both executables and shared libraries, add the proper
2720           # libgcc.a to the start of libraries which puts it in the
2721           # proper spot after .o and .a files get linked in.
2722           #
2723           # TODO: The proper thing to do longer-tem would be proper gyp
2724           # support for a custom link command line.
2725           ['_toolset=="target"', {
2726            'conditions': [
2727            ['build_with_mozilla==0', {
2728             'cflags!': [
2729               '-pthread',  # Not supported by Android toolchain.
2730             ],
2731             'cflags': [
2732               '-ffunction-sections',
2733               '-funwind-tables',
2734               '-g',
2735               '-fstack-protector',
2736               '-fno-short-enums',
2737               '-finline-limit=64',
2738               '-Wa,--noexecstack',
2739               '<@(release_extra_cflags)',
2740             ],
2741             'ldflags!': [
2742               '-pthread',  # Not supported by Android toolchain.
2743             ],
2744             'ldflags': [
2745               '-nostdlib',
2746               '-Wl,--no-undefined',
2747               # Don't export symbols from statically linked libraries.
2748               '-Wl,--exclude-libs=ALL',
2749             ],
2750             'libraries': [
2751               '-l<(android_stlport_library)',
2752               '-lc',
2753               '-ldl',
2754               '-lstdc++',
2755               '-lm',
2756             ],
2757             'conditions': [
2758               ['android_upstream_bringup==1', {
2759                 'defines': ['ANDROID_UPSTREAM_BRINGUP=1',],
2760               }],
2761               ['clang==1', {
2762                 'cflags': [
2763                   # Work around incompatibilities between bionic and clang
2764                   # headers.
2765                   '-D__compiler_offsetof=__builtin_offsetof',
2766                   '-Dnan=__builtin_nan',
2767                 ],
2768                 'conditions': [
2769                   ['target_arch=="arm"', {
2770                     'cflags': [
2771                       '-target arm-linux-androideabi',
2772                       '-mllvm -arm-enable-ehabi',
2773                     ],
2774                     'ldflags': [
2775                       '-target arm-linux-androideabi',
2776                     ],
2777                   }],
2778                   ['target_arch=="ia32"', {
2779                     'cflags': [
2780                       '-target x86-linux-androideabi',
2781                     ],
2782                     'ldflags': [
2783                       '-target x86-linux-androideabi',
2784                     ],
2785                   }],
2786                 ],
2787               }],
2788               ['android_build_type==0', {
2789                 'defines': [
2790                   # The NDK has these things, but doesn't define the constants
2791                   # to say that it does. Define them here instead.
2792                   'HAVE_SYS_UIO_H',
2793                 ],
2794                 'cflags': [
2795                   '--sysroot=<(android_ndk_sysroot)',
2796                 ],
2797                 'ldflags': [
2798                   '--sysroot=<(android_ndk_sysroot)',
2799                 ],
2800               }],
2801               ['android_build_type==1', {
2802                 'include_dirs': [
2803                   # OpenAL headers from the Android tree.
2804                   '<(android_src)/frameworks/wilhelm/include',
2805                 ],
2806                 'cflags': [
2807                   # Chromium builds its own (non-third-party) code with
2808                   # -Werror to make all warnings into errors. However, Android
2809                   # enables warnings that Chromium doesn't, so some of these
2810                   # extra warnings trip and break things.
2811                   # For now, we leave these warnings enabled but prevent them
2812                   # from being treated as errors.
2813                   #
2814                   # Things that are part of -Wextra:
2815                   '-Wno-error=extra', # Enabled by -Wextra, but no specific flag
2816                   '-Wno-error=ignored-qualifiers',
2817                   '-Wno-error=type-limits',
2818                   # Other things unrelated to -Wextra:
2819                   '-Wno-error=non-virtual-dtor',
2820                   '-Wno-error=sign-promo',
2821                 ],
2822                 'cflags_cc': [
2823                   # Disabling c++0x-compat should be handled in WebKit, but
2824                   # this currently doesn't work because gcc_version is not set
2825                   # correctly when building with the Android build system.
2826                   # TODO(torne): Fix this in WebKit.
2827                   '-Wno-error=c++0x-compat',
2828                 ],
2829               }],
2830               ['android_build_type==1 and chromium_code==0', {
2831                 'cflags': [
2832                   # There is a class of warning which:
2833                   #  1) Android always enables and also treats as errors
2834                   #  2) Chromium ignores in third party code
2835                   # For now, I am leaving these warnings enabled but preventing
2836                   # them from being treated as errors here.
2837                   '-Wno-error=address',
2838                   '-Wno-error=format-security',
2839                   '-Wno-error=non-virtual-dtor',
2840                   '-Wno-error=return-type',
2841                   '-Wno-error=sequence-point',
2842                 ],
2843               }],
2844               ['target_arch == "arm"', {
2845                 'ldflags': [
2846                   # Enable identical code folding to reduce size.
2847                   '-Wl,--icf=safe',
2848                 ],
2849               }],
2850               # NOTE: The stlport header include paths below are specified in
2851               # cflags rather than include_dirs because they need to come
2852               # after include_dirs. Think of them like system headers, but
2853               # don't use '-isystem' because the arm-linux-androideabi-4.4.3
2854               # toolchain (circa Gingerbread) will exhibit strange errors.
2855               # The include ordering here is important; change with caution.
2856               ['use_system_stlport==1', {
2857                 'cflags': [
2858                   # For libstdc++/include, which is used by stlport.
2859                   '-I<(android_src)/bionic',
2860                   '-I<(android_src)/external/stlport/stlport',
2861                 ],
2862               }, { # else: use_system_stlport!=1
2863                 'cflags': [
2864                   '-I<(android_ndk_root)/sources/cxx-stl/stlport/stlport',
2865                 ],
2866                 'conditions': [
2867                   ['target_arch=="arm" and armv7==1', {
2868                     'ldflags': [
2869                       '-L<(android_ndk_root)/sources/cxx-stl/stlport/libs/armeabi-v7a',
2870                     ],
2871                   }],
2872                   ['target_arch=="arm" and armv7==0', {
2873                     'ldflags': [
2874                       '-L<(android_ndk_root)/sources/cxx-stl/stlport/libs/armeabi',
2875                     ],
2876                   }],
2877                   ['target_arch=="ia32"', {
2878                     'ldflags': [
2879                       '-L<(android_ndk_root)/sources/cxx-stl/stlport/libs/x86',
2880                     ],
2881                   }],
2882                 ],
2883               }],
2884               ['target_arch=="ia32"', {
2885                 # The x86 toolchain currently has problems with stack-protector.
2886                 'cflags!': [
2887                   '-fstack-protector',
2888                 ],
2889                 'cflags': [
2890                   '-fno-stack-protector',
2891                 ],
2892               }],
2893             ],
2894             'target_conditions': [
2895               ['_type=="executable"', {
2896                 'ldflags': [
2897                   '-Bdynamic',
2898                   '-Wl,-dynamic-linker,/system/bin/linker',
2899                   '-Wl,--gc-sections',
2900                   '-Wl,-z,nocopyreloc',
2901                   # crtbegin_dynamic.o should be the last item in ldflags.
2902                   '<(android_ndk_lib)/crtbegin_dynamic.o',
2903                 ],
2904                 'libraries': [
2905                   # crtend_android.o needs to be the last item in libraries.
2906                   # Do not add any libraries after this!
2907                   '<(android_ndk_lib)/crtend_android.o',
2908                 ],
2909               }],
2910               ['_type=="shared_library" or _type=="loadable_module"', {
2911                 'ldflags': [
2912                   '-Wl,-shared,-Bsymbolic',
2913                   # crtbegin_so.o should be the last item in ldflags.
2914                   '<(android_ndk_lib)/crtbegin_so.o',
2915                 ],
2916                 'libraries': [
2917                   # crtend_so.o needs to be the last item in libraries.
2918                   # Do not add any libraries after this!
2919                   '<(android_ndk_lib)/crtend_so.o',
2920                 ],
2921               }],
2922             ],
2924            }], # build_with_mozilla== 0
2926             ],
2927             'defines': [
2928               'ANDROID',
2929               '__GNU_SOURCE=1',  # Necessary for clone()
2930               'USE_STLPORT=1',
2931               '_STLP_USE_PTR_SPECIALIZATIONS=1',
2932               'CHROME_SYMBOLS_ID="<(chrome_symbols_id)"',
2933             ],
2934            }],
2935           # Settings for building host targets using the system toolchain.
2936           ['_toolset=="host"', {
2937             'cflags!': [
2938               # Due to issues in Clang build system, using ASan on 32-bit
2939               # binaries on x86_64 host is problematic.
2940               # TODO(eugenis): re-enable.
2941               '-faddress-sanitizer',
2942             ],
2943             'ldflags!': [
2944               '-faddress-sanitizer',
2945               '-Wl,-z,noexecstack',
2946               '-Wl,--gc-sections',
2947               '-Wl,-O1',
2948               '-Wl,--as-needed',
2949             ],
2950             'sources/': [
2951               ['exclude', '_android(_unittest)?\\.cc$'],
2952               ['exclude', '(^|/)android/']
2953             ],
2954           }],
2955         ],
2956       },
2957     }],
2958     ['OS=="solaris"', {
2959       'cflags!': ['-fvisibility=hidden'],
2960       'cflags_cc!': ['-fvisibility-inlines-hidden'],
2961     }],
2962     ['OS=="mac" or OS=="ios"', {
2963       'target_defaults': {
2964         'mac_bundle': 0,
2965         'xcode_settings': {
2966           'ALWAYS_SEARCH_USER_PATHS': 'NO',
2967           'GCC_C_LANGUAGE_STANDARD': 'c99',         # -std=c99
2968           'GCC_CW_ASM_SYNTAX': 'NO',                # No -fasm-blocks
2969           'GCC_ENABLE_CPP_EXCEPTIONS': 'NO',        # -fno-exceptions
2970           'GCC_ENABLE_CPP_RTTI': 'NO',              # -fno-rtti
2971           'GCC_ENABLE_PASCAL_STRINGS': 'NO',        # No -mpascal-strings
2972           # GCC_INLINES_ARE_PRIVATE_EXTERN maps to -fvisibility-inlines-hidden
2973           'GCC_INLINES_ARE_PRIVATE_EXTERN': 'YES',
2974           'GCC_OBJC_CALL_CXX_CDTORS': 'YES',        # -fobjc-call-cxx-cdtors
2975           'GCC_SYMBOLS_PRIVATE_EXTERN': 'YES',      # -fvisibility=hidden
2976           'GCC_THREADSAFE_STATICS': 'NO',           # -fno-threadsafe-statics
2977           'GCC_TREAT_WARNINGS_AS_ERRORS': 'YES',    # -Werror
2978           'GCC_VERSION': '4.2',
2979           'GCC_WARN_ABOUT_MISSING_NEWLINE': 'YES',  # -Wnewline-eof
2980           'USE_HEADERMAP': 'NO',
2981           'WARNING_CFLAGS': [
2982             '-Wall',
2983             '-Wendif-labels',
2984             '-Wextra',
2985             # Don't warn about unused function parameters.
2986             '-Wno-unused-parameter',
2987             # Don't warn about the "struct foo f = {0};" initialization
2988             # pattern.
2989             '-Wno-missing-field-initializers',
2990           ],
2991           'conditions': [
2992             ['chromium_mac_pch', {'GCC_PRECOMPILE_PREFIX_HEADER': 'YES'},
2993                                  {'GCC_PRECOMPILE_PREFIX_HEADER': 'NO'}
2994             ],
2995           ],
2996         },
2997         'target_conditions': [
2998           ['_type!="static_library"', {
2999             'xcode_settings': {'OTHER_LDFLAGS': ['-Wl,-search_paths_first']},
3000           }],
3001           ['_mac_bundle', {
3002             'xcode_settings': {'OTHER_LDFLAGS': ['-Wl,-ObjC']},
3003           }],
3004         ],  # target_conditions
3005       },  # target_defaults
3006     }],  # OS=="mac" or OS=="ios"
3007     ['OS=="mac"', {
3008       'target_defaults': {
3009         'variables': {
3010           # These should end with %, but there seems to be a bug with % in
3011           # variables that are intended to be set to different values in
3012           # different targets, like these.
3013           'mac_pie': 1,        # Most executables can be position-independent.
3014           'mac_real_dsym': 0,  # Fake .dSYMs are fine in most cases.
3015           # Strip debugging symbols from the target.
3016           'mac_strip': '<(mac_strip_release)',
3017         },
3018         'xcode_settings': {
3019           'GCC_DYNAMIC_NO_PIC': 'NO',               # No -mdynamic-no-pic
3020                                                     # (Equivalent to -fPIC)
3021           # MACOSX_DEPLOYMENT_TARGET maps to -mmacosx-version-min
3022           'MACOSX_DEPLOYMENT_TARGET': '<(mac_deployment_target)',
3023           # Keep pch files below xcodebuild/.
3024           'SHARED_PRECOMPS_DIR': '$(CONFIGURATION_BUILD_DIR)/SharedPrecompiledHeaders',
3025           'OTHER_CFLAGS': [
3026             '-fno-strict-aliasing',  # See http://crbug.com/32204
3027           ],
3028           'conditions': [
3029             ['clang==1', {
3030               'CC': '$(SOURCE_ROOT)/<(clang_dir)/clang',
3031               'LDPLUSPLUS': '$(SOURCE_ROOT)/<(clang_dir)/clang++',
3033               # Don't use -Wc++0x-extensions, which Xcode 4 enables by default
3034               # when buliding with clang. This warning is triggered when the
3035               # override keyword is used via the OVERRIDE macro from
3036               # base/compiler_specific.h.
3037               'CLANG_WARN_CXX0X_EXTENSIONS': 'NO',
3039               'GCC_VERSION': 'com.apple.compilers.llvm.clang.1_0',
3040               'WARNING_CFLAGS': [
3041                 '-Wheader-hygiene',
3042                 # Don't die on dtoa code that uses a char as an array index.
3043                 # This is required solely for base/third_party/dmg_fp/dtoa.cc.
3044                 '-Wno-char-subscripts',
3045                 # Clang spots more unused functions.
3046                 '-Wno-unused-function',
3047                 # See comments on this flag higher up in this file.
3048                 '-Wno-unnamed-type-template-args',
3049                 # This (rightyfully) complains about 'override', which we use
3050                 # heavily.
3051                 '-Wno-c++11-extensions',
3053                 # Warns on switches on enums that cover all enum values but
3054                 # also contain a default: branch. Chrome is full of that.
3055                 '-Wno-covered-switch-default',
3057                 # TODO(thakis): Remove this.
3058                 '-Wno-implicit-conversion-floating-point-to-bool',
3059               ],
3060             }],
3061             ['clang==1 and clang_use_chrome_plugins==1', {
3062               'OTHER_CFLAGS': [
3063                 '<@(clang_chrome_plugins_flags)',
3064               ],
3065             }],
3066             ['clang==1 and clang_load!=""', {
3067               'OTHER_CFLAGS': [
3068                 '-Xclang', '-load', '-Xclang', '<(clang_load)',
3069               ],
3070             }],
3071             ['clang==1 and clang_add_plugin!=""', {
3072               'OTHER_CFLAGS': [
3073                 '-Xclang', '-add-plugin', '-Xclang', '<(clang_add_plugin)',
3074               ],
3075             }],
3076             ['clang==1 and "<(GENERATOR)"=="ninja"', {
3077               'OTHER_CFLAGS': [
3078                 # See http://crbug.com/110262
3079                 '-fcolor-diagnostics',
3080               ],
3081             }],
3082           ],
3083         },
3084         'conditions': [
3085           ['clang==1', {
3086             'variables': {
3087               'clang_dir': '../third_party/llvm-build/Release+Asserts/bin',
3088             },
3089           }],
3090           ['asan==1', {
3091             'xcode_settings': {
3092               'OTHER_CFLAGS': [
3093                 '-faddress-sanitizer',
3094               ],
3095             },
3096             'defines': [
3097               'ADDRESS_SANITIZER',
3098             ],
3099           }],
3100         ],
3101         'target_conditions': [
3102           ['_type!="static_library"', {
3103             'xcode_settings': {'OTHER_LDFLAGS': ['-Wl,-search_paths_first']},
3104             'conditions': [
3105               ['asan==1', {
3106                 'xcode_settings': {
3107                   'OTHER_LDFLAGS': [
3108                     '-faddress-sanitizer',
3109                   ],
3110                 },
3111               }],
3112             ],
3113           }],
3114           ['_mac_bundle', {
3115             'xcode_settings': {'OTHER_LDFLAGS': ['-Wl,-ObjC']},
3116           }],
3117           ['_type=="executable"', {
3118             'postbuilds': [
3119               {
3120                 # Arranges for data (heap) pages to be protected against
3121                 # code execution when running on Mac OS X 10.7 ("Lion"), and
3122                 # ensures that the position-independent executable (PIE) bit
3123                 # is set for ASLR when running on Mac OS X 10.5 ("Leopard").
3124                 'variables': {
3125                   # Define change_mach_o_flags in a variable ending in _path
3126                   # so that GYP understands it's a path and performs proper
3127                   # relativization during dict merging.
3128                   'change_mach_o_flags':
3129                       'mac/change_mach_o_flags_from_xcode.sh',
3130                   'change_mach_o_flags_options%': [
3131                   ],
3132                   'target_conditions': [
3133                     ['mac_pie==0 or release_valgrind_build==1', {
3134                       # Don't enable PIE if it's unwanted. It's unwanted if
3135                       # the target specifies mac_pie=0 or if building for
3136                       # Valgrind, because Valgrind doesn't understand slide.
3137                       # See the similar mac_pie/release_valgrind_build check
3138                       # below.
3139                       'change_mach_o_flags_options': [
3140                         '--no-pie',
3141                       ],
3142                     }],
3143                   ],
3144                 },
3145                 'postbuild_name': 'Change Mach-O Flags',
3146                 'action': [
3147                    '$(srcdir)$(os_sep)build$(os_sep)<(change_mach_o_flags)',
3148                   '>@(change_mach_o_flags_options)',
3149                 ],
3150               },
3151             ],
3152             'conditions': [
3153               ['asan==1', {
3154                 'variables': {
3155                  'asan_saves_file': 'asan.saves',
3156                 },
3157                 'xcode_settings': {
3158                   'CHROMIUM_STRIP_SAVE_FILE': '<(asan_saves_file)',
3159                 },
3160               }],
3161             ],
3162             'target_conditions': [
3163               ['mac_pie==1 and release_valgrind_build==0', {
3164                 # Turn on position-independence (ASLR) for executables. When
3165                 # PIE is on for the Chrome executables, the framework will
3166                 # also be subject to ASLR.
3167                 # Don't do this when building for Valgrind, because Valgrind
3168                 # doesn't understand slide. TODO: Make Valgrind on Mac OS X
3169                 # understand slide, and get rid of the Valgrind check.
3170                 'xcode_settings': {
3171                   'OTHER_LDFLAGS': [
3172                     '-Wl,-pie',  # Position-independent executable (MH_PIE)
3173                   ],
3174                 },
3175               }],
3176             ],
3177           }],
3178           ['(_type=="executable" or _type=="shared_library" or \
3179              _type=="loadable_module") and mac_strip!=0', {
3180             'target_conditions': [
3181               ['mac_real_dsym == 1', {
3182                 # To get a real .dSYM bundle produced by dsymutil, set the
3183                 # debug information format to dwarf-with-dsym.  Since
3184                 # strip_from_xcode will not be used, set Xcode to do the
3185                 # stripping as well.
3186                 'configurations': {
3187                   'Release_Base': {
3188                     'xcode_settings': {
3189                       'DEBUG_INFORMATION_FORMAT': 'dwarf-with-dsym',
3190                       'DEPLOYMENT_POSTPROCESSING': 'YES',
3191                       'STRIP_INSTALLED_PRODUCT': 'YES',
3192                       'target_conditions': [
3193                         ['_type=="shared_library" or _type=="loadable_module"', {
3194                           # The Xcode default is to strip debugging symbols
3195                           # only (-S).  Local symbols should be stripped as
3196                           # well, which will be handled by -x.  Xcode will
3197                           # continue to insert -S when stripping even when
3198                           # additional flags are added with STRIPFLAGS.
3199                           'STRIPFLAGS': '-x',
3200                         }],  # _type=="shared_library" or _type=="loadable_module"'
3201                       ],  # target_conditions
3202                     },  # xcode_settings
3203                   },  # configuration "Release"
3204                 },  # configurations
3205               }, {  # mac_real_dsym != 1
3206                 # To get a fast fake .dSYM bundle, use a post-build step to
3207                 # produce the .dSYM and strip the executable.  strip_from_xcode
3208                 # only operates in the Release configuration.
3209                 'postbuilds': [
3210                   {
3211                     'variables': {
3212                       # Define strip_from_xcode in a variable ending in _path
3213                       # so that gyp understands it's a path and performs proper
3214                       # relativization during dict merging.
3215                       'strip_from_xcode': 'mac/strip_from_xcode',
3216                     },
3217                     'postbuild_name': 'Strip If Needed',
3218                     'action': ['$(srcdir)$(os_sep)build$(os_sep)<(strip_from_xcode)'],
3219                   },
3220                 ],  # postbuilds
3221               }],  # mac_real_dsym
3222             ],  # target_conditions
3223           }],  # (_type=="executable" or _type=="shared_library" or
3224                #  _type=="loadable_module") and mac_strip!=0
3225         ],  # target_conditions
3226       },  # target_defaults
3227     }],  # OS=="mac"
3228     ['OS=="ios"', {
3229       'target_defaults': {
3230         'xcode_settings' : {
3231           'GCC_VERSION': 'com.apple.compilers.llvm.clang.1_0',
3233           # This next block is mostly common with the 'mac' section above,
3234           # but keying off (or setting) 'clang' isn't valid for iOS as it
3235           # also seems to mean using the custom build of clang.
3237           # Don't use -Wc++0x-extensions, which Xcode 4 enables by default
3238           # when buliding with clang. This warning is triggered when the
3239           # override keyword is used via the OVERRIDE macro from
3240           # base/compiler_specific.h.
3241           'CLANG_WARN_CXX0X_EXTENSIONS': 'NO',
3242           'WARNING_CFLAGS': [
3243             '-Wheader-hygiene',
3244             # Don't die on dtoa code that uses a char as an array index.
3245             # This is required solely for base/third_party/dmg_fp/dtoa.cc.
3246             '-Wno-char-subscripts',
3247             # Clang spots more unused functions.
3248             '-Wno-unused-function',
3249             # See comments on this flag higher up in this file.
3250             '-Wno-unnamed-type-template-args',
3251             # This (rightyfully) complains about 'override', which we use
3252             # heavily.
3253             '-Wno-c++11-extensions',
3254           ],
3255         },
3256         'target_conditions': [
3257           ['_type=="executable"', {
3258             'configurations': {
3259               'Release_Base': {
3260                 'xcode_settings': {
3261                   'DEPLOYMENT_POSTPROCESSING': 'YES',
3262                   'STRIP_INSTALLED_PRODUCT': 'YES',
3263                 },
3264               },
3265             },
3266             'xcode_settings': {
3267               'conditions': [
3268                 ['chromium_ios_signing', {
3269                   # iOS SDK wants everything for device signed.
3270                   'CODE_SIGN_IDENTITY[sdk=iphoneos*]': 'iPhone Developer',
3271                 }, {
3272                   'CODE_SIGNING_REQUIRED': 'NO',
3273                   'CODE_SIGN_IDENTITY[sdk=iphoneos*]': '',
3274                 }],
3275               ],
3276             },
3277           }],
3278         ],  # target_conditions
3279       },  # target_defaults
3280     }],  # OS=="ios"
3281     ['OS=="win"', {
3282       'target_defaults': {
3283         'defines': [
3284           'WIN32',
3285           '_WINDOWS',
3286           'NOMINMAX',
3287           '_CRT_RAND_S',
3288           'CERT_CHAIN_PARA_HAS_EXTRA_FIELDS',
3289           'WIN32_LEAN_AND_MEAN',
3290           '_ATL_NO_OPENGL',
3291         ],
3292         'conditions': [
3293           ['build_with_mozilla==0', {
3294               'defines': [
3295                 '_WIN32_WINNT=0x0602',
3296                 'WINVER=0x0602',
3297               ],
3298           }],
3299           ['buildtype=="Official"', {
3300               # In official builds, targets can self-select an optimization
3301               # level by defining a variable named 'optimize', and setting it
3302               # to one of
3303               # - "size", optimizes for minimal code size - the default.
3304               # - "speed", optimizes for speed over code size.
3305               # - "max", whole program optimization and link-time code
3306               #   generation. This is very expensive and should be used
3307               #   sparingly.
3308               'variables': {
3309                 'optimize%': 'size',
3310               },
3311               'target_conditions': [
3312                 ['optimize=="size"', {
3313                     'msvs_settings': {
3314                       'VCCLCompilerTool': {
3315                         # 1, optimizeMinSpace, Minimize Size (/O1)
3316                         'Optimization': '1',
3317                         # 2, favorSize - Favor small code (/Os)
3318                         'FavorSizeOrSpeed': '2',
3319                       },
3320                     },
3321                   },
3322                 ],
3323                 ['optimize=="speed"', {
3324                     'msvs_settings': {
3325                       'VCCLCompilerTool': {
3326                         # 2, optimizeMaxSpeed, Maximize Speed (/O2)
3327                         'Optimization': '2',
3328                         # 1, favorSpeed - Favor fast code (/Ot)
3329                         'FavorSizeOrSpeed': '1',
3330                       },
3331                     },
3332                   },
3333                 ],
3334                 ['optimize=="max"', {
3335                     'msvs_settings': {
3336                       'VCCLCompilerTool': {
3337                         # 2, optimizeMaxSpeed, Maximize Speed (/O2)
3338                         'Optimization': '2',
3339                         # 1, favorSpeed - Favor fast code (/Ot)
3340                         'FavorSizeOrSpeed': '1',
3341                         # This implies link time code generation.
3342                         'WholeProgramOptimization': 'true',
3343                       },
3344                     },
3345                   },
3346                 ],
3347               ],
3348             },
3349           ],
3350           ['component=="static_library"', {
3351             'defines': [
3352               '_HAS_EXCEPTIONS=0',
3353             ],
3354           }],
3355           ['MSVS_VERSION=="2008"', {
3356             'defines': [
3357               '_HAS_TR1=0',
3358             ],
3359           }],
3360           ['secure_atl', {
3361             'defines': [
3362               '_SECURE_ATL',
3363             ],
3364           }],
3365         ],
3366         'msvs_system_include_dirs': [
3367           '<(windows_sdk_path)/Include/shared',
3368           '<(windows_sdk_path)/Include/um',
3369           '<(windows_sdk_path)/Include/winrt',
3370 #          '<(directx_sdk_path)/Include',
3371           '$(VSInstallDir)/VC/atlmfc/include',
3372         ],
3373         'msvs_cygwin_dirs': ['<(DEPTH)/third_party/cygwin'],
3374         'msvs_disabled_warnings': [4351, 4396, 4503, 4819,
3375           # TODO(maruel): These warnings are level 4. They will be slowly
3376           # removed as code is fixed.
3377           4100, 4121, 4125, 4127, 4130, 4131, 4189, 4201, 4238, 4244, 4245,
3378           4310, 4355, 4428, 4481, 4505, 4510, 4512, 4530, 4610, 4611, 4701,
3379           4702, 4706,
3380         ],
3381         'msvs_settings': {
3382           'VCCLCompilerTool': {
3383             'AdditionalOptions': ['/MP'],
3384             'MinimalRebuild': 'false',
3385             'BufferSecurityCheck': 'true',
3386             'EnableFunctionLevelLinking': 'true',
3387             'RuntimeTypeInfo': 'false',
3388             'WarningLevel': '4',
3389             'WarnAsError': 'true',
3390             'DebugInformationFormat': '3',
3391             'conditions': [
3392               ['component=="shared_library"', {
3393                 'ExceptionHandling': '1',  # /EHsc
3394               }, {
3395                 'ExceptionHandling': '0',
3396               }],
3397             ],
3398           },
3399           'VCLibrarianTool': {
3400             'AdditionalOptions': ['/ignore:4221'],
3401             'AdditionalLibraryDirectories': [
3402 #              '<(directx_sdk_path)/Lib/x86',
3403               '<(windows_sdk_path)/Lib/win8/um/x86',
3404             ],
3405           },
3406           'VCLinkerTool': {
3407             'AdditionalDependencies': [
3408               'wininet.lib',
3409               'dnsapi.lib',
3410               'version.lib',
3411               'msimg32.lib',
3412               'ws2_32.lib',
3413               'usp10.lib',
3414               'dbghelp.lib',
3415               'winmm.lib',
3416               'shlwapi.lib',
3417             ],
3419             'conditions': [
3420               ['msvs_express', {
3421                 # Explicitly required when using the ATL with express
3422                 'AdditionalDependencies': [
3423                   'atlthunk.lib',
3424                 ],
3426                 # ATL 8.0 included in WDK 7.1 makes the linker to generate
3427                 # almost eight hundred LNK4254 and LNK4078 warnings:
3428                 #   - warning LNK4254: section 'ATL' (50000040) merged into
3429                 #     '.rdata' (40000040) with different attributes
3430                 #   - warning LNK4078: multiple 'ATL' sections found with
3431                 #     different attributes
3432                 'AdditionalOptions': ['/ignore:4254', '/ignore:4078'],
3433               }],
3434               ['MSVS_VERSION=="2005e"', {
3435                 # Non-express versions link automatically to these
3436                 'AdditionalDependencies': [
3437                   'advapi32.lib',
3438                   'comdlg32.lib',
3439                   'ole32.lib',
3440                   'shell32.lib',
3441                   'user32.lib',
3442                   'winspool.lib',
3443                 ],
3444               }],
3445             ],
3446             'AdditionalLibraryDirectories': [
3447 #              '<(directx_sdk_path)/Lib/x86', XXXX
3448               '<(windows_sdk_path)/Lib/win8/um/x86',
3449             ],
3450             'GenerateDebugInformation': 'true',
3451             'MapFileName': '$(OutDir)\\$(TargetName).map',
3452             'ImportLibrary': '$(OutDir)\\lib\\$(TargetName).lib',
3453             'FixedBaseAddress': '1',
3454             # SubSystem values:
3455             #   0 == not set
3456             #   1 == /SUBSYSTEM:CONSOLE
3457             #   2 == /SUBSYSTEM:WINDOWS
3458             # Most of the executables we'll ever create are tests
3459             # and utilities with console output.
3460             'SubSystem': '1',
3461           },
3462           'VCMIDLTool': {
3463             'GenerateStublessProxies': 'true',
3464             'TypeLibraryName': '$(InputName).tlb',
3465             'OutputDirectory': '$(IntDir)',
3466             'HeaderFileName': '$(InputName).h',
3467             'DLLDataFileName': '$(InputName).dlldata.c',
3468             'InterfaceIdentifierFileName': '$(InputName)_i.c',
3469             'ProxyFileName': '$(InputName)_p.c',
3470           },
3471           'VCResourceCompilerTool': {
3472             'Culture' : '1033',
3473             'AdditionalIncludeDirectories': [
3474               '<(DEPTH)',
3475               '<(SHARED_INTERMEDIATE_DIR)',
3476             ],
3477           },
3478         },
3479       },
3480     }],
3481     ['disable_nacl==1', {
3482       'target_defaults': {
3483         'defines': [
3484           'DISABLE_NACL',
3485         ],
3486       },
3487     }],
3488     ['OS=="win" and msvs_use_common_linker_extras', {
3489       'target_defaults': {
3490         'msvs_settings': {
3491           'VCLinkerTool': {
3492             'DelayLoadDLLs': [
3493               'dbghelp.dll',
3494               'dwmapi.dll',
3495               'shell32.dll',
3496               'uxtheme.dll',
3497             ],
3498           },
3499         },
3500         'configurations': {
3501           'x86_Base': {
3502             'msvs_settings': {
3503               'VCLinkerTool': {
3504                 'AdditionalOptions': [
3505                   '/safeseh',
3506                   '/dynamicbase',
3507                   '/ignore:4199',
3508                   '/ignore:4221',
3509                   '/nxcompat',
3510                 ],
3511               },
3512             },
3513           },
3514           'x64_Base': {
3515             'msvs_settings': {
3516               'VCLinkerTool': {
3517                 'AdditionalOptions': [
3518                   # safeseh is not compatible with x64
3519                   '/dynamicbase',
3520                   '/ignore:4199',
3521                   '/ignore:4221',
3522                   '/nxcompat',
3523                 ],
3524               },
3525             },
3526           },
3527         },
3528       },
3529     }],
3530     ['enable_new_npdevice_api==1', {
3531       'target_defaults': {
3532         'defines': [
3533           'ENABLE_NEW_NPDEVICE_API',
3534         ],
3535       },
3536     }],
3537   ],
3538   'xcode_settings': {
3539     # DON'T ADD ANYTHING NEW TO THIS BLOCK UNLESS YOU REALLY REALLY NEED IT!
3540     # This block adds *project-wide* configuration settings to each project
3541     # file.  It's almost always wrong to put things here.  Specify your
3542     # custom xcode_settings in target_defaults to add them to targets instead.
3544     'conditions': [
3545       # In an Xcode Project Info window, the "Base SDK for All Configurations"
3546       # setting sets the SDK on a project-wide basis. In order to get the
3547       # configured SDK to show properly in the Xcode UI, SDKROOT must be set
3548       # here at the project level.
3549       ['OS=="mac"', {
3550         'conditions': [
3551           ['mac_sdk_path==""', {
3552             'SDKROOT': 'macosx<(mac_sdk)',  # -isysroot
3553           }, {
3554             'SDKROOT': '<(mac_sdk_path)',  # -isysroot
3555           }],
3556         ],
3557       }],
3558       ['OS=="ios"', {
3559         'conditions': [
3560           ['ios_sdk_path==""', {
3561             'SDKROOT': 'iphoneos<(ios_sdk)',  # -isysroot
3562           }, {
3563             'SDKROOT': '<(ios_sdk_path)',  # -isysroot
3564           }],
3565         ],
3566       }],
3567       ['OS=="ios"', {
3568         # Just build armv7 since iOS 4.3+ only supports armv7.
3569         'ARCHS': '$(ARCHS_UNIVERSAL_IPHONE_OS)',
3570         'IPHONEOS_DEPLOYMENT_TARGET': '<(ios_deployment_target)',
3571         # Target both iPhone and iPad.
3572         'TARGETED_DEVICE_FAMILY': '1,2',
3573       }],
3574     ],
3576     # The Xcode generator will look for an xcode_settings section at the root
3577     # of each dict and use it to apply settings on a file-wide basis.  Most
3578     # settings should not be here, they should be in target-specific
3579     # xcode_settings sections, or better yet, should use non-Xcode-specific
3580     # settings in target dicts.  SYMROOT is a special case, because many other
3581     # Xcode variables depend on it, including variables such as
3582     # PROJECT_DERIVED_FILE_DIR.  When a source group corresponding to something
3583     # like PROJECT_DERIVED_FILE_DIR is added to a project, in order for the
3584     # files to appear (when present) in the UI as actual files and not red
3585     # red "missing file" proxies, the correct path to PROJECT_DERIVED_FILE_DIR,
3586     # and therefore SYMROOT, needs to be set at the project level.
3587     'SYMROOT': '<(DEPTH)/xcodebuild',
3588   },