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