c3f84f
# Only x86_64 and i686 are Tier 1 platforms at this time.
c3f84f
# https://forge.rust-lang.org/platform-support.html
c3f84f
#global rust_arches x86_64 i686 armv7hl aarch64 ppc64 ppc64le s390x
ff05ff
%global rust_arches x86_64 i686 armv7hl aarch64 ppc64le s390x
c3f84f
c3f84f
# The channel can be stable, beta, or nightly
c3f84f
%{!?channel: %global channel stable}
c3f84f
c3f84f
# To bootstrap from scratch, set the channel and date from src/stage0.txt
c3f84f
# e.g. 1.10.0 wants rustc: 1.9.0-2016-05-24
c3f84f
# or nightly wants some beta-YYYY-MM-DD
c3f84f
# Note that cargo matches the program version here, not its crate version.
a0c80e
%global bootstrap_rust 1.36.0
a0c80e
%global bootstrap_cargo 1.36.0
a0c80e
%global bootstrap_channel 1.36.0
a0c80e
%global bootstrap_date 2019-07-04
c3f84f
c3f84f
# Only the specified arches will use bootstrap binaries.
c3f84f
#global bootstrap_arches %%{rust_arches}
c3f84f
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
a0c80e
# is insufficient.  Rust currently requires LLVM 6.0+.
c3f84f
%if 0%{?rhel} && 0%{?rhel} <= 6 && !0%{?epel}
c3f84f
%bcond_without bundled_llvm
c3f84f
%else
c3f84f
%bcond_with bundled_llvm
c3f84f
%endif
c3f84f
c3f84f
# libgit2-sys expects to use its bundled library, which is sometimes just a
c3f84f
# snapshot of libgit2's master branch.  This can mean the FFI declarations
c3f84f
# won't match our released libgit2.so, e.g. having changed struct fields.
c3f84f
# So, tread carefully if you toggle this...
c3f84f
%bcond_without bundled_libgit2
c3f84f
c3f84f
%if 0%{?rhel}
a0c80e
%bcond_without disabled_libssh2
c3f84f
%else
c3f84f
%bcond_with bundled_libssh2
c3f84f
%endif
c3f84f
c3f84f
# LLDB isn't available everywhere...
c3f84f
%if !0%{?rhel} || 0%{?rhel} > 7
c3f84f
%bcond_without lldb
c3f84f
%else
c3f84f
%bcond_with lldb
c3f84f
%endif
c3f84f
c3f84f
Name:           rust
a0c80e
Version:        1.37.0
a0c80e
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
c3f84f
ec855a
# Revert https://github.com/rust-lang/rust/pull/57840
ec855a
# We do have the necessary fix in our LLVM 7.
ec855a
Patch1:         rust-pr57840-llvm7-debuginfo-variants.patch
c3f84f
a0c80e
# Disable cargo->libgit2->libssh2, as it's not approved for FIPS (rhbz1732949)
a0c80e
Patch10:        rustc-1.37.0-disable-libssh2.patch
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"
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
c3f84f
  local base = rpm.expand("https://static.rust-lang.org/dist/%{bootstrap_date}"
c3f84f
                          .."/rust-%{bootstrap_channel}")
c3f84f
  local target_arch = rpm.expand("%{_target_cpu}")
c3f84f
  for i, arch in ipairs(bootstrap_arches) do
c3f84f
    print(string.format("Source%d: %s-%s.tar.xz\n",
c3f84f
                        i, base, rust_triple(arch)))
c3f84f
    if arch == target_arch then
c3f84f
      rpm.define("bootstrap_source "..i)
c3f84f
    end
c3f84f
  end
c3f84f
end}
c3f84f
%endif
c3f84f
c3f84f
%ifarch %{bootstrap_arches}
c3f84f
%global bootstrap_root rust-%{bootstrap_channel}-%{rust_triple}
c3f84f
%global local_rust_root %{_builddir}/%{bootstrap_root}/usr
c3f84f
Provides:       bundled(%{name}-bootstrap) = %{bootstrap_rust}
c3f84f
%else
c3f84f
BuildRequires:  cargo >= %{bootstrap_cargo}
c3f84f
%if 0%{?fedora} >= 27 || 0%{?rhel} > 7
ec855a
BuildRequires:  (%{name} >= %{bootstrap_rust} with %{name} <= %{version})
c3f84f
%else
c3f84f
BuildRequires:  %{name} >= %{bootstrap_rust}
ec855a
BuildConflicts: %{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
c3f84f
BuildRequires:  curl
c3f84f
BuildRequires:  pkgconfig(libcurl)
c3f84f
BuildRequires:  pkgconfig(liblzma)
c3f84f
BuildRequires:  pkgconfig(openssl)
c3f84f
BuildRequires:  pkgconfig(zlib)
c3f84f
c3f84f
%if %without bundled_libgit2
c3f84f
BuildRequires:  pkgconfig(libgit2) >= 0.27
c3f84f
%endif
c3f84f
a0c80e
%if %{without disabled_libssh2} && %{without bundled_libssh2}
c3f84f
# needs libssh2_userauth_publickey_frommemory
c3f84f
BuildRequires:  pkgconfig(libssh2) >= 1.6.0
c3f84f
%endif
c3f84f
c3f84f
%if 0%{?rhel}
c3f84f
%if 0%{?rhel} <= 7
c3f84f
%global python python2
c3f84f
%else
c3f84f
%global python /usr/libexec/platform-python
c3f84f
%endif
c3f84f
%else
c3f84f
%global python python3
c3f84f
%endif
c3f84f
BuildRequires:  %{python}
c3f84f
c3f84f
%if %with bundled_llvm
c3f84f
BuildRequires:  cmake3 >= 3.4.3
a0c80e
Provides:       bundled(llvm) = 8.0.0
c3f84f
%else
c3f84f
BuildRequires:  cmake >= 2.8.11
c3f84f
%if 0%{?epel}
ec855a
%global llvm llvm7.0
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
ec855a
BuildRequires:  %{llvm}-devel >= 6.0
c3f84f
%if %with llvm_static
c3f84f
BuildRequires:  %{llvm}-static
c3f84f
BuildRequires:  libffi-devel
c3f84f
%endif
c3f84f
%endif
c3f84f
c3f84f
# make check needs "ps" for src/test/run-pass/wait-forked-but-failed-child.rs
c3f84f
BuildRequires:  procps-ng
c3f84f
c3f84f
# debuginfo-gdb tests need gdb
c3f84f
BuildRequires:  gdb
c3f84f
c3f84f
# TODO: work on unbundling these!
c3f84f
Provides:       bundled(libbacktrace) = 8.1.0
ec855a
Provides:       bundled(miniz) = 2.0.7
c3f84f
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
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
c3f84f
# support custom-derive plugins like #[proc_macro_derive(Foo)].  But eu-strip is
c3f84f
# very eager by default, so we have to limit it to -g, only debugging symbols.
c3f84f
%if 0%{?fedora} >= 27 || 0%{?rhel} > 7
c3f84f
# Newer find-debuginfo.sh supports --keep-section, which is preferable. rhbz1465997
c3f84f
%global _find_debuginfo_opts --keep-section .rustc
c3f84f
%else
c3f84f
%global _find_debuginfo_opts -g
c3f84f
%undefine _include_minidebuginfo
c3f84f
%endif
c3f84f
c3f84f
# Use hardening ldflags.
c3f84f
%global rustflags -Clink-arg=-Wl,-z,relro,-z,now
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
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
c3f84f
c3f84f
%description std-static
c3f84f
This package includes the standard libraries for building applications
c3f84f
written in Rust.
c3f84f
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
a0c80e
%if 0%{?fedora} >= 31 || 0%{?rhel} > 7
c3f84f
Requires:       python3-lldb
a0c80e
%else
a0c80e
Requires:       python2-lldb
a0c80e
%endif
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
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
a0c80e
Provides:       bundled(libgit2) = 0.28.2
c3f84f
%endif
c3f84f
%if %with bundled_libssh2
c3f84f
Provides:       bundled(libssh2) = 1.8.1~dev
c3f84f
%endif
c3f84f
# For tests:
c3f84f
BuildRequires:  git
c3f84f
# Cargo is not much use without Rust
c3f84f
Requires:       rust
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 cargo-doc
c3f84f
Summary:        Documentation for Cargo
c3f84f
BuildArch:      noarch
c3f84f
# Cargo no longer builds its own documentation
c3f84f
# https://github.com/rust-lang/cargo/pull/4904
ec855a
Requires:       rust-doc = %{version}-%{release}
c3f84f
c3f84f
%description -n cargo-doc
c3f84f
This package includes HTML documentation for Cargo.
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
c3f84f
%package -n rls
c3f84f
Summary:        Rust Language Server for IDE integration
c3f84f
%if %with bundled_libgit2
a0c80e
Provides:       bundled(libgit2) = 0.28.2
c3f84f
%endif
c3f84f
%if %with bundled_libssh2
c3f84f
Provides:       bundled(libssh2) = 1.8.1~dev
c3f84f
%endif
c3f84f
Requires:       rust-analysis
c3f84f
# /usr/bin/rls is dynamically linked against internal rustc libs
ec855a
Requires:       %{name}%{?_isa} = %{version}-%{release}
c3f84f
c3f84f
# The component/package was rls-preview until Rust 1.31.
c3f84f
Obsoletes:      rls-preview < 1.31.6
ec855a
Provides:       rls-preview = %{version}-%{release}
c3f84f
c3f84f
%description -n rls
c3f84f
The Rust Language Server provides a server that runs in the background,
c3f84f
providing IDEs, editors, and other tools with information about Rust programs.
c3f84f
It supports functionality such as 'goto definition', symbol search,
c3f84f
reformatting, and code completion, and enables renaming and refactorings.
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
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
ec855a
Requires:       rust-std-static%{?_isa} = %{version}-%{release}
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
c3f84f
%prep
c3f84f
c3f84f
%ifarch %{bootstrap_arches}
c3f84f
%setup -q -n %{bootstrap_root} -T -b %{bootstrap_source}
c3f84f
./install.sh --components=cargo,rustc,rust-std-%{rust_triple} \
c3f84f
  --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
c3f84f
%setup -q -n %{rustc_package}
c3f84f
ec855a
%patch1 -p1 -R
a0c80e
a0c80e
%if %with disabled_libssh2
a0c80e
%patch10 -p1
a0c80e
%endif
c3f84f
c3f84f
%if "%{python}" != "python2"
c3f84f
sed -i.try-py3 -e '/try python2.7/i try %{python} "$@"' ./configure
c3f84f
%endif
c3f84f
c3f84f
%if %without bundled_llvm
ec855a
rm -rf src/llvm-project/
c3f84f
%endif
c3f84f
c3f84f
# We never enable emscripten.
c3f84f
rm -rf src/llvm-emscripten/
c3f84f
a0c80e
# Remove other unused vendored libraries
a0c80e
rm -rf vendor/curl-sys/curl/
a0c80e
rm -rf vendor/jemalloc-sys/jemalloc/
a0c80e
rm -rf vendor/libz-sys/src/zlib/
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 %without bundled_libssh2
a0c80e
rm -rf vendor/libssh2-sys/libssh2/
a0c80e
%endif
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
ec855a
# rename bundled license for packaging
ec855a
cp -a vendor/backtrace-sys/src/libbacktrace/LICENSE{,-libbacktrace}
c3f84f
c3f84f
%if %{with bundled_llvm} && 0%{?epel}
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 {}' \
c3f84f
  src/librustc_llvm/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
c3f84f
c3f84f
%build
c3f84f
c3f84f
%if %without bundled_libgit2
c3f84f
# convince libgit2-sys to use the distro libgit2
c3f84f
export LIBGIT2_SYS_USE_PKG_CONFIG=1
c3f84f
%endif
c3f84f
c3f84f
%if %without bundled_libssh2
c3f84f
# convince libssh2-sys to use the distro libssh2
c3f84f
export LIBSSH2_SYS_USE_PKG_CONFIG=1
c3f84f
%endif
c3f84f
c3f84f
%{?cmake_path:export PATH=%{cmake_path}:$PATH}
c3f84f
%{?rustflags:export RUSTFLAGS="%{rustflags}"}
c3f84f
c3f84f
# We're going to override --libdir when configuring to get rustlib into a
c3f84f
# common path, but we'll fix the shared libraries during install.
c3f84f
%global common_libdir %{_prefix}/lib
c3f84f
%global rustlibdir %{common_libdir}/rustlib
c3f84f
ec855a
%ifarch %{arm} %{ix86} s390x
c3f84f
# full debuginfo is exhausting memory; just do libstd for now
c3f84f
# https://github.com/rust-lang/rust/issues/45854
c3f84f
%if (0%{?fedora} && 0%{?fedora} < 27) || (0%{?rhel} && 0%{?rhel} <= 7)
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
ec855a
# We want the best optimization for std, but it caused problems for rpm-ostree
ec855a
# on ppc64le to have all of the compiler_builtins in a single object:
ec855a
# https://bugzilla.redhat.com/show_bug.cgi?id=1713090
ec855a
%ifnarch %{power64}
ec855a
%define codegen_units_std --set rust.codegen-units-std=1
ec855a
%endif
ec855a
c3f84f
%configure --disable-option-checking \
c3f84f
  --libdir=%{common_libdir} \
c3f84f
  --build=%{rust_triple} --host=%{rust_triple} --target=%{rust_triple} \
a0c80e
  --python=%{python} \
c3f84f
  --local-rust-root=%{local_rust_root} \
c3f84f
  %{!?with_bundled_llvm: --llvm-root=%{llvm_root} \
c3f84f
    %{!?llvm_has_filecheck: --disable-codegen-tests} \
c3f84f
    %{!?with_llvm_static: --enable-llvm-link-shared } } \
c3f84f
  --disable-rpath \
c3f84f
  %{enable_debuginfo} \
c3f84f
  --enable-extended \
c3f84f
  --enable-vendor \
c3f84f
  --enable-verbose-tests \
ec855a
  %{?codegen_units_std} \
c3f84f
  --release-channel=%{channel}
c3f84f
c3f84f
%{python} ./x.py build
c3f84f
%{python} ./x.py doc
c3f84f
c3f84f
c3f84f
%install
c3f84f
%{?cmake_path:export PATH=%{cmake_path}:$PATH}
c3f84f
%{?rustflags:export RUSTFLAGS="%{rustflags}"}
c3f84f
c3f84f
DESTDIR=%{buildroot} %{python} ./x.py install
c3f84f
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.
c3f84f
(cd "%{buildroot}%{rustlibdir}/%{rust_triple}/lib" &&
c3f84f
 find ../../../../%{_lib} -maxdepth 1 -name '*.so' |
c3f84f
 while read lib; do
c3f84f
   # make sure they're actually identical!
c3f84f
   cmp "$lib" "${lib##*/}"
c3f84f
   ln -v -f -s -t . "$lib"
c3f84f
 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
c3f84f
rm -f %{buildroot}%{rustlibdir}/etc/lldb_*.py*
c3f84f
%endif
c3f84f
c3f84f
c3f84f
%check
c3f84f
%{?cmake_path:export PATH=%{cmake_path}:$PATH}
c3f84f
%{?rustflags:export RUSTFLAGS="%{rustflags}"}
c3f84f
c3f84f
# The results are not stable on koji, so mask errors and just log it.
c3f84f
%{python} ./x.py test --no-fail-fast || :
c3f84f
%{python} ./x.py test --no-fail-fast cargo || :
c3f84f
%{python} ./x.py test --no-fail-fast clippy || :
c3f84f
%{python} ./x.py test --no-fail-fast rls || :
c3f84f
%{python} ./x.py test --no-fail-fast rustfmt || :
c3f84f
c3f84f
c3f84f
%ldconfig_scriptlets
c3f84f
c3f84f
c3f84f
%files
c3f84f
%license COPYRIGHT LICENSE-APACHE LICENSE-MIT
ec855a
%license vendor/backtrace-sys/src/libbacktrace/LICENSE-libbacktrace
c3f84f
%doc README.md
c3f84f
%{_bindir}/rustc
c3f84f
%{_bindir}/rustdoc
c3f84f
%{_libdir}/*.so
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
%{rustlibdir}/%{rust_triple}/codegen-backends/
ec855a
%exclude %{_bindir}/*miri
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
c3f84f
%files debugger-common
c3f84f
%dir %{rustlibdir}
c3f84f
%dir %{rustlibdir}/etc
c3f84f
%{rustlibdir}/etc/debugger_*.py*
c3f84f
c3f84f
c3f84f
%files gdb
c3f84f
%{_bindir}/rust-gdb
c3f84f
%{rustlibdir}/etc/gdb_*.py*
ec855a
%exclude %{_bindir}/rust-gdbgui
c3f84f
c3f84f
c3f84f
%if %with lldb
c3f84f
%files lldb
c3f84f
%{_bindir}/rust-lldb
c3f84f
%{rustlibdir}/etc/lldb_*.py*
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
ec855a
%{_docdir}/%{name}/html/*.ico
c3f84f
%{_docdir}/%{name}/html/*.js
ec855a
%{_docdir}/%{name}/html/*.png
c3f84f
%{_docdir}/%{name}/html/*.svg
c3f84f
%{_docdir}/%{name}/html/*.woff
c3f84f
%license %{_docdir}/%{name}/html/*.txt
a0c80e
%license %{_docdir}/%{name}/html/*.md
c3f84f
c3f84f
c3f84f
%files -n cargo
c3f84f
%license src/tools/cargo/LICENSE-APACHE src/tools/cargo/LICENSE-MIT src/tools/cargo/LICENSE-THIRD-PARTY
c3f84f
%doc src/tools/cargo/README.md
c3f84f
%{_bindir}/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 cargo-doc
c3f84f
%docdir %{_docdir}/cargo
c3f84f
%dir %{_docdir}/cargo
c3f84f
%{_docdir}/cargo/html
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
c3f84f
%files -n rls
c3f84f
%{_bindir}/rls
c3f84f
%doc src/tools/rls/{README.md,COPYRIGHT,debugging.md}
c3f84f
%license src/tools/rls/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
c3f84f
%changelog
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.