]> git.pld-linux.org Git - packages/rust.git/blame_incremental - rust.spec
- patch to disable miri build by default (nightly only tool, not meant for stable)
[packages/rust.git] / rust.spec
... / ...
CommitLineData
1# TODO
2# - consider a rust-std package containing .../rustlib/$target
3# This might allow multilib cross-compilation to work naturally.
4# - package additional tools
5#
6# Conditional build:
7%bcond_with bootstrap # bootstrap using precompiled binaries
8%bcond_with full_debuginfo # full debuginfo vs only std debuginfo (full takes gigabytes of memory to build)
9%bcond_without system_llvm # system LLVM
10%bcond_without rustc # rustc building
11%bcond_without cargo # cargo building
12%bcond_with tests # build without tests
13
14# The channel can be stable, beta, or nightly
15%define channel stable
16
17%if "%{channel}" == "stable"
18%define rustc_package rustc-%{version}-src
19%else
20%define rustc_package rustc-%{channel}-src
21%endif
22
23# To bootstrap from scratch, set the channel and date from src/stage0.txt
24# e.g. 1.10.0 wants rustc: 1.9.0-2016-05-24
25# or nightly wants some beta-YYYY-MM-DD
26%define bootstrap_rust 1.43.1
27%define bootstrap_cargo 1.43.1
28%define bootstrap_date 2020-05-07
29
30%ifarch x32
31%undefine with_cargo
32%undefine with_rustc
33%endif
34Summary: The Rust Programming Language
35Summary(pl.UTF-8): Język programowania Rust
36Name: rust
37Version: 1.44.1
38Release: 1
39# Licenses: (rust itself) and (bundled libraries)
40License: (Apache v2.0 or MIT) and (BSD and ISC and MIT)
41Group: Development/Languages
42Source0: https://static.rust-lang.org/dist/%{rustc_package}.tar.xz
43# Source0-md5: 0cc3b079ddb1eb9a17f9e7e52efcebc5
44Source1: https://static.rust-lang.org/dist/%{bootstrap_date}/rust-%{bootstrap_rust}-x86_64-unknown-linux-gnu.tar.xz
45# Source1-md5: 62b0974a4bad5aeabd50c7a7fa74518c
46Source2: https://static.rust-lang.org/dist/%{bootstrap_date}/rust-%{bootstrap_rust}-i686-unknown-linux-gnu.tar.xz
47# Source2-md5: 758d55172c8dddb1ec71913b5f532bb2
48Source3: https://static.rust-lang.org/dist/%{bootstrap_date}/rust-std-%{bootstrap_rust}-x86_64-unknown-linux-gnux32.tar.xz
49# Source3-md5: 4b07c6922a0965791cf8eb28fee9e89d
50Source4: https://static.rust-lang.org/dist/%{bootstrap_date}/rust-%{bootstrap_rust}-aarch64-unknown-linux-gnu.tar.xz
51# Source4-md5: 3a9d54ab96f96664b2f6077cccb4e70b
52Patch0: %{name}-x32.patch
53URL: https://www.rust-lang.org/
54# for src/compiler-rt
55BuildRequires: cmake >= 3.4.3
56BuildRequires: curl
57BuildRequires: libstdc++-devel
58%{?with_system_llvm:BuildRequires: llvm-devel >= 7.0}
59BuildRequires: openssl-devel >= 1.0.1
60BuildRequires: python >= 1:2.7
61BuildRequires: zlib-devel
62%if %{without bootstrap}
63BuildRequires: %{name} >= %{bootstrap_rust}
64BuildRequires: cargo >= %{bootstrap_cargo}
65BuildConflicts: %{name} > %{version}
66%endif
67# make check needs "ps" for src/test/run-pass/wait-forked-but-failed-child.rs
68BuildRequires: procps
69# The C compiler is needed at runtime just for linking. Someday rustc might
70# invoke the linker directly, and then we'll only need binutils.
71# https://github.com/rust-lang/rust/issues/11937
72Requires: gcc
73# Only x86_64 and i686 are Tier 1 platforms at this time.
74# x32 is Tier 2, only rust-std is available (no rustc or cargo).
75# https://doc.rust-lang.org/nightly/rustc/platform-support.html
76ExclusiveArch: %{x8664} %{ix86} x32 aarch64
77BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
78
79%ifarch x32
80%define rust_triple x86_64-unknown-linux-gnux32
81%define rust_bootstrap_triple x86_64-unknown-linux-gnu
82%else
83%define rust_triple %{_target_cpu}-unknown-linux-gnu
84%define rust_bootstrap_triple %{_target_cpu}-unknown-linux-gnu
85%endif
86
87%if %{without bootstrap}
88%define local_rust_root %{_prefix}
89%else
90%define bootstrap_root rust-%{bootstrap_rust}-%{rust_bootstrap_triple}
91%define local_rust_root %{_builddir}/%{rustc_package}/%{bootstrap_root}
92%endif
93
94# We're going to override --libdir when configuring to get rustlib into a
95# common path, but we'll fix the shared libraries during install.
96# Without this ugly hack, rust would not be able to build itself
97# for non-bootstrap build, lib64 is just too complicated for it.
98%define common_libdir %{_prefix}/lib
99%define rustlibdir %{common_libdir}/rustlib
100
101# once_call/once_callable non-function libstdc++ symbols
102%define skip_post_check_so 'librustc.*llvm.*\.so.*'
103
104# ALL Rust libraries are private, because they don't keep an ABI.
105%define _noautoreqfiles lib.*-[[:xdigit:]]{8}[.]so.*
106%define _noautoprovfiles lib.*-[[:xdigit:]]{8}[.]so.*
107
108%define x_py { \
109 x_py() { \
110 local cmd="$1"; \
111 shift; \
112 %{?__jobs:CARGO_BUILD_JOBS=%__jobs }./x.py "$cmd" %{?__jobs:-j %__jobs} "$@"; \
113 }; x_py }
114
115
116%description
117Rust is a systems programming language that runs blazingly fast,
118prevents segfaults, and guarantees thread safety.
119
120This package includes the Rust compiler, standard library, and
121documentation generator.
122
123%description -l pl.UTF-8
124Rust to systemowy język programowania działający bardzo szybko,
125zapobiegający naruszeniom ochrony pamięci i gwarantujący
126bezpieczną wielowątkowość.
127
128%package debugger-common
129Summary: Common debugger pretty printers for Rust
130Summary(pl.UTF-8): Narzędzia wypisujące struktury Rusa wspólne dla różnych debuggerów
131Group: Development/Debuggers
132BuildArch: noarch
133
134%description debugger-common
135This package includes the common functionality for rust-gdb and
136rust-lldb.
137
138%description debugger-common -l pl.UTF-8
139Ten pakiet zawiera wspólny kod dla pakietów rust-gdb i rust-lldb.
140
141%package gdb
142Summary: GDB pretty printers for Rust
143Summary(pl.UTF-8): Ładne wypisywanie struktur Rusta w GDB
144Group: Development/Debuggers
145Requires: %{name}-debugger-common = %{version}-%{release}
146Requires: gdb
147BuildArch: noarch
148
149%description gdb
150This package includes the rust-gdb script, which allows easier
151debugging of Rust programs.
152
153%description gdb -l pl.UTF-8
154Ten pakiet zawiera skrypt rust-gdb, pozwalający na łatwiejsze
155odpluskwianie programów w języku Rust.
156
157%package lldb
158Summary: LLDB pretty printers for Rust
159Summary(pl.UTF-8): Ładne wypisywanie struktur Rusta w LLDB
160Group: Development/Debuggers
161Requires: %{name}-debugger-common = %{version}-%{release}
162Requires: lldb
163BuildArch: noarch
164
165%description lldb
166This package includes the rust-lldb script, which allows easier
167debugging of Rust programs.
168
169%description lldb -l pl.UTF-8
170Ten pakiet zawiera skrypt rust-lldb, pozwalający na łatwiejsze
171odpluskwianie programów w języku Rust.
172
173%package doc
174Summary: Documentation for Rust
175Summary(pl.UTF-8): Dokumentacja do Rusta
176Group: Documentation
177BuildArch: noarch
178
179%description doc
180This package includes HTML documentation for the Rust programming
181language and its standard library.
182
183%description doc -l pl.UTF-8
184Ten pakiet zawiera dokumentację w formacie HTML do języka
185programowania Rust i jego biblioteki standardowej.
186
187%package -n cargo
188Summary: Rust's package manager and build tool
189Summary(pl.UTF-8): Zarządca pakietów i narzędzie do budowania
190Group: Development/Tools
191Requires: %{name}
192
193%description -n cargo
194Cargo is a tool that allows Rust projects to declare their various
195dependencies and ensure that you'll always get a repeatable build.
196
197%description -n cargo -l pl.UTF-8
198Cargo to narzędzie pozwalające projektom w języku Rust deklarować ich
199zależności i zapewniające powtarzalność procesu budowania.
200
201%package -n bash-completion-cargo
202Summary: Bash completion for cargo command
203Summary(pl.UTF-8): Bashowe dopełnianie parametrów polecenia cargo
204Group: Applications/Shells
205Requires: %{name} = %{version}-%{release}
206Requires: bash-completion
207
208%description -n bash-completion-cargo
209Bash completion for cargo command.
210
211%description -n bash-completion-cargo -l pl.UTF-8
212Bashowe dopełnianie parametrów polecenia cargo.
213
214%package -n zsh-completion-cargo
215Summary: Zsh completion for cargo command
216Summary(pl.UTF-8): Dopełnianie parametrów polecenia cargo w powłoce Zsh
217Group: Applications/Shells
218Requires: %{name} = %{version}-%{release}
219Requires: zsh
220
221%description -n zsh-completion-cargo
222Zsh completion for cargo command.
223
224%description -n zsh-completion-cargo -l pl.UTF-8
225Dopełnianie parametrów polecenia cargo w powłoce Zsh.
226
227%prep
228%setup -q -n %{rustc_package}
229%patch0 -p1
230
231%if %{with bootstrap}
232%ifarch %{x8664} x32
233tar xf %{SOURCE1}
234%endif
235%ifarch %{ix86}
236tar xf %{SOURCE2}
237%endif
238%ifarch x32
239tar xf %{SOURCE1}
240cd %{bootstrap_root}
241tar xf %{SOURCE3}
242%{__mv} rust-std-%{bootstrap_rust}-%{rust_triple} rust-std-%{rust_triple}
243cd ..
244%endif
245%ifarch aarch64
246tar xf %{SOURCE4}
247%endif
248%{__mv} %{bootstrap_root} %{bootstrap_root}-root
249%{bootstrap_root}-root/install.sh \
250 --components=cargo,rustc,rust-std-%{rust_bootstrap_triple} \
251 --prefix=%{local_rust_root} \
252 --disable-ldconfig
253test -f %{local_rust_root}/bin/cargo
254test -f %{local_rust_root}/bin/rustc
255%ifarch x32
256%{bootstrap_root}-root/rust-std-%{rust_triple}/install.sh \
257 --components=rust-std-%{rust_triple} \
258 --prefix=%{local_rust_root} \
259 --disable-ldconfig
260%endif
261%endif
262
263# unbundle
264# We're disabling jemalloc, but rust-src still wants it.
265#%{__rm} -r src/jemalloc
266%{?with_system_llvm:%{__rm} -r src/llvm-project}
267
268# extract bundled licenses for packaging
269sed -e '/*\//q' vendor/backtrace-sys/src/libbacktrace/backtrace.h \
270 >vendor/backtrace-sys/src/libbacktrace/LICENSE-libbacktrace
271
272# rust-gdb has hardcoded SYSROOT/lib -- let's make it noarch
273sed -i -e 's#DIRECTORY=".*"#DIRECTORY="%{_datadir}/%{name}/etc"#' \
274 src/etc/rust-gdb
275
276# The configure macro will modify some autoconf-related files, which upsets
277# cargo when it tries to verify checksums in those files. If we just truncate
278# that file list, cargo won't have anything to complain about.
279find vendor -name .cargo-checksum.json \
280 -exec sed -i.uncheck -e 's/"files":{[^}]*}/"files":{ }/' '{}' '+'
281
282%build
283export PKG_CONFIG_ALLOW_CROSS=1
284%configure \
285 --build=%{rust_triple} \
286 --host=%{rust_triple} \
287 --target=%{rust_triple} \
288 --libdir=%{common_libdir} \
289 --disable-codegen-tests \
290 --disable-debuginfo-lines \
291%if %{with full_debuginfo}
292 --disable-debuginfo-only-std \
293 --enable-debuginfo \
294%else
295 --enable-debuginfo-only-std \
296 --disable-debuginfo \
297%endif
298 --disable-jemalloc \
299 --disable-option-checking \
300 --disable-rpath \
301 --enable-extended \
302 --enable-llvm-link-shared \
303 --enable-vendor \
304 --local-rust-root=%{local_rust_root} \
305 --llvm-root=%{_prefix} \
306 --release-channel=%{channel}
307
308export RUST_BACKTRACE=full
309%x_py dist --verbose
310
311%{?with_tests:%x_py test}
312
313%install
314rm -rf $RPM_BUILD_ROOT
315
316export DESTDIR=$RPM_BUILD_ROOT
317%x_py install
318%x_py install src
319
320# Make sure the shared libraries are in the proper libdir
321%if "%{_libdir}" != "%{common_libdir}"
322mkdir -p %{buildroot}%{_libdir}
323find $RPM_BUILD_ROOT%{common_libdir} -maxdepth 1 -type f -name '*.so' \
324 -exec mv -v -t $RPM_BUILD_ROOT%{_libdir} '{}' '+'
325%endif
326
327# The shared libraries should be executable for debuginfo extraction.
328find $RPM_BUILD_ROOT%{_libdir}/ -type f -name '*.so' -exec chmod -v +x '{}' '+'
329
330# The libdir libraries are identical to those under rustlib/. It's easier on
331# library loading if we keep them in libdir, but we do need them in rustlib/
332# to support dynamic linking for compiler plugins, so we'll symlink.
333(cd "$RPM_BUILD_ROOT%{rustlibdir}/%{rust_triple}/lib" &&
334 find ../../../../%{_lib} -maxdepth 1 -name '*.so' \
335 -exec ln -v -f -s -t . '{}' '+')
336
337# Remove installer artifacts (manifests, uninstall scripts, etc.)
338find $RPM_BUILD_ROOT%{rustlibdir}/ -maxdepth 1 -type f -exec rm -v '{}' '+'
339
340# FIXME: __os_install_post will strip the rlibs
341# -- should we find a way to preserve debuginfo?
342
343# Remove unwanted documentation files (we already package them)
344%{__rm} $RPM_BUILD_ROOT%{_docdir}/%{name}/README.md
345%{__rm} $RPM_BUILD_ROOT%{_docdir}/%{name}/COPYRIGHT
346%{__rm} $RPM_BUILD_ROOT%{_docdir}/%{name}/LICENSE-APACHE
347%{__rm} $RPM_BUILD_ROOT%{_docdir}/%{name}/LICENSE-MIT
348
349# Sanitize the HTML documentation
350find $RPM_BUILD_ROOT%{_docdir}/%{name}/html -empty -delete
351find $RPM_BUILD_ROOT%{_docdir}/%{name}/html -type f -exec chmod -x '{}' '+'
352
353# Move rust-gdb's python scripts so they're noarch
354install -d $RPM_BUILD_ROOT%{_datadir}/%{name}
355%{__mv} $RPM_BUILD_ROOT%{rustlibdir}/etc $RPM_BUILD_ROOT%{_datadir}/%{name}
356
357# We don't need stdlib source
358%{__rm} -r $RPM_BUILD_ROOT%{rustlibdir}/src
359
360# Create the path for crate-devel packages
361install -d $RPM_BUILD_ROOT%{_datadir}/cargo/registry
362
363%clean
364rm -rf $RPM_BUILD_ROOT
365
366%post -p /sbin/ldconfig
367%postun -p /sbin/ldconfig
368
369%files
370%defattr(644,root,root,755)
371%doc COPYRIGHT LICENSE-APACHE LICENSE-MIT README.md vendor/backtrace-sys/src/libbacktrace/LICENSE-libbacktrace
372%attr(755,root,root) %{_bindir}/rls
373%attr(755,root,root) %{_bindir}/rustc
374%attr(755,root,root) %{_bindir}/rustdoc
375%attr(755,root,root) %{_bindir}/rustfmt
376%attr(755,root,root) %{_libdir}/librustc*-*.so
377%attr(755,root,root) %{_libdir}/libstd-*.so
378%attr(755,root,root) %{_libdir}/libtest-*.so
379%{_mandir}/man1/rustc.1*
380%{_mandir}/man1/rustdoc.1*
381%dir %{rustlibdir}
382%dir %{rustlibdir}/%{rust_triple}
383%{rustlibdir}/%{rust_triple}/analysis
384%dir %{rustlibdir}/%{rust_triple}/lib
385%attr(755,root,root) %{rustlibdir}/%{rust_triple}/lib/*.so
386%{rustlibdir}/%{rust_triple}/lib/*.rlib
387
388%files debugger-common
389%defattr(644,root,root,755)
390%dir %{_datadir}/%{name}
391%dir %{_datadir}/%{name}/etc
392%{_datadir}/%{name}/etc/debugger_*.py*
393
394%files lldb
395%defattr(644,root,root,755)
396%attr(755,root,root) %{_bindir}/rust-lldb
397%{_datadir}/%{name}/etc/lldb_*.py*
398
399%files gdb
400%defattr(644,root,root,755)
401%attr(755,root,root) %{_bindir}/rust-gdb
402%attr(755,root,root) %{_bindir}/rust-gdbgui
403%{_datadir}/%{name}/etc/gdb_*.py*
404
405%files doc
406%defattr(644,root,root,755)
407%dir %{_docdir}/%{name}
408%doc %{_docdir}/%{name}/html
409
410%files -n cargo
411%defattr(644,root,root,755)
412%attr(755,root,root) %{_bindir}/cargo
413%attr(755,root,root) %{_bindir}/cargo-clippy
414%attr(755,root,root) %{_bindir}/cargo-fmt
415%attr(755,root,root) %{_bindir}/clippy-driver
416%{_mandir}/man1/cargo*.1*
417%dir %{_datadir}/cargo
418%dir %{_datadir}/cargo/registry
419
420%files -n bash-completion-cargo
421%defattr(644,root,root,755)
422%{_sysconfdir}/bash_completion.d/cargo
423
424%files -n zsh-completion-cargo
425%defattr(644,root,root,755)
426%{zsh_compdir}/_cargo
This page took 0.072244 seconds and 4 git commands to generate.