]> git.proxmox.com Git - rustc.git/blame - compiler/rustc_codegen_cranelift/build_system/abi_cafe.rs
New upstream version 1.66.0+dfsg1
[rustc.git] / compiler / rustc_codegen_cranelift / build_system / abi_cafe.rs
CommitLineData
2b03887a
FG
1use std::env;
2use std::path::Path;
3
4use super::build_sysroot;
5use super::config;
6use super::prepare;
7use super::utils::{cargo_command, spawn_and_wait};
8use super::SysrootKind;
9
10pub(crate) fn run(
11 channel: &str,
12 sysroot_kind: SysrootKind,
13 target_dir: &Path,
14 cg_clif_dylib: &Path,
15 host_triple: &str,
16 target_triple: &str,
17) {
18 if !config::get_bool("testsuite.abi-cafe") {
19 eprintln!("[SKIP] abi-cafe");
20 return;
21 }
22
23 if host_triple != target_triple {
24 eprintln!("[SKIP] abi-cafe (cross-compilation not supported)");
25 return;
26 }
27
28 eprintln!("Building sysroot for abi-cafe");
29 build_sysroot::build_sysroot(
30 channel,
31 sysroot_kind,
32 target_dir,
33 cg_clif_dylib,
34 host_triple,
35 target_triple,
36 );
37
38 eprintln!("Running abi-cafe");
39 let abi_cafe_path = prepare::ABI_CAFE.source_dir();
40 env::set_current_dir(abi_cafe_path.clone()).unwrap();
41
42 let pairs = ["rustc_calls_cgclif", "cgclif_calls_rustc", "cgclif_calls_cc", "cc_calls_cgclif"];
43
44 let mut cmd = cargo_command("cargo", "run", Some(target_triple), &abi_cafe_path);
45 cmd.arg("--");
46 cmd.arg("--pairs");
47 cmd.args(pairs);
48 cmd.arg("--add-rustc-codegen-backend");
49 cmd.arg(format!("cgclif:{}", cg_clif_dylib.display()));
50
51 spawn_and_wait(cmd);
52}