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