Commit c4fab3ec authored by machenbach's avatar machenbach Committed by Commit bot

[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

Committed: https://crrev.com/c47d3c63695d2999752f5fc61ff171f3ff100553
Review-Url: https://codereview.chromium.org/2028623002
Cr-Original-Commit-Position: refs/heads/master@{#36729}
Cr-Commit-Position: refs/heads/master@{#36830}
parent 2822d2df
...@@ -191,6 +191,18 @@ hooks = [ ...@@ -191,6 +191,18 @@ hooks = [
"-s", "v8/buildtools/linux64/gn.sha1", "-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. # Update the Windows toolchain if necessary.
'name': 'win_toolchain', 'name': 'win_toolchain',
......
...@@ -49,35 +49,70 @@ ...@@ -49,35 +49,70 @@
'variables': { 'variables': {
'variables': { 'variables': {
'variables': { 'variables': {
'conditions': [ 'variables': {
['OS=="linux" or OS=="freebsd" or OS=="openbsd" or \ 'conditions': [
OS=="netbsd" or OS=="mac" or OS=="qnx" or OS=="aix"', { ['OS=="linux" or OS=="freebsd" or OS=="openbsd" or \
# This handles the Unix platforms we generally deal with. OS=="netbsd" or OS=="mac" or OS=="qnx" or OS=="aix"', {
# Anything else gets passed through, which probably won't work # This handles the Unix platforms we generally deal with.
# very well; such hosts should pass an explicit target_arch # Anything else gets passed through, which probably won't work
# to gyp. # very well; such hosts should pass an explicit target_arch
'host_arch%': '<!pymod_do_main(detect_v8_host_arch)', # to gyp.
}, { 'host_arch%': '<!pymod_do_main(detect_v8_host_arch)',
# OS!="linux" and OS!="freebsd" and OS!="openbsd" and }, {
# OS!="netbsd" and OS!="mac" and OS!="aix" # OS!="linux" and OS!="freebsd" and OS!="openbsd" and
'host_arch%': 'ia32', # OS!="netbsd" and OS!="mac" and OS!="aix"
}], 'host_arch%': 'ia32',
], }],
],
},
'host_arch%': '<(host_arch)',
'target_arch%': '<(host_arch)',
# 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)', 'host_arch%': '<(host_arch)',
'target_arch%': '<(host_arch)', 'target_arch%': '<(target_arch)',
'use_sysroot%': '<(use_sysroot)',
'base_dir%': '<!(cd <(DEPTH) && python -c "import os; print os.getcwd()")', 'base_dir%': '<!(cd <(DEPTH) && python -c "import os; print os.getcwd()")',
# Instrument for code coverage and use coverage wrapper to exclude some # Instrument for code coverage and use coverage wrapper to exclude some
# files. Uses gcov if clang=0 is set explicitly. Otherwise, # files. Uses gcov if clang=0 is set explicitly. Otherwise,
# sanitizer_coverage must be set too. # sanitizer_coverage must be set too.
'coverage%': 0, '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)', 'base_dir%': '<(base_dir)',
'host_arch%': '<(host_arch)', 'host_arch%': '<(host_arch)',
'target_arch%': '<(target_arch)', 'target_arch%': '<(target_arch)',
'v8_target_arch%': '<(target_arch)', 'v8_target_arch%': '<(target_arch)',
'coverage%': '<(coverage)', 'coverage%': '<(coverage)',
'sysroot%': '<(sysroot)',
'asan%': 0, 'asan%': 0,
'lsan%': 0, 'lsan%': 0,
'msan%': 0, 'msan%': 0,
...@@ -161,6 +196,7 @@ ...@@ -161,6 +196,7 @@
'test_isolation_mode%': '<(test_isolation_mode)', 'test_isolation_mode%': '<(test_isolation_mode)',
'fastbuild%': '<(fastbuild)', 'fastbuild%': '<(fastbuild)',
'coverage%': '<(coverage)', 'coverage%': '<(coverage)',
'sysroot%': '<(sysroot)',
# Add a simple extras solely for the purpose of the cctests # Add a simple extras solely for the purpose of the cctests
'v8_extra_library_files': ['../test/cctest/test-extra.js'], 'v8_extra_library_files': ['../test/cctest/test-extra.js'],
...@@ -631,6 +667,18 @@ ...@@ -631,6 +667,18 @@
'-B<(base_dir)/third_party/binutils/Linux_x64/Release/bin', '-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))',
],
}]]
}],
], ],
}, },
}], }],
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment