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