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