Skip to content

Commit

Permalink
Only deny warnings for cg_clif build itself
Browse files Browse the repository at this point in the history
  • Loading branch information
bjorn3 committed Dec 30, 2021
1 parent 304a50b commit 6b4e640
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 15 deletions.
3 changes: 0 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@ on:
- push
- pull_request

env:
RUSTFLAGS: "-Dwarnings" # Deny warnings on CI

jobs:
rustfmt:
runs-on: ubuntu-latest
Expand Down
26 changes: 14 additions & 12 deletions build_system/build_backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}
Expand All @@ -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);

Expand Down

0 comments on commit 6b4e640

Please sign in to comment.