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