2 use std::path::PathBuf;
4 use super::rustc_info::get_file_name;
5 use super::utils::{cargo_command, is_ci};
7 pub(crate) fn build_backend(
10 use_unstable_features: bool,
12 let source_dir = std::env::current_dir().unwrap();
13 let mut cmd = cargo_command("cargo", "build", Some(host_triple), &source_dir);
15 cmd.env("CARGO_BUILD_INCREMENTAL", "true"); // Force incr comp even in release mode
17 let mut rustflags = env::var("RUSTFLAGS").unwrap_or_default();
20 // Deny warnings on CI
21 rustflags += " -Dwarnings";
23 // Disabling incr comp reduces cache size and incr comp doesn't save as much on CI anyway
24 cmd.env("CARGO_BUILD_INCREMENTAL", "false");
27 if use_unstable_features {
28 cmd.arg("--features").arg("unstable-features");
39 cmd.env("RUSTFLAGS", rustflags);
41 eprintln!("[BUILD] rustc_codegen_cranelift");
42 super::utils::spawn_and_wait(cmd);
48 .join(get_file_name("rustc_codegen_cranelift", "dylib"))