]> git.lizzy.rs Git - rust.git/blob - compiler/rustc_codegen_cranelift/build_system/abi_cafe.rs
Merge commit '7d53619064ab7045c383644cb445052d2a3d46db' into sync_cg_clif-2023-02-09
[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::path::Dirs;
5 use super::prepare::GitRepo;
6 use super::utils::{spawn_and_wait, CargoProject, Compiler};
7 use super::SysrootKind;
8
9 static ABI_CAFE_REPO: GitRepo =
10     GitRepo::github("Gankra", "abi-cafe", "4c6dc8c9c687e2b3a760ff2176ce236872b37212", "abi-cafe");
11
12 static ABI_CAFE: CargoProject = CargoProject::new(&ABI_CAFE_REPO.source_dir(), "abi_cafe");
13
14 pub(crate) fn run(
15     channel: &str,
16     sysroot_kind: SysrootKind,
17     dirs: &Dirs,
18     cg_clif_dylib: &Path,
19     bootstrap_host_compiler: &Compiler,
20 ) {
21     ABI_CAFE_REPO.fetch(dirs);
22     spawn_and_wait(ABI_CAFE.fetch("cargo", &bootstrap_host_compiler.rustc, dirs));
23
24     eprintln!("Building sysroot for abi-cafe");
25     build_sysroot::build_sysroot(
26         dirs,
27         channel,
28         sysroot_kind,
29         cg_clif_dylib,
30         bootstrap_host_compiler,
31         bootstrap_host_compiler.triple.clone(),
32     );
33
34     eprintln!("Running abi-cafe");
35
36     let pairs = ["rustc_calls_cgclif", "cgclif_calls_rustc", "cgclif_calls_cc", "cc_calls_cgclif"];
37
38     let mut cmd = ABI_CAFE.run(bootstrap_host_compiler, dirs);
39     cmd.arg("--");
40     cmd.arg("--pairs");
41     cmd.args(pairs);
42     cmd.arg("--add-rustc-codegen-backend");
43     cmd.arg(format!("cgclif:{}", cg_clif_dylib.display()));
44     cmd.current_dir(ABI_CAFE.source_dir(dirs));
45
46     spawn_and_wait(cmd);
47 }