From 198de9f9e39c0114e3f8c139e930e68d8c64f5a4 Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Nov 08 2022 06:40:54 +0000 Subject: import rust-1.62.1-1.module+el8.7.0+16002+ac58477b --- diff --git a/.gitignore b/.gitignore index 96cc5a3..91dc566 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,2 @@ -SOURCES/rustc-1.58.1-src.tar.xz -SOURCES/wasi-libc-ad5133410f66b93a2381db5b542aad5e0964db96.tar.gz +SOURCES/rustc-1.62.1-src.tar.xz +SOURCES/wasi-libc-9886d3d6200fcc3726329966860fc058707406cd.tar.gz diff --git a/.rust.metadata b/.rust.metadata index 9adc181..59abd03 100644 --- a/.rust.metadata +++ b/.rust.metadata @@ -1,2 +1,2 @@ -783cb359829e7ea508deae659837f9bb360e46c8 SOURCES/rustc-1.58.1-src.tar.xz -b8865d1192852214d6d9b0a0957d4b36c16832aa SOURCES/wasi-libc-ad5133410f66b93a2381db5b542aad5e0964db96.tar.gz +a7e0c2aa676d343f5980d37fd50ffaed9a35d458 SOURCES/rustc-1.62.1-src.tar.xz +22625595caa645e86282b79b5564abb40250d244 SOURCES/wasi-libc-9886d3d6200fcc3726329966860fc058707406cd.tar.gz diff --git a/SOURCES/0001-Use-lld-provided-by-system-for-wasm.patch b/SOURCES/0001-Use-lld-provided-by-system-for-wasm.patch index 681b21a..fa75ad3 100644 --- a/SOURCES/0001-Use-lld-provided-by-system-for-wasm.patch +++ b/SOURCES/0001-Use-lld-provided-by-system-for-wasm.patch @@ -1,4 +1,4 @@ -From 9ac837c237568a6c1c5f0e979fcce208cd9c926a Mon Sep 17 00:00:00 2001 +From b521511174b1a08dddfac243604d649b71cc7386 Mon Sep 17 00:00:00 2001 From: Ivan Mironov Date: Sun, 8 Dec 2019 17:23:08 +0500 Subject: [PATCH] Use lld provided by system for wasm @@ -8,7 +8,7 @@ Subject: [PATCH] Use lld provided by system for wasm 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/compiler/rustc_target/src/spec/wasm_base.rs b/compiler/rustc_target/src/spec/wasm_base.rs -index 4c954a1e567c..15c4f1bda5eb 100644 +index de7b7374af31..eebbe616e9b6 100644 --- a/compiler/rustc_target/src/spec/wasm_base.rs +++ b/compiler/rustc_target/src/spec/wasm_base.rs @@ -99,8 +99,7 @@ pub fn options() -> TargetOptions { @@ -16,11 +16,11 @@ index 4c954a1e567c..15c4f1bda5eb 100644 limit_rdylib_exports: false, - // we use the LLD shipped with the Rust toolchain by default -- linker: Some("rust-lld".to_owned()), -+ linker: Some("lld".to_owned()), +- linker: Some("rust-lld".into()), ++ linker: Some("lld".into()), lld_flavor: LldFlavor::Wasm, linker_is_gnu: false, -- -2.31.1 +2.35.1 diff --git a/SOURCES/macros.rust-toolset b/SOURCES/macros.rust-toolset new file mode 100644 index 0000000..41bb129 --- /dev/null +++ b/SOURCES/macros.rust-toolset @@ -0,0 +1,51 @@ +# Explicitly use bindir tools, in case others are in the PATH, +# like the rustup shims in a user's ~/.cargo/bin/. +# +# Since cargo 1.31, install only uses $CARGO_HOME/config, ignoring $PWD. +# https://github.com/rust-lang/cargo/issues/6397 +# But we can set CARGO_HOME locally, which is a good idea anyway to make sure +# it never writes to ~/.cargo during rpmbuild. +%__cargo %{_bindir}/env CARGO_HOME=.cargo %{_bindir}/cargo +%__rustc %{_bindir}/rustc +%__rustdoc %{_bindir}/rustdoc + +# Enable optimization, debuginfo, and link hardening. +%__global_rustflags -Copt-level=3 -Cdebuginfo=2 -Clink-arg=-Wl,-z,relro,-z,now + +%__global_rustflags_toml [%{lua: + for arg in string.gmatch(rpm.expand("%{__global_rustflags}"), "%S+") do + print('"' .. arg .. '", ') + end}] + +%cargo_prep(V:) (\ +%{__mkdir} -p .cargo \ +cat > .cargo/config << EOF \ +[build]\ +rustc = "%{__rustc}"\ +rustdoc = "%{__rustdoc}"\ +rustflags = %{__global_rustflags_toml}\ +\ +[install]\ +root = "%{buildroot}%{_prefix}"\ +\ +[term]\ +verbose = true\ +EOF\ +%if 0%{-V:1}\ +%{__tar} -xoaf %{S:%{-V*}}\ +cat >> .cargo/config << EOF \ +\ +[source.crates-io]\ +replace-with = "vendored-sources"\ +\ +[source.vendored-sources]\ +directory = "./vendor"\ +EOF\ +%endif\ +) + +%cargo_build %__cargo build --release %{?_smp_mflags} + +%cargo_test %__cargo test --release %{?_smp_mflags} --no-fail-fast + +%cargo_install %__cargo install --no-track --path . diff --git a/SOURCES/rustc-1.56.0-disable-libssh2.patch b/SOURCES/rustc-1.56.0-disable-libssh2.patch deleted file mode 100644 index 4d9331b..0000000 --- a/SOURCES/rustc-1.56.0-disable-libssh2.patch +++ /dev/null @@ -1,42 +0,0 @@ ---- 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", -- "libssh2-sys", - "libz-sys", - "openssl-sys", - "pkg-config", -@@ -1918,20 +1917,6 @@ - ] - - [[package]] --name = "libssh2-sys" --version = "0.2.19" --source = "registry+https://github.com/rust-lang/crates.io-index" --checksum = "ca46220853ba1c512fc82826d0834d87b06bcd3c2a42241b7de72f3d2fe17056" --dependencies = [ -- "cc", -- "libc", -- "libz-sys", -- "openssl-sys", -- "pkg-config", -- "vcpkg", --] -- --[[package]] - name = "libz-sys" - version = "1.1.3" - source = "registry+https://github.com/rust-lang/crates.io-index" ---- 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] --default = ["ssh", "https", "ssh_key_from_memory"] -+default = ["https"] - https = ["libgit2-sys/https", "openssl-sys", "openssl-probe"] - ssh = ["libgit2-sys/ssh"] - ssh_key_from_memory = ["libgit2-sys/ssh_key_from_memory"] diff --git a/SOURCES/rustc-1.58.0-disable-http2.patch b/SOURCES/rustc-1.58.0-disable-http2.patch deleted file mode 100644 index 215e0c7..0000000 --- a/SOURCES/rustc-1.58.0-disable-http2.patch +++ /dev/null @@ -1,66 +0,0 @@ ---- rustc-1.58.0-src/Cargo.lock.orig 2022-01-11 16:13:10.125323813 -0800 -+++ rustc-1.58.0-src/Cargo.lock 2022-01-11 16:22:54.313011908 -0800 -@@ -909,7 +909,6 @@ - dependencies = [ - "cc", - "libc", -- "libnghttp2-sys", - "libz-sys", - "openssl-sys", - "pkg-config", -@@ -1927,16 +1926,6 @@ - checksum = "7fc7aa29613bd6a620df431842069224d8bc9011086b1db4c0e0cd47fa03ec9a" - - [[package]] --name = "libnghttp2-sys" --version = "0.1.4+1.41.0" --source = "registry+https://github.com/rust-lang/crates.io-index" --checksum = "03624ec6df166e79e139a2310ca213283d6b3c30810c54844f307086d4488df1" --dependencies = [ -- "cc", -- "libc", --] -- --[[package]] - name = "libz-sys" - version = "1.1.3" - source = "registry+https://github.com/rust-lang/crates.io-index" ---- rustc-1.58.0-src/src/tools/cargo/Cargo.toml.orig 2022-01-11 16:13:10.127323771 -0800 -+++ rustc-1.58.0-src/src/tools/cargo/Cargo.toml 2022-01-11 16:14:50.721203730 -0800 -@@ -22,7 +22,7 @@ - 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.41", features = ["http2"] } -+curl = { version = "0.4.41", features = [] } - curl-sys = "0.4.50" - env_logger = "0.9.0" - pretty_env_logger = { version = "0.4", optional = true } ---- rustc-1.58.0-src/src/tools/cargo/src/cargo/core/package.rs.orig 2022-01-11 03:18:44.000000000 -0800 -+++ rustc-1.58.0-src/src/tools/cargo/src/cargo/core/package.rs 2022-01-11 16:13:10.127323771 -0800 -@@ -419,14 +419,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. -- let mut multi = Multi::new(); -- let multiplexing = config.http_config()?.multiplexing.unwrap_or(true); -- multi -- .pipelining(false, multiplexing) -- .with_context(|| "failed to enable multiplexing/pipelining in curl")?; -- -- // let's not flood crates.io with connections -- multi.set_max_host_connections(2)?; -+ let multi = Multi::new(); -+ let multiplexing = false; - - Ok(PackageSet { - packages: package_ids -@@ -655,7 +649,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); - } diff --git a/SOURCES/rustc-1.59.0-disable-libssh2.patch b/SOURCES/rustc-1.59.0-disable-libssh2.patch new file mode 100644 index 0000000..4afd67c --- /dev/null +++ b/SOURCES/rustc-1.59.0-disable-libssh2.patch @@ -0,0 +1,42 @@ +--- rustc-1.59.0-src/Cargo.lock.orig 2022-02-21 18:48:37.000000000 -0800 ++++ rustc-1.59.0-src/Cargo.lock 2022-02-22 10:16:10.381962862 -0800 +@@ -1935,7 +1935,6 @@ + dependencies = [ + "cc", + "libc", +- "libssh2-sys", + "libz-sys", + "openssl-sys", + "pkg-config", +@@ -1968,20 +1967,6 @@ + ] + + [[package]] +-name = "libssh2-sys" +-version = "0.2.23" +-source = "registry+https://github.com/rust-lang/crates.io-index" +-checksum = "b094a36eb4b8b8c8a7b4b8ae43b2944502be3e59cd87687595cf6b0a71b3f4ca" +-dependencies = [ +- "cc", +- "libc", +- "libz-sys", +- "openssl-sys", +- "pkg-config", +- "vcpkg", +-] +- +-[[package]] + name = "libz-sys" + version = "1.1.3" + source = "registry+https://github.com/rust-lang/crates.io-index" +--- rustc-1.59.0-src/vendor/git2/Cargo.toml.orig 2022-02-21 20:14:37.000000000 -0800 ++++ rustc-1.59.0-src/vendor/git2/Cargo.toml 2022-02-22 10:12:23.021772490 -0800 +@@ -51,7 +51,7 @@ + version = "0.1.39" + + [features] +-default = ["ssh", "https", "ssh_key_from_memory"] ++default = ["https"] + https = ["libgit2-sys/https", "openssl-sys", "openssl-probe"] + ssh = ["libgit2-sys/ssh"] + ssh_key_from_memory = ["libgit2-sys/ssh_key_from_memory"] diff --git a/SOURCES/rustc-1.61.0-rust-gdb-substitute-path.patch b/SOURCES/rustc-1.61.0-rust-gdb-substitute-path.patch new file mode 100644 index 0000000..b94e23e --- /dev/null +++ b/SOURCES/rustc-1.61.0-rust-gdb-substitute-path.patch @@ -0,0 +1,18 @@ +--- rustc-1.61.0-src/src/etc/rust-gdb.orig 2022-05-17 18:29:36.000000000 -0700 ++++ rustc-1.61.0-src/src/etc/rust-gdb 2022-05-18 11:18:13.732709661 -0700 +@@ -14,6 +14,9 @@ fi + RUSTC_SYSROOT="$("$RUSTC" --print=sysroot)" + GDB_PYTHON_MODULE_DIRECTORY="$RUSTC_SYSROOT/lib/rustlib/etc" + ++RUST_STD_BUILD="@BUILDDIR@/library/" ++RUST_STD_SRC="$RUSTC_SYSROOT/lib/rustlib/src/rust/library/" ++ + # Run GDB with the additional arguments that load the pretty printers + # Set the environment variable `RUST_GDB` to overwrite the call to a + # different/specific command (defaults to `gdb`). +@@ -21,4 +24,5 @@ RUST_GDB="${RUST_GDB:-gdb}" + PYTHONPATH="$PYTHONPATH:$GDB_PYTHON_MODULE_DIRECTORY" exec ${RUST_GDB} \ + --directory="$GDB_PYTHON_MODULE_DIRECTORY" \ + -iex "add-auto-load-safe-path $GDB_PYTHON_MODULE_DIRECTORY" \ ++ -iex "set substitute-path $RUST_STD_BUILD $RUST_STD_SRC" \ + "$@" diff --git a/SOURCES/rustc-1.62.0-disable-http2.patch b/SOURCES/rustc-1.62.0-disable-http2.patch new file mode 100644 index 0000000..71b019e --- /dev/null +++ b/SOURCES/rustc-1.62.0-disable-http2.patch @@ -0,0 +1,90 @@ +--- rustc-beta-src/Cargo.lock.orig 2022-06-22 14:03:26.309745526 -0700 ++++ rustc-beta-src/Cargo.lock 2022-06-22 14:03:26.310745506 -0700 +@@ -990,7 +990,6 @@ + dependencies = [ + "cc", + "libc", +- "libnghttp2-sys", + "libz-sys", + "openssl-sys", + "pkg-config", +@@ -2101,16 +2100,6 @@ + checksum = "7fc7aa29613bd6a620df431842069224d8bc9011086b1db4c0e0cd47fa03ec9a" + + [[package]] +-name = "libnghttp2-sys" +-version = "0.1.4+1.41.0" +-source = "registry+https://github.com/rust-lang/crates.io-index" +-checksum = "03624ec6df166e79e139a2310ca213283d6b3c30810c54844f307086d4488df1" +-dependencies = [ +- "cc", +- "libc", +-] +- +-[[package]] + 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 2022-06-22 14:03:26.310745506 -0700 ++++ rustc-beta-src/src/tools/cargo/Cargo.toml 2022-06-22 14:04:22.058596881 -0700 +@@ -22,7 +22,7 @@ + cargo-util = { path = "crates/cargo-util", version = "0.1.3" } + crates-io = { path = "crates/crates-io", version = "0.34.0" } + crossbeam-utils = "0.8" +-curl = { version = "0.4.41", features = ["http2"] } ++curl = { version = "0.4.41", features = [] } + curl-sys = "0.4.50" + env_logger = "0.9.0" + pretty_env_logger = { version = "0.4", optional = true } +--- rustc-beta-src/src/tools/cargo/src/cargo/sources/registry/http_remote.rs.orig 2022-06-13 07:34:54.000000000 -0700 ++++ rustc-beta-src/src/tools/cargo/src/cargo/sources/registry/http_remote.rs 2022-06-22 14:03:26.311745485 -0700 +@@ -183,16 +183,8 @@ + } + self.fetch_started = true; + +- // We've enabled the `http2` feature of `curl` in Cargo, so treat +- // failures here as fatal as it would indicate a build-time problem. +- self.multiplexing = self.config.http_config()?.multiplexing.unwrap_or(true); +- +- self.multi +- .pipelining(false, self.multiplexing) +- .with_context(|| "failed to enable multiplexing/pipelining in curl")?; +- +- // let's not flood the server with connections +- self.multi.set_max_host_connections(2)?; ++ // Multiplexing is disabled because the system libcurl doesn't support it. ++ self.multiplexing = false; + + self.config + .shell() +--- rustc-beta-src/src/tools/cargo/src/cargo/core/package.rs.orig 2022-06-13 07:34:54.000000000 -0700 ++++ rustc-beta-src/src/tools/cargo/src/cargo/core/package.rs 2022-06-22 14:03:26.311745485 -0700 +@@ -403,16 +403,9 @@ + sources: SourceMap<'cfg>, + config: &'cfg Config, + ) -> CargoResult> { +- // We've enabled the `http2` feature of `curl` in Cargo, so treat +- // failures here as fatal as it would indicate a build-time problem. +- let mut multi = Multi::new(); +- let multiplexing = config.http_config()?.multiplexing.unwrap_or(true); +- multi +- .pipelining(false, multiplexing) +- .with_context(|| "failed to enable multiplexing/pipelining in curl")?; +- +- // let's not flood crates.io with connections +- multi.set_max_host_connections(2)?; ++ // Multiplexing is disabled because the system libcurl doesn't support it. ++ let multi = Multi::new(); ++ let multiplexing = false; + + 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); + } diff --git a/SPECS/rust.spec b/SPECS/rust.spec index 5b3d412..8ab0681 100644 --- a/SPECS/rust.spec +++ b/SPECS/rust.spec @@ -6,15 +6,17 @@ %{!?channel: %global channel stable} # To bootstrap from scratch, set the channel and date from src/stage0.json -# e.g. 1.10.0 wants rustc: 1.9.0-2016-05-24 +# e.g. 1.59.0 wants rustc: 1.58.0-2022-01-13 # or nightly wants some beta-YYYY-MM-DD -# Note that cargo matches the program version here, not its crate version. -%global bootstrap_rust 1.57.0 -%global bootstrap_cargo 1.57.0 -%global bootstrap_channel 1.57.0 -%global bootstrap_date 2021-12-02 +%global bootstrap_version 1.61.0 +%global bootstrap_channel 1.61.0 +%global bootstrap_date 2022-05-19 # Only the specified arches will use bootstrap binaries. +# NOTE: Those binaries used to be uploaded with every new release, but that was +# a waste of lookaside cache space when they're most often unused. +# Run "spectool -g rust.spec" after changing this and then "fedpkg upload" to +# add them to sources. Remember to remove them again after the bootstrap build! #global bootstrap_arches %%{rust_arches} # Define a space-separated list of targets to ship rust-std-static-$triple for @@ -35,8 +37,9 @@ # 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 +# (updated per https://github.com/rust-lang/rust/pull/96907) %global wasi_libc_url https://github.com/WebAssembly/wasi-libc -%global wasi_libc_commit ad5133410f66b93a2381db5b542aad5e0964db96 +%global wasi_libc_commit 9886d3d6200fcc3726329966860fc058707406cd %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} @@ -47,13 +50,15 @@ # We can also choose to just use Rust's bundled LLVM, in case the system LLVM # is insufficient. Rust currently requires LLVM 12.0+. %global min_llvm_version 12.0.0 -%global bundled_llvm_version 13.0.0 +%global bundled_llvm_version 14.0.4 %bcond_with bundled_llvm -# Requires stable libgit2 1.3 -%global min_libgit2_version 1.3.0 -%global bundled_libgit2_version 1.3.0 -%if 0%{?fedora} >= 36 +# Requires stable libgit2 1.4, and not the next minor soname change. +# This needs to be consistent with the bindings in vendor/libgit2-sys. +%global min_libgit2_version 1.4.0 +%global next_libgit2_version 1.5.0~ +%global bundled_libgit2_version 1.4.2 +%if 0%{?fedora} >= 99 %bcond_with bundled_libgit2 %else %bcond_without bundled_libgit2 @@ -82,7 +87,7 @@ %endif Name: rust -Version: 1.58.1 +Version: 1.62.1 Release: 1%{?dist} Summary: The Rust Programming Language License: (ASL 2.0 or MIT) and (BSD and MIT) @@ -102,14 +107,20 @@ Source1: %{wasi_libc_source} # By default, rust tries to use "rust-lld" as a linker for WebAssembly. Patch1: 0001-Use-lld-provided-by-system-for-wasm.patch +# Set a substitute-path in rust-gdb for standard library sources. +Patch2: rustc-1.61.0-rust-gdb-substitute-path.patch + ### RHEL-specific patches below ### +# Simple rpm macros for rust-toolset (as opposed to full rust-packaging) +Source100: macros.rust-toolset + # Disable cargo->libgit2->libssh2 on RHEL, as it's not approved for FIPS (rhbz1732949) -Patch100: rustc-1.56.0-disable-libssh2.patch +Patch100: rustc-1.59.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.58.0-disable-http2.patch +Patch101: rustc-1.62.0-disable-http2.patch # kernel rh1410097 causes too-small stacks for PIE. # (affects RHEL6 kernels when building for RHEL7) @@ -142,31 +153,35 @@ end} for arch in string.gmatch(rpm.expand("%{bootstrap_arches}"), "%S+") do table.insert(bootstrap_arches, arch) end - local base = rpm.expand("https://static.rust-lang.org/dist/%{bootstrap_date}" - .."/rust-%{bootstrap_channel}") + local base = rpm.expand("https://static.rust-lang.org/dist/%{bootstrap_date}") + local channel = rpm.expand("%{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))) + i = 1000 + i * 3 + local suffix = channel.."-"..rust_triple(arch) + print(string.format("Source%d: %s/cargo-%s.tar.xz\n", i, base, suffix)) + print(string.format("Source%d: %s/rustc-%s.tar.xz\n", i+1, base, suffix)) + print(string.format("Source%d: %s/rust-std-%s.tar.xz\n", i+2, base, suffix)) if arch == target_arch then - rpm.define("bootstrap_source "..i) + rpm.define("bootstrap_source_cargo "..i) + rpm.define("bootstrap_source_rustc "..i+1) + rpm.define("bootstrap_source_std "..i+2) + rpm.define("bootstrap_suffix "..suffix) end end end} %endif %ifarch %{bootstrap_arches} -%global bootstrap_root rust-%{bootstrap_channel}-%{rust_triple} -%global local_rust_root %{_builddir}/%{bootstrap_root}/usr -Provides: bundled(%{name}-bootstrap) = %{bootstrap_rust} +%global local_rust_root %{_builddir}/rust-%{bootstrap_suffix} +Provides: bundled(%{name}-bootstrap) = %{bootstrap_version} %else -BuildRequires: cargo >= %{bootstrap_cargo} +BuildRequires: cargo >= %{bootstrap_version} %if 0%{?rhel} && 0%{?rhel} < 8 -BuildRequires: %{name} >= %{bootstrap_rust} +BuildRequires: %{name} >= %{bootstrap_version} BuildConflicts: %{name} > %{version} %else -BuildRequires: (%{name} >= %{bootstrap_rust} with %{name} <= %{version}) +BuildRequires: (%{name} >= %{bootstrap_version} with %{name} <= %{version}) %endif %global local_rust_root %{_prefix} %endif @@ -183,7 +198,7 @@ BuildRequires: pkgconfig(openssl) BuildRequires: pkgconfig(zlib) %if %{without bundled_libgit2} -BuildRequires: pkgconfig(libgit2) >= %{min_libgit2_version} +BuildRequires: (pkgconfig(libgit2) >= %{min_libgit2_version} with pkgconfig(libgit2) < %{next_libgit2_version}) %endif %if %{without disabled_libssh2} @@ -225,6 +240,9 @@ BuildRequires: procps-ng # debuginfo-gdb tests need gdb BuildRequires: gdb +# For src/test/run-make/static-pie +BuildRequires: glibc-static + # Virtual provides for folks who attempt "dnf install rustc" Provides: rustc = %{version}-%{release} Provides: rustc%{?_isa} = %{version}-%{release} @@ -285,16 +303,21 @@ BuildRequires: %{devtoolset_name}-gcc-c++ %if %defined mingw_targets BuildRequires: mingw32-filesystem >= 95 BuildRequires: mingw64-filesystem >= 95 +BuildRequires: mingw32-crt +BuildRequires: mingw64-crt BuildRequires: mingw32-gcc BuildRequires: mingw64-gcc +BuildRequires: mingw32-winpthreads-static +BuildRequires: mingw64-winpthreads-static %endif %if %defined wasm_targets BuildRequires: clang +BuildRequires: lld # 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' -print -exec '%{llvm_root}/bin/llvm-ranlib' '{}' ';' \ +find '%{buildroot}%{rustlibdir}'/wasm*/lib -type f -regex '.*\\.\\(a\\|rlib\\)' -print -exec '%{llvm_root}/bin/llvm-ranlib' '{}' ';' \ %{nil} %endif @@ -520,12 +543,30 @@ feature for the Rust standard library. The RLS (Rust Language Server) uses this data to provide information about the Rust standard library. +%if 0%{?rhel} && 0%{?rhel} >= 8 + +%package toolset +Summary: Rust Toolset +Requires: rust%{?_isa} = %{version}-%{release} +Requires: cargo%{?_isa} = %{version}-%{release} + +%description toolset +This is the metapackage for Rust Toolset, bringing in the Rust compiler, +the Cargo package manager, and a few convenience macros for rpm builds. + +%endif + + %prep %ifarch %{bootstrap_arches} -%setup -q -n %{bootstrap_root} -T -b %{bootstrap_source} -./install.sh --components=cargo,rustc,rust-std-%{rust_triple} \ - --prefix=%{local_rust_root} --disable-ldconfig +rm -rf %{local_rust_root} +%setup -q -n cargo-%{bootstrap_suffix} -T -b %{bootstrap_source_cargo} +./install.sh --prefix=%{local_rust_root} --disable-ldconfig +%setup -q -n rustc-%{bootstrap_suffix} -T -b %{bootstrap_source_rustc} +./install.sh --prefix=%{local_rust_root} --disable-ldconfig +%setup -q -n rust-std-%{bootstrap_suffix} -T -b %{bootstrap_source_std} +./install.sh --prefix=%{local_rust_root} --disable-ldconfig test -f '%{local_rust_root}/bin/cargo' test -f '%{local_rust_root}/bin/rustc' %endif @@ -537,6 +578,7 @@ test -f '%{local_rust_root}/bin/rustc' %setup -q -n %{rustc_package} %patch1 -p1 +%patch2 -p1 %if %with disabled_libssh2 %patch100 -p1 @@ -554,6 +596,9 @@ rm -rf vendor/libnghttp2-sys/ # Use our explicit python3 first sed -i.try-python -e '/^try python3 /i try "%{__python3}" "$@"' ./configure +# Set a substitute-path in rust-gdb for standard library sources. +sed -i.rust-src -e "s#@BUILDDIR@#$PWD#" ./src/etc/rust-gdb + %if %without bundled_llvm rm -rf src/llvm-project/ mkdir -p src/llvm-project/libunwind/ @@ -561,7 +606,8 @@ mkdir -p src/llvm-project/libunwind/ # Remove other unused vendored libraries rm -rf vendor/curl-sys/curl/ -rm -rf vendor/jemalloc-sys/jemalloc/ +rm -rf vendor/*jemalloc-sys*/jemalloc/ +rm -rf vendor/libmimalloc-sys/c_src/mimalloc/ rm -rf vendor/libssh2-sys/libssh2/ rm -rf vendor/libz-sys/src/zlib/ rm -rf vendor/libz-sys/src/zlib-ng/ @@ -639,14 +685,6 @@ if [ "$max_cpus" -ge 1 -a "$max_cpus" -lt "$ncpus" ]; then ncpus="$max_cpus" fi -%define target_config %{shrink: - --set target.%{rust_triple}.linker=%{__cc} - --set target.%{rust_triple}.cc=%{__cc} - --set target.%{rust_triple}.cxx=%{__cxx} - --set target.%{rust_triple}.ar=%{__ar} - --set target.%{rust_triple}.ranlib=%{__ranlib} -} - %if %defined mingw_targets %{lua: do local cfg = "" @@ -655,20 +693,21 @@ fi triple = triple, mingw = string.sub(triple, 1, 4) == "i686" and "mingw32" or "mingw64", } - local s = string.gsub([[%{shrink: + local s = string.gsub([[ --set target.{{triple}}.linker=%{{{mingw}}_cc} --set target.{{triple}}.cc=%{{{mingw}}_cc} --set target.{{triple}}.ar=%{{{mingw}}_ar} --set target.{{triple}}.ranlib=%{{{mingw}}_ranlib} - }]], "{{(%w+)}}", subs) + ]], "{{(%w+)}}", subs) cfg = cfg .. " " .. s end + cfg = string.gsub(cfg, "%s+", " ") rpm.define("mingw_target_config " .. cfg) end} %endif %if %defined wasm_targets -%make_build --quiet -C %{wasi_libc_dir} +%make_build --quiet -C %{wasi_libc_dir} CC=clang AR=llvm-ar NM=llvm-nm %{lua: do local wasi_root = rpm.expand("%{wasi_libc_dir}") .. "/sysroot" local cfg = "" @@ -684,14 +723,20 @@ end} %configure --disable-option-checking \ --libdir=%{common_libdir} \ --build=%{rust_triple} --host=%{rust_triple} --target=%{rust_triple} \ - %{target_config} \ + --set target.%{rust_triple}.linker=%{__cc} \ + --set target.%{rust_triple}.cc=%{__cc} \ + --set target.%{rust_triple}.cxx=%{__cxx} \ + --set target.%{rust_triple}.ar=%{__ar} \ + --set target.%{rust_triple}.ranlib=%{__ranlib} \ %{?mingw_target_config} \ %{?wasm_target_config} \ --python=%{__python3} \ --local-rust-root=%{local_rust_root} \ + --set build.rustfmt=/bin/true \ %{!?with_bundled_llvm: --llvm-root=%{llvm_root} \ %{!?llvm_has_filecheck: --disable-codegen-tests} \ %{!?with_llvm_static: --enable-llvm-link-shared } } \ + --disable-llvm-static-stdcpp \ --disable-rpath \ %{enable_debuginfo} \ --set rust.codegen-units-std=1 \ @@ -788,6 +833,11 @@ rm -f %{buildroot}%{rustlibdir}/etc/lldb_* # We don't want Rust copies of LLVM tools (rust-lld, rust-llvm-dwp) rm -f %{buildroot}%{rustlibdir}/%{rust_triple}/bin/rust-ll* +%if 0%{?rhel} && 0%{?rhel} >= 8 +# This allows users to build packages using Rust Toolset. +%{__install} -D -m 644 %{S:100} %{buildroot}%{rpmmacrodir}/macros.rust-toolset +%endif + %check %{export_rust_env} @@ -798,6 +848,13 @@ env RUSTC=%{buildroot}%{_bindir}/rustc \ LD_LIBRARY_PATH="%{buildroot}%{_libdir}:$LD_LIBRARY_PATH" \ %{buildroot}%{_bindir}/cargo run --manifest-path build/hello-world/Cargo.toml +# Try a build sanity-check for other targets +for triple in %{?mingw_targets} %{?wasm_targets}; do + env RUSTC=%{buildroot}%{_bindir}/rustc \ + LD_LIBRARY_PATH="%{buildroot}%{_libdir}:$LD_LIBRARY_PATH" \ + %{buildroot}%{_bindir}/cargo build --manifest-path build/hello-world/Cargo.toml --target=$triple +done + # 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. %{__python3} ./x.py test --no-fail-fast --stage 2 || : @@ -921,7 +978,6 @@ end} %{_docdir}/%{name}/html/*.js %{_docdir}/%{name}/html/*.png %{_docdir}/%{name}/html/*.svg -%{_docdir}/%{name}/html/*.woff %{_docdir}/%{name}/html/*.woff2 %license %{_docdir}/%{name}/html/*.txt %license %{_docdir}/%{name}/html/*.md @@ -974,7 +1030,32 @@ end} %{rustlibdir}/%{rust_triple}/analysis/ +%if 0%{?rhel} && 0%{?rhel} >= 8 +%files toolset +%{rpmmacrodir}/macros.rust-toolset +%endif + + %changelog +* Tue Jul 19 2022 Josh Stone - 1.62.1-1 +- Update to 1.62.1. + +* Wed Jul 13 2022 Josh Stone - 1.62.0-2 +- Prevent unsound coercions from functions with opaque return types. + +* Thu Jun 30 2022 Josh Stone - 1.62.0-1 +- Update to 1.62.0. + +* Fri Jun 03 2022 Josh Stone - 1.61.0-1 +- Update to 1.61.0. +- Add rust-toolset as a subpackage. + +* Wed Apr 20 2022 Josh Stone - 1.60.0-1 +- Update to 1.60.0. + +* Tue Apr 19 2022 Josh Stone - 1.59.0-1 +- Update to 1.59.0. + * Thu Jan 20 2022 Josh Stone - 1.58.1-1 - Update to 1.58.1.