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