From ce3f300e40146480d3f508e9657c454bf6881b10 Mon Sep 17 00:00:00 2001 From: bjorn3 <17426603+bjorn3@users.noreply.github.com> Date: Mon, 13 Feb 2023 10:38:25 +0000 Subject: [PATCH] Add --download-dir option to specify download dir separate from --out-dir --- build_system/mod.rs | 12 ++++++++++-- build_system/usage.txt | 13 ++++++++----- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/build_system/mod.rs b/build_system/mod.rs index 0110011169df..e1b46c3120e2 100644 --- a/build_system/mod.rs +++ b/build_system/mod.rs @@ -81,6 +81,7 @@ pub(crate) fn main() { }; let mut out_dir = PathBuf::from("."); + let mut download_dir = None; let mut channel = "release"; let mut sysroot_kind = SysrootKind::Clif; let mut use_unstable_features = true; @@ -91,7 +92,12 @@ pub(crate) fn main() { "--out-dir" => { out_dir = PathBuf::from(args.next().unwrap_or_else(|| { arg_error!("--out-dir requires argument"); - })) + })); + } + "--download-dir" => { + download_dir = Some(PathBuf::from(args.next().unwrap_or_else(|| { + arg_error!("--download-dir requires argument"); + }))); } "--debug" => channel = "debug", "--sysroot" => { @@ -152,7 +158,9 @@ pub(crate) fn main() { out_dir = current_dir.join(out_dir); let dirs = path::Dirs { source_dir: current_dir.clone(), - download_dir: out_dir.join("download"), + download_dir: download_dir + .map(|dir| current_dir.join(dir)) + .unwrap_or_else(|| out_dir.join("download")), build_dir: out_dir.join("build"), dist_dir: out_dir.join("dist"), frozen, diff --git a/build_system/usage.txt b/build_system/usage.txt index 3bc18a933311..98726ae5af12 100644 --- a/build_system/usage.txt +++ b/build_system/usage.txt @@ -1,11 +1,11 @@ The build system of cg_clif. USAGE: - ./y.rs prepare [--out-dir DIR] - ./y.rs build [--debug] [--sysroot none|clif|llvm] [--out-dir DIR] [--no-unstable-features] [--frozen] - ./y.rs test [--debug] [--sysroot none|clif|llvm] [--out-dir DIR] [--no-unstable-features] [--frozen] - ./y.rs abi-cafe [--debug] [--sysroot none|clif|llvm] [--out-dir DIR] [--no-unstable-features] [--frozen] - ./y.rs bench [--debug] [--sysroot none|clif|llvm] [--out-dir DIR] [--no-unstable-features] [--frozen] + ./y.rs prepare [--out-dir DIR] [--download-dir DIR] + ./y.rs build [--debug] [--sysroot none|clif|llvm] [--out-dir DIR] [--download-dir DIR] [--no-unstable-features] [--frozen] + ./y.rs test [--debug] [--sysroot none|clif|llvm] [--out-dir DIR] [--download-dir DIR] [--no-unstable-features] [--frozen] + ./y.rs abi-cafe [--debug] [--sysroot none|clif|llvm] [--out-dir DIR] [--download-dir DIR] [--no-unstable-features] [--frozen] + ./y.rs bench [--debug] [--sysroot none|clif|llvm] [--out-dir DIR] [--download-dir DIR] [--no-unstable-features] [--frozen] OPTIONS: --debug @@ -22,6 +22,9 @@ OPTIONS: Specify the directory in which the download, build and dist directories are stored. By default this is the working directory. + --download-dir DIR + Specify the directory in which the download directory is stored. Overrides --out-dir. + --no-unstable-features Some features are not yet ready for production usage. This option will disable these features. This includes the JIT mode and inline assembly support.