Skip to content

Commit 98ddd69

Browse files
committed
Add wrappers to dist/bin/ too in addition to dist/
Rust's build system since recently expects rustc to be in a bin/ directory if it is specified using the rustc option in config.toml.
1 parent 746008e commit 98ddd69

File tree

5 files changed

+19
-6
lines changed

5 files changed

+19
-6
lines changed

build_system/build_sysroot.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,15 @@ pub(crate) fn build_sysroot(
4646
let wrapper_name = wrapper_base_name.replace("____", wrapper);
4747

4848
let mut build_cargo_wrapper_cmd = Command::new(&bootstrap_host_compiler.rustc);
49+
let wrapper_path = DIST_DIR.to_path(dirs).join(&wrapper_name);
4950
build_cargo_wrapper_cmd
5051
.env("TOOLCHAIN_NAME", toolchain_name.clone())
5152
.arg(RelPath::SCRIPTS.to_path(dirs).join(&format!("{wrapper}.rs")))
5253
.arg("-o")
53-
.arg(DIST_DIR.to_path(dirs).join(wrapper_name))
54+
.arg(&wrapper_path)
5455
.arg("-Cstrip=debuginfo");
5556
spawn_and_wait(build_cargo_wrapper_cmd);
57+
try_hard_link(wrapper_path, BIN_DIR.to_path(dirs).join(wrapper_name));
5658
}
5759

5860
let host = build_sysroot_for_triple(

scripts/cargo-clif.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,11 @@ use std::path::PathBuf;
55
use std::process::Command;
66

77
fn main() {
8-
let sysroot = PathBuf::from(env::current_exe().unwrap().parent().unwrap());
8+
let current_exe = env::current_exe().unwrap();
9+
let mut sysroot = current_exe.parent().unwrap();
10+
if sysroot.file_name().unwrap().to_str().unwrap() == "bin" {
11+
sysroot = sysroot.parent().unwrap();
12+
}
913

1014
let mut rustflags = String::new();
1115
rustflags.push_str(" -Cpanic=abort -Zpanic-abort-tests -Zcodegen-backend=");

scripts/rustc-clif.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,14 @@ use std::env;
22
use std::ffi::OsString;
33
#[cfg(unix)]
44
use std::os::unix::process::CommandExt;
5-
use std::path::PathBuf;
65
use std::process::Command;
76

87
fn main() {
9-
let sysroot = PathBuf::from(env::current_exe().unwrap().parent().unwrap());
8+
let current_exe = env::current_exe().unwrap();
9+
let mut sysroot = current_exe.parent().unwrap();
10+
if sysroot.file_name().unwrap().to_str().unwrap() == "bin" {
11+
sysroot = sysroot.parent().unwrap();
12+
}
1013

1114
let cg_clif_dylib_path = sysroot.join(if cfg!(windows) { "bin" } else { "lib" }).join(
1215
env::consts::DLL_PREFIX.to_string() + "rustc_codegen_cranelift" + env::consts::DLL_SUFFIX,

scripts/rustdoc-clif.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,11 @@ use std::path::PathBuf;
66
use std::process::Command;
77

88
fn main() {
9-
let sysroot = PathBuf::from(env::current_exe().unwrap().parent().unwrap());
9+
let current_exe = env::current_exe().unwrap();
10+
let mut sysroot = current_exe.parent().unwrap();
11+
if sysroot.file_name().unwrap().to_str().unwrap() == "bin" {
12+
sysroot = sysroot.parent().unwrap();
13+
}
1014

1115
let cg_clif_dylib_path = sysroot.join(if cfg!(windows) { "bin" } else { "lib" }).join(
1216
env::consts::DLL_PREFIX.to_string() + "rustc_codegen_cranelift" + env::consts::DLL_SUFFIX,

scripts/setup_rust_fork.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ changelog-seen = 2
3636
ninja = false
3737
3838
[build]
39-
rustc = "$(pwd)/../dist/rustc-clif"
39+
rustc = "$(pwd)/../dist/bin/rustc-clif"
4040
cargo = "$(rustup which cargo)"
4141
full-bootstrap = true
4242
local-rebuild = true

0 commit comments

Comments
 (0)