From 04aa99912974f04e8c30a7fe9d05982072f8de81 Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Fri, 10 Dec 2021 16:07:08 +0000 Subject: [PATCH] import rust-1.56.1-2.module+el8.6.0+13527+64f2eba2 --- .gitignore | 3 +- .rust.metadata | 3 +- ...patch => rustc-1.56.0-disable-http2.patch} | 32 ++--- ...tch => rustc-1.56.0-disable-libssh2.patch} | 16 +-- SPECS/rust.spec | 110 ++++++++++++++---- 5 files changed, 118 insertions(+), 46 deletions(-) rename SOURCES/{rustc-1.53.0-disable-http2.patch => rustc-1.56.0-disable-http2.patch} (67%) rename SOURCES/{rustc-1.48.0-disable-libssh2.patch => rustc-1.56.0-disable-libssh2.patch} (66%) diff --git a/.gitignore b/.gitignore index 8bd8e61..70f2cb5 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ -SOURCES/rustc-1.54.0-src.tar.xz +SOURCES/rustc-1.56.1-src.tar.xz +SOURCES/wasi-libc-ad5133410f66b93a2381db5b542aad5e0964db96.tar.gz diff --git a/.rust.metadata b/.rust.metadata index b0db6af..f4d02f1 100644 --- a/.rust.metadata +++ b/.rust.metadata @@ -1 +1,2 @@ -1577242bee41fe6c1aee17d47ae791f4bfc1f8c3 SOURCES/rustc-1.54.0-src.tar.xz +a79516231c4391e37990bdda0efdafdc51697fab SOURCES/rustc-1.56.1-src.tar.xz +b8865d1192852214d6d9b0a0957d4b36c16832aa SOURCES/wasi-libc-ad5133410f66b93a2381db5b542aad5e0964db96.tar.gz diff --git a/SOURCES/rustc-1.53.0-disable-http2.patch b/SOURCES/rustc-1.56.0-disable-http2.patch similarity index 67% rename from SOURCES/rustc-1.53.0-disable-http2.patch rename to SOURCES/rustc-1.56.0-disable-http2.patch index 94040b3..3b3d0c8 100644 --- a/SOURCES/rustc-1.53.0-disable-http2.patch +++ b/SOURCES/rustc-1.56.0-disable-http2.patch @@ -1,6 +1,6 @@ ---- rustc-beta-src/Cargo.lock.orig 2021-06-04 15:56:04.141227630 -0700 -+++ rustc-beta-src/Cargo.lock 2021-06-04 16:03:04.461396826 -0700 -@@ -885,7 +885,6 @@ +--- rustc-1.56.0-src/Cargo.lock.orig 2021-10-19 18:03:53.928187581 -0700 ++++ rustc-1.56.0-src/Cargo.lock 2021-10-19 18:05:41.443522980 -0700 +@@ -877,7 +877,6 @@ dependencies = [ "cc", "libc", @@ -8,7 +8,7 @@ "libz-sys", "openssl-sys", "pkg-config", -@@ -1904,16 +1903,6 @@ +@@ -1907,16 +1906,6 @@ checksum = "7fc7aa29613bd6a620df431842069224d8bc9011086b1db4c0e0cd47fa03ec9a" [[package]] @@ -23,22 +23,22 @@ - -[[package]] name = "libz-sys" - version = "1.1.2" + version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" ---- rustc-beta-src/src/tools/cargo/Cargo.toml.orig 2021-06-04 15:56:04.143227587 -0700 -+++ rustc-beta-src/src/tools/cargo/Cargo.toml 2021-06-04 15:57:56.931857927 -0700 +--- rustc-1.56.0-src/src/tools/cargo/Cargo.toml.orig 2021-10-19 18:03:53.930187532 -0700 ++++ rustc-1.56.0-src/src/tools/cargo/Cargo.toml 2021-10-19 18:05:13.663211469 -0700 @@ -25,7 +25,7 @@ - cargo-util = { path = "crates/cargo-util", version = "0.1.0" } + cargo-util = { path = "crates/cargo-util", version = "0.1.1" } crates-io = { path = "crates/crates-io", version = "0.33.0" } crossbeam-utils = "0.8" --curl = { version = "0.4.23", features = ["http2"] } -+curl = { version = "0.4.23", features = [] } - curl-sys = "0.4.22" - env_logger = "0.8.1" +-curl = { version = "0.4.38", features = ["http2"] } ++curl = { version = "0.4.38", features = [] } + curl-sys = "0.4.48" + env_logger = "0.9.0" pretty_env_logger = { version = "0.4", optional = true } ---- rustc-beta-src/src/tools/cargo/src/cargo/core/package.rs.orig 2021-05-22 15:22:31.000000000 -0700 -+++ rustc-beta-src/src/tools/cargo/src/cargo/core/package.rs 2021-06-04 16:00:03.903190293 -0700 -@@ -416,14 +416,8 @@ +--- rustc-1.56.0-src/src/tools/cargo/src/cargo/core/package.rs.orig 2021-10-18 02:52:56.000000000 -0700 ++++ rustc-1.56.0-src/src/tools/cargo/src/cargo/core/package.rs 2021-10-19 18:03:53.931187507 -0700 +@@ -417,14 +417,8 @@ // Also note that pipelining is disabled as curl authors have indicated // that it's buggy, and we've empirically seen that it's buggy with HTTP // proxies. @@ -55,7 +55,7 @@ Ok(PackageSet { packages: package_ids -@@ -596,7 +590,7 @@ +@@ -653,7 +647,7 @@ macro_rules! try_old_curl { ($e:expr, $msg:expr) => { let result = $e; diff --git a/SOURCES/rustc-1.48.0-disable-libssh2.patch b/SOURCES/rustc-1.56.0-disable-libssh2.patch similarity index 66% rename from SOURCES/rustc-1.48.0-disable-libssh2.patch rename to SOURCES/rustc-1.56.0-disable-libssh2.patch index 6916e74..4d9331b 100644 --- a/SOURCES/rustc-1.48.0-disable-libssh2.patch +++ b/SOURCES/rustc-1.56.0-disable-libssh2.patch @@ -1,6 +1,6 @@ ---- rustc-1.48.0-src/Cargo.lock.orig 2020-11-16 06:01:53.000000000 -0800 -+++ rustc-1.48.0-src/Cargo.lock 2020-11-16 09:27:44.425104404 -0800 -@@ -1676,7 +1676,6 @@ +--- rustc-1.56.0-src/Cargo.lock.orig 2021-10-18 02:52:36.000000000 -0700 ++++ rustc-1.56.0-src/Cargo.lock 2021-10-19 18:00:47.999793566 -0700 +@@ -1895,7 +1895,6 @@ dependencies = [ "cc", "libc", @@ -8,7 +8,7 @@ "libz-sys", "openssl-sys", "pkg-config", -@@ -1693,20 +1692,6 @@ +@@ -1918,20 +1917,6 @@ ] [[package]] @@ -27,11 +27,11 @@ - -[[package]] name = "libz-sys" - version = "1.1.2" + version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" ---- rustc-1.48.0-src/vendor/git2/Cargo.toml.orig 2020-11-16 06:27:49.000000000 -0800 -+++ rustc-1.48.0-src/vendor/git2/Cargo.toml 2020-11-16 09:27:44.425104404 -0800 -@@ -49,7 +49,7 @@ +--- rustc-1.56.0-src/vendor/git2/Cargo.toml.orig 2021-10-18 04:05:54.000000000 -0700 ++++ rustc-1.56.0-src/vendor/git2/Cargo.toml 2021-10-19 17:57:37.960500359 -0700 +@@ -52,7 +52,7 @@ version = "0.1.39" [features] diff --git a/SPECS/rust.spec b/SPECS/rust.spec index 96a2b2d..339931b 100644 --- a/SPECS/rust.spec +++ b/SPECS/rust.spec @@ -1,6 +1,5 @@ # Only x86_64 and i686 are Tier 1 platforms at this time. # https://doc.rust-lang.org/nightly/rustc/platform-support.html -#global rust_arches x86_64 i686 armv7hl aarch64 ppc64 ppc64le s390x %global rust_arches x86_64 i686 aarch64 ppc64le s390x # The channel can be stable, beta, or nightly @@ -10,10 +9,10 @@ # e.g. 1.10.0 wants rustc: 1.9.0-2016-05-24 # or nightly wants some beta-YYYY-MM-DD # Note that cargo matches the program version here, not its crate version. -%global bootstrap_rust 1.53.0 -%global bootstrap_cargo 1.53.0 -%global bootstrap_channel 1.53.0 -%global bootstrap_date 2021-06-17 +%global bootstrap_rust 1.55.0 +%global bootstrap_cargo 1.55.0 +%global bootstrap_channel 1.55.0 +%global bootstrap_date 2021-09-09 # Only the specified arches will use bootstrap binaries. #global bootstrap_arches %%{rust_arches} @@ -27,10 +26,18 @@ # arch-specific package only for the supported arches. %ifnarch s390x %if 0%{?fedora} || 0%{?rhel} >= 8 -%global cross_targets wasm32-unknown-unknown +%global cross_targets wasm32-unknown-unknown wasm32-wasi %endif %endif +# We need CRT files for *-wasi targets, at least as new as the commit in +# src/ci/docker/host-x86_64/dist-various-2/build-wasi-toolchain.sh +%global wasi_libc_url https://github.com/WebAssembly/wasi-libc +%global wasi_libc_commit ad5133410f66b93a2381db5b542aad5e0964db96 +%global wasi_libc_name wasi-libc-%{wasi_libc_commit} +%global wasi_libc_source %{wasi_libc_url}/archive/%{wasi_libc_commit}/%{wasi_libc_name}.tar.gz +%global wasi_libc_dir %{_builddir}/%{wasi_libc_name} + # Using llvm-static may be helpful as an opt-in, e.g. to aid LLVM rebases. %bcond_with llvm_static @@ -66,7 +73,7 @@ %endif Name: rust -Version: 1.54.0 +Version: 1.56.1 Release: 2%{?dist} Summary: The Rust Programming Language License: (ASL 2.0 or MIT) and (BSD and MIT) @@ -80,8 +87,11 @@ ExclusiveArch: %{rust_arches} %global rustc_package rustc-%{channel}-src %endif Source0: https://static.rust-lang.org/dist/%{rustc_package}.tar.xz +Source1: %{wasi_libc_source} +# Sources for bootstrap_arches are inserted by lua below -# This internal rust-abi change broke s390x -- revert for now. +# An internal rust-abi change broke s390x, but it's fixed in LLVM 12.0.1. +# We'll revert the change on Fedora 33 that has an unpatched LLVM 11. # https://github.com/rust-lang/rust/issues/80810#issuecomment-781784032 Patch1: 0001-Revert-Auto-merge-of-79547.patch @@ -91,17 +101,16 @@ Patch2: 0001-Use-lld-provided-by-system-for-wasm.patch ### RHEL-specific patches below ### # Disable cargo->libgit2->libssh2 on RHEL, as it's not approved for FIPS (rhbz1732949) -Patch100: rustc-1.48.0-disable-libssh2.patch +Patch100: rustc-1.56.0-disable-libssh2.patch # libcurl on RHEL7 doesn't have http2, but since cargo requests it, curl-sys # will try to build it statically -- instead we turn off the feature. -Patch101: rustc-1.53.0-disable-http2.patch +Patch101: rustc-1.56.0-disable-http2.patch # kernel rh1410097 causes too-small stacks for PIE. # (affects RHEL6 kernels when building for RHEL7) Patch102: rustc-1.51.0-no-default-pie.patch - # Get the Rust triple for any arch. %{lua: function rust_triple(arch) local abi = "gnu" @@ -132,6 +141,7 @@ end} .."/rust-%{bootstrap_channel}") local target_arch = rpm.expand("%{_target_cpu}") for i, arch in ipairs(bootstrap_arches) do + i = 100 + i print(string.format("Source%d: %s-%s.tar.xz\n", i, base, rust_triple(arch))) if arch == target_arch then @@ -182,7 +192,8 @@ BuildRequires: %{python} %if %with bundled_llvm BuildRequires: cmake3 >= 3.13.4 -Provides: bundled(llvm) = 12.0.0 +BuildRequires: ninja-build +Provides: bundled(llvm) = 13.0.0 %else BuildRequires: cmake >= 2.8.11 %if 0%{?epel} == 7 @@ -261,10 +272,11 @@ BuildRequires: %{devtoolset_name}-gcc-c++ %global rustlibdir %{common_libdir}/rustlib %if %defined cross_targets +BuildRequires: clang # brp-strip-static-archive breaks the archive index for wasm %global __os_install_post \ %__os_install_post \ -find %{buildroot}%{rustlibdir} -type f -path '*/wasm*/lib/*.rlib' -exec llvm-ranlib '{}' ';' \ +find '%{buildroot}%{rustlibdir}' -type f -path '*/wasm*/lib/*.rlib' -print -exec '%{llvm_root}/bin/llvm-ranlib' '{}' ';' \ %{nil} %endif @@ -285,24 +297,30 @@ written in Rust. %if %defined cross_targets %{lua: do for triple in string.gmatch(rpm.expand("%{cross_targets}"), "%S+") do - local requires = rpm.expand("Requires: rust = %{version}-%{release}") - if string.sub(triple, 1, 4) == "wasm" then - requires = requires .. "\nRequires: lld >= 8.0" - end local subs = { triple = triple, - requires = requires, + verrel = rpm.expand("%{version}-%{release}"), + wasm = string.sub(triple, 1, 4) == "wasm" and 1 or 0, + wasi = string.find(triple, "-wasi") and 1 or 0, } local s = string.gsub([[ + %package std-static-{{triple}} Summary: Standard library for Rust # FIX: we can't be noarch while excluding s390x for lack of lld # BuildArch: noarch -{{requires}} +Requires: rust = {{verrel}} +%if {{wasm}} +Requires: lld >= 8.0 +%endif +%if {{wasi}} +Provides: bundled(wasi-libc) +%endif %description std-static-{{triple}} This package includes the standard libraries for building applications written in Rust for the {{triple}} target. + ]], "{{(%w+)}}", subs) print(s) end @@ -463,9 +481,17 @@ test -f '%{local_rust_root}/bin/cargo' test -f '%{local_rust_root}/bin/rustc' %endif +%if %defined cross_targets +%setup -q -n %{wasi_libc_name} -T -b 1 +%endif + %setup -q -n %{rustc_package} +%if 0%{?fedora} == 33 +# revert only for LLVM 11 %patch1 -p1 +%endif + %patch2 -p1 %if %with disabled_libssh2 @@ -574,6 +600,22 @@ if [ "$max_cpus" -ge 1 -a "$max_cpus" -lt "$ncpus" ]; then ncpus="$max_cpus" fi +%if %defined cross_targets +%make_build -C %{wasi_libc_dir} +%{lua: do + local wasi_root = rpm.expand("%{wasi_libc_dir}") .. "/sysroot" + local set_wasi_root = "" + for triple in string.gmatch(rpm.expand("%{cross_targets}"), "%S+") do + if string.find(triple, "-wasi") then + set_wasi_root = set_wasi_root .. " --set target." .. triple .. ".wasi-root=" .. wasi_root + end + end + if wasi_root ~= "" then + rpm.define("set_wasi_root "..set_wasi_root) + end +end} +%endif + %configure --disable-option-checking \ --libdir=%{common_libdir} \ --build=%{rust_triple} --host=%{rust_triple} --target=%{rust_triple} \ @@ -592,7 +634,8 @@ fi --tools=analysis,cargo,clippy,rls,rustfmt,src \ --enable-vendor \ --enable-verbose-tests \ - %{?codegen_units_std} \ + %{?set_wasi_root} \ + --dist-compression-formats=gz \ --release-channel=%{channel} \ --release-description="%{?fedora:Fedora }%{?rhel:Red Hat }%{version}-%{release}" @@ -689,6 +732,12 @@ rm -f %{buildroot}%{rustlibdir}/%{rust_triple}/bin/rust-ll* %check export %{rust_env} +# Sanity-check the installed binaries, debuginfo-stripped and all. +%{buildroot}%{_bindir}/cargo new build/hello-world +env RUSTC=%{buildroot}%{_bindir}/rustc \ + LD_LIBRARY_PATH="%{buildroot}%{_libdir}:$LD_LIBRARY_PATH" \ + %{buildroot}%{_bindir}/cargo run --manifest-path build/hello-world/Cargo.toml + # The results are not stable on koji, so mask errors and just log it. # Some of the larger test artifacts are manually cleaned to save space. %{python} ./x.py test --no-fail-fast --stage 2 || : @@ -698,7 +747,10 @@ rm -rf "./build/%{rust_triple}/test/" rm -rf "./build/%{rust_triple}/stage2-tools/%{rust_triple}/cit/" %{python} ./x.py test --no-fail-fast --stage 2 clippy || : + +env RLS_TEST_WAIT_FOR_AGES=1 \ %{python} ./x.py test --no-fail-fast --stage 2 rls || : + %{python} ./x.py test --no-fail-fast --stage 2 rustfmt || : @@ -732,13 +784,20 @@ rm -rf "./build/%{rust_triple}/stage2-tools/%{rust_triple}/cit/" local subs = { triple = triple, rustlibdir = rpm.expand("%{rustlibdir}"), + wasi = string.find(triple, "-wasi") and 1 or 0, } local s = string.gsub([[ + %files std-static-{{triple}} %dir {{rustlibdir}} %dir {{rustlibdir}}/{{triple}} %dir {{rustlibdir}}/{{triple}}/lib {{rustlibdir}}/{{triple}}/lib/*.rlib +%if {{wasi}} +%dir {{rustlibdir}}/{{triple}}/lib/self-contained +{{rustlibdir}}/{{triple}}/lib/self-contained/crt*.o +%endif + ]], "{{(%w+)}}", subs) print(s) end @@ -829,6 +888,17 @@ end} %changelog +* Thu Dec 02 2021 Josh Stone - 1.56.1-2 +- Add rust-std-static-wasm32-wasi + Resolves: rhbz#1980080 + +* Tue Nov 02 2021 Josh Stone - 1.56.0-1 +- Update to 1.56.1. + +* Fri Oct 29 2021 Josh Stone - 1.55.0-1 +- Update to 1.55.0. +- Backport support for LLVM 13. + * Tue Aug 17 2021 Josh Stone - 1.54.0-2 - Make std-static-wasm* arch-specific to avoid s390x.