%bcond_with bootstrap # bootstrap using precompiled binaries
%bcond_with full_debuginfo # full debuginfo vs only std debuginfo (full takes gigabytes of memory to build)
%bcond_without system_llvm # system LLVM
-%bcond_without rustc # rustc building
-%bcond_without cargo # cargo building
%bcond_with tests # build without tests
# The channel can be stable, beta, or nightly
# To bootstrap from scratch, set the channel and date from src/stage0.txt
# e.g. 1.10.0 wants rustc: 1.9.0-2016-05-24
# or nightly wants some beta-YYYY-MM-DD
-%define bootstrap_rust 1.38.0
-%define bootstrap_cargo 0.39.0
-%define bootstrap_date 2019-09-26
+%define bootstrap_rust 1.43.1
+%define bootstrap_cargo 1.43.1
+%define bootstrap_date 2020-05-07
%ifarch x32
-%undefine with_cargo
-%undefine with_rustc
+%define with_cross 1
%endif
Summary: The Rust Programming Language
Summary(pl.UTF-8): Język programowania Rust
Name: rust
-Version: 1.39.0
+Version: 1.44.1
Release: 1
# Licenses: (rust itself) and (bundled libraries)
License: (Apache v2.0 or MIT) and (BSD and ISC and MIT)
Group: Development/Languages
Source0: https://static.rust-lang.org/dist/%{rustc_package}.tar.xz
-# Source0-md5: ee76b165cd95ef420765bfb568adb450
+# Source0-md5: 0cc3b079ddb1eb9a17f9e7e52efcebc5
Source1: https://static.rust-lang.org/dist/%{bootstrap_date}/rust-%{bootstrap_rust}-x86_64-unknown-linux-gnu.tar.xz
-# Source1-md5: b019f0dc0e4c45198d781fa459179ccd
+# Source1-md5: 62b0974a4bad5aeabd50c7a7fa74518c
Source2: https://static.rust-lang.org/dist/%{bootstrap_date}/rust-%{bootstrap_rust}-i686-unknown-linux-gnu.tar.xz
-# Source2-md5: e3a0c200eb1c9eabae930c94296885ee
+# Source2-md5: 758d55172c8dddb1ec71913b5f532bb2
Source3: https://static.rust-lang.org/dist/%{bootstrap_date}/rust-std-%{bootstrap_rust}-x86_64-unknown-linux-gnux32.tar.xz
-# Source3-md5: 067ea32f60e37821723be41a5ba829d9
+# Source3-md5: 4b07c6922a0965791cf8eb28fee9e89d
+Source4: https://static.rust-lang.org/dist/%{bootstrap_date}/rust-%{bootstrap_rust}-aarch64-unknown-linux-gnu.tar.xz
+# Source4-md5: 3a9d54ab96f96664b2f6077cccb4e70b
+Patch0: %{name}-no-miri.patch
+Patch1: %{name}-x32.patch
URL: https://www.rust-lang.org/
# for src/compiler-rt
BuildRequires: cmake >= 3.4.3
BuildRequires: curl
-BuildRequires: libstdc++-devel
-%{?with_system_llvm:BuildRequires: llvm-devel}
-BuildRequires: ncurses-devel
+# make check needs "ps" for src/test/run-pass/wait-forked-but-failed-child.rs
+BuildRequires: procps
BuildRequires: python >= 1:2.7
+BuildRequires: rpmbuild(macros) >= 1.752
+%if %{without cross}
+BuildRequires: libstdc++-devel
+%{?with_system_llvm:BuildRequires: llvm-devel >= 7.0}
+BuildRequires: openssl-devel >= 1.0.1
BuildRequires: zlib-devel
+%endif
%if %{without bootstrap}
BuildRequires: %{name} >= %{bootstrap_rust}
BuildRequires: cargo >= %{bootstrap_cargo}
BuildConflicts: %{name} > %{version}
%endif
-# make check needs "ps" for src/test/run-pass/wait-forked-but-failed-child.rs
-BuildRequires: procps
+%ifarch x32
+BuildRequires: glibc-devel(x32)
+BuildRequires: glibc-devel(x86_64)
+%if "%{_host_cpu}" == "x86_64"
+# building on x86_64 host with --target x32-pld-linux
+BuildRequires: gcc-multilib-x32
+BuildRequires: libstdc++-devel
+%{?with_system_llvm:BuildRequires: llvm-devel >= 7.0}
+BuildRequires: openssl-devel >= 1.0.1
+BuildRequires: zlib-devel
+%else
+# building x86_64-hosted crosscompiler on x32 host
+BuildRequires: gcc-multilib-64
+BuildRequires: libstdc++-multilib-64-devel
+# how to specify?
+#BuildRequires: llvm-devel.x86_64 >= 7.0
+#BuildRequires: openssl-devel.x86_64
+#BuildRequires: zlib-devel.x86_64
+%endif
+%endif
# The C compiler is needed at runtime just for linking. Someday rustc might
# invoke the linker directly, and then we'll only need binutils.
# https://github.com/rust-lang/rust/issues/11937
Requires: gcc
# Only x86_64 and i686 are Tier 1 platforms at this time.
# x32 is Tier 2, only rust-std is available (no rustc or cargo).
-# https://doc.rust-lang.org/stable/book/getting-started.html#tier-1
-ExclusiveArch: %{x8664} %{ix86} x32
+# https://doc.rust-lang.org/nightly/rustc/platform-support.html
+ExclusiveArch: %{x8664} %{ix86} x32 aarch64
BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
%ifarch x32
%define rust_triple x86_64-unknown-linux-gnux32
+%define rust_host_triple x86_64-unknown-linux-gnu
%define rust_bootstrap_triple x86_64-unknown-linux-gnu
%else
%define rust_triple %{_target_cpu}-unknown-linux-gnu
-%define rust_bootstrap_triple %{_target_cpu}-unknown-linux-gnu
+%define rust_host_triple %{rust_triple}
+%define rust_bootstrap_triple %{rust_triple}
%endif
%if %{without bootstrap}
%define _noautoreqfiles lib.*-[[:xdigit:]]{8}[.]so.*
%define _noautoprovfiles lib.*-[[:xdigit:]]{8}[.]so.*
+%define x_py { \
+ x_py() { \
+ local cmd="$1"; \
+ shift; \
+ %{?__jobs:CARGO_BUILD_JOBS=%__jobs }./x.py "$cmd" %{?__jobs:-j %__jobs} "$@"; \
+ }; x_py }
+
+
%description
Rust is a systems programming language that runs blazingly fast,
prevents segfaults, and guarantees thread safety.
Summary: Common debugger pretty printers for Rust
Summary(pl.UTF-8): Narzędzia wypisujące struktury Rusa wspólne dla różnych debuggerów
Group: Development/Debuggers
-BuildArch: noarch
+%{?noarchpackage}
%description debugger-common
This package includes the common functionality for rust-gdb and
Group: Development/Debuggers
Requires: %{name}-debugger-common = %{version}-%{release}
Requires: gdb
-BuildArch: noarch
+%{?noarchpackage}
%description gdb
This package includes the rust-gdb script, which allows easier
Group: Development/Debuggers
Requires: %{name}-debugger-common = %{version}-%{release}
Requires: lldb
-BuildArch: noarch
+%{?noarchpackage}
%description lldb
This package includes the rust-lldb script, which allows easier
Summary: Documentation for Rust
Summary(pl.UTF-8): Dokumentacja do Rusta
Group: Documentation
-BuildArch: noarch
+%{?noarchpackage}
%description doc
This package includes HTML documentation for the Rust programming
%prep
%setup -q -n %{rustc_package}
+%patch0 -p1
+# irrelevant when not building rustc for x32
+#patch1 -p1
%if %{with bootstrap}
-%ifarch %{x8664}
+%ifarch %{x8664} x32
tar xf %{SOURCE1}
%endif
%ifarch %{ix86}
tar xf %{SOURCE2}
%endif
%ifarch x32
-tar xf %{SOURCE1}
cd %{bootstrap_root}
tar xf %{SOURCE3}
%{__mv} rust-std-%{bootstrap_rust}-%{rust_triple} rust-std-%{rust_triple}
cd ..
%endif
+%ifarch aarch64
+tar xf %{SOURCE4}
+%endif
%{__mv} %{bootstrap_root} %{bootstrap_root}-root
%{bootstrap_root}-root/install.sh \
--components=cargo,rustc,rust-std-%{rust_bootstrap_triple} \
%build
%configure \
- --build=%{rust_triple} \
- --host=%{rust_triple} \
+ --build=%{rust_bootstrap_triple} \
+ --host=%{rust_host_triple} \
--target=%{rust_triple} \
--libdir=%{common_libdir} \
--disable-codegen-tests \
--llvm-root=%{_prefix} \
--release-channel=%{channel}
-RUST_BACKTRACE=full \
-./x.py dist --verbose
+export RUST_BACKTRACE=full
+%x_py dist --verbose
-%{?with_tests:./x.py test}
+%{?with_tests:%x_py test}
%install
rm -rf $RPM_BUILD_ROOT
-DESTDIR=$RPM_BUILD_ROOT ./x.py install
-DESTDIR=$RPM_BUILD_ROOT ./x.py install src
+export DESTDIR=$RPM_BUILD_ROOT
+%x_py install
+%x_py install src
# Make sure the shared libraries are in the proper libdir
%if "%{_libdir}" != "%{common_libdir}"
%files
%defattr(644,root,root,755)
%doc COPYRIGHT LICENSE-APACHE LICENSE-MIT README.md vendor/backtrace-sys/src/libbacktrace/LICENSE-libbacktrace
-%attr(755,root,root) %{_bindir}/miri
%attr(755,root,root) %{_bindir}/rls
%attr(755,root,root) %{_bindir}/rustc
%attr(755,root,root) %{_bindir}/rustdoc
%dir %{rustlibdir}
%dir %{rustlibdir}/%{rust_triple}
%{rustlibdir}/%{rust_triple}/analysis
-%dir %{rustlibdir}/%{rust_triple}/codegen-backends
-%attr(755,root,root) %{rustlibdir}/%{rust_triple}/codegen-backends/*.so
%dir %{rustlibdir}/%{rust_triple}/lib
%attr(755,root,root) %{rustlibdir}/%{rust_triple}/lib/*.so
%{rustlibdir}/%{rust_triple}/lib/*.rlib
+# for cross-compiler (e.g. x86_64-hosted x32 rust)
+%if "%{rust_host_triple}" != "%{rust_triple}"
+%dir %{rustlibdir}/%{rust_host_triple}
+%{rustlibdir}/%{rust_host_triple}/analysis
+%dir %{rustlibdir}/%{rust_host_triple}/lib
+%attr(755,root,root) %{rustlibdir}/%{rust_host_triple}/lib/*.so
+%{rustlibdir}/%{rust_host_triple}/lib/*.rlib
+%endif
+
%files debugger-common
%defattr(644,root,root,755)
%dir %{_datadir}/%{name}
%attr(755,root,root) %{_bindir}/cargo
%attr(755,root,root) %{_bindir}/cargo-clippy
%attr(755,root,root) %{_bindir}/cargo-fmt
-%attr(755,root,root) %{_bindir}/cargo-miri
%attr(755,root,root) %{_bindir}/clippy-driver
%{_mandir}/man1/cargo*.1*
%dir %{_datadir}/cargo