38 lines
1.5 KiB
Diff
38 lines
1.5 KiB
Diff
--- a/src/bootstrap/bootstrap.py
|
|
+++ b/src/bootstrap/bootstrap.py
|
|
@@ -546,7 +546,7 @@ class RustBuild(object):
|
|
shutil.rmtree(bin_root)
|
|
|
|
key = self.stage0_compiler.date
|
|
- cache_dst = os.path.join(self.build_dir, "cache")
|
|
+ cache_dst = os.getenv('OPENWRT_RUSTC_BOOTSTRAP_CACHE', os.path.join(self.build_dir, "cache"))
|
|
rustc_cache = os.path.join(cache_dst, key)
|
|
if not os.path.exists(rustc_cache):
|
|
os.makedirs(rustc_cache)
|
|
--- a/src/bootstrap/download.rs
|
|
+++ b/src/bootstrap/download.rs
|
|
@@ -520,7 +520,10 @@ impl Config {
|
|
key: &str,
|
|
destination: &str,
|
|
) {
|
|
- let cache_dst = self.out.join("cache");
|
|
+ let cache_dst = match env::var_os("OPENWRT_RUSTC_BOOTSTRAP_CACHE") {
|
|
+ Some(v) => PathBuf::from(v),
|
|
+ None => self.out.join("cache"),
|
|
+ };
|
|
let cache_dir = cache_dst.join(key);
|
|
if !cache_dir.exists() {
|
|
t!(fs::create_dir_all(&cache_dir));
|
|
@@ -647,7 +650,10 @@ download-rustc = false
|
|
let llvm_assertions = self.llvm_assertions;
|
|
|
|
let cache_prefix = format!("llvm-{llvm_sha}-{llvm_assertions}");
|
|
- let cache_dst = self.out.join("cache");
|
|
+ let cache_dst = match env::var_os("OPENWRT_RUSTC_BOOTSTRAP_CACHE") {
|
|
+ Some(v) => PathBuf::from(v),
|
|
+ None => self.out.join("cache"),
|
|
+ };
|
|
let rustc_cache = cache_dst.join(cache_prefix);
|
|
if !rustc_cache.exists() {
|
|
t!(fs::create_dir_all(&rustc_cache));
|