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