df7f61c
# Only x86_64 and i686 are Tier 1 platforms at this time.
df7f61c
# https://forge.rust-lang.org/platform-support.html
df7f61c
%global rust_arches x86_64 i686 armv7hl aarch64 ppc64 ppc64le s390x
df7f61c
717ffe2
# The channel can be stable, beta, or nightly
717ffe2
%{!?channel: %global channel stable}
717ffe2
717ffe2
# To bootstrap from scratch, set the channel and date from src/stage0.txt
717ffe2
# e.g. 1.10.0 wants rustc: 1.9.0-2016-05-24
717ffe2
# or nightly wants some beta-YYYY-MM-DD
143aeca
# Note that cargo matches the program version here, not its crate version.
eedc935
%global bootstrap_rust 1.32.0
eedc935
%global bootstrap_cargo 1.32.0
faed2aa
%global bootstrap_channel %{bootstrap_rust}
eedc935
%global bootstrap_date 2019-01-17
df7f61c
df7f61c
# Only the specified arches will use bootstrap binaries.
820f98e
#global bootstrap_arches %%{rust_arches}
717ffe2
2e4d893
# Using llvm-static may be helpful as an opt-in, e.g. to aid LLVM rebases.
b233f15
%bcond_with llvm_static
1713894
7cfff5a
# We can also choose to just use Rust's bundled LLVM, in case the system LLVM
7524bca
# is insufficient.  Rust currently requires LLVM 5.0+.
28e2de5
%if 0%{?rhel} && !0%{?epel}
7cfff5a
%bcond_without bundled_llvm
7cfff5a
%else
7cfff5a
%bcond_with bundled_llvm
7cfff5a
%endif
7cfff5a
143aeca
# libgit2-sys expects to use its bundled library, which is sometimes just a
143aeca
# snapshot of libgit2's master branch.  This can mean the FFI declarations
143aeca
# won't match our released libgit2.so, e.g. having changed struct fields.
143aeca
# So, tread carefully if you toggle this...
8ccb982
%bcond_without bundled_libgit2
8ccb982
7524bca
%if 0%{?rhel}
7524bca
%bcond_without bundled_libssh2
7524bca
%else
7524bca
%bcond_with bundled_libssh2
7524bca
%endif
7524bca
9245da2
# LLDB only works on some architectures
9245da2
%ifarch %{arm} aarch64 %{ix86} x86_64
faed2aa
# LLDB isn't available everywhere...
9245da2
%if !0%{?rhel}
9245da2
%bcond_without lldb
9245da2
%else
faed2aa
%bcond_with lldb
9245da2
%endif
faed2aa
%else
9245da2
%bcond_with lldb
faed2aa
%endif
faed2aa
717ffe2
Name:           rust
eedc935
Version:        1.33.0
72d7be3
Release:        1%{?dist}
717ffe2
Summary:        The Rust Programming Language
72ac666
License:        (ASL 2.0 or MIT) and (BSD and MIT)
717ffe2
# ^ written as: (rust itself) and (bundled libraries)
717ffe2
URL:            https://www.rust-lang.org
df7f61c
ExclusiveArch:  %{rust_arches}
717ffe2
717ffe2
%if "%{channel}" == "stable"
72d7be3
%global rustc_package rustc-%{version}-src
717ffe2
%else
7cfff5a
%global rustc_package rustc-%{channel}-src
717ffe2
%endif
6d4fd15
Source0:        https://static.rust-lang.org/dist/%{rustc_package}.tar.xz
717ffe2
72d7be3
# https://github.com/rust-dev-tools/rls-analysis/pull/160
72d7be3
Patch1:         0001-Try-to-get-the-target-triple-from-rustc-itself.patch
72d7be3
eedc935
# https://github.com/rust-lang/rust/pull/57647
eedc935
Patch2:         0001-rust-gdb-relax-the-GDB-version-regex.patch
eedc935
eedc935
# Revert https://github.com/rust-lang/rust/pull/57840
eedc935
# We do have the necessary fix in our LLVM 7.
eedc935
Patch3:         rust-pr57840-llvm7-debuginfo-variants.patch
26d7cf9
df7f61c
# Get the Rust triple for any arch.
df7f61c
%{lua: function rust_triple(arch)
df7f61c
  local abi = "gnu"
df7f61c
  if arch == "armv7hl" then
df7f61c
    arch = "armv7"
df7f61c
    abi = "gnueabihf"
df7f61c
  elseif arch == "ppc64" then
df7f61c
    arch = "powerpc64"
df7f61c
  elseif arch == "ppc64le" then
df7f61c
    arch = "powerpc64le"
df7f61c
  end
df7f61c
  return arch.."-unknown-linux-"..abi
df7f61c
end}
df7f61c
df7f61c
%global rust_triple %{lua: print(rust_triple(rpm.expand("%{_target_cpu}")))}
df7f61c
df7f61c
%if %defined bootstrap_arches
df7f61c
# For each bootstrap arch, add an additional binary Source.
df7f61c
# Also define bootstrap_source just for the current target.
df7f61c
%{lua: do
df7f61c
  local bootstrap_arches = {}
df7f61c
  for arch in string.gmatch(rpm.expand("%{bootstrap_arches}"), "%S+") do
df7f61c
    table.insert(bootstrap_arches, arch)
df7f61c
  end
df7f61c
  local base = rpm.expand("https://static.rust-lang.org/dist/%{bootstrap_date}"
faed2aa
                          .."/rust-%{bootstrap_channel}")
df7f61c
  local target_arch = rpm.expand("%{_target_cpu}")
df7f61c
  for i, arch in ipairs(bootstrap_arches) do
6eec89a
    print(string.format("Source%d: %s-%s.tar.xz\n",
df7f61c
                        i, base, rust_triple(arch)))
df7f61c
    if arch == target_arch then
df7f61c
      rpm.define("bootstrap_source "..i)
df7f61c
    end
df7f61c
  end
df7f61c
end}
717ffe2
%endif
717ffe2
df7f61c
%ifarch %{bootstrap_arches}
faed2aa
%global bootstrap_root rust-%{bootstrap_channel}-%{rust_triple}
96a6a34
%global local_rust_root %{_builddir}/%{bootstrap_root}/usr
faed2aa
Provides:       bundled(%{name}-bootstrap) = %{bootstrap_rust}
717ffe2
%else
faed2aa
BuildRequires:  cargo >= %{bootstrap_cargo}
2e4d893
%if 0%{?fedora} >= 27
72d7be3
BuildRequires:  (%{name} >= %{bootstrap_rust} with %{name} <= %{version})
2e4d893
%else
faed2aa
BuildRequires:  %{name} >= %{bootstrap_rust}
72d7be3
BuildConflicts: %{name} > %{version}
2e4d893
%endif
df7f61c
%global local_rust_root %{_prefix}
717ffe2
%endif
717ffe2
717ffe2
BuildRequires:  make
717ffe2
BuildRequires:  gcc
717ffe2
BuildRequires:  gcc-c++
1cdcdee
BuildRequires:  ncurses-devel
717ffe2
BuildRequires:  curl
4fd41d0
BuildRequires:  pkgconfig(libcurl)
4fd41d0
BuildRequires:  pkgconfig(liblzma)
4fd41d0
BuildRequires:  pkgconfig(openssl)
4fd41d0
BuildRequires:  pkgconfig(zlib)
717ffe2
7524bca
%if %without bundled_libgit2
7524bca
BuildRequires:  pkgconfig(libgit2) >= 0.27
7524bca
%endif
7524bca
7524bca
%if %without bundled_libssh2
7524bca
# needs libssh2_userauth_publickey_frommemory
7524bca
BuildRequires:  pkgconfig(libssh2) >= 1.6.0
7524bca
%endif
7524bca
216b2d2
%if 0%{?rhel} && 0%{?rhel} <= 7
216b2d2
%global python python2
216b2d2
%else
216b2d2
%global python python3
216b2d2
%endif
216b2d2
BuildRequires:  %{python}
216b2d2
2e9a258
%if %with bundled_llvm
d6d1480
BuildRequires:  cmake3 >= 3.4.3
26d7cf9
Provides:       bundled(llvm) = 8.0.0~svn
7cfff5a
%else
143aeca
BuildRequires:  cmake >= 2.8.11
eedc935
%if 0%{?epel} || 0%{?fedora} >= 30
eedc935
# TODO: for f30+, we'll be ready for LLVM8 in Rust 1.34
eedc935
%global llvm llvm7.0
6d19212
%endif
6d19212
%if %defined llvm
2453b71
%global llvm_root %{_libdir}/%{llvm}
2453b71
%else
2453b71
%global llvm llvm
2453b71
%global llvm_root %{_prefix}
2453b71
%endif
eedc935
BuildRequires:  %{llvm}-devel >= 6.0
1713894
%if %with llvm_static
2453b71
BuildRequires:  %{llvm}-static
1713894
BuildRequires:  libffi-devel
1713894
%endif
7cfff5a
%endif
1713894
e70d943
# make check needs "ps" for src/test/run-pass/wait-forked-but-failed-child.rs
e70d943
BuildRequires:  procps-ng
e70d943
faed2aa
# debuginfo-gdb tests need gdb
faed2aa
BuildRequires:  gdb
faed2aa
ba0dc4e
# TODO: work on unbundling these!
c81e0e5
Provides:       bundled(libbacktrace) = 8.1.0
eedc935
Provides:       bundled(miniz) = 2.0.7
717ffe2
e11f49f
# Virtual provides for folks who attempt "dnf install rustc"
72d7be3
Provides:       rustc = %{version}-%{release}
72d7be3
Provides:       rustc%{?_isa} = %{version}-%{release}
e11f49f
e11f49f
# Always require our exact standard library
72d7be3
Requires:       %{name}-std-static%{?_isa} = %{version}-%{release}
e11f49f
717ffe2
# The C compiler is needed at runtime just for linking.  Someday rustc might
717ffe2
# invoke the linker directly, and then we'll only need binutils.
717ffe2
# https://github.com/rust-lang/rust/issues/11937
6eec89a
Requires:       /usr/bin/cc
717ffe2
717ffe2
# ALL Rust libraries are private, because they don't keep an ABI.
7524bca
%global _privatelibs lib(.*-[[:xdigit:]]{16}*|rustc.*)[.]so.*
717ffe2
%global __provides_exclude ^(%{_privatelibs})$
717ffe2
%global __requires_exclude ^(%{_privatelibs})$
e5fcf71
%global __provides_exclude_from ^(%{_docdir}|%{rustlibdir}/src)/.*$
e5fcf71
%global __requires_exclude_from ^(%{_docdir}|%{rustlibdir}/src)/.*$
717ffe2
7cfff5a
# While we don't want to encourage dynamic linking to Rust shared libraries, as
7cfff5a
# there's no stable ABI, we still need the unallocated metadata (.rustc) to
7cfff5a
# support custom-derive plugins like #[proc_macro_derive(Foo)].  But eu-strip is
7cfff5a
# very eager by default, so we have to limit it to -g, only debugging symbols.
df0e2cb
%if 0%{?fedora} >= 27
df0e2cb
# Newer find-debuginfo.sh supports --keep-section, which is preferable. rhbz1465997
df0e2cb
%global _find_debuginfo_opts --keep-section .rustc
df0e2cb
%else
df7f61c
%global _find_debuginfo_opts -g
df7f61c
%undefine _include_minidebuginfo
df0e2cb
%endif
df7f61c
2453b71
# Use hardening ldflags.
2453b71
%global rustflags -Clink-arg=-Wl,-z,relro,-z,now
2453b71
26d7cf9
%if %{without bundled_llvm}
eedc935
%if "%{llvm_root}" == "%{_prefix}" || 0%{?scl:1}
26d7cf9
%global llvm_has_filecheck 1
26d7cf9
%endif
26d7cf9
%if "%{llvm_root}" != "%{_prefix}"
2453b71
# https://github.com/rust-lang/rust/issues/40717
96a6a34
%global library_path $(%{llvm_root}/bin/llvm-config --libdir)
2453b71
%endif
26d7cf9
%endif
2453b71
717ffe2
%description
717ffe2
Rust is a systems programming language that runs blazingly fast, prevents
717ffe2
segfaults, and guarantees thread safety.
717ffe2
e11f49f
This package includes the Rust compiler and documentation generator.
e11f49f
e11f49f
e11f49f
%package std-static
e11f49f
Summary:        Standard library for Rust
e11f49f
e11f49f
%description std-static
e11f49f
This package includes the standard libraries for building applications
e11f49f
written in Rust.
717ffe2
717ffe2
28e2de5
%package debugger-common
28e2de5
Summary:        Common debugger pretty printers for Rust
28e2de5
BuildArch:      noarch
28e2de5
28e2de5
%description debugger-common
28e2de5
This package includes the common functionality for %{name}-gdb and %{name}-lldb.
28e2de5
28e2de5
717ffe2
%package gdb
717ffe2
Summary:        GDB pretty printers for Rust
717ffe2
BuildArch:      noarch
717ffe2
Requires:       gdb
72d7be3
Requires:       %{name}-debugger-common = %{version}-%{release}
717ffe2
717ffe2
%description gdb
717ffe2
This package includes the rust-gdb script, which allows easier debugging of Rust
717ffe2
programs.
717ffe2
717ffe2
faed2aa
%if %with lldb
faed2aa
faed2aa
%package lldb
faed2aa
Summary:        LLDB pretty printers for Rust
457e051
9245da2
# It could be noarch, but lldb has limited availability
9245da2
#BuildArch:      noarch
9245da2
faed2aa
Requires:       lldb
559c48d
Requires:       python2-lldb
72d7be3
Requires:       %{name}-debugger-common = %{version}-%{release}
faed2aa
faed2aa
%description lldb
faed2aa
This package includes the rust-lldb script, which allows easier debugging of Rust
faed2aa
programs.
faed2aa
faed2aa
%endif
faed2aa
faed2aa
717ffe2
%package doc
717ffe2
Summary:        Documentation for Rust
8509043
# NOT BuildArch:      noarch
717ffe2
# Note, while docs are mostly noarch, some things do vary by target_arch.
8509043
# Koji will fail the build in rpmdiff if two architectures build a noarch
8509043
# subpackage differently, so instead we have to keep its arch.
717ffe2
717ffe2
%description doc
717ffe2
This package includes HTML documentation for the Rust programming language and
717ffe2
its standard library.
717ffe2
717ffe2
4fd41d0
%package -n cargo
4fd41d0
Summary:        Rust's package manager and build tool
4fd41d0
%if %with bundled_libgit2
143aeca
Provides:       bundled(libgit2) = 0.27
7524bca
%endif
7524bca
%if %with bundled_libssh2
26d7cf9
Provides:       bundled(libssh2) = 1.8.1~dev
4fd41d0
%endif
4fd41d0
# For tests:
4fd41d0
BuildRequires:  git
4fd41d0
# Cargo is not much use without Rust
4fd41d0
Requires:       rust
4fd41d0
4fd41d0
%description -n cargo
4fd41d0
Cargo is a tool that allows Rust projects to declare their various dependencies
4fd41d0
and ensure that you'll always get a repeatable build.
4fd41d0
4fd41d0
4fd41d0
%package -n cargo-doc
4fd41d0
Summary:        Documentation for Cargo
4fd41d0
BuildArch:      noarch
4fd41d0
# Cargo no longer builds its own documentation
4fd41d0
# https://github.com/rust-lang/cargo/pull/4904
72d7be3
Requires:       rust-doc = %{version}-%{release}
4fd41d0
4fd41d0
%description -n cargo-doc
4fd41d0
This package includes HTML documentation for Cargo.
4fd41d0
4fd41d0
26d7cf9
%package -n rustfmt
2e4d893
Summary:        Tool to find and fix Rust formatting issues
2e4d893
Requires:       cargo
2e4d893
26d7cf9
# The component/package was rustfmt-preview until Rust 1.31.
26d7cf9
Obsoletes:      rustfmt-preview < 1.0.0
72d7be3
Provides:       rustfmt-preview = %{version}-%{release}
2e4d893
26d7cf9
%description -n rustfmt
2e4d893
A tool for formatting Rust code according to style guidelines.
2e4d893
2e4d893
26d7cf9
%package -n rls
4fd41d0
Summary:        Rust Language Server for IDE integration
4fd41d0
%if %with bundled_libgit2
143aeca
Provides:       bundled(libgit2) = 0.27
4fd41d0
%endif
7524bca
%if %with bundled_libssh2
26d7cf9
Provides:       bundled(libssh2) = 1.8.1~dev
7524bca
%endif
4fd41d0
Requires:       rust-analysis
4fd41d0
# /usr/bin/rls is dynamically linked against internal rustc libs
72d7be3
Requires:       %{name}%{?_isa} = %{version}-%{release}
4fd41d0
26d7cf9
# The component/package was rls-preview until Rust 1.31.
26d7cf9
Obsoletes:      rls-preview < 1.31.6
72d7be3
Provides:       rls-preview = %{version}-%{release}
26d7cf9
26d7cf9
%description -n rls
4fd41d0
The Rust Language Server provides a server that runs in the background,
4fd41d0
providing IDEs, editors, and other tools with information about Rust programs.
4fd41d0
It supports functionality such as 'goto definition', symbol search,
4fd41d0
reformatting, and code completion, and enables renaming and refactorings.
4fd41d0
4fd41d0
26d7cf9
%package -n clippy
7524bca
Summary:        Lints to catch common mistakes and improve your Rust code
7524bca
Requires:       cargo
7524bca
# /usr/bin/clippy-driver is dynamically linked against internal rustc libs
72d7be3
Requires:       %{name}%{?_isa} = %{version}-%{release}
7524bca
26d7cf9
# The component/package was clippy-preview until Rust 1.31.
26d7cf9
Obsoletes:      clippy-preview <= 0.0.212
72d7be3
Provides:       clippy-preview = %{version}-%{release}
26d7cf9
26d7cf9
%description -n clippy
7524bca
A collection of lints to catch common mistakes and improve your Rust code.
7524bca
7524bca
6eec89a
%package src
6eec89a
Summary:        Sources for the Rust standard library
6eec89a
BuildArch:      noarch
6eec89a
6eec89a
%description src
6eec89a
This package includes source files for the Rust standard library.  It may be
6eec89a
useful as a reference for code completion tools in various editors.
6eec89a
6eec89a
4fd41d0
%package analysis
4fd41d0
Summary:        Compiler analysis data for the Rust standard library
72d7be3
Requires:       rust-std-static%{?_isa} = %{version}-%{release}
4fd41d0
4fd41d0
%description analysis
4fd41d0
This package contains analysis data files produced with rustc's -Zsave-analysis
4fd41d0
feature for the Rust standard library. The RLS (Rust Language Server) uses this
4fd41d0
data to provide information about the Rust standard library.
4fd41d0
4fd41d0
717ffe2
%prep
717ffe2
df7f61c
%ifarch %{bootstrap_arches}
df7f61c
%setup -q -n %{bootstrap_root} -T -b %{bootstrap_source}
faed2aa
./install.sh --components=cargo,rustc,rust-std-%{rust_triple} \
96a6a34
  --prefix=%{local_rust_root} --disable-ldconfig
faed2aa
test -f '%{local_rust_root}/bin/cargo'
e70d943
test -f '%{local_rust_root}/bin/rustc'
e70d943
%endif
e70d943
df7f61c
%setup -q -n %{rustc_package}
717ffe2
72d7be3
pushd vendor/rls-analysis
26d7cf9
%patch1 -p1
72d7be3
popd
72d7be3
%patch2 -p1
eedc935
%patch3 -p1 -R
26d7cf9
216b2d2
%if "%{python}" == "python3"
216b2d2
sed -i.try-py3 -e '/try python2.7/i try python3 "$@"' ./configure
216b2d2
%endif
216b2d2
7cfff5a
%if %without bundled_llvm
e70d943
rm -rf src/llvm/
7cfff5a
%endif
717ffe2
2e4d893
# We never enable emscripten.
2e4d893
rm -rf src/llvm-emscripten/
2e4d893
3fff7a4
# We never enable other LLVM tools.
3fff7a4
rm -rf src/tools/clang
3fff7a4
rm -rf src/tools/lld
3fff7a4
rm -rf src/tools/lldb
3fff7a4
eedc935
# rename bundled license for packaging
eedc935
cp -a vendor/backtrace-sys/src/libbacktrace/LICENSE{,-libbacktrace}
717ffe2
2e9a258
%if %{with bundled_llvm} && 0%{?epel}
faed2aa
mkdir -p cmake-bin
faed2aa
ln -s /usr/bin/cmake3 cmake-bin/cmake
faed2aa
%global cmake_path $PWD/cmake-bin
7cfff5a
%endif
7cfff5a
7cfff5a
%if %{without bundled_llvm} && %{with llvm_static}
1713894
# Static linking to distro LLVM needs to add -lffi
1713894
# https://github.com/rust-lang/rust/issues/34486
1713894
sed -i.ffi -e '$a #[link(name = "ffi")] extern {}' \
1713894
  src/librustc_llvm/lib.rs
1713894
%endif
1713894
6d4fd15
# The configure macro will modify some autoconf-related files, which upsets
6d4fd15
# cargo when it tries to verify checksums in those files.  If we just truncate
6d4fd15
# that file list, cargo won't have anything to complain about.
72d7be3
find vendor -name .cargo-checksum.json \
6d4fd15
  -exec sed -i.uncheck -e 's/"files":{[^}]*}/"files":{ }/' '{}' '+'
faed2aa
717ffe2
717ffe2
%build
4d5af3f
4fd41d0
%if %without bundled_libgit2
4fd41d0
# convince libgit2-sys to use the distro libgit2
4fd41d0
export LIBGIT2_SYS_USE_PKG_CONFIG=1
4fd41d0
%endif
4fd41d0
7524bca
%if %without bundled_libssh2
7524bca
# convince libssh2-sys to use the distro libssh2
7524bca
export LIBSSH2_SYS_USE_PKG_CONFIG=1
7524bca
%endif
7524bca
faed2aa
%{?cmake_path:export PATH=%{cmake_path}:$PATH}
96a6a34
%{?library_path:export LIBRARY_PATH="%{library_path}"}
96a6a34
%{?rustflags:export RUSTFLAGS="%{rustflags}"}
e11f49f
df7f61c
# We're going to override --libdir when configuring to get rustlib into a
7cfff5a
# common path, but we'll fix the shared libraries during install.
df7f61c
%global common_libdir %{_prefix}/lib
df7f61c
%global rustlibdir %{common_libdir}/rustlib
e11f49f
6699af7
%ifarch %{arm} %{ix86} s390x
6d19212
# full debuginfo is exhausting memory; just do libstd for now
6d19212
# https://github.com/rust-lang/rust/issues/45854
Pablo Sebastián Greco 9e518e0
%if (0%{?fedora} && 0%{?fedora} < 27) || (0%{?rhel} && 0%{?rhel} <= 7)
6cdc8d0
# Older rpmbuild didn't work with partial debuginfo coverage.
Pablo Sebastián Greco 9e518e0
%global debug_package %{nil}
Pablo Sebastián Greco 9e518e0
%define enable_debuginfo --disable-debuginfo --disable-debuginfo-only-std --disable-debuginfo-tools --disable-debuginfo-lines
Pablo Sebastián Greco 9e518e0
%else
4fd41d0
%define enable_debuginfo --enable-debuginfo --enable-debuginfo-only-std --disable-debuginfo-tools --disable-debuginfo-lines
Pablo Sebastián Greco 9e518e0
%endif
6d19212
%else
4fd41d0
%define enable_debuginfo --enable-debuginfo --disable-debuginfo-only-std --enable-debuginfo-tools --disable-debuginfo-lines
6d19212
%endif
6d19212
717ffe2
%configure --disable-option-checking \
e11f49f
  --libdir=%{common_libdir} \
717ffe2
  --build=%{rust_triple} --host=%{rust_triple} --target=%{rust_triple} \
2e4d893
  --local-rust-root=%{local_rust_root} \
26d7cf9
  %{!?with_bundled_llvm: --llvm-root=%{llvm_root} \
26d7cf9
    %{!?llvm_has_filecheck: --disable-codegen-tests} \
7cfff5a
    %{!?with_llvm_static: --enable-llvm-link-shared } } \
717ffe2
  --disable-rpath \
6d19212
  %{enable_debuginfo} \
4fd41d0
  --enable-extended \
faed2aa
  --enable-vendor \
c81e0e5
  --enable-verbose-tests \
717ffe2
  --release-channel=%{channel}
ba0dc4e
216b2d2
%{python} ./x.py build
216b2d2
%{python} ./x.py doc
717ffe2
717ffe2
717ffe2
%install
faed2aa
%{?cmake_path:export PATH=%{cmake_path}:$PATH}
96a6a34
%{?library_path:export LIBRARY_PATH="%{library_path}"}
96a6a34
%{?rustflags:export RUSTFLAGS="%{rustflags}"}
faed2aa
216b2d2
DESTDIR=%{buildroot} %{python} ./x.py install
e11f49f
0d6f63b
# Make sure the shared libraries are in the proper libdir
0d6f63b
%if "%{_libdir}" != "%{common_libdir}"
0d6f63b
mkdir -p %{buildroot}%{_libdir}
0d6f63b
find %{buildroot}%{common_libdir} -maxdepth 1 -type f -name '*.so' \
0d6f63b
  -exec mv -v -t %{buildroot}%{_libdir} '{}' '+'
0d6f63b
%endif
717ffe2
7cfff5a
# The shared libraries should be executable for debuginfo extraction.
0d6f63b
find %{buildroot}%{_libdir} -maxdepth 1 -type f -name '*.so' \
0d6f63b
  -exec chmod -v +x '{}' '+'
0d6f63b
0d6f63b
# The libdir libraries are identical to those under rustlib/.  It's easier on
0d6f63b
# library loading if we keep them in libdir, but we do need them in rustlib/
0d6f63b
# to support dynamic linking for compiler plugins, so we'll symlink.
0d6f63b
(cd "%{buildroot}%{rustlibdir}/%{rust_triple}/lib" &&
1fe43a8
 find ../../../../%{_lib} -maxdepth 1 -name '*.so' |
1fe43a8
 while read lib; do
1fe43a8
   # make sure they're actually identical!
1fe43a8
   cmp "$lib" "${lib##*/}"
1fe43a8
   ln -v -f -s -t . "$lib"
1fe43a8
 done)
0d6f63b
0d6f63b
# Remove installer artifacts (manifests, uninstall scripts, etc.)
0d6f63b
find %{buildroot}%{rustlibdir} -maxdepth 1 -type f -exec rm -v '{}' '+'
e70d943
5eabb0b
# Remove backup files from %%configure munging
5eabb0b
find %{buildroot}%{rustlibdir} -type f -name '*.orig' -exec rm -v '{}' '+'
5eabb0b
7524bca
# https://fedoraproject.org/wiki/Changes/Make_ambiguous_python_shebangs_error
7524bca
# We don't actually need to ship any of those python scripts in rust-src anyway.
7524bca
find %{buildroot}%{rustlibdir}/src -type f -name '*.py' -exec rm -v '{}' '+'
7524bca
717ffe2
# FIXME: __os_install_post will strip the rlibs
717ffe2
# -- should we find a way to preserve debuginfo?
717ffe2
717ffe2
# Remove unwanted documentation files (we already package them)
7cfff5a
rm -f %{buildroot}%{_docdir}/%{name}/README.md
7cfff5a
rm -f %{buildroot}%{_docdir}/%{name}/COPYRIGHT
7524bca
rm -f %{buildroot}%{_docdir}/%{name}/LICENSE
7cfff5a
rm -f %{buildroot}%{_docdir}/%{name}/LICENSE-APACHE
7cfff5a
rm -f %{buildroot}%{_docdir}/%{name}/LICENSE-MIT
4fd41d0
rm -f %{buildroot}%{_docdir}/%{name}/LICENSE-THIRD-PARTY
2e4d893
rm -f %{buildroot}%{_docdir}/%{name}/*.old
717ffe2
717ffe2
# Sanitize the HTML documentation
7cfff5a
find %{buildroot}%{_docdir}/%{name}/html -empty -delete
7cfff5a
find %{buildroot}%{_docdir}/%{name}/html -type f -exec chmod -x '{}' '+'
717ffe2
4fd41d0
# Create the path for crate-devel packages
4fd41d0
mkdir -p %{buildroot}%{_datadir}/cargo/registry
4fd41d0
4fd41d0
# Cargo no longer builds its own documentation
4fd41d0
# https://github.com/rust-lang/cargo/pull/4904
7524bca
mkdir -p %{buildroot}%{_docdir}/cargo
7524bca
ln -sT ../rust/html/cargo/ %{buildroot}%{_docdir}/cargo/html
4fd41d0
faed2aa
%if %without lldb
faed2aa
rm -f %{buildroot}%{_bindir}/rust-lldb
faed2aa
rm -f %{buildroot}%{rustlibdir}/etc/lldb_*.py*
faed2aa
%endif
faed2aa
717ffe2
717ffe2
%check
faed2aa
%{?cmake_path:export PATH=%{cmake_path}:$PATH}
96a6a34
%{?library_path:export LIBRARY_PATH="%{library_path}"}
96a6a34
%{?rustflags:export RUSTFLAGS="%{rustflags}"}
faed2aa
81684a4
# The results are not stable on koji, so mask errors and just log it.
216b2d2
%{python} ./x.py test --no-fail-fast || :
4fd41d0
%{python} ./x.py test --no-fail-fast cargo || :
7524bca
%{python} ./x.py test --no-fail-fast clippy || :
4fd41d0
%{python} ./x.py test --no-fail-fast rls || :
4fd41d0
%{python} ./x.py test --no-fail-fast rustfmt || :
717ffe2
717ffe2
ba2e3fd
%ldconfig_scriptlets
717ffe2
717ffe2
717ffe2
%files
717ffe2
%license COPYRIGHT LICENSE-APACHE LICENSE-MIT
eedc935
%license vendor/backtrace-sys/src/libbacktrace/LICENSE-libbacktrace
717ffe2
%doc README.md
717ffe2
%{_bindir}/rustc
717ffe2
%{_bindir}/rustdoc
0d6f63b
%{_libdir}/*.so
717ffe2
%{_mandir}/man1/rustc.1*
717ffe2
%{_mandir}/man1/rustdoc.1*
7cfff5a
%dir %{rustlibdir}
7cfff5a
%dir %{rustlibdir}/%{rust_triple}
7cfff5a
%dir %{rustlibdir}/%{rust_triple}/lib
7cfff5a
%{rustlibdir}/%{rust_triple}/lib/*.so
2e4d893
%{rustlibdir}/%{rust_triple}/codegen-backends/
eedc935
%exclude %{_bindir}/{cargo-,}miri
e11f49f
e11f49f
e11f49f
%files std-static
e11f49f
%dir %{rustlibdir}
e11f49f
%dir %{rustlibdir}/%{rust_triple}
e11f49f
%dir %{rustlibdir}/%{rust_triple}/lib
e11f49f
%{rustlibdir}/%{rust_triple}/lib/*.rlib
717ffe2
717ffe2
28e2de5
%files debugger-common
e11f49f
%dir %{rustlibdir}
e11f49f
%dir %{rustlibdir}/etc
faed2aa
%{rustlibdir}/etc/debugger_*.py*
28e2de5
28e2de5
28e2de5
%files gdb
28e2de5
%{_bindir}/rust-gdb
faed2aa
%{rustlibdir}/etc/gdb_*.py*
faed2aa
faed2aa
faed2aa
%if %with lldb
faed2aa
%files lldb
faed2aa
%{_bindir}/rust-lldb
faed2aa
%{rustlibdir}/etc/lldb_*.py*
faed2aa
%endif
717ffe2
717ffe2
717ffe2
%files doc
28e2de5
%docdir %{_docdir}/%{name}
717ffe2
%dir %{_docdir}/%{name}
28e2de5
%dir %{_docdir}/%{name}/html
28e2de5
%{_docdir}/%{name}/html/*/
28e2de5
%{_docdir}/%{name}/html/*.html
28e2de5
%{_docdir}/%{name}/html/*.css
28e2de5
%{_docdir}/%{name}/html/*.js
2e4d893
%{_docdir}/%{name}/html/*.svg
28e2de5
%{_docdir}/%{name}/html/*.woff
28e2de5
%license %{_docdir}/%{name}/html/*.txt
717ffe2
717ffe2
4fd41d0
%files -n cargo
4fd41d0
%license src/tools/cargo/LICENSE-APACHE src/tools/cargo/LICENSE-MIT src/tools/cargo/LICENSE-THIRD-PARTY
4fd41d0
%doc src/tools/cargo/README.md
4fd41d0
%{_bindir}/cargo
4fd41d0
%{_mandir}/man1/cargo*.1*
4fd41d0
%{_sysconfdir}/bash_completion.d/cargo
4fd41d0
%{_datadir}/zsh/site-functions/_cargo
4fd41d0
%dir %{_datadir}/cargo
4fd41d0
%dir %{_datadir}/cargo/registry
4fd41d0
4fd41d0
4fd41d0
%files -n cargo-doc
7524bca
%docdir %{_docdir}/cargo
7524bca
%dir %{_docdir}/cargo
4fd41d0
%{_docdir}/cargo/html
4fd41d0
4fd41d0
26d7cf9
%files -n rustfmt
2e4d893
%{_bindir}/rustfmt
2e4d893
%{_bindir}/cargo-fmt
2e4d893
%doc src/tools/rustfmt/{README,CHANGELOG,Configurations}.md
2e4d893
%license src/tools/rustfmt/LICENSE-{APACHE,MIT}
2e4d893
2e4d893
26d7cf9
%files -n rls
4fd41d0
%{_bindir}/rls
4fd41d0
%doc src/tools/rls/{README.md,COPYRIGHT,debugging.md}
4fd41d0
%license src/tools/rls/LICENSE-{APACHE,MIT}
4fd41d0
4fd41d0
26d7cf9
%files -n clippy
7524bca
%{_bindir}/cargo-clippy
7524bca
%{_bindir}/clippy-driver
7524bca
%doc src/tools/clippy/{README.md,CHANGELOG.md}
26d7cf9
%license src/tools/clippy/LICENSE-{APACHE,MIT}
7524bca
7524bca
6eec89a
%files src
6eec89a
%dir %{rustlibdir}
6eec89a
%{rustlibdir}/src
6eec89a
6eec89a
4fd41d0
%files analysis
4fd41d0
%{rustlibdir}/%{rust_triple}/analysis/
4fd41d0
4fd41d0
717ffe2
%changelog
eedc935
* Thu Feb 28 2019 Josh Stone <jistone@redhat.com> - 1.33.0-1
eedc935
- Update to 1.33.0.
eedc935
2503a33
* Sat Feb 02 2019 Fedora Release Engineering <releng@fedoraproject.org> - 1.32.0-2
2503a33
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
2503a33
72d7be3
* Thu Jan 17 2019 Josh Stone <jistone@redhat.com> - 1.32.0-1
72d7be3
- Update to 1.32.0.
72d7be3
86aff7c
* Mon Jan 07 2019 Josh Stone <jistone@redhat.com> - 1.31.1-9
86aff7c
- Update to 1.31.1 for RLS fixes.
86aff7c
26d7cf9
* Thu Dec 06 2018 Josh Stone <jistone@redhat.com> - 1.31.0-8
26d7cf9
- Update to 1.31.0 -- Rust 2018!
26d7cf9
- clippy/rls/rustfmt are no longer -preview
26d7cf9
02208e3
* Thu Nov 08 2018 Josh Stone <jistone@redhat.com> - 1.30.1-7
02208e3
- Update to 1.30.1.
02208e3
3fff7a4
* Thu Oct 25 2018 Josh Stone <jistone@redhat.com> - 1.30.0-6
3fff7a4
- Update to 1.30.0.
3fff7a4
e2862ab
* Fri Oct 12 2018 Josh Stone <jistone@redhat.com> - 1.29.2-3
e2862ab
- Update to 1.29.2.
e2862ab
6ae43e1
* Tue Sep 25 2018 Josh Stone <jistone@redhat.com> - 1.29.1-2
6ae43e1
- Update to 1.29.1.
6ae43e1
- Security fix for str::repeat (pending CVE).
6ae43e1
7524bca
* Thu Sep 13 2018 Josh Stone <jistone@redhat.com> - 1.29.0-1
7524bca
- Update to 1.29.0.
7524bca
- Add a clippy-preview subpackage
7524bca
1917fae
* Mon Aug 13 2018 Josh Stone <jistone@redhat.com> - 1.28.0-3
1917fae
- Use llvm6.0 instead of llvm-7 for now
1917fae
7273060
* Tue Aug 07 2018 Josh Stone <jistone@redhat.com> - 1.28.0-2
7273060
- Rebuild for LLVM ppc64/s390x fixes
7273060
c81e0e5
* Thu Aug 02 2018 Josh Stone <jistone@redhat.com> - 1.28.0-1
c81e0e5
- Update to 1.28.0.
c81e0e5
63599d0
* Tue Jul 24 2018 Josh Stone <jistone@redhat.com> - 1.27.2-4
63599d0
- Update to 1.27.2.
63599d0
507a2f1
* Sat Jul 14 2018 Fedora Release Engineering <releng@fedoraproject.org> - 1.27.1-3
507a2f1
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
507a2f1
e5aa295
* Tue Jul 10 2018 Josh Stone <jistone@redhat.com> - 1.27.1-2
e5aa295
- Update to 1.27.1.
dcadfa5
- Security fix for CVE-2018-1000622
e5aa295
143aeca
* Thu Jun 21 2018 Josh Stone <jistone@redhat.com> - 1.27.0-1
143aeca
- Update to 1.27.0.
143aeca
820f98e
* Tue Jun 05 2018 Josh Stone <jistone@redhat.com> - 1.26.2-4
820f98e
- Rebuild without bootstrap binaries.
820f98e
59bda43
* Tue Jun 05 2018 Josh Stone <jistone@redhat.com> - 1.26.2-3
59bda43
- Update to 1.26.2.
59bda43
- Re-bootstrap to deal with LLVM symbol changes.
59bda43
225f76f
* Tue May 29 2018 Josh Stone <jistone@redhat.com> - 1.26.1-2
225f76f
- Update to 1.26.1.
225f76f
72ac666
* Thu May 10 2018 Josh Stone <jistone@redhat.com> - 1.26.0-1
72ac666
- Update to 1.26.0.
72ac666
4fd41d0
* Mon Apr 16 2018 Dan Callaghan <dcallagh@redhat.com> - 1.25.0-3
4fd41d0
- Add cargo, rls, and analysis
4fd41d0
be4334f
* Tue Apr 10 2018 Josh Stone <jistone@redhat.com> - 1.25.0-2
be4334f
- Filter codegen-backends from Provides too.
be4334f
2e4d893
* Thu Mar 29 2018 Josh Stone <jistone@redhat.com> - 1.25.0-1
2e4d893
- Update to 1.25.0.
2e4d893
1bb4d24
* Thu Mar 01 2018 Josh Stone <jistone@redhat.com> - 1.24.1-1
1bb4d24
- Update to 1.24.1.
1bb4d24
c25b6ed
* Wed Feb 21 2018 Josh Stone <jistone@redhat.com> - 1.24.0-3
c25b6ed
- Backport a rebuild fix for rust#48308.
c25b6ed
1fe43a8
* Mon Feb 19 2018 Josh Stone <jistone@redhat.com> - 1.24.0-2
1fe43a8
- rhbz1546541: drop full-bootstrap; cmp libs before symlinking.
1fe43a8
- Backport pr46592 to fix local_rebuild bootstrapping.
1fe43a8
- Backport pr48362 to fix relative/absolute libdir.
1fe43a8
216b2d2
* Thu Feb 15 2018 Josh Stone <jistone@redhat.com> - 1.24.0-1
216b2d2
- Update to 1.24.0.
216b2d2
559c48d
* Mon Feb 12 2018 Iryna Shcherbina <ishcherb@redhat.com> - 1.23.0-4
559c48d
- Update Python 2 dependency declarations to new packaging standards
559c48d
  (See https://fedoraproject.org/wiki/FinalizingFedoraSwitchtoPython3)
559c48d
87264cb
* Tue Feb 06 2018 Josh Stone <jistone@redhat.com> - 1.23.0-3
87264cb
- Use full-bootstrap to work around a rebuild issue.
d93a6f0
- Patch binaryen for GCC 8
87264cb
ba2e3fd
* Thu Feb 01 2018 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 1.23.0-2
ba2e3fd
- Switch to %%ldconfig_scriptlets
ba2e3fd
d6d1480
* Mon Jan 08 2018 Josh Stone <jistone@redhat.com> - 1.23.0-1
d6d1480
- Update to 1.23.0.
d6d1480
6d19212
* Thu Nov 23 2017 Josh Stone <jistone@redhat.com> - 1.22.1-1
6d19212
- Update to 1.22.1.
6d19212
dbb950d
* Thu Oct 12 2017 Josh Stone <jistone@redhat.com> - 1.21.0-1
dbb950d
- Update to 1.21.0.
dbb950d
99c271a
* Mon Sep 11 2017 Josh Stone <jistone@redhat.com> - 1.20.0-2
99c271a
- ABI fixes for ppc64 and s390x.
99c271a
6eec89a
* Thu Aug 31 2017 Josh Stone <jistone@redhat.com> - 1.20.0-1
6eec89a
- Update to 1.20.0.
6eec89a
- Add a rust-src subpackage.
6eec89a
7248043
* Thu Aug 03 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.19.0-4
7248043
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild
7248043
c854d36
* Thu Jul 27 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.19.0-3
c854d36
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
c854d36
df0e2cb
* Mon Jul 24 2017 Josh Stone <jistone@redhat.com> - 1.19.0-2
df0e2cb
- Use find-debuginfo.sh --keep-section .rustc
df0e2cb
6d4fd15
* Thu Jul 20 2017 Josh Stone <jistone@redhat.com> - 1.19.0-1
6d4fd15
- Update to 1.19.0.
6d4fd15
96a6a34
* Thu Jun 08 2017 Josh Stone <jistone@redhat.com> - 1.18.0-1
96a6a34
- Update to 1.18.0.
96a6a34
0d6f63b
* Mon May 08 2017 Josh Stone <jistone@redhat.com> - 1.17.0-2
0d6f63b
- Move shared libraries back to libdir and symlink in rustlib
0d6f63b
28e2de5
* Thu Apr 27 2017 Josh Stone <jistone@redhat.com> - 1.17.0-1
28e2de5
- Update to 1.17.0.
28e2de5
9245da2
* Mon Mar 20 2017 Josh Stone <jistone@redhat.com> - 1.16.0-3
9245da2
- Make rust-lldb arch-specific to deal with lldb deps
9245da2
457e051
* Fri Mar 17 2017 Josh Stone <jistone@redhat.com> - 1.16.0-2
457e051
- Limit rust-lldb arches
457e051
faed2aa
* Thu Mar 16 2017 Josh Stone <jistone@redhat.com> - 1.16.0-1
faed2aa
- Update to 1.16.0.
faed2aa
- Use rustbuild instead of the old makefiles.
faed2aa
- Update bootstrapping to include rust-std and cargo.
faed2aa
- Add a rust-lldb subpackage.
faed2aa
7cfff5a
* Thu Feb 09 2017 Josh Stone <jistone@redhat.com> - 1.15.1-1
7cfff5a
- Update to 1.15.1.
7cfff5a
- Require rust-rpm-macros for new crate packaging.
7cfff5a
- Keep shared libraries under rustlib/, only debug-stripped.
7cfff5a
- Merge and clean up conditionals for epel7.
7cfff5a
5295a12
* Fri Dec 23 2016 Josh Stone <jistone@redhat.com> - 1.14.0-2
5295a12
- Rebuild without bootstrap binaries.
5295a12
df7f61c
* Thu Dec 22 2016 Josh Stone <jistone@redhat.com> - 1.14.0-1
df7f61c
- Update to 1.14.0.
df7f61c
- Rewrite bootstrap logic to target specific arches.
df7f61c
- Bootstrap ppc64, ppc64le, s390x. (thanks to Sinny Kumari for testing!)
df7f61c
e11f49f
* Thu Nov 10 2016 Josh Stone <jistone@redhat.com> - 1.13.0-1
e11f49f
- Update to 1.13.0.
e11f49f
- Use hardening flags for linking.
e11f49f
- Split the standard library into its own package
e11f49f
- Centralize rustlib/ under /usr/lib/ for multilib integration.
e11f49f
6050c3a
* Thu Oct 20 2016 Josh Stone <jistone@redhat.com> - 1.12.1-1
6050c3a
- Update to 1.12.1.
6050c3a
b233f15
* Fri Oct 14 2016 Josh Stone <jistone@redhat.com> - 1.12.0-7
b233f15
- Rebuild with LLVM 3.9.
1cdcdee
- Add ncurses-devel for llvm-config's -ltinfo.
b233f15
ee0eb2e
* Thu Oct 13 2016 Josh Stone <jistone@redhat.com> - 1.12.0-6
ee0eb2e
- Rebuild with llvm-static, preparing for 3.9
ee0eb2e
b7f305b
* Fri Oct 07 2016 Josh Stone <jistone@redhat.com> - 1.12.0-5
b7f305b
- Rebuild with fixed eu-strip (rhbz1380961)
b7f305b
41b455a
* Fri Oct 07 2016 Josh Stone <jistone@redhat.com> - 1.12.0-4
41b455a
- Rebuild without bootstrap binaries.
41b455a
4d5af3f
* Thu Oct 06 2016 Josh Stone <jistone@redhat.com> - 1.12.0-3
4d5af3f
- Bootstrap aarch64.
4d5af3f
- Use jemalloc's MALLOC_CONF to work around #36944.
4d5af3f
- Apply pr36933 to really disable armv7hl NEON.
4d5af3f
1702b2c
* Sat Oct 01 2016 Josh Stone <jistone@redhat.com> - 1.12.0-2
1702b2c
- Protect .rustc from rpm stripping.
1702b2c
e70d943
* Fri Sep 30 2016 Josh Stone <jistone@redhat.com> - 1.12.0-1
e70d943
- Update to 1.12.0.
e70d943
- Always use --local-rust-root, even for bootstrap binaries.
e70d943
- Remove the rebuild conditional - the build system now figures it out.
e70d943
- Let minidebuginfo do its thing, since metadata is no longer a note.
e70d943
- Let rust build its own compiler-rt builtins again.
e70d943
2cf5e86
* Sat Sep 03 2016 Josh Stone <jistone@redhat.com> - 1.11.0-3
2cf5e86
- Rebuild without bootstrap binaries.
2cf5e86
5a8b330
* Fri Sep 02 2016 Josh Stone <jistone@redhat.com> - 1.11.0-2
5a8b330
- Bootstrap armv7hl, with backported no-neon patch.
5a8b330
ba0dc4e
* Wed Aug 24 2016 Josh Stone <jistone@redhat.com> - 1.11.0-1
ba0dc4e
- Update to 1.11.0.
ba0dc4e
- Drop the backported patches.
ba0dc4e
- Patch get-stage0.py to trust existing bootstrap binaries.
ba0dc4e
- Use libclang_rt.builtins from compiler-rt, dodging llvm-static issues.
ba0dc4e
- Use --local-rust-root to make sure the right bootstrap is used.
ba0dc4e
5529092
* Sat Aug 13 2016 Josh Stone <jistone@redhat.com> 1.10.0-4
5529092
- Rebuild without bootstrap binaries.
5529092
8509043
* Fri Aug 12 2016 Josh Stone <jistone@redhat.com> - 1.10.0-3
717ffe2
- Initial import into Fedora (#1356907), bootstrapped
717ffe2
- Format license text as suggested in review.
717ffe2
- Note how the tests already run in parallel.
717ffe2
- Undefine _include_minidebuginfo, because it duplicates ".note.rustc".
81684a4
- Don't let checks fail the whole build.
8509043
- Note that -doc can't be noarch, as rpmdiff doesn't allow variations.
717ffe2
717ffe2
* Tue Jul 26 2016 Josh Stone <jistone@redhat.com> - 1.10.0-2
717ffe2
- Update -doc directory ownership, and mark its licenses.
717ffe2
- Package and declare licenses for libbacktrace and hoedown.
717ffe2
- Set bootstrap_base as a global.
717ffe2
- Explicitly require python2.
717ffe2
717ffe2
* Thu Jul 14 2016 Josh Stone <jistone@fedoraproject.org> - 1.10.0-1
717ffe2
- Initial package, bootstrapped