Rename target_dir to dist_dir in a couple of places
This commit is contained in:
parent
052d5ccf5d
commit
9c21990283
@ -14,7 +14,7 @@
|
||||
pub(crate) fn run(
|
||||
channel: &str,
|
||||
sysroot_kind: SysrootKind,
|
||||
target_dir: &Path,
|
||||
dist_dir: &Path,
|
||||
cg_clif_dylib: &Path,
|
||||
host_triple: &str,
|
||||
target_triple: &str,
|
||||
@ -33,7 +33,7 @@ pub(crate) fn run(
|
||||
build_sysroot::build_sysroot(
|
||||
channel,
|
||||
sysroot_kind,
|
||||
target_dir,
|
||||
dist_dir,
|
||||
cg_clif_dylib,
|
||||
host_triple,
|
||||
target_triple,
|
||||
|
@ -9,21 +9,21 @@
|
||||
pub(crate) fn build_sysroot(
|
||||
channel: &str,
|
||||
sysroot_kind: SysrootKind,
|
||||
target_dir: &Path,
|
||||
dist_dir: &Path,
|
||||
cg_clif_dylib_src: &Path,
|
||||
host_triple: &str,
|
||||
target_triple: &str,
|
||||
) {
|
||||
eprintln!("[BUILD] sysroot {:?}", sysroot_kind);
|
||||
|
||||
if target_dir.exists() {
|
||||
fs::remove_dir_all(target_dir).unwrap();
|
||||
if dist_dir.exists() {
|
||||
fs::remove_dir_all(dist_dir).unwrap();
|
||||
}
|
||||
fs::create_dir_all(target_dir.join("bin")).unwrap();
|
||||
fs::create_dir_all(target_dir.join("lib")).unwrap();
|
||||
fs::create_dir_all(dist_dir.join("bin")).unwrap();
|
||||
fs::create_dir_all(dist_dir.join("lib")).unwrap();
|
||||
|
||||
// Copy the backend
|
||||
let cg_clif_dylib_path = target_dir
|
||||
let cg_clif_dylib_path = dist_dir
|
||||
.join(if cfg!(windows) {
|
||||
// Windows doesn't have rpath support, so the cg_clif dylib needs to be next to the
|
||||
// binaries.
|
||||
@ -42,14 +42,14 @@ pub(crate) fn build_sysroot(
|
||||
build_cargo_wrapper_cmd
|
||||
.arg(PathBuf::from("scripts").join(format!("{wrapper}.rs")))
|
||||
.arg("-o")
|
||||
.arg(target_dir.join(wrapper_name))
|
||||
.arg(dist_dir.join(wrapper_name))
|
||||
.arg("-g");
|
||||
spawn_and_wait(build_cargo_wrapper_cmd);
|
||||
}
|
||||
|
||||
let default_sysroot = super::rustc_info::get_default_sysroot();
|
||||
|
||||
let rustlib = target_dir.join("lib").join("rustlib");
|
||||
let rustlib = dist_dir.join("lib").join("rustlib");
|
||||
let host_rustlib_lib = rustlib.join(host_triple).join("lib");
|
||||
let target_rustlib_lib = rustlib.join(target_triple).join("lib");
|
||||
fs::create_dir_all(&host_rustlib_lib).unwrap();
|
||||
@ -114,7 +114,7 @@ pub(crate) fn build_sysroot(
|
||||
SysrootKind::Clif => {
|
||||
build_clif_sysroot_for_triple(
|
||||
channel,
|
||||
target_dir,
|
||||
dist_dir,
|
||||
host_triple,
|
||||
&cg_clif_dylib_path,
|
||||
None,
|
||||
@ -129,7 +129,7 @@ pub(crate) fn build_sysroot(
|
||||
};
|
||||
build_clif_sysroot_for_triple(
|
||||
channel,
|
||||
target_dir,
|
||||
dist_dir,
|
||||
target_triple,
|
||||
&cg_clif_dylib_path,
|
||||
linker,
|
||||
@ -142,7 +142,7 @@ pub(crate) fn build_sysroot(
|
||||
let file = file.unwrap().path();
|
||||
let filename = file.file_name().unwrap().to_str().unwrap();
|
||||
if filename.contains("std-") && !filename.contains(".rlib") {
|
||||
try_hard_link(&file, target_dir.join("lib").join(file.file_name().unwrap()));
|
||||
try_hard_link(&file, dist_dir.join("lib").join(file.file_name().unwrap()));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -153,7 +153,7 @@ pub(crate) fn build_sysroot(
|
||||
|
||||
fn build_clif_sysroot_for_triple(
|
||||
channel: &str,
|
||||
target_dir: &Path,
|
||||
dist_dir: &Path,
|
||||
triple: &str,
|
||||
cg_clif_dylib_path: &Path,
|
||||
linker: Option<&str>,
|
||||
@ -189,7 +189,7 @@ fn build_clif_sysroot_for_triple(
|
||||
// Build sysroot
|
||||
let mut rustflags = "-Zforce-unstable-if-unmarked -Cpanic=abort".to_string();
|
||||
rustflags.push_str(&format!(" -Zcodegen-backend={}", cg_clif_dylib_path.to_str().unwrap()));
|
||||
rustflags.push_str(&format!(" --sysroot={}", target_dir.to_str().unwrap()));
|
||||
rustflags.push_str(&format!(" --sysroot={}", dist_dir.to_str().unwrap()));
|
||||
if channel == "release" {
|
||||
rustflags.push_str(" -Zmir-opt-level=3");
|
||||
}
|
||||
@ -221,7 +221,7 @@ fn build_clif_sysroot_for_triple(
|
||||
};
|
||||
try_hard_link(
|
||||
entry.path(),
|
||||
target_dir.join("lib").join("rustlib").join(triple).join("lib").join(entry.file_name()),
|
||||
dist_dir.join("lib").join("rustlib").join(triple).join("lib").join(entry.file_name()),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -17,10 +17,10 @@ fn usage() {
|
||||
eprintln!("Usage:");
|
||||
eprintln!(" ./y.rs prepare");
|
||||
eprintln!(
|
||||
" ./y.rs build [--debug] [--sysroot none|clif|llvm] [--target-dir DIR] [--no-unstable-features]"
|
||||
" ./y.rs build [--debug] [--sysroot none|clif|llvm] [--dist-dir DIR] [--no-unstable-features]"
|
||||
);
|
||||
eprintln!(
|
||||
" ./y.rs test [--debug] [--sysroot none|clif|llvm] [--target-dir DIR] [--no-unstable-features]"
|
||||
" ./y.rs test [--debug] [--sysroot none|clif|llvm] [--dist-dir DIR] [--no-unstable-features]"
|
||||
);
|
||||
}
|
||||
|
||||
@ -75,15 +75,15 @@ pub fn main() {
|
||||
}
|
||||
};
|
||||
|
||||
let mut target_dir = PathBuf::from("dist");
|
||||
let mut dist_dir = PathBuf::from("dist");
|
||||
let mut channel = "release";
|
||||
let mut sysroot_kind = SysrootKind::Clif;
|
||||
let mut use_unstable_features = true;
|
||||
while let Some(arg) = args.next().as_deref() {
|
||||
match arg {
|
||||
"--target-dir" => {
|
||||
target_dir = PathBuf::from(args.next().unwrap_or_else(|| {
|
||||
arg_error!("--target-dir requires argument");
|
||||
"--dist-dir" => {
|
||||
dist_dir = PathBuf::from(args.next().unwrap_or_else(|| {
|
||||
arg_error!("--dist-dir requires argument");
|
||||
}))
|
||||
}
|
||||
"--debug" => channel = "debug",
|
||||
@ -101,7 +101,7 @@ pub fn main() {
|
||||
arg => arg_error!("Unexpected argument {}", arg),
|
||||
}
|
||||
}
|
||||
target_dir = std::env::current_dir().unwrap().join(target_dir);
|
||||
dist_dir = std::env::current_dir().unwrap().join(dist_dir);
|
||||
|
||||
let host_triple = if let Ok(host_triple) = std::env::var("HOST_TRIPLE") {
|
||||
host_triple
|
||||
@ -128,7 +128,7 @@ pub fn main() {
|
||||
tests::run_tests(
|
||||
channel,
|
||||
sysroot_kind,
|
||||
&target_dir,
|
||||
&dist_dir,
|
||||
&cg_clif_dylib,
|
||||
&host_triple,
|
||||
&target_triple,
|
||||
@ -137,7 +137,7 @@ pub fn main() {
|
||||
abi_cafe::run(
|
||||
channel,
|
||||
sysroot_kind,
|
||||
&target_dir,
|
||||
&dist_dir,
|
||||
&cg_clif_dylib,
|
||||
&host_triple,
|
||||
&target_triple,
|
||||
@ -147,7 +147,7 @@ pub fn main() {
|
||||
build_sysroot::build_sysroot(
|
||||
channel,
|
||||
sysroot_kind,
|
||||
&target_dir,
|
||||
&dist_dir,
|
||||
&cg_clif_dylib,
|
||||
&host_triple,
|
||||
&target_triple,
|
||||
|
@ -432,7 +432,7 @@ const fn new(config: &'static str, func: &'static dyn Fn(&TestRunner)) -> Self {
|
||||
pub(crate) fn run_tests(
|
||||
channel: &str,
|
||||
sysroot_kind: SysrootKind,
|
||||
target_dir: &Path,
|
||||
dist_dir: &Path,
|
||||
cg_clif_dylib: &Path,
|
||||
host_triple: &str,
|
||||
target_triple: &str,
|
||||
@ -443,7 +443,7 @@ pub(crate) fn run_tests(
|
||||
build_sysroot::build_sysroot(
|
||||
channel,
|
||||
SysrootKind::None,
|
||||
&target_dir,
|
||||
&dist_dir,
|
||||
cg_clif_dylib,
|
||||
&host_triple,
|
||||
&target_triple,
|
||||
@ -462,7 +462,7 @@ pub(crate) fn run_tests(
|
||||
build_sysroot::build_sysroot(
|
||||
channel,
|
||||
sysroot_kind,
|
||||
&target_dir,
|
||||
&dist_dir,
|
||||
cg_clif_dylib,
|
||||
&host_triple,
|
||||
&target_triple,
|
||||
|
Loading…
Reference in New Issue
Block a user