Merge branch 'master' into epel7

This commit is contained in:
Josh Stone 2018-02-19 21:38:18 -08:00
commit 7d2caa5f1a
3 changed files with 242 additions and 8 deletions

View File

@ -0,0 +1,159 @@
commit 6cf081c8c54e92702f350fa30d77561540324401 (from 6eff103aa1f93cbc07b1e5684e695635993c9752)
Merge: 6eff103aa1f9 472f4e1cc8c3
Author: bors <bors@rust-lang.org>
Date: Sat Jan 13 05:02:04 2018 +0000
Auto merge of #46592 - o01eg:fix-45345, r=alexcrichton
Fix 45345
There is a fix for https://github.com/rust-lang/rust/issues/45345
It re-introduces `CFG_LIBDIR_RELATIVE` which was broken when migration from `configure` script to `x.py`.
Other commits fix errors which happen after rustbuild cleanups.
diff --git a/src/bootstrap/bin/rustdoc.rs b/src/bootstrap/bin/rustdoc.rs
index 62037590853c..389b504c64cd 100644
--- a/src/bootstrap/bin/rustdoc.rs
+++ b/src/bootstrap/bin/rustdoc.rs
@@ -23,10 +23,17 @@ use std::path::PathBuf;
fn main() {
let args = env::args_os().skip(1).collect::<Vec<_>>();
let rustdoc = env::var_os("RUSTDOC_REAL").expect("RUSTDOC_REAL was not set");
- let libdir = env::var_os("RUSTC_LIBDIR").expect("RUSTC_LIBDIR was not set");
+ let libdir = env::var_os("RUSTDOC_LIBDIR").expect("RUSTDOC_LIBDIR was not set");
let stage = env::var("RUSTC_STAGE").expect("RUSTC_STAGE was not set");
let sysroot = env::var_os("RUSTC_SYSROOT").expect("RUSTC_SYSROOT was not set");
+ use std::str::FromStr;
+
+ let verbose = match env::var("RUSTC_VERBOSE") {
+ Ok(s) => usize::from_str(&s).expect("RUSTC_VERBOSE should be an integer"),
+ Err(_) => 0,
+ };
+
let mut dylib_path = bootstrap::util::dylib_path();
dylib_path.insert(0, PathBuf::from(libdir));
@@ -63,6 +70,10 @@ fn main() {
cmd.arg("--deny-render-differences");
}
+ if verbose > 1 {
+ eprintln!("rustdoc command: {:?}", cmd);
+ }
+
std::process::exit(match cmd.status() {
Ok(s) => s.code().unwrap_or(1),
Err(e) => panic!("\n\nfailed to run {:?}: {}\n\n", cmd, e),
diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs
index ce30d1f4cec4..a660b5cf852a 100644
--- a/src/bootstrap/builder.rs
+++ b/src/bootstrap/builder.rs
@@ -357,8 +357,8 @@ impl<'a> Builder<'a> {
fn run(self, builder: &Builder) -> Interned<PathBuf> {
let compiler = self.compiler;
- let lib = if compiler.stage >= 2 && builder.build.config.libdir_relative.is_some() {
- builder.build.config.libdir_relative.clone().unwrap()
+ let lib = if compiler.stage >= 1 && builder.build.config.libdir.is_some() {
+ builder.build.config.libdir.clone().unwrap()
} else {
PathBuf::from("lib")
};
@@ -416,7 +416,7 @@ impl<'a> Builder<'a> {
let compiler = self.compiler(self.top_stage, host);
cmd.env("RUSTC_STAGE", compiler.stage.to_string())
.env("RUSTC_SYSROOT", self.sysroot(compiler))
- .env("RUSTC_LIBDIR", self.sysroot_libdir(compiler, self.build.build))
+ .env("RUSTDOC_LIBDIR", self.sysroot_libdir(compiler, self.build.build))
.env("CFG_RELEASE_CHANNEL", &self.build.config.channel)
.env("RUSTDOC_REAL", self.rustdoc(host))
.env("RUSTDOC_CRATE_VERSION", self.build.rust_version())
@@ -496,6 +496,9 @@ impl<'a> Builder<'a> {
if let Some(target_linker) = self.build.linker(target) {
cargo.env("RUSTC_TARGET_LINKER", target_linker);
}
+ if cmd != "build" {
+ cargo.env("RUSTDOC_LIBDIR", self.rustc_libdir(self.compiler(2, self.build.build)));
+ }
if mode != Mode::Tool {
// Tools don't get debuginfo right now, e.g. cargo and rls don't
diff --git a/src/bootstrap/check.rs b/src/bootstrap/check.rs
index cc9be3cec347..ed110762cb3c 100644
--- a/src/bootstrap/check.rs
+++ b/src/bootstrap/check.rs
@@ -1166,7 +1166,7 @@ impl Step for Crate {
}
Mode::Librustc => {
builder.ensure(compile::Rustc { compiler, target });
- compile::rustc_cargo(build, &compiler, target, &mut cargo);
+ compile::rustc_cargo(build, target, &mut cargo);
("librustc", "rustc-main")
}
_ => panic!("can only test libraries"),
diff --git a/src/bootstrap/compile.rs b/src/bootstrap/compile.rs
index c8e500a4f68c..c6adfc7ffae4 100644
--- a/src/bootstrap/compile.rs
+++ b/src/bootstrap/compile.rs
@@ -485,7 +485,7 @@ impl Step for Rustc {
build.clear_if_dirty(&stage_out, &libtest_stamp(build, compiler, target));
let mut cargo = builder.cargo(compiler, Mode::Librustc, target, "build");
- rustc_cargo(build, &compiler, target, &mut cargo);
+ rustc_cargo(build, target, &mut cargo);
run_cargo(build,
&mut cargo,
&librustc_stamp(build, compiler, target));
@@ -500,7 +500,6 @@ impl Step for Rustc {
/// Same as `std_cargo`, but for libtest
pub fn rustc_cargo(build: &Build,
- compiler: &Compiler,
target: Interned<String>,
cargo: &mut Command) {
cargo.arg("--features").arg(build.rustc_features())
@@ -514,13 +513,9 @@ pub fn rustc_cargo(build: &Build,
.env("CFG_VERSION", build.rust_version())
.env("CFG_PREFIX", build.config.prefix.clone().unwrap_or_default());
- if compiler.stage == 0 {
- cargo.env("CFG_LIBDIR_RELATIVE", "lib");
- } else {
- let libdir_relative =
- build.config.libdir_relative.clone().unwrap_or(PathBuf::from("lib"));
- cargo.env("CFG_LIBDIR_RELATIVE", libdir_relative);
- }
+ let libdir_relative =
+ build.config.libdir.clone().unwrap_or(PathBuf::from("lib"));
+ cargo.env("CFG_LIBDIR_RELATIVE", libdir_relative);
// If we're not building a compiler with debugging information then remove
// these two env vars which would be set otherwise.
diff --git a/src/bootstrap/config.rs b/src/bootstrap/config.rs
index f3ffe9a27611..72e75fddc194 100644
--- a/src/bootstrap/config.rs
+++ b/src/bootstrap/config.rs
@@ -121,7 +121,6 @@ pub struct Config {
pub docdir: Option<PathBuf>,
pub bindir: Option<PathBuf>,
pub libdir: Option<PathBuf>,
- pub libdir_relative: Option<PathBuf>,
pub mandir: Option<PathBuf>,
pub codegen_tests: bool,
pub nodejs: Option<PathBuf>,
diff --git a/src/bootstrap/doc.rs b/src/bootstrap/doc.rs
index 832da24c994d..178d60dd7df7 100644
--- a/src/bootstrap/doc.rs
+++ b/src/bootstrap/doc.rs
@@ -616,7 +616,7 @@ impl Step for Rustc {
t!(symlink_dir_force(&my_out, &out_dir));
let mut cargo = builder.cargo(compiler, Mode::Librustc, target, "doc");
- compile::rustc_cargo(build, &compiler, target, &mut cargo);
+ compile::rustc_cargo(build, target, &mut cargo);
if build.config.compiler_docs {
// src/rustc/Cargo.toml contains a bin crate called rustc which

View File

@ -0,0 +1,64 @@
diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs
index 66a1c9724620..fcb78c479fa2 100644
--- a/src/bootstrap/builder.rs
+++ b/src/bootstrap/builder.rs
@@ -444,10 +444,11 @@ impl<'a> Builder<'a> {
fn run(self, builder: &Builder) -> Interned<PathBuf> {
let compiler = self.compiler;
- let lib = if compiler.stage >= 1 && builder.build.config.libdir.is_some() {
- builder.build.config.libdir.clone().unwrap()
+ let config = &builder.build.config;
+ let lib = if compiler.stage >= 1 && config.libdir_relative().is_some() {
+ builder.build.config.libdir_relative().unwrap()
} else {
- PathBuf::from("lib")
+ Path::new("lib")
};
let sysroot = builder.sysroot(self.compiler).join(lib)
.join("rustlib").join(self.target).join("lib");
diff --git a/src/bootstrap/compile.rs b/src/bootstrap/compile.rs
index 2dcc0e0e7cd9..c85b04ddc024 100644
--- a/src/bootstrap/compile.rs
+++ b/src/bootstrap/compile.rs
@@ -516,8 +516,7 @@ fn rustc_cargo_env(build: &Build, cargo: &mut Command) {
.env("CFG_VERSION", build.rust_version())
.env("CFG_PREFIX", build.config.prefix.clone().unwrap_or_default());
- let libdir_relative =
- build.config.libdir.clone().unwrap_or(PathBuf::from("lib"));
+ let libdir_relative = build.config.libdir_relative().unwrap_or(Path::new("lib"));
cargo.env("CFG_LIBDIR_RELATIVE", libdir_relative);
// If we're not building a compiler with debugging information then remove
diff --git a/src/bootstrap/config.rs b/src/bootstrap/config.rs
index 812ca6d64fb6..3cf8f36df25e 100644
--- a/src/bootstrap/config.rs
+++ b/src/bootstrap/config.rs
@@ -17,7 +17,7 @@ use std::collections::{HashMap, HashSet};
use std::env;
use std::fs::File;
use std::io::prelude::*;
-use std::path::PathBuf;
+use std::path::{Path, PathBuf};
use std::process;
use std::cmp;
@@ -564,6 +564,17 @@ impl Config {
config
}
+ /// Try to find the relative path of `libdir`.
+ pub fn libdir_relative(&self) -> Option<&Path> {
+ let libdir = self.libdir.as_ref()?;
+ if libdir.is_relative() {
+ Some(libdir)
+ } else {
+ // Try to make it relative to the prefix.
+ libdir.strip_prefix(self.prefix.as_ref()?).ok()
+ }
+ }
+
pub fn verbose(&self) -> bool {
self.verbose > 0
}

View File

@ -48,7 +48,7 @@
Name: rust
Version: 1.24.0
Release: 1%{?dist}
Release: 2%{?dist}
Summary: The Rust Programming Language
License: (ASL 2.0 or MIT) and (BSD and ISC and MIT)
# ^ written as: (rust itself) and (bundled libraries)
@ -78,6 +78,11 @@ Patch4: 0001-Ignore-run-pass-sse2-when-using-system-LLVM.patch
Patch5: 0001-Enable-stack-probe-tests-with-system-LLVM-5.0.patch
Patch6: 0002-Use-a-range-to-identify-SIGSEGV-in-stack-guards.patch
# fix for https://github.com/rust-lang/rust/issues/47469
# via https://github.com/rust-lang/rust/pull/46592
Patch7: rust-pr46592-bootstrap-libdir.patch
Patch8: rust-pr48362-libdir-relative.patch
Patch100: binaryen-cmake-aarch64.patch
# Get the Rust triple for any arch.
@ -313,6 +318,8 @@ popd
%patch4 -p1 -b .sse2
%patch5 -p1 -b .out-of-stack
%patch6 -p1 -b .out-of-stack
%patch7 -p1 -b .bootstrap-libdir
%patch8 -p1 -b .bootstrap-libdir-relative
%if "%{python}" == "python3"
sed -i.try-py3 -e '/try python2.7/i try python3 "$@"' ./configure
@ -374,10 +381,6 @@ find src/vendor -name .cargo-checksum.json \
%define enable_debuginfo --enable-debuginfo --disable-debuginfo-only-std --disable-debuginfo-lines
%endif
# NB: full bootstrap is needed because of a bug in local_rebuild:
# https://github.com/rust-lang/rust/issues/47469
# (should be fixed in rust-1.25)
%configure --disable-option-checking \
--libdir=%{common_libdir} \
--build=%{rust_triple} --host=%{rust_triple} --target=%{rust_triple} \
@ -388,7 +391,6 @@ find src/vendor -name .cargo-checksum.json \
--disable-rpath \
%{enable_debuginfo} \
--enable-vendor \
--enable-full-bootstrap \
--release-channel=%{channel}
%{python} ./x.py build
@ -419,8 +421,12 @@ find %{buildroot}%{_libdir} -maxdepth 1 -type f -name '*.so' \
# library loading if we keep them in libdir, but we do need them in rustlib/
# to support dynamic linking for compiler plugins, so we'll symlink.
(cd "%{buildroot}%{rustlibdir}/%{rust_triple}/lib" &&
find ../../../../%{_lib} -maxdepth 1 -name '*.so' \
-exec ln -v -f -s -t . '{}' '+')
find ../../../../%{_lib} -maxdepth 1 -name '*.so' |
while read lib; do
# make sure they're actually identical!
cmp "$lib" "${lib##*/}"
ln -v -f -s -t . "$lib"
done)
# Remove installer artifacts (manifests, uninstall scripts, etc.)
find %{buildroot}%{rustlibdir} -maxdepth 1 -type f -exec rm -v '{}' '+'
@ -515,6 +521,11 @@ rm -f %{buildroot}%{rustlibdir}/etc/lldb_*.py*
%changelog
* Mon Feb 19 2018 Josh Stone <jistone@redhat.com> - 1.24.0-2
- rhbz1546541: drop full-bootstrap; cmp libs before symlinking.
- Backport pr46592 to fix local_rebuild bootstrapping.
- Backport pr48362 to fix relative/absolute libdir.
* Thu Feb 15 2018 Josh Stone <jistone@redhat.com> - 1.24.0-1
- Update to 1.24.0.