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 pub(crate) static CG_CLIF: CargoProject = CargoProject::new(&RelPath::SOURCE, "cg_clif");
10 pub(crate) fn build_backend(
13 bootstrap_host_compiler: &Compiler,
14 use_unstable_features: bool,
16 let mut cmd = CG_CLIF.build(&bootstrap_host_compiler, 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");
29 cmd.env("CARGO_PROFILE_RELEASE_DEBUG_ASSERTIONS", "true");
32 if use_unstable_features {
33 cmd.arg("--features").arg("unstable-features");
44 cmd.env("RUSTFLAGS", rustflags);
46 eprintln!("[BUILD] rustc_codegen_cranelift");
47 super::utils::spawn_and_wait(cmd);
51 .join(&bootstrap_host_compiler.triple)
53 .join(get_file_name("rustc_codegen_cranelift", "dylib"))