]> git.lizzy.rs Git - rust.git/blob - compiler/rustc_codegen_cranelift/build_system/abi_cafe.rs
Rollup merge of #104182 - gabhijit:ipv6-in6addr-any-doc-fix, r=m-ou-se
[rust.git] / compiler / rustc_codegen_cranelift / build_system / abi_cafe.rs
1 use std::path::Path;
2
3 use super::build_sysroot;
4 use super::config;
5 use super::path::Dirs;
6 use super::prepare::GitRepo;
7 use super::utils::{spawn_and_wait, CargoProject, Compiler};
8 use super::SysrootKind;
9
10 pub(crate) static ABI_CAFE_REPO: GitRepo =
11     GitRepo::github("Gankra", "abi-cafe", "4c6dc8c9c687e2b3a760ff2176ce236872b37212", "abi-cafe");
12
13 static ABI_CAFE: CargoProject = CargoProject::new(&ABI_CAFE_REPO.source_dir(), "abi_cafe");
14
15 pub(crate) fn run(
16     channel: &str,
17     sysroot_kind: SysrootKind,
18     dirs: &Dirs,
19     cg_clif_dylib: &Path,
20     host_triple: &str,
21     target_triple: &str,
22 ) {
23     if !config::get_bool("testsuite.abi-cafe") {
24         eprintln!("[SKIP] abi-cafe");
25         return;
26     }
27
28     if host_triple != target_triple {
29         eprintln!("[SKIP] abi-cafe (cross-compilation not supported)");
30         return;
31     }
32
33     eprintln!("Building sysroot for abi-cafe");
34     build_sysroot::build_sysroot(
35         dirs,
36         channel,
37         sysroot_kind,
38         cg_clif_dylib,
39         host_triple,
40         target_triple,
41     );
42
43     eprintln!("Running abi-cafe");
44
45     let pairs = ["rustc_calls_cgclif", "cgclif_calls_rustc", "cgclif_calls_cc", "cc_calls_cgclif"];
46
47     let mut cmd = ABI_CAFE.run(&Compiler::host(), dirs);
48     cmd.arg("--");
49     cmd.arg("--pairs");
50     cmd.args(pairs);
51     cmd.arg("--add-rustc-codegen-backend");
52     cmd.arg(format!("cgclif:{}", cg_clif_dylib.display()));
53     cmd.current_dir(ABI_CAFE.source_dir(dirs));
54
55     spawn_and_wait(cmd);
56 }