Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ matrix:
NO_LLVM_ASSERTIONS=1
NO_DEBUG_ASSERTIONS=1
os: osx
osx_image: xcode9.2
osx_image: xcode9.3-moar
if: branch = auto

- env: >
Expand All @@ -70,7 +70,7 @@ matrix:
NO_LLVM_ASSERTIONS=1
NO_DEBUG_ASSERTIONS=1
os: osx
osx_image: xcode9.2
osx_image: xcode9.3-moar
if: branch = auto

# OSX builders producing releases. These do not run the full test suite and
Expand Down
702 changes: 341 additions & 361 deletions src/Cargo.lock

Large diffs are not rendered by default.

6 changes: 4 additions & 2 deletions src/bootstrap/bin/rustc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ fn main() {
let rustc = env::var_os(rustc).unwrap_or_else(|| panic!("{:?} was not set", rustc));
let libdir = env::var_os(libdir).unwrap_or_else(|| panic!("{:?} was not set", libdir));
let mut dylib_path = bootstrap::util::dylib_path();
dylib_path.insert(0, PathBuf::from(libdir));
dylib_path.insert(0, PathBuf::from(&libdir));

let mut cmd = Command::new(rustc);
cmd.args(&args)
Expand All @@ -107,7 +107,7 @@ fn main() {
if let Some(target) = target {
// The stage0 compiler has a special sysroot distinct from what we
// actually downloaded, so we just always pass the `--sysroot` option.
cmd.arg("--sysroot").arg(sysroot);
cmd.arg("--sysroot").arg(&sysroot);

// When we build Rust dylibs they're all intended for intermediate
// usage, so make sure we pass the -Cprefer-dynamic flag instead of
Expand Down Expand Up @@ -280,6 +280,8 @@ fn main() {

if verbose > 1 {
eprintln!("rustc command: {:?}", cmd);
eprintln!("sysroot: {:?}", sysroot);
eprintln!("libdir: {:?}", libdir);
}

// Actually run the compiler!
Expand Down
26 changes: 6 additions & 20 deletions src/bootstrap/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,6 @@ pub trait Step: 'static + Clone + Debug + PartialEq + Eq + Hash {
/// Run this rule for all hosts without cross compiling.
const ONLY_HOSTS: bool = false;

/// Run this rule for all targets, but only with the native host.
const ONLY_BUILD_TARGETS: bool = false;

/// Only run this step with the build triple as host and target.
const ONLY_BUILD: bool = false;

/// Primary function to execute this rule. Can call `builder.ensure(...)`
/// with other steps to run those.
fn run(self, builder: &Builder) -> Self::Output;
Expand Down Expand Up @@ -101,8 +95,6 @@ pub struct RunConfig<'a> {
struct StepDescription {
default: bool,
only_hosts: bool,
only_build_targets: bool,
only_build: bool,
should_run: fn(ShouldRun) -> ShouldRun,
make_run: fn(RunConfig),
name: &'static str,
Expand Down Expand Up @@ -138,8 +130,6 @@ impl StepDescription {
StepDescription {
default: S::DEFAULT,
only_hosts: S::ONLY_HOSTS,
only_build_targets: S::ONLY_BUILD_TARGETS,
only_build: S::ONLY_BUILD,
should_run: S::should_run,
make_run: S::make_run,
name: unsafe { ::std::intrinsics::type_name::<S>() },
Expand All @@ -155,18 +145,12 @@ impl StepDescription {
self.name, builder.config.exclude);
}
let build = builder.build;
let hosts = if self.only_build_targets || self.only_build {
build.build_triple()
} else {
&build.hosts
};
let hosts = &build.hosts;

// Determine the targets participating in this rule.
let targets = if self.only_hosts {
if build.config.run_host_only {
&[]
} else if self.only_build {
build.build_triple()
if !build.config.run_host_only {
return; // don't run anything
} else {
&build.hosts
}
Expand Down Expand Up @@ -775,7 +759,9 @@ impl<'a> Builder<'a> {
// be resolved because MinGW has the import library. The downside is we
// don't get newer functions from Windows, but we don't use any of them
// anyway.
cargo.env("WINAPI_NO_BUNDLED_LIBRARIES", "1");
if mode != Mode::Tool {
cargo.env("WINAPI_NO_BUNDLED_LIBRARIES", "1");
}

if self.is_very_verbose() {
cargo.arg("-v");
Expand Down
6 changes: 4 additions & 2 deletions src/bootstrap/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ pub struct Config {
pub musl_root: Option<PathBuf>,
pub prefix: Option<PathBuf>,
pub sysconfdir: Option<PathBuf>,
pub datadir: Option<PathBuf>,
pub docdir: Option<PathBuf>,
pub bindir: Option<PathBuf>,
pub libdir: Option<PathBuf>,
Expand Down Expand Up @@ -212,13 +213,13 @@ struct Build {
struct Install {
prefix: Option<String>,
sysconfdir: Option<String>,
datadir: Option<String>,
docdir: Option<String>,
bindir: Option<String>,
libdir: Option<String>,
mandir: Option<String>,

// standard paths, currently unused
datadir: Option<String>,
infodir: Option<String>,
localstatedir: Option<String>,
}
Expand Down Expand Up @@ -347,7 +348,7 @@ impl Config {
config.keep_stage = flags.keep_stage;

// If --target was specified but --host wasn't specified, don't run any host-only tests.
config.run_host_only = flags.host.is_empty() && !flags.target.is_empty();
config.run_host_only = !(flags.host.is_empty() && !flags.target.is_empty());

let toml = file.map(|file| {
let mut f = t!(File::open(&file));
Expand Down Expand Up @@ -419,6 +420,7 @@ impl Config {
if let Some(ref install) = toml.install {
config.prefix = install.prefix.clone().map(PathBuf::from);
config.sysconfdir = install.sysconfdir.clone().map(PathBuf::from);
config.datadir = install.datadir.clone().map(PathBuf::from);
config.docdir = install.docdir.clone().map(PathBuf::from);
config.bindir = install.bindir.clone().map(PathBuf::from);
config.libdir = install.libdir.clone().map(PathBuf::from);
Expand Down
21 changes: 3 additions & 18 deletions src/bootstrap/dist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ pub struct Docs {
impl Step for Docs {
type Output = PathBuf;
const DEFAULT: bool = true;
const ONLY_BUILD_TARGETS: bool = true;

fn should_run(run: ShouldRun) -> ShouldRun {
run.path("src/doc")
Expand Down Expand Up @@ -271,7 +270,6 @@ pub struct Mingw {
impl Step for Mingw {
type Output = Option<PathBuf>;
const DEFAULT: bool = true;
const ONLY_BUILD_TARGETS: bool = true;

fn should_run(run: ShouldRun) -> ShouldRun {
run.never()
Expand Down Expand Up @@ -331,7 +329,6 @@ impl Step for Rustc {
type Output = PathBuf;
const DEFAULT: bool = true;
const ONLY_HOSTS: bool = true;
const ONLY_BUILD_TARGETS: bool = true;

fn should_run(run: ShouldRun) -> ShouldRun {
run.path("src/librustc")
Expand Down Expand Up @@ -561,15 +558,14 @@ pub struct Std {
impl Step for Std {
type Output = PathBuf;
const DEFAULT: bool = true;
const ONLY_BUILD_TARGETS: bool = true;

fn should_run(run: ShouldRun) -> ShouldRun {
run.path("src/libstd")
}

fn make_run(run: RunConfig) {
run.builder.ensure(Std {
compiler: run.builder.compiler(run.builder.top_stage, run.host),
compiler: run.builder.compiler(run.builder.top_stage, run.builder.build.build),
target: run.target,
});
}
Expand Down Expand Up @@ -638,7 +634,6 @@ pub struct Analysis {
impl Step for Analysis {
type Output = PathBuf;
const DEFAULT: bool = true;
const ONLY_BUILD_TARGETS: bool = true;

fn should_run(run: ShouldRun) -> ShouldRun {
let builder = run.builder;
Expand All @@ -647,7 +642,7 @@ impl Step for Analysis {

fn make_run(run: RunConfig) {
run.builder.ensure(Analysis {
compiler: run.builder.compiler(run.builder.top_stage, run.host),
compiler: run.builder.compiler(run.builder.top_stage, run.builder.build.build),
target: run.target,
});
}
Expand Down Expand Up @@ -755,8 +750,6 @@ impl Step for Src {
type Output = PathBuf;
const DEFAULT: bool = true;
const ONLY_HOSTS: bool = true;
const ONLY_BUILD_TARGETS: bool = true;
const ONLY_BUILD: bool = true;

fn should_run(run: ShouldRun) -> ShouldRun {
run.path("src")
Expand Down Expand Up @@ -851,8 +844,6 @@ impl Step for PlainSourceTarball {
type Output = PathBuf;
const DEFAULT: bool = true;
const ONLY_HOSTS: bool = true;
const ONLY_BUILD_TARGETS: bool = true;
const ONLY_BUILD: bool = true;

fn should_run(run: ShouldRun) -> ShouldRun {
let builder = run.builder;
Expand Down Expand Up @@ -1007,7 +998,6 @@ pub struct Cargo {

impl Step for Cargo {
type Output = PathBuf;
const ONLY_BUILD_TARGETS: bool = true;
const ONLY_HOSTS: bool = true;

fn should_run(run: ShouldRun) -> ShouldRun {
Expand Down Expand Up @@ -1095,7 +1085,6 @@ pub struct Rls {

impl Step for Rls {
type Output = Option<PathBuf>;
const ONLY_BUILD_TARGETS: bool = true;
const ONLY_HOSTS: bool = true;

fn should_run(run: ShouldRun) -> ShouldRun {
Expand Down Expand Up @@ -1177,7 +1166,6 @@ pub struct Rustfmt {

impl Step for Rustfmt {
type Output = Option<PathBuf>;
const ONLY_BUILD_TARGETS: bool = true;
const ONLY_HOSTS: bool = true;

fn should_run(run: ShouldRun) -> ShouldRun {
Expand Down Expand Up @@ -1263,7 +1251,6 @@ pub struct Extended {
impl Step for Extended {
type Output = ();
const DEFAULT: bool = true;
const ONLY_BUILD_TARGETS: bool = true;
const ONLY_HOSTS: bool = true;

fn should_run(run: ShouldRun) -> ShouldRun {
Expand All @@ -1274,7 +1261,7 @@ impl Step for Extended {
fn make_run(run: RunConfig) {
run.builder.ensure(Extended {
stage: run.builder.top_stage,
host: run.host,
host: run.builder.build.build,
target: run.target,
});
}
Expand Down Expand Up @@ -1692,9 +1679,7 @@ pub struct HashSign;

impl Step for HashSign {
type Output = ();
const ONLY_BUILD_TARGETS: bool = true;
const ONLY_HOSTS: bool = true;
const ONLY_BUILD: bool = true;

fn should_run(run: ShouldRun) -> ShouldRun {
run.path("hash-and-sign")
Expand Down
45 changes: 37 additions & 8 deletions src/bootstrap/install.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,18 +67,21 @@ fn install_sh(

let prefix_default = PathBuf::from("/usr/local");
let sysconfdir_default = PathBuf::from("/etc");
let docdir_default = PathBuf::from("share/doc/rust");
let datadir_default = PathBuf::from("share");
let docdir_default = datadir_default.join("doc/rust");
let bindir_default = PathBuf::from("bin");
let libdir_default = PathBuf::from("lib");
let mandir_default = PathBuf::from("share/man");
let mandir_default = datadir_default.join("man");
let prefix = build.config.prefix.as_ref().unwrap_or(&prefix_default);
let sysconfdir = build.config.sysconfdir.as_ref().unwrap_or(&sysconfdir_default);
let datadir = build.config.datadir.as_ref().unwrap_or(&datadir_default);
let docdir = build.config.docdir.as_ref().unwrap_or(&docdir_default);
let bindir = build.config.bindir.as_ref().unwrap_or(&bindir_default);
let libdir = build.config.libdir.as_ref().unwrap_or(&libdir_default);
let mandir = build.config.mandir.as_ref().unwrap_or(&mandir_default);

let sysconfdir = prefix.join(sysconfdir);
let datadir = prefix.join(datadir);
let docdir = prefix.join(docdir);
let bindir = prefix.join(bindir);
let libdir = prefix.join(libdir);
Expand All @@ -88,6 +91,7 @@ fn install_sh(

let prefix = add_destdir(&prefix, &destdir);
let sysconfdir = add_destdir(&sysconfdir, &destdir);
let datadir = add_destdir(&datadir, &destdir);
let docdir = add_destdir(&docdir, &destdir);
let bindir = add_destdir(&bindir, &destdir);
let libdir = add_destdir(&libdir, &destdir);
Expand All @@ -107,6 +111,7 @@ fn install_sh(
.arg(sanitize_sh(&tmpdir(build).join(&package_name).join("install.sh")))
.arg(format!("--prefix={}", sanitize_sh(&prefix)))
.arg(format!("--sysconfdir={}", sanitize_sh(&sysconfdir)))
.arg(format!("--datadir={}", sanitize_sh(&datadir)))
.arg(format!("--docdir={}", sanitize_sh(&docdir)))
.arg(format!("--bindir={}", sanitize_sh(&bindir)))
.arg(format!("--libdir={}", sanitize_sh(&libdir)))
Expand Down Expand Up @@ -161,7 +166,6 @@ macro_rules! install {
impl Step for $name {
type Output = ();
const DEFAULT: bool = true;
const ONLY_BUILD_TARGETS: bool = true;
const ONLY_HOSTS: bool = $only_hosts;
$(const $c: bool = true;)*

Expand All @@ -174,7 +178,7 @@ macro_rules! install {
run.builder.ensure($name {
stage: run.builder.top_stage,
target: run.target,
host: run.host,
host: run.builder.build.build,
});
}

Expand Down Expand Up @@ -226,14 +230,39 @@ install!((self, builder, _config),
});
install_analysis(builder, self.stage, self.target);
};
Src, "src", Self::should_build(_config) , only_hosts: true, {
builder.ensure(dist::Src);
install_src(builder, self.stage);
}, ONLY_BUILD;
Rustc, "src/librustc", true, only_hosts: true, {
builder.ensure(dist::Rustc {
compiler: builder.compiler(self.stage, self.target),
});
install_rustc(builder, self.stage, self.target);
};
);

#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub struct Src {
pub stage: u32,
}

impl Step for Src {
type Output = ();
const DEFAULT: bool = true;
const ONLY_HOSTS: bool = true;

fn should_run(run: ShouldRun) -> ShouldRun {
let config = &run.builder.config;
let cond = config.extended &&
config.tools.as_ref().map_or(true, |t| t.contains("src"));
run.path("src").default_condition(cond)
}

fn make_run(run: RunConfig) {
run.builder.ensure(Src {
stage: run.builder.top_stage,
});
}

fn run(self, builder: &Builder) {
builder.ensure(dist::Src);
install_src(builder, self.stage);
}
}
2 changes: 1 addition & 1 deletion src/bootstrap/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@
//! More documentation can be found in each respective module below, and you can
//! also check out the `src/bootstrap/README.md` file for more information.

//#![deny(warnings)]
#![deny(warnings)]
#![feature(core_intrinsics)]

#[macro_use]
Expand Down
Loading