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