[packages/rust] - added no-miri patch (disable miri by default in stable builds) - adjusted to allow building x86_64
qboosh
qboosh at pld-linux.org
Sun Oct 4 13:37:05 CEST 2020
commit 2eb301494237f5656f8ea438272a7bfd7887dc44
Author: Jakub Bogusz <qboosh at pld-linux.org>
Date: Sun Oct 4 13:40:07 2020 +0200
- added no-miri patch (disable miri by default in stable builds)
- adjusted to allow building x86_64-hosted x32-targeted rustc
rust-no-miri.patch | 23 ++++++++++---------
rust.spec | 66 ++++++++++++++++++++++++++++++++++++++++--------------
2 files changed, 61 insertions(+), 28 deletions(-)
---
diff --git a/rust.spec b/rust.spec
index 60937c2..46ac278 100644
--- a/rust.spec
+++ b/rust.spec
@@ -7,8 +7,6 @@
%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
@@ -28,8 +26,7 @@
%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
@@ -49,23 +46,47 @@ Source3: https://static.rust-lang.org/dist/%{bootstrap_date}/rust-std-%{bootstra
# 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}-x32.patch
+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
+# 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: python >= 1:2.7
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
@@ -78,10 +99,12 @@ 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}
@@ -129,7 +152,7 @@ bezpieczną wielowątkowość.
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
@@ -144,7 +167,7 @@ Summary(pl.UTF-8): Ładne wypisywanie struktur Rusta w GDB
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
@@ -160,7 +183,7 @@ Summary(pl.UTF-8): Ładne wypisywanie struktur Rusta w LLDB
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
@@ -174,7 +197,7 @@ odpluskwianie programów w języku Rust.
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
@@ -227,6 +250,8 @@ Dopełnianie parametrów polecenia cargo w powłoce Zsh.
%prep
%setup -q -n %{rustc_package}
%patch0 -p1
+# irrelevant when not building rustc for x32
+#patch1 -p1
%if %{with bootstrap}
%ifarch %{x8664} x32
@@ -236,7 +261,6 @@ tar xf %{SOURCE1}
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}
@@ -280,10 +304,9 @@ find vendor -name .cargo-checksum.json \
-exec sed -i.uncheck -e 's/"files":{[^}]*}/"files":{ }/' '{}' '+'
%build
-export PKG_CONFIG_ALLOW_CROSS=1
%configure \
- --build=%{rust_triple} \
- --host=%{rust_triple} \
+ --build=%{rust_bootstrap_triple} \
+ --host=%{rust_host_triple} \
--target=%{rust_triple} \
--libdir=%{common_libdir} \
--disable-codegen-tests \
@@ -385,6 +408,15 @@ rm -rf $RPM_BUILD_ROOT
%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}
diff --git a/rust-no-miri.patch b/rust-no-miri.patch
index 3e3619c..ad90523 100644
--- a/rust-no-miri.patch
+++ b/rust-no-miri.patch
@@ -1,3 +1,4 @@
+(rebased to 1.44.1)
From 416b010f4087d055febe2d55919f74e261ca8cd6 Mon Sep 17 00:00:00 2001
From: Ralf Jung <post at ralfj.de>
Date: Thu, 11 Jun 2020 09:25:06 +0200
@@ -25,7 +26,7 @@ diff --git a/src/bootstrap/tool.rs b/src/bootstrap/tool.rs
index 6cd9f9029c948..9c95de0a81eae 100644
--- a/src/bootstrap/tool.rs
+++ b/src/bootstrap/tool.rs
-@@ -595,6 +595,7 @@ macro_rules! tool_extended {
+@@ -591,6 +591,7 @@ macro_rules! tool_extended {
$toolstate:ident,
$path:expr,
$tool_name:expr,
@@ -33,7 +34,7 @@ index 6cd9f9029c948..9c95de0a81eae 100644
$extra_deps:block;)+) => {
$(
#[derive(Debug, Clone, Hash, PartialEq, Eq)]
-@@ -606,17 +607,22 @@ macro_rules! tool_extended {
+@@ -602,17 +603,22 @@ macro_rules! tool_extended {
impl Step for $name {
type Output = Option<PathBuf>;
@@ -61,28 +62,28 @@ index 6cd9f9029c948..9c95de0a81eae 100644
})
}),
)
-@@ -652,12 +658,12 @@ macro_rules! tool_extended {
- // Note: tools need to be also added to `Builder::get_step_descriptions` in `build.rs`
- // to make `./x.py build <tool>` work.
+@@ -646,12 +652,12 @@ macro_rules! tool_extended {
+ }
+
tool_extended!((self, builder),
- Cargofmt, rustfmt, "src/tools/rustfmt", "cargo-fmt", {};
- CargoClippy, clippy, "src/tools/clippy", "cargo-clippy", {};
- Clippy, clippy, "src/tools/clippy", "clippy-driver", {};
- Miri, miri, "src/tools/miri", "miri", {};
-- CargoMiri, miri, "src/tools/miri/cargo-miri", "cargo-miri", {};
+- CargoMiri, miri, "src/tools/miri", "cargo-miri", {};
- Rls, rls, "src/tools/rls", "rls", {
+ Cargofmt, rustfmt, "src/tools/rustfmt", "cargo-fmt", stable=true, {};
+ CargoClippy, clippy, "src/tools/clippy", "cargo-clippy", stable=true, {};
+ Clippy, clippy, "src/tools/clippy", "clippy-driver", stable=true, {};
+ Miri, miri, "src/tools/miri", "miri", stable=false, {};
-+ CargoMiri, miri, "src/tools/miri/cargo-miri", "cargo-miri", stable=false, {};
++ CargoMiri, miri, "src/tools/miri", "cargo-miri", stable=false, {};
+ Rls, rls, "src/tools/rls", "rls", stable=true, {
- builder.ensure(Clippy {
+ let clippy = builder.ensure(Clippy {
compiler: self.compiler,
target: self.target,
-@@ -665,7 +671,7 @@ tool_extended!((self, builder),
- });
- self.extra_features.push("clippy".to_owned());
+@@ -661,7 +667,7 @@ tool_extended!((self, builder),
+ self.extra_features.push("clippy".to_owned());
+ }
};
- Rustfmt, rustfmt, "src/tools/rustfmt", "rustfmt", {};
+ Rustfmt, rustfmt, "src/tools/rustfmt", "rustfmt", stable=true, {};
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/packages/rust.git/commitdiff/2eb301494237f5656f8ea438272a7bfd7887dc44
More information about the pld-cvs-commit
mailing list