2 use std::path::PathBuf;
4 use super::path::{Dirs, RelPath};
5 use super::rustc_info::get_file_name;
6 use super::utils::{is_ci, CargoProject, Compiler};
8 static CG_CLIF: CargoProject = CargoProject::new(&RelPath::SOURCE, "cg_clif");
10 pub(crate) fn build_backend(
14 use_unstable_features: bool,
16 let mut cmd = CG_CLIF.build(&Compiler::host(), dirs);
18 cmd.env("CARGO_BUILD_INCREMENTAL", "true"); // Force incr comp even in release mode
20 let mut rustflags = env::var("RUSTFLAGS").unwrap_or_default();
23 // Deny warnings on CI
24 rustflags += " -Dwarnings";
26 // Disabling incr comp reduces cache size and incr comp doesn't save as much on CI anyway
27 cmd.env("CARGO_BUILD_INCREMENTAL", "false");
30 if use_unstable_features {
31 cmd.arg("--features").arg("unstable-features");
42 cmd.env("RUSTFLAGS", rustflags);
44 eprintln!("[BUILD] rustc_codegen_cranelift");
45 super::utils::spawn_and_wait(cmd);
51 .join(get_file_name("rustc_codegen_cranelift", "dylib"))