Update to 1.74.1.

Related: RHEL-12963
This commit is contained in:
Josh Stone 2024-01-03 16:33:01 -08:00
parent 46e57ff1eb
commit ee38ce6167
11 changed files with 317 additions and 229 deletions

2
.gitignore vendored
View File

@ -408,3 +408,5 @@
/rustc-1.72.1-src.tar.xz
/wasi-libc-bd950eb128bff337153de217b11270f948d04bb4.tar.gz
/rustc-1.73.0-src.tar.xz
/rustc-1.74.0-src.tar.xz
/rustc-1.74.1-src.tar.xz

View File

@ -1,30 +0,0 @@
From 35187c7e6474d346eea3113c4ae34d26d6b18756 Mon Sep 17 00:00:00 2001
From: Josh Stone <jistone@redhat.com>
Date: Tue, 22 Aug 2023 10:42:12 -0700
Subject: [PATCH] Skip ExpandYamlAnchors when the config is missing
The dist-src tarball does not include `.github/` at all, so we can't
check whether it needs to be regenerated.
---
src/bootstrap/test.rs | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/src/bootstrap/test.rs b/src/bootstrap/test.rs
index db3b7ffbea4e..d1018978f78c 100644
--- a/src/bootstrap/test.rs
+++ b/src/bootstrap/test.rs
@@ -1174,6 +1174,11 @@ impl Step for ExpandYamlAnchors {
/// appropriate configuration for all our CI providers. This step ensures the tool was called
/// by the user before committing CI changes.
fn run(self, builder: &Builder<'_>) {
+ // Note: `.github/` is not included in dist-src tarballs
+ if !builder.src.join(".github/workflows/ci.yml").exists() {
+ builder.info("Skipping YAML anchors check: GitHub Actions config not found");
+ return;
+ }
builder.info("Ensuring the YAML anchors in the GitHub Actions config were expanded");
builder.run_delaying_failure(
&mut builder.tool_cmd(Tool::ExpandYamlAnchors).arg("check").arg(&builder.src),
--
2.41.0

View File

@ -1,3 +1,14 @@
From b6ca6a363a7c91136c723a21fda4816d3009e479 Mon Sep 17 00:00:00 2001
From: Josh Stone <jistone@redhat.com>
Date: Wed, 1 Nov 2023 15:21:15 -0700
Subject: [PATCH] Use lld provided by system
---
compiler/rustc_target/src/spec/wasm_base.rs | 3 +--
compiler/rustc_target/src/spec/x86_64_unknown_none.rs | 2 +-
compiler/rustc_target/src/spec/x86_64_unknown_uefi.rs | 1 +
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/compiler/rustc_target/src/spec/wasm_base.rs b/compiler/rustc_target/src/spec/wasm_base.rs
index 341763aadbaf..ee6358e72955 100644
--- a/compiler/rustc_target/src/spec/wasm_base.rs
@ -26,14 +37,17 @@ index fe3b24f2d4af..1f1731d202ca 100644
"-mmx,-sse,-sse2,-sse3,-ssse3,-sse4.1,-sse4.2,-3dnow,-3dnowa,-avx,-avx2,+soft-float"
.into(),
diff --git a/compiler/rustc_target/src/spec/x86_64_unknown_uefi.rs b/compiler/rustc_target/src/spec/x86_64_unknown_uefi.rs
index 67664a74710a..53153cd120a3 100644
index 41ba768068a3..2eea4c76f1ca 100644
--- a/compiler/rustc_target/src/spec/x86_64_unknown_uefi.rs
+++ b/compiler/rustc_target/src/spec/x86_64_unknown_uefi.rs
@@ -12,6 +12,7 @@ pub fn target() -> Target {
base.cpu = "x86-64".into();
@@ -13,6 +13,7 @@ pub fn target() -> Target {
base.plt_by_default = false;
base.max_atomic_width = Some(64);
base.entry_abi = Conv::X86_64Win64;
+ base.linker = Some("lld".into());
// We disable MMX and SSE for now, even though UEFI allows using them. Problem is, you have to
// enable these CPU features explicitly before their first use, otherwise their instructions
--
2.41.0

View File

@ -1,4 +1,4 @@
From 19c37083cdae94105f6429350dd0b6617e3c2d56 Mon Sep 17 00:00:00 2001
From 4acc7d53182cf83f2c776c4005fc12756ecdfe8f Mon Sep 17 00:00:00 2001
From: Josh Stone <jistone@redhat.com>
Date: Thu, 28 Sep 2023 18:14:28 -0700
Subject: [PATCH 1/2] bootstrap: allow disabling target self-contained
@ -11,10 +11,10 @@ Subject: [PATCH 1/2] bootstrap: allow disabling target self-contained
4 files changed, 22 insertions(+)
diff --git a/config.example.toml b/config.example.toml
index 0c65b25fe138..6a0f1c01c328 100644
index f3c2366d674e..c6c5e24fb592 100644
--- a/config.example.toml
+++ b/config.example.toml
@@ -789,6 +789,11 @@ changelog-seen = 2
@@ -798,6 +798,11 @@ changelog-seen = 2
# target triples containing `-none`, `nvptx`, `switch`, or `-uefi`.
#no-std = <platform-specific> (bool)
@ -27,10 +27,10 @@ index 0c65b25fe138..6a0f1c01c328 100644
# Distribution options
#
diff --git a/src/bootstrap/compile.rs b/src/bootstrap/compile.rs
index 14c3ef79a78f..7adbf091acbb 100644
index 292ccc5780fa..d4d79ce982af 100644
--- a/src/bootstrap/compile.rs
+++ b/src/bootstrap/compile.rs
@@ -263,6 +263,10 @@ fn copy_self_contained_objects(
@@ -251,6 +251,10 @@ fn copy_self_contained_objects(
compiler: &Compiler,
target: TargetSelection,
) -> Vec<(PathBuf, DependencyType)> {
@ -42,10 +42,10 @@ index 14c3ef79a78f..7adbf091acbb 100644
t!(fs::create_dir_all(&libdir_self_contained));
let mut target_deps = vec![];
diff --git a/src/bootstrap/config.rs b/src/bootstrap/config.rs
index fe932fd6bd30..a626badc3e8a 100644
index 836328f94ef8..4ae3d853ed88 100644
--- a/src/bootstrap/config.rs
+++ b/src/bootstrap/config.rs
@@ -541,6 +541,7 @@ pub struct Target {
@@ -527,6 +527,7 @@ pub struct Target {
pub wasi_root: Option<PathBuf>,
pub qemu_rootfs: Option<PathBuf>,
pub no_std: bool,
@ -53,8 +53,8 @@ index fe932fd6bd30..a626badc3e8a 100644
}
impl Target {
@@ -553,6 +554,9 @@ pub fn from_triple(triple: &str) -> Self {
{
@@ -535,6 +536,9 @@ pub fn from_triple(triple: &str) -> Self {
if triple.contains("-none") || triple.contains("nvptx") || triple.contains("switch") {
target.no_std = true;
}
+ if triple.contains("-musl") || triple.contains("-wasi") || triple.contains("-windows-gnu") {
@ -63,7 +63,7 @@ index fe932fd6bd30..a626badc3e8a 100644
target
}
}
@@ -999,6 +1003,7 @@ struct TomlTarget {
@@ -1033,6 +1037,7 @@ struct TomlTarget {
wasi_root: Option<String> = "wasi-root",
qemu_rootfs: Option<String> = "qemu-rootfs",
no_std: Option<bool> = "no-std",
@ -71,7 +71,7 @@ index fe932fd6bd30..a626badc3e8a 100644
}
}
@@ -1524,6 +1529,9 @@ fn get_table(option: &str) -> Result<TomlConfig, toml::de::Error> {
@@ -1587,6 +1592,9 @@ fn get_table(option: &str) -> Result<TomlConfig, toml::de::Error> {
if let Some(s) = cfg.no_std {
target.no_std = s;
}
@ -82,10 +82,10 @@ index fe932fd6bd30..a626badc3e8a 100644
target.ndk.as_ref().map(|ndk| ndk_compiler(Language::C, &triple, ndk))
});
diff --git a/src/bootstrap/lib.rs b/src/bootstrap/lib.rs
index 0a7aff62257a..9b7c18a3353f 100644
index 8b8d4b237953..c3e7a1ccc00f 100644
--- a/src/bootstrap/lib.rs
+++ b/src/bootstrap/lib.rs
@@ -1285,6 +1285,11 @@ fn no_std(&self, target: TargetSelection) -> Option<bool> {
@@ -1320,6 +1320,11 @@ fn no_std(&self, target: TargetSelection) -> Option<bool> {
self.config.target_config.get(&target).map(|t| t.no_std)
}

View File

@ -1,33 +0,0 @@
From 1c6d867d78475fd8c6274e2b64ebb27735b6cabf Mon Sep 17 00:00:00 2001
From: Josh Stone <jistone@redhat.com>
Date: Sat, 26 Aug 2023 11:50:16 -0700
Subject: [PATCH] wasi: round up the size for `aligned_alloc`
C11 `aligned_alloc` requires that the size be a multiple of the
alignment. This is enforced in the wasi-libc emmalloc implementation,
which always returns NULL if the size is not a multiple.
(The default `MALLOC_IMPL=dlmalloc` does not currently check this.)
---
library/std/src/sys/unix/alloc.rs | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/library/std/src/sys/unix/alloc.rs b/library/std/src/sys/unix/alloc.rs
index 8604b53983d6..af0089978ecb 100644
--- a/library/std/src/sys/unix/alloc.rs
+++ b/library/std/src/sys/unix/alloc.rs
@@ -86,7 +86,11 @@ unsafe fn aligned_malloc(layout: &Layout) -> *mut u8 {
} else if #[cfg(target_os = "wasi")] {
#[inline]
unsafe fn aligned_malloc(layout: &Layout) -> *mut u8 {
- libc::aligned_alloc(layout.align(), layout.size()) as *mut u8
+ // C11 aligned_alloc requires that the size be a multiple of the alignment.
+ // Layout already checks that the size rounded up doesn't overflow isize::MAX.
+ let align = layout.align();
+ let size = layout.size().next_multiple_of(align);
+ libc::aligned_alloc(align, size) as *mut u8
}
} else {
#[inline]
--
2.41.0

View File

@ -1,4 +1,4 @@
From 3016b2b7052d8b01d50c3a3c6591aeb99d918ca3 Mon Sep 17 00:00:00 2001
From 461f64c60ec897d8e9caa85190ac27fe81871ebf Mon Sep 17 00:00:00 2001
From: Josh Stone <jistone@redhat.com>
Date: Thu, 28 Sep 2023 18:18:16 -0700
Subject: [PATCH 2/2] set an external library path for wasm32-wasi
@ -10,10 +10,10 @@ Subject: [PATCH 2/2] set an external library path for wasm32-wasi
3 files changed, 16 insertions(+), 1 deletion(-)
diff --git a/compiler/rustc_codegen_ssa/src/back/link.rs b/compiler/rustc_codegen_ssa/src/back/link.rs
index b603a8787460..40d878b64479 100644
index c4a0f6291e7f..9421f2fda303 100644
--- a/compiler/rustc_codegen_ssa/src/back/link.rs
+++ b/compiler/rustc_codegen_ssa/src/back/link.rs
@@ -1475,6 +1475,12 @@ fn get_object_file_path(sess: &Session, name: &str, self_contained: bool) -> Pat
@@ -1490,6 +1490,12 @@ fn get_object_file_path(sess: &Session, name: &str, self_contained: bool) -> Pat
return file_path;
}
}
@ -26,7 +26,7 @@ index b603a8787460..40d878b64479 100644
for search_path in fs.search_paths() {
let file_path = search_path.dir.join(name);
if file_path.exists() {
@@ -1967,6 +1973,9 @@ fn add_library_search_dirs(cmd: &mut dyn Linker, sess: &Session, self_contained:
@@ -1982,6 +1988,9 @@ fn add_library_search_dirs(cmd: &mut dyn Linker, sess: &Session, self_contained:
let lib_path = sess.target_filesearch(PathKind::All).get_self_contained_lib_path();
cmd.include_path(&fix_windows_verbatim_for_gcc(&lib_path));
}
@ -37,10 +37,10 @@ index b603a8787460..40d878b64479 100644
/// Add options making relocation sections in the produced ELF files read-only
diff --git a/compiler/rustc_target/src/spec/mod.rs b/compiler/rustc_target/src/spec/mod.rs
index 2365dfaf1af8..35f3a686cf67 100644
index 1bcb1f353159..33d9c54922cb 100644
--- a/compiler/rustc_target/src/spec/mod.rs
+++ b/compiler/rustc_target/src/spec/mod.rs
@@ -1653,6 +1653,7 @@ pub struct TargetOptions {
@@ -1701,6 +1701,7 @@ pub struct TargetOptions {
/// Objects to link before and after all other object code.
pub pre_link_objects: CrtObjects,
pub post_link_objects: CrtObjects,
@ -48,7 +48,7 @@ index 2365dfaf1af8..35f3a686cf67 100644
/// Same as `(pre|post)_link_objects`, but when self-contained linking mode is enabled.
pub pre_link_objects_self_contained: CrtObjects,
pub post_link_objects_self_contained: CrtObjects,
@@ -2124,6 +2125,7 @@ fn default() -> TargetOptions {
@@ -2175,6 +2176,7 @@ fn default() -> TargetOptions {
relro_level: RelroLevel::None,
pre_link_objects: Default::default(),
post_link_objects: Default::default(),

View File

@ -5,17 +5,55 @@
# 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
%__cargo /usr/bin/env CARGO_HOME=.cargo RUSTFLAGS='%{build_rustflags}' /usr/bin/cargo
%__rustc /usr/bin/rustc
%__rustdoc /usr/bin/rustdoc
# Enable optimization, debuginfo, and link hardening.
%__global_rustflags -Copt-level=3 -Cdebuginfo=2 -Clink-arg=-Wl,-z,relro,-z,now
# rustflags_opt_level: default optimization level
#
# It corresponds to the "-Copt-level" rustc command line option.
%rustflags_opt_level 3
%__global_rustflags_toml [%{lua:
for arg in string.gmatch(rpm.expand("%{__global_rustflags}"), "%S+") do
print('"' .. arg .. '", ')
end}]
# rustflags_debuginfo: default verbosity of debug information
#
# It corresponds to the "-Cdebuginfo" rustc command line option.
# In some cases, it might be required to override this macro with "1" or even
# "0", if memory usage gets too high during builds on some resource-constrained
# architectures (most likely on 32-bit architectures), which will however
# reduce the quality of the produced debug symbols.
%rustflags_debuginfo 2
# rustflags_codegen_units: default number of parallel code generation units
#
# The default value of "1" results in generation of better code, but comes at
# the cost of longer build times.
%rustflags_codegen_units 1
# build_rustflags: default compiler flags for rustc (RUSTFLAGS)
#
# -Copt-level: set optimization level (default: highest optimization level)
# -Cdebuginfo: set debuginfo verbosity (default: full debug information)
# -Ccodegen-units: set number of parallel code generation units (default: 1)
# -Cforce-frame-pointers: force inclusion of frame pointers (default: enabled
# on x86_64 and aarch64 on Fedora 37+)
#
# Additionally, some linker flags are set which correspond to the default
# Fedora compiler flags for hardening and for embedding package versions into
# compiled binaries.
#
# ref. https://doc.rust-lang.org/rustc/codegen-options/index.html
%build_rustflags %{shrink:
-Copt-level=%rustflags_opt_level
-Cdebuginfo=%rustflags_debuginfo
-Ccodegen-units=%rustflags_codegen_units
%{expr:0%{?_include_frame_pointers} && ("%{_arch}" != "ppc64le" && "%{_arch}" != "s390x" && "%{_arch}" != "i386") ? "-Cforce-frame-pointers=yes" : ""}
%[0%{?_package_note_status} ? "-Clink-arg=%_package_note_flags" : ""]
}
# __cargo_common_opts: common command line flags for cargo
#
# _smp_mflags: run builds and tests in parallel
%__cargo_common_opts %{?_smp_mflags}
%cargo_prep(V:) (\
%{__mkdir} -p .cargo \
@ -23,7 +61,11 @@ cat > .cargo/config << EOF \
[build]\
rustc = "%{__rustc}"\
rustdoc = "%{__rustdoc}"\
rustflags = %{__global_rustflags_toml}\
\
[env]\
CFLAGS = "%{build_cflags}"\
CXXFLAGS = "%{build_cxxflags}"\
LDFLAGS = "%{build_ldflags}"\
\
[install]\
root = "%{buildroot}%{_prefix}"\
@ -44,8 +86,104 @@ EOF\
%endif\
)
%cargo_build %__cargo build --release %{?_smp_mflags}
# __cargo_parse_opts: function-like macro which parses common flags into the
# equivalent command-line flags for cargo
%__cargo_parse_opts(naf:) %{shrink:\
%{-f:%{-a:%{error:Can't specify both -f(%{-f*}) and -a}}} \
%{-n:--no-default-features} \
%{-a:--all-features} \
%{-f:--features %{-f*}} \
%{nil}
}
%cargo_test %__cargo test --release %{?_smp_mflags} --no-fail-fast
# NB: cargo_build/test/install do not use the -n/-a/-f argument parsing like
# Fedora's rust-packaging, because that change would break anyone that's
# already passing arguments directly to cargo after the macro. Instead, one can
# explicitly use --no-default-features, --all-features, or --features XYZ.
%cargo_install %__cargo install --no-track --path .
# cargo_build: builds the crate with cargo
%cargo_build \
%{shrink:\
%{__cargo} build \
%{__cargo_common_opts} \
--release \
}
# cargo_test: runs the test suite with cargo
#
# To pass command-line arguments to the cargo test runners directly (for
# example, to skip certain tests during package builds), the
# "cargo test" argument parsing need to be bypassed,
# i.e. "%%cargo_test -- --skip foo" for skipping all tests with names that
# match "foo".
%cargo_test \
%{shrink:\
%{__cargo} test \
%{__cargo_common_opts} \
--release \
--no-fail-fast \
}
# cargo_install: install files into the buildroot
#
# For "binary" crates, this macro installs all "bin" build targets to _bindir
# inside the buildroot. The "--no-track" option prevents the creation of the
# "$CARGO_HOME/.crates.toml" file, which is used to keep track of which version
# of a specific binary has been installed, but which conflicts between builds
# of different Rust applications and is not needed when building RPM packages.
%cargo_install \
%{shrink: \
%{__cargo} install \
%{__cargo_common_opts} \
--no-track \
--path . \
} \
# cargo_license: print license information for all crate dependencies
#
# The "no-build,no-dev,no-proc-macro" argument results in only crates which are
# linked into the final binary to be considered.
#
# Additionally, deprecated SPDX syntax ("/" instead of "OR") is normalized
# before sorting the results to ensure reproducible output of this macro.
#
# This macro must be called with the same feature flags as other cargo macros,
# in particular, "cargo_build", otherwise its output will be incomplete.
#
# The "cargo tree" command called by this macro will fail if there are missing
# (optional) dependencies.
%cargo_license(naf:)\
%{shrink:\
%{__cargo} tree \
--workspace \
--offline \
--edges no-build,no-dev,no-proc-macro \
--no-dedupe \
--target all \
%{__cargo_parse_opts %{-n} %{-a} %{-f:-f%{-f*}}} \
--prefix none \
--format "{l}: {p}" \
| sed -e "s: ($(pwd)[^)]*)::g" -e "s: / :/:g" -e "s:/: OR :g" \
| sort -u
}
# cargo_license_summary: print license summary for all crate dependencies
#
# This macro works in the same way as cargo_license, except that it only prints
# a list of licenses, and not the complete license information for every crate
# in the dependency tree. This is useful for determining the correct License
# tag for packages that contain compiled Rust binaries.
%cargo_license_summary(naf:)\
%{shrink:\
%{__cargo} tree \
--workspace \
--offline \
--edges no-build,no-dev,no-proc-macro \
--no-dedupe \
--target all \
%{__cargo_parse_opts %{-n} %{-a} %{-f:-f%{-f*}}} \
--prefix none \
--format "# {l}" \
| sed -e "s: / :/:g" -e "s:/: OR :g" \
| sort -u \
}

171
rust.spec
View File

@ -1,16 +1,22 @@
Name: rust
Version: 1.74.1
Release: 1%{?dist}
Summary: The Rust Programming Language
License: (Apache-2.0 OR MIT) AND (Artistic-2.0 AND BSD-3-Clause AND ISC AND MIT AND MPL-2.0 AND Unicode-DFS-2016)
# ^ written as: (rust itself) and (bundled libraries)
URL: https://www.rust-lang.org
# Only x86_64, i686, and aarch64 are Tier 1 platforms at this time.
# https://doc.rust-lang.org/nightly/rustc/platform-support.html
%global rust_arches x86_64 i686 aarch64 ppc64le s390x
# The channel can be stable, beta, or nightly
%{!?channel: %global channel stable}
ExclusiveArch: %{rust_arches}
# To bootstrap from scratch, set the channel and date from src/stage0.json
# e.g. 1.59.0 wants rustc: 1.58.0-2022-01-13
# or nightly wants some beta-YYYY-MM-DD
%global bootstrap_version 1.72.0
%global bootstrap_channel 1.72.0
%global bootstrap_date 2023-08-24
%global bootstrap_version 1.73.0
%global bootstrap_channel 1.73.0
%global bootstrap_date 2023-10-05
# Only the specified arches will use bootstrap binaries.
# NOTE: Those binaries used to be uploaded with every new release, but that was
@ -57,22 +63,20 @@
# We can also choose to just use Rust's bundled LLVM, in case the system LLVM
# is insufficient. Rust currently requires LLVM 15.0+.
%global min_llvm_version 15.0.0
%global bundled_llvm_version 17.0.2
%global bundled_llvm_version 17.0.4
%bcond_with bundled_llvm
# Requires stable libgit2 1.6, and not the next minor soname change.
# Requires stable libgit2 1.7, and not the next minor soname change.
# This needs to be consistent with the bindings in vendor/libgit2-sys.
%global min_libgit2_version 1.6.4
%global next_libgit2_version 1.7.0~
%global bundled_libgit2_version 1.6.4
%if 0%{?fedora} >= 38
%global min_libgit2_version 1.7.1
%global next_libgit2_version 1.8.0~
%global bundled_libgit2_version 1.7.1
%if 0%{?fedora} >= 39
%bcond_with bundled_libgit2
%else
%bcond_without bundled_libgit2
%endif
# needs libssh2_userauth_publickey_frommemory
%global min_libssh2_version 1.6.0
%if 0%{?rhel}
# Disable cargo->libgit2->libssh2 on RHEL, as it's not approved for FIPS (rhbz1732949)
%bcond_without disabled_libssh2
@ -80,20 +84,20 @@
%bcond_with disabled_libssh2
%endif
Name: rust
Version: 1.73.0
Release: 1%{?dist}
Summary: The Rust Programming Language
License: (Apache-2.0 OR MIT) AND (Artistic-2.0 AND BSD-3-Clause AND ISC AND MIT AND MPL-2.0 AND Unicode-DFS-2016)
# ^ written as: (rust itself) and (bundled libraries)
URL: https://www.rust-lang.org
ExclusiveArch: %{rust_arches}
%if "%{channel}" == "stable"
%global rustc_package rustc-%{version}-src
%if 0%{?__isa_bits} == 32
# Disable PGO on 32-bit to reduce build memory
%bcond_with rustc_pgo
%else
%global rustc_package rustc-%{channel}-src
%bcond_without rustc_pgo
%endif
# Detect non-stable channels from the version, like 1.74.0~beta.1
%{lua: do
local version = rpm.expand("%{version}")
local version_channel, subs = string.gsub(version, "^.*~(%w+).*$", "%1", 1)
rpm.define("channel " .. (subs ~= 0 and version_channel or "stable"))
rpm.define("rustc_package rustc-" .. version_channel .. "-src")
end}
Source0: https://static.rust-lang.org/dist/%{rustc_package}.tar.xz
Source1: %{wasi_libc_source}
# Sources for bootstrap_arches are inserted by lua below
@ -114,21 +118,13 @@ Patch3: 0001-Let-environment-variables-override-some-default-CPUs.patch
Patch4: 0001-bootstrap-allow-disabling-target-self-contained.patch
Patch5: 0002-set-an-external-library-path-for-wasm32-wasi.patch
# The dist-src tarball doesn't include .github/
# https://github.com/rust-lang/rust/pull/115109
Patch6: 0001-Skip-ExpandYamlAnchors-when-the-config-is-missing.patch
# wasi: round up the size for aligned_alloc
# https://github.com/rust-lang/rust/pull/115254
Patch7: 0001-wasi-round-up-the-size-for-aligned_alloc.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.73.0-disable-libssh2.patch
Patch100: rustc-1.74.0-disable-libssh2.patch
# Get the Rust triple for any arch.
%{lua: function rust_triple(arch)
@ -205,7 +201,7 @@ BuildRequires: (pkgconfig(libgit2) >= %{min_libgit2_version} with pkgconfig(lib
%endif
%if %{without disabled_libssh2}
BuildRequires: pkgconfig(libssh2) >= %{min_libssh2_version}
BuildRequires: pkgconfig(libssh2)
%endif
%if 0%{?rhel} == 8
@ -216,14 +212,11 @@ BuildRequires: python3
BuildRequires: python3-rpm-macros
%if %with bundled_llvm
BuildRequires: cmake3 >= 3.13.4
BuildRequires: cmake >= 3.20.0
BuildRequires: ninja-build
Provides: bundled(llvm) = %{bundled_llvm_version}
%else
BuildRequires: cmake >= 2.8.11
%if 0%{?epel} == 7
%global llvm llvm14
%endif
BuildRequires: cmake >= 3.5.1
%if %defined llvm
%global llvm_root %{_libdir}/%{llvm}
%else
@ -258,20 +251,7 @@ Requires: %{name}-std-static%{?_isa} = %{version}-%{release}
# https://github.com/rust-lang/rust/issues/11937
Requires: /usr/bin/cc
%if 0%{?epel} == 7
%global devtoolset_name devtoolset-11
BuildRequires: %{devtoolset_name}-binutils
BuildRequires: %{devtoolset_name}-gcc
BuildRequires: %{devtoolset_name}-gcc-c++
%global devtoolset_bindir /opt/rh/%{devtoolset_name}/root/usr/bin
%global __cc %{devtoolset_bindir}/gcc
%global __cxx %{devtoolset_bindir}/g++
%global __ar %{devtoolset_bindir}/ar
%global __ranlib %{devtoolset_bindir}/ranlib
%global __strip %{devtoolset_bindir}/strip
%else
%global __ranlib %{_bindir}/ranlib
%endif
# ALL Rust libraries are private, because they don't keep an ABI.
%global _privatelibs lib(.*-[[:xdigit:]]{16}*|rustc.*)[.]so.*
@ -578,8 +558,6 @@ rm -rf %{wasi_libc_dir}/dlmalloc/
%if %without bundled_wasi_libc
%patch -P5 -p1
%endif
%patch -P6 -p1
%patch -P7 -p1
%if %with disabled_libssh2
%patch -P100 -p1
@ -596,18 +574,21 @@ rm -rf src/llvm-project/
mkdir -p src/llvm-project/libunwind/
%endif
# Remove other unused vendored libraries
rm -rf vendor/curl-sys*/curl/
rm -rf vendor/*jemalloc-sys*/jemalloc/
rm -rf vendor/libffi-sys*/libffi/
rm -rf vendor/libmimalloc-sys*/c_src/mimalloc/
rm -rf vendor/libssh2-sys*/libssh2/
rm -rf vendor/libz-sys*/src/zlib{,-ng}/
rm -rf vendor/lzma-sys*/xz-*/
rm -rf vendor/openssl-src*/openssl/
# Remove other unused vendored libraries. This leaves the directory in place,
# because some build scripts watch them, e.g. "cargo:rerun-if-changed=curl".
%define clear_dir() find ./%1 -mindepth 1 -delete
%clear_dir vendor/curl-sys*/curl/
%clear_dir vendor/*jemalloc-sys*/jemalloc/
%clear_dir vendor/libffi-sys*/libffi/
%clear_dir vendor/libmimalloc-sys*/c_src/mimalloc/
%clear_dir vendor/libssh2-sys*/libssh2/
%clear_dir vendor/libz-sys*/src/zlib{,-ng}/
%clear_dir vendor/lzma-sys*/xz-*/
%clear_dir vendor/openssl-src*/openssl/
%if %without bundled_libgit2
rm -rf vendor/libgit2-sys*/libgit2/
%clear_dir vendor/libgit2-sys*/libgit2/
%endif
%if %with disabled_libssh2
@ -617,12 +598,6 @@ rm -rf vendor/libssh2-sys*/
# This only affects the transient rust-installer, but let it use our dynamic xz-libs
sed -i.lzma -e '/LZMA_API_STATIC/d' src/bootstrap/tool.rs
%if %{with bundled_llvm} && 0%{?epel} == 7
mkdir -p cmake-bin
ln -s /usr/bin/cmake3 cmake-bin/cmake
%global cmake_path $PWD/cmake-bin
%endif
%if %{without bundled_llvm} && %{with llvm_static}
# Static linking to distro LLVM needs to add -lffi
# https://github.com/rust-lang/rust/issues/34486
@ -661,9 +636,6 @@ end}
# Set up shared environment variables for build/install/check
%global rust_env %{?rustflags:RUSTFLAGS="%{rustflags}"} %{rustc_target_cpus}
%if %defined cmake_path
%global rust_env %{?rust_env} PATH="%{cmake_path}:$PATH"
%endif
%if %without disabled_libssh2
# convince libssh2-sys to use the distro libssh2
%global rust_env %{?rust_env} LIBSSH2_SYS_USE_PKG_CONFIG=1
@ -721,7 +693,7 @@ fi
%define profiler %{clang_resource_dir}/lib/%{_arch}-redhat-linux-gnu/libclang_rt.profile.a
%else
# The exact profiler path is version dependent..
%define profiler %(echo %{_libdir}/clang/*/lib/libclang_rt.profile-%{_arch}.a)
%define profiler %(echo %{_libdir}/clang/??/lib/libclang_rt.profile-*.a)
%endif
test -r "%{profiler}"
@ -745,7 +717,8 @@ test -r "%{profiler}"
--disable-llvm-static-stdcpp \
--disable-rpath \
%{enable_debuginfo} \
--set rust.codegen-units-std=1 \
--set rust.codegen-units=1 \
--set rust.lto=thin \
--set build.build-stage=2 \
--set build.doc-stage=2 \
--set build.install-stage=2 \
@ -758,11 +731,32 @@ test -r "%{profiler}"
--release-channel=%{channel} \
--release-description="%{?fedora:Fedora }%{?rhel:Red Hat }%{version}-%{release}"
%{__python3} ./x.py build -j "$ncpus"
%{__python3} ./x.py doc
%global __x %{__python3} ./x.py
%global __xk %{__x} --keep-stage=0 --keep-stage=1
%if %with rustc_pgo
# Build the compiler with profile instrumentation
PROFRAW="$PWD/build/profiles"
PROFDATA="$PWD/build/rustc.profdata"
mkdir -p "$PROFRAW"
%{__x} build -j "$ncpus" sysroot --rust-profile-generate="$PROFRAW"
# Build cargo as a workload to generate compiler profiles
env LLVM_PROFILE_FILE="$PROFRAW/default_%%m_%%p.profraw" %{__xk} build cargo
llvm-profdata merge -o "$PROFDATA" "$PROFRAW"
rm -r "$PROFRAW" build/%{rust_triple}/stage2*/
# Rebuild the compiler using the profile data
%{__x} build -j "$ncpus" sysroot --rust-profile-use="$PROFDATA"
%else
# Build the compiler without PGO
%{__x} build -j "$ncpus" sysroot
%endif
# Build everything else normally
%{__xk} build
%{__xk} doc
for triple in %{?all_targets} ; do
%{__python3} ./x.py build --target=$triple std
%{__xk} build --target=$triple std
done
%install
@ -771,10 +765,10 @@ done
%endif
%{export_rust_env}
DESTDIR=%{buildroot} %{__python3} ./x.py install
DESTDIR=%{buildroot} %{__xk} install
for triple in %{?all_targets} ; do
DESTDIR=%{buildroot} %{__python3} ./x.py install --target=$triple std
DESTDIR=%{buildroot} %{__xk} install --target=$triple std
done
# The rls stub doesn't have an install target, but we can just copy it.
@ -882,17 +876,17 @@ rm -f %{buildroot}%{rustlibdir}/%{rust_triple}/bin/rust-ll*
# Bootstrap is excluded because it's not something we ship, and a lot of its
# tests are geared toward the upstream CI environment.
%{__python3} ./x.py test --no-fail-fast --skip src/bootstrap || :
%{__xk} test --no-fail-fast --skip src/bootstrap || :
rm -rf "./build/%{rust_triple}/test/"
%{__python3} ./x.py test --no-fail-fast cargo || :
%{__xk} test --no-fail-fast cargo || :
rm -rf "./build/%{rust_triple}/stage2-tools/%{rust_triple}/cit/"
%{__python3} ./x.py test --no-fail-fast clippy || :
%{__xk} test --no-fail-fast clippy || :
%{__python3} ./x.py test --no-fail-fast rust-analyzer || :
%{__xk} test --no-fail-fast rust-analyzer || :
%{__python3} ./x.py test --no-fail-fast rustfmt || :
%{__xk} test --no-fail-fast rustfmt || :
%ldconfig_scriptlets
@ -1033,6 +1027,9 @@ rm -rf "./build/%{rust_triple}/stage2-tools/%{rust_triple}/cit/"
%changelog
* Wed Jan 03 2024 Josh Stone <jistone@redhat.com> - 1.74.1-1
- Update to 1.74.1.
* Tue Oct 17 2023 Josh Stone <jistone@redhat.com> - 1.73.0-1
- Update to 1.73.0.
- Use emmalloc instead of CC0 dlmalloc when bundling wasi-libc

View File

@ -1,42 +0,0 @@
--- rustc-beta-src/src/tools/cargo/Cargo.lock.orig 2023-09-01 10:51:15.000000000 -0700
+++ rustc-beta-src/src/tools/cargo/Cargo.lock 2023-09-05 16:59:08.837345133 -0700
@@ -1973,7 +1973,6 @@
dependencies = [
"cc",
"libc",
- "libssh2-sys",
"libz-sys",
"openssl-sys",
"pkg-config",
@@ -2006,20 +2005,6 @@
]
[[package]]
-name = "libssh2-sys"
-version = "0.3.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2dc8a030b787e2119a731f1951d6a773e2280c660f8ec4b0f5e1505a386e71ee"
-dependencies = [
- "cc",
- "libc",
- "libz-sys",
- "openssl-sys",
- "pkg-config",
- "vcpkg",
-]
-
-[[package]]
name = "libz-sys"
version = "1.1.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
--- rustc-beta-src/src/tools/cargo/Cargo.toml.orig 2023-09-05 16:59:08.837345133 -0700
+++ rustc-beta-src/src/tools/cargo/Cargo.toml 2023-09-05 17:00:00.828461993 -0700
@@ -37,7 +37,7 @@
filetime = "0.2.21"
flate2 = { version = "1.0.26", default-features = false, features = ["zlib"] }
fwdansi = "1.1.0"
-git2 = "0.17.2"
+git2 = { version = "0.17.2", default-features = false, features = ["https"] }
git2-curl = "0.18.0"
gix = { version = "0.45.1", default-features = false, features = ["blocking-http-transport-curl", "progress-tree"] }
gix-features-for-configuration-only = { version = "0.30.0", package = "gix-features", features = [ "parallel" ] }

View File

@ -0,0 +1,42 @@
--- rustc-beta-src/src/tools/cargo/Cargo.lock.orig 2023-10-20 22:31:52.000000000 -0700
+++ rustc-beta-src/src/tools/cargo/Cargo.lock 2023-11-01 15:33:13.224745542 -0700
@@ -2009,7 +2009,6 @@
dependencies = [
"cc",
"libc",
- "libssh2-sys",
"libz-sys",
"openssl-sys",
"pkg-config",
@@ -2042,20 +2041,6 @@
]
[[package]]
-name = "libssh2-sys"
-version = "0.3.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2dc8a030b787e2119a731f1951d6a773e2280c660f8ec4b0f5e1505a386e71ee"
-dependencies = [
- "cc",
- "libc",
- "libz-sys",
- "openssl-sys",
- "pkg-config",
- "vcpkg",
-]
-
-[[package]]
name = "libz-sys"
version = "1.1.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
--- rustc-beta-src/src/tools/cargo/Cargo.toml.orig 2023-11-01 15:33:13.225745528 -0700
+++ rustc-beta-src/src/tools/cargo/Cargo.toml 2023-11-01 15:34:51.883397544 -0700
@@ -40,7 +40,7 @@
curl-sys = "0.4.68"
filetime = "0.2.22"
flate2 = { version = "1.0.27", default-features = false, features = ["zlib"] }
-git2 = "0.18.0"
+git2 = { version = "0.18.0", default-features = false, features = ["https"] }
git2-curl = "0.19.0"
gix = { version = "0.54.1", default-features = false, features = ["blocking-http-transport-curl", "progress-tree", "revision"] }
gix-features-for-configuration-only = { version = "0.35.0", package = "gix-features", features = [ "parallel" ] }

View File

@ -1,2 +1,2 @@
SHA512 (rustc-1.73.0-src.tar.xz) = 75c59680a82cb9d076b9434744a1c65908524ef769293952f5d9c5779d9a9c6fa4d9aa0c7e7d6b7566a21a50a27cd6ae452b5283a4d4606b2fa1acc24dfd8e0c
SHA512 (rustc-1.74.1-src.tar.xz) = 14c7e7ed2f38ab60299d8c7d41d78f042b6b57ef822d577b5138e60bdde31cf141eccd4332a25bc5da3d58eb5313d63c1448b5dfe9e11b8055bb8ea133a9038d
SHA512 (wasi-libc-bd950eb128bff337153de217b11270f948d04bb4.tar.gz) = 01e5cc3ebdab239f57816ff80f939fd87a5491a28951daf74b3310b118b4820c098ac9417771c9c6af55ca91d2cabe6498975ab9db4914aba754d87067cd1066