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