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