[build] Use sysroot for linux compilation with clang

This ports the configuration for using a sysroot from
chromium's common.gypi.

This is restricted to clang only.

BUG=chromium:474921, chromium:616032
LOG=y

Review-Url: https://codereview.chromium.org/2028623002
Cr-Commit-Position: refs/heads/master@{#36729}
This commit is contained in:
machenbach 2016-06-06 01:40:15 -07:00 committed by Commit bot
parent 1763a9e5f3
commit c47d3c6369
2 changed files with 56 additions and 0 deletions

12
DEPS
View File

@ -189,6 +189,18 @@ hooks = [
"-s", "v8/buildtools/linux64/gn.sha1",
],
},
{
# Downloads the current stable linux sysroot to build/linux/ if needed.
# This sysroot updates at about the same rate that the chrome build deps
# change.
'name': 'sysroot',
'pattern': '.',
'action': [
'python',
'v8/build/linux/sysroot_scripts/install-sysroot.py',
'--running-as-hook',
],
},
{
# Update the Windows toolchain if necessary.
'name': 'win_toolchain',

View File

@ -63,21 +63,52 @@
'host_arch%': 'ia32',
}],
],
# By default we build against a stable sysroot image to avoid
# depending on the packages installed on the local machine. Set this
# to 0 to build against locally installed headers and libraries (e.g.
# if packaging for a linux distro)
'use_sysroot%': 1,
},
'host_arch%': '<(host_arch)',
'target_arch%': '<(host_arch)',
'use_sysroot%': '<(use_sysroot)',
'base_dir%': '<!(cd <(DEPTH) && python -c "import os; print os.getcwd()")',
# Instrument for code coverage and use coverage wrapper to exclude some
# files. Uses gcov if clang=0 is set explicitly. Otherwise,
# sanitizer_coverage must be set too.
'coverage%': 0,
# Default sysroot if no sysroot can be provided.
'sysroot%': '',
'conditions': [
# The system root for linux builds.
['OS=="linux" and use_sysroot==1', {
'conditions': [
['target_arch=="arm"', {
'sysroot%': '<!(cd <(DEPTH) && pwd -P)/build/linux/debian_wheezy_arm-sysroot',
}],
['target_arch=="x64"', {
'sysroot%': '<!(cd <(DEPTH) && pwd -P)/build/linux/debian_wheezy_amd64-sysroot',
}],
['target_arch=="ia32"', {
'sysroot%': '<!(cd <(DEPTH) && pwd -P)/build/linux/debian_wheezy_i386-sysroot',
}],
['target_arch=="mipsel"', {
'sysroot%': '<!(cd <(DEPTH) && pwd -P)/build/linux/debian_wheezy_mips-sysroot',
}],
],
}], # OS=="linux" and use_sysroot==1
],
},
'base_dir%': '<(base_dir)',
'host_arch%': '<(host_arch)',
'target_arch%': '<(target_arch)',
'v8_target_arch%': '<(target_arch)',
'coverage%': '<(coverage)',
'sysroot%': '<(sysroot)',
'asan%': 0,
'lsan%': 0,
'msan%': 0,
@ -161,6 +192,7 @@
'test_isolation_mode%': '<(test_isolation_mode)',
'fastbuild%': '<(fastbuild)',
'coverage%': '<(coverage)',
'sysroot%': '<(sysroot)',
# Add a simple extras solely for the purpose of the cctests
'v8_extra_library_files': ['../test/cctest/test-extra.js'],
@ -627,6 +659,18 @@
'-B<(base_dir)/third_party/binutils/Linux_x64/Release/bin',
],
}],
['sysroot!="" and clang==1', {
'target_conditions': [
['_toolset=="target"', {
'cflags': [
'--sysroot=<(sysroot)',
],
'ldflags': [
'--sysroot=<(sysroot)',
'<!(<(DEPTH)/build/linux/sysroot_ld_path.sh <(sysroot))',
],
}]]
}],
],
},
}],