diff --git a/0001-add-musl-root-riscv64gc-detection-in-configure.py.patch b/0001-add-musl-root-riscv64gc-detection-in-configure.py.patch new file mode 100644 index 0000000..61e6e1c --- /dev/null +++ b/0001-add-musl-root-riscv64gc-detection-in-configure.py.patch @@ -0,0 +1,25 @@ +From a216df759724049385b729f038de2cb49c580cd2 Mon Sep 17 00:00:00 2001 +From: jchzhou +Date: Wed, 8 Mar 2023 00:10:42 +0800 +Subject: [PATCH] add musl-root-riscv64gc detection in configure.py + +--- + src/bootstrap/configure.py | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/src/bootstrap/configure.py b/src/bootstrap/configure.py +index 6b139decb..55855f8a1 100755 +--- a/src/bootstrap/configure.py ++++ b/src/bootstrap/configure.py +@@ -140,6 +140,8 @@ v("musl-root-mips64", "target.mips64-unknown-linux-muslabi64.musl-root", + "mips64-unknown-linux-muslabi64 install directory") + v("musl-root-mips64el", "target.mips64el-unknown-linux-muslabi64.musl-root", + "mips64el-unknown-linux-muslabi64 install directory") ++v("musl-root-riscv64gc", "target.riscv64gc-unknown-linux-musl.musl-root", ++ "riscv64gc-unknown-linux-musl install directory") + v("qemu-armhf-rootfs", "target.arm-unknown-linux-gnueabihf.qemu-rootfs", + "rootfs in qemu testing, you probably don't want to use this") + v("qemu-aarch64-rootfs", "target.aarch64-unknown-linux-gnu.qemu-rootfs", +-- +2.39.2 + diff --git a/rust.spec b/rust.spec index b1de7a6..52b54dd 100644 --- a/rust.spec +++ b/rust.spec @@ -1,23 +1,27 @@ -%global bootstrap_rust 1.67.1 -%global bootstrap_cargo 1.67.1 -%global bootstrap_channel 1.67.1 -%global bootstrap_date 2023-02-09 +%global bootstrap_rust 1.68.0 +%global bootstrap_cargo 1.68.0 +%global bootstrap_channel 1.68.0 +%global bootstrap_date 2023-03-09 %bcond_with llvm_static %bcond_with bundled_llvm %bcond_without bundled_libgit2 %bcond_with disabled_libssh2 %bcond_without curl_http2 %bcond_without lldb +%ifnarch riscv64 +%bcond_without analyzer +%endif + Name: rust -Version: 1.68.0 -Release: 1 +Version: 1.69.0 +Release: 2 Summary: The Rust Programming Language License: (ASL 2.0 or MIT) and (BSD and MIT) URL: https://www.rust-lang.org -Source0: https://static.rust-lang.org/dist/rustc-%{version}-src.tar.gz +Source0: https://static.rust-lang.org/dist/rustc-%{version}-src.tar.xz Patch0000: rustc-1.65.0-disable-libssh2.patch -Patch0001: rustc-1.67.1-disable-http2.patch +Patch0001: rustc-1.69.0-disable-http2.patch Patch0002: clippy-driver-usage-should-user-friendly.patch Patch0003: cargo-help-clippy-should-have-description-to-user.patch Patch0004: fix-a-println-wrong-format.patch @@ -26,6 +30,7 @@ Patch0005: compile-with-llvm-15.patch Patch0006: 0001-Use-lld-provided-by-system-for-wasm.patch # Set a substitute-path in rust-gdb for standard library sources. Patch0007: rustc-1.61.0-rust-gdb-substitute-path.patch +Patch0008: 0001-add-musl-root-riscv64gc-detection-in-configure.py.patch %{lua: function rust_triple(arch) local abi = "gnu" @@ -43,9 +48,15 @@ Patch0007: rustc-1.61.0-rust-gdb-substitute-path.patch end} %{lua: function rust_musl_triple(arch) local abi = "musl" + if arch == "riscv64" then + arch = "riscv64gc" + end return arch.."-unknown-linux-"..abi end} %{lua: function rust_musl_root(arch) + if arch == "riscv64" then + arch = "riscv64gc" + end return "--musl-root-"..arch end} %global rust_triple %{lua: print(rust_triple(rpm.expand("%{_target_cpu}")))} @@ -90,11 +101,17 @@ BuildRequires: cmake >= 2.8.11 %if %defined llvm %global llvm_root %{_libdir}/%{llvm} %else +# default llvm is decent enough on riscv64 +%ifnarch riscv64 %global llvm llvm15 +%else +%global llvm llvm +%endif %global llvm_root %{_prefix} %endif -BuildRequires: %{llvm} >= 13.0 -BuildRequires: %{llvm}-devel >= 13.0 +# rust currently requires llvm 14.0+ +BuildRequires: %{llvm} >= 14.0.0 +BuildRequires: %{llvm}-devel >= 14.0.0 %if %with llvm_static BuildRequires: %{llvm}-static libffi-devel %endif @@ -119,6 +136,10 @@ Requires: /usr/bin/cc %endif %global musl_root %{_prefix}/musl +# The 'analysis' component is removed since Rust 1.69.0 +# ref: https://github.com/rust-lang/rust/pull/101841 +Obsoletes: %{name}-analysis < 1.69.0~ + %description Rust is a systems programming language that runs blazingly fast, prevents segfaults, and guarantees thread safety. @@ -176,6 +197,7 @@ Conflicts: rustfmt-preview < 1.0.0 %description -n rustfmt A tool for formatting Rust code according to style guidelines. +%if %{with analyzer} %package analyzer Summary:Rust implementation of the Language Server Protocol Requires: %{name}-src @@ -188,6 +210,7 @@ Obsoletes: rls-preview < 1.31.6 rust-analyzer is an implementation of Language Server Protocol for the Rust programming language. It provides features like completion and goto definition for many code editors, including VS Code, Emacs and Vim. +%endif %package -n clippy Summary: Lints to catch common mistakes and improve your Rust code @@ -205,14 +228,6 @@ BuildArch: noarch This package includes source files for the Rust standard library. It may be useful as a reference for code completion tools in various editors. -%package analysis -Summary: Compiler analysis data for the Rust standard library -Requires: rust-std-static%{?_isa} = %{version}-%{release} -%description analysis -This package contains analysis data files produced with rustc's -Zsave-analysis -feature for the Rust standard library. The RLS (Rust Language Server) uses this -data to provide information about the Rust standard library. - %package help Summary: Help documents for rust @@ -244,9 +259,13 @@ sed -i.try-python -e '/^try python3 /i try "%{python}" "$@"' ./configure %patch0002 -p1 %patch0003 -p1 %patch0004 -p1 +# default llvm is decent enough on riscv64 +%ifnarch riscv64 %patch0005 -p1 +%endif %patch0006 -p1 %patch0007 -p1 +%patch0008 -p1 rm -rf vendor/curl-sys/curl/ rm -rf vendor/jemalloc-sys/jemalloc/ rm -rf vendor/libssh2-sys/libssh2/ @@ -308,7 +327,7 @@ fi --disable-rpath \ %{enable_debuginfo} \ --enable-extended \ - --tools=analysis,cargo,clippy,rls,rust-analyzer,rustfmt,src \ + --tools=cargo,clippy,%{?with_analyzer:rls,rust-analyzer,}rustfmt,src \ --enable-vendor \ --enable-verbose-tests \ %{?codegen_units_std} \ @@ -351,8 +370,10 @@ mkdir -p %{buildroot}%{_datadir}/cargo/registry mkdir -p %{buildroot}%{_docdir}/cargo ln -sT ../rust/html/cargo/ %{buildroot}%{_docdir}/cargo/html +%if %{with analyzer} # The rls stub doesn't have an install target, but we can just copy it. %{__install} -t %{buildroot}%{_bindir} build/%{rust_triple}/stage2-tools-bin/rls +%endif %if %without lldb rm -f %{buildroot}%{_bindir}/rust-lldb @@ -365,7 +386,9 @@ export %{rust_env} %{python} ./x.py test --no-fail-fast --stage 2 || : %{python} ./x.py test --no-fail-fast --stage 2 cargo || : %{python} ./x.py test --no-fail-fast --stage 2 clippy || : +%if %{with analyzer} %{python} ./x.py test --no-fail-fast --stage 2 rust-analyzer || : +%endif %{python} ./x.py test --no-fail-fast --stage 2 rustfmt || : %ldconfig_scriptlets @@ -428,11 +451,13 @@ export %{rust_env} %doc src/tools/rustfmt/{README,CHANGELOG,Configurations}.md %license src/tools/rustfmt/LICENSE-{APACHE,MIT} +%if %{with analyzer} %files analyzer %{_bindir}/rls %{_bindir}/rust-analyzer %doc src/tools/rust-analyzer/README.md %license src/tools/rust-analyzer/LICENSE-{APACHE,MIT} +%endif %files -n clippy %{_bindir}/cargo-clippy @@ -444,10 +469,6 @@ export %{rust_env} %dir %{rustlibdir} %{rustlibdir}/src -%files analysis -%{rustlibdir}/%{rust_triple}/analysis/ -%{rustlibdir}/%{rust_musl_triple}/analysis/ - %files help %dir %{_docdir}/%{name} %docdir %{_docdir}/%{name} @@ -460,6 +481,14 @@ export %{rust_env} %{_mandir}/man1/cargo*.1* %changelog +* Mon Apr 24 2023 jchzhou - 1.69.0-2 +- Add riscv64 specific changes + +* Mon Apr 24 2023 jchzhou - 1.69.0-1 +- Update to 1.69.0 +- Obsolete the removed rust-analysis subpackage +- Switch to xz tarball to save space + * Wed Mar 22 2023 wangkai - 1.68.0-1 - Update to 1.68.0 diff --git a/rustc-1.67.1-disable-http2.patch b/rustc-1.69.0-disable-http2.patch similarity index 75% rename from rustc-1.67.1-disable-http2.patch rename to rustc-1.69.0-disable-http2.patch index b74cb61..09e7930 100644 --- a/rustc-1.67.1-disable-http2.patch +++ b/rustc-1.69.0-disable-http2.patch @@ -1,6 +1,6 @@ ---- rustc-beta-src/Cargo.lock.orig 2023-01-24 13:25:47.822917185 -0800 -+++ rustc-beta-src/Cargo.lock 2023-01-24 13:25:47.824917142 -0800 -@@ -1062,7 +1062,6 @@ +--- rustc-beta-src/Cargo.lock.orig 2023-03-23 17:10:30.810989345 -0700 ++++ rustc-beta-src/Cargo.lock 2023-03-23 17:10:30.812989303 -0700 +@@ -1142,7 +1142,6 @@ dependencies = [ "cc", "libc", @@ -8,7 +8,7 @@ "libz-sys", "openssl-sys", "pkg-config", -@@ -2181,16 +2180,6 @@ +@@ -2375,16 +2374,6 @@ checksum = "7fc7aa29613bd6a620df431842069224d8bc9011086b1db4c0e0cd47fa03ec9a" [[package]] @@ -22,23 +22,23 @@ -] - -[[package]] - name = "libssh2-sys" - version = "0.2.23" + name = "libz-sys" + version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" ---- rustc-beta-src/src/tools/cargo/Cargo.toml.orig 2023-01-24 13:25:47.824917142 -0800 -+++ rustc-beta-src/src/tools/cargo/Cargo.toml 2023-01-24 13:26:29.209044200 -0800 -@@ -21,7 +21,7 @@ - cargo-platform = { path = "crates/cargo-platform", version = "0.1.2" } +--- rustc-beta-src/src/tools/cargo/Cargo.toml.orig 2023-03-23 17:10:30.812989303 -0700 ++++ rustc-beta-src/src/tools/cargo/Cargo.toml 2023-03-23 17:11:26.242836664 -0700 +@@ -23,7 +23,7 @@ cargo-util = { path = "crates/cargo-util", version = "0.2.3" } - crates-io = { path = "crates/crates-io", version = "0.35.0" } + clap = "4.1.3" + crates-io = { path = "crates/crates-io", version = "0.36.0" } -curl = { version = "0.4.44", features = ["http2"] } +curl = { version = "0.4.44", features = [] } curl-sys = "0.4.59" env_logger = "0.10.0" - pretty_env_logger = { version = "0.4", optional = true } ---- rustc-beta-src/src/tools/cargo/src/cargo/core/package.rs.orig 2023-01-21 17:17:19.000000000 -0800 -+++ rustc-beta-src/src/tools/cargo/src/cargo/core/package.rs 2023-01-24 13:25:47.824917142 -0800 -@@ -403,16 +403,9 @@ + filetime = "0.2.9" +--- rustc-beta-src/src/tools/cargo/src/cargo/core/package.rs.orig 2023-03-19 00:20:55.000000000 -0700 ++++ rustc-beta-src/src/tools/cargo/src/cargo/core/package.rs 2023-03-23 17:10:30.812989303 -0700 +@@ -401,16 +401,9 @@ sources: SourceMap<'cfg>, config: &'cfg Config, ) -> CargoResult> { @@ -58,18 +58,9 @@ Ok(PackageSet { packages: package_ids -@@ -658,7 +651,7 @@ - macro_rules! try_old_curl { - ($e:expr, $msg:expr) => { - let result = $e; -- if cfg!(target_os = "macos") { -+ if cfg!(any(target_os = "linux", target_os = "macos")) { - if let Err(e) = result { - warn!("ignoring libcurl {} error: {}", $msg, e); - } ---- rustc-beta-src/src/tools/cargo/src/cargo/sources/registry/http_remote.rs.orig 2023-01-21 17:17:19.000000000 -0800 -+++ rustc-beta-src/src/tools/cargo/src/cargo/sources/registry/http_remote.rs 2023-01-24 13:25:47.824917142 -0800 -@@ -223,16 +223,8 @@ +--- rustc-beta-src/src/tools/cargo/src/cargo/sources/registry/http_remote.rs.orig 2023-03-19 00:20:55.000000000 -0700 ++++ rustc-beta-src/src/tools/cargo/src/cargo/sources/registry/http_remote.rs 2023-03-23 17:10:30.813989282 -0700 +@@ -220,16 +220,8 @@ } self.fetch_started = true; @@ -88,3 +79,14 @@ self.config .shell() +--- rustc-beta-src/src/tools/cargo/src/cargo/util/network.rs.orig 2023-03-19 00:20:55.000000000 -0700 ++++ rustc-beta-src/src/tools/cargo/src/cargo/util/network.rs 2023-03-23 17:10:30.813989282 -0700 +@@ -116,7 +116,7 @@ + macro_rules! try_old_curl { + ($e:expr, $msg:expr) => { + let result = $e; +- if cfg!(target_os = "macos") { ++ if cfg!(any(target_os = "linux", target_os = "macos")) { + if let Err(e) = result { + warn!("ignoring libcurl {} error: {}", $msg, e); + }