@ -1,4 +1,4 @@
# Only x86_64 and i686 are Tier 1 platforms at this time.
# Only x86_64, i686, and aarch64 are Tier 1 platforms at this time.
# https://doc.rust-lang.org/nightly/rustc/platform-support.html
# https://doc.rust-lang.org/nightly/rustc/platform-support.html
%global rust_arches x86_64 i686 aarch64 ppc64le s390x
%global rust_arches x86_64 i686 aarch64 ppc64le s390x
@ -8,9 +8,9 @@
# To bootstrap from scratch, set the channel and date from src/stage0.json
# 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
# e.g. 1.59.0 wants rustc: 1.58.0-2022-01-13
# or nightly wants some beta-YYYY-MM-DD
# or nightly wants some beta-YYYY-MM-DD
%global bootstrap_version 1.65 .0
%global bootstrap_version 1.70 .0
%global bootstrap_channel 1.65 .0
%global bootstrap_channel 1.70 .0
%global bootstrap_date 2022-11-03
%global bootstrap_date 2023-06-01
# Only the specified arches will use bootstrap binaries.
# Only the specified arches will use bootstrap binaries.
# NOTE: Those binaries used to be uploaded with every new release, but that was
# NOTE: Those binaries used to be uploaded with every new release, but that was
@ -39,7 +39,7 @@
# src/ci/docker/host-x86_64/dist-various-2/build-wasi-toolchain.sh
# src/ci/docker/host-x86_64/dist-various-2/build-wasi-toolchain.sh
# (updated per https://github.com/rust-lang/rust/pull/96907)
# (updated per https://github.com/rust-lang/rust/pull/96907)
%global wasi_libc_url https://github.com/WebAssembly/wasi-libc
%global wasi_libc_url https://github.com/WebAssembly/wasi-libc
%global wasi_libc_ref wasi-sdk-17
%global wasi_libc_ref wasi-sdk-20
%global wasi_libc_name wasi-libc-%{wasi_libc_ref}
%global wasi_libc_name wasi-libc-%{wasi_libc_ref}
%global wasi_libc_source %{wasi_libc_url}/archive/%{wasi_libc_ref}/%{wasi_libc_name}.tar.gz
%global wasi_libc_source %{wasi_libc_url}/archive/%{wasi_libc_ref}/%{wasi_libc_name}.tar.gz
%global wasi_libc_dir %{_builddir}/%{wasi_libc_name}
%global wasi_libc_dir %{_builddir}/%{wasi_libc_name}
@ -48,17 +48,17 @@
%bcond_with llvm_static
%bcond_with llvm_static
# We can also choose to just use Rust's bundled LLVM, in case the system LLVM
# We can also choose to just use Rust's bundled LLVM, in case the system LLVM
# is insufficient. Rust currently requires LLVM 12 .0+.
# is insufficient. Rust currently requires LLVM 14 .0+.
%global min_llvm_version 13 .0.0
%global min_llvm_version 14 .0.0
%global bundled_llvm_version 15.0.2
%global bundled_llvm_version 16.0.5
%bcond_with bundled_llvm
%bcond_with bundled_llvm
# Requires stable libgit2 1.5 , and not the next minor soname change.
# Requires stable libgit2 1.6 , and not the next minor soname change.
# This needs to be consistent with the bindings in vendor/libgit2-sys.
# This needs to be consistent with the bindings in vendor/libgit2-sys.
%global min_libgit2_version 1.5.0
%global min_libgit2_version 1.6.4
%global next_libgit2_version 1.6 .0~
%global next_libgit2_version 1.7 .0~
%global bundled_libgit2_version 1.5.0
%global bundled_libgit2_version 1.6.4
%if 0%{?fedora} >= 99
%if 0%{?fedora} >= 38
%bcond_with bundled_libgit2
%bcond_with bundled_libgit2
%else
%else
%bcond_without bundled_libgit2
%bcond_without bundled_libgit2
@ -87,8 +87,8 @@
%endif
%endif
Name: rust
Name: rust
Version: 1.66 .1
Version: 1.71 .1
Release: 2 %{?dist}
Release: 1 %{?dist}
Summary: The Rust Programming Language
Summary: The Rust Programming Language
License: (ASL 2.0 or MIT) and (BSD and MIT)
License: (ASL 2.0 or MIT) and (BSD and MIT)
# ^ written as: (rust itself) and (bundled libraries)
# ^ written as: (rust itself) and (bundled libraries)
@ -108,19 +108,18 @@ Source1: %{wasi_libc_source}
Patch1: 0001-Use-lld-provided-by-system-for-wasm.patch
Patch1: 0001-Use-lld-provided-by-system-for-wasm.patch
# Set a substitute-path in rust-gdb for standard library sources.
# Set a substitute-path in rust-gdb for standard library sources.
Patch2: rustc-1.61 .0-rust-gdb-substitute-path.patch
Patch2: rustc-1.70 .0-rust-gdb-substitute-path.patch
# https://github.com/rust-lang/rust/pull/103072
# Override default target CPUs to match distro settings
Patch3: 0001-compiletest-set-the-dylib-path-when-gathering-target.patch
# TODO: upstream this ability into the actual build configuration
Patch3: 0001-Let-environment-variables-override-some-default-CPUs.patch
# https://github.com/rust-lang/rust/pull/104001
# Enable the profiler runtime for native hosts
Patch4: 0001-Improve-generating-Custom-entry-function.patch
# https://github.com/rust-lang/rust/pull/114069
Patch4: 0001-Allow-using-external-builds-of-the-compiler-rt-profi.patch
# https://github.com/rust-lang/rust/pull/105468
# https://github.com/rust-lang/rust/pull/114440
Patch5: 0001-Mangle-main-as-__main_void-on-wasm32-wasi.patch
Patch5: 0001-bootstrap-config-fix-version-comparison-bug.patch
# CVE-2023-38497: cargo does not respect the umask when extracting dependencies
Patch6: CVE-2023-38497-cargo-umask.patch
### RHEL-specific patches below ###
### RHEL-specific patches below ###
@ -128,16 +127,11 @@ Patch6: CVE-2023-38497-cargo-umask.patch
Source100: macros.rust-toolset
Source100: macros.rust-toolset
# Disable cargo->libgit2->libssh2 on RHEL, as it's not approved for FIPS (rhbz1732949)
# Disable cargo->libgit2->libssh2 on RHEL, as it's not approved for FIPS (rhbz1732949)
Patch100: rustc-1.65 .0-disable-libssh2.patch
Patch100: rustc-1.71 .0-disable-libssh2.patch
# libcurl on RHEL7 doesn't have http2, but since cargo requests it, curl-sys
# 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.
# will try to build it statically -- instead we turn off the feature.
Patch101: rustc-1.65.0-disable-http2.patch
Patch101: rustc-1.71.0-disable-http2.patch
# kernel rh1410097 causes too-small stacks for PIE.
# (affects RHEL6 kernels when building for RHEL7)
Patch102: rustc-1.65.0-no-default-pie.patch
# Get the Rust triple for any arch.
# Get the Rust triple for any arch.
%{lua: function rust_triple(arch)
%{lua: function rust_triple(arch)
@ -155,7 +149,14 @@ Patch102: rustc-1.65.0-no-default-pie.patch
return arch.."-unknown-linux-"..abi
return arch.."-unknown-linux-"..abi
end}
end}
# Get the environment form of a Rust triple
%{lua: function rust_triple_env(triple)
local sub = string.gsub(triple, "-", "_")
return string.upper(sub)
end}
%global rust_triple %{lua: print(rust_triple(rpm.expand("%{_target_cpu}")))}
%global rust_triple %{lua: print(rust_triple(rpm.expand("%{_target_cpu}")))}
%global rust_triple_env %{lua: print(rust_triple_env(rpm.expand("%{rust_triple}")))}
%if %defined bootstrap_arches
%if %defined bootstrap_arches
# For each bootstrap arch, add an additional binary Source.
# For each bootstrap arch, add an additional binary Source.
@ -231,7 +232,7 @@ Provides: bundled(llvm) = %{bundled_llvm_version}
%else
%else
BuildRequires: cmake >= 2.8.11
BuildRequires: cmake >= 2.8.11
%if 0%{?epel} == 7
%if 0%{?epel} == 7
%global llvm llvm13
%global llvm llvm14
%endif
%endif
%if %defined llvm
%if %defined llvm
%global llvm_root %{_libdir}/%{llvm}
%global llvm_root %{_libdir}/%{llvm}
@ -268,7 +269,7 @@ Requires: %{name}-std-static%{?_isa} = %{version}-%{release}
Requires: /usr/bin/cc
Requires: /usr/bin/cc
%if 0%{?epel} == 7
%if 0%{?epel} == 7
%global devtoolset_name devtoolset-9
%global devtoolset_name devtoolset-11
BuildRequires: %{devtoolset_name}-binutils
BuildRequires: %{devtoolset_name}-binutils
BuildRequires: %{devtoolset_name}-gcc
BuildRequires: %{devtoolset_name}-gcc
BuildRequires: %{devtoolset_name}-gcc-c++
BuildRequires: %{devtoolset_name}-gcc-c++
@ -333,6 +334,15 @@ find '%{buildroot}%{rustlibdir}'/wasm*/lib -type f -regex '.*\\.\\(a\\|rlib\\)'
%{nil}
%{nil}
%endif
%endif
%if 0%{?fedora} || 0%{?rhel} >= 8
# For profiler_builtins
BuildRequires: compiler-rt
%endif
# This component was removed as of Rust 1.69.0.
# https://github.com/rust-lang/rust/pull/101841
Obsoletes: %{name}-analysis < 1.69.0~
%description
%description
Rust is a systems programming language that runs blazingly fast, prevents
Rust is a systems programming language that runs blazingly fast, prevents
segfaults, and guarantees thread safety.
segfaults, and guarantees thread safety.
@ -342,8 +352,9 @@ This package includes the Rust compiler and documentation generator.
%package std-static
%package std-static
Summary: Standard library for Rust
Summary: Standard library for Rust
Provides: %{name}-std-static-%{rust_triple} = %{version}-%{release}
Requires: %{name} = %{version}-%{release}
Requires: %{name} = %{version}-%{release}
Requires: glibc-devel%{?_isa} >= 2.11
Requires: glibc-devel%{?_isa} >= 2.17
%description std-static
%description std-static
This package includes the standard libraries for building applications
This package includes the standard libraries for building applications
@ -547,26 +558,13 @@ This package includes source files for the Rust standard library. It may be
useful as a reference for code completion tools in various editors.
useful as a reference for code completion tools in various editors.
%package analysis
%if 0%{?rhel}
Summary: Compiler analysis data for the Rust standard library
%if 0%{?rhel} && 0%{?rhel} < 8
Requires: %{name}-std-static%{?_isa} = %{version}-%{release}
%else
Recommends: %{name}-std-static%{?_isa} = %{version}-%{release}
%endif
%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.
%if 0%{?rhel} && 0%{?rhel} >= 8
%package toolset
%package toolset
Summary: Rust Toolset
Summary: Rust Toolset
Requires: rust%{?_isa} = %{version}-%{release}
BuildArch: noarch
Requires: cargo%{?_isa} = %{version}-%{release}
Requires: rust = %{version}-%{release}
Requires: cargo = %{version}-%{release}
%description toolset
%description toolset
This is the metapackage for Rust Toolset, bringing in the Rust compiler,
This is the metapackage for Rust Toolset, bringing in the Rust compiler,
@ -595,24 +593,19 @@ test -f '%{local_rust_root}/bin/rustc'
%setup -q -n %{rustc_package}
%setup -q -n %{rustc_package}
%patch1 -p1
%patch -P1 -p1
%patch2 -p1
%patch -P2 -p1
%patch3 -p1
%patch -P3 -p1
%patch4 -p1
%patch -P4 -p1
%patch5 -p1
%patch -P5 -p1
%patch6 -p1
%if %with disabled_libssh2
%if %with disabled_libssh2
%patch100 -p1
%patch -P 100 -p1
%endif
%endif
%if %without curl_http2
%if %without curl_http2
%patch101 -p1
%patch -P101 -p1
rm -rf vendor/libnghttp2-sys/
rm -rf vendor/libnghttp2-sys*/
%endif
%if 0%{?rhel} && 0%{?rhel} < 8
%patch102 -p1
%endif
%endif
# Use our explicit python3 first
# Use our explicit python3 first
@ -627,21 +620,21 @@ mkdir -p src/llvm-project/libunwind/
%endif
%endif
# Remove other unused vendored libraries
# Remove other unused vendored libraries
rm -rf vendor/curl-sys/curl/
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/libffi-sys*/libffi /
rm -rf vendor/libssh2-sys/libssh2 /
rm -rf vendor/libmimalloc-sys*/c_src/mimalloc /
rm -rf vendor/libz-sys/src/zlib /
rm -rf vendor/libssh2-sys*/libssh2 /
rm -rf vendor/libz-sys/src/zlib-ng/
rm -rf vendor/libz-sys* /src/zlib{, -ng} /
rm -rf vendor/lzma-sys/xz-*/
rm -rf vendor/lzma-sys* /xz-*/
rm -rf vendor/openssl-src/openssl/
rm -rf vendor/openssl-src* /openssl/
%if %without bundled_libgit2
%if %without bundled_libgit2
rm -rf vendor/libgit2-sys/libgit2/
rm -rf vendor/libgit2-sys* /libgit2/
%endif
%endif
%if %with disabled_libssh2
%if %with disabled_libssh2
rm -rf vendor/libssh2-sys/
rm -rf vendor/libssh2-sys* /
%endif
%endif
# This only affects the transient rust-installer, but let it use our dynamic xz-libs
# This only affects the transient rust-installer, but let it use our dynamic xz-libs
@ -670,9 +663,28 @@ find vendor -name .cargo-checksum.json \
# it's a shebang and make them executable. Then brp-mangle-shebangs gets upset...
# it's a shebang and make them executable. Then brp-mangle-shebangs gets upset...
find -name '*.rs' -type f -perm /111 -exec chmod -v -x '{}' '+'
find -name '*.rs' -type f -perm /111 -exec chmod -v -x '{}' '+'
# The distro flags are only appropriate for the host, not our cross-targets,
# and they're not as fine-grained as the settings we choose for std vs rustc.
%if %defined build_rustflags
%global build_rustflags %{nil}
%endif
# These are similar to __cflags_arch_* in /usr/lib/rpm/redhat/macros
%{lua: function rustc_target_cpus()
local fedora = tonumber(rpm.expand("0%{?fedora}"))
local rhel = tonumber(rpm.expand("0%{?rhel}"))
local env =
" RUSTC_TARGET_CPU_X86_64=x86-64" .. ((rhel >= 10) and "-v3" or (rhel == 9) and "-v2" or "")
.. " RUSTC_TARGET_CPU_PPC64LE=" .. ((rhel >= 9) and "pwr9" or "pwr8")
.. " RUSTC_TARGET_CPU_S390X=" ..
((rhel >= 9) and "z14" or (rhel == 8 or fedora >= 38) and "z13" or
(fedora >= 26) and "zEC12" or (rhel == 7) and "z196" or "z10")
return env
end}
# Set up shared environment variables for build/install/check
# Set up shared environment variables for build/install/check
%global rust_env %{?rustflags:RUSTFLAGS="%{rustflags}"}
%global rust_env %{?rustflags:RUSTFLAGS="%{rustflags}"} %{lua: print(rustc_target_cpus())}
%if 0%{?cmake_path:1}
%if %defined cmake_path
%global rust_env %{?rust_env} PATH="%{cmake_path}:$PATH"
%global rust_env %{?rust_env} PATH="%{cmake_path}:$PATH"
%endif
%endif
%if %without disabled_libssh2
%if %without disabled_libssh2
@ -681,7 +693,6 @@ find -name '*.rs' -type f -perm /111 -exec chmod -v -x '{}' '+'
%endif
%endif
%global export_rust_env %{?rust_env:export %{rust_env}}
%global export_rust_env %{?rust_env:export %{rust_env}}
%build
%build
%{export_rust_env}
%{export_rust_env}
@ -742,6 +753,12 @@ end}
end}
end}
%endif
%endif
%if 0%{?fedora} || 0%{?rhel} >= 8
# The exact profiler path is version dependent, and uses LLVM-specific
# arch names in the filename, but this find is good enough for now...
PROFILER=$(find %{_libdir}/clang -type f -name 'libclang_rt.profile-*.a')
%endif
%configure --disable-option-checking \
%configure --disable-option-checking \
--libdir=%{common_libdir} \
--libdir=%{common_libdir} \
--build=%{rust_triple} --host=%{rust_triple} --target=%{rust_triple} \
--build=%{rust_triple} --host=%{rust_triple} --target=%{rust_triple} \
@ -750,6 +767,7 @@ end}
--set target.%{rust_triple}.cxx=%{__cxx} \
--set target.%{rust_triple}.cxx=%{__cxx} \
--set target.%{rust_triple}.ar=%{__ar} \
--set target.%{rust_triple}.ar=%{__ar} \
--set target.%{rust_triple}.ranlib=%{__ranlib} \
--set target.%{rust_triple}.ranlib=%{__ranlib} \
${PROFILER:+--set target.%{rust_triple}.profiler="$PROFILER"} \
%{?mingw_target_config} \
%{?mingw_target_config} \
%{?wasm_target_config} \
%{?wasm_target_config} \
--python=%{__python3} \
--python=%{__python3} \
@ -767,7 +785,7 @@ end}
--set build.install-stage=2 \
--set build.install-stage=2 \
--set build.test-stage=2 \
--set build.test-stage=2 \
--enable-extended \
--enable-extended \
--tools=analysis, cargo,clippy,rls,rust-analyzer,rustfmt,src \
--tools=cargo,clippy,rls,rust-analyzer,rustfmt,src \
--enable-vendor \
--enable-vendor \
--enable-verbose-tests \
--enable-verbose-tests \
--dist-compression-formats=gz \
--dist-compression-formats=gz \
@ -782,6 +800,9 @@ for triple in %{?mingw_targets} %{?wasm_targets}; do
done
done
%install
%install
%if 0%{?rhel} && 0%{?rhel} <= 9
%{?set_build_flags}
%endif
%{export_rust_env}
%{export_rust_env}
DESTDIR=%{buildroot} %{__python3} ./x.py install
DESTDIR=%{buildroot} %{__python3} ./x.py install
@ -796,6 +817,9 @@ done
# These are transient files used by x.py dist and install
# These are transient files used by x.py dist and install
rm -rf ./build/dist/ ./build/tmp/
rm -rf ./build/dist/ ./build/tmp/
# Some of the components duplicate-install binaries, leaving backups we don't want
rm -f %{buildroot}%{_bindir}/*.old
# Make sure the shared libraries are in the proper libdir
# Make sure the shared libraries are in the proper libdir
%if "%{_libdir}" != "%{common_libdir}"
%if "%{_libdir}" != "%{common_libdir}"
mkdir -p %{buildroot}%{_libdir}
mkdir -p %{buildroot}%{_libdir}
@ -862,13 +886,16 @@ rm -f %{buildroot}%{rustlibdir}/etc/lldb_*
# We don't want Rust copies of LLVM tools (rust-lld, rust-llvm-dwp)
# We don't want Rust copies of LLVM tools (rust-lld, rust-llvm-dwp)
rm -f %{buildroot}%{rustlibdir}/%{rust_triple}/bin/rust-ll*
rm -f %{buildroot}%{rustlibdir}/%{rust_triple}/bin/rust-ll*
%if 0%{?rhel} && 0%{?rhel} >= 8
%if 0%{?rhel}
# This allows users to build packages using Rust Toolset.
# This allows users to build packages using Rust Toolset.
%{__install} -D -m 644 %{S:100} %{buildroot}%{rpmmacrodir}/macros.rust-toolset
%{__install} -D -m 644 %{S:100} %{buildroot}%{rpmmacrodir}/macros.rust-toolset
%endif
%endif
%check
%check
%if 0%{?rhel} && 0%{?rhel} <= 9
%{?set_build_flags}
%endif
%{export_rust_env}
%{export_rust_env}
# Sanity-check the installed binaries, debuginfo-stripped and all.
# Sanity-check the installed binaries, debuginfo-stripped and all.
@ -886,7 +913,10 @@ done
# The results are not stable on koji, so mask errors and just log it.
# 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.
# Some of the larger test artifacts are manually cleaned to save space.
timeout -v 90m %{__python3} ./x.py test --no-fail-fast || :
# Bootstrap is excluded because it's not something we ship, and a lot of its
# tests are geared toward the upstream CI environment.
timeout -v 90m %{__python3} ./x.py test --no-fail-fast --exclude src/bootstrap || :
rm -rf "./build/%{rust_triple}/test/"
rm -rf "./build/%{rust_triple}/test/"
timeout -v 30m %{__python3} ./x.py test --no-fail-fast cargo || :
timeout -v 30m %{__python3} ./x.py test --no-fail-fast cargo || :
@ -1000,16 +1030,7 @@ end}
%files doc
%files doc
%docdir %{_docdir}/%{name}
%docdir %{_docdir}/%{name}
%dir %{_docdir}/%{name}
%dir %{_docdir}/%{name}
%dir %{_docdir}/%{name}/html
%{_docdir}/%{name}/html
%{_docdir}/%{name}/html/*/
%{_docdir}/%{name}/html/*.html
%{_docdir}/%{name}/html/*.css
%{_docdir}/%{name}/html/*.js
%{_docdir}/%{name}/html/*.png
%{_docdir}/%{name}/html/*.svg
%{_docdir}/%{name}/html/*.woff2
%license %{_docdir}/%{name}/html/*.txt
%license %{_docdir}/%{name}/html/*.md
# former cargo-doc
# former cargo-doc
%docdir %{_docdir}/cargo
%docdir %{_docdir}/cargo
%dir %{_docdir}/cargo
%dir %{_docdir}/cargo
@ -1054,23 +1075,39 @@ end}
%{rustlibdir}/src
%{rustlibdir}/src
%files analysis
%if 0%{?rhel}
%{rustlibdir}/%{rust_triple}/analysis/
%if 0%{?rhel} && 0%{?rhel} >= 8
%files toolset
%files toolset
%{rpmmacrodir}/macros.rust-toolset
%{rpmmacrodir}/macros.rust-toolset
%endif
%endif
%changelog
%changelog
* Tue Dec 12 2023 MSVSphere Packaging Team <packager@msvsphere-os.ru> - 1.66.1-2
* Tue Dec 12 2023 MSVSphere Packaging Team <packager@msvsphere-os.ru> - 1.71.1-1
- Rebuilt for MSVSphere 8.8
- Rebuilt for MSVSphere 8.8
* Mon Aug 07 2023 Josh Stone <jistone@redhat.com> - 1.66.1-2
* Tue Aug 08 2023 Josh Stone <jistone@redhat.com> - 1.71.1-1
- CVE-2023-38497: fix cargo to respect umask
- Update to 1.71.1.
- Resolves: rhbz#2228137
- Security fix for CVE-2023-38497
* Wed Jul 26 2023 Josh Stone <jistone@redhat.com> - 1.71.0-2
- Relax the suspicious_double_ref_op lint (rhbz2225471)
- Enable the profiler runtime for native hosts (rhbz2213875)
* Thu Jul 20 2023 Josh Stone <jistone@redhat.com> - 1.71.0-1
- Update to 1.71.0.
* Tue Jul 18 2023 Josh Stone <jistone@redhat.com> - 1.70.0-1
- Update to 1.70.0.
* Fri May 26 2023 Josh Stone <jistone@redhat.com> - 1.69.0-1
- Update to 1.69.0.
- Obsolete rust-analysis.
* Fri May 19 2023 Josh Stone <jistone@redhat.com> - 1.68.2-1
- Update to 1.68.2.
* Thu May 18 2023 Josh Stone <jistone@redhat.com> - 1.67.1-1
- Update to 1.67.1.
* Wed Jan 11 2023 Josh Stone <jistone@redhat.com> - 1.66.1-1
* Wed Jan 11 2023 Josh Stone <jistone@redhat.com> - 1.66.1-1
- Update to 1.66.1.
- Update to 1.66.1.