Skip to content

Commit 45fba43

Browse files
committed
Auto merge of #48113 - kennytm:rollup, r=kennytm
Rollup of 20 pull requests - Successful merges: #47790, #47835, #47854, #48015, #48047, #48051, #48058, #48059, #48064, #48078, #48080, #48086, #48098, #48101, #48107, #48100, #48085, #48120, #48124, #47547 - Failed merges:
2 parents 39abcc0 + 4a82718 commit 45fba43

File tree

55 files changed

+399
-534
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+399
-534
lines changed

config.toml.example

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,10 @@
151151
# default.
152152
#extended = false
153153

154+
# Installs choosen set of extended tools if enables. By default builds all.
155+
# If choosen tool failed to build the installation fails.
156+
#tools = ["cargo", "rls", "rustfmt", "analysis", "src"]
157+
154158
# Verbosity level: 0 == not verbose, 1 == verbose, 2 == very verbose
155159
#verbose = 0
156160

src/bootstrap/builder.rs

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -570,7 +570,7 @@ impl<'a> Builder<'a> {
570570
// build scripts in that situation.
571571
//
572572
// If LLVM support is disabled we need to use the snapshot compiler to compile
573-
// build scripts, as the new compiler doesnt support executables.
573+
// build scripts, as the new compiler doesn't support executables.
574574
if mode == Mode::Libstd || !self.build.config.llvm_enabled {
575575
cargo.env("RUSTC_SNAPSHOT", &self.initial_rustc)
576576
.env("RUSTC_SNAPSHOT_LIBDIR", self.rustc_snapshot_libdir());
@@ -600,9 +600,25 @@ impl<'a> Builder<'a> {
600600
//
601601
// FIXME: the guard against msvc shouldn't need to be here
602602
if !target.contains("msvc") {
603-
let cc = self.cc(target);
604-
cargo.env(format!("CC_{}", target), cc)
605-
.env("CC", cc);
603+
let ccache = self.config.ccache.as_ref();
604+
let ccacheify = |s: &Path| {
605+
let ccache = match ccache {
606+
Some(ref s) => s,
607+
None => return s.display().to_string(),
608+
};
609+
// FIXME: the cc-rs crate only recognizes the literal strings
610+
// `ccache` and `sccache` when doing caching compilations, so we
611+
// mirror that here. It should probably be fixed upstream to
612+
// accept a new env var or otherwise work with custom ccache
613+
// vars.
614+
match &ccache[..] {
615+
"ccache" | "sccache" => format!("{} {}", ccache, s.display()),
616+
_ => s.display().to_string(),
617+
}
618+
};
619+
let cc = ccacheify(&self.cc(target));
620+
cargo.env(format!("CC_{}", target), &cc)
621+
.env("CC", &cc);
606622

607623
let cflags = self.cflags(target).join(" ");
608624
cargo.env(format!("CFLAGS_{}", target), cflags.clone())
@@ -617,8 +633,9 @@ impl<'a> Builder<'a> {
617633
}
618634

619635
if let Ok(cxx) = self.cxx(target) {
620-
cargo.env(format!("CXX_{}", target), cxx)
621-
.env("CXX", cxx)
636+
let cxx = ccacheify(&cxx);
637+
cargo.env(format!("CXX_{}", target), &cxx)
638+
.env("CXX", &cxx)
622639
.env(format!("CXXFLAGS_{}", target), cflags.clone())
623640
.env("CXXFLAGS", cflags);
624641
}

src/bootstrap/config.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
//! This module implements parsing `config.toml` configuration files to tweak
1414
//! how the build runs.
1515
16-
use std::collections::HashMap;
16+
use std::collections::{HashMap, HashSet};
1717
use std::env;
1818
use std::fs::File;
1919
use std::io::prelude::*;
@@ -52,6 +52,7 @@ pub struct Config {
5252
pub target_config: HashMap<Interned<String>, Target>,
5353
pub full_bootstrap: bool,
5454
pub extended: bool,
55+
pub tools: Option<HashSet<String>>,
5556
pub sanitizers: bool,
5657
pub profiler: bool,
5758
pub ignore_git: bool,
@@ -191,6 +192,7 @@ struct Build {
191192
python: Option<String>,
192193
full_bootstrap: Option<bool>,
193194
extended: Option<bool>,
195+
tools: Option<HashSet<String>>,
194196
verbose: Option<usize>,
195197
sanitizers: Option<bool>,
196198
profiler: Option<bool>,
@@ -395,6 +397,7 @@ impl Config {
395397
set(&mut config.vendor, build.vendor);
396398
set(&mut config.full_bootstrap, build.full_bootstrap);
397399
set(&mut config.extended, build.extended);
400+
config.tools = build.tools;
398401
set(&mut config.verbose, build.verbose);
399402
set(&mut config.sanitizers, build.sanitizers);
400403
set(&mut config.profiler, build.profiler);

src/bootstrap/configure.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ def v(*args):
144144
o("full-bootstrap", "build.full-bootstrap", "build three compilers instead of two")
145145
o("extended", "build.extended", "build an extended rust tool set")
146146

147+
v("tools", "build.tools", "List of extended tools will be installed")
147148
v("build", "build.build", "GNUs ./configure syntax LLVM build triple")
148149
v("host", None, "GNUs ./configure syntax LLVM host triples")
149150
v("target", None, "GNUs ./configure syntax LLVM target triples")

src/bootstrap/dist.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ use channel;
3131
use util::{cp_r, libdir, is_dylib, cp_filtered, copy, replace_in_file};
3232
use builder::{Builder, RunConfig, ShouldRun, Step};
3333
use compile;
34+
use native;
3435
use tool::{self, Tool};
3536
use cache::{INTERNER, Interned};
3637
use time;
@@ -898,6 +899,12 @@ impl Step for PlainSourceTarball {
898899
.arg("--vers").arg(CARGO_VENDOR_VERSION)
899900
.arg("cargo-vendor")
900901
.env("RUSTC", &build.initial_rustc);
902+
if let Some(dir) = build.openssl_install_dir(build.config.build) {
903+
builder.ensure(native::Openssl {
904+
target: build.config.build,
905+
});
906+
cmd.env("OPENSSL_DIR", dir);
907+
}
901908
build.run(&mut cmd);
902909
}
903910

src/bootstrap/install.rs

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ use dist::{self, pkgname, sanitize_sh, tmpdir};
2222

2323
use builder::{Builder, RunConfig, ShouldRun, Step};
2424
use cache::Interned;
25+
use config::Config;
2526

2627
pub fn install_docs(builder: &Builder, stage: u32, host: Interned<String>) {
2728
install_sh(builder, "docs", "rust-docs", stage, Some(host));
@@ -144,6 +145,19 @@ macro_rules! install {
144145
pub host: Interned<String>,
145146
}
146147

148+
impl $name {
149+
#[allow(dead_code)]
150+
fn should_build(config: &Config) -> bool {
151+
config.extended && config.tools.as_ref()
152+
.map_or(true, |t| t.contains($path))
153+
}
154+
155+
#[allow(dead_code)]
156+
fn should_install(builder: &Builder) -> bool {
157+
builder.config.tools.as_ref().map_or(false, |t| t.contains($path))
158+
}
159+
}
160+
147161
impl Step for $name {
148162
type Output = ();
149163
const DEFAULT: bool = true;
@@ -185,32 +199,34 @@ install!((self, builder, _config),
185199
install_std(builder, self.stage, *target);
186200
}
187201
};
188-
Cargo, "cargo", _config.extended, only_hosts: true, {
202+
Cargo, "cargo", Self::should_build(_config), only_hosts: true, {
189203
builder.ensure(dist::Cargo { stage: self.stage, target: self.target });
190204
install_cargo(builder, self.stage, self.target);
191205
};
192-
Rls, "rls", _config.extended, only_hosts: true, {
193-
if builder.ensure(dist::Rls { stage: self.stage, target: self.target }).is_some() {
206+
Rls, "rls", Self::should_build(_config), only_hosts: true, {
207+
if builder.ensure(dist::Rls { stage: self.stage, target: self.target }).is_some() ||
208+
Self::should_install(builder) {
194209
install_rls(builder, self.stage, self.target);
195210
} else {
196211
println!("skipping Install RLS stage{} ({})", self.stage, self.target);
197212
}
198213
};
199-
Rustfmt, "rustfmt", _config.extended, only_hosts: true, {
200-
if builder.ensure(dist::Rustfmt { stage: self.stage, target: self.target }).is_some() {
214+
Rustfmt, "rustfmt", Self::should_build(_config), only_hosts: true, {
215+
if builder.ensure(dist::Rustfmt { stage: self.stage, target: self.target }).is_some() ||
216+
Self::should_install(builder) {
201217
install_rustfmt(builder, self.stage, self.target);
202218
} else {
203219
println!("skipping Install Rustfmt stage{} ({})", self.stage, self.target);
204220
}
205221
};
206-
Analysis, "analysis", _config.extended, only_hosts: false, {
222+
Analysis, "analysis", Self::should_build(_config), only_hosts: false, {
207223
builder.ensure(dist::Analysis {
208224
compiler: builder.compiler(self.stage, self.host),
209225
target: self.target
210226
});
211227
install_analysis(builder, self.stage, self.target);
212228
};
213-
Src, "src", _config.extended, only_hosts: true, {
229+
Src, "src", Self::should_build(_config) , only_hosts: true, {
214230
builder.ensure(dist::Src);
215231
install_src(builder, self.stage);
216232
}, ONLY_BUILD;

src/bootstrap/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -666,7 +666,7 @@ impl Build {
666666
}
667667
}
668668

669-
/// Returns the path to the linker for the given target if it needs to be overriden.
669+
/// Returns the path to the linker for the given target if it needs to be overridden.
670670
fn linker(&self, target: Interned<String>) -> Option<&Path> {
671671
if let Some(linker) = self.config.target_config.get(&target)
672672
.and_then(|c| c.linker.as_ref()) {

src/bootstrap/test.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -902,7 +902,7 @@ impl Step for Compiletest {
902902
}
903903
}
904904
if suite == "run-make" && !build.config.llvm_enabled {
905-
println!("Ignoring run-make test suite as they generally dont work without LLVM");
905+
println!("Ignoring run-make test suite as they generally don't work without LLVM");
906906
return;
907907
}
908908

src/ci/docker/dist-i686-linux/Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,8 @@ ENV RUST_CONFIGURE_ARGS \
8686
--enable-extended \
8787
--enable-sanitizers \
8888
--enable-profiler \
89-
--enable-emscripten
89+
--enable-emscripten \
90+
--build=i686-unknown-linux-gnu
9091
ENV SCRIPT python2.7 ../x.py dist --host $HOSTS --target $HOSTS
9192

9293
# This is the only builder which will create source tarballs

0 commit comments

Comments
 (0)