]> git.proxmox.com Git - rustc.git/blame - compiler/rustc_codegen_cranelift/build_system/abi_cafe.rs
New upstream version 1.69.0+dfsg1
[rustc.git] / compiler / rustc_codegen_cranelift / build_system / abi_cafe.rs
CommitLineData
2b03887a
FG
1use std::path::Path;
2
3use super::build_sysroot;
9c376795
FG
4use super::path::Dirs;
5use super::prepare::GitRepo;
6use super::utils::{spawn_and_wait, CargoProject, Compiler};
2b03887a
FG
7use super::SysrootKind;
8
9ffffee4 9static ABI_CAFE_REPO: GitRepo =
9c376795
FG
10 GitRepo::github("Gankra", "abi-cafe", "4c6dc8c9c687e2b3a760ff2176ce236872b37212", "abi-cafe");
11
12static ABI_CAFE: CargoProject = CargoProject::new(&ABI_CAFE_REPO.source_dir(), "abi_cafe");
13
2b03887a
FG
14pub(crate) fn run(
15 channel: &str,
16 sysroot_kind: SysrootKind,
9c376795 17 dirs: &Dirs,
2b03887a 18 cg_clif_dylib: &Path,
9ffffee4 19 bootstrap_host_compiler: &Compiler,
2b03887a 20) {
9ffffee4
FG
21 ABI_CAFE_REPO.fetch(dirs);
22 spawn_and_wait(ABI_CAFE.fetch("cargo", &bootstrap_host_compiler.rustc, dirs));
2b03887a
FG
23
24 eprintln!("Building sysroot for abi-cafe");
25 build_sysroot::build_sysroot(
9c376795 26 dirs,
2b03887a
FG
27 channel,
28 sysroot_kind,
2b03887a 29 cg_clif_dylib,
9ffffee4
FG
30 bootstrap_host_compiler,
31 bootstrap_host_compiler.triple.clone(),
2b03887a
FG
32 );
33
34 eprintln!("Running abi-cafe");
2b03887a
FG
35
36 let pairs = ["rustc_calls_cgclif", "cgclif_calls_rustc", "cgclif_calls_cc", "cc_calls_cgclif"];
37
9ffffee4 38 let mut cmd = ABI_CAFE.run(bootstrap_host_compiler, dirs);
2b03887a
FG
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()));
9c376795 44 cmd.current_dir(ABI_CAFE.source_dir(dirs));
2b03887a
FG
45
46 spawn_and_wait(cmd);
47}