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