rust: Update to 1.78.0 master
authorTianling Shen <cnsztl@immortalwrt.org>
Sat, 4 May 2024 10:39:44 +0000 (18:39 +0800)
committerTianling Shen <cnsztl@gmail.com>
Sun, 5 May 2024 04:49:58 +0000 (12:49 +0800)
- Switch back to .gz tarball
- Replace local bootstrap cache hack with upstreamed option

Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
lang/rust/Makefile
lang/rust/patches/0002-correct-the-handling-of-bootstrap-cache-path-option.patch [new file with mode: 0644]
lang/rust/patches/0002-rustc-bootstrap-cache.patch [deleted file]

index 53f9aa389114af69fdeae71e03491c0b10cc89fd..794ab2dd4f16a55cd9ca3c4779337b5b4cb15bfe 100644 (file)
@@ -5,12 +5,12 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=rust
-PKG_VERSION:=1.77.0
+PKG_VERSION:=1.78.0
 PKG_RELEASE:=1
 
-PKG_SOURCE:=rustc-$(PKG_VERSION)-src.tar.xz
+PKG_SOURCE:=rustc-$(PKG_VERSION)-src.tar.gz
 PKG_SOURCE_URL:=https://static.rust-lang.org/dist/
-PKG_HASH:=66126989782cbf77fa3aff121bbb108429f2d46fe19328c3de231553de711b90
+PKG_HASH:=ff544823a5cb27f2738128577f1e7e00ee8f4c83f2a348781ae4fc355e91d5a9
 HOST_BUILD_DIR:=$(BUILD_DIR)/host/rustc-$(PKG_VERSION)-src
 
 PKG_MAINTAINER:=Luca Barbato <lu_zero@luminem.org>
@@ -74,6 +74,7 @@ HOST_CONFIGURE_ARGS = \
        --disable-sanitizers \
        --release-channel=stable \
        --enable-cargo-native-static \
+       --bootstrap-cache-path=$(DL_DIR)/rustc \
        --set=llvm.download-ci-llvm=true \
        $(TARGET_CONFIGURE_ARGS)
 
@@ -87,7 +88,6 @@ define Host/Compile
        $(RUST_SCCACHE_VARS) \
        CARGO_HOME=$(CARGO_HOME) \
        TARGET_CFLAGS="$(TARGET_CFLAGS)" \
-       OPENWRT_RUSTC_BOOTSTRAP_CACHE=$(DL_DIR)/rustc \
        $(PYTHON) $(HOST_BUILD_DIR)/x.py \
                --build-dir $(HOST_BUILD_DIR)/build \
                --config $(HOST_BUILD_DIR)/config.toml \
diff --git a/lang/rust/patches/0002-correct-the-handling-of-bootstrap-cache-path-option.patch b/lang/rust/patches/0002-correct-the-handling-of-bootstrap-cache-path-option.patch
new file mode 100644 (file)
index 0000000..99c8038
--- /dev/null
@@ -0,0 +1,47 @@
+From bd479113d38aa453cbad9d9f5ca9c5fc8903b0cf Mon Sep 17 00:00:00 2001
+From: onur-ozkan <work@onurozkan.dev>
+Date: Thu, 11 Apr 2024 14:57:10 +0300
+Subject: [PATCH] correct the handling of `bootstrap-cache-path` option
+
+This change makes `build.bootstrap-cache-path` option to be configurable with
+`./configure` script, so it can be used like `./configure --bootstrap-cache-path=demo`.
+
+Signed-off-by: onur-ozkan <work@onurozkan.dev>
+---
+ config.example.toml        | 2 +-
+ src/bootstrap/configure.py | 4 +++-
+ 2 files changed, 4 insertions(+), 2 deletions(-)
+
+--- a/config.example.toml
++++ b/config.example.toml
+@@ -302,7 +302,7 @@
+ # Set the bootstrap/download cache path. It is useful when building rust
+ # repeatedly in a CI invironment.
+-# bootstrap-cache-path = /shared/cache
++#bootstrap-cache-path = /path/to/shared/cache
+ # Enable a build of the extended Rust tool set which is not only the compiler
+ # but also tools such as Cargo. This will also produce "combined installers"
+--- a/src/bootstrap/configure.py
++++ b/src/bootstrap/configure.py
+@@ -152,9 +152,9 @@ v("default-linker", "rust.default-linker
+ # (others are conditionally saved).
+ o("manage-submodules", "build.submodules", "let the build manage the git submodules")
+ o("full-bootstrap", "build.full-bootstrap", "build three compilers instead of two (not recommended except for testing reproducible builds)")
+-o("bootstrap-cache-path", "build.bootstrap-cache-path", "use provided path for the bootstrap cache")
+ o("extended", "build.extended", "build an extended rust tool set")
++v("bootstrap-cache-path", None, "use provided path for the bootstrap cache")
+ v("tools", None, "List of extended tools will be installed")
+ v("codegen-backends", None, "List of codegen backends to build")
+ v("build", "build.build", "GNUs ./configure syntax LLVM build triple")
+@@ -359,6 +359,8 @@ def apply_args(known_args, option_checki
+             set('target.{}.llvm-filecheck'.format(build_triple), value, config)
+         elif option.name == 'tools':
+             set('build.tools', value.split(','), config)
++        elif option.name == 'bootstrap-cache-path':
++            set('build.bootstrap-cache-path', value, config)
+         elif option.name == 'codegen-backends':
+             set('rust.codegen-backends', value.split(','), config)
+         elif option.name == 'host':
diff --git a/lang/rust/patches/0002-rustc-bootstrap-cache.patch b/lang/rust/patches/0002-rustc-bootstrap-cache.patch
deleted file mode 100644 (file)
index 61cd009..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
---- a/src/bootstrap/bootstrap.py
-+++ b/src/bootstrap/bootstrap.py
-@@ -557,7 +557,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/src/core/download.rs
-+++ b/src/bootstrap/src/core/download.rs
-@@ -208,10 +208,13 @@ impl Config {
-             Some(other) => panic!("unsupported protocol {other} in {url}"),
-             None => panic!("no protocol in {url}"),
-         }
--        t!(
--            std::fs::rename(&tempfile, dest_path),
--            format!("failed to rename {tempfile:?} to {dest_path:?}")
--        );
-+        match std::fs::rename(&tempfile, dest_path) {
-+            Ok(v) => v,
-+            Err(_) => {
-+                t!(std::fs::copy(&tempfile, dest_path));
-+                t!(std::fs::remove_file(&tempfile));
-+            }
-+        };
-     }
-     fn download_http_with_retries(&self, tempfile: &Path, url: &str, help_on_error: &str) {
-@@ -577,7 +580,10 @@ impl Config {
-             return;
-         }
--        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));
-@@ -704,7 +710,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));