Skip to content

Commit 6b4e640

Browse files
committed
Only deny warnings for cg_clif build itself
cc #1213
1 parent 304a50b commit 6b4e640

File tree

2 files changed

+14
-15
lines changed

2 files changed

+14
-15
lines changed

Diff for: .github/workflows/main.yml

-3
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@ on:
44
- push
55
- pull_request
66

7-
env:
8-
RUSTFLAGS: "-Dwarnings" # Deny warnings on CI
9-
107
jobs:
118
rustfmt:
129
runs-on: ubuntu-latest

Diff for: build_system/build_backend.rs

+14-12
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,13 @@ pub(crate) fn build_backend(
1010
let mut cmd = Command::new("cargo");
1111
cmd.arg("build").arg("--target").arg(host_triple);
1212

13+
let mut rustflags = env::var("RUSTFLAGS").unwrap_or_default();
14+
15+
// Deny warnings on CI
16+
if env::var("CI").as_ref().map(|val| &**val) == Ok("true") {
17+
rustflags += " -Dwarnings";
18+
}
19+
1320
if use_unstable_features {
1421
cmd.arg("--features").arg("unstable-features");
1522
}
@@ -22,25 +29,20 @@ pub(crate) fn build_backend(
2229
_ => unreachable!(),
2330
}
2431

32+
// Set the rpath to make the cg_clif executable find librustc_codegen_cranelift without changing
33+
// LD_LIBRARY_PATH
2534
if cfg!(unix) {
2635
if cfg!(target_os = "macos") {
27-
cmd.env(
28-
"RUSTFLAGS",
29-
"-Csplit-debuginfo=unpacked \
36+
rustflags += " -Csplit-debuginfo=unpacked \
3037
-Clink-arg=-Wl,-rpath,@loader_path/../lib \
31-
-Zosx-rpath-install-name"
32-
.to_string()
33-
+ env::var("RUSTFLAGS").as_deref().unwrap_or(""),
34-
);
38+
-Zosx-rpath-install-name";
3539
} else {
36-
cmd.env(
37-
"RUSTFLAGS",
38-
"-Clink-arg=-Wl,-rpath=$ORIGIN/../lib ".to_string()
39-
+ env::var("RUSTFLAGS").as_deref().unwrap_or(""),
40-
);
40+
rustflags += " -Clink-arg=-Wl,-rpath=$ORIGIN/../lib ";
4141
}
4242
}
4343

44+
cmd.env("RUSTFLAGS", rustflags);
45+
4446
eprintln!("[BUILD] rustc_codegen_cranelift");
4547
crate::utils::spawn_and_wait(cmd);
4648

0 commit comments

Comments
 (0)