]> git.pld-linux.org Git - packages/rust.git/blame - rust.spec
- up to 1.38.0, use xz tarballs, fetch x32 boostrap stdlib
[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
be28e1f1
JR
26%define bootstrap_rust 1.37.0
27%define bootstrap_cargo 0.38.0
28%define bootstrap_date 2019-08-15
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
be28e1f1 37Version: 1.38.0
6ed79af8 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
JR
42Source0: https://static.rust-lang.org/dist/%{rustc_package}.tar.xz
43# Source0-md5: 492d3fbedc865606119336d55b9c4f29
44Source1: https://static.rust-lang.org/dist/%{bootstrap_date}/rust-%{bootstrap_rust}-x86_64-unknown-linux-gnu.tar.xz
45# Source1-md5: 5d874193878390be4acec3f2f54fff9c
46Source2: https://static.rust-lang.org/dist/%{bootstrap_date}/rust-%{bootstrap_rust}-i686-unknown-linux-gnu.tar.xz
47# Source2-md5: c543ba5b28cc1c90eaf509e9d89effe9
48Source3: https://static.rust-lang.org/dist/%{bootstrap_date}/rust-std-%{bootstrap_rust}-x86_64-unknown-linux-gnux32.tar.xz
49# Source3-md5: d3c7de339814808e79bd78f92e18f75b
e361528e 50URL: https://www.rust-lang.org/
e8f16183
JB
51# for src/compiler-rt
52BuildRequires: cmake >= 3.4.3
e361528e 53BuildRequires: curl
d1b96fd8 54BuildRequires: libstdc++-devel
5b9d67b0 55%{?with_system_llvm:BuildRequires: llvm-devel}
d1b96fd8 56BuildRequires: ncurses-devel
e8f16183 57BuildRequires: python >= 1:2.7
e361528e
ER
58BuildRequires: zlib-devel
59%if %{without bootstrap}
d6d4cb2b 60BuildRequires: %{name} >= %{bootstrap_rust}
d1b96fd8 61BuildRequires: cargo >= %{bootstrap_cargo}
ff5a5e0b 62BuildConflicts: %{name} > %{version}
e361528e
ER
63%endif
64# make check needs "ps" for src/test/run-pass/wait-forked-but-failed-child.rs
65BuildRequires: procps
e361528e
ER
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
e361528e 70# Only x86_64 and i686 are Tier 1 platforms at this time.
badbe44d 71# x32 is Tier 2, only rust-std is available (no rustc or cargo).
e361528e 72# https://doc.rust-lang.org/stable/book/getting-started.html#tier-1
badbe44d 73ExclusiveArch: %{x8664} %{ix86} x32
6ed79af8 74BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
e361528e 75
e064fbd0 76%ifarch x32
badbe44d
JB
77%define rust_triple x86_64-unknown-linux-gnux32
78%define rust_bootstrap_triple x86_64-unknown-linux-gnu
e064fbd0 79%else
badbe44d
JB
80%define rust_triple %{_target_cpu}-unknown-linux-gnu
81%define rust_bootstrap_triple %{_target_cpu}-unknown-linux-gnu
e064fbd0 82%endif
e361528e
ER
83
84%if %{without bootstrap}
8a073211 85%define local_rust_root %{_prefix}
e361528e 86%else
badbe44d 87%define bootstrap_root rust-%{bootstrap_rust}-%{rust_bootstrap_triple}
8a073211 88%define local_rust_root %{_builddir}/%{rustc_package}/%{bootstrap_root}
e361528e
ER
89%endif
90
18a1004b
JR
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.
5b9d67b0 93# Without this ugly hack, rust would not be able to build itself
18a1004b
JR
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
19f98749 98# once_call/once_callable non-function libstdc++ symbols
8f4c23f4 99%define skip_post_check_so 'librustc.*llvm.*\.so.*'
19f98749 100
e361528e 101# ALL Rust libraries are private, because they don't keep an ABI.
8a073211
JR
102%define _noautoreqfiles lib.*-[[:xdigit:]]{8}[.]so.*
103%define _noautoprovfiles lib.*-[[:xdigit:]]{8}[.]so.*
e361528e
ER
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
e8f16183
JB
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
d1b96fd8
JR
117%package debugger-common
118Summary: Common debugger pretty printers for Rust
e8f16183 119Summary(pl.UTF-8): Narzędzia wypisujące struktury Rusa wspólne dla różnych debuggerów
d1b96fd8
JR
120Group: Development/Debuggers
121BuildArch: noarch
122
123%description debugger-common
e8f16183
JB
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.
d1b96fd8 129
e361528e
ER
130%package gdb
131Summary: GDB pretty printers for Rust
e8f16183 132Summary(pl.UTF-8): Ładne wypisywanie struktur Rusta w GDB
d1b96fd8
JR
133Group: Development/Debuggers
134Requires: %{name}-debugger-common = %{version}-%{release}
e361528e 135Requires: gdb
e361528e 136BuildArch: noarch
e361528e
ER
137
138%description gdb
139This package includes the rust-gdb script, which allows easier
140debugging of Rust programs.
141
e8f16183
JB
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
d1b96fd8
JR
146%package lldb
147Summary: LLDB pretty printers for Rust
e8f16183 148Summary(pl.UTF-8): Ładne wypisywanie struktur Rusta w LLDB
d1b96fd8
JR
149Group: Development/Debuggers
150Requires: %{name}-debugger-common = %{version}-%{release}
151Requires: lldb
d1b96fd8
JR
152BuildArch: noarch
153
154%description lldb
155This package includes the rust-lldb script, which allows easier
156debugging of Rust programs.
157
e8f16183
JB
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
e361528e
ER
162%package doc
163Summary: Documentation for Rust
e8f16183 164Summary(pl.UTF-8): Dokumentacja do Rusta
d1b96fd8
JR
165Group: Documentation
166BuildArch: noarch
e361528e
ER
167
168%description doc
169This package includes HTML documentation for the Rust programming
170language and its standard library.
171
e8f16183
JB
172%description doc -l pl.UTF-8
173Ten pakiet zawiera dokumentację w formacie HTML do języka
174programowania Rust i jego biblioteki standardowej.
175
8a758d34
JP
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
6ed79af8
JB
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
8a758d34
JP
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}
6ed79af8 208Requires: zsh
8a758d34
JP
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
e361528e
ER
216%prep
217%setup -q -n %{rustc_package}
b5eceb5e 218
e361528e 219%if %{with bootstrap}
badbe44d 220%ifarch %{x8664} x32
e361528e
ER
221tar xf %{SOURCE1}
222%endif
223%ifarch %{ix86}
224tar xf %{SOURCE2}
225%endif
d6d4cb2b
JR
226%{__mv} %{bootstrap_root} %{bootstrap_root}-root
227%{bootstrap_root}-root/install.sh \
badbe44d 228 --components=cargo,rustc,rust-std-%{rust_bootstrap_triple} \
d6d4cb2b
JR
229 --prefix=%{local_rust_root} \
230 --disable-ldconfig
231test -f %{local_rust_root}/bin/cargo
e361528e
ER
232test -f %{local_rust_root}/bin/rustc
233%endif
234
235# unbundle
d4b51567 236# We're disabling jemalloc, but rust-src still wants it.
5b9d67b0 237#%{__rm} -r src/jemalloc
fe49e3fc 238%{?with_system_llvm:%{__rm} -r src/llvm-project}
e361528e
ER
239
240# extract bundled licenses for packaging
fe49e3fc
JP
241sed -e '/*\//q' vendor/backtrace-sys/src/libbacktrace/backtrace.h \
242 >vendor/backtrace-sys/src/libbacktrace/LICENSE-libbacktrace
e361528e
ER
243
244# rust-gdb has hardcoded SYSROOT/lib -- let's make it noarch
245sed -i -e 's#DIRECTORY=".*"#DIRECTORY="%{_datadir}/%{name}/etc"#' \
246 src/etc/rust-gdb
247
5ee06aa0
JR
248# The configure macro will modify some autoconf-related files, which upsets
249# cargo when it tries to verify checksums in those files. If we just truncate
250# that file list, cargo won't have anything to complain about.
fe49e3fc 251find vendor -name .cargo-checksum.json \
5ee06aa0 252 -exec sed -i.uncheck -e 's/"files":{[^}]*}/"files":{ }/' '{}' '+'
e361528e 253
e361528e
ER
254%build
255%configure \
e8f16183
JB
256 --build=%{rust_triple} \
257 --host=%{rust_triple} \
258 --target=%{rust_triple} \
18a1004b 259 --libdir=%{common_libdir} \
e8f16183 260 --disable-codegen-tests \
5ee06aa0 261 --disable-debuginfo-lines \
5b9d67b0 262%if %{with full_debuginfo}
5ee06aa0 263 --disable-debuginfo-only-std \
e361528e 264 --enable-debuginfo \
5b9d67b0
JB
265%else
266 --enable-debuginfo-only-std \
267 --disable-debuginfo \
268%endif
6ed79af8
JB
269 --disable-jemalloc \
270 --disable-option-checking \
271 --disable-rpath \
8a758d34 272 --enable-extended \
e8f16183 273 --enable-llvm-link-shared \
d6d4cb2b 274 --enable-vendor \
6ed79af8 275 --local-rust-root=%{local_rust_root} \
e8f16183 276 --llvm-root=%{_prefix} \
e361528e
ER
277 --release-channel=%{channel}
278
5b9d67b0 279RUST_BACKTRACE=full \
6ed79af8 280./x.py dist --verbose
e361528e 281
8a073211
JR
282%{?with_tests:./x.py test}
283
e361528e
ER
284%install
285rm -rf $RPM_BUILD_ROOT
e361528e 286
4f353dba
JR
287DESTDIR=$RPM_BUILD_ROOT ./x.py install
288DESTDIR=$RPM_BUILD_ROOT ./x.py install src
e361528e 289
18a1004b
JR
290# Make sure the shared libraries are in the proper libdir
291%if "%{_libdir}" != "%{common_libdir}"
292mkdir -p %{buildroot}%{_libdir}
293find $RPM_BUILD_ROOT%{common_libdir} -maxdepth 1 -type f -name '*.so' \
294 -exec mv -v -t $RPM_BUILD_ROOT%{_libdir} '{}' '+'
295%endif
296
d1b96fd8 297# The shared libraries should be executable for debuginfo extraction.
e361528e
ER
298find $RPM_BUILD_ROOT%{_libdir}/ -type f -name '*.so' -exec chmod -v +x '{}' '+'
299
d1b96fd8
JR
300# The libdir libraries are identical to those under rustlib/. It's easier on
301# library loading if we keep them in libdir, but we do need them in rustlib/
302# to support dynamic linking for compiler plugins, so we'll symlink.
18a1004b 303(cd "$RPM_BUILD_ROOT%{rustlibdir}/%{rust_triple}/lib" &&
d1b96fd8
JR
304 find ../../../../%{_lib} -maxdepth 1 -name '*.so' \
305 -exec ln -v -f -s -t . '{}' '+')
306
307# Remove installer artifacts (manifests, uninstall scripts, etc.)
18a1004b 308find $RPM_BUILD_ROOT%{rustlibdir}/ -maxdepth 1 -type f -exec rm -v '{}' '+'
e361528e
ER
309
310# FIXME: __os_install_post will strip the rlibs
311# -- should we find a way to preserve debuginfo?
312
313# Remove unwanted documentation files (we already package them)
e8f16183
JB
314%{__rm} $RPM_BUILD_ROOT%{_docdir}/%{name}/README.md
315%{__rm} $RPM_BUILD_ROOT%{_docdir}/%{name}/COPYRIGHT
316%{__rm} $RPM_BUILD_ROOT%{_docdir}/%{name}/LICENSE-APACHE
317%{__rm} $RPM_BUILD_ROOT%{_docdir}/%{name}/LICENSE-MIT
e361528e
ER
318
319# Sanitize the HTML documentation
320find $RPM_BUILD_ROOT%{_docdir}/%{name}/html -empty -delete
321find $RPM_BUILD_ROOT%{_docdir}/%{name}/html -type f -exec chmod -x '{}' '+'
322
323# Move rust-gdb's python scripts so they're noarch
324install -d $RPM_BUILD_ROOT%{_datadir}/%{name}
e8f16183 325%{__mv} $RPM_BUILD_ROOT%{rustlibdir}/etc $RPM_BUILD_ROOT%{_datadir}/%{name}
e361528e 326
4f353dba
JR
327# We don't need stdlib source
328%{__rm} -r $RPM_BUILD_ROOT%{rustlibdir}/src
329
1dd26160
JP
330# Create the path for crate-devel packages
331install -d $RPM_BUILD_ROOT%{_datadir}/cargo/registry
332
e361528e
ER
333%clean
334rm -rf $RPM_BUILD_ROOT
335
336%post -p /sbin/ldconfig
337%postun -p /sbin/ldconfig
338
339%files
340%defattr(644,root,root,755)
fe49e3fc
JP
341%doc COPYRIGHT LICENSE-APACHE LICENSE-MIT README.md vendor/backtrace-sys/src/libbacktrace/LICENSE-libbacktrace
342%attr(755,root,root) %{_bindir}/miri
6ed79af8 343%attr(755,root,root) %{_bindir}/rls
e361528e
ER
344%attr(755,root,root) %{_bindir}/rustc
345%attr(755,root,root) %{_bindir}/rustdoc
6ed79af8 346%attr(755,root,root) %{_bindir}/rustfmt
e8f16183 347%attr(755,root,root) %{_libdir}/libarena-*.so
e8f16183 348%attr(755,root,root) %{_libdir}/libfmt_macros-*.so
e8f16183 349%attr(755,root,root) %{_libdir}/libgraphviz-*.so
e8f16183 350%attr(755,root,root) %{_libdir}/librustc*-*.so
e8f16183
JB
351%attr(755,root,root) %{_libdir}/libserialize-*.so
352%attr(755,root,root) %{_libdir}/libstd-*.so
353%attr(755,root,root) %{_libdir}/libsyntax-*.so
354%attr(755,root,root) %{_libdir}/libsyntax_ext-*.so
355%attr(755,root,root) %{_libdir}/libsyntax_pos-*.so
356%attr(755,root,root) %{_libdir}/libterm-*.so
357%attr(755,root,root) %{_libdir}/libtest-*.so
e361528e
ER
358%{_mandir}/man1/rustc.1*
359%{_mandir}/man1/rustdoc.1*
18a1004b
JR
360%dir %{rustlibdir}
361%dir %{rustlibdir}/%{rust_triple}
6ed79af8 362%{rustlibdir}/%{rust_triple}/analysis
9ee62e7d
JP
363%dir %{rustlibdir}/%{rust_triple}/codegen-backends
364%attr(755,root,root) %{rustlibdir}/%{rust_triple}/codegen-backends/*.so
18a1004b
JR
365%dir %{rustlibdir}/%{rust_triple}/lib
366%attr(755,root,root) %{rustlibdir}/%{rust_triple}/lib/*.so
367%{rustlibdir}/%{rust_triple}/lib/*.rlib
e361528e 368
d1b96fd8
JR
369%files debugger-common
370%defattr(644,root,root,755)
371%dir %{_datadir}/%{name}
372%dir %{_datadir}/%{name}/etc
373%{_datadir}/%{name}/etc/debugger_*.py*
374
375%files lldb
376%defattr(644,root,root,755)
377%attr(755,root,root) %{_bindir}/rust-lldb
378%{_datadir}/%{name}/etc/lldb_*.py*
379
e361528e
ER
380%files gdb
381%defattr(644,root,root,755)
382%attr(755,root,root) %{_bindir}/rust-gdb
fe49e3fc 383%attr(755,root,root) %{_bindir}/rust-gdbgui
d1b96fd8 384%{_datadir}/%{name}/etc/gdb_*.py*
e361528e
ER
385
386%files doc
387%defattr(644,root,root,755)
388%dir %{_docdir}/%{name}
d1b96fd8 389%doc %{_docdir}/%{name}/html
8a758d34
JP
390
391%files -n cargo
392%defattr(644,root,root,755)
393%attr(755,root,root) %{_bindir}/cargo
6ed79af8
JB
394%attr(755,root,root) %{_bindir}/cargo-clippy
395%attr(755,root,root) %{_bindir}/cargo-fmt
fe49e3fc 396%attr(755,root,root) %{_bindir}/cargo-miri
6ed79af8 397%attr(755,root,root) %{_bindir}/clippy-driver
8a758d34
JP
398%{_mandir}/man1/cargo*.1*
399%dir %{_datadir}/cargo
400%dir %{_datadir}/cargo/registry
401
402%files -n bash-completion-cargo
403%defattr(644,root,root,755)
404%{_sysconfdir}/bash_completion.d/cargo
405
406%files -n zsh-completion-cargo
407%defattr(644,root,root,755)
408%{zsh_compdir}/_cargo
This page took 0.192368 seconds and 4 git commands to generate.