Skip to content

Commit 2eb3014

Browse files
committed
- added no-miri patch (disable miri by default in stable builds)
- adjusted to allow building x86_64-hosted x32-targeted rustc
1 parent 91aaab5 commit 2eb3014

File tree

2 files changed

+61
-28
lines changed

2 files changed

+61
-28
lines changed

rust-no-miri.patch

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
(rebased to 1.44.1)
12
From 416b010f4087d055febe2d55919f74e261ca8cd6 Mon Sep 17 00:00:00 2001
23
From: Ralf Jung <[email protected]>
34
Date: Thu, 11 Jun 2020 09:25:06 +0200
@@ -25,15 +26,15 @@ diff --git a/src/bootstrap/tool.rs b/src/bootstrap/tool.rs
2526
index 6cd9f9029c948..9c95de0a81eae 100644
2627
--- a/src/bootstrap/tool.rs
2728
+++ b/src/bootstrap/tool.rs
28-
@@ -595,6 +595,7 @@ macro_rules! tool_extended {
29+
@@ -591,6 +591,7 @@ macro_rules! tool_extended {
2930
$toolstate:ident,
3031
$path:expr,
3132
$tool_name:expr,
3233
+ stable = $stable:expr,
3334
$extra_deps:block;)+) => {
3435
$(
3536
#[derive(Debug, Clone, Hash, PartialEq, Eq)]
36-
@@ -606,17 +607,22 @@ macro_rules! tool_extended {
37+
@@ -602,17 +603,22 @@ macro_rules! tool_extended {
3738

3839
impl Step for $name {
3940
type Output = Option<PathBuf>;
@@ -61,28 +62,28 @@ index 6cd9f9029c948..9c95de0a81eae 100644
6162
})
6263
}),
6364
)
64-
@@ -652,12 +658,12 @@ macro_rules! tool_extended {
65-
// Note: tools need to be also added to `Builder::get_step_descriptions` in `build.rs`
66-
// to make `./x.py build <tool>` work.
65+
@@ -646,12 +652,12 @@ macro_rules! tool_extended {
66+
}
67+
6768
tool_extended!((self, builder),
6869
- Cargofmt, rustfmt, "src/tools/rustfmt", "cargo-fmt", {};
6970
- CargoClippy, clippy, "src/tools/clippy", "cargo-clippy", {};
7071
- Clippy, clippy, "src/tools/clippy", "clippy-driver", {};
7172
- Miri, miri, "src/tools/miri", "miri", {};
72-
- CargoMiri, miri, "src/tools/miri/cargo-miri", "cargo-miri", {};
73+
- CargoMiri, miri, "src/tools/miri", "cargo-miri", {};
7374
- Rls, rls, "src/tools/rls", "rls", {
7475
+ Cargofmt, rustfmt, "src/tools/rustfmt", "cargo-fmt", stable=true, {};
7576
+ CargoClippy, clippy, "src/tools/clippy", "cargo-clippy", stable=true, {};
7677
+ Clippy, clippy, "src/tools/clippy", "clippy-driver", stable=true, {};
7778
+ Miri, miri, "src/tools/miri", "miri", stable=false, {};
78-
+ CargoMiri, miri, "src/tools/miri/cargo-miri", "cargo-miri", stable=false, {};
79+
+ CargoMiri, miri, "src/tools/miri", "cargo-miri", stable=false, {};
7980
+ Rls, rls, "src/tools/rls", "rls", stable=true, {
80-
builder.ensure(Clippy {
81+
let clippy = builder.ensure(Clippy {
8182
compiler: self.compiler,
8283
target: self.target,
83-
@@ -665,7 +671,7 @@ tool_extended!((self, builder),
84-
});
85-
self.extra_features.push("clippy".to_owned());
84+
@@ -661,7 +667,7 @@ tool_extended!((self, builder),
85+
self.extra_features.push("clippy".to_owned());
86+
}
8687
};
8788
- Rustfmt, rustfmt, "src/tools/rustfmt", "rustfmt", {};
8889
+ Rustfmt, rustfmt, "src/tools/rustfmt", "rustfmt", stable=true, {};

rust.spec

Lines changed: 49 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77
%bcond_with bootstrap # bootstrap using precompiled binaries
88
%bcond_with full_debuginfo # full debuginfo vs only std debuginfo (full takes gigabytes of memory to build)
99
%bcond_without system_llvm # system LLVM
10-
%bcond_without rustc # rustc building
11-
%bcond_without cargo # cargo building
1210
%bcond_with tests # build without tests
1311

1412
# The channel can be stable, beta, or nightly
@@ -28,8 +26,7 @@
2826
%define bootstrap_date 2020-05-07
2927

3028
%ifarch x32
31-
%undefine with_cargo
32-
%undefine with_rustc
29+
%define with_cross 1
3330
%endif
3431
Summary: The Rust Programming Language
3532
Summary(pl.UTF-8): Język programowania Rust
@@ -49,23 +46,47 @@ Source3: https://static.rust-lang.org/dist/%{bootstrap_date}/rust-std-%{bootstra
4946
# Source3-md5: 4b07c6922a0965791cf8eb28fee9e89d
5047
Source4: https://static.rust-lang.org/dist/%{bootstrap_date}/rust-%{bootstrap_rust}-aarch64-unknown-linux-gnu.tar.xz
5148
# Source4-md5: 3a9d54ab96f96664b2f6077cccb4e70b
52-
Patch0: %{name}-x32.patch
49+
Patch0: %{name}-no-miri.patch
50+
Patch1: %{name}-x32.patch
5351
URL: https://www.rust-lang.org/
5452
# for src/compiler-rt
5553
BuildRequires: cmake >= 3.4.3
5654
BuildRequires: curl
55+
# make check needs "ps" for src/test/run-pass/wait-forked-but-failed-child.rs
56+
BuildRequires: procps
57+
BuildRequires: python >= 1:2.7
58+
BuildRequires: rpmbuild(macros) >= 1.752
59+
%if %{without cross}
5760
BuildRequires: libstdc++-devel
5861
%{?with_system_llvm:BuildRequires: llvm-devel >= 7.0}
5962
BuildRequires: openssl-devel >= 1.0.1
60-
BuildRequires: python >= 1:2.7
6163
BuildRequires: zlib-devel
64+
%endif
6265
%if %{without bootstrap}
6366
BuildRequires: %{name} >= %{bootstrap_rust}
6467
BuildRequires: cargo >= %{bootstrap_cargo}
6568
BuildConflicts: %{name} > %{version}
6669
%endif
67-
# make check needs "ps" for src/test/run-pass/wait-forked-but-failed-child.rs
68-
BuildRequires: procps
70+
%ifarch x32
71+
BuildRequires: glibc-devel(x32)
72+
BuildRequires: glibc-devel(x86_64)
73+
%if "%{_host_cpu}" == "x86_64"
74+
# building on x86_64 host with --target x32-pld-linux
75+
BuildRequires: gcc-multilib-x32
76+
BuildRequires: libstdc++-devel
77+
%{?with_system_llvm:BuildRequires: llvm-devel >= 7.0}
78+
BuildRequires: openssl-devel >= 1.0.1
79+
BuildRequires: zlib-devel
80+
%else
81+
# building x86_64-hosted crosscompiler on x32 host
82+
BuildRequires: gcc-multilib-64
83+
BuildRequires: libstdc++-multilib-64-devel
84+
# how to specify?
85+
#BuildRequires: llvm-devel.x86_64 >= 7.0
86+
#BuildRequires: openssl-devel.x86_64
87+
#BuildRequires: zlib-devel.x86_64
88+
%endif
89+
%endif
6990
# The C compiler is needed at runtime just for linking. Someday rustc might
7091
# invoke the linker directly, and then we'll only need binutils.
7192
# https://github.com/rust-lang/rust/issues/11937
@@ -78,10 +99,12 @@ BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
7899

79100
%ifarch x32
80101
%define rust_triple x86_64-unknown-linux-gnux32
102+
%define rust_host_triple x86_64-unknown-linux-gnu
81103
%define rust_bootstrap_triple x86_64-unknown-linux-gnu
82104
%else
83105
%define rust_triple %{_target_cpu}-unknown-linux-gnu
84-
%define rust_bootstrap_triple %{_target_cpu}-unknown-linux-gnu
106+
%define rust_host_triple %{rust_triple}
107+
%define rust_bootstrap_triple %{rust_triple}
85108
%endif
86109

87110
%if %{without bootstrap}
@@ -129,7 +152,7 @@ bezpieczną wielowątkowość.
129152
Summary: Common debugger pretty printers for Rust
130153
Summary(pl.UTF-8): Narzędzia wypisujące struktury Rusa wspólne dla różnych debuggerów
131154
Group: Development/Debuggers
132-
BuildArch: noarch
155+
%{?noarchpackage}
133156

134157
%description debugger-common
135158
This package includes the common functionality for rust-gdb and
@@ -144,7 +167,7 @@ Summary(pl.UTF-8): Ładne wypisywanie struktur Rusta w GDB
144167
Group: Development/Debuggers
145168
Requires: %{name}-debugger-common = %{version}-%{release}
146169
Requires: gdb
147-
BuildArch: noarch
170+
%{?noarchpackage}
148171

149172
%description gdb
150173
This package includes the rust-gdb script, which allows easier
@@ -160,7 +183,7 @@ Summary(pl.UTF-8): Ładne wypisywanie struktur Rusta w LLDB
160183
Group: Development/Debuggers
161184
Requires: %{name}-debugger-common = %{version}-%{release}
162185
Requires: lldb
163-
BuildArch: noarch
186+
%{?noarchpackage}
164187

165188
%description lldb
166189
This package includes the rust-lldb script, which allows easier
@@ -174,7 +197,7 @@ odpluskwianie programów w języku Rust.
174197
Summary: Documentation for Rust
175198
Summary(pl.UTF-8): Dokumentacja do Rusta
176199
Group: Documentation
177-
BuildArch: noarch
200+
%{?noarchpackage}
178201

179202
%description doc
180203
This package includes HTML documentation for the Rust programming
@@ -227,6 +250,8 @@ Dopełnianie parametrów polecenia cargo w powłoce Zsh.
227250
%prep
228251
%setup -q -n %{rustc_package}
229252
%patch0 -p1
253+
# irrelevant when not building rustc for x32
254+
#patch1 -p1
230255

231256
%if %{with bootstrap}
232257
%ifarch %{x8664} x32
@@ -236,7 +261,6 @@ tar xf %{SOURCE1}
236261
tar xf %{SOURCE2}
237262
%endif
238263
%ifarch x32
239-
tar xf %{SOURCE1}
240264
cd %{bootstrap_root}
241265
tar xf %{SOURCE3}
242266
%{__mv} rust-std-%{bootstrap_rust}-%{rust_triple} rust-std-%{rust_triple}
@@ -280,10 +304,9 @@ find vendor -name .cargo-checksum.json \
280304
-exec sed -i.uncheck -e 's/"files":{[^}]*}/"files":{ }/' '{}' '+'
281305

282306
%build
283-
export PKG_CONFIG_ALLOW_CROSS=1
284307
%configure \
285-
--build=%{rust_triple} \
286-
--host=%{rust_triple} \
308+
--build=%{rust_bootstrap_triple} \
309+
--host=%{rust_host_triple} \
287310
--target=%{rust_triple} \
288311
--libdir=%{common_libdir} \
289312
--disable-codegen-tests \
@@ -385,6 +408,15 @@ rm -rf $RPM_BUILD_ROOT
385408
%attr(755,root,root) %{rustlibdir}/%{rust_triple}/lib/*.so
386409
%{rustlibdir}/%{rust_triple}/lib/*.rlib
387410

411+
# for cross-compiler (e.g. x86_64-hosted x32 rust)
412+
%if "%{rust_host_triple}" != "%{rust_triple}"
413+
%dir %{rustlibdir}/%{rust_host_triple}
414+
%{rustlibdir}/%{rust_host_triple}/analysis
415+
%dir %{rustlibdir}/%{rust_host_triple}/lib
416+
%attr(755,root,root) %{rustlibdir}/%{rust_host_triple}/lib/*.so
417+
%{rustlibdir}/%{rust_host_triple}/lib/*.rlib
418+
%endif
419+
388420
%files debugger-common
389421
%defattr(644,root,root,755)
390422
%dir %{_datadir}/%{name}

0 commit comments

Comments
 (0)