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