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