1 |
# (akien) This package is synced with Fedora / Josh Stone's spec. |
2 |
# The aim is to work with them on a rust packaging policy we could share, |
3 |
# so that we can ensure a good packaging and share the workload. |
4 |
|
5 |
|
6 |
# Only x86_64 and i686 are Tier 1 platforms at this time. |
7 |
# https://forge.rust-lang.org/platform-support.html |
8 |
%global rust_arches x86_64 i686 i586 armv7hl aarch64 ppc64 ppc64le s390x |
9 |
|
10 |
# The channel can be stable, beta, or nightly |
11 |
%{!?channel: %global channel stable} |
12 |
|
13 |
# To bootstrap from scratch, set the channel and date from src/stage0.txt |
14 |
# e.g. 1.10.0 wants rustc: 1.9.0-2016-05-24 |
15 |
# or nightly wants some beta-YYYY-MM-DD |
16 |
# Note that cargo matches the program version here, not its crate version. |
17 |
%global bootstrap_rust 1.33.0 |
18 |
%global bootstrap_cargo 1.33.0 |
19 |
%global bootstrap_channel %{bootstrap_rust} |
20 |
%global bootstrap_date 2019-02-28 |
21 |
|
22 |
# Only the specified arches will use bootstrap binaries. |
23 |
#global bootstrap_arches %%{rust_arches} |
24 |
|
25 |
# Using llvm-static may be helpful as an opt-in, e.g. to aid LLVM rebases. |
26 |
%bcond_with llvm_static |
27 |
|
28 |
# We can also choose to just use Rust's bundled LLVM, in case the system LLVM |
29 |
# is insufficient. Rust currently requires LLVM 5.0+. |
30 |
%if 0%{?rhel} && !0%{?epel} |
31 |
%bcond_without bundled_llvm |
32 |
%else |
33 |
%bcond_with bundled_llvm |
34 |
%endif |
35 |
|
36 |
# libgit2-sys expects to use its bundled library, which is sometimes just a |
37 |
# snapshot of libgit2's master branch. This can mean the FFI declarations |
38 |
# won't match our released libgit2.so, e.g. having changed struct fields. |
39 |
# So, tread carefully if you toggle this... |
40 |
%bcond_without bundled_libgit2 |
41 |
|
42 |
%if 0%{?rhel} |
43 |
%bcond_without bundled_libssh2 |
44 |
%else |
45 |
%bcond_with bundled_libssh2 |
46 |
%endif |
47 |
|
48 |
# LLDB only works on some architectures |
49 |
%ifarch %{arm} aarch64 %{ix86} x86_64 |
50 |
# LLDB isn't available everywhere... |
51 |
%if !0%{?rhel} |
52 |
%bcond_without lldb |
53 |
%else |
54 |
%bcond_with lldb |
55 |
%endif |
56 |
%else |
57 |
%bcond_with lldb |
58 |
%endif |
59 |
|
60 |
Name: rust |
61 |
Version: 1.34.0 |
62 |
Release: %mkrel 2 |
63 |
Summary: The Rust Programming Language |
64 |
%if 0%{?mageia} |
65 |
Group: Development/Other |
66 |
%endif |
67 |
License: (ASL 2.0 or MIT) and (BSD and MIT) |
68 |
# ^ written as: (rust itself) and (bundled libraries) |
69 |
URL: https://www.rust-lang.org |
70 |
ExclusiveArch: %{rust_arches} |
71 |
|
72 |
%if "%{channel}" == "stable" |
73 |
%global rustc_package rustc-%{version}-src |
74 |
%else |
75 |
%global rustc_package rustc-%{channel}-src |
76 |
%endif |
77 |
Source0: https://static.rust-lang.org/dist/%{rustc_package}.tar.xz |
78 |
|
79 |
# Revert https://github.com/rust-lang/rust/pull/57840 |
80 |
# We do have the necessary fix in our LLVM 7. |
81 |
Patch1: rust-pr57840-llvm7-debuginfo-variants.patch |
82 |
|
83 |
# Get the Rust triple for any arch. |
84 |
%{lua: function rust_triple(arch) |
85 |
local abi = "gnu" |
86 |
if arch == "armv7hl" then |
87 |
arch = "armv7" |
88 |
abi = "gnueabihf" |
89 |
elseif arch == "ppc64" then |
90 |
arch = "powerpc64" |
91 |
elseif arch == "ppc64le" then |
92 |
arch = "powerpc64le" |
93 |
elseif arch == "i586" then |
94 |
arch = "i686" |
95 |
end |
96 |
return arch.."-unknown-linux-"..abi |
97 |
end} |
98 |
|
99 |
%global rust_triple %{lua: print(rust_triple(rpm.expand("%{_target_cpu}")))} |
100 |
|
101 |
%if %defined bootstrap_arches |
102 |
# For each bootstrap arch, add an additional binary Source. |
103 |
# Also define bootstrap_source just for the current target. |
104 |
%{lua: do |
105 |
local bootstrap_arches = {} |
106 |
for arch in string.gmatch(rpm.expand("%{bootstrap_arches}"), "%S+") do |
107 |
table.insert(bootstrap_arches, arch) |
108 |
end |
109 |
local base = rpm.expand("https://static.rust-lang.org/dist/%{bootstrap_date}" |
110 |
.."/rust-%{bootstrap_channel}") |
111 |
local target_arch = rpm.expand("%{_target_cpu}") |
112 |
for i, arch in ipairs(bootstrap_arches) do |
113 |
print(string.format("Source%d: %s-%s.tar.xz\n", |
114 |
i, base, rust_triple(arch))) |
115 |
if arch == target_arch then |
116 |
rpm.define("bootstrap_source "..i) |
117 |
end |
118 |
end |
119 |
end} |
120 |
%endif |
121 |
|
122 |
%ifarch %{bootstrap_arches} |
123 |
%global bootstrap_root rust-%{bootstrap_channel}-%{rust_triple} |
124 |
%global local_rust_root %{_builddir}/%{bootstrap_root}/usr |
125 |
Provides: bundled(%{name}-bootstrap) = %{bootstrap_rust} |
126 |
%else |
127 |
BuildRequires: cargo >= %{bootstrap_cargo} |
128 |
%if 0%{?fedora} >= 27 |
129 |
BuildRequires: (%{name} >= %{bootstrap_rust} with %{name} <= %{version}) |
130 |
%else |
131 |
BuildRequires: %{name} >= %{bootstrap_rust} |
132 |
BuildConflicts: %{name} > %{version} |
133 |
%endif |
134 |
%global local_rust_root %{_prefix} |
135 |
%endif |
136 |
|
137 |
BuildRequires: make |
138 |
BuildRequires: gcc |
139 |
BuildRequires: gcc-c++ |
140 |
BuildRequires: ncurses-devel |
141 |
BuildRequires: curl |
142 |
BuildRequires: pkgconfig(libcurl) |
143 |
BuildRequires: pkgconfig(liblzma) |
144 |
BuildRequires: pkgconfig(openssl) |
145 |
BuildRequires: pkgconfig(zlib) |
146 |
|
147 |
%if %without bundled_libgit2 |
148 |
BuildRequires: pkgconfig(libgit2) >= 0.27 |
149 |
%endif |
150 |
|
151 |
%if %without bundled_libssh2 |
152 |
# needs libssh2_userauth_publickey_frommemory |
153 |
BuildRequires: pkgconfig(libssh2) >= 1.6.0 |
154 |
%endif |
155 |
|
156 |
%if 0%{?rhel} && 0%{?rhel} <= 7 |
157 |
%global python python2 |
158 |
%else |
159 |
%global python python3 |
160 |
%endif |
161 |
BuildRequires: %{python} |
162 |
|
163 |
%if %with bundled_llvm |
164 |
BuildRequires: cmake3 >= 3.4.3 |
165 |
Provides: bundled(llvm) = 8.0.0~svn |
166 |
%else |
167 |
BuildRequires: cmake >= 2.8.11 |
168 |
%if 0%{?epel} |
169 |
%global llvm llvm7.0 |
170 |
%endif |
171 |
%if %defined llvm |
172 |
%global llvm_root %{_libdir}/%{llvm} |
173 |
%else |
174 |
%global llvm llvm |
175 |
%global llvm_root %{_prefix} |
176 |
%endif |
177 |
BuildRequires: %{llvm}-devel >= 6.0 |
178 |
%if %with llvm_static |
179 |
BuildRequires: %{llvm}-static |
180 |
BuildRequires: libffi-devel |
181 |
%endif |
182 |
%endif |
183 |
|
184 |
# make check needs "ps" for src/test/run-pass/wait-forked-but-failed-child.rs |
185 |
BuildRequires: procps-ng |
186 |
|
187 |
# debuginfo-gdb tests need gdb |
188 |
BuildRequires: gdb |
189 |
|
190 |
# TODO: work on unbundling these! |
191 |
Provides: bundled(libbacktrace) = 8.1.0 |
192 |
Provides: bundled(miniz) = 2.0.7 |
193 |
|
194 |
# Virtual provides for folks who attempt "dnf install rustc" |
195 |
Provides: rustc = %{version}-%{release} |
196 |
Provides: rustc%{?_isa} = %{version}-%{release} |
197 |
|
198 |
# Always require our exact standard library |
199 |
Requires: %{name}-std-static%{?_isa} = %{version}-%{release} |
200 |
|
201 |
# The C compiler is needed at runtime just for linking. Someday rustc might |
202 |
# invoke the linker directly, and then we'll only need binutils. |
203 |
# https://github.com/rust-lang/rust/issues/11937 |
204 |
%if 0%{?mageia} |
205 |
Requires: gcc |
206 |
%else |
207 |
Requires: /usr/bin/cc |
208 |
%endif |
209 |
|
210 |
# ALL Rust libraries are private, because they don't keep an ABI. |
211 |
%global _privatelibs lib(.*-[[:xdigit:]]{16}*|rustc.*)[.]so.* |
212 |
%global __provides_exclude ^(%{_privatelibs})$ |
213 |
%global __requires_exclude ^(%{_privatelibs})$ |
214 |
%global __provides_exclude_from ^(%{_docdir}|%{rustlibdir}/src)/.*$ |
215 |
%global __requires_exclude_from ^(%{_docdir}|%{rustlibdir}/src)/.*$ |
216 |
|
217 |
# While we don't want to encourage dynamic linking to Rust shared libraries, as |
218 |
# there's no stable ABI, we still need the unallocated metadata (.rustc) to |
219 |
# support custom-derive plugins like #[proc_macro_derive(Foo)]. But eu-strip is |
220 |
# very eager by default, so we have to limit it to -g, only debugging symbols. |
221 |
%if 0%{?fedora} >= 27 || 0%{?mageia} >= 7 |
222 |
# Newer find-debuginfo.sh supports --keep-section, which is preferable. rhbz1465997 |
223 |
%global _find_debuginfo_opts --keep-section .rustc |
224 |
%else |
225 |
%global _find_debuginfo_opts -g |
226 |
%undefine _include_minidebuginfo |
227 |
%endif |
228 |
|
229 |
# Use hardening ldflags. |
230 |
%global rustflags -Clink-arg=-Wl,-z,relro,-z,now |
231 |
|
232 |
%if %{without bundled_llvm} |
233 |
%if "%{llvm_root}" == "%{_prefix}" || 0%{?scl:1} |
234 |
%global llvm_has_filecheck 1 |
235 |
%endif |
236 |
%endif |
237 |
|
238 |
%description |
239 |
Rust is a systems programming language that runs blazingly fast, prevents |
240 |
segfaults, and guarantees thread safety. |
241 |
|
242 |
This package includes the Rust compiler and documentation generator. |
243 |
|
244 |
|
245 |
%package std-static |
246 |
Summary: Standard library for Rust |
247 |
|
248 |
%description std-static |
249 |
This package includes the standard libraries for building applications |
250 |
written in Rust. |
251 |
|
252 |
|
253 |
%package debugger-common |
254 |
Summary: Common debugger pretty printers for Rust |
255 |
BuildArch: noarch |
256 |
|
257 |
%description debugger-common |
258 |
This package includes the common functionality for %{name}-gdb and %{name}-lldb. |
259 |
|
260 |
|
261 |
%package gdb |
262 |
Summary: GDB pretty printers for Rust |
263 |
BuildArch: noarch |
264 |
Requires: gdb |
265 |
Requires: %{name}-debugger-common = %{version}-%{release} |
266 |
|
267 |
%description gdb |
268 |
This package includes the rust-gdb script, which allows easier debugging of Rust |
269 |
programs. |
270 |
|
271 |
|
272 |
%if %with lldb |
273 |
|
274 |
%package lldb |
275 |
Summary: LLDB pretty printers for Rust |
276 |
|
277 |
# It could be noarch, but lldb has limited availability |
278 |
#BuildArch: noarch |
279 |
|
280 |
Requires: lldb |
281 |
Requires: python2-lldb |
282 |
Requires: %{name}-debugger-common = %{version}-%{release} |
283 |
|
284 |
%description lldb |
285 |
This package includes the rust-lldb script, which allows easier debugging of Rust |
286 |
programs. |
287 |
|
288 |
%endif |
289 |
|
290 |
|
291 |
%package doc |
292 |
Summary: Documentation for Rust |
293 |
# NOT BuildArch: noarch |
294 |
# Note, while docs are mostly noarch, some things do vary by target_arch. |
295 |
# Koji will fail the build in rpmdiff if two architectures build a noarch |
296 |
# subpackage differently, so instead we have to keep its arch. |
297 |
|
298 |
%description doc |
299 |
This package includes HTML documentation for the Rust programming language and |
300 |
its standard library. |
301 |
|
302 |
|
303 |
%package -n cargo |
304 |
Summary: Rust's package manager and build tool |
305 |
%if %with bundled_libgit2 |
306 |
Provides: bundled(libgit2) = 0.27 |
307 |
%endif |
308 |
%if %with bundled_libssh2 |
309 |
Provides: bundled(libssh2) = 1.8.1~dev |
310 |
%endif |
311 |
# For tests: |
312 |
BuildRequires: git |
313 |
# Cargo is not much use without Rust |
314 |
Requires: rust |
315 |
|
316 |
%description -n cargo |
317 |
Cargo is a tool that allows Rust projects to declare their various dependencies |
318 |
and ensure that you'll always get a repeatable build. |
319 |
|
320 |
|
321 |
%package -n cargo-doc |
322 |
Summary: Documentation for Cargo |
323 |
BuildArch: noarch |
324 |
# Cargo no longer builds its own documentation |
325 |
# https://github.com/rust-lang/cargo/pull/4904 |
326 |
Requires: rust-doc = %{version}-%{release} |
327 |
|
328 |
%description -n cargo-doc |
329 |
This package includes HTML documentation for Cargo. |
330 |
|
331 |
|
332 |
%package -n rustfmt |
333 |
Summary: Tool to find and fix Rust formatting issues |
334 |
Requires: cargo |
335 |
|
336 |
# The component/package was rustfmt-preview until Rust 1.31. |
337 |
Obsoletes: rustfmt-preview < 1.0.0 |
338 |
Provides: rustfmt-preview = %{version}-%{release} |
339 |
|
340 |
%description -n rustfmt |
341 |
A tool for formatting Rust code according to style guidelines. |
342 |
|
343 |
|
344 |
%package -n rls |
345 |
Summary: Rust Language Server for IDE integration |
346 |
%if %with bundled_libgit2 |
347 |
Provides: bundled(libgit2) = 0.27 |
348 |
%endif |
349 |
%if %with bundled_libssh2 |
350 |
Provides: bundled(libssh2) = 1.8.1~dev |
351 |
%endif |
352 |
Requires: rust-analysis |
353 |
# /usr/bin/rls is dynamically linked against internal rustc libs |
354 |
Requires: %{name}%{?_isa} = %{version}-%{release} |
355 |
|
356 |
# The component/package was rls-preview until Rust 1.31. |
357 |
Obsoletes: rls-preview < 1.31.6 |
358 |
Provides: rls-preview = %{version}-%{release} |
359 |
|
360 |
%description -n rls |
361 |
The Rust Language Server provides a server that runs in the background, |
362 |
providing IDEs, editors, and other tools with information about Rust programs. |
363 |
It supports functionality such as 'goto definition', symbol search, |
364 |
reformatting, and code completion, and enables renaming and refactorings. |
365 |
|
366 |
|
367 |
%package -n clippy |
368 |
Summary: Lints to catch common mistakes and improve your Rust code |
369 |
Requires: cargo |
370 |
# /usr/bin/clippy-driver is dynamically linked against internal rustc libs |
371 |
Requires: %{name}%{?_isa} = %{version}-%{release} |
372 |
|
373 |
# The component/package was clippy-preview until Rust 1.31. |
374 |
Obsoletes: clippy-preview <= 0.0.212 |
375 |
Provides: clippy-preview = %{version}-%{release} |
376 |
|
377 |
%description -n clippy |
378 |
A collection of lints to catch common mistakes and improve your Rust code. |
379 |
|
380 |
|
381 |
%package src |
382 |
Summary: Sources for the Rust standard library |
383 |
BuildArch: noarch |
384 |
|
385 |
%description src |
386 |
This package includes source files for the Rust standard library. It may be |
387 |
useful as a reference for code completion tools in various editors. |
388 |
|
389 |
|
390 |
%package analysis |
391 |
Summary: Compiler analysis data for the Rust standard library |
392 |
Requires: rust-std-static%{?_isa} = %{version}-%{release} |
393 |
|
394 |
%description analysis |
395 |
This package contains analysis data files produced with rustc's -Zsave-analysis |
396 |
feature for the Rust standard library. The RLS (Rust Language Server) uses this |
397 |
data to provide information about the Rust standard library. |
398 |
|
399 |
|
400 |
%prep |
401 |
|
402 |
%ifarch %{bootstrap_arches} |
403 |
%setup -q -n %{bootstrap_root} -T -b %{bootstrap_source} |
404 |
./install.sh --components=cargo,rustc,rust-std-%{rust_triple} \ |
405 |
--prefix=%{local_rust_root} --disable-ldconfig |
406 |
test -f '%{local_rust_root}/bin/cargo' |
407 |
test -f '%{local_rust_root}/bin/rustc' |
408 |
%endif |
409 |
|
410 |
%setup -q -n %{rustc_package} |
411 |
|
412 |
%patch1 -p1 -R |
413 |
|
414 |
%if "%{python}" == "python3" |
415 |
sed -i.try-py3 -e '/try python2.7/i try python3 "$@"' ./configure |
416 |
%endif |
417 |
|
418 |
%if %without bundled_llvm |
419 |
rm -rf src/llvm-project/ |
420 |
%endif |
421 |
|
422 |
# We never enable emscripten. |
423 |
rm -rf src/llvm-emscripten/ |
424 |
|
425 |
# rename bundled license for packaging |
426 |
cp -a vendor/backtrace-sys/src/libbacktrace/LICENSE{,-libbacktrace} |
427 |
|
428 |
%if %{with bundled_llvm} && 0%{?epel} |
429 |
mkdir -p cmake-bin |
430 |
ln -s /usr/bin/cmake3 cmake-bin/cmake |
431 |
%global cmake_path $PWD/cmake-bin |
432 |
%endif |
433 |
|
434 |
%if %{without bundled_llvm} && %{with llvm_static} |
435 |
# Static linking to distro LLVM needs to add -lffi |
436 |
# https://github.com/rust-lang/rust/issues/34486 |
437 |
sed -i.ffi -e '$a #[link(name = "ffi")] extern {}' \ |
438 |
src/librustc_llvm/lib.rs |
439 |
%endif |
440 |
|
441 |
# The configure macro will modify some autoconf-related files, which upsets |
442 |
# cargo when it tries to verify checksums in those files. If we just truncate |
443 |
# that file list, cargo won't have anything to complain about. |
444 |
find vendor -name .cargo-checksum.json \ |
445 |
-exec sed -i.uncheck -e 's/"files":{[^}]*}/"files":{ }/' '{}' '+' |
446 |
|
447 |
|
448 |
%build |
449 |
|
450 |
%if %without bundled_libgit2 |
451 |
# convince libgit2-sys to use the distro libgit2 |
452 |
export LIBGIT2_SYS_USE_PKG_CONFIG=1 |
453 |
%endif |
454 |
|
455 |
%if %without bundled_libssh2 |
456 |
# convince libssh2-sys to use the distro libssh2 |
457 |
export LIBSSH2_SYS_USE_PKG_CONFIG=1 |
458 |
%endif |
459 |
|
460 |
%{?cmake_path:export PATH=%{cmake_path}:$PATH} |
461 |
%{?rustflags:export RUSTFLAGS="%{rustflags}"} |
462 |
|
463 |
# We're going to override --libdir when configuring to get rustlib into a |
464 |
# common path, but we'll fix the shared libraries during install. |
465 |
%global common_libdir %{_prefix}/lib |
466 |
%global rustlibdir %{common_libdir}/rustlib |
467 |
|
468 |
%ifarch %{arm} %{ix86} s390x |
469 |
# full debuginfo is exhausting memory; just do libstd for now |
470 |
# https://github.com/rust-lang/rust/issues/45854 |
471 |
%if (0%{?fedora} && 0%{?fedora} < 27) || (0%{?rhel} && 0%{?rhel} <= 7) |
472 |
# Older rpmbuild didn't work with partial debuginfo coverage. |
473 |
%global debug_package %{nil} |
474 |
%define enable_debuginfo --disable-debuginfo --disable-debuginfo-only-std --disable-debuginfo-tools --disable-debuginfo-lines |
475 |
%else |
476 |
%define enable_debuginfo --enable-debuginfo --enable-debuginfo-only-std --disable-debuginfo-tools --disable-debuginfo-lines |
477 |
%endif |
478 |
%else |
479 |
%define enable_debuginfo --enable-debuginfo --disable-debuginfo-only-std --enable-debuginfo-tools --disable-debuginfo-lines |
480 |
%endif |
481 |
|
482 |
%configure --disable-option-checking \ |
483 |
--libdir=%{common_libdir} \ |
484 |
--build=%{rust_triple} --host=%{rust_triple} --target=%{rust_triple} \ |
485 |
--local-rust-root=%{local_rust_root} \ |
486 |
%{!?with_bundled_llvm: --llvm-root=%{llvm_root} \ |
487 |
%{!?llvm_has_filecheck: --disable-codegen-tests} \ |
488 |
%{!?with_llvm_static: --enable-llvm-link-shared } } \ |
489 |
--disable-rpath \ |
490 |
%{enable_debuginfo} \ |
491 |
--enable-extended \ |
492 |
--enable-vendor \ |
493 |
--enable-verbose-tests \ |
494 |
--release-channel=%{channel} |
495 |
|
496 |
%{python} ./x.py build |
497 |
%{python} ./x.py doc |
498 |
|
499 |
|
500 |
%install |
501 |
%{?cmake_path:export PATH=%{cmake_path}:$PATH} |
502 |
%{?rustflags:export RUSTFLAGS="%{rustflags}"} |
503 |
|
504 |
DESTDIR=%{buildroot} %{python} ./x.py install |
505 |
|
506 |
# Make sure the shared libraries are in the proper libdir |
507 |
%if "%{_libdir}" != "%{common_libdir}" |
508 |
mkdir -p %{buildroot}%{_libdir} |
509 |
find %{buildroot}%{common_libdir} -maxdepth 1 -type f -name '*.so' \ |
510 |
-exec mv -v -t %{buildroot}%{_libdir} '{}' '+' |
511 |
%endif |
512 |
|
513 |
# The shared libraries should be executable for debuginfo extraction. |
514 |
find %{buildroot}%{_libdir} -maxdepth 1 -type f -name '*.so' \ |
515 |
-exec chmod -v +x '{}' '+' |
516 |
|
517 |
# The libdir libraries are identical to those under rustlib/. It's easier on |
518 |
# library loading if we keep them in libdir, but we do need them in rustlib/ |
519 |
# to support dynamic linking for compiler plugins, so we'll symlink. |
520 |
(cd "%{buildroot}%{rustlibdir}/%{rust_triple}/lib" && |
521 |
find ../../../../%{_lib} -maxdepth 1 -name '*.so' | |
522 |
while read lib; do |
523 |
# make sure they're actually identical! |
524 |
cmp "$lib" "${lib##*/}" |
525 |
ln -v -f -s -t . "$lib" |
526 |
done) |
527 |
|
528 |
# Remove installer artifacts (manifests, uninstall scripts, etc.) |
529 |
find %{buildroot}%{rustlibdir} -maxdepth 1 -type f -exec rm -v '{}' '+' |
530 |
|
531 |
# Remove backup files from %%configure munging |
532 |
find %{buildroot}%{rustlibdir} -type f -name '*.orig' -exec rm -v '{}' '+' |
533 |
|
534 |
# https://fedoraproject.org/wiki/Changes/Make_ambiguous_python_shebangs_error |
535 |
# We don't actually need to ship any of those python scripts in rust-src anyway. |
536 |
find %{buildroot}%{rustlibdir}/src -type f -name '*.py' -exec rm -v '{}' '+' |
537 |
|
538 |
# FIXME: __os_install_post will strip the rlibs |
539 |
# -- should we find a way to preserve debuginfo? |
540 |
|
541 |
# Remove unwanted documentation files (we already package them) |
542 |
rm -f %{buildroot}%{_docdir}/%{name}/README.md |
543 |
rm -f %{buildroot}%{_docdir}/%{name}/COPYRIGHT |
544 |
rm -f %{buildroot}%{_docdir}/%{name}/LICENSE |
545 |
rm -f %{buildroot}%{_docdir}/%{name}/LICENSE-APACHE |
546 |
rm -f %{buildroot}%{_docdir}/%{name}/LICENSE-MIT |
547 |
rm -f %{buildroot}%{_docdir}/%{name}/LICENSE-THIRD-PARTY |
548 |
rm -f %{buildroot}%{_docdir}/%{name}/*.old |
549 |
|
550 |
# Sanitize the HTML documentation |
551 |
find %{buildroot}%{_docdir}/%{name}/html -empty -delete |
552 |
find %{buildroot}%{_docdir}/%{name}/html -type f -exec chmod -x '{}' '+' |
553 |
|
554 |
# Create the path for crate-devel packages |
555 |
mkdir -p %{buildroot}%{_datadir}/cargo/registry |
556 |
|
557 |
# Cargo no longer builds its own documentation |
558 |
# https://github.com/rust-lang/cargo/pull/4904 |
559 |
mkdir -p %{buildroot}%{_docdir}/cargo |
560 |
ln -sT ../rust/html/cargo/ %{buildroot}%{_docdir}/cargo/html |
561 |
|
562 |
%if %without lldb |
563 |
rm -f %{buildroot}%{_bindir}/rust-lldb |
564 |
rm -f %{buildroot}%{rustlibdir}/etc/lldb_*.py* |
565 |
%endif |
566 |
|
567 |
|
568 |
%check |
569 |
%{?cmake_path:export PATH=%{cmake_path}:$PATH} |
570 |
%{?rustflags:export RUSTFLAGS="%{rustflags}"} |
571 |
|
572 |
# The results are not stable on koji, so mask errors and just log it. |
573 |
%{python} ./x.py test --no-fail-fast || : |
574 |
%{python} ./x.py test --no-fail-fast cargo || : |
575 |
%{python} ./x.py test --no-fail-fast clippy || : |
576 |
%{python} ./x.py test --no-fail-fast rls || : |
577 |
%{python} ./x.py test --no-fail-fast rustfmt || : |
578 |
|
579 |
|
580 |
%{?ldconfig_scriptlets} |
581 |
|
582 |
|
583 |
%files |
584 |
%license COPYRIGHT LICENSE-APACHE LICENSE-MIT |
585 |
%license vendor/backtrace-sys/src/libbacktrace/LICENSE-libbacktrace |
586 |
%doc README.md |
587 |
%{_bindir}/rustc |
588 |
%{_bindir}/rustdoc |
589 |
%{_libdir}/*.so |
590 |
%{_mandir}/man1/rustc.1* |
591 |
%{_mandir}/man1/rustdoc.1* |
592 |
%dir %{rustlibdir} |
593 |
%dir %{rustlibdir}/%{rust_triple} |
594 |
%dir %{rustlibdir}/%{rust_triple}/lib |
595 |
%{rustlibdir}/%{rust_triple}/lib/*.so |
596 |
%{rustlibdir}/%{rust_triple}/codegen-backends/ |
597 |
%exclude %{_bindir}/*miri |
598 |
|
599 |
|
600 |
%files std-static |
601 |
%dir %{rustlibdir} |
602 |
%dir %{rustlibdir}/%{rust_triple} |
603 |
%dir %{rustlibdir}/%{rust_triple}/lib |
604 |
%{rustlibdir}/%{rust_triple}/lib/*.rlib |
605 |
|
606 |
|
607 |
%files debugger-common |
608 |
%dir %{rustlibdir} |
609 |
%dir %{rustlibdir}/etc |
610 |
%{rustlibdir}/etc/debugger_*.py* |
611 |
|
612 |
|
613 |
%files gdb |
614 |
%{_bindir}/rust-gdb |
615 |
%{rustlibdir}/etc/gdb_*.py* |
616 |
%exclude %{_bindir}/rust-gdbgui |
617 |
|
618 |
|
619 |
%if %with lldb |
620 |
%files lldb |
621 |
%{_bindir}/rust-lldb |
622 |
%{rustlibdir}/etc/lldb_*.py* |
623 |
%endif |
624 |
|
625 |
|
626 |
%files doc |
627 |
%docdir %{_docdir}/%{name} |
628 |
%dir %{_docdir}/%{name} |
629 |
%dir %{_docdir}/%{name}/html |
630 |
%{_docdir}/%{name}/html/*/ |
631 |
%{_docdir}/%{name}/html/*.html |
632 |
%{_docdir}/%{name}/html/*.css |
633 |
%{_docdir}/%{name}/html/*.ico |
634 |
%{_docdir}/%{name}/html/*.js |
635 |
%{_docdir}/%{name}/html/*.png |
636 |
%{_docdir}/%{name}/html/*.svg |
637 |
%{_docdir}/%{name}/html/*.woff |
638 |
%license %{_docdir}/%{name}/html/*.txt |
639 |
|
640 |
|
641 |
%files -n cargo |
642 |
%license src/tools/cargo/LICENSE-APACHE src/tools/cargo/LICENSE-MIT src/tools/cargo/LICENSE-THIRD-PARTY |
643 |
%doc src/tools/cargo/README.md |
644 |
%{_bindir}/cargo |
645 |
%{_mandir}/man1/cargo*.1* |
646 |
%{_sysconfdir}/bash_completion.d/cargo |
647 |
%{_datadir}/zsh/site-functions/_cargo |
648 |
%dir %{_datadir}/cargo |
649 |
%dir %{_datadir}/cargo/registry |
650 |
|
651 |
|
652 |
%files -n cargo-doc |
653 |
%docdir %{_docdir}/cargo |
654 |
%dir %{_docdir}/cargo |
655 |
%{_docdir}/cargo/html |
656 |
|
657 |
|
658 |
%files -n rustfmt |
659 |
%{_bindir}/rustfmt |
660 |
%{_bindir}/cargo-fmt |
661 |
%doc src/tools/rustfmt/{README,CHANGELOG,Configurations}.md |
662 |
%license src/tools/rustfmt/LICENSE-{APACHE,MIT} |
663 |
|
664 |
|
665 |
%files -n rls |
666 |
%{_bindir}/rls |
667 |
%doc src/tools/rls/{README.md,COPYRIGHT,debugging.md} |
668 |
%license src/tools/rls/LICENSE-{APACHE,MIT} |
669 |
|
670 |
|
671 |
%files -n clippy |
672 |
%{_bindir}/cargo-clippy |
673 |
%{_bindir}/clippy-driver |
674 |
%doc src/tools/clippy/{README.md,CHANGELOG.md} |
675 |
%license src/tools/clippy/LICENSE-{APACHE,MIT} |
676 |
|
677 |
|
678 |
%files src |
679 |
%dir %{rustlibdir} |
680 |
%{rustlibdir}/src |
681 |
|
682 |
|
683 |
%files analysis |
684 |
%{rustlibdir}/%{rust_triple}/analysis/ |