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_without 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.1 |
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 |
%ifarch %{ix86} |
254 |
# i686 fails to link some static symbols with ThinLTO: |
255 |
# https://bugzilla.redhat.com/show_bug.cgi?id=1701339 |
256 |
# https://github.com/rust-lang/rust/issues/60184 |
257 |
# and since this affects rustbook built with *stage0*, we can't just patch it. |
258 |
# Workaround: using a single codegen unit bypasses ThinLTO. |
259 |
%global rustflags %{rustflags} -Ccodegen-units=1 |
260 |
%endif |
261 |
|
262 |
%if %{without bundled_llvm} |
263 |
%if "%{llvm_root}" == "%{_prefix}" || 0%{?scl:1} |
264 |
%global llvm_has_filecheck 1 |
265 |
%endif |
266 |
%endif |
267 |
|
268 |
%description |
269 |
Rust is a systems programming language that runs blazingly fast, prevents |
270 |
segfaults, and guarantees thread safety. |
271 |
|
272 |
This package includes the Rust compiler and documentation generator. |
273 |
|
274 |
|
275 |
%package std-static |
276 |
Summary: Standard library for Rust |
277 |
|
278 |
%description std-static |
279 |
This package includes the standard libraries for building applications |
280 |
written in Rust. |
281 |
|
282 |
|
283 |
%package debugger-common |
284 |
Summary: Common debugger pretty printers for Rust |
285 |
BuildArch: noarch |
286 |
|
287 |
%description debugger-common |
288 |
This package includes the common functionality for %{name}-gdb and %{name}-lldb. |
289 |
|
290 |
|
291 |
%package gdb |
292 |
Summary: GDB pretty printers for Rust |
293 |
BuildArch: noarch |
294 |
Requires: gdb |
295 |
Requires: %{name}-debugger-common = %{version}-%{release} |
296 |
|
297 |
%description gdb |
298 |
This package includes the rust-gdb script, which allows easier debugging of Rust |
299 |
programs. |
300 |
|
301 |
|
302 |
%if %with lldb |
303 |
|
304 |
%package lldb |
305 |
Summary: LLDB pretty printers for Rust |
306 |
|
307 |
# It could be noarch, but lldb has limited availability |
308 |
#BuildArch: noarch |
309 |
|
310 |
Requires: lldb |
311 |
Requires: python2-lldb |
312 |
Requires: %{name}-debugger-common = %{version}-%{release} |
313 |
|
314 |
%description lldb |
315 |
This package includes the rust-lldb script, which allows easier debugging of Rust |
316 |
programs. |
317 |
|
318 |
%endif |
319 |
|
320 |
|
321 |
%package doc |
322 |
Summary: Documentation for Rust |
323 |
# NOT BuildArch: noarch |
324 |
# Note, while docs are mostly noarch, some things do vary by target_arch. |
325 |
# Koji will fail the build in rpmdiff if two architectures build a noarch |
326 |
# subpackage differently, so instead we have to keep its arch. |
327 |
|
328 |
%description doc |
329 |
This package includes HTML documentation for the Rust programming language and |
330 |
its standard library. |
331 |
|
332 |
|
333 |
%package -n cargo |
334 |
Summary: Rust's package manager and build tool |
335 |
%if %with bundled_libgit2 |
336 |
Provides: bundled(libgit2) = 0.27 |
337 |
%endif |
338 |
%if %with bundled_libssh2 |
339 |
Provides: bundled(libssh2) = 1.8.1~dev |
340 |
%endif |
341 |
# For tests: |
342 |
BuildRequires: git |
343 |
# Cargo is not much use without Rust |
344 |
Requires: rust |
345 |
|
346 |
%description -n cargo |
347 |
Cargo is a tool that allows Rust projects to declare their various dependencies |
348 |
and ensure that you'll always get a repeatable build. |
349 |
|
350 |
|
351 |
%package -n cargo-doc |
352 |
Summary: Documentation for Cargo |
353 |
BuildArch: noarch |
354 |
# Cargo no longer builds its own documentation |
355 |
# https://github.com/rust-lang/cargo/pull/4904 |
356 |
Requires: rust-doc = %{version}-%{release} |
357 |
|
358 |
%description -n cargo-doc |
359 |
This package includes HTML documentation for Cargo. |
360 |
|
361 |
|
362 |
%package -n rustfmt |
363 |
Summary: Tool to find and fix Rust formatting issues |
364 |
Requires: cargo |
365 |
|
366 |
# The component/package was rustfmt-preview until Rust 1.31. |
367 |
Obsoletes: rustfmt-preview < 1.0.0 |
368 |
Provides: rustfmt-preview = %{version}-%{release} |
369 |
|
370 |
%description -n rustfmt |
371 |
A tool for formatting Rust code according to style guidelines. |
372 |
|
373 |
|
374 |
%package -n rls |
375 |
Summary: Rust Language Server for IDE integration |
376 |
%if %with bundled_libgit2 |
377 |
Provides: bundled(libgit2) = 0.27 |
378 |
%endif |
379 |
%if %with bundled_libssh2 |
380 |
Provides: bundled(libssh2) = 1.8.1~dev |
381 |
%endif |
382 |
Requires: rust-analysis |
383 |
# /usr/bin/rls is dynamically linked against internal rustc libs |
384 |
Requires: %{name}%{?_isa} = %{version}-%{release} |
385 |
|
386 |
# The component/package was rls-preview until Rust 1.31. |
387 |
Obsoletes: rls-preview < 1.31.6 |
388 |
Provides: rls-preview = %{version}-%{release} |
389 |
|
390 |
%description -n rls |
391 |
The Rust Language Server provides a server that runs in the background, |
392 |
providing IDEs, editors, and other tools with information about Rust programs. |
393 |
It supports functionality such as 'goto definition', symbol search, |
394 |
reformatting, and code completion, and enables renaming and refactorings. |
395 |
|
396 |
|
397 |
%package -n clippy |
398 |
Summary: Lints to catch common mistakes and improve your Rust code |
399 |
Requires: cargo |
400 |
# /usr/bin/clippy-driver is dynamically linked against internal rustc libs |
401 |
Requires: %{name}%{?_isa} = %{version}-%{release} |
402 |
|
403 |
# The component/package was clippy-preview until Rust 1.31. |
404 |
Obsoletes: clippy-preview <= 0.0.212 |
405 |
Provides: clippy-preview = %{version}-%{release} |
406 |
|
407 |
%description -n clippy |
408 |
A collection of lints to catch common mistakes and improve your Rust code. |
409 |
|
410 |
|
411 |
%package src |
412 |
Summary: Sources for the Rust standard library |
413 |
BuildArch: noarch |
414 |
|
415 |
%description src |
416 |
This package includes source files for the Rust standard library. It may be |
417 |
useful as a reference for code completion tools in various editors. |
418 |
|
419 |
|
420 |
%package analysis |
421 |
Summary: Compiler analysis data for the Rust standard library |
422 |
Requires: rust-std-static%{?_isa} = %{version}-%{release} |
423 |
|
424 |
%description analysis |
425 |
This package contains analysis data files produced with rustc's -Zsave-analysis |
426 |
feature for the Rust standard library. The RLS (Rust Language Server) uses this |
427 |
data to provide information about the Rust standard library. |
428 |
|
429 |
|
430 |
%prep |
431 |
|
432 |
%ifarch %{bootstrap_arches} |
433 |
%setup -q -n %{bootstrap_root} -T -b %{bootstrap_source} |
434 |
./install.sh --components=cargo,rustc,rust-std-%{rust_triple} \ |
435 |
--prefix=%{local_rust_root} --disable-ldconfig |
436 |
test -f '%{local_rust_root}/bin/cargo' |
437 |
test -f '%{local_rust_root}/bin/rustc' |
438 |
%endif |
439 |
|
440 |
%setup -q -n %{rustc_package} |
441 |
|
442 |
%patch1 -p1 -R |
443 |
%patch2 -p1 |
444 |
%patch3 -p1 |
445 |
|
446 |
%if "%{python}" == "python3" |
447 |
sed -i.try-py3 -e '/try python2.7/i try python3 "$@"' ./configure |
448 |
%endif |
449 |
|
450 |
%if %without bundled_llvm |
451 |
rm -rf src/llvm-project/ |
452 |
%endif |
453 |
|
454 |
# We never enable emscripten. |
455 |
rm -rf src/llvm-emscripten/ |
456 |
|
457 |
# rename bundled license for packaging |
458 |
cp -a vendor/backtrace-sys/src/libbacktrace/LICENSE{,-libbacktrace} |
459 |
|
460 |
%if %{with bundled_llvm} && 0%{?epel} |
461 |
mkdir -p cmake-bin |
462 |
ln -s /usr/bin/cmake3 cmake-bin/cmake |
463 |
%global cmake_path $PWD/cmake-bin |
464 |
%endif |
465 |
|
466 |
%if %{without bundled_llvm} && %{with llvm_static} |
467 |
# Static linking to distro LLVM needs to add -lffi |
468 |
# https://github.com/rust-lang/rust/issues/34486 |
469 |
sed -i.ffi -e '$a #[link(name = "ffi")] extern {}' \ |
470 |
src/librustc_llvm/lib.rs |
471 |
%endif |
472 |
|
473 |
# The configure macro will modify some autoconf-related files, which upsets |
474 |
# cargo when it tries to verify checksums in those files. If we just truncate |
475 |
# that file list, cargo won't have anything to complain about. |
476 |
find vendor -name .cargo-checksum.json \ |
477 |
-exec sed -i.uncheck -e 's/"files":{[^}]*}/"files":{ }/' '{}' '+' |
478 |
|
479 |
|
480 |
%build |
481 |
|
482 |
%if %without bundled_libgit2 |
483 |
# convince libgit2-sys to use the distro libgit2 |
484 |
export LIBGIT2_SYS_USE_PKG_CONFIG=1 |
485 |
%endif |
486 |
|
487 |
%if %without bundled_libssh2 |
488 |
# convince libssh2-sys to use the distro libssh2 |
489 |
export LIBSSH2_SYS_USE_PKG_CONFIG=1 |
490 |
%endif |
491 |
|
492 |
%{?cmake_path:export PATH=%{cmake_path}:$PATH} |
493 |
%{?rustflags:export RUSTFLAGS="%{rustflags}"} |
494 |
|
495 |
# We're going to override --libdir when configuring to get rustlib into a |
496 |
# common path, but we'll fix the shared libraries during install. |
497 |
%global common_libdir %{_prefix}/lib |
498 |
%global rustlibdir %{common_libdir}/rustlib |
499 |
|
500 |
%ifarch %{arm} %{ix86} s390x |
501 |
# full debuginfo is exhausting memory; just do libstd for now |
502 |
# https://github.com/rust-lang/rust/issues/45854 |
503 |
%if (0%{?fedora} && 0%{?fedora} < 27) || (0%{?rhel} && 0%{?rhel} <= 7) |
504 |
# Older rpmbuild didn't work with partial debuginfo coverage. |
505 |
%global debug_package %{nil} |
506 |
%define enable_debuginfo --disable-debuginfo --disable-debuginfo-only-std --disable-debuginfo-tools --disable-debuginfo-lines |
507 |
%else |
508 |
%define enable_debuginfo --enable-debuginfo --enable-debuginfo-only-std --disable-debuginfo-tools --disable-debuginfo-lines |
509 |
%endif |
510 |
%else |
511 |
%define enable_debuginfo --enable-debuginfo --disable-debuginfo-only-std --enable-debuginfo-tools --disable-debuginfo-lines |
512 |
%endif |
513 |
|
514 |
%configure --disable-option-checking \ |
515 |
--libdir=%{common_libdir} \ |
516 |
--build=%{rust_triple} --host=%{rust_triple} --target=%{target_triple} \ |
517 |
--local-rust-root=%{local_rust_root} \ |
518 |
%{!?with_bundled_llvm: --llvm-root=%{llvm_root} \ |
519 |
%{!?llvm_has_filecheck: --disable-codegen-tests} \ |
520 |
%{!?with_llvm_static: --enable-llvm-link-shared } } \ |
521 |
--disable-rpath \ |
522 |
%{enable_debuginfo} \ |
523 |
--enable-extended \ |
524 |
--enable-vendor \ |
525 |
--enable-verbose-tests \ |
526 |
--set rust.codegen-units-std=1 \ |
527 |
--release-channel=%{channel} |
528 |
|
529 |
%{python} ./x.py build |
530 |
%{python} ./x.py doc |
531 |
|
532 |
|
533 |
%install |
534 |
%{?cmake_path:export PATH=%{cmake_path}:$PATH} |
535 |
%{?rustflags:export RUSTFLAGS="%{rustflags}"} |
536 |
|
537 |
DESTDIR=%{buildroot} %{python} ./x.py install |
538 |
|
539 |
# Make sure the shared libraries are in the proper libdir |
540 |
%if "%{_libdir}" != "%{common_libdir}" |
541 |
mkdir -p %{buildroot}%{_libdir} |
542 |
find %{buildroot}%{common_libdir} -maxdepth 1 -type f -name '*.so' \ |
543 |
-exec mv -v -t %{buildroot}%{_libdir} '{}' '+' |
544 |
%endif |
545 |
|
546 |
# The shared libraries should be executable for debuginfo extraction. |
547 |
find %{buildroot}%{_libdir} -maxdepth 1 -type f -name '*.so' \ |
548 |
-exec chmod -v +x '{}' '+' |
549 |
|
550 |
# The libdir libraries are identical to those under rustlib/. It's easier on |
551 |
# library loading if we keep them in libdir, but we do need them in rustlib/ |
552 |
# to support dynamic linking for compiler plugins, so we'll symlink. |
553 |
(cd "%{buildroot}%{rustlibdir}/%{rust_triple}/lib" && |
554 |
find ../../../../%{_lib} -maxdepth 1 -name '*.so' | |
555 |
while read lib; do |
556 |
# make sure they're actually identical! |
557 |
cmp "$lib" "${lib##*/}" |
558 |
ln -v -f -s -t . "$lib" |
559 |
done) |
560 |
|
561 |
# Remove installer artifacts (manifests, uninstall scripts, etc.) |
562 |
find %{buildroot}%{rustlibdir} -maxdepth 1 -type f -exec rm -v '{}' '+' |
563 |
|
564 |
# Remove backup files from %%configure munging |
565 |
find %{buildroot}%{rustlibdir} -type f -name '*.orig' -exec rm -v '{}' '+' |
566 |
|
567 |
# https://fedoraproject.org/wiki/Changes/Make_ambiguous_python_shebangs_error |
568 |
# We don't actually need to ship any of those python scripts in rust-src anyway. |
569 |
find %{buildroot}%{rustlibdir}/src -type f -name '*.py' -exec rm -v '{}' '+' |
570 |
|
571 |
# FIXME: __os_install_post will strip the rlibs |
572 |
# -- should we find a way to preserve debuginfo? |
573 |
|
574 |
# Remove unwanted documentation files (we already package them) |
575 |
rm -f %{buildroot}%{_docdir}/%{name}/README.md |
576 |
rm -f %{buildroot}%{_docdir}/%{name}/COPYRIGHT |
577 |
rm -f %{buildroot}%{_docdir}/%{name}/LICENSE |
578 |
rm -f %{buildroot}%{_docdir}/%{name}/LICENSE-APACHE |
579 |
rm -f %{buildroot}%{_docdir}/%{name}/LICENSE-MIT |
580 |
rm -f %{buildroot}%{_docdir}/%{name}/LICENSE-THIRD-PARTY |
581 |
rm -f %{buildroot}%{_docdir}/%{name}/*.old |
582 |
|
583 |
# Sanitize the HTML documentation |
584 |
find %{buildroot}%{_docdir}/%{name}/html -empty -delete |
585 |
find %{buildroot}%{_docdir}/%{name}/html -type f -exec chmod -x '{}' '+' |
586 |
|
587 |
# Create the path for crate-devel packages |
588 |
mkdir -p %{buildroot}%{_datadir}/cargo/registry |
589 |
|
590 |
# Cargo no longer builds its own documentation |
591 |
# https://github.com/rust-lang/cargo/pull/4904 |
592 |
mkdir -p %{buildroot}%{_docdir}/cargo |
593 |
ln -sT ../rust/html/cargo/ %{buildroot}%{_docdir}/cargo/html |
594 |
|
595 |
%if %without lldb |
596 |
rm -f %{buildroot}%{_bindir}/rust-lldb |
597 |
rm -f %{buildroot}%{rustlibdir}/etc/lldb_*.py* |
598 |
%endif |
599 |
|
600 |
|
601 |
%check |
602 |
%{?cmake_path:export PATH=%{cmake_path}:$PATH} |
603 |
%{?rustflags:export RUSTFLAGS="%{rustflags}"} |
604 |
|
605 |
# The results are not stable on koji, so mask errors and just log it. |
606 |
%{python} ./x.py test --no-fail-fast || : |
607 |
%{python} ./x.py test --no-fail-fast cargo || : |
608 |
%{python} ./x.py test --no-fail-fast clippy || : |
609 |
%{python} ./x.py test --no-fail-fast rls || : |
610 |
%{python} ./x.py test --no-fail-fast rustfmt || : |
611 |
|
612 |
|
613 |
%{?ldconfig_scriptlets} |
614 |
|
615 |
|
616 |
%files |
617 |
%license COPYRIGHT LICENSE-APACHE LICENSE-MIT |
618 |
%license vendor/backtrace-sys/src/libbacktrace/LICENSE-libbacktrace |
619 |
%doc README.md |
620 |
%{_bindir}/rustc |
621 |
%{_bindir}/rustdoc |
622 |
%{_libdir}/*.so |
623 |
%{_mandir}/man1/rustc.1* |
624 |
%{_mandir}/man1/rustdoc.1* |
625 |
%dir %{rustlibdir} |
626 |
%dir %{rustlibdir}/%{rust_triple} |
627 |
%dir %{rustlibdir}/%{rust_triple}/lib |
628 |
%{rustlibdir}/%{rust_triple}/lib/*.so |
629 |
%{rustlibdir}/%{rust_triple}/codegen-backends/ |
630 |
%if %defined bootstrap_build_arch |
631 |
%dir %{rustlibdir}/%{target_triple} |
632 |
%dir %{rustlibdir}/%{target_triple}/lib |
633 |
%{rustlibdir}/%{target_triple}/lib/*.so |
634 |
%endif |
635 |
%exclude %{_bindir}/*miri |
636 |
|
637 |
|
638 |
%files std-static |
639 |
%dir %{rustlibdir} |
640 |
%dir %{rustlibdir}/%{rust_triple} |
641 |
%dir %{rustlibdir}/%{rust_triple}/lib |
642 |
%{rustlibdir}/%{rust_triple}/lib/*.rlib |
643 |
%if %defined bootstrap_build_arch |
644 |
%dir %{rustlibdir}/%{target_triple} |
645 |
%dir %{rustlibdir}/%{target_triple}/lib |
646 |
%{rustlibdir}/%{target_triple}/lib/*.rlib |
647 |
%endif |
648 |
|
649 |
|
650 |
%files debugger-common |
651 |
%dir %{rustlibdir} |
652 |
%dir %{rustlibdir}/etc |
653 |
%{rustlibdir}/etc/debugger_*.py* |
654 |
|
655 |
|
656 |
%files gdb |
657 |
%{_bindir}/rust-gdb |
658 |
%{rustlibdir}/etc/gdb_*.py* |
659 |
%exclude %{_bindir}/rust-gdbgui |
660 |
|
661 |
|
662 |
%if %with lldb |
663 |
%files lldb |
664 |
%{_bindir}/rust-lldb |
665 |
%{rustlibdir}/etc/lldb_*.py* |
666 |
%endif |
667 |
|
668 |
|
669 |
%files doc |
670 |
%docdir %{_docdir}/%{name} |
671 |
%dir %{_docdir}/%{name} |
672 |
%dir %{_docdir}/%{name}/html |
673 |
%{_docdir}/%{name}/html/*/ |
674 |
%{_docdir}/%{name}/html/*.html |
675 |
%{_docdir}/%{name}/html/*.css |
676 |
%{_docdir}/%{name}/html/*.ico |
677 |
%{_docdir}/%{name}/html/*.js |
678 |
%{_docdir}/%{name}/html/*.png |
679 |
%{_docdir}/%{name}/html/*.svg |
680 |
%{_docdir}/%{name}/html/*.woff |
681 |
%license %{_docdir}/%{name}/html/*.txt |
682 |
|
683 |
|
684 |
%files -n cargo |
685 |
%license src/tools/cargo/LICENSE-APACHE src/tools/cargo/LICENSE-MIT src/tools/cargo/LICENSE-THIRD-PARTY |
686 |
%doc src/tools/cargo/README.md |
687 |
%{_bindir}/cargo |
688 |
%{_mandir}/man1/cargo*.1* |
689 |
%{_sysconfdir}/bash_completion.d/cargo |
690 |
%{_datadir}/zsh/site-functions/_cargo |
691 |
%dir %{_datadir}/cargo |
692 |
%dir %{_datadir}/cargo/registry |
693 |
|
694 |
|
695 |
%files -n cargo-doc |
696 |
%docdir %{_docdir}/cargo |
697 |
%dir %{_docdir}/cargo |
698 |
%{_docdir}/cargo/html |
699 |
|
700 |
|
701 |
%files -n rustfmt |
702 |
%{_bindir}/rustfmt |
703 |
%{_bindir}/cargo-fmt |
704 |
%doc src/tools/rustfmt/{README,CHANGELOG,Configurations}.md |
705 |
%license src/tools/rustfmt/LICENSE-{APACHE,MIT} |
706 |
|
707 |
|
708 |
%files -n rls |
709 |
%{_bindir}/rls |
710 |
%doc src/tools/rls/{README.md,COPYRIGHT,debugging.md} |
711 |
%license src/tools/rls/LICENSE-{APACHE,MIT} |
712 |
|
713 |
|
714 |
%files -n clippy |
715 |
%{_bindir}/cargo-clippy |
716 |
%{_bindir}/clippy-driver |
717 |
%doc src/tools/clippy/{README.md,CHANGELOG.md} |
718 |
%license src/tools/clippy/LICENSE-{APACHE,MIT} |
719 |
|
720 |
|
721 |
%files src |
722 |
%dir %{rustlibdir} |
723 |
%{rustlibdir}/src |
724 |
|
725 |
|
726 |
%files analysis |
727 |
%{rustlibdir}/%{rust_triple}/analysis/ |
728 |
%if %defined bootstrap_build_arch |
729 |
%{rustlibdir}/%{target_triple}/analysis/ |
730 |
%endif |