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