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