pub rustc_error_format: Option<String>,
pub json_output: bool,
pub test_compare_mode: bool,
- pub llvm_libunwind: Option<LlvmLibunwind>,
+ pub llvm_libunwind: LlvmLibunwind,
pub color: Color,
pub on_fail: Option<String>,
pub llvm_link_jobs: Option<u32>,
pub llvm_version_suffix: Option<String>,
pub llvm_use_linker: Option<String>,
- pub llvm_allow_old_toolchain: Option<bool>,
- pub llvm_polly: Option<bool>,
+ pub llvm_allow_old_toolchain: bool,
+ pub llvm_polly: bool,
pub llvm_from_ci: bool,
pub use_lld: bool,
// dist misc
pub dist_sign_folder: Option<PathBuf>,
pub dist_upload_addr: Option<String>,
- pub dist_gpg_password_file: Option<PathBuf>,
pub dist_compression_formats: Option<Vec<String>>,
// libstd features
libdir: Option<String>,
mandir: Option<String>,
datadir: Option<String>,
-
- // standard paths, currently unused
- infodir: Option<String>,
- localstatedir: Option<String>,
}
/// TOML representation of how the LLVM build is configured.
new_symbol_mangling: Option<bool>,
profile_generate: Option<String>,
profile_use: Option<String>,
- download_rustc: Option<bool>,
+ // ignored; this is set from an env var set by bootstrap.py
+ download_rustc: Option<StringOrBool>,
}
/// TOML representation of how each build target is configured.
config.rust_rpath = true;
config.channel = "dev".to_string();
config.codegen_tests = true;
- config.ignore_git = false;
config.rust_dist_src = true;
config.rust_codegen_backends = vec![INTERNER.intern_str("llvm")];
config.deny_warnings = true;
- config.missing_tools = false;
+ config.bindir = "bin".into();
// set by build.rs
config.build = TargetSelection::from_user(&env!("BUILD_TRIPLE"));
config.dry_run = flags.dry_run;
config.keep_stage = flags.keep_stage;
config.keep_stage_std = flags.keep_stage_std;
- config.bindir = "bin".into(); // default
config.color = flags.color;
if let Some(value) = flags.deny_warnings {
config.deny_warnings = value;
set(&mut config.print_step_timings, build.print_step_timings);
set(&mut config.print_step_rusage, build.print_step_rusage);
- // See https://github.com/rust-lang/compiler-team/issues/326
- config.stage = match config.cmd {
- Subcommand::Check { .. } => flags.stage.or(build.check_stage).unwrap_or(0),
- Subcommand::Doc { .. } => flags.stage.or(build.doc_stage).unwrap_or(0),
- Subcommand::Build { .. } => flags.stage.or(build.build_stage).unwrap_or(1),
- Subcommand::Test { .. } => flags.stage.or(build.test_stage).unwrap_or(1),
- Subcommand::Bench { .. } => flags.stage.or(build.bench_stage).unwrap_or(2),
- Subcommand::Dist { .. } => flags.stage.or(build.dist_stage).unwrap_or(2),
- Subcommand::Install { .. } => flags.stage.or(build.install_stage).unwrap_or(2),
- // These are all bootstrap tools, which don't depend on the compiler.
- // The stage we pass shouldn't matter, but use 0 just in case.
- Subcommand::Clean { .. }
- | Subcommand::Clippy { .. }
- | Subcommand::Fix { .. }
- | Subcommand::Run { .. }
- | Subcommand::Setup { .. }
- | Subcommand::Format { .. } => flags.stage.unwrap_or(0),
- };
-
- // CI should always run stage 2 builds, unless it specifically states otherwise
- #[cfg(not(test))]
- if flags.stage.is_none() && crate::CiEnv::current() != crate::CiEnv::None {
- match config.cmd {
- Subcommand::Test { .. }
- | Subcommand::Doc { .. }
- | Subcommand::Build { .. }
- | Subcommand::Bench { .. }
- | Subcommand::Dist { .. }
- | Subcommand::Install { .. } => {
- assert_eq!(
- config.stage, 2,
- "x.py should be run with `--stage 2` on CI, but was run with `--stage {}`",
- config.stage,
- );
- }
- Subcommand::Clean { .. }
- | Subcommand::Check { .. }
- | Subcommand::Clippy { .. }
- | Subcommand::Fix { .. }
- | Subcommand::Run { .. }
- | Subcommand::Setup { .. }
- | Subcommand::Format { .. } => {}
- }
- }
-
config.verbose = cmp::max(config.verbose, flags.verbose);
if let Some(install) = toml.install {
config.llvm_ldflags = llvm.ldflags.clone();
set(&mut config.llvm_use_libcxx, llvm.use_libcxx);
config.llvm_use_linker = llvm.use_linker.clone();
- config.llvm_allow_old_toolchain = llvm.allow_old_toolchain;
- config.llvm_polly = llvm.polly;
+ config.llvm_allow_old_toolchain = llvm.allow_old_toolchain.unwrap_or(false);
+ config.llvm_polly = llvm.polly.unwrap_or(false);
config.llvm_from_ci = match llvm.download_ci_llvm {
Some(StringOrBool::String(s)) => {
assert!(s == "if-available", "unknown option `{}` for download-ci-llvm", s);
- config.build.triple == "x86_64-unknown-linux-gnu"
+ // This is currently all tier 1 targets (since others may not have CI artifacts)
+ // https://doc.rust-lang.org/rustc/platform-support.html#tier-1
+ // FIXME: this is duplicated in bootstrap.py
+ let supported_platforms = [
+ "aarch64-unknown-linux-gnu",
+ "i686-pc-windows-gnu",
+ "i686-pc-windows-msvc",
+ "i686-unknown-linux-gnu",
+ "x86_64-unknown-linux-gnu",
+ "x86_64-apple-darwin",
+ "x86_64-pc-windows-gnu",
+ "x86_64-pc-windows-msvc",
+ ];
+ supported_platforms.contains(&&*config.build.triple)
}
Some(StringOrBool::Bool(b)) => b,
None => false,
check_ci_llvm!(llvm.targets);
check_ci_llvm!(llvm.experimental_targets);
check_ci_llvm!(llvm.link_jobs);
- check_ci_llvm!(llvm.link_shared);
check_ci_llvm!(llvm.clang_cl);
check_ci_llvm!(llvm.version_suffix);
check_ci_llvm!(llvm.cflags);
// If we're building with ThinLTO on, we want to link to LLVM
// shared, to avoid re-doing ThinLTO (which happens in the link
// step) with each stage.
+ assert_ne!(
+ llvm.link_shared,
+ Some(false),
+ "setting link-shared=false is incompatible with thin-lto=true"
+ );
config.llvm_link_shared = true;
}
}
set(&mut config.test_compare_mode, rust.test_compare_mode);
config.llvm_libunwind = rust
.llvm_libunwind
- .map(|v| v.parse().expect("failed to parse rust.llvm-libunwind"));
+ .map(|v| v.parse().expect("failed to parse rust.llvm-libunwind"))
+ .unwrap_or_default();
set(&mut config.backtrace, rust.backtrace);
set(&mut config.channel, rust.channel);
config.description = rust.description;
config.rust_codegen_units_std = rust.codegen_units_std.map(threads_from_config);
config.rust_profile_use = flags.rust_profile_use.or(rust.profile_use);
config.rust_profile_generate = flags.rust_profile_generate.or(rust.profile_generate);
- config.download_rustc = rust.download_rustc.unwrap_or(false);
+ config.download_rustc = env::var("BOOTSTRAP_DOWNLOAD_RUSTC").as_deref() == Ok("1");
} else {
config.rust_profile_use = flags.rust_profile_use;
config.rust_profile_generate = flags.rust_profile_generate;
if let Some(t) = toml.dist {
config.dist_sign_folder = t.sign_folder.map(PathBuf::from);
- config.dist_gpg_password_file = t.gpg_password_file.map(PathBuf::from);
config.dist_upload_addr = t.upload_addr;
config.dist_compression_formats = t.compression_formats;
set(&mut config.rust_dist_src, t.src_tarball);
// default values for all options that we haven't otherwise stored yet.
config.llvm_skip_rebuild = llvm_skip_rebuild.unwrap_or(false);
-
- let default = false;
- config.llvm_assertions = llvm_assertions.unwrap_or(default);
-
- let default = true;
- config.rust_optimize = optimize.unwrap_or(default);
+ config.llvm_assertions = llvm_assertions.unwrap_or(false);
+ config.rust_optimize = optimize.unwrap_or(true);
let default = debug == Some(true);
config.rust_debug_assertions = debug_assertions.unwrap_or(default);
let default = config.channel == "dev";
config.ignore_git = ignore_git.unwrap_or(default);
+ let download_rustc = config.download_rustc;
+ // See https://github.com/rust-lang/compiler-team/issues/326
+ config.stage = match config.cmd {
+ Subcommand::Check { .. } => flags.stage.or(build.check_stage).unwrap_or(0),
+ // `download-rustc` only has a speed-up for stage2 builds. Default to stage2 unless explicitly overridden.
+ Subcommand::Doc { .. } => {
+ flags.stage.or(build.doc_stage).unwrap_or(if download_rustc { 2 } else { 0 })
+ }
+ Subcommand::Build { .. } => {
+ flags.stage.or(build.build_stage).unwrap_or(if download_rustc { 2 } else { 1 })
+ }
+ Subcommand::Test { .. } => {
+ flags.stage.or(build.test_stage).unwrap_or(if download_rustc { 2 } else { 1 })
+ }
+ Subcommand::Bench { .. } => flags.stage.or(build.bench_stage).unwrap_or(2),
+ Subcommand::Dist { .. } => flags.stage.or(build.dist_stage).unwrap_or(2),
+ Subcommand::Install { .. } => flags.stage.or(build.install_stage).unwrap_or(2),
+ // These are all bootstrap tools, which don't depend on the compiler.
+ // The stage we pass shouldn't matter, but use 0 just in case.
+ Subcommand::Clean { .. }
+ | Subcommand::Clippy { .. }
+ | Subcommand::Fix { .. }
+ | Subcommand::Run { .. }
+ | Subcommand::Setup { .. }
+ | Subcommand::Format { .. } => flags.stage.unwrap_or(0),
+ };
+
+ // CI should always run stage 2 builds, unless it specifically states otherwise
+ #[cfg(not(test))]
+ if flags.stage.is_none() && crate::CiEnv::current() != crate::CiEnv::None {
+ match config.cmd {
+ Subcommand::Test { .. }
+ | Subcommand::Doc { .. }
+ | Subcommand::Build { .. }
+ | Subcommand::Bench { .. }
+ | Subcommand::Dist { .. }
+ | Subcommand::Install { .. } => {
+ assert_eq!(
+ config.stage, 2,
+ "x.py should be run with `--stage 2` on CI, but was run with `--stage {}`",
+ config.stage,
+ );
+ }
+ Subcommand::Clean { .. }
+ | Subcommand::Check { .. }
+ | Subcommand::Clippy { .. }
+ | Subcommand::Fix { .. }
+ | Subcommand::Run { .. }
+ | Subcommand::Setup { .. }
+ | Subcommand::Format { .. } => {}
+ }
+ }
+
config
}