Only deny warnings for cg_clif build itself

cc 
This commit is contained in:
bjorn3 2021-12-30 12:40:23 +01:00
parent 304a50b768
commit 6b4e640dcb
2 changed files with 14 additions and 15 deletions
.github/workflows
build_system

@ -4,9 +4,6 @@ on:
- push
- pull_request
env:
RUSTFLAGS: "-Dwarnings" # Deny warnings on CI
jobs:
rustfmt:
runs-on: ubuntu-latest

@ -10,6 +10,13 @@ pub(crate) fn build_backend(
let mut cmd = Command::new("cargo");
cmd.arg("build").arg("--target").arg(host_triple);
let mut rustflags = env::var("RUSTFLAGS").unwrap_or_default();
// Deny warnings on CI
if env::var("CI").as_ref().map(|val| &**val) == Ok("true") {
rustflags += " -Dwarnings";
}
if use_unstable_features {
cmd.arg("--features").arg("unstable-features");
}
@ -22,25 +29,20 @@ pub(crate) fn build_backend(
_ => unreachable!(),
}
// Set the rpath to make the cg_clif executable find librustc_codegen_cranelift without changing
// LD_LIBRARY_PATH
if cfg!(unix) {
if cfg!(target_os = "macos") {
cmd.env(
"RUSTFLAGS",
"-Csplit-debuginfo=unpacked \
rustflags += " -Csplit-debuginfo=unpacked \
-Clink-arg=-Wl,-rpath,@loader_path/../lib \
-Zosx-rpath-install-name"
.to_string()
+ env::var("RUSTFLAGS").as_deref().unwrap_or(""),
);
-Zosx-rpath-install-name";
} else {
cmd.env(
"RUSTFLAGS",
"-Clink-arg=-Wl,-rpath=$ORIGIN/../lib ".to_string()
+ env::var("RUSTFLAGS").as_deref().unwrap_or(""),
);
rustflags += " -Clink-arg=-Wl,-rpath=$ORIGIN/../lib ";
}
}
cmd.env("RUSTFLAGS", rustflags);
eprintln!("[BUILD] rustc_codegen_cranelift");
crate::utils::spawn_and_wait(cmd);