@@ -10,6 +10,13 @@ pub(crate) fn build_backend(
10
10
let mut cmd = Command :: new ( "cargo" ) ;
11
11
cmd. arg ( "build" ) . arg ( "--target" ) . arg ( host_triple) ;
12
12
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
+
13
20
if use_unstable_features {
14
21
cmd. arg ( "--features" ) . arg ( "unstable-features" ) ;
15
22
}
@@ -22,25 +29,20 @@ pub(crate) fn build_backend(
22
29
_ => unreachable ! ( ) ,
23
30
}
24
31
32
+ // Set the rpath to make the cg_clif executable find librustc_codegen_cranelift without changing
33
+ // LD_LIBRARY_PATH
25
34
if cfg ! ( unix) {
26
35
if cfg ! ( target_os = "macos" ) {
27
- cmd. env (
28
- "RUSTFLAGS" ,
29
- "-Csplit-debuginfo=unpacked \
36
+ rustflags += " -Csplit-debuginfo=unpacked \
30
37
-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";
35
39
} 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 " ;
41
41
}
42
42
}
43
43
44
+ cmd. env ( "RUSTFLAGS" , rustflags) ;
45
+
44
46
eprintln ! ( "[BUILD] rustc_codegen_cranelift" ) ;
45
47
crate :: utils:: spawn_and_wait ( cmd) ;
46
48
0 commit comments