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