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