]> git.pld-linux.org Git - packages/rust.git/blame - rust.spec
- added x32 patch, librustc* libs now build (but build then fails when trying to...
[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
a1735efb 52Patch0: %{name}-x32.patch
e361528e 53URL: https://www.rust-lang.org/
e8f16183
JB
54# for src/compiler-rt
55BuildRequires: cmake >= 3.4.3
e361528e 56BuildRequires: curl
d1b96fd8 57BuildRequires: libstdc++-devel
7da6653d
JB
58%{?with_system_llvm:BuildRequires: llvm-devel >= 7.0}
59BuildRequires: openssl-devel >= 1.0.1
e8f16183 60BuildRequires: python >= 1:2.7
e361528e
ER
61BuildRequires: zlib-devel
62%if %{without bootstrap}
d6d4cb2b 63BuildRequires: %{name} >= %{bootstrap_rust}
d1b96fd8 64BuildRequires: cargo >= %{bootstrap_cargo}
ff5a5e0b 65BuildConflicts: %{name} > %{version}
e361528e
ER
66%endif
67# make check needs "ps" for src/test/run-pass/wait-forked-but-failed-child.rs
68BuildRequires: procps
e361528e
ER
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
e361528e 73# Only x86_64 and i686 are Tier 1 platforms at this time.
badbe44d 74# x32 is Tier 2, only rust-std is available (no rustc or cargo).
4f433f76 75# https://doc.rust-lang.org/nightly/rustc/platform-support.html
c160f211 76ExclusiveArch: %{x8664} %{ix86} x32 aarch64
6ed79af8 77BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
e361528e 78
e064fbd0 79%ifarch x32
badbe44d
JB
80%define rust_triple x86_64-unknown-linux-gnux32
81%define rust_bootstrap_triple x86_64-unknown-linux-gnu
e064fbd0 82%else
badbe44d
JB
83%define rust_triple %{_target_cpu}-unknown-linux-gnu
84%define rust_bootstrap_triple %{_target_cpu}-unknown-linux-gnu
e064fbd0 85%endif
e361528e
ER
86
87%if %{without bootstrap}
8a073211 88%define local_rust_root %{_prefix}
e361528e 89%else
badbe44d 90%define bootstrap_root rust-%{bootstrap_rust}-%{rust_bootstrap_triple}
8a073211 91%define local_rust_root %{_builddir}/%{rustc_package}/%{bootstrap_root}
e361528e
ER
92%endif
93
18a1004b
JR
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.
5b9d67b0 96# Without this ugly hack, rust would not be able to build itself
18a1004b
JR
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
19f98749 101# once_call/once_callable non-function libstdc++ symbols
8f4c23f4 102%define skip_post_check_so 'librustc.*llvm.*\.so.*'
19f98749 103
e361528e 104# ALL Rust libraries are private, because they don't keep an ABI.
8a073211
JR
105%define _noautoreqfiles lib.*-[[:xdigit:]]{8}[.]so.*
106%define _noautoprovfiles lib.*-[[:xdigit:]]{8}[.]so.*
e361528e 107
37765656
JP
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
e361528e
ER
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
e8f16183
JB
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
d1b96fd8
JR
128%package debugger-common
129Summary: Common debugger pretty printers for Rust
e8f16183 130Summary(pl.UTF-8): Narzędzia wypisujące struktury Rusa wspólne dla różnych debuggerów
d1b96fd8
JR
131Group: Development/Debuggers
132BuildArch: noarch
133
134%description debugger-common
e8f16183
JB
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.
d1b96fd8 140
e361528e
ER
141%package gdb
142Summary: GDB pretty printers for Rust
e8f16183 143Summary(pl.UTF-8): Ładne wypisywanie struktur Rusta w GDB
d1b96fd8
JR
144Group: Development/Debuggers
145Requires: %{name}-debugger-common = %{version}-%{release}
e361528e 146Requires: gdb
e361528e 147BuildArch: noarch
e361528e
ER
148
149%description gdb
150This package includes the rust-gdb script, which allows easier
151debugging of Rust programs.
152
e8f16183
JB
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
d1b96fd8
JR
157%package lldb
158Summary: LLDB pretty printers for Rust
e8f16183 159Summary(pl.UTF-8): Ładne wypisywanie struktur Rusta w LLDB
d1b96fd8
JR
160Group: Development/Debuggers
161Requires: %{name}-debugger-common = %{version}-%{release}
162Requires: lldb
d1b96fd8
JR
163BuildArch: noarch
164
165%description lldb
166This package includes the rust-lldb script, which allows easier
167debugging of Rust programs.
168
e8f16183
JB
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
e361528e
ER
173%package doc
174Summary: Documentation for Rust
e8f16183 175Summary(pl.UTF-8): Dokumentacja do Rusta
d1b96fd8
JR
176Group: Documentation
177BuildArch: noarch
e361528e
ER
178
179%description doc
180This package includes HTML documentation for the Rust programming
181language and its standard library.
182
e8f16183
JB
183%description doc -l pl.UTF-8
184Ten pakiet zawiera dokumentację w formacie HTML do języka
185programowania Rust i jego biblioteki standardowej.
186
8a758d34
JP
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
6ed79af8
JB
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
8a758d34
JP
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}
6ed79af8 219Requires: zsh
8a758d34
JP
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
e361528e
ER
227%prep
228%setup -q -n %{rustc_package}
a1735efb 229%patch0 -p1
b5eceb5e 230
e361528e 231%if %{with bootstrap}
a1735efb 232%ifarch %{x8664} x32
e361528e
ER
233tar xf %{SOURCE1}
234%endif
235%ifarch %{ix86}
236tar xf %{SOURCE2}
237%endif
72bb5844
JR
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
c160f211
JP
245%ifarch aarch64
246tar xf %{SOURCE4}
247%endif
d6d4cb2b
JR
248%{__mv} %{bootstrap_root} %{bootstrap_root}-root
249%{bootstrap_root}-root/install.sh \
badbe44d 250 --components=cargo,rustc,rust-std-%{rust_bootstrap_triple} \
d6d4cb2b
JR
251 --prefix=%{local_rust_root} \
252 --disable-ldconfig
253test -f %{local_rust_root}/bin/cargo
e361528e 254test -f %{local_rust_root}/bin/rustc
72bb5844
JR
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
e361528e
ER
261%endif
262
263# unbundle
d4b51567 264# We're disabling jemalloc, but rust-src still wants it.
5b9d67b0 265#%{__rm} -r src/jemalloc
fe49e3fc 266%{?with_system_llvm:%{__rm} -r src/llvm-project}
e361528e
ER
267
268# extract bundled licenses for packaging
fe49e3fc
JP
269sed -e '/*\//q' vendor/backtrace-sys/src/libbacktrace/backtrace.h \
270 >vendor/backtrace-sys/src/libbacktrace/LICENSE-libbacktrace
e361528e
ER
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
5ee06aa0
JR
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.
fe49e3fc 279find vendor -name .cargo-checksum.json \
5ee06aa0 280 -exec sed -i.uncheck -e 's/"files":{[^}]*}/"files":{ }/' '{}' '+'
e361528e 281
e361528e 282%build
a1735efb 283export PKG_CONFIG_ALLOW_CROSS=1
e361528e 284%configure \
e8f16183
JB
285 --build=%{rust_triple} \
286 --host=%{rust_triple} \
287 --target=%{rust_triple} \
18a1004b 288 --libdir=%{common_libdir} \
e8f16183 289 --disable-codegen-tests \
5ee06aa0 290 --disable-debuginfo-lines \
5b9d67b0 291%if %{with full_debuginfo}
5ee06aa0 292 --disable-debuginfo-only-std \
e361528e 293 --enable-debuginfo \
5b9d67b0
JB
294%else
295 --enable-debuginfo-only-std \
296 --disable-debuginfo \
297%endif
6ed79af8
JB
298 --disable-jemalloc \
299 --disable-option-checking \
300 --disable-rpath \
8a758d34 301 --enable-extended \
e8f16183 302 --enable-llvm-link-shared \
d6d4cb2b 303 --enable-vendor \
6ed79af8 304 --local-rust-root=%{local_rust_root} \
e8f16183 305 --llvm-root=%{_prefix} \
e361528e
ER
306 --release-channel=%{channel}
307
37765656
JP
308export RUST_BACKTRACE=full
309%x_py dist --verbose
e361528e 310
37765656 311%{?with_tests:%x_py test}
8a073211 312
e361528e
ER
313%install
314rm -rf $RPM_BUILD_ROOT
e361528e 315
37765656
JP
316export DESTDIR=$RPM_BUILD_ROOT
317%x_py install
318%x_py install src
e361528e 319
18a1004b
JR
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
d1b96fd8 327# The shared libraries should be executable for debuginfo extraction.
e361528e
ER
328find $RPM_BUILD_ROOT%{_libdir}/ -type f -name '*.so' -exec chmod -v +x '{}' '+'
329
d1b96fd8
JR
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.
18a1004b 333(cd "$RPM_BUILD_ROOT%{rustlibdir}/%{rust_triple}/lib" &&
d1b96fd8
JR
334 find ../../../../%{_lib} -maxdepth 1 -name '*.so' \
335 -exec ln -v -f -s -t . '{}' '+')
336
337# Remove installer artifacts (manifests, uninstall scripts, etc.)
18a1004b 338find $RPM_BUILD_ROOT%{rustlibdir}/ -maxdepth 1 -type f -exec rm -v '{}' '+'
e361528e
ER
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)
e8f16183
JB
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
e361528e
ER
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}
e8f16183 355%{__mv} $RPM_BUILD_ROOT%{rustlibdir}/etc $RPM_BUILD_ROOT%{_datadir}/%{name}
e361528e 356
4f353dba
JR
357# We don't need stdlib source
358%{__rm} -r $RPM_BUILD_ROOT%{rustlibdir}/src
359
1dd26160
JP
360# Create the path for crate-devel packages
361install -d $RPM_BUILD_ROOT%{_datadir}/cargo/registry
362
e361528e
ER
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)
fe49e3fc 371%doc COPYRIGHT LICENSE-APACHE LICENSE-MIT README.md vendor/backtrace-sys/src/libbacktrace/LICENSE-libbacktrace
6ed79af8 372%attr(755,root,root) %{_bindir}/rls
e361528e
ER
373%attr(755,root,root) %{_bindir}/rustc
374%attr(755,root,root) %{_bindir}/rustdoc
6ed79af8 375%attr(755,root,root) %{_bindir}/rustfmt
e8f16183 376%attr(755,root,root) %{_libdir}/librustc*-*.so
e8f16183 377%attr(755,root,root) %{_libdir}/libstd-*.so
e8f16183 378%attr(755,root,root) %{_libdir}/libtest-*.so
e361528e
ER
379%{_mandir}/man1/rustc.1*
380%{_mandir}/man1/rustdoc.1*
18a1004b
JR
381%dir %{rustlibdir}
382%dir %{rustlibdir}/%{rust_triple}
6ed79af8 383%{rustlibdir}/%{rust_triple}/analysis
18a1004b
JR
384%dir %{rustlibdir}/%{rust_triple}/lib
385%attr(755,root,root) %{rustlibdir}/%{rust_triple}/lib/*.so
386%{rustlibdir}/%{rust_triple}/lib/*.rlib
e361528e 387
d1b96fd8
JR
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
e361528e
ER
399%files gdb
400%defattr(644,root,root,755)
401%attr(755,root,root) %{_bindir}/rust-gdb
fe49e3fc 402%attr(755,root,root) %{_bindir}/rust-gdbgui
d1b96fd8 403%{_datadir}/%{name}/etc/gdb_*.py*
e361528e
ER
404
405%files doc
406%defattr(644,root,root,755)
407%dir %{_docdir}/%{name}
d1b96fd8 408%doc %{_docdir}/%{name}/html
8a758d34
JP
409
410%files -n cargo
411%defattr(644,root,root,755)
412%attr(755,root,root) %{_bindir}/cargo
6ed79af8
JB
413%attr(755,root,root) %{_bindir}/cargo-clippy
414%attr(755,root,root) %{_bindir}/cargo-fmt
415%attr(755,root,root) %{_bindir}/clippy-driver
8a758d34
JP
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.155445 seconds and 4 git commands to generate.