Blame SPECS/rust.spec

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