rust-lang/cargo#10395 made it possible to apply RUSTFLAGS to build scripts and proc-macros. Bootstrap currently special-cases this in fake rustc:
|
// FIXME(rust-lang/cargo#5754) we shouldn't be using special env vars |
|
// here, but rather Cargo should know what flags to pass rustc itself. |
|
|
|
// Override linker if necessary. |
|
if let Ok(host_linker) = env::var("RUSTC_HOST_LINKER") { |
|
cmd.arg(format!("-Clinker={}", host_linker)); |
|
} |
|
if env::var_os("RUSTC_HOST_FUSE_LD_LLD").is_some() { |
|
cmd.arg("-Clink-args=-fuse-ld=lld"); |
|
} |
|
|
|
if let Ok(s) = env::var("RUSTC_HOST_CRT_STATIC") { |
|
if s == "true" { |
|
cmd.arg("-C").arg("target-feature=+crt-static"); |
|
} |
|
if s == "false" { |
|
cmd.arg("-C").arg("target-feature=-crt-static"); |
|
} |
|
} |
|
|
|
if stage == "0" { |
|
// Cargo doesn't pass RUSTFLAGS to proc_macros: |
|
// https://github.com/rust-lang/cargo/issues/4423 |
|
// Set `--cfg=bootstrap` explicitly instead. |
|
cmd.arg("--cfg=bootstrap"); |
|
} |
We should switch to using
-Ztarget-applies-to-host=true on the next cargo update.
cc
@Mark-Simulacrum @ehuss @jonhoo (thank you again
@jonhoo for fixing this! ❤️)
@rustbot label: +A-rustbuild +C-enhancement
rust-lang/cargo#10395 made it possible to apply RUSTFLAGS to build scripts and proc-macros. Bootstrap currently special-cases this in fake rustc:
rust/src/bootstrap/bin/rustc.rs
Lines 110 to 135 in 06460fe
We should switch to using
-Ztarget-applies-to-host=trueon the next cargo update.cc @Mark-Simulacrum @ehuss @jonhoo (thank you again @jonhoo for fixing this! ❤️)
@rustbot label: +A-rustbuild +C-enhancement