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