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