rust: update to 1.78.0

This commit is contained in:
coolsnowwolf 2024-05-23 20:25:13 +08:00
parent 5bb9de28c7
commit 1ec98c1488
6 changed files with 166 additions and 190 deletions

View File

@ -5,12 +5,12 @@
include $(TOPDIR)/rules.mk include $(TOPDIR)/rules.mk
PKG_NAME:=rust PKG_NAME:=rust
PKG_VERSION:=1.74.1 PKG_VERSION:=1.78.0
PKG_RELEASE:=1 PKG_RELEASE:=2
PKG_SOURCE:=rustc-$(PKG_VERSION)-src.tar.gz PKG_SOURCE:=rustc-$(PKG_VERSION)-src.tar.xz
PKG_SOURCE_URL:=https://static.rust-lang.org/dist/ PKG_SOURCE_URL:=https://static.rust-lang.org/dist/
PKG_HASH:=67db3e22fc9921c885baae5953ba144fc474cde29ec69ab56d43ce764206231d PKG_HASH:=8065824f0255faa3901db8206e6f9423f6f8c07cec28bc6f2797c6c948310ece
HOST_BUILD_DIR:=$(BUILD_DIR)/host/rustc-$(PKG_VERSION)-src HOST_BUILD_DIR:=$(BUILD_DIR)/host/rustc-$(PKG_VERSION)-src
PKG_MAINTAINER:=Luca Barbato <lu_zero@luminem.org> PKG_MAINTAINER:=Luca Barbato <lu_zero@luminem.org>
@ -18,8 +18,8 @@ PKG_LICENSE:=Apache-2.0 MIT
PKG_LICENSE_FILES:=LICENSE-APACHE LICENSE-MIT PKG_LICENSE_FILES:=LICENSE-APACHE LICENSE-MIT
PKG_HOST_ONLY:=1 PKG_HOST_ONLY:=1
PKG_USE_MIPS16:=0
PKG_BUILD_FLAGS:=no-mips16 PKG_BUILD_FLAGS:=no-mips16
PKG_USE_MIPS16:=0
include $(INCLUDE_DIR)/host-build.mk include $(INCLUDE_DIR)/host-build.mk
include $(INCLUDE_DIR)/package.mk include $(INCLUDE_DIR)/package.mk
@ -72,10 +72,10 @@ HOST_CONFIGURE_ARGS = \
--datadir=$(STAGING_DIR)/host/share \ --datadir=$(STAGING_DIR)/host/share \
--mandir=$(STAGING_DIR)/host/man \ --mandir=$(STAGING_DIR)/host/man \
--dist-compression-formats=gz \ --dist-compression-formats=gz \
--enable-missing-tools \
--disable-sanitizers \ --disable-sanitizers \
--release-channel=stable \ --release-channel=stable \
--enable-cargo-native-static \ --enable-cargo-native-static \
--bootstrap-cache-path=$(DL_DIR)/rustc \
--set=llvm.download-ci-llvm=true \ --set=llvm.download-ci-llvm=true \
$(TARGET_CONFIGURE_ARGS) $(TARGET_CONFIGURE_ARGS)
@ -89,7 +89,6 @@ define Host/Compile
$(RUST_SCCACHE_VARS) \ $(RUST_SCCACHE_VARS) \
CARGO_HOME=$(CARGO_HOME) \ CARGO_HOME=$(CARGO_HOME) \
TARGET_CFLAGS="$(TARGET_CFLAGS)" \ TARGET_CFLAGS="$(TARGET_CFLAGS)" \
OPENWRT_RUSTC_BOOTSTRAP_CACHE=$(DL_DIR)/rustc \
$(PYTHON) $(HOST_BUILD_DIR)/x.py \ $(PYTHON) $(HOST_BUILD_DIR)/x.py \
--build-dir $(HOST_BUILD_DIR)/build \ --build-dir $(HOST_BUILD_DIR)/build \
--config $(HOST_BUILD_DIR)/config.toml \ --config $(HOST_BUILD_DIR)/config.toml \

View File

@ -4,45 +4,17 @@ Date: Sun, 4 Jun 2023 19:32:28 +0000
Subject: [PATCH] Update xz2 and use it static Subject: [PATCH] Update xz2 and use it static
--- ---
Cargo.lock | 8 ++++----
src/bootstrap/Cargo.lock | 8 ++++----
src/bootstrap/Cargo.toml | 2 +- src/bootstrap/Cargo.toml | 2 +-
3 files changed, 9 insertions(+), 9 deletions(-) 3 files changed, 9 insertions(+), 9 deletions(-)
--- a/src/bootstrap/Cargo.lock
+++ b/src/bootstrap/Cargo.lock
@@ -424,9 +424,9 @@ dependencies = [
[[package]]
name = "lzma-sys"
-version = "0.1.17"
+version = "0.1.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "bdb4b7c3eddad11d3af9e86c487607d2d2442d185d848575365c4856ba96d619"
+checksum = "5fda04ab3764e6cde78b9974eec4f779acaba7c4e84b36eca3cf77c581b85d27"
dependencies = [
"cc",
"libc",
@@ -871,9 +871,9 @@ dependencies = [
[[package]]
name = "xz2"
-version = "0.1.6"
+version = "0.1.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c179869f34fc7c01830d3ce7ea2086bc3a07e0d35289b667d0a8bf910258926c"
+checksum = "388c44dc09d76f1536602ead6d325eb532f5c122f17782bd57fb47baeeb767e2"
dependencies = [
"lzma-sys",
]
--- a/src/bootstrap/Cargo.toml --- a/src/bootstrap/Cargo.toml
+++ b/src/bootstrap/Cargo.toml +++ b/src/bootstrap/Cargo.toml
@@ -49,7 +49,7 @@ toml = "0.5" @@ -61,7 +61,7 @@ tar = "0.4"
ignore = "0.4.10" termcolor = "1.4"
opener = "0.5" toml = "0.5"
once_cell = "1.7.2" walkdir = "2.4"
-xz2 = "0.1" -xz2 = "0.1"
+xz2 = { version = "0.1", features = ["static"] } +xz2 = { version = "0.1", features = ["static"] }
walkdir = "2"
# Dependencies needed by the build-metrics feature # Dependencies needed by the build-metrics feature
sysinfo = { version = "0.30", optional = true }

View File

@ -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':

View File

@ -1,52 +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/download.rs
+++ b/src/bootstrap/download.rs
@@ -211,7 +211,13 @@ impl Config {
Some(other) => panic!("unsupported protocol {other} in {url}"),
None => panic!("no protocol in {url}"),
}
- t!(std::fs::rename(&tempfile, 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) {
@@ -529,7 +535,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));
@@ -656,7 +665,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));

View File

@ -1,61 +1,5 @@
This patch bumps all libc dependencies and checksums to 0.2.147, which includes the fix for musl 1.2.4. This patch bumps all libc dependencies and checksums to 0.2.147, which includes the fix for musl 1.2.4.
--- a/vendor/addr2line-0.19.0/Cargo.lock
+++ b/vendor/addr2line-0.19.0/Cargo.lock
@@ -235,9 +235,9 @@ checksum = "e2abad23fbc42b3700f2f279844d
[[package]]
name = "libc"
-version = "0.2.126"
+version = "0.2.147"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "349d5a591cd28b49e1d1037471617a32ddcda5731b99419008085f72d5a53836"
+checksum = "b4668fb0ea861c1df094127ac5f1da3409a82116a4ba74fca2e58ef927159bb3"
[[package]]
name = "memchr"
--- a/vendor/backtrace-0.3.67/Cargo.lock
+++ b/vendor/backtrace-0.3.67/Cargo.lock
@@ -64,9 +64,9 @@ checksum = "dec7af912d60cdbd3677c1af9352
[[package]]
name = "libc"
-version = "0.2.138"
+version = "0.2.147"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "db6d7e329c562c5dfab7a46a2afabc8b987ab9a4834c9d1ca04dc54c1546cef8"
+checksum = "b4668fb0ea861c1df094127ac5f1da3409a82116a4ba74fca2e58ef927159bb3"
[[package]]
name = "libloading"
--- a/vendor/cranelift-jit/Cargo.lock
+++ b/vendor/cranelift-jit/Cargo.lock
@@ -224,9 +224,9 @@ dependencies = [
[[package]]
name = "libc"
-version = "0.2.141"
+version = "0.2.147"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3304a64d199bb964be99741b7a14d26972741915b3649639149b2479bb46f4b5"
+checksum = "b4668fb0ea861c1df094127ac5f1da3409a82116a4ba74fca2e58ef927159bb3"
[[package]]
name = "log"
--- a/vendor/crossbeam-channel/Cargo.lock
+++ b/vendor/crossbeam-channel/Cargo.lock
@@ -50,9 +50,9 @@ dependencies = [
[[package]]
name = "libc"
-version = "0.2.141"
+version = "0.2.147"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3304a64d199bb964be99741b7a14d26972741915b3649639149b2479bb46f4b5"
+checksum = "b4668fb0ea861c1df094127ac5f1da3409a82116a4ba74fca2e58ef927159bb3"
[[package]]
name = "num_cpus"
--- a/vendor/elasticlunr-rs/Cargo.lock --- a/vendor/elasticlunr-rs/Cargo.lock
+++ b/vendor/elasticlunr-rs/Cargo.lock +++ b/vendor/elasticlunr-rs/Cargo.lock
@@ -555,9 +555,9 @@ checksum = "e2abad23fbc42b3700f2f279844d @@ -555,9 +555,9 @@ checksum = "e2abad23fbc42b3700f2f279844d
@ -70,34 +14,6 @@ This patch bumps all libc dependencies and checksums to 0.2.147, which includes
[[package]] [[package]]
name = "lindera" name = "lindera"
--- a/vendor/handlebars/Cargo.lock
+++ b/vendor/handlebars/Cargo.lock
@@ -550,9 +550,9 @@ checksum = "e2abad23fbc42b3700f2f279844d
[[package]]
name = "libc"
-version = "0.2.140"
+version = "0.2.147"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "99227334921fae1a979cf0bfdfcc6b3e5ce376ef57e16fb6fb3ea2ed6095f80c"
+checksum = "b4668fb0ea861c1df094127ac5f1da3409a82116a4ba74fca2e58ef927159bb3"
[[package]]
name = "lock_api"
--- a/vendor/icu_locid/Cargo.lock
+++ b/vendor/icu_locid/Cargo.lock
@@ -318,9 +318,9 @@ checksum = "e2abad23fbc42b3700f2f279844d
[[package]]
name = "libc"
-version = "0.2.141"
+version = "0.2.147"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3304a64d199bb964be99741b7a14d26972741915b3649639149b2479bb46f4b5"
+checksum = "b4668fb0ea861c1df094127ac5f1da3409a82116a4ba74fca2e58ef927159bb3"
[[package]]
name = "litemap"
--- a/vendor/libffi/Cargo.lock --- a/vendor/libffi/Cargo.lock
+++ b/vendor/libffi/Cargo.lock +++ b/vendor/libffi/Cargo.lock
@@ -10,9 +10,9 @@ checksum = "50d30906286121d95be3d479533b @@ -10,9 +10,9 @@ checksum = "50d30906286121d95be3d479533b
@ -112,17 +28,3 @@ This patch bumps all libc dependencies and checksums to 0.2.147, which includes
[[package]] [[package]]
name = "libffi" name = "libffi"
--- a/vendor/tracing-tree/Cargo.lock
+++ b/vendor/tracing-tree/Cargo.lock
@@ -296,9 +296,9 @@ checksum = "e2abad23fbc42b3700f2f279844d
[[package]]
name = "libc"
-version = "0.2.141"
+version = "0.2.147"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3304a64d199bb964be99741b7a14d26972741915b3649639149b2479bb46f4b5"
+checksum = "b4668fb0ea861c1df094127ac5f1da3409a82116a4ba74fca2e58ef927159bb3"
[[package]]
name = "linux-raw-sys"

View File

@ -0,0 +1,108 @@
From 4db00fe229f08b06feeee552ae53af9f49c25048 Mon Sep 17 00:00:00 2001
From: Luca Barbato <lu_zero@gentoo.org>
Date: Fri, 10 May 2024 16:38:19 +0200
Subject: [PATCH] Use an helper to move the files
In case the source is not in the same filesystem.
---
src/bootstrap/src/core/build_steps/dist.rs | 6 ++++--
src/bootstrap/src/core/download.rs | 6 +++---
src/bootstrap/src/utils/helpers.rs | 15 +++++++++++++++
src/bootstrap/src/utils/tarball.rs | 4 ++--
4 files changed, 24 insertions(+), 7 deletions(-)
--- a/src/bootstrap/src/core/build_steps/dist.rs
+++ b/src/bootstrap/src/core/build_steps/dist.rs
@@ -26,7 +26,9 @@ use crate::core::build_steps::tool::{sel
use crate::core::builder::{Builder, Kind, RunConfig, ShouldRun, Step};
use crate::core::config::TargetSelection;
use crate::utils::channel;
-use crate::utils::helpers::{exe, is_dylib, output, t, target_supports_cranelift_backend, timeit};
+use crate::utils::helpers::{
+ exe, is_dylib, move_file, output, t, target_supports_cranelift_backend, timeit,
+};
use crate::utils::tarball::{GeneratedTarball, OverlayKind, Tarball};
use crate::{Compiler, DependencyType, Mode, LLVM_TOOLS};
@@ -1993,7 +1995,7 @@ impl Step for Extended {
builder.run(&mut cmd);
if !builder.config.dry_run() {
- t!(fs::rename(exe.join(&filename), distdir(builder).join(&filename)));
+ t!(move_file(exe.join(&filename), distdir(builder).join(&filename)));
}
}
}
--- a/src/bootstrap/src/core/download.rs
+++ b/src/bootstrap/src/core/download.rs
@@ -12,7 +12,7 @@ use build_helper::ci::CiEnv;
use xz2::bufread::XzDecoder;
use crate::core::config::RustfmtMetadata;
-use crate::utils::helpers::{check_run, exe, program_out_of_date};
+use crate::utils::helpers::{check_run, exe, move_file, program_out_of_date};
use crate::{core::build_steps::llvm::detect_llvm_sha, utils::helpers::hex_encode};
use crate::{t, Config};
@@ -209,7 +209,7 @@ impl Config {
None => panic!("no protocol in {url}"),
}
t!(
- std::fs::rename(&tempfile, dest_path),
+ move_file(&tempfile, dest_path),
format!("failed to rename {tempfile:?} to {dest_path:?}")
);
}
@@ -313,7 +313,7 @@ impl Config {
if src_path.is_dir() && dst_path.exists() {
continue;
}
- t!(fs::rename(src_path, dst_path));
+ t!(move_file(src_path, dst_path));
}
let dst_dir = dst.join(directory_prefix);
if dst_dir.exists() {
--- a/src/bootstrap/src/utils/helpers.rs
+++ b/src/bootstrap/src/utils/helpers.rs
@@ -150,6 +150,21 @@ pub fn symlink_dir(config: &Config, orig
}
}
+/// Rename a file if from and to are in the same filesystem or
+/// copy and remove the file otherwise
+pub fn move_file<P: AsRef<Path>, Q: AsRef<Path>>(from: P, to: Q) -> io::Result<()> {
+ match fs::rename(&from, &to) {
+ // FIXME: Once `ErrorKind::CrossesDevices` is stabilized use
+ // if e.kind() == io::ErrorKind::CrossesDevices {
+ #[cfg(unix)]
+ Err(e) if e.raw_os_error() == Some(libc::EXDEV) => {
+ std::fs::copy(&from, &to)?;
+ std::fs::remove_file(&from)
+ }
+ r => r,
+ }
+}
+
pub fn forcing_clang_based_tests() -> bool {
if let Some(var) = env::var_os("RUSTBUILD_FORCE_CLANG_BASED_TESTS") {
match &var.to_string_lossy().to_lowercase()[..] {
--- a/src/bootstrap/src/utils/tarball.rs
+++ b/src/bootstrap/src/utils/tarball.rs
@@ -6,7 +6,7 @@ use std::{
use crate::core::builder::Builder;
use crate::core::{build_steps::dist::distdir, builder::Kind};
use crate::utils::channel;
-use crate::utils::helpers::t;
+use crate::utils::helpers::{move_file, t};
#[derive(Copy, Clone)]
pub(crate) enum OverlayKind {
@@ -269,7 +269,7 @@ impl<'a> Tarball<'a> {
// name, not "image". We rename the image directory just before passing
// into rust-installer.
let dest = self.temp_dir.join(self.package_name());
- t!(std::fs::rename(&self.image_dir, &dest));
+ t!(move_file(&self.image_dir, &dest));
self.run(|this, cmd| {
let distdir = distdir(this.builder);