c3f84f
# Only x86_64 and i686 are Tier 1 platforms at this time.
905bf8
# https://doc.rust-lang.org/nightly/rustc/platform-support.html
eacbcd
%global rust_arches x86_64 i686 aarch64 ppc64le s390x
c3f84f
c3f84f
# The channel can be stable, beta, or nightly
c3f84f
%{!?channel: %global channel stable}
c3f84f
d07ae9
# To bootstrap from scratch, set the channel and date from src/stage0.json
198de9
# e.g. 1.59.0 wants rustc: 1.58.0-2022-01-13
c3f84f
# or nightly wants some beta-YYYY-MM-DD
235ca3
%global bootstrap_version 1.65.0
235ca3
%global bootstrap_channel 1.65.0
235ca3
%global bootstrap_date 2022-11-03
c3f84f
c3f84f
# Only the specified arches will use bootstrap binaries.
198de9
# NOTE: Those binaries used to be uploaded with every new release, but that was
198de9
# a waste of lookaside cache space when they're most often unused.
198de9
# Run "spectool -g rust.spec" after changing this and then "fedpkg upload" to
198de9
# add them to sources. Remember to remove them again after the bootstrap build!
eacbcd
#global bootstrap_arches %%{rust_arches}
c3f84f
4ac2b7
# Define a space-separated list of targets to ship rust-std-static-$triple for
4ac2b7
# cross-compilation. The packages are noarch, but they're not fully
4ac2b7
# reproducible between hosts, so only x86_64 actually builds it.
4ac2b7
#ifarch x86_64
4ac2b7
# FIX: Except on RHEL8 modules, we can't filter a noarch package from shipping
4ac2b7
# on certain arches, namely s390x for its lack of lld. So we need to make it an
4ac2b7
# arch-specific package only for the supported arches.
4ac2b7
%ifnarch s390x
d07ae9
%if 0%{?fedora}
d07ae9
%global mingw_targets i686-pc-windows-gnu x86_64-pc-windows-gnu
d07ae9
%endif
4ac2b7
%if 0%{?fedora} || 0%{?rhel} >= 8
d07ae9
%global wasm_targets wasm32-unknown-unknown wasm32-wasi
4ac2b7
%endif
4ac2b7
%endif
4ac2b7
d07ae9
# We need CRT files for *-wasi targets, at least as new as the commit in
d07ae9
# src/ci/docker/host-x86_64/dist-various-2/build-wasi-toolchain.sh
198de9
# (updated per https://github.com/rust-lang/rust/pull/96907)
d07ae9
%global wasi_libc_url https://github.com/WebAssembly/wasi-libc
235ca3
%global wasi_libc_ref wasi-sdk-17
235ca3
%global wasi_libc_name wasi-libc-%{wasi_libc_ref}
235ca3
%global wasi_libc_source %{wasi_libc_url}/archive/%{wasi_libc_ref}/%{wasi_libc_name}.tar.gz
d07ae9
%global wasi_libc_dir %{_builddir}/%{wasi_libc_name}
d07ae9
c3f84f
# Using llvm-static may be helpful as an opt-in, e.g. to aid LLVM rebases.
c3f84f
%bcond_with llvm_static
c3f84f
c3f84f
# We can also choose to just use Rust's bundled LLVM, in case the system LLVM
d07ae9
# is insufficient.  Rust currently requires LLVM 12.0+.
235ca3
%global min_llvm_version 13.0.0
235ca3
%global bundled_llvm_version 15.0.2
c3f84f
%bcond_with bundled_llvm
c3f84f
235ca3
# Requires stable libgit2 1.5, and not the next minor soname change.
198de9
# This needs to be consistent with the bindings in vendor/libgit2-sys.
235ca3
%global min_libgit2_version 1.5.0
235ca3
%global next_libgit2_version 1.6.0~
235ca3
%global bundled_libgit2_version 1.5.0
198de9
%if 0%{?fedora} >= 99
f7bb61
%bcond_with bundled_libgit2
f7bb61
%else
c3f84f
%bcond_without bundled_libgit2
f7bb61
%endif
c3f84f
d07ae9
# needs libssh2_userauth_publickey_frommemory
d07ae9
%global min_libssh2_version 1.6.0
c3f84f
%if 0%{?rhel}
f7bb61
# Disable cargo->libgit2->libssh2 on RHEL, as it's not approved for FIPS (rhbz1732949)
a0c80e
%bcond_without disabled_libssh2
c3f84f
%else
f7bb61
%bcond_with disabled_libssh2
c3f84f
%endif
c3f84f
f7bb61
%if 0%{?rhel} && 0%{?rhel} < 8
f7bb61
%bcond_with curl_http2
c3f84f
%else
f7bb61
%bcond_without curl_http2
f7bb61
%endif
f7bb61
f7bb61
# LLDB isn't available everywhere...
f7bb61
%if 0%{?rhel} && 0%{?rhel} < 8
c3f84f
%bcond_with lldb
f7bb61
%else
f7bb61
%bcond_without lldb
c3f84f
%endif
c3f84f
c3f84f
Name:           rust
235ca3
Version:        1.66.1
d07ae9
Release:        1%{?dist}
c3f84f
Summary:        The Rust Programming Language
c3f84f
License:        (ASL 2.0 or MIT) and (BSD and MIT)
c3f84f
# ^ written as: (rust itself) and (bundled libraries)
c3f84f
URL:            https://www.rust-lang.org
c3f84f
ExclusiveArch:  %{rust_arches}
c3f84f
c3f84f
%if "%{channel}" == "stable"
ec855a
%global rustc_package rustc-%{version}-src
c3f84f
%else
c3f84f
%global rustc_package rustc-%{channel}-src
c3f84f
%endif
c3f84f
Source0:        https://static.rust-lang.org/dist/%{rustc_package}.tar.xz
d07ae9
Source1:        %{wasi_libc_source}
d07ae9
# Sources for bootstrap_arches are inserted by lua below
778c89
4ac2b7
# By default, rust tries to use "rust-lld" as a linker for WebAssembly.
d07ae9
Patch1:         0001-Use-lld-provided-by-system-for-wasm.patch
16df65
198de9
# Set a substitute-path in rust-gdb for standard library sources.
198de9
Patch2:         rustc-1.61.0-rust-gdb-substitute-path.patch
198de9
235ca3
# https://github.com/rust-lang/rust/pull/103072
235ca3
Patch3:         0001-compiletest-set-the-dylib-path-when-gathering-target.patch
235ca3
235ca3
# https://github.com/rust-lang/rust/pull/104001
235ca3
Patch4:         0001-Improve-generating-Custom-entry-function.patch
235ca3
235ca3
# https://github.com/rust-lang/rust/pull/105468
235ca3
Patch5:         0001-Mangle-main-as-__main_void-on-wasm32-wasi.patch
235ca3
f7bb61
### RHEL-specific patches below ###
f7bb61
198de9
# Simple rpm macros for rust-toolset (as opposed to full rust-packaging)
198de9
Source100:      macros.rust-toolset
198de9
f7bb61
# Disable cargo->libgit2->libssh2 on RHEL, as it's not approved for FIPS (rhbz1732949)
235ca3
Patch100:       rustc-1.65.0-disable-libssh2.patch
f7bb61
f7bb61
# libcurl on RHEL7 doesn't have http2, but since cargo requests it, curl-sys
f7bb61
# will try to build it statically -- instead we turn off the feature.
235ca3
Patch101:       rustc-1.65.0-disable-http2.patch
f7bb61
f7bb61
# kernel rh1410097 causes too-small stacks for PIE.
f7bb61
# (affects RHEL6 kernels when building for RHEL7)
235ca3
Patch102:       rustc-1.65.0-no-default-pie.patch
6a711d
c3f84f
c3f84f
# Get the Rust triple for any arch.
c3f84f
%{lua: function rust_triple(arch)
c3f84f
  local abi = "gnu"
c3f84f
  if arch == "armv7hl" then
c3f84f
    arch = "armv7"
c3f84f
    abi = "gnueabihf"
c3f84f
  elseif arch == "ppc64" then
c3f84f
    arch = "powerpc64"
c3f84f
  elseif arch == "ppc64le" then
c3f84f
    arch = "powerpc64le"
f7bb61
  elseif arch == "riscv64" then
f7bb61
    arch = "riscv64gc"
c3f84f
  end
c3f84f
  return arch.."-unknown-linux-"..abi
c3f84f
end}
c3f84f
c3f84f
%global rust_triple %{lua: print(rust_triple(rpm.expand("%{_target_cpu}")))}
c3f84f
c3f84f
%if %defined bootstrap_arches
c3f84f
# For each bootstrap arch, add an additional binary Source.
c3f84f
# Also define bootstrap_source just for the current target.
c3f84f
%{lua: do
c3f84f
  local bootstrap_arches = {}
c3f84f
  for arch in string.gmatch(rpm.expand("%{bootstrap_arches}"), "%S+") do
c3f84f
    table.insert(bootstrap_arches, arch)
c3f84f
  end
198de9
  local base = rpm.expand("https://static.rust-lang.org/dist/%{bootstrap_date}")
198de9
  local channel = rpm.expand("%{bootstrap_channel}")
c3f84f
  local target_arch = rpm.expand("%{_target_cpu}")
c3f84f
  for i, arch in ipairs(bootstrap_arches) do
198de9
    i = 1000 + i * 3
198de9
    local suffix = channel.."-"..rust_triple(arch)
198de9
    print(string.format("Source%d: %s/cargo-%s.tar.xz\n", i, base, suffix))
198de9
    print(string.format("Source%d: %s/rustc-%s.tar.xz\n", i+1, base, suffix))
198de9
    print(string.format("Source%d: %s/rust-std-%s.tar.xz\n", i+2, base, suffix))
c3f84f
    if arch == target_arch then
198de9
      rpm.define("bootstrap_source_cargo "..i)
198de9
      rpm.define("bootstrap_source_rustc "..i+1)
198de9
      rpm.define("bootstrap_source_std "..i+2)
198de9
      rpm.define("bootstrap_suffix "..suffix)
c3f84f
    end
c3f84f
  end
c3f84f
end}
c3f84f
%endif
c3f84f
c3f84f
%ifarch %{bootstrap_arches}
198de9
%global local_rust_root %{_builddir}/rust-%{bootstrap_suffix}
198de9
Provides:       bundled(%{name}-bootstrap) = %{bootstrap_version}
c3f84f
%else
198de9
BuildRequires:  cargo >= %{bootstrap_version}
f7bb61
%if 0%{?rhel} && 0%{?rhel} < 8
198de9
BuildRequires:  %{name} >= %{bootstrap_version}
ec855a
BuildConflicts: %{name} > %{version}
f7bb61
%else
198de9
BuildRequires:  (%{name} >= %{bootstrap_version} with %{name} <= %{version})
c3f84f
%endif
c3f84f
%global local_rust_root %{_prefix}
c3f84f
%endif
c3f84f
c3f84f
BuildRequires:  make
c3f84f
BuildRequires:  gcc
c3f84f
BuildRequires:  gcc-c++
c3f84f
BuildRequires:  ncurses-devel
f7bb61
# explicit curl-devel to avoid httpd24-curl (rhbz1540167)
f7bb61
BuildRequires:  curl-devel
c3f84f
BuildRequires:  pkgconfig(libcurl)
c3f84f
BuildRequires:  pkgconfig(liblzma)
c3f84f
BuildRequires:  pkgconfig(openssl)
c3f84f
BuildRequires:  pkgconfig(zlib)
c3f84f
d07ae9
%if %{without bundled_libgit2}
198de9
BuildRequires:  (pkgconfig(libgit2) >= %{min_libgit2_version} with pkgconfig(libgit2) < %{next_libgit2_version})
c3f84f
%endif
c3f84f
905bf8
%if %{without disabled_libssh2}
d07ae9
BuildRequires:  pkgconfig(libssh2) >= %{min_libssh2_version}
c3f84f
%endif
c3f84f
d07ae9
%if 0%{?rhel} == 8
d07ae9
BuildRequires:  platform-python
d07ae9
%else
d07ae9
BuildRequires:  python3
d07ae9
%endif
d07ae9
BuildRequires:  python3-rpm-macros
c3f84f
c3f84f
%if %with bundled_llvm
778c89
BuildRequires:  cmake3 >= 3.13.4
d07ae9
BuildRequires:  ninja-build
d07ae9
Provides:       bundled(llvm) = %{bundled_llvm_version}
c3f84f
%else
c3f84f
BuildRequires:  cmake >= 2.8.11
f7bb61
%if 0%{?epel} == 7
d07ae9
%global llvm llvm13
c3f84f
%endif
c3f84f
%if %defined llvm
c3f84f
%global llvm_root %{_libdir}/%{llvm}
c3f84f
%else
c3f84f
%global llvm llvm
c3f84f
%global llvm_root %{_prefix}
c3f84f
%endif
d07ae9
BuildRequires:  %{llvm}-devel >= %{min_llvm_version}
c3f84f
%if %with llvm_static
c3f84f
BuildRequires:  %{llvm}-static
c3f84f
BuildRequires:  libffi-devel
c3f84f
%endif
c3f84f
%endif
c3f84f
d07ae9
# make check needs "ps" for src/test/ui/wait-forked-but-failed-child.rs
c3f84f
BuildRequires:  procps-ng
c3f84f
c3f84f
# debuginfo-gdb tests need gdb
c3f84f
BuildRequires:  gdb
c3f84f
198de9
# For src/test/run-make/static-pie
198de9
BuildRequires:  glibc-static
198de9
c3f84f
# Virtual provides for folks who attempt "dnf install rustc"
ec855a
Provides:       rustc = %{version}-%{release}
ec855a
Provides:       rustc%{?_isa} = %{version}-%{release}
c3f84f
c3f84f
# Always require our exact standard library
ec855a
Requires:       %{name}-std-static%{?_isa} = %{version}-%{release}
c3f84f
c3f84f
# The C compiler is needed at runtime just for linking.  Someday rustc might
c3f84f
# invoke the linker directly, and then we'll only need binutils.
c3f84f
# https://github.com/rust-lang/rust/issues/11937
c3f84f
Requires:       /usr/bin/cc
c3f84f
4ac2b7
%if 0%{?epel} == 7
4ac2b7
%global devtoolset_name devtoolset-9
d07ae9
BuildRequires:  %{devtoolset_name}-binutils
4ac2b7
BuildRequires:  %{devtoolset_name}-gcc
4ac2b7
BuildRequires:  %{devtoolset_name}-gcc-c++
d07ae9
%global devtoolset_bindir /opt/rh/%{devtoolset_name}/root/usr/bin
d07ae9
%global __cc     %{devtoolset_bindir}/gcc
d07ae9
%global __cxx    %{devtoolset_bindir}/g++
d07ae9
%global __ar     %{devtoolset_bindir}/ar
d07ae9
%global __ranlib %{devtoolset_bindir}/ranlib
d07ae9
%global __strip  %{devtoolset_bindir}/strip
d07ae9
%else
d07ae9
%global __ranlib %{_bindir}/ranlib
4ac2b7
%endif
4ac2b7
c3f84f
# ALL Rust libraries are private, because they don't keep an ABI.
c3f84f
%global _privatelibs lib(.*-[[:xdigit:]]{16}*|rustc.*)[.]so.*
c3f84f
%global __provides_exclude ^(%{_privatelibs})$
c3f84f
%global __requires_exclude ^(%{_privatelibs})$
c3f84f
%global __provides_exclude_from ^(%{_docdir}|%{rustlibdir}/src)/.*$
c3f84f
%global __requires_exclude_from ^(%{_docdir}|%{rustlibdir}/src)/.*$
c3f84f
c3f84f
# While we don't want to encourage dynamic linking to Rust shared libraries, as
c3f84f
# there's no stable ABI, we still need the unallocated metadata (.rustc) to
f7bb61
# support custom-derive plugins like #[proc_macro_derive(Foo)].
f7bb61
%if 0%{?rhel} && 0%{?rhel} < 8
f7bb61
# eu-strip is very eager by default, so we have to limit it to -g, only debugging symbols.
c3f84f
%global _find_debuginfo_opts -g
c3f84f
%undefine _include_minidebuginfo
f7bb61
%else
f7bb61
# Newer find-debuginfo.sh supports --keep-section, which is preferable. rhbz1465997
f7bb61
%global _find_debuginfo_opts --keep-section .rustc
c3f84f
%endif
c3f84f
c3f84f
%if %{without bundled_llvm}
ec855a
%if "%{llvm_root}" == "%{_prefix}" || 0%{?scl:1}
c3f84f
%global llvm_has_filecheck 1
c3f84f
%endif
c3f84f
%endif
c3f84f
4ac2b7
# We're going to override --libdir when configuring to get rustlib into a
4ac2b7
# common path, but we'll fix the shared libraries during install.
4ac2b7
%global common_libdir %{_prefix}/lib
4ac2b7
%global rustlibdir %{common_libdir}/rustlib
4ac2b7
d07ae9
%if %defined mingw_targets
d07ae9
BuildRequires:  mingw32-filesystem >= 95
d07ae9
BuildRequires:  mingw64-filesystem >= 95
198de9
BuildRequires:  mingw32-crt
198de9
BuildRequires:  mingw64-crt
d07ae9
BuildRequires:  mingw32-gcc
d07ae9
BuildRequires:  mingw64-gcc
198de9
BuildRequires:  mingw32-winpthreads-static
198de9
BuildRequires:  mingw64-winpthreads-static
d07ae9
%endif
d07ae9
d07ae9
%if %defined wasm_targets
d07ae9
BuildRequires:  clang
198de9
BuildRequires:  lld
4ac2b7
# brp-strip-static-archive breaks the archive index for wasm
4ac2b7
%global __os_install_post \
4ac2b7
%__os_install_post \
198de9
find '%{buildroot}%{rustlibdir}'/wasm*/lib -type f -regex '.*\\.\\(a\\|rlib\\)' -print -exec '%{llvm_root}/bin/llvm-ranlib' '{}' ';' \
4ac2b7
%{nil}
4ac2b7
%endif
4ac2b7
c3f84f
%description
c3f84f
Rust is a systems programming language that runs blazingly fast, prevents
c3f84f
segfaults, and guarantees thread safety.
c3f84f
c3f84f
This package includes the Rust compiler and documentation generator.
c3f84f
c3f84f
c3f84f
%package std-static
c3f84f
Summary:        Standard library for Rust
d07ae9
Requires:       %{name} = %{version}-%{release}
d07ae9
Requires:       glibc-devel%{?_isa} >= 2.11
c3f84f
c3f84f
%description std-static
c3f84f
This package includes the standard libraries for building applications
c3f84f
written in Rust.
c3f84f
d07ae9
%if %defined mingw_targets
4ac2b7
%{lua: do
d07ae9
  for triple in string.gmatch(rpm.expand("%{mingw_targets}"), "%S+") do
4ac2b7
    local subs = {
4ac2b7
      triple = triple,
d07ae9
      name = rpm.expand("%{name}"),
d07ae9
      verrel = rpm.expand("%{version}-%{release}"),
d07ae9
      mingw = string.sub(triple, 1, 4) == "i686" and "mingw32" or "mingw64",
4ac2b7
    }
4ac2b7
    local s = string.gsub([[
d07ae9
4ac2b7
%package std-static-{{triple}}
d07ae9
Summary:        Standard library for Rust {{triple}}
d07ae9
BuildArch:      noarch
d07ae9
Provides:       {{mingw}}-rust = {{verrel}}
d07ae9
Provides:       {{mingw}}-rustc = {{verrel}}
d07ae9
Requires:       {{mingw}}-crt
d07ae9
Requires:       {{mingw}}-gcc
d07ae9
Requires:       {{mingw}}-winpthreads-static
d07ae9
Requires:       {{name}} = {{verrel}}
d07ae9
d07ae9
%description std-static-{{triple}}
d07ae9
This package includes the standard libraries for building applications
d07ae9
written in Rust for the MinGW target {{triple}}.
d07ae9
d07ae9
]], "{{(%w+)}}", subs)
d07ae9
    print(s)
d07ae9
  end
d07ae9
end}
d07ae9
%endif
d07ae9
d07ae9
%if %defined wasm_targets
d07ae9
%{lua: do
d07ae9
  for triple in string.gmatch(rpm.expand("%{wasm_targets}"), "%S+") do
d07ae9
    local subs = {
d07ae9
      triple = triple,
d07ae9
      name = rpm.expand("%{name}"),
d07ae9
      verrel = rpm.expand("%{version}-%{release}"),
d07ae9
      wasi = string.find(triple, "-wasi") and 1 or 0,
d07ae9
    }
d07ae9
    local s = string.gsub([[
d07ae9
d07ae9
%package std-static-{{triple}}
d07ae9
Summary:        Standard library for Rust {{triple}}
4ac2b7
# FIX: we can't be noarch while excluding s390x for lack of lld
4ac2b7
# BuildArch:      noarch
d07ae9
Requires:       {{name}} = {{verrel}}
d07ae9
Requires:       lld >= 8.0
d07ae9
%if {{wasi}}
d07ae9
Provides:       bundled(wasi-libc)
d07ae9
%endif
4ac2b7
4ac2b7
%description std-static-{{triple}}
4ac2b7
This package includes the standard libraries for building applications
d07ae9
written in Rust for the WebAssembly target {{triple}}.
d07ae9
4ac2b7
]], "{{(%w+)}}", subs)
4ac2b7
    print(s)
4ac2b7
  end
4ac2b7
end}
4ac2b7
%endif
4ac2b7
c3f84f
c3f84f
%package debugger-common
c3f84f
Summary:        Common debugger pretty printers for Rust
c3f84f
BuildArch:      noarch
c3f84f
c3f84f
%description debugger-common
c3f84f
This package includes the common functionality for %{name}-gdb and %{name}-lldb.
c3f84f
c3f84f
c3f84f
%package gdb
c3f84f
Summary:        GDB pretty printers for Rust
c3f84f
BuildArch:      noarch
c3f84f
Requires:       gdb
ec855a
Requires:       %{name}-debugger-common = %{version}-%{release}
c3f84f
c3f84f
%description gdb
c3f84f
This package includes the rust-gdb script, which allows easier debugging of Rust
c3f84f
programs.
c3f84f
c3f84f
c3f84f
%if %with lldb
c3f84f
c3f84f
%package lldb
c3f84f
Summary:        LLDB pretty printers for Rust
a0c80e
BuildArch:      noarch
c3f84f
Requires:       lldb
d07ae9
Requires:       python3-lldb
ec855a
Requires:       %{name}-debugger-common = %{version}-%{release}
c3f84f
c3f84f
%description lldb
c3f84f
This package includes the rust-lldb script, which allows easier debugging of Rust
c3f84f
programs.
c3f84f
c3f84f
%endif
c3f84f
c3f84f
c3f84f
%package doc
c3f84f
Summary:        Documentation for Rust
c3f84f
# NOT BuildArch:      noarch
c3f84f
# Note, while docs are mostly noarch, some things do vary by target_arch.
c3f84f
# Koji will fail the build in rpmdiff if two architectures build a noarch
c3f84f
# subpackage differently, so instead we have to keep its arch.
c3f84f
235ca3
# Cargo no longer builds its own documentation
235ca3
# https://github.com/rust-lang/cargo/pull/4904
235ca3
# We used to keep a shim cargo-doc package, but now that's merged too.
235ca3
Obsoletes:      cargo-doc < 1.65.0~
235ca3
Provides:       cargo-doc = %{version}-%{release}
235ca3
c3f84f
%description doc
c3f84f
This package includes HTML documentation for the Rust programming language and
c3f84f
its standard library.
c3f84f
c3f84f
c3f84f
%package -n cargo
c3f84f
Summary:        Rust's package manager and build tool
c3f84f
%if %with bundled_libgit2
d07ae9
Provides:       bundled(libgit2) = %{bundled_libgit2_version}
c3f84f
%endif
c3f84f
# For tests:
d07ae9
BuildRequires:  git-core
c3f84f
# Cargo is not much use without Rust
d07ae9
Requires:       %{name}
c3f84f
a0c80e
# "cargo vendor" is a builtin command starting with 1.37.  The Obsoletes and
a0c80e
# Provides are mostly relevant to RHEL, but harmless to have on Fedora/etc. too
a0c80e
Obsoletes:      cargo-vendor <= 0.1.23
a0c80e
Provides:       cargo-vendor = %{version}-%{release}
a0c80e
c3f84f
%description -n cargo
c3f84f
Cargo is a tool that allows Rust projects to declare their various dependencies
c3f84f
and ensure that you'll always get a repeatable build.
c3f84f
c3f84f
c3f84f
%package -n rustfmt
c3f84f
Summary:        Tool to find and fix Rust formatting issues
c3f84f
Requires:       cargo
c3f84f
c3f84f
# The component/package was rustfmt-preview until Rust 1.31.
c3f84f
Obsoletes:      rustfmt-preview < 1.0.0
ec855a
Provides:       rustfmt-preview = %{version}-%{release}
c3f84f
c3f84f
%description -n rustfmt
c3f84f
A tool for formatting Rust code according to style guidelines.
c3f84f
c3f84f
235ca3
%package analyzer
235ca3
Summary:        Rust implementation of the Language Server Protocol
235ca3
235ca3
# The standard library sources are needed for most functionality.
235ca3
%if 0%{?rhel} && 0%{?rhel} < 8
235ca3
Requires:       %{name}-src
235ca3
%else
235ca3
Recommends:     %{name}-src
c3f84f
%endif
c3f84f
235ca3
# RLS is no longer available as of Rust 1.65, but we're including the stub
235ca3
# binary that implements LSP just enough to recommend rust-analyzer.
235ca3
Obsoletes:      rls < 1.65.0~
c3f84f
# The component/package was rls-preview until Rust 1.31.
c3f84f
Obsoletes:      rls-preview < 1.31.6
c3f84f
235ca3
%description analyzer
235ca3
rust-analyzer is an implementation of Language Server Protocol for the Rust
235ca3
programming language. It provides features like completion and goto definition
235ca3
for many code editors, including VS Code, Emacs and Vim.
c3f84f
c3f84f
c3f84f
%package -n clippy
c3f84f
Summary:        Lints to catch common mistakes and improve your Rust code
c3f84f
Requires:       cargo
c3f84f
# /usr/bin/clippy-driver is dynamically linked against internal rustc libs
ec855a
Requires:       %{name}%{?_isa} = %{version}-%{release}
c3f84f
c3f84f
# The component/package was clippy-preview until Rust 1.31.
c3f84f
Obsoletes:      clippy-preview <= 0.0.212
ec855a
Provides:       clippy-preview = %{version}-%{release}
c3f84f
c3f84f
%description -n clippy
c3f84f
A collection of lints to catch common mistakes and improve your Rust code.
c3f84f
c3f84f
c3f84f
%package src
c3f84f
Summary:        Sources for the Rust standard library
c3f84f
BuildArch:      noarch
235ca3
%if 0%{?rhel} && 0%{?rhel} < 8
235ca3
Requires:       %{name}-std-static = %{version}-%{release}
235ca3
%else
235ca3
Recommends:     %{name}-std-static = %{version}-%{release}
235ca3
%endif
c3f84f
c3f84f
%description src
c3f84f
This package includes source files for the Rust standard library.  It may be
c3f84f
useful as a reference for code completion tools in various editors.
c3f84f
c3f84f
c3f84f
%package analysis
c3f84f
Summary:        Compiler analysis data for the Rust standard library
235ca3
%if 0%{?rhel} && 0%{?rhel} < 8
d07ae9
Requires:       %{name}-std-static%{?_isa} = %{version}-%{release}
235ca3
%else
235ca3
Recommends:     %{name}-std-static%{?_isa} = %{version}-%{release}
235ca3
%endif
c3f84f
c3f84f
%description analysis
c3f84f
This package contains analysis data files produced with rustc's -Zsave-analysis
c3f84f
feature for the Rust standard library. The RLS (Rust Language Server) uses this
c3f84f
data to provide information about the Rust standard library.
c3f84f
c3f84f
198de9
%if 0%{?rhel} && 0%{?rhel} >= 8
198de9
198de9
%package toolset
198de9
Summary:        Rust Toolset
198de9
Requires:       rust%{?_isa} = %{version}-%{release}
198de9
Requires:       cargo%{?_isa} = %{version}-%{release}
198de9
198de9
%description toolset
198de9
This is the metapackage for Rust Toolset, bringing in the Rust compiler,
198de9
the Cargo package manager, and a few convenience macros for rpm builds.
198de9
198de9
%endif
198de9
198de9
c3f84f
%prep
c3f84f
c3f84f
%ifarch %{bootstrap_arches}
198de9
rm -rf %{local_rust_root}
198de9
%setup -q -n cargo-%{bootstrap_suffix} -T -b %{bootstrap_source_cargo}
198de9
./install.sh --prefix=%{local_rust_root} --disable-ldconfig
198de9
%setup -q -n rustc-%{bootstrap_suffix} -T -b %{bootstrap_source_rustc}
198de9
./install.sh --prefix=%{local_rust_root} --disable-ldconfig
198de9
%setup -q -n rust-std-%{bootstrap_suffix} -T -b %{bootstrap_source_std}
198de9
./install.sh --prefix=%{local_rust_root} --disable-ldconfig
c3f84f
test -f '%{local_rust_root}/bin/cargo'
c3f84f
test -f '%{local_rust_root}/bin/rustc'
c3f84f
%endif
c3f84f
d07ae9
%if %defined wasm_targets
d07ae9
%setup -q -n %{wasi_libc_name} -T -b 1
d07ae9
%endif
d07ae9
c3f84f
%setup -q -n %{rustc_package}
c3f84f
778c89
%patch1 -p1
198de9
%patch2 -p1
235ca3
%patch3 -p1
235ca3
%patch4 -p1
235ca3
%patch5 -p1
778c89
a0c80e
%if %with disabled_libssh2
f7bb61
%patch100 -p1
f7bb61
%endif
f7bb61
f7bb61
%if %without curl_http2
f7bb61
%patch101 -p1
f7bb61
rm -rf vendor/libnghttp2-sys/
a0c80e
%endif
c3f84f
f7bb61
%if 0%{?rhel} && 0%{?rhel} < 8
905bf8
%patch102 -p1
f7bb61
%endif
f7bb61
d07ae9
# Use our explicit python3 first
d07ae9
sed -i.try-python -e '/^try python3 /i try "%{__python3}" "$@"' ./configure
c3f84f
198de9
# Set a substitute-path in rust-gdb for standard library sources.
198de9
sed -i.rust-src -e "s#@BUILDDIR@#$PWD#" ./src/etc/rust-gdb
198de9
c3f84f
%if %without bundled_llvm
ec855a
rm -rf src/llvm-project/
905bf8
mkdir -p src/llvm-project/libunwind/
c3f84f
%endif
c3f84f
a0c80e
# Remove other unused vendored libraries
a0c80e
rm -rf vendor/curl-sys/curl/
198de9
rm -rf vendor/*jemalloc-sys*/jemalloc/
198de9
rm -rf vendor/libmimalloc-sys/c_src/mimalloc/
905bf8
rm -rf vendor/libssh2-sys/libssh2/
a0c80e
rm -rf vendor/libz-sys/src/zlib/
905bf8
rm -rf vendor/libz-sys/src/zlib-ng/
a0c80e
rm -rf vendor/lzma-sys/xz-*/
a0c80e
rm -rf vendor/openssl-src/openssl/
a0c80e
a0c80e
%if %without bundled_libgit2
a0c80e
rm -rf vendor/libgit2-sys/libgit2/
a0c80e
%endif
a0c80e
a0c80e
%if %with disabled_libssh2
a0c80e
rm -rf vendor/libssh2-sys/
a0c80e
%endif
a0c80e
a0c80e
# This only affects the transient rust-installer, but let it use our dynamic xz-libs
a0c80e
sed -i.lzma -e '/LZMA_API_STATIC/d' src/bootstrap/tool.rs
a0c80e
f7bb61
%if %{with bundled_llvm} && 0%{?epel} == 7
c3f84f
mkdir -p cmake-bin
c3f84f
ln -s /usr/bin/cmake3 cmake-bin/cmake
c3f84f
%global cmake_path $PWD/cmake-bin
c3f84f
%endif
c3f84f
c3f84f
%if %{without bundled_llvm} && %{with llvm_static}
c3f84f
# Static linking to distro LLVM needs to add -lffi
c3f84f
# https://github.com/rust-lang/rust/issues/34486
c3f84f
sed -i.ffi -e '$a #[link(name = "ffi")] extern {}' \
235ca3
  compiler/rustc_llvm/src/lib.rs
c3f84f
%endif
c3f84f
c3f84f
# The configure macro will modify some autoconf-related files, which upsets
c3f84f
# cargo when it tries to verify checksums in those files.  If we just truncate
c3f84f
# that file list, cargo won't have anything to complain about.
ec855a
find vendor -name .cargo-checksum.json \
c3f84f
  -exec sed -i.uncheck -e 's/"files":{[^}]*}/"files":{ }/' '{}' '+'
c3f84f
6a711d
# Sometimes Rust sources start with #![...] attributes, and "smart" editors think
6a711d
# it's a shebang and make them executable. Then brp-mangle-shebangs gets upset...
6a711d
find -name '*.rs' -type f -perm /111 -exec chmod -v -x '{}' '+'
6a711d
f7bb61
# Set up shared environment variables for build/install/check
d07ae9
%global rust_env %{?rustflags:RUSTFLAGS="%{rustflags}"}
f7bb61
%if 0%{?cmake_path:1}
d07ae9
%global rust_env %{?rust_env} PATH="%{cmake_path}:$PATH"
c3f84f
%endif
905bf8
%if %without disabled_libssh2
c3f84f
# convince libssh2-sys to use the distro libssh2
d07ae9
%global rust_env %{?rust_env} LIBSSH2_SYS_USE_PKG_CONFIG=1
c3f84f
%endif
d07ae9
%global export_rust_env %{?rust_env:export %{rust_env}}
c3f84f
f7bb61
f7bb61
%build
d07ae9
%{export_rust_env}
c3f84f
235ca3
%ifarch %{arm} %{ix86}
c3f84f
# full debuginfo is exhausting memory; just do libstd for now
c3f84f
# https://github.com/rust-lang/rust/issues/45854
f7bb61
%if 0%{?rhel} && 0%{?rhel} < 8
c3f84f
# Older rpmbuild didn't work with partial debuginfo coverage.
c3f84f
%global debug_package %{nil}
a0c80e
%define enable_debuginfo --debuginfo-level=0
c3f84f
%else
a0c80e
%define enable_debuginfo --debuginfo-level=0 --debuginfo-level-std=2
c3f84f
%endif
c3f84f
%else
a0c80e
%define enable_debuginfo --debuginfo-level=2
c3f84f
%endif
c3f84f
ab64c0
# Some builders have relatively little memory for their CPU count.
ab64c0
# At least 2GB per CPU is a good rule of thumb for building rustc.
ab64c0
ncpus=$(/usr/bin/getconf _NPROCESSORS_ONLN)
ab64c0
max_cpus=$(( ($(free -g | awk '/^Mem:/{print $2}') + 1) / 2 ))
ab64c0
if [ "$max_cpus" -ge 1 -a "$max_cpus" -lt "$ncpus" ]; then
ab64c0
  ncpus="$max_cpus"
ab64c0
fi
ab64c0
d07ae9
%if %defined mingw_targets
d07ae9
%{lua: do
d07ae9
  local cfg = ""
d07ae9
  for triple in string.gmatch(rpm.expand("%{mingw_targets}"), "%S+") do
d07ae9
    local subs = {
d07ae9
      triple = triple,
d07ae9
      mingw = string.sub(triple, 1, 4) == "i686" and "mingw32" or "mingw64",
d07ae9
    }
198de9
    local s = string.gsub([[
d07ae9
      --set target.{{triple}}.linker=%{{{mingw}}_cc}
d07ae9
      --set target.{{triple}}.cc=%{{{mingw}}_cc}
d07ae9
      --set target.{{triple}}.ar=%{{{mingw}}_ar}
d07ae9
      --set target.{{triple}}.ranlib=%{{{mingw}}_ranlib}
198de9
    ]], "{{(%w+)}}", subs)
d07ae9
    cfg = cfg .. " " .. s
d07ae9
  end
198de9
  cfg = string.gsub(cfg, "%s+", " ")
d07ae9
  rpm.define("mingw_target_config " .. cfg)
d07ae9
end}
d07ae9
%endif
d07ae9
d07ae9
%if %defined wasm_targets
198de9
%make_build --quiet -C %{wasi_libc_dir} CC=clang AR=llvm-ar NM=llvm-nm
d07ae9
%{lua: do
d07ae9
  local wasi_root = rpm.expand("%{wasi_libc_dir}") .. "/sysroot"
d07ae9
  local cfg = ""
d07ae9
  for triple in string.gmatch(rpm.expand("%{wasm_targets}"), "%S+") do
d07ae9
    if string.find(triple, "-wasi") then
d07ae9
      cfg = cfg .. " --set target." .. triple .. ".wasi-root=" .. wasi_root
d07ae9
    end
d07ae9
  end
d07ae9
  rpm.define("wasm_target_config "..cfg)
d07ae9
end}
d07ae9
%endif
d07ae9
c3f84f
%configure --disable-option-checking \
c3f84f
  --libdir=%{common_libdir} \
c3f84f
  --build=%{rust_triple} --host=%{rust_triple} --target=%{rust_triple} \
198de9
  --set target.%{rust_triple}.linker=%{__cc} \
198de9
  --set target.%{rust_triple}.cc=%{__cc} \
198de9
  --set target.%{rust_triple}.cxx=%{__cxx} \
198de9
  --set target.%{rust_triple}.ar=%{__ar} \
198de9
  --set target.%{rust_triple}.ranlib=%{__ranlib} \
d07ae9
  %{?mingw_target_config} \
d07ae9
  %{?wasm_target_config} \
d07ae9
  --python=%{__python3} \
c3f84f
  --local-rust-root=%{local_rust_root} \
198de9
  --set build.rustfmt=/bin/true \
c3f84f
  %{!?with_bundled_llvm: --llvm-root=%{llvm_root} \
c3f84f
    %{!?llvm_has_filecheck: --disable-codegen-tests} \
c3f84f
    %{!?with_llvm_static: --enable-llvm-link-shared } } \
198de9
  --disable-llvm-static-stdcpp \
c3f84f
  --disable-rpath \
c3f84f
  %{enable_debuginfo} \
4ac2b7
  --set rust.codegen-units-std=1 \
235ca3
  --set build.build-stage=2 \
235ca3
  --set build.doc-stage=2 \
235ca3
  --set build.install-stage=2 \
235ca3
  --set build.test-stage=2 \
c3f84f
  --enable-extended \
235ca3
  --tools=analysis,cargo,clippy,rls,rust-analyzer,rustfmt,src \
c3f84f
  --enable-vendor \
c3f84f
  --enable-verbose-tests \
d07ae9
  --dist-compression-formats=gz \
778c89
  --release-channel=%{channel} \
778c89
  --release-description="%{?fedora:Fedora }%{?rhel:Red Hat }%{version}-%{release}"
c3f84f
235ca3
%{__python3} ./x.py build -j "$ncpus"
235ca3
%{__python3} ./x.py doc
c3f84f
d07ae9
for triple in %{?mingw_targets} %{?wasm_targets}; do
235ca3
  %{__python3} ./x.py build --target=$triple std
4ac2b7
done
c3f84f
c3f84f
%install
d07ae9
%{export_rust_env}
c3f84f
d07ae9
DESTDIR=%{buildroot} %{__python3} ./x.py install
c3f84f
d07ae9
for triple in %{?mingw_targets} %{?wasm_targets}; do
d07ae9
  DESTDIR=%{buildroot} %{__python3} ./x.py install --target=$triple std
4ac2b7
done
4ac2b7
235ca3
# The rls stub doesn't have an install target, but we can just copy it.
235ca3
%{__install} -t %{buildroot}%{_bindir} build/%{rust_triple}/stage2-tools-bin/rls
235ca3
4ac2b7
# These are transient files used by x.py dist and install
4ac2b7
rm -rf ./build/dist/ ./build/tmp/
4ac2b7
c3f84f
# Make sure the shared libraries are in the proper libdir
c3f84f
%if "%{_libdir}" != "%{common_libdir}"
c3f84f
mkdir -p %{buildroot}%{_libdir}
c3f84f
find %{buildroot}%{common_libdir} -maxdepth 1 -type f -name '*.so' \
c3f84f
  -exec mv -v -t %{buildroot}%{_libdir} '{}' '+'
c3f84f
%endif
c3f84f
c3f84f
# The shared libraries should be executable for debuginfo extraction.
c3f84f
find %{buildroot}%{_libdir} -maxdepth 1 -type f -name '*.so' \
c3f84f
  -exec chmod -v +x '{}' '+'
c3f84f
c3f84f
# The libdir libraries are identical to those under rustlib/.  It's easier on
c3f84f
# library loading if we keep them in libdir, but we do need them in rustlib/
c3f84f
# to support dynamic linking for compiler plugins, so we'll symlink.
235ca3
find %{buildroot}%{rustlibdir}/%{rust_triple}/lib/ -maxdepth 1 -type f -name '*.so' |
235ca3
while read lib; do
235ca3
 lib2="%{buildroot}%{_libdir}/${lib##*/}"
235ca3
 if [ -f "$lib2" ]; then
235ca3
   # make sure they're actually identical!
235ca3
   cmp "$lib" "$lib2"
235ca3
   ln -v -f -r -s -T "$lib2" "$lib"
235ca3
 fi
235ca3
done
c3f84f
c3f84f
# Remove installer artifacts (manifests, uninstall scripts, etc.)
c3f84f
find %{buildroot}%{rustlibdir} -maxdepth 1 -type f -exec rm -v '{}' '+'
c3f84f
c3f84f
# Remove backup files from %%configure munging
c3f84f
find %{buildroot}%{rustlibdir} -type f -name '*.orig' -exec rm -v '{}' '+'
c3f84f
c3f84f
# https://fedoraproject.org/wiki/Changes/Make_ambiguous_python_shebangs_error
c3f84f
# We don't actually need to ship any of those python scripts in rust-src anyway.
c3f84f
find %{buildroot}%{rustlibdir}/src -type f -name '*.py' -exec rm -v '{}' '+'
c3f84f
c3f84f
# FIXME: __os_install_post will strip the rlibs
c3f84f
# -- should we find a way to preserve debuginfo?
c3f84f
c3f84f
# Remove unwanted documentation files (we already package them)
c3f84f
rm -f %{buildroot}%{_docdir}/%{name}/README.md
c3f84f
rm -f %{buildroot}%{_docdir}/%{name}/COPYRIGHT
c3f84f
rm -f %{buildroot}%{_docdir}/%{name}/LICENSE
c3f84f
rm -f %{buildroot}%{_docdir}/%{name}/LICENSE-APACHE
c3f84f
rm -f %{buildroot}%{_docdir}/%{name}/LICENSE-MIT
c3f84f
rm -f %{buildroot}%{_docdir}/%{name}/LICENSE-THIRD-PARTY
c3f84f
rm -f %{buildroot}%{_docdir}/%{name}/*.old
c3f84f
c3f84f
# Sanitize the HTML documentation
c3f84f
find %{buildroot}%{_docdir}/%{name}/html -empty -delete
c3f84f
find %{buildroot}%{_docdir}/%{name}/html -type f -exec chmod -x '{}' '+'
c3f84f
c3f84f
# Create the path for crate-devel packages
c3f84f
mkdir -p %{buildroot}%{_datadir}/cargo/registry
c3f84f
c3f84f
# Cargo no longer builds its own documentation
c3f84f
# https://github.com/rust-lang/cargo/pull/4904
c3f84f
mkdir -p %{buildroot}%{_docdir}/cargo
c3f84f
ln -sT ../rust/html/cargo/ %{buildroot}%{_docdir}/cargo/html
c3f84f
c3f84f
%if %without lldb
c3f84f
rm -f %{buildroot}%{_bindir}/rust-lldb
f7bb61
rm -f %{buildroot}%{rustlibdir}/etc/lldb_*
c3f84f
%endif
c3f84f
778c89
# We don't want Rust copies of LLVM tools (rust-lld, rust-llvm-dwp)
778c89
rm -f %{buildroot}%{rustlibdir}/%{rust_triple}/bin/rust-ll*
778c89
198de9
%if 0%{?rhel} && 0%{?rhel} >= 8
198de9
# This allows users to build packages using Rust Toolset.
198de9
%{__install} -D -m 644 %{S:100} %{buildroot}%{rpmmacrodir}/macros.rust-toolset
198de9
%endif
198de9
c3f84f
c3f84f
%check
d07ae9
%{export_rust_env}
d07ae9
d07ae9
# Sanity-check the installed binaries, debuginfo-stripped and all.
d07ae9
%{buildroot}%{_bindir}/cargo new build/hello-world
d07ae9
env RUSTC=%{buildroot}%{_bindir}/rustc \
d07ae9
    LD_LIBRARY_PATH="%{buildroot}%{_libdir}:$LD_LIBRARY_PATH" \
d07ae9
    %{buildroot}%{_bindir}/cargo run --manifest-path build/hello-world/Cargo.toml
c3f84f
198de9
# Try a build sanity-check for other targets
198de9
for triple in %{?mingw_targets} %{?wasm_targets}; do
198de9
  env RUSTC=%{buildroot}%{_bindir}/rustc \
198de9
      LD_LIBRARY_PATH="%{buildroot}%{_libdir}:$LD_LIBRARY_PATH" \
198de9
      %{buildroot}%{_bindir}/cargo build --manifest-path build/hello-world/Cargo.toml --target=$triple
198de9
done
198de9
c3f84f
# The results are not stable on koji, so mask errors and just log it.
4ac2b7
# Some of the larger test artifacts are manually cleaned to save space.
235ca3
timeout -v 90m %{__python3} ./x.py test --no-fail-fast || :
4ac2b7
rm -rf "./build/%{rust_triple}/test/"
4ac2b7
235ca3
timeout -v 30m %{__python3} ./x.py test --no-fail-fast cargo || :
4ac2b7
rm -rf "./build/%{rust_triple}/stage2-tools/%{rust_triple}/cit/"
4ac2b7
235ca3
timeout -v 30m %{__python3} ./x.py test --no-fail-fast clippy || :
d07ae9
235ca3
timeout -v 30m %{__python3} ./x.py test --no-fail-fast rust-analyzer || :
d07ae9
235ca3
timeout -v 30m %{__python3} ./x.py test --no-fail-fast rustfmt || :
c3f84f
c3f84f
c3f84f
%ldconfig_scriptlets
c3f84f
c3f84f
c3f84f
%files
c3f84f
%license COPYRIGHT LICENSE-APACHE LICENSE-MIT
c3f84f
%doc README.md
c3f84f
%{_bindir}/rustc
c3f84f
%{_bindir}/rustdoc
c3f84f
%{_libdir}/*.so
235ca3
%{_libexecdir}/rust-analyzer-proc-macro-srv
c3f84f
%{_mandir}/man1/rustc.1*
c3f84f
%{_mandir}/man1/rustdoc.1*
c3f84f
%dir %{rustlibdir}
c3f84f
%dir %{rustlibdir}/%{rust_triple}
c3f84f
%dir %{rustlibdir}/%{rust_triple}/lib
c3f84f
%{rustlibdir}/%{rust_triple}/lib/*.so
c3f84f
c3f84f
c3f84f
%files std-static
c3f84f
%dir %{rustlibdir}
c3f84f
%dir %{rustlibdir}/%{rust_triple}
c3f84f
%dir %{rustlibdir}/%{rust_triple}/lib
c3f84f
%{rustlibdir}/%{rust_triple}/lib/*.rlib
c3f84f
c3f84f
d07ae9
%if %defined mingw_targets
4ac2b7
%{lua: do
d07ae9
  for triple in string.gmatch(rpm.expand("%{mingw_targets}"), "%S+") do
4ac2b7
    local subs = {
4ac2b7
      triple = triple,
4ac2b7
      rustlibdir = rpm.expand("%{rustlibdir}"),
4ac2b7
    }
4ac2b7
    local s = string.gsub([[
d07ae9
4ac2b7
%files std-static-{{triple}}
4ac2b7
%dir {{rustlibdir}}
4ac2b7
%dir {{rustlibdir}}/{{triple}}
4ac2b7
%dir {{rustlibdir}}/{{triple}}/lib
4ac2b7
{{rustlibdir}}/{{triple}}/lib/*.rlib
d07ae9
{{rustlibdir}}/{{triple}}/lib/rs*.o
d07ae9
%exclude {{rustlibdir}}/{{triple}}/lib/*.dll
d07ae9
%exclude {{rustlibdir}}/{{triple}}/lib/*.dll.a
d07ae9
%exclude {{rustlibdir}}/{{triple}}/lib/self-contained
d07ae9
d07ae9
]], "{{(%w+)}}", subs)
d07ae9
    print(s)
d07ae9
  end
d07ae9
end}
d07ae9
%endif
d07ae9
d07ae9
d07ae9
%if %defined wasm_targets
d07ae9
%{lua: do
d07ae9
  for triple in string.gmatch(rpm.expand("%{wasm_targets}"), "%S+") do
d07ae9
    local subs = {
d07ae9
      triple = triple,
d07ae9
      rustlibdir = rpm.expand("%{rustlibdir}"),
d07ae9
      wasi = string.find(triple, "-wasi") and 1 or 0,
d07ae9
    }
d07ae9
    local s = string.gsub([[
d07ae9
d07ae9
%files std-static-{{triple}}
d07ae9
%dir {{rustlibdir}}
d07ae9
%dir {{rustlibdir}}/{{triple}}
d07ae9
%dir {{rustlibdir}}/{{triple}}/lib
d07ae9
{{rustlibdir}}/{{triple}}/lib/*.rlib
d07ae9
%if {{wasi}}
d07ae9
%dir {{rustlibdir}}/{{triple}}/lib/self-contained
d07ae9
{{rustlibdir}}/{{triple}}/lib/self-contained/crt*.o
d07ae9
{{rustlibdir}}/{{triple}}/lib/self-contained/libc.a
d07ae9
%endif
d07ae9
4ac2b7
]], "{{(%w+)}}", subs)
4ac2b7
    print(s)
4ac2b7
  end
4ac2b7
end}
4ac2b7
%endif
4ac2b7
4ac2b7
c3f84f
%files debugger-common
c3f84f
%dir %{rustlibdir}
c3f84f
%dir %{rustlibdir}/etc
f7bb61
%{rustlibdir}/etc/rust_*.py*
c3f84f
c3f84f
c3f84f
%files gdb
c3f84f
%{_bindir}/rust-gdb
f7bb61
%{rustlibdir}/etc/gdb_*
ec855a
%exclude %{_bindir}/rust-gdbgui
c3f84f
c3f84f
c3f84f
%if %with lldb
c3f84f
%files lldb
c3f84f
%{_bindir}/rust-lldb
f7bb61
%{rustlibdir}/etc/lldb_*
c3f84f
%endif
c3f84f
c3f84f
c3f84f
%files doc
c3f84f
%docdir %{_docdir}/%{name}
c3f84f
%dir %{_docdir}/%{name}
c3f84f
%dir %{_docdir}/%{name}/html
c3f84f
%{_docdir}/%{name}/html/*/
c3f84f
%{_docdir}/%{name}/html/*.html
c3f84f
%{_docdir}/%{name}/html/*.css
c3f84f
%{_docdir}/%{name}/html/*.js
ec855a
%{_docdir}/%{name}/html/*.png
c3f84f
%{_docdir}/%{name}/html/*.svg
778c89
%{_docdir}/%{name}/html/*.woff2
c3f84f
%license %{_docdir}/%{name}/html/*.txt
a0c80e
%license %{_docdir}/%{name}/html/*.md
235ca3
# former cargo-doc
235ca3
%docdir %{_docdir}/cargo
235ca3
%dir %{_docdir}/cargo
235ca3
%{_docdir}/cargo/html
c3f84f
c3f84f
c3f84f
%files -n cargo
235ca3
%license src/tools/cargo/LICENSE-{APACHE,MIT,THIRD-PARTY}
c3f84f
%doc src/tools/cargo/README.md
c3f84f
%{_bindir}/cargo
778c89
%{_libexecdir}/cargo*
c3f84f
%{_mandir}/man1/cargo*.1*
c3f84f
%{_sysconfdir}/bash_completion.d/cargo
c3f84f
%{_datadir}/zsh/site-functions/_cargo
c3f84f
%dir %{_datadir}/cargo
c3f84f
%dir %{_datadir}/cargo/registry
c3f84f
c3f84f
c3f84f
%files -n rustfmt
c3f84f
%{_bindir}/rustfmt
c3f84f
%{_bindir}/cargo-fmt
c3f84f
%doc src/tools/rustfmt/{README,CHANGELOG,Configurations}.md
c3f84f
%license src/tools/rustfmt/LICENSE-{APACHE,MIT}
c3f84f
c3f84f
235ca3
%files analyzer
c3f84f
%{_bindir}/rls
235ca3
%{_bindir}/rust-analyzer
235ca3
%doc src/tools/rust-analyzer/README.md
235ca3
%license src/tools/rust-analyzer/LICENSE-{APACHE,MIT}
c3f84f
c3f84f
c3f84f
%files -n clippy
c3f84f
%{_bindir}/cargo-clippy
c3f84f
%{_bindir}/clippy-driver
c3f84f
%doc src/tools/clippy/{README.md,CHANGELOG.md}
c3f84f
%license src/tools/clippy/LICENSE-{APACHE,MIT}
c3f84f
c3f84f
c3f84f
%files src
c3f84f
%dir %{rustlibdir}
c3f84f
%{rustlibdir}/src
c3f84f
c3f84f
c3f84f
%files analysis
c3f84f
%{rustlibdir}/%{rust_triple}/analysis/
c3f84f
c3f84f
198de9
%if 0%{?rhel} && 0%{?rhel} >= 8
198de9
%files toolset
198de9
%{rpmmacrodir}/macros.rust-toolset
198de9
%endif
198de9
198de9
c3f84f
%changelog
235ca3
* Wed Jan 11 2023 Josh Stone <jistone@redhat.com> - 1.66.1-1
235ca3
- Update to 1.66.1.
235ca3
235ca3
* Fri Jan 06 2023 Josh Stone <jistone@redhat.com> - 1.65.0-1
235ca3
- Update to 1.65.0.
235ca3
- rust-analyzer now obsoletes rls.
235ca3
235ca3
* Thu Sep 22 2022 Josh Stone <jistone@redhat.com> - 1.64.0-1
235ca3
- Update to 1.64.0.
235ca3
- Add rust-analyzer.
235ca3
235ca3
* Wed Sep 07 2022 Josh Stone <jistone@redhat.com> - 1.63.0-1
235ca3
- Update to 1.63.0.
235ca3
198de9
* Tue Jul 19 2022 Josh Stone <jistone@redhat.com> - 1.62.1-1
198de9
- Update to 1.62.1.
198de9
198de9
* Wed Jul 13 2022 Josh Stone <jistone@redhat.com> - 1.62.0-2
198de9
- Prevent unsound coercions from functions with opaque return types.
198de9
198de9
* Thu Jun 30 2022 Josh Stone <jistone@redhat.com> - 1.62.0-1
198de9
- Update to 1.62.0.
198de9
198de9
* Fri Jun 03 2022 Josh Stone <jistone@redhat.com> - 1.61.0-1
198de9
- Update to 1.61.0.
198de9
- Add rust-toolset as a subpackage.
198de9
198de9
* Wed Apr 20 2022 Josh Stone <jistone@redhat.com> - 1.60.0-1
198de9
- Update to 1.60.0.
198de9
198de9
* Tue Apr 19 2022 Josh Stone <jistone@redhat.com> - 1.59.0-1
198de9
- Update to 1.59.0.
198de9
d07ae9
* Thu Jan 20 2022 Josh Stone <jistone@redhat.com> - 1.58.1-1
d07ae9
- Update to 1.58.1.
d07ae9
d07ae9
* Thu Jan 13 2022 Josh Stone <jistone@redhat.com> - 1.58.0-1
d07ae9
- Update to 1.58.0.
d07ae9
d07ae9
* Wed Dec 15 2021 Josh Stone <jistone@redhat.com> - 1.57.0-1
d07ae9
- Update to 1.57.0.
d07ae9
d07ae9
* Thu Dec 02 2021 Josh Stone <jistone@redhat.com> - 1.56.1-2
d07ae9
- Add rust-std-static-wasm32-wasi
d07ae9
  Resolves: rhbz#1980080
d07ae9
d07ae9
* Tue Nov 02 2021 Josh Stone <jistone@redhat.com> - 1.56.0-1
d07ae9
- Update to 1.56.1.
d07ae9
d07ae9
* Fri Oct 29 2021 Josh Stone <jistone@redhat.com> - 1.55.0-1
d07ae9
- Update to 1.55.0.
d07ae9
- Backport support for LLVM 13.
16df65
4ac2b7
* Tue Aug 17 2021 Josh Stone <jistone@redhat.com> - 1.54.0-2
4ac2b7
- Make std-static-wasm* arch-specific to avoid s390x.
4ac2b7
4ac2b7
* Thu Jul 29 2021 Josh Stone <jistone@redhat.com> - 1.54.0-1
4ac2b7
- Update to 1.54.0.
4ac2b7
4ac2b7
* Tue Jul 20 2021 Josh Stone <jistone@redhat.com> - 1.53.0-2
4ac2b7
- Use llvm-ranlib to fix wasm archives.
4ac2b7
4ac2b7
* Mon Jun 21 2021 Josh Stone <jistone@redhat.com> - 1.53.0-1
4ac2b7
- Update to 1.53.0.
4ac2b7
4ac2b7
* Tue Jun 15 2021 Josh Stone <jistone@redhat.com> - 1.52.1-2
4ac2b7
- Set rust.codegen-units-std=1 for all targets again.
4ac2b7
- Add rust-std-static-wasm32-unknown-unknown.
4ac2b7
778c89
* Tue May 25 2021 Josh Stone <jistone@redhat.com> - 1.52.1-1
778c89
- Update to 1.52.1. Includes security fixes for CVE-2020-36323,
778c89
  CVE-2021-28876, CVE-2021-28878, CVE-2021-28879, and CVE-2021-31162.
778c89
778c89
* Mon May 24 2021 Josh Stone <jistone@redhat.com> - 1.51.0-1
778c89
- Update to 1.51.0. Update to 1.51.0. Includes security fixes for
778c89
  CVE-2021-28875 and CVE-2021-28877.
778c89
778c89
* Mon May 24 2021 Josh Stone <jistone@redhat.com> - 1.50.0-1
778c89
- Update to 1.50.0.
778c89
905bf8
* Wed Jan 13 2021 Josh Stone <jistone@redhat.com> - 1.49.0-1
905bf8
- Update to 1.49.0.
905bf8
905bf8
* Tue Jan 12 2021 Josh Stone <jistone@redhat.com> - 1.48.0-1
905bf8
- Update to 1.48.0.
905bf8
f7bb61
* Thu Oct 22 2020 Josh Stone <jistone@redhat.com> - 1.47.0-1
f7bb61
- Update to 1.47.0.
f7bb61
f7bb61
* Wed Oct 14 2020 Josh Stone <jistone@redhat.com> - 1.46.0-1
f7bb61
- Update to 1.46.0.
f7bb61
ab64c0
* Tue Aug 04 2020 Josh Stone <jistone@redhat.com> - 1.45.2-1
ab64c0
- Update to 1.45.2.
ab64c0
ab64c0
* Thu Jul 16 2020 Josh Stone <jistone@redhat.com> - 1.45.0-1
ab64c0
- Update to 1.45.0.
ab64c0
ab64c0
* Tue Jul 14 2020 Josh Stone <jistone@redhat.com> - 1.44.1-1
ab64c0
- Update to 1.44.1.
ab64c0
54b405
* Thu May 07 2020 Josh Stone <jistone@redhat.com> - 1.43.1-1
54b405
- Update to 1.43.1.
54b405
54b405
* Thu Apr 23 2020 Josh Stone <jistone@redhat.com> - 1.43.0-1
54b405
- Update to 1.43.0.
54b405
54b405
* Thu Mar 12 2020 Josh Stone <jistone@redhat.com> - 1.42.0-1
54b405
- Update to 1.42.0.
54b405
eacbcd
* Thu Feb 27 2020 Josh Stone <jistone@redhat.com> - 1.41.1-1
eacbcd
- Update to 1.41.1.
eacbcd
eacbcd
* Thu Jan 30 2020 Josh Stone <jistone@redhat.com> - 1.41.0-1
eacbcd
- Update to 1.41.0.
eacbcd
eacbcd
* Thu Jan 16 2020 Josh Stone <jistone@redhat.com> - 1.40.0-1
eacbcd
- Update to 1.40.0.
eacbcd
- Fix compiletest with newer (local-rebuild) libtest
eacbcd
- Build compiletest with in-tree libtest
eacbcd
- Fix ARM EHABI unwinding
eacbcd
6a711d
* Tue Nov 12 2019 Josh Stone <jistone@redhat.com> - 1.39.0-2
6a711d
- Fix a couple build and test issues with rustdoc.
6a711d
6a711d
* Thu Nov 07 2019 Josh Stone <jistone@redhat.com> - 1.39.0-1
6a711d
- Update to 1.39.0.
6a711d
6a711d
* Thu Sep 26 2019 Josh Stone <jistone@redhat.com> - 1.38.0-1
6a711d
- Update to 1.38.0.
6a711d
a0c80e
* Thu Aug 15 2019 Josh Stone <jistone@redhat.com> - 1.37.0-1
a0c80e
- Update to 1.37.0.
a0c80e
- Disable libssh2 (git+ssh support).
a0c80e
a0c80e
* Thu Jul 04 2019 Josh Stone <jistone@redhat.com> - 1.36.0-1
a0c80e
- Update to 1.36.0.
a0c80e
ec855a
* Wed May 29 2019 Josh Stone <jistone@redhat.com> - 1.35.0-2
ec855a
- Fix compiletest for rebuild testing.
ec855a
ec855a
* Thu May 23 2019 Josh Stone <jistone@redhat.com> - 1.35.0-1
ec855a
- Update to 1.35.0.
ec855a
ec855a
* Tue May 14 2019 Josh Stone <jistone@redhat.com> - 1.34.2-1
ec855a
- Update to 1.34.2 -- fixes CVE-2019-12083.
ec855a
ec855a
* Thu May 09 2019 Josh Stone <jistone@redhat.com> - 1.34.1-1
ec855a
- Update to 1.34.1.
ec855a
ec855a
* Thu Apr 11 2019 Josh Stone <jistone@redhat.com> - 1.34.0-1
ec855a
- Update to 1.34.0.
ec855a
ec855a
* Wed Apr 10 2019 Josh Stone <jistone@redhat.com> - 1.33.0-1
ec855a
- Update to 1.33.0.
ec855a
ec855a
* Tue Apr 09 2019 Josh Stone <jistone@redhat.com> - 1.32.0-1
ec855a
- Update to 1.32.0.
ec855a
c3f84f
* Fri Dec 14 2018 Josh Stone <jistone@redhat.com> - 1.31.0-5
c3f84f
- Restore rust-lldb.
c3f84f
c3f84f
* Thu Dec 13 2018 Josh Stone <jistone@redhat.com> - 1.31.0-4
c3f84f
- Backport fixes for rls.
c3f84f
c3f84f
* Thu Dec 13 2018 Josh Stone <jistone@redhat.com> - 1.31.0-3
c3f84f
- Update to 1.31.0 -- Rust 2018!
c3f84f
- clippy/rls/rustfmt are no longer -preview
c3f84f
c3f84f
* Wed Dec 12 2018 Josh Stone <jistone@redhat.com> - 1.30.1-2
c3f84f
- Update to 1.30.1.
c3f84f
c3f84f
* Tue Nov 06 2018 Josh Stone <jistone@redhat.com> - 1.29.2-1
c3f84f
- Update to 1.29.2.
c3f84f
c3f84f
* Thu Nov 01 2018 Josh Stone <jistone@redhat.com> - 1.28.0-1
c3f84f
- Update to 1.28.0.
c3f84f
c3f84f
* Thu Nov 01 2018 Josh Stone <jistone@redhat.com> - 1.27.2-1
c3f84f
- Update to 1.27.2.
c3f84f
c3f84f
* Wed Oct 10 2018 Josh Stone <jistone@redhat.com> - 1.26.2-12
c3f84f
- Fix "fp" target feature for AArch64 (#1632880)
c3f84f
c3f84f
* Mon Oct 08 2018 Josh Stone <jistone@redhat.com> - 1.26.2-11
c3f84f
- Security fix for str::repeat (pending CVE).
c3f84f
c3f84f
* Fri Oct 05 2018 Josh Stone <jistone@redhat.com> - 1.26.2-10
c3f84f
- Rebuild without bootstrap binaries.
c3f84f
c3f84f
* Thu Oct 04 2018 Josh Stone <jistone@redhat.com> - 1.26.2-9
c3f84f
- Bootstrap without SCL packaging. (rhbz1635067)
c3f84f
c3f84f
* Tue Aug 28 2018 Tom Stellard <tstellar@redhat.com> - 1.26.2-8
c3f84f
- Use python3 prefix for lldb Requires
c3f84f
c3f84f
* Mon Aug 13 2018 Josh Stone <jistone@redhat.com> - 1.26.2-7
c3f84f
- Build with platform-python
c3f84f
c3f84f
* Tue Aug 07 2018 Josh Stone <jistone@redhat.com> - 1.26.2-6
c3f84f
- Exclude rust-src from auto-requires
c3f84f
c3f84f
* Thu Aug 02 2018 Josh Stone <jistone@redhat.com> - 1.26.2-5
c3f84f
- Rebuild without bootstrap binaries.
c3f84f
c3f84f
* Tue Jul 31 2018 Josh Stone <jistone@redhat.com> - 1.26.2-4
c3f84f
- Bootstrap as a module.
c3f84f
c3f84f
* Mon Jun 04 2018 Josh Stone <jistone@redhat.com> - 1.26.2-3
c3f84f
- Update to 1.26.2.
c3f84f
c3f84f
* Wed May 30 2018 Josh Stone <jistone@redhat.com> - 1.26.1-2
c3f84f
- Update to 1.26.1.
c3f84f
c3f84f
* Fri May 18 2018 Josh Stone <jistone@redhat.com> - 1.26.0-1
c3f84f
- Update to 1.26.0.
c3f84f
c3f84f
* Tue Apr 10 2018 Josh Stone <jistone@redhat.com> - 1.25.0-2
c3f84f
- Filter codegen-backends from Provides too.
c3f84f
c3f84f
* Tue Apr 03 2018 Josh Stone <jistone@redhat.com> - 1.25.0-1
c3f84f
- Update to 1.25.0.
c3f84f
- Add rustfmt-preview as a subpackage.
c3f84f
c3f84f
* Thu Feb 22 2018 Josh Stone <jistone@redhat.com> - 1.24.0-1
c3f84f
- Update to 1.24.0.
c3f84f
c3f84f
* Tue Jan 16 2018 Josh Stone <jistone@redhat.com> - 1.23.0-2
c3f84f
- Rebuild without bootstrap binaries.
c3f84f
c3f84f
* Mon Jan 15 2018 Josh Stone <jistone@redhat.com> - 1.23.0-1
c3f84f
- Bootstrap 1.23 on el8.