1 |
akien |
1085562 |
# (akien) This package is synced with Fedora / Josh Stone's spec. |
2 |
akien |
1057871 |
# 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 |
thatsamguy |
617730 |
|
5 |
thatsamguy |
494699 |
|
6 |
akien |
1076532 |
# Only x86_64 and i686 are Tier 1 platforms at this time. |
7 |
|
|
# https://forge.rust-lang.org/platform-support.html |
8 |
akien |
1192969 |
%global rust_arches x86_64 i686 i586 armv7hl aarch64 ppc64 ppc64le s390x |
9 |
akien |
1076532 |
|
10 |
akien |
1057871 |
# The channel can be stable, beta, or nightly |
11 |
|
|
%{!?channel: %global channel stable} |
12 |
thatsamguy |
494699 |
|
13 |
akien |
1057871 |
# 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 |
akien |
1239841 |
# Note that cargo matches the program version here, not its crate version. |
17 |
akien |
1603779 |
%global bootstrap_rust 1.43.1 |
18 |
|
|
%global bootstrap_cargo 1.43.1 |
19 |
|
|
%global bootstrap_channel 1.43.1 |
20 |
|
|
%global bootstrap_date 2020-05-07 |
21 |
akien |
1057871 |
|
22 |
akien |
1076532 |
# Only the specified arches will use bootstrap binaries. |
23 |
|
|
#global bootstrap_arches %%{rust_arches} |
24 |
|
|
|
25 |
akien |
1396907 |
# 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 |
akien |
1397010 |
%bcond_with bootstrap_i586 |
30 |
akien |
1396907 |
%if %with bootstrap_i586 |
31 |
|
|
%ifarch i586 |
32 |
|
|
%global bootstrap_build_arch i686 |
33 |
|
|
%endif |
34 |
|
|
%endif |
35 |
|
|
|
36 |
akien |
1215099 |
# Using llvm-static may be helpful as an opt-in, e.g. to aid LLVM rebases. |
37 |
akien |
1062905 |
%bcond_with llvm_static |
38 |
|
|
|
39 |
akien |
1085562 |
# We can also choose to just use Rust's bundled LLVM, in case the system LLVM |
40 |
akien |
1544256 |
# is insufficient. Rust currently requires LLVM 7.0+. |
41 |
akien |
1449358 |
%if 0%{?rhel} && !0%{?epel} |
42 |
|
|
# (akien) Hacks below are needed on mga's buildsystem when we have to rebootstrap llvm. |
43 |
akien |
1448837 |
# Bundled LLVM has underlinking issues: |
44 |
|
|
%global _disable_ld_no_undefined 1 |
45 |
akien |
1449358 |
%ifarch %{arm} %ix86 |
46 |
|
|
# Decrease debuginfo verbosity to reduce memory consumption during final library linking |
47 |
|
|
%global optflags %(echo %{optflags} | sed 's/-g /-g1 /') |
48 |
akien |
1448838 |
%endif |
49 |
akien |
1085562 |
%bcond_without bundled_llvm |
50 |
|
|
%else |
51 |
akien |
1448837 |
%bcond_with bundled_llvm |
52 |
akien |
1085562 |
%endif |
53 |
akien |
1076532 |
|
54 |
akien |
1239841 |
# libgit2-sys expects to use its bundled library, which is sometimes just a |
55 |
|
|
# snapshot of libgit2's master branch. This can mean the FFI declarations |
56 |
|
|
# won't match our released libgit2.so, e.g. having changed struct fields. |
57 |
|
|
# So, tread carefully if you toggle this... |
58 |
akien |
1228274 |
%bcond_without bundled_libgit2 |
59 |
|
|
|
60 |
akien |
1308362 |
%if 0%{?rhel} |
61 |
|
|
%bcond_without bundled_libssh2 |
62 |
|
|
%else |
63 |
|
|
%bcond_with bundled_libssh2 |
64 |
|
|
%endif |
65 |
|
|
|
66 |
akien |
1093561 |
# LLDB isn't available everywhere... |
67 |
akien |
1098716 |
%if !0%{?rhel} |
68 |
|
|
%bcond_without lldb |
69 |
|
|
%else |
70 |
akien |
1093561 |
%bcond_with lldb |
71 |
akien |
1098716 |
%endif |
72 |
akien |
1085562 |
|
73 |
akien |
1449358 |
%if 0%{?mageia} |
74 |
|
|
# (akien) Added by tv in mga8/rust 1.37.0. |
75 |
|
|
%global _python_bytecompile_extra 0 |
76 |
|
|
%endif |
77 |
|
|
|
78 |
akien |
1057871 |
Name: rust |
79 |
akien |
1603779 |
Version: 1.44.1 |
80 |
akien |
1603572 |
Release: %mkrel 1 |
81 |
akien |
1057871 |
Summary: The Rust Programming Language |
82 |
akien |
1085562 |
%if 0%{?mageia} |
83 |
akien |
1076533 |
Group: Development/Other |
84 |
akien |
1085562 |
%endif |
85 |
akien |
1228274 |
License: (ASL 2.0 or MIT) and (BSD and MIT) |
86 |
akien |
1057871 |
# ^ written as: (rust itself) and (bundled libraries) |
87 |
|
|
URL: https://www.rust-lang.org |
88 |
akien |
1076532 |
ExclusiveArch: %{rust_arches} |
89 |
akien |
1057871 |
|
90 |
|
|
%if "%{channel}" == "stable" |
91 |
akien |
1357861 |
%global rustc_package rustc-%{version}-src |
92 |
akien |
1057871 |
%else |
93 |
akien |
1085562 |
%global rustc_package rustc-%{channel}-src |
94 |
akien |
1057871 |
%endif |
95 |
akien |
1130315 |
Source0: https://static.rust-lang.org/dist/%{rustc_package}.tar.xz |
96 |
akien |
1057871 |
|
97 |
akien |
1603572 |
# https://github.com/rust-lang/rust/pull/71782 |
98 |
akien |
1603779 |
Patch1: rust-pr71782-Use-a-non-existent-test-path.patch |
99 |
akien |
1603572 |
|
100 |
akien |
1396907 |
# Upstream patch to fix typenum crate build on i386/i486/i586. |
101 |
akien |
1603572 |
Patch10: typenum-pr115-fix-log2-rounding-error.patch |
102 |
akien |
1396907 |
|
103 |
akien |
1076532 |
# Get the Rust triple for any arch. |
104 |
|
|
%{lua: function rust_triple(arch) |
105 |
|
|
local abi = "gnu" |
106 |
|
|
if arch == "armv7hl" then |
107 |
|
|
arch = "armv7" |
108 |
|
|
abi = "gnueabihf" |
109 |
|
|
elseif arch == "ppc64" then |
110 |
|
|
arch = "powerpc64" |
111 |
|
|
elseif arch == "ppc64le" then |
112 |
|
|
arch = "powerpc64le" |
113 |
|
|
end |
114 |
|
|
return arch.."-unknown-linux-"..abi |
115 |
|
|
end} |
116 |
pterjan |
1058164 |
|
117 |
akien |
1396907 |
%if %defined bootstrap_build_arch |
118 |
|
|
%global rust_triple %{lua: print(rust_triple(rpm.expand("%{bootstrap_build_arch}")))} |
119 |
|
|
%global target_triple %{lua: print(rust_triple(rpm.expand("%{_target_cpu}")))} |
120 |
|
|
%else |
121 |
akien |
1076532 |
%global rust_triple %{lua: print(rust_triple(rpm.expand("%{_target_cpu}")))} |
122 |
akien |
1396907 |
%global target_triple %{rust_triple} |
123 |
|
|
%endif |
124 |
akien |
1076532 |
|
125 |
|
|
%if %defined bootstrap_arches |
126 |
|
|
# For each bootstrap arch, add an additional binary Source. |
127 |
|
|
# Also define bootstrap_source just for the current target. |
128 |
|
|
%{lua: do |
129 |
|
|
local bootstrap_arches = {} |
130 |
|
|
for arch in string.gmatch(rpm.expand("%{bootstrap_arches}"), "%S+") do |
131 |
|
|
table.insert(bootstrap_arches, arch) |
132 |
|
|
end |
133 |
|
|
local base = rpm.expand("https://static.rust-lang.org/dist/%{bootstrap_date}" |
134 |
akien |
1093561 |
.."/rust-%{bootstrap_channel}") |
135 |
akien |
1076532 |
local target_arch = rpm.expand("%{_target_cpu}") |
136 |
|
|
for i, arch in ipairs(bootstrap_arches) do |
137 |
akien |
1151630 |
print(string.format("Source%d: %s-%s.tar.xz\n", |
138 |
akien |
1076532 |
i, base, rust_triple(arch))) |
139 |
|
|
if arch == target_arch then |
140 |
|
|
rpm.define("bootstrap_source "..i) |
141 |
|
|
end |
142 |
|
|
end |
143 |
|
|
end} |
144 |
akien |
1057871 |
%endif |
145 |
|
|
|
146 |
akien |
1076532 |
%ifarch %{bootstrap_arches} |
147 |
akien |
1093561 |
%global bootstrap_root rust-%{bootstrap_channel}-%{rust_triple} |
148 |
akien |
1107392 |
%global local_rust_root %{_builddir}/%{bootstrap_root}/usr |
149 |
akien |
1093561 |
Provides: bundled(%{name}-bootstrap) = %{bootstrap_rust} |
150 |
akien |
1057871 |
%else |
151 |
akien |
1093561 |
BuildRequires: cargo >= %{bootstrap_cargo} |
152 |
akien |
1215099 |
%if 0%{?fedora} >= 27 |
153 |
akien |
1357861 |
BuildRequires: (%{name} >= %{bootstrap_rust} with %{name} <= %{version}) |
154 |
akien |
1215099 |
%else |
155 |
akien |
1093561 |
BuildRequires: %{name} >= %{bootstrap_rust} |
156 |
akien |
1357861 |
BuildConflicts: %{name} > %{version} |
157 |
akien |
1215099 |
%endif |
158 |
akien |
1076532 |
%global local_rust_root %{_prefix} |
159 |
akien |
1057871 |
%endif |
160 |
|
|
|
161 |
|
|
BuildRequires: make |
162 |
|
|
BuildRequires: gcc |
163 |
|
|
BuildRequires: gcc-c++ |
164 |
akien |
1151628 |
BuildRequires: ncurses-devel |
165 |
akien |
1057871 |
BuildRequires: curl |
166 |
akien |
1228274 |
BuildRequires: pkgconfig(libcurl) |
167 |
|
|
BuildRequires: pkgconfig(liblzma) |
168 |
|
|
BuildRequires: pkgconfig(openssl) |
169 |
|
|
BuildRequires: pkgconfig(zlib) |
170 |
akien |
1057871 |
|
171 |
akien |
1308362 |
%if %without bundled_libgit2 |
172 |
akien |
1603779 |
BuildRequires: pkgconfig(libgit2) >= 1.0.0 |
173 |
akien |
1308362 |
%endif |
174 |
|
|
|
175 |
|
|
%if %without bundled_libssh2 |
176 |
|
|
# needs libssh2_userauth_publickey_frommemory |
177 |
|
|
BuildRequires: pkgconfig(libssh2) >= 1.6.0 |
178 |
|
|
%endif |
179 |
|
|
|
180 |
akien |
1208625 |
%if 0%{?rhel} && 0%{?rhel} <= 7 |
181 |
|
|
%global python python2 |
182 |
|
|
%else |
183 |
|
|
%global python python3 |
184 |
|
|
%endif |
185 |
|
|
BuildRequires: %{python} |
186 |
|
|
|
187 |
akien |
1098716 |
%if %with bundled_llvm |
188 |
akien |
1193979 |
BuildRequires: cmake3 >= 3.4.3 |
189 |
akien |
1603779 |
Provides: bundled(llvm) = 9.0.1 |
190 |
akien |
1085562 |
%else |
191 |
akien |
1239841 |
BuildRequires: cmake >= 2.8.11 |
192 |
akien |
1388944 |
%if 0%{?epel} |
193 |
akien |
1603779 |
%global llvm llvm9.0 |
194 |
akien |
1179950 |
%endif |
195 |
|
|
%if %defined llvm |
196 |
akien |
1098716 |
%global llvm_root %{_libdir}/%{llvm} |
197 |
|
|
%else |
198 |
|
|
%global llvm llvm |
199 |
|
|
%global llvm_root %{_prefix} |
200 |
|
|
%endif |
201 |
akien |
1603779 |
BuildRequires: %{llvm}-devel >= 8.0 |
202 |
akien |
1062905 |
%if %with llvm_static |
203 |
akien |
1098716 |
BuildRequires: %{llvm}-static |
204 |
akien |
1062905 |
BuildRequires: libffi-devel |
205 |
|
|
%endif |
206 |
akien |
1085562 |
%endif |
207 |
akien |
1062905 |
|
208 |
akien |
1058123 |
# make check needs "ps" for src/test/run-pass/wait-forked-but-failed-child.rs |
209 |
akien |
1057887 |
BuildRequires: procps-ng |
210 |
akien |
1057871 |
|
211 |
akien |
1093561 |
# debuginfo-gdb tests need gdb |
212 |
|
|
BuildRequires: gdb |
213 |
|
|
|
214 |
akien |
1057871 |
# TODO: work on unbundling these! |
215 |
akien |
1603779 |
Provides: bundled(libbacktrace) = 1.0.20200219 |
216 |
akien |
1057871 |
|
217 |
akien |
1066912 |
# Virtual provides for folks who attempt "dnf install rustc" |
218 |
akien |
1357861 |
Provides: rustc = %{version}-%{release} |
219 |
|
|
Provides: rustc%{?_isa} = %{version}-%{release} |
220 |
akien |
1066912 |
|
221 |
|
|
# Always require our exact standard library |
222 |
akien |
1357861 |
Requires: %{name}-std-static%{?_isa} = %{version}-%{release} |
223 |
akien |
1066912 |
|
224 |
akien |
1057871 |
# The C compiler is needed at runtime just for linking. Someday rustc might |
225 |
|
|
# invoke the linker directly, and then we'll only need binutils. |
226 |
|
|
# https://github.com/rust-lang/rust/issues/11937 |
227 |
akien |
1151630 |
%if 0%{?mageia} |
228 |
akien |
1057871 |
Requires: gcc |
229 |
akien |
1151630 |
%else |
230 |
|
|
Requires: /usr/bin/cc |
231 |
|
|
%endif |
232 |
akien |
1057871 |
|
233 |
|
|
# ALL Rust libraries are private, because they don't keep an ABI. |
234 |
akien |
1308362 |
%global _privatelibs lib(.*-[[:xdigit:]]{16}*|rustc.*)[.]so.* |
235 |
akien |
1057871 |
%global __provides_exclude ^(%{_privatelibs})$ |
236 |
|
|
%global __requires_exclude ^(%{_privatelibs})$ |
237 |
akien |
1251113 |
%global __provides_exclude_from ^(%{_docdir}|%{rustlibdir}/src)/.*$ |
238 |
|
|
%global __requires_exclude_from ^(%{_docdir}|%{rustlibdir}/src)/.*$ |
239 |
akien |
1057871 |
|
240 |
akien |
1085562 |
# While we don't want to encourage dynamic linking to Rust shared libraries, as |
241 |
|
|
# there's no stable ABI, we still need the unallocated metadata (.rustc) to |
242 |
|
|
# support custom-derive plugins like #[proc_macro_derive(Foo)]. But eu-strip is |
243 |
|
|
# very eager by default, so we have to limit it to -g, only debugging symbols. |
244 |
akien |
1172054 |
%if 0%{?fedora} >= 27 || 0%{?mageia} >= 7 |
245 |
akien |
1151628 |
# Newer find-debuginfo.sh supports --keep-section, which is preferable. rhbz1465997 |
246 |
|
|
%global _find_debuginfo_opts --keep-section .rustc |
247 |
|
|
%else |
248 |
akien |
1085562 |
%global _find_debuginfo_opts -g |
249 |
|
|
%undefine _include_minidebuginfo |
250 |
akien |
1151628 |
%endif |
251 |
akien |
1085562 |
|
252 |
akien |
1098716 |
# Use hardening ldflags. |
253 |
|
|
%global rustflags -Clink-arg=-Wl,-z,relro,-z,now |
254 |
|
|
|
255 |
akien |
1338691 |
%if %{without bundled_llvm} |
256 |
akien |
1370979 |
%if "%{llvm_root}" == "%{_prefix}" || 0%{?scl:1} |
257 |
akien |
1338691 |
%global llvm_has_filecheck 1 |
258 |
|
|
%endif |
259 |
akien |
1098716 |
%endif |
260 |
|
|
|
261 |
thatsamguy |
494699 |
%description |
262 |
akien |
1057871 |
Rust is a systems programming language that runs blazingly fast, prevents |
263 |
|
|
segfaults, and guarantees thread safety. |
264 |
thatsamguy |
494699 |
|
265 |
akien |
1066912 |
This package includes the Rust compiler and documentation generator. |
266 |
thatsamguy |
494699 |
|
267 |
akien |
1057871 |
|
268 |
akien |
1066912 |
%package std-static |
269 |
|
|
Summary: Standard library for Rust |
270 |
|
|
|
271 |
|
|
%description std-static |
272 |
|
|
This package includes the standard libraries for building applications |
273 |
|
|
written in Rust. |
274 |
|
|
|
275 |
|
|
|
276 |
akien |
1098716 |
%package debugger-common |
277 |
|
|
Summary: Common debugger pretty printers for Rust |
278 |
|
|
BuildArch: noarch |
279 |
|
|
|
280 |
|
|
%description debugger-common |
281 |
|
|
This package includes the common functionality for %{name}-gdb and %{name}-lldb. |
282 |
|
|
|
283 |
akien |
1239841 |
|
284 |
akien |
1057871 |
%package gdb |
285 |
|
|
Summary: GDB pretty printers for Rust |
286 |
|
|
BuildArch: noarch |
287 |
|
|
Requires: gdb |
288 |
akien |
1357861 |
Requires: %{name}-debugger-common = %{version}-%{release} |
289 |
akien |
1057871 |
|
290 |
akien |
1098861 |
%description gdb |
291 |
|
|
This package includes the rust-gdb script, which allows easier debugging of Rust |
292 |
|
|
programs. |
293 |
akien |
1057871 |
|
294 |
akien |
1098861 |
|
295 |
akien |
1093561 |
%if %with lldb |
296 |
|
|
|
297 |
|
|
%package lldb |
298 |
|
|
Summary: LLDB pretty printers for Rust |
299 |
akien |
1399021 |
BuildArch: noarch |
300 |
akien |
1093561 |
Requires: lldb |
301 |
akien |
1419248 |
%if 0%{?fedora} >= 31 |
302 |
|
|
Requires: python3-lldb |
303 |
|
|
%else |
304 |
akien |
1208625 |
Requires: python2-lldb |
305 |
akien |
1419248 |
%endif |
306 |
akien |
1357861 |
Requires: %{name}-debugger-common = %{version}-%{release} |
307 |
akien |
1093561 |
|
308 |
|
|
%description lldb |
309 |
|
|
This package includes the rust-lldb script, which allows easier debugging of Rust |
310 |
|
|
programs. |
311 |
|
|
|
312 |
|
|
%endif |
313 |
|
|
|
314 |
|
|
|
315 |
shlomif |
990941 |
%package doc |
316 |
akien |
1057871 |
Summary: Documentation for Rust |
317 |
|
|
# NOT BuildArch: noarch |
318 |
|
|
# Note, while docs are mostly noarch, some things do vary by target_arch. |
319 |
|
|
# Koji will fail the build in rpmdiff if two architectures build a noarch |
320 |
|
|
# subpackage differently, so instead we have to keep its arch. |
321 |
thatsamguy |
494699 |
|
322 |
shlomif |
990941 |
%description doc |
323 |
akien |
1057871 |
This package includes HTML documentation for the Rust programming language and |
324 |
|
|
its standard library. |
325 |
thatsamguy |
494699 |
|
326 |
akien |
1057871 |
|
327 |
akien |
1228274 |
%package -n cargo |
328 |
|
|
Summary: Rust's package manager and build tool |
329 |
|
|
%if %with bundled_libgit2 |
330 |
akien |
1603779 |
Provides: bundled(libgit2) = 1.0.0 |
331 |
akien |
1228274 |
%endif |
332 |
akien |
1308362 |
%if %with bundled_libssh2 |
333 |
akien |
1556061 |
Provides: bundled(libssh2) = 1.9.0~dev |
334 |
akien |
1308362 |
%endif |
335 |
akien |
1228274 |
# For tests: |
336 |
|
|
BuildRequires: git |
337 |
|
|
# Cargo is not much use without Rust |
338 |
|
|
Requires: rust |
339 |
|
|
|
340 |
tv |
1443439 |
# "cargo vendor" is a builtin command starting with 1.37. The Obsoletes and |
341 |
|
|
# Provides are mostly relevant to RHEL, but harmless to have on Fedora/etc. too |
342 |
|
|
Obsoletes: cargo-vendor <= 0.1.23 |
343 |
|
|
Provides: cargo-vendor = %{version}-%{release} |
344 |
|
|
|
345 |
akien |
1228274 |
%description -n cargo |
346 |
|
|
Cargo is a tool that allows Rust projects to declare their various dependencies |
347 |
|
|
and ensure that you'll always get a repeatable build. |
348 |
|
|
|
349 |
|
|
|
350 |
|
|
%package -n cargo-doc |
351 |
|
|
Summary: Documentation for Cargo |
352 |
|
|
BuildArch: noarch |
353 |
|
|
# Cargo no longer builds its own documentation |
354 |
|
|
# https://github.com/rust-lang/cargo/pull/4904 |
355 |
akien |
1357861 |
Requires: rust-doc = %{version}-%{release} |
356 |
akien |
1228274 |
|
357 |
|
|
%description -n cargo-doc |
358 |
|
|
This package includes HTML documentation for Cargo. |
359 |
|
|
|
360 |
|
|
|
361 |
akien |
1338691 |
%package -n rustfmt |
362 |
akien |
1215099 |
Summary: Tool to find and fix Rust formatting issues |
363 |
|
|
Requires: cargo |
364 |
|
|
|
365 |
akien |
1338691 |
# The component/package was rustfmt-preview until Rust 1.31. |
366 |
|
|
Obsoletes: rustfmt-preview < 1.0.0 |
367 |
akien |
1357861 |
Provides: rustfmt-preview = %{version}-%{release} |
368 |
akien |
1215099 |
|
369 |
akien |
1338691 |
%description -n rustfmt |
370 |
akien |
1215099 |
A tool for formatting Rust code according to style guidelines. |
371 |
|
|
|
372 |
|
|
|
373 |
akien |
1338691 |
%package -n rls |
374 |
akien |
1228274 |
Summary: Rust Language Server for IDE integration |
375 |
|
|
%if %with bundled_libgit2 |
376 |
akien |
1603779 |
Provides: bundled(libgit2) = 1.0.0 |
377 |
akien |
1228274 |
%endif |
378 |
akien |
1308362 |
%if %with bundled_libssh2 |
379 |
akien |
1556061 |
Provides: bundled(libssh2) = 1.9.0~dev |
380 |
akien |
1308362 |
%endif |
381 |
akien |
1228274 |
Requires: rust-analysis |
382 |
|
|
# /usr/bin/rls is dynamically linked against internal rustc libs |
383 |
akien |
1357861 |
Requires: %{name}%{?_isa} = %{version}-%{release} |
384 |
akien |
1228274 |
|
385 |
akien |
1338691 |
# The component/package was rls-preview until Rust 1.31. |
386 |
|
|
Obsoletes: rls-preview < 1.31.6 |
387 |
akien |
1357861 |
Provides: rls-preview = %{version}-%{release} |
388 |
akien |
1338691 |
|
389 |
|
|
%description -n rls |
390 |
akien |
1228274 |
The Rust Language Server provides a server that runs in the background, |
391 |
|
|
providing IDEs, editors, and other tools with information about Rust programs. |
392 |
|
|
It supports functionality such as 'goto definition', symbol search, |
393 |
|
|
reformatting, and code completion, and enables renaming and refactorings. |
394 |
|
|
|
395 |
|
|
|
396 |
akien |
1338691 |
%package -n clippy |
397 |
akien |
1308362 |
Summary: Lints to catch common mistakes and improve your Rust code |
398 |
|
|
Requires: cargo |
399 |
|
|
# /usr/bin/clippy-driver is dynamically linked against internal rustc libs |
400 |
akien |
1357861 |
Requires: %{name}%{?_isa} = %{version}-%{release} |
401 |
akien |
1308362 |
|
402 |
akien |
1338691 |
# The component/package was clippy-preview until Rust 1.31. |
403 |
|
|
Obsoletes: clippy-preview <= 0.0.212 |
404 |
akien |
1357861 |
Provides: clippy-preview = %{version}-%{release} |
405 |
akien |
1338691 |
|
406 |
|
|
%description -n clippy |
407 |
akien |
1308362 |
A collection of lints to catch common mistakes and improve your Rust code. |
408 |
|
|
|
409 |
|
|
|
410 |
akien |
1151630 |
%package src |
411 |
|
|
Summary: Sources for the Rust standard library |
412 |
|
|
BuildArch: noarch |
413 |
|
|
|
414 |
|
|
%description src |
415 |
|
|
This package includes source files for the Rust standard library. It may be |
416 |
|
|
useful as a reference for code completion tools in various editors. |
417 |
|
|
|
418 |
|
|
|
419 |
akien |
1228274 |
%package analysis |
420 |
|
|
Summary: Compiler analysis data for the Rust standard library |
421 |
akien |
1357861 |
Requires: rust-std-static%{?_isa} = %{version}-%{release} |
422 |
akien |
1228274 |
|
423 |
|
|
%description analysis |
424 |
|
|
This package contains analysis data files produced with rustc's -Zsave-analysis |
425 |
|
|
feature for the Rust standard library. The RLS (Rust Language Server) uses this |
426 |
|
|
data to provide information about the Rust standard library. |
427 |
|
|
|
428 |
|
|
|
429 |
thatsamguy |
494699 |
%prep |
430 |
|
|
|
431 |
akien |
1076532 |
%ifarch %{bootstrap_arches} |
432 |
|
|
%setup -q -n %{bootstrap_root} -T -b %{bootstrap_source} |
433 |
akien |
1093561 |
./install.sh --components=cargo,rustc,rust-std-%{rust_triple} \ |
434 |
akien |
1107392 |
--prefix=%{local_rust_root} --disable-ldconfig |
435 |
akien |
1093561 |
test -f '%{local_rust_root}/bin/cargo' |
436 |
akien |
1058123 |
test -f '%{local_rust_root}/bin/rustc' |
437 |
|
|
%endif |
438 |
akien |
1057871 |
|
439 |
akien |
1076532 |
%setup -q -n %{rustc_package} |
440 |
akien |
1058123 |
|
441 |
akien |
1603779 |
%patch1 -p1 |
442 |
akien |
1603572 |
%patch10 -p1 |
443 |
akien |
1338691 |
|
444 |
akien |
1208625 |
%if "%{python}" == "python3" |
445 |
|
|
sed -i.try-py3 -e '/try python2.7/i try python3 "$@"' ./configure |
446 |
|
|
%endif |
447 |
|
|
|
448 |
akien |
1085562 |
%if %without bundled_llvm |
449 |
akien |
1388944 |
rm -rf src/llvm-project/ |
450 |
akien |
1085562 |
%endif |
451 |
akien |
1057871 |
|
452 |
tv |
1443439 |
# Remove other unused vendored libraries |
453 |
|
|
rm -rf vendor/curl-sys/curl/ |
454 |
|
|
rm -rf vendor/jemalloc-sys/jemalloc/ |
455 |
|
|
rm -rf vendor/libz-sys/src/zlib/ |
456 |
|
|
rm -rf vendor/lzma-sys/xz-*/ |
457 |
|
|
rm -rf vendor/openssl-src/openssl/ |
458 |
|
|
|
459 |
|
|
%if %without bundled_libgit2 |
460 |
|
|
rm -rf vendor/libgit2-sys/libgit2/ |
461 |
|
|
%endif |
462 |
|
|
|
463 |
|
|
%if %without bundled_libssh2 |
464 |
|
|
rm -rf vendor/libssh2-sys/libssh2/ |
465 |
|
|
%endif |
466 |
|
|
|
467 |
|
|
# This only affects the transient rust-installer, but let it use our dynamic xz-libs |
468 |
|
|
sed -i.lzma -e '/LZMA_API_STATIC/d' src/bootstrap/tool.rs |
469 |
|
|
|
470 |
akien |
1370979 |
# rename bundled license for packaging |
471 |
|
|
cp -a vendor/backtrace-sys/src/libbacktrace/LICENSE{,-libbacktrace} |
472 |
akien |
1057871 |
|
473 |
akien |
1098716 |
%if %{with bundled_llvm} && 0%{?epel} |
474 |
akien |
1093561 |
mkdir -p cmake-bin |
475 |
|
|
ln -s /usr/bin/cmake3 cmake-bin/cmake |
476 |
|
|
%global cmake_path $PWD/cmake-bin |
477 |
akien |
1085562 |
%endif |
478 |
|
|
|
479 |
|
|
%if %{without bundled_llvm} && %{with llvm_static} |
480 |
akien |
1062905 |
# 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 |
akien |
1057871 |
|
486 |
akien |
1130315 |
# 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 |
akien |
1357861 |
find vendor -name .cargo-checksum.json \ |
490 |
akien |
1130315 |
-exec sed -i.uncheck -e 's/"files":{[^}]*}/"files":{ }/' '{}' '+' |
491 |
akien |
1093561 |
|
492 |
akien |
1449358 |
# Sometimes Rust sources start with #![...] attributes, and "smart" editors think |
493 |
|
|
# it's a shebang and make them executable. Then brp-mangle-shebangs gets upset... |
494 |
|
|
find -name '*.rs' -type f -perm /111 -exec chmod -v -x '{}' '+' |
495 |
akien |
1130315 |
|
496 |
akien |
1449358 |
|
497 |
thatsamguy |
494699 |
%build |
498 |
akien |
1603779 |
# This package fails to build with LTO due to undefined symbols. LTO |
499 |
|
|
# was disabled in OpenSuSE as well, but with no real explanation why |
500 |
|
|
# beyond the undefined symbols. It really should be investigated further. |
501 |
|
|
# Disable LTO |
502 |
|
|
%define _lto_cflags %{nil} |
503 |
akien |
1449358 |
|
504 |
akien |
1228274 |
%if %without bundled_libgit2 |
505 |
|
|
# convince libgit2-sys to use the distro libgit2 |
506 |
|
|
export LIBGIT2_SYS_USE_PKG_CONFIG=1 |
507 |
|
|
%endif |
508 |
|
|
|
509 |
akien |
1308362 |
%if %without bundled_libssh2 |
510 |
|
|
# convince libssh2-sys to use the distro libssh2 |
511 |
|
|
export LIBSSH2_SYS_USE_PKG_CONFIG=1 |
512 |
|
|
%endif |
513 |
|
|
|
514 |
akien |
1093561 |
%{?cmake_path:export PATH=%{cmake_path}:$PATH} |
515 |
akien |
1107392 |
%{?rustflags:export RUSTFLAGS="%{rustflags}"} |
516 |
akien |
1066912 |
|
517 |
akien |
1076532 |
# We're going to override --libdir when configuring to get rustlib into a |
518 |
akien |
1085562 |
# common path, but we'll fix the shared libraries during install. |
519 |
akien |
1076532 |
%global common_libdir %{_prefix}/lib |
520 |
|
|
%global rustlibdir %{common_libdir}/rustlib |
521 |
akien |
1066912 |
|
522 |
akien |
1463214 |
%ifarch aarch64 %{arm} %{ix86} s390x |
523 |
akien |
1179950 |
# full debuginfo is exhausting memory; just do libstd for now |
524 |
|
|
# https://github.com/rust-lang/rust/issues/45854 |
525 |
akien |
1449358 |
%if (0%{?fedora} && 0%{?fedora} < 27) || (0%{?rhel} && 0%{?rhel} <= 7) |
526 |
akien |
1325525 |
# Older rpmbuild didn't work with partial debuginfo coverage. |
527 |
|
|
%global debug_package %{nil} |
528 |
tv |
1443439 |
%define enable_debuginfo --debuginfo-level=0 |
529 |
akien |
1325525 |
%else |
530 |
tv |
1443439 |
%define enable_debuginfo --debuginfo-level=0 --debuginfo-level-std=2 |
531 |
akien |
1325525 |
%endif |
532 |
akien |
1179950 |
%else |
533 |
tv |
1443439 |
%define enable_debuginfo --debuginfo-level=2 |
534 |
akien |
1179950 |
%endif |
535 |
|
|
|
536 |
akien |
1399021 |
# We want the best optimization for std, but it caused problems for rpm-ostree |
537 |
|
|
# on ppc64le to have all of the compiler_builtins in a single object: |
538 |
|
|
# https://bugzilla.redhat.com/show_bug.cgi?id=1713090 |
539 |
|
|
%ifnarch %{power64} |
540 |
|
|
%define codegen_units_std --set rust.codegen-units-std=1 |
541 |
akien |
1556084 |
%endif |
542 |
akien |
1399021 |
|
543 |
wally |
1481298 |
%configure --disable-option-checking \ |
544 |
akien |
1066912 |
--libdir=%{common_libdir} \ |
545 |
akien |
1396907 |
--build=%{rust_triple} --host=%{rust_triple} --target=%{target_triple} \ |
546 |
tv |
1443439 |
--python=%{python} \ |
547 |
akien |
1215099 |
--local-rust-root=%{local_rust_root} \ |
548 |
akien |
1338691 |
%{!?with_bundled_llvm: --llvm-root=%{llvm_root} \ |
549 |
|
|
%{!?llvm_has_filecheck: --disable-codegen-tests} \ |
550 |
akien |
1085562 |
%{!?with_llvm_static: --enable-llvm-link-shared } } \ |
551 |
akien |
1057871 |
--disable-rpath \ |
552 |
akien |
1179950 |
%{enable_debuginfo} \ |
553 |
akien |
1228274 |
--enable-extended \ |
554 |
akien |
1093561 |
--enable-vendor \ |
555 |
akien |
1251113 |
--enable-verbose-tests \ |
556 |
akien |
1399021 |
%{?codegen_units_std} \ |
557 |
akien |
1208625 |
--release-channel=%{channel} |
558 |
thatsamguy |
494699 |
|
559 |
akien |
1208625 |
%{python} ./x.py build |
560 |
|
|
%{python} ./x.py doc |
561 |
thatsamguy |
494699 |
|
562 |
akien |
1057871 |
|
563 |
thatsamguy |
494699 |
%install |
564 |
akien |
1093561 |
%{?cmake_path:export PATH=%{cmake_path}:$PATH} |
565 |
akien |
1107392 |
%{?rustflags:export RUSTFLAGS="%{rustflags}"} |
566 |
thatsamguy |
494699 |
|
567 |
akien |
1208625 |
DESTDIR=%{buildroot} %{python} ./x.py install |
568 |
akien |
1093561 |
|
569 |
akien |
1107389 |
# Make sure the shared libraries are in the proper libdir |
570 |
|
|
%if "%{_libdir}" != "%{common_libdir}" |
571 |
|
|
mkdir -p %{buildroot}%{_libdir} |
572 |
|
|
find %{buildroot}%{common_libdir} -maxdepth 1 -type f -name '*.so' \ |
573 |
|
|
-exec mv -v -t %{buildroot}%{_libdir} '{}' '+' |
574 |
|
|
%endif |
575 |
akien |
1066912 |
|
576 |
akien |
1107389 |
# The shared libraries should be executable for debuginfo extraction. |
577 |
|
|
find %{buildroot}%{_libdir} -maxdepth 1 -type f -name '*.so' \ |
578 |
|
|
-exec chmod -v +x '{}' '+' |
579 |
|
|
|
580 |
|
|
# The libdir libraries are identical to those under rustlib/. It's easier on |
581 |
|
|
# library loading if we keep them in libdir, but we do need them in rustlib/ |
582 |
|
|
# to support dynamic linking for compiler plugins, so we'll symlink. |
583 |
|
|
(cd "%{buildroot}%{rustlibdir}/%{rust_triple}/lib" && |
584 |
akien |
1208625 |
find ../../../../%{_lib} -maxdepth 1 -name '*.so' | |
585 |
|
|
while read lib; do |
586 |
akien |
1449358 |
if [ -f "${lib##*/}" ]; then |
587 |
|
|
# make sure they're actually identical! |
588 |
|
|
cmp "$lib" "${lib##*/}" |
589 |
|
|
ln -v -f -s -t . "$lib" |
590 |
|
|
fi |
591 |
akien |
1208625 |
done) |
592 |
akien |
1107389 |
|
593 |
akien |
1057871 |
# Remove installer artifacts (manifests, uninstall scripts, etc.) |
594 |
akien |
1085562 |
find %{buildroot}%{rustlibdir} -maxdepth 1 -type f -exec rm -v '{}' '+' |
595 |
akien |
1057871 |
|
596 |
akien |
1251113 |
# Remove backup files from %%configure munging |
597 |
|
|
find %{buildroot}%{rustlibdir} -type f -name '*.orig' -exec rm -v '{}' '+' |
598 |
|
|
|
599 |
akien |
1308362 |
# https://fedoraproject.org/wiki/Changes/Make_ambiguous_python_shebangs_error |
600 |
|
|
# We don't actually need to ship any of those python scripts in rust-src anyway. |
601 |
|
|
find %{buildroot}%{rustlibdir}/src -type f -name '*.py' -exec rm -v '{}' '+' |
602 |
|
|
|
603 |
akien |
1057871 |
# FIXME: __os_install_post will strip the rlibs |
604 |
|
|
# -- should we find a way to preserve debuginfo? |
605 |
|
|
|
606 |
|
|
# Remove unwanted documentation files (we already package them) |
607 |
akien |
1085562 |
rm -f %{buildroot}%{_docdir}/%{name}/README.md |
608 |
|
|
rm -f %{buildroot}%{_docdir}/%{name}/COPYRIGHT |
609 |
akien |
1308362 |
rm -f %{buildroot}%{_docdir}/%{name}/LICENSE |
610 |
akien |
1085562 |
rm -f %{buildroot}%{_docdir}/%{name}/LICENSE-APACHE |
611 |
|
|
rm -f %{buildroot}%{_docdir}/%{name}/LICENSE-MIT |
612 |
akien |
1228274 |
rm -f %{buildroot}%{_docdir}/%{name}/LICENSE-THIRD-PARTY |
613 |
akien |
1215099 |
rm -f %{buildroot}%{_docdir}/%{name}/*.old |
614 |
akien |
1057871 |
|
615 |
|
|
# Sanitize the HTML documentation |
616 |
akien |
1085562 |
find %{buildroot}%{_docdir}/%{name}/html -empty -delete |
617 |
|
|
find %{buildroot}%{_docdir}/%{name}/html -type f -exec chmod -x '{}' '+' |
618 |
akien |
1057871 |
|
619 |
akien |
1228274 |
# Create the path for crate-devel packages |
620 |
|
|
mkdir -p %{buildroot}%{_datadir}/cargo/registry |
621 |
|
|
|
622 |
|
|
# Cargo no longer builds its own documentation |
623 |
|
|
# https://github.com/rust-lang/cargo/pull/4904 |
624 |
akien |
1308362 |
mkdir -p %{buildroot}%{_docdir}/cargo |
625 |
|
|
ln -sT ../rust/html/cargo/ %{buildroot}%{_docdir}/cargo/html |
626 |
akien |
1228274 |
|
627 |
akien |
1093561 |
%if %without lldb |
628 |
|
|
rm -f %{buildroot}%{_bindir}/rust-lldb |
629 |
|
|
rm -f %{buildroot}%{rustlibdir}/etc/lldb_*.py* |
630 |
|
|
%endif |
631 |
akien |
1057871 |
|
632 |
akien |
1093561 |
|
633 |
akien |
1057871 |
%check |
634 |
akien |
1093561 |
%{?cmake_path:export PATH=%{cmake_path}:$PATH} |
635 |
akien |
1107392 |
%{?rustflags:export RUSTFLAGS="%{rustflags}"} |
636 |
akien |
1093561 |
|
637 |
akien |
1057871 |
# The results are not stable on koji, so mask errors and just log it. |
638 |
akien |
1208625 |
%{python} ./x.py test --no-fail-fast || : |
639 |
akien |
1228274 |
%{python} ./x.py test --no-fail-fast cargo || : |
640 |
akien |
1308362 |
%{python} ./x.py test --no-fail-fast clippy || : |
641 |
akien |
1228274 |
%{python} ./x.py test --no-fail-fast rls || : |
642 |
|
|
%{python} ./x.py test --no-fail-fast rustfmt || : |
643 |
akien |
1057871 |
|
644 |
|
|
|
645 |
akien |
1370979 |
%{?ldconfig_scriptlets} |
646 |
akien |
1085562 |
|
647 |
|
|
|
648 |
thatsamguy |
494699 |
%files |
649 |
akien |
1057871 |
%license COPYRIGHT LICENSE-APACHE LICENSE-MIT |
650 |
akien |
1370979 |
%license vendor/backtrace-sys/src/libbacktrace/LICENSE-libbacktrace |
651 |
akien |
1057871 |
%doc README.md |
652 |
thatsamguy |
494699 |
%{_bindir}/rustc |
653 |
|
|
%{_bindir}/rustdoc |
654 |
akien |
1107389 |
%{_libdir}/*.so |
655 |
akien |
1057871 |
%{_mandir}/man1/rustc.1* |
656 |
|
|
%{_mandir}/man1/rustdoc.1* |
657 |
akien |
1085562 |
%dir %{rustlibdir} |
658 |
|
|
%dir %{rustlibdir}/%{rust_triple} |
659 |
|
|
%dir %{rustlibdir}/%{rust_triple}/lib |
660 |
|
|
%{rustlibdir}/%{rust_triple}/lib/*.so |
661 |
akien |
1396907 |
%if %defined bootstrap_build_arch |
662 |
|
|
%dir %{rustlibdir}/%{target_triple} |
663 |
|
|
%dir %{rustlibdir}/%{target_triple}/lib |
664 |
|
|
%{rustlibdir}/%{target_triple}/lib/*.so |
665 |
|
|
%endif |
666 |
akien |
1370979 |
%exclude %{_bindir}/*miri |
667 |
thatsamguy |
494699 |
|
668 |
akien |
1057871 |
|
669 |
akien |
1066912 |
%files std-static |
670 |
|
|
%dir %{rustlibdir} |
671 |
|
|
%dir %{rustlibdir}/%{rust_triple} |
672 |
|
|
%dir %{rustlibdir}/%{rust_triple}/lib |
673 |
|
|
%{rustlibdir}/%{rust_triple}/lib/*.rlib |
674 |
akien |
1396907 |
%if %defined bootstrap_build_arch |
675 |
|
|
%dir %{rustlibdir}/%{target_triple} |
676 |
|
|
%dir %{rustlibdir}/%{target_triple}/lib |
677 |
|
|
%{rustlibdir}/%{target_triple}/lib/*.rlib |
678 |
|
|
%endif |
679 |
akien |
1066912 |
|
680 |
|
|
|
681 |
akien |
1098716 |
%files debugger-common |
682 |
akien |
1066912 |
%dir %{rustlibdir} |
683 |
|
|
%dir %{rustlibdir}/etc |
684 |
akien |
1093561 |
%{rustlibdir}/etc/debugger_*.py* |
685 |
akien |
1098716 |
|
686 |
|
|
|
687 |
|
|
%files gdb |
688 |
|
|
%{_bindir}/rust-gdb |
689 |
akien |
1093561 |
%{rustlibdir}/etc/gdb_*.py* |
690 |
akien |
1388944 |
%exclude %{_bindir}/rust-gdbgui |
691 |
akien |
1057871 |
|
692 |
|
|
|
693 |
akien |
1093561 |
%if %with lldb |
694 |
|
|
%files lldb |
695 |
|
|
%{_bindir}/rust-lldb |
696 |
|
|
%{rustlibdir}/etc/lldb_*.py* |
697 |
|
|
%endif |
698 |
|
|
|
699 |
|
|
|
700 |
shlomif |
990941 |
%files doc |
701 |
akien |
1098716 |
%docdir %{_docdir}/%{name} |
702 |
akien |
1057871 |
%dir %{_docdir}/%{name} |
703 |
akien |
1098716 |
%dir %{_docdir}/%{name}/html |
704 |
|
|
%{_docdir}/%{name}/html/*/ |
705 |
|
|
%{_docdir}/%{name}/html/*.html |
706 |
|
|
%{_docdir}/%{name}/html/*.css |
707 |
akien |
1388944 |
%{_docdir}/%{name}/html/*.ico |
708 |
akien |
1098716 |
%{_docdir}/%{name}/html/*.js |
709 |
akien |
1388944 |
%{_docdir}/%{name}/html/*.png |
710 |
akien |
1215099 |
%{_docdir}/%{name}/html/*.svg |
711 |
akien |
1098716 |
%{_docdir}/%{name}/html/*.woff |
712 |
|
|
%license %{_docdir}/%{name}/html/*.txt |
713 |
akien |
1419248 |
%license %{_docdir}/%{name}/html/*.md |
714 |
akien |
1151630 |
|
715 |
|
|
|
716 |
akien |
1228274 |
%files -n cargo |
717 |
|
|
%license src/tools/cargo/LICENSE-APACHE src/tools/cargo/LICENSE-MIT src/tools/cargo/LICENSE-THIRD-PARTY |
718 |
|
|
%doc src/tools/cargo/README.md |
719 |
|
|
%{_bindir}/cargo |
720 |
|
|
%{_mandir}/man1/cargo*.1* |
721 |
|
|
%{_sysconfdir}/bash_completion.d/cargo |
722 |
|
|
%{_datadir}/zsh/site-functions/_cargo |
723 |
|
|
%dir %{_datadir}/cargo |
724 |
|
|
%dir %{_datadir}/cargo/registry |
725 |
|
|
|
726 |
|
|
|
727 |
|
|
%files -n cargo-doc |
728 |
akien |
1308362 |
%docdir %{_docdir}/cargo |
729 |
|
|
%dir %{_docdir}/cargo |
730 |
akien |
1228274 |
%{_docdir}/cargo/html |
731 |
|
|
|
732 |
|
|
|
733 |
akien |
1338691 |
%files -n rustfmt |
734 |
akien |
1215099 |
%{_bindir}/rustfmt |
735 |
|
|
%{_bindir}/cargo-fmt |
736 |
|
|
%doc src/tools/rustfmt/{README,CHANGELOG,Configurations}.md |
737 |
|
|
%license src/tools/rustfmt/LICENSE-{APACHE,MIT} |
738 |
|
|
|
739 |
|
|
|
740 |
akien |
1338691 |
%files -n rls |
741 |
akien |
1228274 |
%{_bindir}/rls |
742 |
|
|
%doc src/tools/rls/{README.md,COPYRIGHT,debugging.md} |
743 |
|
|
%license src/tools/rls/LICENSE-{APACHE,MIT} |
744 |
|
|
|
745 |
|
|
|
746 |
akien |
1338691 |
%files -n clippy |
747 |
akien |
1308362 |
%{_bindir}/cargo-clippy |
748 |
|
|
%{_bindir}/clippy-driver |
749 |
|
|
%doc src/tools/clippy/{README.md,CHANGELOG.md} |
750 |
akien |
1338691 |
%license src/tools/clippy/LICENSE-{APACHE,MIT} |
751 |
akien |
1308362 |
|
752 |
|
|
|
753 |
akien |
1151630 |
%files src |
754 |
|
|
%dir %{rustlibdir} |
755 |
|
|
%{rustlibdir}/src |
756 |
akien |
1228274 |
|
757 |
|
|
|
758 |
|
|
%files analysis |
759 |
|
|
%{rustlibdir}/%{rust_triple}/analysis/ |
760 |
akien |
1396907 |
%if %defined bootstrap_build_arch |
761 |
|
|
%{rustlibdir}/%{target_triple}/analysis/ |
762 |
|
|
%endif |