Commit 96415575 authored by sbc's avatar sbc Committed by Commit bot

Reland of Use sysroot by default for all linux builds (patchset #1 id:1 of...

Reland of Use sysroot by default for all linux builds (patchset #1 id:1 of https://codereview.chromium.org/1473363002/ )

Reason for revert:
Couldn't reproduce the failure.

Original issue's description:
> Revert of Use sysroot by default for all linux builds (patchset #7 id:120001 of https://codereview.chromium.org/1464983003/ )
>
> Reason for revert:
> Seems to have caused issues with goma: https://code.google.com/p/chromium/issues/detail?id=560973
>
> Original issue's description:
> > Use sysroot by default for all linux builds
> >
> > Using a sysroot was already the default for official
> > build and when cross compiling (e.g. arm, mips, x86-32).
> > This change makes it the default in all cases.
> >
> > The old behavior of building against local
> > system libraries can still be achieved by
> > setting use_sysroot=0
> >
> > BUG=504446
> >
> > Committed: https://crrev.com/a931efd5dc8d8783ce73a64fc641627866b6869d
> > Cr-Commit-Position: refs/heads/master@{#361197}
>
> TBR=dpranke@chromium.org,thestig@chromium.org,thakis@chromium.org
> NOPRESUBMIT=true
> NOTREECHECKS=true
> NOTRY=true
> BUG=504446
>
> Committed: https://crrev.com/05373dc078f0d5d3f2fb1398db9a4008a55d9016
> Cr-Commit-Position: refs/heads/master@{#361405}

TBR=dpranke@chromium.org,thestig@chromium.org,thakis@chromium.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=504446

Review URL: https://codereview.chromium.org/1472873004

Cr-Commit-Position: refs/heads/master@{#361411}
parent 74fbd561
......@@ -88,10 +88,11 @@
# Enable Wayland display server support.
'enable_wayland_server%' : 0,
# Build against pre-built sysroot image on linux. By default
# the sysroot image is only used for Official builds or when cross
# compiling.
'use_sysroot%': 0,
# 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,
# Override buildtype to select the desired build flavor.
# Dev - everyday build for development/testing
......@@ -294,8 +295,11 @@
'mips_arch_variant%': 'r1',
}],
# The system root for cross-compiles. Default: none.
['OS=="linux" and chromeos==0 and ((branding=="Chrome" and buildtype=="Official") or target_arch=="arm" or target_arch=="mipsel" or use_sysroot==1)', {
# The system root for linux compiles.
# Not used when chromecast=1 since ozone_platform_gbm doesn't
# currently build against the linux sysroot
# TODO(sbc): http://crbug.com/559708
['OS=="linux" and chromeos==0 and chromecast==0 and use_sysroot==1', {
# sysroot needs to be an absolute path otherwise it generates
# incorrect results when passed to pkg-config
'conditions': [
......
......@@ -11,6 +11,7 @@ declare_args() {
# The absolute path of the sysroot that is applied when compiling using
# the target toolchain.
target_sysroot = ""
use_sysroot = true
}
if (current_toolchain == default_toolchain && target_sysroot != "") {
......@@ -32,28 +33,23 @@ if (current_toolchain == default_toolchain && target_sysroot != "") {
} else {
sysroot = ""
}
} else if (is_linux && is_chrome_branded && is_official_build && !is_chromeos) {
# For official builds, use the sysroot checked into the internal source repo
# so that the builds work on older versions of Linux.
} else if (is_linux && !is_chromeos && use_sysroot) {
# By default build against a sysroot image downloaded from Cloud Storage
# during gclient runhooks.
if (current_cpu == "x64") {
sysroot = rebase_path("//build/linux/debian_wheezy_amd64-sysroot")
} else if (current_cpu == "x86") {
sysroot = rebase_path("//build/linux/debian_wheezy_i386-sysroot")
} else {
# Any other builds don't use a sysroot.
sysroot = ""
}
} else if (is_linux && !is_chromeos) {
if (current_cpu == "mipsel") {
sysroot = rebase_path("//mipsel-sysroot/sysroot")
} else if (current_cpu == "mipsel") {
sysroot = rebase_path("//build/linux/debian_wheezy_mips-sysroot")
} else if (current_cpu == "arm") {
sysroot = rebase_path("//build/linux/debian_wheezy_arm-sysroot")
} else {
# Any other builds don't use a sysroot.
sysroot = ""
}
} else if (is_mac) {
import("//build/config/mac/mac_sdk.gni")
sysroot = mac_sdk_path
} else if (is_ios) {
import("//build/config/ios/ios_sdk.gni")
......
......@@ -103,28 +103,6 @@ def DetectArch(gyp_defines, is_android):
return None
def UsingSysroot(target_arch, is_android, gyp_defines):
# ChromeOS uses a chroot, so doesn't need a sysroot
if gyp_defines.get('chromeos'):
return False
# When cross-compiling non-Android builds we always use a sysroot
if not is_android and target_arch in ('arm', 'mips', 'i386'):
return True
# Setting use_sysroot=1 GYP_DEFINES forces the use of the sysroot even
# when not cross compiling
if gyp_defines.get('use_sysroot'):
return True
# Official builds always use the sysroot.
if (gyp_defines.get('branding') == 'Chrome' and
gyp_defines.get('buildtype') == 'Official'):
return True
return False
def main():
if options.running_as_hook and not sys.platform.startswith('linux'):
return 0
......@@ -134,6 +112,10 @@ def main():
gyp_defines = gyp_chromium.GetGypVars(supplemental_includes)
is_android = gyp_defines.get('OS') == 'android'
if (options.running_as_hook and (not is_android) and
(gyp_defines.get('chromeos') or gyp_defines.get('use_sysroot') == '0')):
return 0
if options.arch:
target_arch = options.arch
else:
......@@ -142,10 +124,6 @@ def main():
print 'Unable to detect target architecture'
return 1
if (options.running_as_hook and
not UsingSysroot(target_arch, is_android, gyp_defines)):
return 0
if is_android:
# 32-bit Android builds require a 32-bit host sysroot for the v8 snapshot.
if '64' not in target_arch:
......
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