db49a4
# Only x86_64 and i686 are Tier 1 platforms at this time.
872d83
# https://doc.rust-lang.org/nightly/rustc/platform-support.html
db49a4
#global rust_arches x86_64 i686 armv7hl aarch64 ppc64 ppc64le s390x
db49a4
%global rust_arches x86_64 i686 aarch64 ppc64le s390x
db49a4
db49a4
# The channel can be stable, beta, or nightly
db49a4
%{!?channel: %global channel stable}
db49a4
db49a4
# To bootstrap from scratch, set the channel and date from src/stage0.txt
db49a4
# e.g. 1.10.0 wants rustc: 1.9.0-2016-05-24
db49a4
# or nightly wants some beta-YYYY-MM-DD
db49a4
# Note that cargo matches the program version here, not its crate version.
872d83
%global bootstrap_rust 1.48.0
872d83
%global bootstrap_cargo 1.48.0
872d83
%global bootstrap_channel 1.48.0
872d83
%global bootstrap_date 2020-11-19
db49a4
db49a4
# Only the specified arches will use bootstrap binaries.
db49a4
#global bootstrap_arches %%{rust_arches}
db49a4
db49a4
# Using llvm-static may be helpful as an opt-in, e.g. to aid LLVM rebases.
db49a4
%bcond_with llvm_static
db49a4
db49a4
# We can also choose to just use Rust's bundled LLVM, in case the system LLVM
872d83
# is insufficient.  Rust currently requires LLVM 8.0+.
db49a4
%bcond_with bundled_llvm
db49a4
872d83
# Requires stable libgit2 1.0
872d83
%if 0%{?fedora} >= 32
872d83
%bcond_with bundled_libgit2
872d83
%else
db49a4
%bcond_without bundled_libgit2
872d83
%endif
db49a4
db49a4
%if 0%{?rhel}
872d83
# Disable cargo->libgit2->libssh2 on RHEL, as it's not approved for FIPS (rhbz1732949)
cbcbe2
%bcond_without disabled_libssh2
db49a4
%else
872d83
%bcond_with disabled_libssh2
db49a4
%endif
db49a4
872d83
%if 0%{?rhel} && 0%{?rhel} < 8
872d83
%bcond_with curl_http2
db49a4
%else
872d83
%bcond_without curl_http2
872d83
%endif
872d83
872d83
# LLDB isn't available everywhere...
872d83
%if 0%{?rhel} && 0%{?rhel} < 8
db49a4
%bcond_with lldb
872d83
%else
872d83
%bcond_without lldb
db49a4
%endif
db49a4
db49a4
Name:           rust
872d83
Version:        1.49.0
a43525
Release:        1%{?dist}
db49a4
Summary:        The Rust Programming Language
db49a4
License:        (ASL 2.0 or MIT) and (BSD and MIT)
db49a4
# ^ written as: (rust itself) and (bundled libraries)
db49a4
URL:            https://www.rust-lang.org
db49a4
ExclusiveArch:  %{rust_arches}
db49a4
db49a4
%if "%{channel}" == "stable"
db49a4
%global rustc_package rustc-%{version}-src
db49a4
%else
db49a4
%global rustc_package rustc-%{channel}-src
db49a4
%endif
db49a4
Source0:        https://static.rust-lang.org/dist/%{rustc_package}.tar.xz
db49a4
872d83
### RHEL-specific patches below ###
db49a4
872d83
# Disable cargo->libgit2->libssh2 on RHEL, as it's not approved for FIPS (rhbz1732949)
872d83
Patch100:       rustc-1.48.0-disable-libssh2.patch
db49a4
872d83
# libcurl on RHEL7 doesn't have http2, but since cargo requests it, curl-sys
872d83
# will try to build it statically -- instead we turn off the feature.
872d83
Patch101:       rustc-1.49.0-disable-http2.patch
db49a4
872d83
# kernel rh1410097 causes too-small stacks for PIE.
872d83
# (affects RHEL6 kernels when building for RHEL7)
872d83
Patch102:       rustc-1.48.0-no-default-pie.patch
cbcbe2
db49a4
db49a4
# Get the Rust triple for any arch.
db49a4
%{lua: function rust_triple(arch)
db49a4
  local abi = "gnu"
db49a4
  if arch == "armv7hl" then
db49a4
    arch = "armv7"
db49a4
    abi = "gnueabihf"
db49a4
  elseif arch == "ppc64" then
db49a4
    arch = "powerpc64"
db49a4
  elseif arch == "ppc64le" then
db49a4
    arch = "powerpc64le"
872d83
  elseif arch == "riscv64" then
872d83
    arch = "riscv64gc"
db49a4
  end
db49a4
  return arch.."-unknown-linux-"..abi
db49a4
end}
db49a4
db49a4
%global rust_triple %{lua: print(rust_triple(rpm.expand("%{_target_cpu}")))}
db49a4
db49a4
%if %defined bootstrap_arches
db49a4
# For each bootstrap arch, add an additional binary Source.
db49a4
# Also define bootstrap_source just for the current target.
db49a4
%{lua: do
db49a4
  local bootstrap_arches = {}
db49a4
  for arch in string.gmatch(rpm.expand("%{bootstrap_arches}"), "%S+") do
db49a4
    table.insert(bootstrap_arches, arch)
db49a4
  end
db49a4
  local base = rpm.expand("https://static.rust-lang.org/dist/%{bootstrap_date}"
db49a4
                          .."/rust-%{bootstrap_channel}")
db49a4
  local target_arch = rpm.expand("%{_target_cpu}")
db49a4
  for i, arch in ipairs(bootstrap_arches) do
db49a4
    print(string.format("Source%d: %s-%s.tar.xz\n",
db49a4
                        i, base, rust_triple(arch)))
db49a4
    if arch == target_arch then
db49a4
      rpm.define("bootstrap_source "..i)
db49a4
    end
db49a4
  end
db49a4
end}
db49a4
%endif
db49a4
db49a4
%ifarch %{bootstrap_arches}
db49a4
%global bootstrap_root rust-%{bootstrap_channel}-%{rust_triple}
db49a4
%global local_rust_root %{_builddir}/%{bootstrap_root}/usr
db49a4
Provides:       bundled(%{name}-bootstrap) = %{bootstrap_rust}
db49a4
%else
db49a4
BuildRequires:  cargo >= %{bootstrap_cargo}
872d83
%if 0%{?rhel} && 0%{?rhel} < 8
db49a4
BuildRequires:  %{name} >= %{bootstrap_rust}
db49a4
BuildConflicts: %{name} > %{version}
872d83
%else
872d83
BuildRequires:  (%{name} >= %{bootstrap_rust} with %{name} <= %{version})
db49a4
%endif
db49a4
%global local_rust_root %{_prefix}
db49a4
%endif
db49a4
db49a4
BuildRequires:  make
db49a4
BuildRequires:  gcc
db49a4
BuildRequires:  gcc-c++
db49a4
BuildRequires:  ncurses-devel
db49a4
BuildRequires:  curl
872d83
# explicit curl-devel to avoid httpd24-curl (rhbz1540167)
872d83
BuildRequires:  curl-devel
db49a4
BuildRequires:  pkgconfig(libcurl)
db49a4
BuildRequires:  pkgconfig(liblzma)
db49a4
BuildRequires:  pkgconfig(openssl)
db49a4
BuildRequires:  pkgconfig(zlib)
db49a4
db49a4
%if %without bundled_libgit2
872d83
BuildRequires:  pkgconfig(libgit2) >= 1.0.0
db49a4
%endif
db49a4
872d83
%if %{without disabled_libssh2}
db49a4
# needs libssh2_userauth_publickey_frommemory
db49a4
BuildRequires:  pkgconfig(libssh2) >= 1.6.0
db49a4
%endif
db49a4
db49a4
%global python python3
db49a4
BuildRequires:  %{python}
db49a4
db49a4
%if %with bundled_llvm
db49a4
BuildRequires:  cmake3 >= 3.4.3
872d83
Provides:       bundled(llvm) = 11.0.0
db49a4
%else
db49a4
BuildRequires:  cmake >= 2.8.11
872d83
%if 0%{?epel} == 7
872d83
%global llvm llvm9.0
db49a4
%endif
db49a4
%if %defined llvm
db49a4
%global llvm_root %{_libdir}/%{llvm}
db49a4
%else
db49a4
%global llvm llvm
db49a4
%global llvm_root %{_prefix}
db49a4
%endif
872d83
BuildRequires:  %{llvm}-devel >= 9.0
db49a4
%if %with llvm_static
db49a4
BuildRequires:  %{llvm}-static
db49a4
BuildRequires:  libffi-devel
db49a4
%endif
db49a4
%endif
db49a4
db49a4
# make check needs "ps" for src/test/run-pass/wait-forked-but-failed-child.rs
db49a4
BuildRequires:  procps-ng
db49a4
db49a4
# debuginfo-gdb tests need gdb
db49a4
BuildRequires:  gdb
db49a4
db49a4
# Virtual provides for folks who attempt "dnf install rustc"
db49a4
Provides:       rustc = %{version}-%{release}
db49a4
Provides:       rustc%{?_isa} = %{version}-%{release}
db49a4
db49a4
# Always require our exact standard library
db49a4
Requires:       %{name}-std-static%{?_isa} = %{version}-%{release}
db49a4
db49a4
# The C compiler is needed at runtime just for linking.  Someday rustc might
db49a4
# invoke the linker directly, and then we'll only need binutils.
db49a4
# https://github.com/rust-lang/rust/issues/11937
db49a4
Requires:       /usr/bin/cc
db49a4
db49a4
# ALL Rust libraries are private, because they don't keep an ABI.
db49a4
%global _privatelibs lib(.*-[[:xdigit:]]{16}*|rustc.*)[.]so.*
db49a4
%global __provides_exclude ^(%{_privatelibs})$
db49a4
%global __requires_exclude ^(%{_privatelibs})$
db49a4
%global __provides_exclude_from ^(%{_docdir}|%{rustlibdir}/src)/.*$
db49a4
%global __requires_exclude_from ^(%{_docdir}|%{rustlibdir}/src)/.*$
db49a4
db49a4
# While we don't want to encourage dynamic linking to Rust shared libraries, as
db49a4
# there's no stable ABI, we still need the unallocated metadata (.rustc) to
872d83
# support custom-derive plugins like #[proc_macro_derive(Foo)].
872d83
%if 0%{?rhel} && 0%{?rhel} < 8
872d83
# eu-strip is very eager by default, so we have to limit it to -g, only debugging symbols.
db49a4
%global _find_debuginfo_opts -g
db49a4
%undefine _include_minidebuginfo
872d83
%else
872d83
# Newer find-debuginfo.sh supports --keep-section, which is preferable. rhbz1465997
872d83
%global _find_debuginfo_opts --keep-section .rustc
db49a4
%endif
db49a4
db49a4
# Use hardening ldflags.
db49a4
%global rustflags -Clink-arg=-Wl,-z,relro,-z,now
db49a4
db49a4
%if %{without bundled_llvm}
db49a4
%if "%{llvm_root}" == "%{_prefix}" || 0%{?scl:1}
db49a4
%global llvm_has_filecheck 1
db49a4
%endif
db49a4
%endif
db49a4
db49a4
%description
db49a4
Rust is a systems programming language that runs blazingly fast, prevents
db49a4
segfaults, and guarantees thread safety.
db49a4
db49a4
This package includes the Rust compiler and documentation generator.
db49a4
db49a4
db49a4
%package std-static
db49a4
Summary:        Standard library for Rust
db49a4
db49a4
%description std-static
db49a4
This package includes the standard libraries for building applications
db49a4
written in Rust.
db49a4
db49a4
db49a4
%package debugger-common
db49a4
Summary:        Common debugger pretty printers for Rust
db49a4
BuildArch:      noarch
db49a4
db49a4
%description debugger-common
db49a4
This package includes the common functionality for %{name}-gdb and %{name}-lldb.
db49a4
db49a4
db49a4
%package gdb
db49a4
Summary:        GDB pretty printers for Rust
db49a4
BuildArch:      noarch
db49a4
Requires:       gdb
db49a4
Requires:       %{name}-debugger-common = %{version}-%{release}
db49a4
db49a4
%description gdb
db49a4
This package includes the rust-gdb script, which allows easier debugging of Rust
db49a4
programs.
db49a4
db49a4
db49a4
%if %with lldb
db49a4
db49a4
%package lldb
db49a4
Summary:        LLDB pretty printers for Rust
db49a4
BuildArch:      noarch
db49a4
Requires:       lldb
872d83
Requires:       %{python}-lldb
db49a4
Requires:       %{name}-debugger-common = %{version}-%{release}
db49a4
db49a4
%description lldb
db49a4
This package includes the rust-lldb script, which allows easier debugging of Rust
db49a4
programs.
db49a4
db49a4
%endif
db49a4
db49a4
db49a4
%package doc
db49a4
Summary:        Documentation for Rust
db49a4
# NOT BuildArch:      noarch
db49a4
# Note, while docs are mostly noarch, some things do vary by target_arch.
db49a4
# Koji will fail the build in rpmdiff if two architectures build a noarch
db49a4
# subpackage differently, so instead we have to keep its arch.
db49a4
db49a4
%description doc
db49a4
This package includes HTML documentation for the Rust programming language and
db49a4
its standard library.
db49a4
db49a4
db49a4
%package -n cargo
db49a4
Summary:        Rust's package manager and build tool
db49a4
%if %with bundled_libgit2
872d83
Provides:       bundled(libgit2) = 1.1.0
db49a4
%endif
db49a4
# For tests:
db49a4
BuildRequires:  git
db49a4
# Cargo is not much use without Rust
db49a4
Requires:       rust
db49a4
cbcbe2
# "cargo vendor" is a builtin command starting with 1.37.  The Obsoletes and
cbcbe2
# Provides are mostly relevant to RHEL, but harmless to have on Fedora/etc. too
cbcbe2
Obsoletes:      cargo-vendor <= 0.1.23
cbcbe2
Provides:       cargo-vendor = %{version}-%{release}
cbcbe2
db49a4
%description -n cargo
db49a4
Cargo is a tool that allows Rust projects to declare their various dependencies
db49a4
and ensure that you'll always get a repeatable build.
db49a4
db49a4
db49a4
%package -n cargo-doc
db49a4
Summary:        Documentation for Cargo
db49a4
BuildArch:      noarch
db49a4
# Cargo no longer builds its own documentation
db49a4
# https://github.com/rust-lang/cargo/pull/4904
db49a4
Requires:       rust-doc = %{version}-%{release}
db49a4
db49a4
%description -n cargo-doc
db49a4
This package includes HTML documentation for Cargo.
db49a4
db49a4
db49a4
%package -n rustfmt
db49a4
Summary:        Tool to find and fix Rust formatting issues
db49a4
Requires:       cargo
db49a4
db49a4
# The component/package was rustfmt-preview until Rust 1.31.
db49a4
Obsoletes:      rustfmt-preview < 1.0.0
db49a4
Provides:       rustfmt-preview = %{version}-%{release}
db49a4
db49a4
%description -n rustfmt
db49a4
A tool for formatting Rust code according to style guidelines.
db49a4
db49a4
db49a4
%package -n rls
db49a4
Summary:        Rust Language Server for IDE integration
db49a4
%if %with bundled_libgit2
872d83
Provides:       bundled(libgit2) = 1.1.0
db49a4
%endif
db49a4
Requires:       rust-analysis
db49a4
# /usr/bin/rls is dynamically linked against internal rustc libs
db49a4
Requires:       %{name}%{?_isa} = %{version}-%{release}
db49a4
db49a4
# The component/package was rls-preview until Rust 1.31.
db49a4
Obsoletes:      rls-preview < 1.31.6
db49a4
Provides:       rls-preview = %{version}-%{release}
db49a4
db49a4
%description -n rls
db49a4
The Rust Language Server provides a server that runs in the background,
db49a4
providing IDEs, editors, and other tools with information about Rust programs.
db49a4
It supports functionality such as 'goto definition', symbol search,
db49a4
reformatting, and code completion, and enables renaming and refactorings.
db49a4
db49a4
db49a4
%package -n clippy
db49a4
Summary:        Lints to catch common mistakes and improve your Rust code
db49a4
Requires:       cargo
db49a4
# /usr/bin/clippy-driver is dynamically linked against internal rustc libs
db49a4
Requires:       %{name}%{?_isa} = %{version}-%{release}
db49a4
db49a4
# The component/package was clippy-preview until Rust 1.31.
db49a4
Obsoletes:      clippy-preview <= 0.0.212
db49a4
Provides:       clippy-preview = %{version}-%{release}
db49a4
db49a4
%description -n clippy
db49a4
A collection of lints to catch common mistakes and improve your Rust code.
db49a4
db49a4
db49a4
%package src
db49a4
Summary:        Sources for the Rust standard library
db49a4
BuildArch:      noarch
db49a4
db49a4
%description src
db49a4
This package includes source files for the Rust standard library.  It may be
db49a4
useful as a reference for code completion tools in various editors.
db49a4
db49a4
db49a4
%package analysis
db49a4
Summary:        Compiler analysis data for the Rust standard library
db49a4
Requires:       rust-std-static%{?_isa} = %{version}-%{release}
db49a4
db49a4
%description analysis
db49a4
This package contains analysis data files produced with rustc's -Zsave-analysis
db49a4
feature for the Rust standard library. The RLS (Rust Language Server) uses this
db49a4
data to provide information about the Rust standard library.
db49a4
db49a4
db49a4
%prep
db49a4
db49a4
%ifarch %{bootstrap_arches}
db49a4
%setup -q -n %{bootstrap_root} -T -b %{bootstrap_source}
db49a4
./install.sh --components=cargo,rustc,rust-std-%{rust_triple} \
db49a4
  --prefix=%{local_rust_root} --disable-ldconfig
db49a4
test -f '%{local_rust_root}/bin/cargo'
db49a4
test -f '%{local_rust_root}/bin/rustc'
db49a4
%endif
db49a4
db49a4
%setup -q -n %{rustc_package}
db49a4
cbcbe2
%if %with disabled_libssh2
872d83
%patch100 -p1
872d83
%endif
872d83
872d83
%if %without curl_http2
872d83
%patch101 -p1
872d83
rm -rf vendor/libnghttp2-sys/
872d83
%endif
872d83
872d83
%if 0%{?rhel} && 0%{?rhel} < 8
872d83
%patch102 -p1
cbcbe2
%endif
cbcbe2
872d83
%if "%{python}" != "python3"
872d83
# Use our preferred python first
872d83
sed -i.try-python -e '/^try python3 /i try "%{python}" "$@"' ./configure
db49a4
%endif
db49a4
db49a4
%if %without bundled_llvm
db49a4
rm -rf src/llvm-project/
872d83
mkdir -p src/llvm-project/libunwind/
db49a4
%endif
db49a4
cbcbe2
# Remove other unused vendored libraries
cbcbe2
rm -rf vendor/curl-sys/curl/
cbcbe2
rm -rf vendor/jemalloc-sys/jemalloc/
872d83
rm -rf vendor/libssh2-sys/libssh2/
cbcbe2
rm -rf vendor/libz-sys/src/zlib/
872d83
rm -rf vendor/libz-sys/src/zlib-ng/
cbcbe2
rm -rf vendor/lzma-sys/xz-*/
cbcbe2
rm -rf vendor/openssl-src/openssl/
cbcbe2
cbcbe2
%if %without bundled_libgit2
cbcbe2
rm -rf vendor/libgit2-sys/libgit2/
cbcbe2
%endif
cbcbe2
cbcbe2
%if %with disabled_libssh2
cbcbe2
rm -rf vendor/libssh2-sys/
cbcbe2
%endif
cbcbe2
cbcbe2
# This only affects the transient rust-installer, but let it use our dynamic xz-libs
cbcbe2
sed -i.lzma -e '/LZMA_API_STATIC/d' src/bootstrap/tool.rs
cbcbe2
872d83
%if %{with bundled_llvm} && 0%{?epel} == 7
db49a4
mkdir -p cmake-bin
db49a4
ln -s /usr/bin/cmake3 cmake-bin/cmake
db49a4
%global cmake_path $PWD/cmake-bin
db49a4
%endif
db49a4
db49a4
%if %{without bundled_llvm} && %{with llvm_static}
db49a4
# Static linking to distro LLVM needs to add -lffi
db49a4
# https://github.com/rust-lang/rust/issues/34486
db49a4
sed -i.ffi -e '$a #[link(name = "ffi")] extern {}' \
db49a4
  src/librustc_llvm/lib.rs
db49a4
%endif
db49a4
db49a4
# The configure macro will modify some autoconf-related files, which upsets
db49a4
# cargo when it tries to verify checksums in those files.  If we just truncate
db49a4
# that file list, cargo won't have anything to complain about.
db49a4
find vendor -name .cargo-checksum.json \
db49a4
  -exec sed -i.uncheck -e 's/"files":{[^}]*}/"files":{ }/' '{}' '+'
db49a4
cbcbe2
# Sometimes Rust sources start with #![...] attributes, and "smart" editors think
cbcbe2
# it's a shebang and make them executable. Then brp-mangle-shebangs gets upset...
cbcbe2
find -name '*.rs' -type f -perm /111 -exec chmod -v -x '{}' '+'
cbcbe2
872d83
# Set up shared environment variables for build/install/check
872d83
%global rust_env RUSTFLAGS="%{rustflags}"
872d83
%if 0%{?cmake_path:1}
872d83
%global rust_env %{rust_env} PATH="%{cmake_path}:$PATH"
872d83
%endif
db49a4
%if %without bundled_libgit2
db49a4
# convince libgit2-sys to use the distro libgit2
872d83
%global rust_env %{rust_env} LIBGIT2_SYS_USE_PKG_CONFIG=1
db49a4
%endif
872d83
%if %without disabled_libssh2
db49a4
# convince libssh2-sys to use the distro libssh2
872d83
%global rust_env %{rust_env} LIBSSH2_SYS_USE_PKG_CONFIG=1
db49a4
%endif
db49a4
872d83
872d83
%build
872d83
export %{rust_env}
db49a4
db49a4
# We're going to override --libdir when configuring to get rustlib into a
db49a4
# common path, but we'll fix the shared libraries during install.
db49a4
%global common_libdir %{_prefix}/lib
db49a4
%global rustlibdir %{common_libdir}/rustlib
db49a4
db49a4
%ifarch %{arm} %{ix86} s390x
db49a4
# full debuginfo is exhausting memory; just do libstd for now
db49a4
# https://github.com/rust-lang/rust/issues/45854
872d83
%if 0%{?rhel} && 0%{?rhel} < 8
db49a4
# Older rpmbuild didn't work with partial debuginfo coverage.
db49a4
%global debug_package %{nil}
cbcbe2
%define enable_debuginfo --debuginfo-level=0
db49a4
%else
cbcbe2
%define enable_debuginfo --debuginfo-level=0 --debuginfo-level-std=2
db49a4
%endif
db49a4
%else
cbcbe2
%define enable_debuginfo --debuginfo-level=2
db49a4
%endif
db49a4
db49a4
# We want the best optimization for std, but it caused problems for rpm-ostree
db49a4
# on ppc64le to have all of the compiler_builtins in a single object:
db49a4
# https://bugzilla.redhat.com/show_bug.cgi?id=1713090
db49a4
%ifnarch %{power64}
db49a4
%define codegen_units_std --set rust.codegen-units-std=1
db49a4
%endif
db49a4
872d83
# Some builders have relatively little memory for their CPU count.
872d83
# At least 2GB per CPU is a good rule of thumb for building rustc.
872d83
ncpus=$(/usr/bin/getconf _NPROCESSORS_ONLN)
872d83
max_cpus=$(( ($(free -g | awk '/^Mem:/{print $2}') + 1) / 2 ))
872d83
if [ "$max_cpus" -ge 1 -a "$max_cpus" -lt "$ncpus" ]; then
872d83
  ncpus="$max_cpus"
872d83
fi
872d83
db49a4
%configure --disable-option-checking \
db49a4
  --libdir=%{common_libdir} \
db49a4
  --build=%{rust_triple} --host=%{rust_triple} --target=%{rust_triple} \
cbcbe2
  --python=%{python} \
db49a4
  --local-rust-root=%{local_rust_root} \
db49a4
  %{!?with_bundled_llvm: --llvm-root=%{llvm_root} \
db49a4
    %{!?llvm_has_filecheck: --disable-codegen-tests} \
db49a4
    %{!?with_llvm_static: --enable-llvm-link-shared } } \
db49a4
  --disable-rpath \
db49a4
  %{enable_debuginfo} \
db49a4
  --enable-extended \
872d83
  --tools=analysis,cargo,clippy,rls,rustfmt,src \
db49a4
  --enable-vendor \
db49a4
  --enable-verbose-tests \
db49a4
  %{?codegen_units_std} \
db49a4
  --release-channel=%{channel}
db49a4
872d83
%{python} ./x.py build -j "$ncpus" --stage 2
872d83
%{python} ./x.py doc --stage 2
db49a4
db49a4
db49a4
%install
872d83
export %{rust_env}
db49a4
db49a4
DESTDIR=%{buildroot} %{python} ./x.py install
db49a4
db49a4
# Make sure the shared libraries are in the proper libdir
db49a4
%if "%{_libdir}" != "%{common_libdir}"
db49a4
mkdir -p %{buildroot}%{_libdir}
db49a4
find %{buildroot}%{common_libdir} -maxdepth 1 -type f -name '*.so' \
db49a4
  -exec mv -v -t %{buildroot}%{_libdir} '{}' '+'
db49a4
%endif
db49a4
db49a4
# The shared libraries should be executable for debuginfo extraction.
db49a4
find %{buildroot}%{_libdir} -maxdepth 1 -type f -name '*.so' \
db49a4
  -exec chmod -v +x '{}' '+'
db49a4
db49a4
# The libdir libraries are identical to those under rustlib/.  It's easier on
db49a4
# library loading if we keep them in libdir, but we do need them in rustlib/
db49a4
# to support dynamic linking for compiler plugins, so we'll symlink.
db49a4
(cd "%{buildroot}%{rustlibdir}/%{rust_triple}/lib" &&
db49a4
 find ../../../../%{_lib} -maxdepth 1 -name '*.so' |
db49a4
 while read lib; do
cbcbe2
   if [ -f "${lib##*/}" ]; then
cbcbe2
     # make sure they're actually identical!
cbcbe2
     cmp "$lib" "${lib##*/}"
cbcbe2
     ln -v -f -s -t . "$lib"
cbcbe2
   fi
db49a4
 done)
db49a4
db49a4
# Remove installer artifacts (manifests, uninstall scripts, etc.)
db49a4
find %{buildroot}%{rustlibdir} -maxdepth 1 -type f -exec rm -v '{}' '+'
db49a4
db49a4
# Remove backup files from %%configure munging
db49a4
find %{buildroot}%{rustlibdir} -type f -name '*.orig' -exec rm -v '{}' '+'
db49a4
db49a4
# https://fedoraproject.org/wiki/Changes/Make_ambiguous_python_shebangs_error
db49a4
# We don't actually need to ship any of those python scripts in rust-src anyway.
db49a4
find %{buildroot}%{rustlibdir}/src -type f -name '*.py' -exec rm -v '{}' '+'
db49a4
db49a4
# FIXME: __os_install_post will strip the rlibs
db49a4
# -- should we find a way to preserve debuginfo?
db49a4
db49a4
# Remove unwanted documentation files (we already package them)
db49a4
rm -f %{buildroot}%{_docdir}/%{name}/README.md
db49a4
rm -f %{buildroot}%{_docdir}/%{name}/COPYRIGHT
db49a4
rm -f %{buildroot}%{_docdir}/%{name}/LICENSE
db49a4
rm -f %{buildroot}%{_docdir}/%{name}/LICENSE-APACHE
db49a4
rm -f %{buildroot}%{_docdir}/%{name}/LICENSE-MIT
db49a4
rm -f %{buildroot}%{_docdir}/%{name}/LICENSE-THIRD-PARTY
db49a4
rm -f %{buildroot}%{_docdir}/%{name}/*.old
db49a4
db49a4
# Sanitize the HTML documentation
db49a4
find %{buildroot}%{_docdir}/%{name}/html -empty -delete
db49a4
find %{buildroot}%{_docdir}/%{name}/html -type f -exec chmod -x '{}' '+'
db49a4
db49a4
# Create the path for crate-devel packages
db49a4
mkdir -p %{buildroot}%{_datadir}/cargo/registry
db49a4
db49a4
# Cargo no longer builds its own documentation
db49a4
# https://github.com/rust-lang/cargo/pull/4904
db49a4
mkdir -p %{buildroot}%{_docdir}/cargo
db49a4
ln -sT ../rust/html/cargo/ %{buildroot}%{_docdir}/cargo/html
db49a4
db49a4
%if %without lldb
db49a4
rm -f %{buildroot}%{_bindir}/rust-lldb
872d83
rm -f %{buildroot}%{rustlibdir}/etc/lldb_*
db49a4
%endif
db49a4
db49a4
db49a4
%check
872d83
export %{rust_env}
db49a4
db49a4
# The results are not stable on koji, so mask errors and just log it.
872d83
%{python} ./x.py test --no-fail-fast --stage 2 || :
872d83
%{python} ./x.py test --no-fail-fast --stage 2 cargo || :
872d83
%{python} ./x.py test --no-fail-fast --stage 2 clippy || :
872d83
%{python} ./x.py test --no-fail-fast --stage 2 rls || :
872d83
%{python} ./x.py test --no-fail-fast --stage 2 rustfmt || :
db49a4
db49a4
db49a4
%ldconfig_scriptlets
db49a4
db49a4
db49a4
%files
db49a4
%license COPYRIGHT LICENSE-APACHE LICENSE-MIT
db49a4
%doc README.md
db49a4
%{_bindir}/rustc
db49a4
%{_bindir}/rustdoc
db49a4
%{_libdir}/*.so
db49a4
%{_mandir}/man1/rustc.1*
db49a4
%{_mandir}/man1/rustdoc.1*
db49a4
%dir %{rustlibdir}
db49a4
%dir %{rustlibdir}/%{rust_triple}
db49a4
%dir %{rustlibdir}/%{rust_triple}/lib
db49a4
%{rustlibdir}/%{rust_triple}/lib/*.so
db49a4
db49a4
db49a4
%files std-static
db49a4
%dir %{rustlibdir}
db49a4
%dir %{rustlibdir}/%{rust_triple}
db49a4
%dir %{rustlibdir}/%{rust_triple}/lib
db49a4
%{rustlibdir}/%{rust_triple}/lib/*.rlib
db49a4
db49a4
db49a4
%files debugger-common
db49a4
%dir %{rustlibdir}
db49a4
%dir %{rustlibdir}/etc
872d83
%{rustlibdir}/etc/rust_*.py*
db49a4
db49a4
db49a4
%files gdb
db49a4
%{_bindir}/rust-gdb
872d83
%{rustlibdir}/etc/gdb_*
db49a4
%exclude %{_bindir}/rust-gdbgui
db49a4
db49a4
db49a4
%if %with lldb
db49a4
%files lldb
db49a4
%{_bindir}/rust-lldb
872d83
%{rustlibdir}/etc/lldb_*
db49a4
%endif
db49a4
db49a4
db49a4
%files doc
db49a4
%docdir %{_docdir}/%{name}
db49a4
%dir %{_docdir}/%{name}
db49a4
%dir %{_docdir}/%{name}/html
db49a4
%{_docdir}/%{name}/html/*/
db49a4
%{_docdir}/%{name}/html/*.html
db49a4
%{_docdir}/%{name}/html/*.css
db49a4
%{_docdir}/%{name}/html/*.js
db49a4
%{_docdir}/%{name}/html/*.png
db49a4
%{_docdir}/%{name}/html/*.svg
db49a4
%{_docdir}/%{name}/html/*.woff
db49a4
%license %{_docdir}/%{name}/html/*.txt
cbcbe2
%license %{_docdir}/%{name}/html/*.md
db49a4
db49a4
db49a4
%files -n cargo
db49a4
%license src/tools/cargo/LICENSE-APACHE src/tools/cargo/LICENSE-MIT src/tools/cargo/LICENSE-THIRD-PARTY
db49a4
%doc src/tools/cargo/README.md
db49a4
%{_bindir}/cargo
db49a4
%{_mandir}/man1/cargo*.1*
db49a4
%{_sysconfdir}/bash_completion.d/cargo
db49a4
%{_datadir}/zsh/site-functions/_cargo
db49a4
%dir %{_datadir}/cargo
db49a4
%dir %{_datadir}/cargo/registry
db49a4
db49a4
db49a4
%files -n cargo-doc
db49a4
%docdir %{_docdir}/cargo
db49a4
%dir %{_docdir}/cargo
db49a4
%{_docdir}/cargo/html
db49a4
db49a4
db49a4
%files -n rustfmt
db49a4
%{_bindir}/rustfmt
db49a4
%{_bindir}/cargo-fmt
db49a4
%doc src/tools/rustfmt/{README,CHANGELOG,Configurations}.md
db49a4
%license src/tools/rustfmt/LICENSE-{APACHE,MIT}
db49a4
db49a4
db49a4
%files -n rls
db49a4
%{_bindir}/rls
db49a4
%doc src/tools/rls/{README.md,COPYRIGHT,debugging.md}
db49a4
%license src/tools/rls/LICENSE-{APACHE,MIT}
db49a4
db49a4
db49a4
%files -n clippy
db49a4
%{_bindir}/cargo-clippy
db49a4
%{_bindir}/clippy-driver
db49a4
%doc src/tools/clippy/{README.md,CHANGELOG.md}
db49a4
%license src/tools/clippy/LICENSE-{APACHE,MIT}
db49a4
db49a4
db49a4
%files src
db49a4
%dir %{rustlibdir}
db49a4
%{rustlibdir}/src
db49a4
db49a4
db49a4
%files analysis
db49a4
%{rustlibdir}/%{rust_triple}/analysis/
db49a4
db49a4
db49a4
%changelog
872d83
* Wed Jan 13 2021 Josh Stone <jistone@redhat.com> - 1.49.0-1
872d83
- Update to 1.49.0.
872d83
872d83
* Tue Jan 12 2021 Josh Stone <jistone@redhat.com> - 1.48.0-1
872d83
- Update to 1.48.0.
872d83
872d83
* Thu Oct 22 2020 Josh Stone <jistone@redhat.com> - 1.47.0-1
872d83
- Update to 1.47.0.
872d83
872d83
* Wed Oct 14 2020 Josh Stone <jistone@redhat.com> - 1.46.0-1
872d83
- Update to 1.46.0.
872d83
872d83
* Tue Aug 04 2020 Josh Stone <jistone@redhat.com> - 1.45.2-1
872d83
- Update to 1.45.2.
872d83
872d83
* Thu Jul 16 2020 Josh Stone <jistone@redhat.com> - 1.45.0-1
872d83
- Update to 1.45.0.
872d83
872d83
* Tue Jul 14 2020 Josh Stone <jistone@redhat.com> - 1.44.1-1
872d83
- Update to 1.44.1.
872d83
a43525
* Thu May 07 2020 Josh Stone <jistone@redhat.com> - 1.43.1-1
a43525
- Update to 1.43.1.
a43525
a43525
* Thu Apr 23 2020 Josh Stone <jistone@redhat.com> - 1.43.0-1
a43525
- Update to 1.43.0.
a43525
a43525
* Thu Mar 12 2020 Josh Stone <jistone@redhat.com> - 1.42.0-1
a43525
- Update to 1.42.0.
a43525
a43525
* Thu Feb 27 2020 Josh Stone <jistone@redhat.com> - 1.41.1-1
a43525
- Update to 1.41.1.
a43525
a43525
* Thu Jan 30 2020 Josh Stone <jistone@redhat.com> - 1.41.0-1
a43525
- Update to 1.41.0.
a43525
a43525
* Thu Jan 16 2020 Josh Stone <jistone@redhat.com> - 1.40.0-1
a43525
- Update to 1.40.0.
a43525
- Fix compiletest with newer (local-rebuild) libtest
a43525
- Build compiletest with in-tree libtest
a43525
- Fix ARM EHABI unwinding
a43525
cbcbe2
* Tue Nov 12 2019 Josh Stone <jistone@redhat.com> - 1.39.0-2
cbcbe2
- Fix a couple build and test issues with rustdoc.
cbcbe2
cbcbe2
* Thu Nov 07 2019 Josh Stone <jistone@redhat.com> - 1.39.0-1
cbcbe2
- Update to 1.39.0.
cbcbe2
cbcbe2
* Thu Sep 26 2019 Josh Stone <jistone@redhat.com> - 1.38.0-1
cbcbe2
- Update to 1.38.0.
cbcbe2
cbcbe2
* Thu Aug 15 2019 Josh Stone <jistone@redhat.com> - 1.37.0-1
cbcbe2
- Update to 1.37.0.
cbcbe2
- Disable libssh2 (git+ssh support).
cbcbe2
cbcbe2
* Thu Jul 04 2019 Josh Stone <jistone@redhat.com> - 1.36.0-1
cbcbe2
- Update to 1.36.0.
cbcbe2
db49a4
* Wed May 29 2019 Josh Stone <jistone@redhat.com> - 1.35.0-2
db49a4
- Fix compiletest for rebuild testing.
db49a4
db49a4
* Thu May 23 2019 Josh Stone <jistone@redhat.com> - 1.35.0-1
db49a4
- Update to 1.35.0.
db49a4
db49a4
* Tue May 14 2019 Josh Stone <jistone@redhat.com> - 1.34.2-1
db49a4
- Update to 1.34.2 -- fixes CVE-2019-12083.
db49a4
db49a4
* Thu May 09 2019 Josh Stone <jistone@redhat.com> - 1.34.1-1
db49a4
- Update to 1.34.1.
db49a4
db49a4
* Thu Apr 11 2019 Josh Stone <jistone@redhat.com> - 1.34.0-1
db49a4
- Update to 1.34.0.
db49a4
db49a4
* Wed Apr 10 2019 Josh Stone <jistone@redhat.com> - 1.33.0-1
db49a4
- Update to 1.33.0.
db49a4
db49a4
* Tue Apr 09 2019 Josh Stone <jistone@redhat.com> - 1.32.0-1
db49a4
- Update to 1.32.0.
db49a4
db49a4
* Fri Dec 14 2018 Josh Stone <jistone@redhat.com> - 1.31.0-5
db49a4
- Restore rust-lldb.
db49a4
db49a4
* Thu Dec 13 2018 Josh Stone <jistone@redhat.com> - 1.31.0-4
db49a4
- Backport fixes for rls.
db49a4
db49a4
* Thu Dec 13 2018 Josh Stone <jistone@redhat.com> - 1.31.0-3
db49a4
- Update to 1.31.0 -- Rust 2018!
db49a4
- clippy/rls/rustfmt are no longer -preview
db49a4
db49a4
* Wed Dec 12 2018 Josh Stone <jistone@redhat.com> - 1.30.1-2
db49a4
- Update to 1.30.1.
db49a4
db49a4
* Tue Nov 06 2018 Josh Stone <jistone@redhat.com> - 1.29.2-1
db49a4
- Update to 1.29.2.
db49a4
db49a4
* Thu Nov 01 2018 Josh Stone <jistone@redhat.com> - 1.28.0-1
db49a4
- Update to 1.28.0.
db49a4
db49a4
* Thu Nov 01 2018 Josh Stone <jistone@redhat.com> - 1.27.2-1
db49a4
- Update to 1.27.2.
db49a4
db49a4
* Wed Oct 10 2018 Josh Stone <jistone@redhat.com> - 1.26.2-12
db49a4
- Fix "fp" target feature for AArch64 (#1632880)
db49a4
db49a4
* Mon Oct 08 2018 Josh Stone <jistone@redhat.com> - 1.26.2-11
db49a4
- Security fix for str::repeat (pending CVE).
db49a4
db49a4
* Fri Oct 05 2018 Josh Stone <jistone@redhat.com> - 1.26.2-10
db49a4
- Rebuild without bootstrap binaries.
db49a4
db49a4
* Thu Oct 04 2018 Josh Stone <jistone@redhat.com> - 1.26.2-9
db49a4
- Bootstrap without SCL packaging. (rhbz1635067)
db49a4
db49a4
* Tue Aug 28 2018 Tom Stellard <tstellar@redhat.com> - 1.26.2-8
db49a4
- Use python3 prefix for lldb Requires
db49a4
db49a4
* Mon Aug 13 2018 Josh Stone <jistone@redhat.com> - 1.26.2-7
db49a4
- Build with platform-python
db49a4
db49a4
* Tue Aug 07 2018 Josh Stone <jistone@redhat.com> - 1.26.2-6
db49a4
- Exclude rust-src from auto-requires
db49a4
db49a4
* Thu Aug 02 2018 Josh Stone <jistone@redhat.com> - 1.26.2-5
db49a4
- Rebuild without bootstrap binaries.
db49a4
db49a4
* Tue Jul 31 2018 Josh Stone <jistone@redhat.com> - 1.26.2-4
db49a4
- Bootstrap as a module.
db49a4
db49a4
* Mon Jun 04 2018 Josh Stone <jistone@redhat.com> - 1.26.2-3
db49a4
- Update to 1.26.2.
db49a4
db49a4
* Wed May 30 2018 Josh Stone <jistone@redhat.com> - 1.26.1-2
db49a4
- Update to 1.26.1.
db49a4
db49a4
* Fri May 18 2018 Josh Stone <jistone@redhat.com> - 1.26.0-1
db49a4
- Update to 1.26.0.
db49a4
db49a4
* Tue Apr 10 2018 Josh Stone <jistone@redhat.com> - 1.25.0-2
db49a4
- Filter codegen-backends from Provides too.
db49a4
db49a4
* Tue Apr 03 2018 Josh Stone <jistone@redhat.com> - 1.25.0-1
db49a4
- Update to 1.25.0.
db49a4
- Add rustfmt-preview as a subpackage.
db49a4
db49a4
* Thu Feb 22 2018 Josh Stone <jistone@redhat.com> - 1.24.0-1
db49a4
- Update to 1.24.0.
db49a4
db49a4
* Tue Jan 16 2018 Josh Stone <jistone@redhat.com> - 1.23.0-2
db49a4
- Rebuild without bootstrap binaries.
db49a4
db49a4
* Mon Jan 15 2018 Josh Stone <jistone@redhat.com> - 1.23.0-1
db49a4
- Bootstrap 1.23 on el8.