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