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 |
akien |
1648840 |
# https://doc.rust-lang.org/nightly/rustc/platform-support.html |
8 |
tv |
1840420 |
%global rust_arches x86_64 i686 armv7hl aarch64 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 |
1769757 |
# To bootstrap from scratch, set the channel and date from src/stage0.json |
14 |
akien |
1848765 |
# e.g. 1.59.0 wants rustc: 1.58.0-2022-01-13 |
15 |
akien |
1057871 |
# or nightly wants some beta-YYYY-MM-DD |
16 |
akien |
1861388 |
%global bootstrap_version 1.60.0 |
17 |
|
|
%global bootstrap_channel 1.60.0 |
18 |
|
|
%global bootstrap_date 2022-04-07 |
19 |
akien |
1057871 |
|
20 |
akien |
1076532 |
# Only the specified arches will use bootstrap binaries. |
21 |
akien |
1848765 |
# NOTE: Those binaries used to be uploaded with every new release, but that was |
22 |
|
|
# a waste of lookaside cache space when they're most often unused. |
23 |
|
|
# Run "spectool -g rust.spec" after changing this and then "fedpkg upload" to |
24 |
akien |
1848766 |
# add them to sources. Remember to remove them again after the bootstrap build! |
25 |
akien |
1848902 |
#global bootstrap_arches %%{rust_arches} |
26 |
akien |
1076532 |
|
27 |
akien |
1396907 |
# To bootstrap a compiler for a Tier 2 platform, we first need to build a |
28 |
|
|
# compiler for a Tier 1 platform that targets the Tier 2 platform, then use |
29 |
|
|
# the resulting compiler in a second build. Set bootstrap_build_arch to the |
30 |
|
|
# Tier 1 arch for the first build, leave it undefined for the second build. |
31 |
akien |
1397010 |
%bcond_with bootstrap_i586 |
32 |
akien |
1396907 |
%if %with bootstrap_i586 |
33 |
|
|
%ifarch i586 |
34 |
|
|
%global bootstrap_build_arch i686 |
35 |
|
|
%endif |
36 |
|
|
%endif |
37 |
|
|
|
38 |
akien |
1732055 |
# Define a space-separated list of targets to ship rust-std-static-$triple for |
39 |
|
|
# cross-compilation. The packages are noarch, but they're not fully |
40 |
|
|
# reproducible between hosts, so only x86_64 actually builds it. |
41 |
|
|
%ifarch x86_64 |
42 |
akien |
1789601 |
%if 0%{?fedora} || 0%{?mageia} >= 9 |
43 |
akien |
1769757 |
%global mingw_targets i686-pc-windows-gnu x86_64-pc-windows-gnu |
44 |
akien |
1732055 |
%endif |
45 |
akien |
1789601 |
%if 0%{?fedora} || 0%{?rhel} >= 8 || 0%{?mageia} >= 9 |
46 |
akien |
1769757 |
%global wasm_targets wasm32-unknown-unknown wasm32-wasi |
47 |
akien |
1732055 |
%endif |
48 |
akien |
1769757 |
%endif |
49 |
akien |
1732055 |
|
50 |
akien |
1766230 |
# We need CRT files for *-wasi targets, at least as new as the commit in |
51 |
|
|
# src/ci/docker/host-x86_64/dist-various-2/build-wasi-toolchain.sh |
52 |
akien |
1861388 |
# (updated per https://github.com/rust-lang/rust/pull/96907) |
53 |
akien |
1769757 |
%global wasi_libc_url https://github.com/WebAssembly/wasi-libc |
54 |
akien |
1861388 |
%global wasi_libc_commit 9886d3d6200fcc3726329966860fc058707406cd |
55 |
akien |
1769757 |
%global wasi_libc_name wasi-libc-%{wasi_libc_commit} |
56 |
|
|
%global wasi_libc_source %{wasi_libc_url}/archive/%{wasi_libc_commit}/%{wasi_libc_name}.tar.gz |
57 |
|
|
%global wasi_libc_dir %{_builddir}/%{wasi_libc_name} |
58 |
akien |
1766230 |
|
59 |
akien |
1215099 |
# Using llvm-static may be helpful as an opt-in, e.g. to aid LLVM rebases. |
60 |
tv |
1652435 |
%bcond_with llvm_static |
61 |
akien |
1062905 |
|
62 |
akien |
1085562 |
# We can also choose to just use Rust's bundled LLVM, in case the system LLVM |
63 |
akien |
1769757 |
# is insufficient. Rust currently requires LLVM 12.0+. |
64 |
|
|
%global min_llvm_version 12.0.0 |
65 |
akien |
1848766 |
%global bundled_llvm_version 14.0.0 |
66 |
akien |
1708017 |
%bcond_with bundled_llvm |
67 |
akien |
1449358 |
# (akien) Hacks below are needed on mga's buildsystem when we have to rebootstrap llvm. |
68 |
akien |
1623991 |
## Bundled LLVM has underlinking issues: |
69 |
|
|
#%%global _disable_ld_no_undefined 1 |
70 |
|
|
#%%ifarch %%{arm} %%ix86 |
71 |
|
|
## Decrease debuginfo verbosity to reduce memory consumption during final library linking |
72 |
|
|
#%%global optflags %%(echo %%{optflags} | sed 's/-g /-g1 /') |
73 |
|
|
#%%endif |
74 |
|
|
|
75 |
akien |
1861388 |
# Requires stable libgit2 1.4, and not the next minor soname change. |
76 |
akien |
1848766 |
# This needs to be consistent with the bindings in vendor/libgit2-sys. |
77 |
akien |
1861388 |
%global min_libgit2_version 1.4.0 |
78 |
|
|
%global next_libgit2_version 1.5.0~ |
79 |
|
|
%global bundled_libgit2_version 1.4.2 |
80 |
|
|
%if 0%{?fedora} >= 99 || 0%{?mageia} >= 99 |
81 |
akien |
1623991 |
%bcond_with bundled_libgit2 |
82 |
akien |
1085562 |
%else |
83 |
akien |
1623991 |
%bcond_without bundled_libgit2 |
84 |
akien |
1085562 |
%endif |
85 |
akien |
1076532 |
|
86 |
akien |
1769757 |
# needs libssh2_userauth_publickey_frommemory |
87 |
|
|
%global min_libssh2_version 1.6.0 |
88 |
akien |
1308362 |
%if 0%{?rhel} |
89 |
akien |
1623991 |
# Disable cargo->libgit2->libssh2 on RHEL, as it's not approved for FIPS (rhbz1732949) |
90 |
|
|
%bcond_without disabled_libssh2 |
91 |
akien |
1308362 |
%else |
92 |
akien |
1623991 |
%bcond_with disabled_libssh2 |
93 |
akien |
1308362 |
%endif |
94 |
|
|
|
95 |
akien |
1623991 |
%if 0%{?rhel} && 0%{?rhel} < 8 |
96 |
|
|
%bcond_with curl_http2 |
97 |
|
|
%else |
98 |
|
|
%bcond_without curl_http2 |
99 |
|
|
%endif |
100 |
|
|
|
101 |
akien |
1093561 |
# LLDB isn't available everywhere... |
102 |
akien |
1623991 |
%if 0%{?rhel} && 0%{?rhel} < 8 |
103 |
|
|
%bcond_with lldb |
104 |
|
|
%else |
105 |
akien |
1098716 |
%bcond_without lldb |
106 |
|
|
%endif |
107 |
akien |
1085562 |
|
108 |
akien |
1449358 |
%if 0%{?mageia} |
109 |
|
|
# (akien) Added by tv in mga8/rust 1.37.0. |
110 |
|
|
%global _python_bytecompile_extra 0 |
111 |
|
|
%endif |
112 |
|
|
|
113 |
akien |
1057871 |
Name: rust |
114 |
akien |
1861388 |
Version: 1.61.0 |
115 |
|
|
Release: %mkrel 1 |
116 |
akien |
1057871 |
Summary: The Rust Programming Language |
117 |
akien |
1085562 |
%if 0%{?mageia} |
118 |
akien |
1076533 |
Group: Development/Other |
119 |
akien |
1085562 |
%endif |
120 |
akien |
1228274 |
License: (ASL 2.0 or MIT) and (BSD and MIT) |
121 |
akien |
1057871 |
# ^ written as: (rust itself) and (bundled libraries) |
122 |
|
|
URL: https://www.rust-lang.org |
123 |
akien |
1846412 |
ExclusiveArch: %{rust_arches} i586 |
124 |
akien |
1057871 |
|
125 |
|
|
%if "%{channel}" == "stable" |
126 |
akien |
1357861 |
%global rustc_package rustc-%{version}-src |
127 |
akien |
1057871 |
%else |
128 |
akien |
1085562 |
%global rustc_package rustc-%{channel}-src |
129 |
akien |
1057871 |
%endif |
130 |
akien |
1130315 |
Source0: https://static.rust-lang.org/dist/%{rustc_package}.tar.xz |
131 |
akien |
1766230 |
Source1: %{wasi_libc_source} |
132 |
|
|
# Sources for bootstrap_arches are inserted by lua below |
133 |
akien |
1057871 |
|
134 |
akien |
1732055 |
# By default, rust tries to use "rust-lld" as a linker for WebAssembly. |
135 |
akien |
1769757 |
Patch1: 0001-Use-lld-provided-by-system-for-wasm.patch |
136 |
akien |
1732055 |
|
137 |
akien |
1861388 |
# Set a substitute-path in rust-gdb for standard library sources. |
138 |
|
|
Patch2: rustc-1.61.0-rust-gdb-substitute-path.patch |
139 |
akien |
1789601 |
|
140 |
akien |
1861388 |
# Infer the type that compiletest uses for TestDesc ignore_message |
141 |
|
|
Patch3: rustc-1.61.0-fix-compiletest-ignore_message.patch |
142 |
akien |
1848766 |
|
143 |
akien |
1861388 |
# Add missing target_feature to the list of well known cfg names |
144 |
|
|
# https://github.com/rust-lang/rust/pull/96483 |
145 |
|
|
Patch4: 0001-Add-missing-target_feature-to-the-list-of-well-known.patch |
146 |
|
|
|
147 |
akien |
1709688 |
# (akien) Those tests fail on armv7 - on Fedora too, and jistone ignores them |
148 |
|
|
# https://github.com/rust-lang/rust/issues/83453 |
149 |
|
|
Patch11: rustc-1.50.0-allow_fail-armv7-instruction_set.patch |
150 |
akien |
1708248 |
|
151 |
akien |
1623991 |
### RHEL-specific patches below ### |
152 |
|
|
|
153 |
akien |
1861388 |
# Simple rpm macros for rust-toolset (as opposed to full rust-packaging) |
154 |
|
|
Source100: macros.rust-toolset |
155 |
|
|
|
156 |
akien |
1623991 |
# Disable cargo->libgit2->libssh2 on RHEL, as it's not approved for FIPS (rhbz1732949) |
157 |
akien |
1789601 |
Patch100: rustc-1.59.0-disable-libssh2.patch |
158 |
akien |
1623991 |
|
159 |
|
|
# libcurl on RHEL7 doesn't have http2, but since cargo requests it, curl-sys |
160 |
|
|
# will try to build it statically -- instead we turn off the feature. |
161 |
akien |
1861388 |
Patch101: rustc-1.61.0-disable-http2.patch |
162 |
akien |
1623991 |
|
163 |
|
|
# kernel rh1410097 causes too-small stacks for PIE. |
164 |
|
|
# (affects RHEL6 kernels when building for RHEL7) |
165 |
akien |
1769757 |
Patch102: rustc-1.58.0-no-default-pie.patch |
166 |
akien |
1623991 |
|
167 |
|
|
|
168 |
akien |
1076532 |
# Get the Rust triple for any arch. |
169 |
|
|
%{lua: function rust_triple(arch) |
170 |
|
|
local abi = "gnu" |
171 |
|
|
if arch == "armv7hl" then |
172 |
|
|
arch = "armv7" |
173 |
|
|
abi = "gnueabihf" |
174 |
|
|
elseif arch == "ppc64" then |
175 |
|
|
arch = "powerpc64" |
176 |
|
|
elseif arch == "ppc64le" then |
177 |
|
|
arch = "powerpc64le" |
178 |
akien |
1623991 |
elseif arch == "riscv64" then |
179 |
|
|
arch = "riscv64gc" |
180 |
akien |
1076532 |
end |
181 |
|
|
return arch.."-unknown-linux-"..abi |
182 |
|
|
end} |
183 |
pterjan |
1058164 |
|
184 |
akien |
1396907 |
%if %defined bootstrap_build_arch |
185 |
|
|
%global rust_triple %{lua: print(rust_triple(rpm.expand("%{bootstrap_build_arch}")))} |
186 |
|
|
%global target_triple %{lua: print(rust_triple(rpm.expand("%{_target_cpu}")))} |
187 |
|
|
%else |
188 |
akien |
1076532 |
%global rust_triple %{lua: print(rust_triple(rpm.expand("%{_target_cpu}")))} |
189 |
akien |
1396907 |
%global target_triple %{rust_triple} |
190 |
|
|
%endif |
191 |
akien |
1076532 |
|
192 |
|
|
%if %defined bootstrap_arches |
193 |
|
|
# For each bootstrap arch, add an additional binary Source. |
194 |
|
|
# Also define bootstrap_source just for the current target. |
195 |
|
|
%{lua: do |
196 |
|
|
local bootstrap_arches = {} |
197 |
|
|
for arch in string.gmatch(rpm.expand("%{bootstrap_arches}"), "%S+") do |
198 |
|
|
table.insert(bootstrap_arches, arch) |
199 |
|
|
end |
200 |
akien |
1848765 |
local base = rpm.expand("https://static.rust-lang.org/dist/%{bootstrap_date}") |
201 |
|
|
local channel = rpm.expand("%{bootstrap_channel}") |
202 |
akien |
1076532 |
local target_arch = rpm.expand("%{_target_cpu}") |
203 |
|
|
for i, arch in ipairs(bootstrap_arches) do |
204 |
akien |
1861388 |
i = 1000 + i * 3 |
205 |
akien |
1848765 |
local suffix = channel.."-"..rust_triple(arch) |
206 |
|
|
print(string.format("Source%d: %s/cargo-%s.tar.xz\n", i, base, suffix)) |
207 |
|
|
print(string.format("Source%d: %s/rustc-%s.tar.xz\n", i+1, base, suffix)) |
208 |
|
|
print(string.format("Source%d: %s/rust-std-%s.tar.xz\n", i+2, base, suffix)) |
209 |
akien |
1076532 |
if arch == target_arch then |
210 |
akien |
1848765 |
rpm.define("bootstrap_source_cargo "..i) |
211 |
|
|
rpm.define("bootstrap_source_rustc "..i+1) |
212 |
|
|
rpm.define("bootstrap_source_std "..i+2) |
213 |
|
|
rpm.define("bootstrap_suffix "..suffix) |
214 |
akien |
1076532 |
end |
215 |
|
|
end |
216 |
|
|
end} |
217 |
akien |
1057871 |
%endif |
218 |
|
|
|
219 |
akien |
1076532 |
%ifarch %{bootstrap_arches} |
220 |
akien |
1848765 |
%global local_rust_root %{_builddir}/rust-%{bootstrap_suffix} |
221 |
|
|
Provides: bundled(%{name}-bootstrap) = %{bootstrap_version} |
222 |
akien |
1057871 |
%else |
223 |
akien |
1848765 |
BuildRequires: cargo >= %{bootstrap_version} |
224 |
akien |
1623992 |
%if (0%{?rhel} && 0%{?rhel} < 8) || 0%{?mageia} |
225 |
akien |
1848765 |
BuildRequires: %{name} >= %{bootstrap_version} |
226 |
akien |
1357861 |
BuildConflicts: %{name} > %{version} |
227 |
akien |
1623991 |
%else |
228 |
akien |
1848765 |
BuildRequires: (%{name} >= %{bootstrap_version} with %{name} <= %{version}) |
229 |
akien |
1215099 |
%endif |
230 |
akien |
1076532 |
%global local_rust_root %{_prefix} |
231 |
akien |
1057871 |
%endif |
232 |
|
|
|
233 |
|
|
BuildRequires: make |
234 |
|
|
BuildRequires: gcc |
235 |
|
|
BuildRequires: gcc-c++ |
236 |
akien |
1151628 |
BuildRequires: ncurses-devel |
237 |
akien |
1623991 |
# explicit curl-devel to avoid httpd24-curl (rhbz1540167) |
238 |
|
|
BuildRequires: curl-devel |
239 |
akien |
1228274 |
BuildRequires: pkgconfig(libcurl) |
240 |
|
|
BuildRequires: pkgconfig(liblzma) |
241 |
|
|
BuildRequires: pkgconfig(openssl) |
242 |
|
|
BuildRequires: pkgconfig(zlib) |
243 |
akien |
1057871 |
|
244 |
akien |
1766230 |
%if %{without bundled_libgit2} |
245 |
akien |
1769757 |
BuildRequires: pkgconfig(libgit2) >= %{min_libgit2_version} |
246 |
akien |
1789601 |
BuildRequires: pkgconfig(libgit2) < %{next_libgit2_version} |
247 |
akien |
1308362 |
%endif |
248 |
|
|
|
249 |
akien |
1671021 |
%if %{without disabled_libssh2} |
250 |
akien |
1769757 |
BuildRequires: pkgconfig(libssh2) >= %{min_libssh2_version} |
251 |
akien |
1308362 |
%endif |
252 |
|
|
|
253 |
akien |
1769757 |
%if 0%{?rhel} == 8 |
254 |
|
|
BuildRequires: platform-python |
255 |
|
|
%else |
256 |
|
|
BuildRequires: python3 |
257 |
|
|
%endif |
258 |
|
|
BuildRequires: python3-rpm-macros |
259 |
akien |
1208625 |
|
260 |
akien |
1098716 |
%if %with bundled_llvm |
261 |
akien |
1724501 |
BuildRequires: cmake3 >= 3.13.4 |
262 |
akien |
1753622 |
BuildRequires: ninja-build |
263 |
akien |
1769757 |
Provides: bundled(llvm) = %{bundled_llvm_version} |
264 |
akien |
1085562 |
%else |
265 |
akien |
1239841 |
BuildRequires: cmake >= 2.8.11 |
266 |
akien |
1848768 |
%if 0%{?epel} == 7 |
267 |
akien |
1769757 |
%global llvm llvm13 |
268 |
akien |
1710263 |
%endif |
269 |
akien |
1179950 |
%if %defined llvm |
270 |
akien |
1848768 |
%if 0%{?mageia} |
271 |
|
|
%global llvm_root %{_prefix}/lib/%{llvm} |
272 |
|
|
%else |
273 |
akien |
1098716 |
%global llvm_root %{_libdir}/%{llvm} |
274 |
akien |
1848768 |
%endif |
275 |
akien |
1098716 |
%else |
276 |
|
|
%global llvm llvm |
277 |
|
|
%global llvm_root %{_prefix} |
278 |
|
|
%endif |
279 |
akien |
1769757 |
BuildRequires: %{llvm}-devel >= %{min_llvm_version} |
280 |
akien |
1062905 |
%if %with llvm_static |
281 |
akien |
1708017 |
BuildRequires: %{llvm}-static |
282 |
akien |
1062905 |
BuildRequires: libffi-devel |
283 |
|
|
%endif |
284 |
akien |
1085562 |
%endif |
285 |
akien |
1062905 |
|
286 |
akien |
1769757 |
# make check needs "ps" for src/test/ui/wait-forked-but-failed-child.rs |
287 |
akien |
1057887 |
BuildRequires: procps-ng |
288 |
akien |
1057871 |
|
289 |
akien |
1093561 |
# debuginfo-gdb tests need gdb |
290 |
|
|
BuildRequires: gdb |
291 |
|
|
|
292 |
akien |
1066912 |
# Virtual provides for folks who attempt "dnf install rustc" |
293 |
akien |
1357861 |
Provides: rustc = %{version}-%{release} |
294 |
|
|
Provides: rustc%{?_isa} = %{version}-%{release} |
295 |
akien |
1066912 |
|
296 |
|
|
# Always require our exact standard library |
297 |
akien |
1357861 |
Requires: %{name}-std-static%{?_isa} = %{version}-%{release} |
298 |
akien |
1066912 |
|
299 |
akien |
1057871 |
# The C compiler is needed at runtime just for linking. Someday rustc might |
300 |
|
|
# invoke the linker directly, and then we'll only need binutils. |
301 |
|
|
# https://github.com/rust-lang/rust/issues/11937 |
302 |
akien |
1151630 |
%if 0%{?mageia} |
303 |
akien |
1057871 |
Requires: gcc |
304 |
akien |
1151630 |
%else |
305 |
|
|
Requires: /usr/bin/cc |
306 |
|
|
%endif |
307 |
akien |
1057871 |
|
308 |
akien |
1732055 |
%if 0%{?epel} == 7 |
309 |
|
|
%global devtoolset_name devtoolset-9 |
310 |
akien |
1769757 |
BuildRequires: %{devtoolset_name}-binutils |
311 |
akien |
1732055 |
BuildRequires: %{devtoolset_name}-gcc |
312 |
|
|
BuildRequires: %{devtoolset_name}-gcc-c++ |
313 |
akien |
1769757 |
%global devtoolset_bindir /opt/rh/%{devtoolset_name}/root/usr/bin |
314 |
|
|
%global __cc %{devtoolset_bindir}/gcc |
315 |
|
|
%global __cxx %{devtoolset_bindir}/g++ |
316 |
|
|
%global __ar %{devtoolset_bindir}/ar |
317 |
|
|
%global __ranlib %{devtoolset_bindir}/ranlib |
318 |
|
|
%global __strip %{devtoolset_bindir}/strip |
319 |
|
|
%else |
320 |
|
|
%global __ranlib %{_bindir}/ranlib |
321 |
akien |
1732055 |
%endif |
322 |
|
|
|
323 |
akien |
1057871 |
# ALL Rust libraries are private, because they don't keep an ABI. |
324 |
akien |
1308362 |
%global _privatelibs lib(.*-[[:xdigit:]]{16}*|rustc.*)[.]so.* |
325 |
akien |
1057871 |
%global __provides_exclude ^(%{_privatelibs})$ |
326 |
|
|
%global __requires_exclude ^(%{_privatelibs})$ |
327 |
akien |
1251113 |
%global __provides_exclude_from ^(%{_docdir}|%{rustlibdir}/src)/.*$ |
328 |
|
|
%global __requires_exclude_from ^(%{_docdir}|%{rustlibdir}/src)/.*$ |
329 |
akien |
1057871 |
|
330 |
akien |
1085562 |
# While we don't want to encourage dynamic linking to Rust shared libraries, as |
331 |
|
|
# there's no stable ABI, we still need the unallocated metadata (.rustc) to |
332 |
akien |
1623991 |
# support custom-derive plugins like #[proc_macro_derive(Foo)]. |
333 |
akien |
1732055 |
%if 0%{?rhel} && 0%{?rhel} < 8 |
334 |
akien |
1623991 |
# eu-strip is very eager by default, so we have to limit it to -g, only debugging symbols. |
335 |
|
|
%global _find_debuginfo_opts -g |
336 |
|
|
%undefine _include_minidebuginfo |
337 |
|
|
%else |
338 |
akien |
1151628 |
# Newer find-debuginfo.sh supports --keep-section, which is preferable. rhbz1465997 |
339 |
|
|
%global _find_debuginfo_opts --keep-section .rustc |
340 |
|
|
%endif |
341 |
akien |
1085562 |
|
342 |
akien |
1338691 |
%if %{without bundled_llvm} |
343 |
akien |
1370979 |
%if "%{llvm_root}" == "%{_prefix}" || 0%{?scl:1} |
344 |
akien |
1338691 |
%global llvm_has_filecheck 1 |
345 |
|
|
%endif |
346 |
akien |
1098716 |
%endif |
347 |
|
|
|
348 |
akien |
1732055 |
# We're going to override --libdir when configuring to get rustlib into a |
349 |
|
|
# common path, but we'll fix the shared libraries during install. |
350 |
|
|
%global common_libdir %{_prefix}/lib |
351 |
|
|
%global rustlibdir %{common_libdir}/rustlib |
352 |
|
|
|
353 |
akien |
1769757 |
%if %defined mingw_targets |
354 |
|
|
BuildRequires: mingw32-filesystem >= 95 |
355 |
|
|
BuildRequires: mingw64-filesystem >= 95 |
356 |
akien |
1846418 |
BuildRequires: mingw32-crt |
357 |
akien |
1848766 |
BuildRequires: mingw64-crt |
358 |
akien |
1769757 |
BuildRequires: mingw32-gcc |
359 |
|
|
BuildRequires: mingw64-gcc |
360 |
akien |
1846418 |
BuildRequires: mingw32-winpthreads-static |
361 |
akien |
1848766 |
BuildRequires: mingw64-winpthreads-static |
362 |
akien |
1769757 |
%endif |
363 |
|
|
|
364 |
|
|
%if %defined wasm_targets |
365 |
akien |
1766230 |
BuildRequires: clang |
366 |
akien |
1846418 |
BuildRequires: lld |
367 |
akien |
1732055 |
# brp-strip-static-archive breaks the archive index for wasm |
368 |
|
|
%global __os_install_post \ |
369 |
|
|
%__os_install_post \ |
370 |
akien |
1846418 |
find '%{buildroot}%{rustlibdir}'/wasm*/lib -type f -regex '.*\\.\\(a\\|rlib\\)' -print -exec '%{llvm_root}/bin/llvm-ranlib' '{}' ';' \ |
371 |
akien |
1732055 |
%{nil} |
372 |
|
|
%endif |
373 |
|
|
|
374 |
thatsamguy |
494699 |
%description |
375 |
akien |
1057871 |
Rust is a systems programming language that runs blazingly fast, prevents |
376 |
|
|
segfaults, and guarantees thread safety. |
377 |
thatsamguy |
494699 |
|
378 |
akien |
1066912 |
This package includes the Rust compiler and documentation generator. |
379 |
thatsamguy |
494699 |
|
380 |
akien |
1057871 |
|
381 |
akien |
1066912 |
%package std-static |
382 |
|
|
Summary: Standard library for Rust |
383 |
akien |
1769757 |
Requires: %{name} = %{version}-%{release} |
384 |
|
|
Requires: glibc-devel%{?_isa} >= 2.11 |
385 |
akien |
1066912 |
|
386 |
|
|
%description std-static |
387 |
|
|
This package includes the standard libraries for building applications |
388 |
|
|
written in Rust. |
389 |
|
|
|
390 |
akien |
1769757 |
%if %defined mingw_targets |
391 |
akien |
1732055 |
%{lua: do |
392 |
akien |
1769757 |
for triple in string.gmatch(rpm.expand("%{mingw_targets}"), "%S+") do |
393 |
akien |
1732055 |
local subs = { |
394 |
|
|
triple = triple, |
395 |
akien |
1769757 |
name = rpm.expand("%{name}"), |
396 |
akien |
1766230 |
verrel = rpm.expand("%{version}-%{release}"), |
397 |
akien |
1769757 |
mingw = string.find(rpm.expand("%{ix86}"), string.sub(triple, 1, 4)) and "mingw32" or "mingw64", |
398 |
|
|
} |
399 |
|
|
local s = string.gsub([[ |
400 |
|
|
|
401 |
|
|
%package std-static-{{triple}} |
402 |
|
|
Summary: Standard library for Rust {{triple}} |
403 |
|
|
BuildArch: noarch |
404 |
|
|
Provides: {{mingw}}-rust = {{verrel}} |
405 |
|
|
Provides: {{mingw}}-rustc = {{verrel}} |
406 |
|
|
Requires: {{mingw}}-crt |
407 |
|
|
Requires: {{mingw}}-gcc |
408 |
|
|
Requires: {{mingw}}-winpthreads-static |
409 |
|
|
Requires: {{name}} = {{verrel}} |
410 |
|
|
|
411 |
|
|
%description std-static-{{triple}} |
412 |
|
|
This package includes the standard libraries for building applications |
413 |
|
|
written in Rust for the MinGW target {{triple}}. |
414 |
|
|
|
415 |
|
|
]], "{{(%w+)}}", subs) |
416 |
|
|
print(s) |
417 |
|
|
end |
418 |
|
|
end} |
419 |
|
|
%endif |
420 |
|
|
|
421 |
|
|
%if %defined wasm_targets |
422 |
|
|
%{lua: do |
423 |
|
|
for triple in string.gmatch(rpm.expand("%{wasm_targets}"), "%S+") do |
424 |
|
|
local subs = { |
425 |
|
|
triple = triple, |
426 |
|
|
name = rpm.expand("%{name}"), |
427 |
|
|
verrel = rpm.expand("%{version}-%{release}"), |
428 |
akien |
1766230 |
wasi = string.find(triple, "-wasi") and 1 or 0, |
429 |
akien |
1732055 |
} |
430 |
|
|
local s = string.gsub([[ |
431 |
akien |
1766230 |
|
432 |
akien |
1732055 |
%package std-static-{{triple}} |
433 |
akien |
1769757 |
Summary: Standard library for Rust {{triple}} |
434 |
akien |
1732055 |
BuildArch: noarch |
435 |
akien |
1769757 |
Requires: {{name}} = {{verrel}} |
436 |
akien |
1766230 |
Requires: lld >= 8.0 |
437 |
|
|
%if {{wasi}} |
438 |
|
|
Provides: bundled(wasi-libc) |
439 |
|
|
%endif |
440 |
akien |
1066912 |
|
441 |
akien |
1732055 |
%description std-static-{{triple}} |
442 |
|
|
This package includes the standard libraries for building applications |
443 |
akien |
1769757 |
written in Rust for the WebAssembly target {{triple}}. |
444 |
akien |
1766230 |
|
445 |
akien |
1732055 |
]], "{{(%w+)}}", subs) |
446 |
|
|
print(s) |
447 |
|
|
end |
448 |
|
|
end} |
449 |
|
|
%endif |
450 |
|
|
|
451 |
|
|
|
452 |
akien |
1098716 |
%package debugger-common |
453 |
|
|
Summary: Common debugger pretty printers for Rust |
454 |
|
|
BuildArch: noarch |
455 |
|
|
|
456 |
|
|
%description debugger-common |
457 |
|
|
This package includes the common functionality for %{name}-gdb and %{name}-lldb. |
458 |
|
|
|
459 |
akien |
1239841 |
|
460 |
akien |
1057871 |
%package gdb |
461 |
|
|
Summary: GDB pretty printers for Rust |
462 |
|
|
BuildArch: noarch |
463 |
|
|
Requires: gdb |
464 |
akien |
1357861 |
Requires: %{name}-debugger-common = %{version}-%{release} |
465 |
akien |
1057871 |
|
466 |
akien |
1098861 |
%description gdb |
467 |
|
|
This package includes the rust-gdb script, which allows easier debugging of Rust |
468 |
|
|
programs. |
469 |
akien |
1057871 |
|
470 |
akien |
1098861 |
|
471 |
akien |
1093561 |
%if %with lldb |
472 |
|
|
|
473 |
|
|
%package lldb |
474 |
|
|
Summary: LLDB pretty printers for Rust |
475 |
akien |
1399021 |
BuildArch: noarch |
476 |
akien |
1093561 |
Requires: lldb |
477 |
akien |
1769757 |
Requires: python3-lldb |
478 |
akien |
1357861 |
Requires: %{name}-debugger-common = %{version}-%{release} |
479 |
akien |
1093561 |
|
480 |
|
|
%description lldb |
481 |
|
|
This package includes the rust-lldb script, which allows easier debugging of Rust |
482 |
|
|
programs. |
483 |
|
|
|
484 |
|
|
%endif |
485 |
|
|
|
486 |
|
|
|
487 |
shlomif |
990941 |
%package doc |
488 |
akien |
1057871 |
Summary: Documentation for Rust |
489 |
|
|
# NOT BuildArch: noarch |
490 |
|
|
# Note, while docs are mostly noarch, some things do vary by target_arch. |
491 |
|
|
# Koji will fail the build in rpmdiff if two architectures build a noarch |
492 |
|
|
# subpackage differently, so instead we have to keep its arch. |
493 |
thatsamguy |
494699 |
|
494 |
shlomif |
990941 |
%description doc |
495 |
akien |
1057871 |
This package includes HTML documentation for the Rust programming language and |
496 |
|
|
its standard library. |
497 |
thatsamguy |
494699 |
|
498 |
akien |
1057871 |
|
499 |
akien |
1228274 |
%package -n cargo |
500 |
|
|
Summary: Rust's package manager and build tool |
501 |
|
|
%if %with bundled_libgit2 |
502 |
akien |
1769757 |
Provides: bundled(libgit2) = %{bundled_libgit2_version} |
503 |
akien |
1228274 |
%endif |
504 |
|
|
# For tests: |
505 |
akien |
1769757 |
BuildRequires: git-core |
506 |
akien |
1228274 |
# Cargo is not much use without Rust |
507 |
akien |
1769757 |
Requires: %{name} |
508 |
akien |
1228274 |
|
509 |
tv |
1443439 |
# "cargo vendor" is a builtin command starting with 1.37. The Obsoletes and |
510 |
|
|
# Provides are mostly relevant to RHEL, but harmless to have on Fedora/etc. too |
511 |
|
|
Obsoletes: cargo-vendor <= 0.1.23 |
512 |
|
|
Provides: cargo-vendor = %{version}-%{release} |
513 |
|
|
|
514 |
akien |
1228274 |
%description -n cargo |
515 |
|
|
Cargo is a tool that allows Rust projects to declare their various dependencies |
516 |
|
|
and ensure that you'll always get a repeatable build. |
517 |
|
|
|
518 |
|
|
|
519 |
|
|
%package -n cargo-doc |
520 |
|
|
Summary: Documentation for Cargo |
521 |
|
|
BuildArch: noarch |
522 |
|
|
# Cargo no longer builds its own documentation |
523 |
|
|
# https://github.com/rust-lang/cargo/pull/4904 |
524 |
akien |
1769757 |
Requires: %{name}-doc = %{version}-%{release} |
525 |
akien |
1228274 |
|
526 |
|
|
%description -n cargo-doc |
527 |
|
|
This package includes HTML documentation for Cargo. |
528 |
|
|
|
529 |
|
|
|
530 |
akien |
1338691 |
%package -n rustfmt |
531 |
akien |
1215099 |
Summary: Tool to find and fix Rust formatting issues |
532 |
|
|
Requires: cargo |
533 |
|
|
|
534 |
akien |
1338691 |
# The component/package was rustfmt-preview until Rust 1.31. |
535 |
|
|
Obsoletes: rustfmt-preview < 1.0.0 |
536 |
akien |
1357861 |
Provides: rustfmt-preview = %{version}-%{release} |
537 |
akien |
1215099 |
|
538 |
akien |
1338691 |
%description -n rustfmt |
539 |
akien |
1215099 |
A tool for formatting Rust code according to style guidelines. |
540 |
|
|
|
541 |
|
|
|
542 |
akien |
1338691 |
%package -n rls |
543 |
akien |
1228274 |
Summary: Rust Language Server for IDE integration |
544 |
|
|
%if %with bundled_libgit2 |
545 |
akien |
1769757 |
Provides: bundled(libgit2) = %{bundled_libgit2_version} |
546 |
akien |
1228274 |
%endif |
547 |
akien |
1769757 |
Requires: %{name}-analysis |
548 |
akien |
1228274 |
# /usr/bin/rls is dynamically linked against internal rustc libs |
549 |
akien |
1357861 |
Requires: %{name}%{?_isa} = %{version}-%{release} |
550 |
akien |
1228274 |
|
551 |
akien |
1338691 |
# The component/package was rls-preview until Rust 1.31. |
552 |
|
|
Obsoletes: rls-preview < 1.31.6 |
553 |
akien |
1357861 |
Provides: rls-preview = %{version}-%{release} |
554 |
akien |
1338691 |
|
555 |
|
|
%description -n rls |
556 |
akien |
1228274 |
The Rust Language Server provides a server that runs in the background, |
557 |
|
|
providing IDEs, editors, and other tools with information about Rust programs. |
558 |
|
|
It supports functionality such as 'goto definition', symbol search, |
559 |
|
|
reformatting, and code completion, and enables renaming and refactorings. |
560 |
|
|
|
561 |
|
|
|
562 |
akien |
1338691 |
%package -n clippy |
563 |
akien |
1308362 |
Summary: Lints to catch common mistakes and improve your Rust code |
564 |
|
|
Requires: cargo |
565 |
|
|
# /usr/bin/clippy-driver is dynamically linked against internal rustc libs |
566 |
akien |
1357861 |
Requires: %{name}%{?_isa} = %{version}-%{release} |
567 |
akien |
1308362 |
|
568 |
akien |
1338691 |
# The component/package was clippy-preview until Rust 1.31. |
569 |
|
|
Obsoletes: clippy-preview <= 0.0.212 |
570 |
akien |
1357861 |
Provides: clippy-preview = %{version}-%{release} |
571 |
akien |
1338691 |
|
572 |
|
|
%description -n clippy |
573 |
akien |
1308362 |
A collection of lints to catch common mistakes and improve your Rust code. |
574 |
|
|
|
575 |
|
|
|
576 |
akien |
1151630 |
%package src |
577 |
|
|
Summary: Sources for the Rust standard library |
578 |
|
|
BuildArch: noarch |
579 |
|
|
|
580 |
|
|
%description src |
581 |
|
|
This package includes source files for the Rust standard library. It may be |
582 |
|
|
useful as a reference for code completion tools in various editors. |
583 |
|
|
|
584 |
|
|
|
585 |
akien |
1228274 |
%package analysis |
586 |
|
|
Summary: Compiler analysis data for the Rust standard library |
587 |
akien |
1769757 |
Requires: %{name}-std-static%{?_isa} = %{version}-%{release} |
588 |
akien |
1228274 |
|
589 |
|
|
%description analysis |
590 |
|
|
This package contains analysis data files produced with rustc's -Zsave-analysis |
591 |
|
|
feature for the Rust standard library. The RLS (Rust Language Server) uses this |
592 |
|
|
data to provide information about the Rust standard library. |
593 |
|
|
|
594 |
|
|
|
595 |
akien |
1861388 |
%if 0%{?rhel} && 0%{?rhel} >= 8 |
596 |
|
|
|
597 |
|
|
%package toolset |
598 |
|
|
Summary: Rust Toolset |
599 |
|
|
Requires: rust%{?_isa} = %{version}-%{release} |
600 |
|
|
Requires: cargo%{?_isa} = %{version}-%{release} |
601 |
|
|
|
602 |
|
|
%description toolset |
603 |
|
|
This is the metapackage for Rust Toolset, bringing in the Rust compiler, |
604 |
|
|
the Cargo package manager, and a few convenience macros for rpm builds. |
605 |
|
|
|
606 |
|
|
%endif |
607 |
|
|
|
608 |
|
|
|
609 |
thatsamguy |
494699 |
%prep |
610 |
|
|
|
611 |
akien |
1076532 |
%ifarch %{bootstrap_arches} |
612 |
akien |
1848765 |
rm -rf %{local_rust_root} |
613 |
|
|
%setup -q -n cargo-%{bootstrap_suffix} -T -b %{bootstrap_source_cargo} |
614 |
|
|
./install.sh --prefix=%{local_rust_root} --disable-ldconfig |
615 |
|
|
%setup -q -n rustc-%{bootstrap_suffix} -T -b %{bootstrap_source_rustc} |
616 |
|
|
./install.sh --prefix=%{local_rust_root} --disable-ldconfig |
617 |
|
|
%setup -q -n rust-std-%{bootstrap_suffix} -T -b %{bootstrap_source_std} |
618 |
|
|
./install.sh --prefix=%{local_rust_root} --disable-ldconfig |
619 |
akien |
1093561 |
test -f '%{local_rust_root}/bin/cargo' |
620 |
akien |
1058123 |
test -f '%{local_rust_root}/bin/rustc' |
621 |
|
|
%endif |
622 |
akien |
1057871 |
|
623 |
akien |
1769757 |
%if %defined wasm_targets |
624 |
|
|
%setup -q -n %{wasi_libc_name} -T -b 1 |
625 |
akien |
1766230 |
%endif |
626 |
|
|
|
627 |
akien |
1076532 |
%setup -q -n %{rustc_package} |
628 |
akien |
1058123 |
|
629 |
tv |
1695215 |
%patch1 -p1 |
630 |
akien |
1789601 |
%patch2 -p1 |
631 |
akien |
1861388 |
%patch3 -p1 |
632 |
|
|
%patch4 -p1 |
633 |
tv |
1695215 |
|
634 |
akien |
1709688 |
%patch11 -p1 |
635 |
|
|
|
636 |
akien |
1623991 |
%if %with disabled_libssh2 |
637 |
|
|
%patch100 -p1 |
638 |
akien |
1208625 |
%endif |
639 |
|
|
|
640 |
akien |
1623991 |
%if %without curl_http2 |
641 |
|
|
%patch101 -p1 |
642 |
|
|
rm -rf vendor/libnghttp2-sys/ |
643 |
|
|
%endif |
644 |
|
|
|
645 |
|
|
%if 0%{?rhel} && 0%{?rhel} < 8 |
646 |
akien |
1648840 |
%patch102 -p1 |
647 |
akien |
1623991 |
%endif |
648 |
|
|
|
649 |
akien |
1769757 |
# Use our explicit python3 first |
650 |
|
|
sed -i.try-python -e '/^try python3 /i try "%{__python3}" "$@"' ./configure |
651 |
akien |
1623991 |
|
652 |
akien |
1861388 |
# Set a substitute-path in rust-gdb for standard library sources. |
653 |
|
|
sed -i.rust-src -e "s#@BUILDDIR@#$PWD#" ./src/etc/rust-gdb |
654 |
|
|
|
655 |
akien |
1085562 |
%if %without bundled_llvm |
656 |
akien |
1388944 |
rm -rf src/llvm-project/ |
657 |
akien |
1648840 |
mkdir -p src/llvm-project/libunwind/ |
658 |
akien |
1085562 |
%endif |
659 |
akien |
1057871 |
|
660 |
tv |
1443439 |
# Remove other unused vendored libraries |
661 |
|
|
rm -rf vendor/curl-sys/curl/ |
662 |
akien |
1861388 |
rm -rf vendor/*jemalloc-sys*/jemalloc/ |
663 |
|
|
rm -rf vendor/libmimalloc-sys/c_src/mimalloc/ |
664 |
akien |
1671021 |
rm -rf vendor/libssh2-sys/libssh2/ |
665 |
tv |
1443439 |
rm -rf vendor/libz-sys/src/zlib/ |
666 |
akien |
1648840 |
rm -rf vendor/libz-sys/src/zlib-ng/ |
667 |
tv |
1443439 |
rm -rf vendor/lzma-sys/xz-*/ |
668 |
|
|
rm -rf vendor/openssl-src/openssl/ |
669 |
|
|
|
670 |
|
|
%if %without bundled_libgit2 |
671 |
|
|
rm -rf vendor/libgit2-sys/libgit2/ |
672 |
|
|
%endif |
673 |
|
|
|
674 |
akien |
1623991 |
%if %with disabled_libssh2 |
675 |
|
|
rm -rf vendor/libssh2-sys/ |
676 |
|
|
%endif |
677 |
tv |
1443439 |
|
678 |
|
|
# This only affects the transient rust-installer, but let it use our dynamic xz-libs |
679 |
|
|
sed -i.lzma -e '/LZMA_API_STATIC/d' src/bootstrap/tool.rs |
680 |
|
|
|
681 |
akien |
1623991 |
%if %{with bundled_llvm} && 0%{?epel} == 7 |
682 |
akien |
1093561 |
mkdir -p cmake-bin |
683 |
|
|
ln -s /usr/bin/cmake3 cmake-bin/cmake |
684 |
|
|
%global cmake_path $PWD/cmake-bin |
685 |
akien |
1085562 |
%endif |
686 |
|
|
|
687 |
|
|
%if %{without bundled_llvm} && %{with llvm_static} |
688 |
akien |
1062905 |
# Static linking to distro LLVM needs to add -lffi |
689 |
|
|
# https://github.com/rust-lang/rust/issues/34486 |
690 |
|
|
sed -i.ffi -e '$a #[link(name = "ffi")] extern {}' \ |
691 |
tv |
1652432 |
compiler/rustc_llvm/src/lib.rs |
692 |
akien |
1062905 |
%endif |
693 |
akien |
1057871 |
|
694 |
akien |
1130315 |
# The configure macro will modify some autoconf-related files, which upsets |
695 |
|
|
# cargo when it tries to verify checksums in those files. If we just truncate |
696 |
|
|
# that file list, cargo won't have anything to complain about. |
697 |
akien |
1357861 |
find vendor -name .cargo-checksum.json \ |
698 |
akien |
1130315 |
-exec sed -i.uncheck -e 's/"files":{[^}]*}/"files":{ }/' '{}' '+' |
699 |
akien |
1093561 |
|
700 |
akien |
1449358 |
# Sometimes Rust sources start with #![...] attributes, and "smart" editors think |
701 |
|
|
# it's a shebang and make them executable. Then brp-mangle-shebangs gets upset... |
702 |
|
|
find -name '*.rs' -type f -perm /111 -exec chmod -v -x '{}' '+' |
703 |
akien |
1130315 |
|
704 |
akien |
1633704 |
# Set up shared environment variables for build/install/check |
705 |
akien |
1769757 |
%global rust_env %{?rustflags:RUSTFLAGS="%{rustflags}"} |
706 |
akien |
1633704 |
%if 0%{?cmake_path:1} |
707 |
akien |
1769757 |
%global rust_env %{?rust_env} PATH="%{cmake_path}:$PATH" |
708 |
akien |
1633704 |
%endif |
709 |
akien |
1671021 |
%if %without disabled_libssh2 |
710 |
akien |
1308362 |
# convince libssh2-sys to use the distro libssh2 |
711 |
akien |
1769757 |
%global rust_env %{?rust_env} LIBSSH2_SYS_USE_PKG_CONFIG=1 |
712 |
akien |
1308362 |
%endif |
713 |
akien |
1769757 |
%global export_rust_env %{?rust_env:export %{rust_env}} |
714 |
akien |
1308362 |
|
715 |
akien |
1066912 |
|
716 |
akien |
1633704 |
%build |
717 |
akien |
1769757 |
%{export_rust_env} |
718 |
akien |
1633704 |
|
719 |
akien |
1463214 |
%ifarch aarch64 %{arm} %{ix86} s390x |
720 |
akien |
1179950 |
# full debuginfo is exhausting memory; just do libstd for now |
721 |
|
|
# https://github.com/rust-lang/rust/issues/45854 |
722 |
akien |
1623991 |
%if 0%{?rhel} && 0%{?rhel} < 8 |
723 |
akien |
1325525 |
# Older rpmbuild didn't work with partial debuginfo coverage. |
724 |
|
|
%global debug_package %{nil} |
725 |
tv |
1443439 |
%define enable_debuginfo --debuginfo-level=0 |
726 |
akien |
1325525 |
%else |
727 |
tv |
1443439 |
%define enable_debuginfo --debuginfo-level=0 --debuginfo-level-std=2 |
728 |
akien |
1325525 |
%endif |
729 |
akien |
1179950 |
%else |
730 |
tv |
1443439 |
%define enable_debuginfo --debuginfo-level=2 |
731 |
akien |
1179950 |
%endif |
732 |
|
|
|
733 |
akien |
1623991 |
# Some builders have relatively little memory for their CPU count. |
734 |
|
|
# At least 2GB per CPU is a good rule of thumb for building rustc. |
735 |
|
|
ncpus=$(/usr/bin/getconf _NPROCESSORS_ONLN) |
736 |
|
|
max_cpus=$(( ($(free -g | awk '/^Mem:/{print $2}') + 1) / 2 )) |
737 |
|
|
if [ "$max_cpus" -ge 1 -a "$max_cpus" -lt "$ncpus" ]; then |
738 |
|
|
ncpus="$max_cpus" |
739 |
|
|
fi |
740 |
|
|
|
741 |
akien |
1769757 |
%if %defined mingw_targets |
742 |
akien |
1766230 |
%{lua: do |
743 |
akien |
1769757 |
local cfg = "" |
744 |
|
|
for triple in string.gmatch(rpm.expand("%{mingw_targets}"), "%S+") do |
745 |
|
|
local subs = { |
746 |
|
|
triple = triple, |
747 |
|
|
mingw = string.find(rpm.expand("%{ix86}"), string.sub(triple, 1, 4)) and "mingw32" or "mingw64", |
748 |
|
|
} |
749 |
akien |
1848766 |
local s = string.gsub([[ |
750 |
akien |
1769757 |
--set target.{{triple}}.linker=%{{{mingw}}_cc} |
751 |
|
|
--set target.{{triple}}.cc=%{{{mingw}}_cc} |
752 |
|
|
--set target.{{triple}}.ar=%{{{mingw}}_ar} |
753 |
|
|
--set target.{{triple}}.ranlib=%{{{mingw}}_ranlib} |
754 |
akien |
1848766 |
]], "{{(%w+)}}", subs) |
755 |
akien |
1769757 |
cfg = cfg .. " " .. s |
756 |
|
|
end |
757 |
akien |
1848766 |
cfg = string.gsub(cfg, "%s+", " ") |
758 |
akien |
1769757 |
rpm.define("mingw_target_config " .. cfg) |
759 |
|
|
end} |
760 |
|
|
%endif |
761 |
|
|
|
762 |
|
|
%if %defined wasm_targets |
763 |
akien |
1861388 |
%make_build --quiet -C %{wasi_libc_dir} CC=clang AR=llvm-ar NM=llvm-nm |
764 |
akien |
1769757 |
%{lua: do |
765 |
akien |
1766230 |
local wasi_root = rpm.expand("%{wasi_libc_dir}") .. "/sysroot" |
766 |
akien |
1769757 |
local cfg = "" |
767 |
|
|
for triple in string.gmatch(rpm.expand("%{wasm_targets}"), "%S+") do |
768 |
akien |
1766230 |
if string.find(triple, "-wasi") then |
769 |
akien |
1769757 |
cfg = cfg .. " --set target." .. triple .. ".wasi-root=" .. wasi_root |
770 |
akien |
1766230 |
end |
771 |
|
|
end |
772 |
akien |
1769757 |
rpm.define("wasm_target_config "..cfg) |
773 |
akien |
1766230 |
end} |
774 |
|
|
%endif |
775 |
|
|
|
776 |
wally |
1481298 |
%configure --disable-option-checking \ |
777 |
akien |
1066912 |
--libdir=%{common_libdir} \ |
778 |
akien |
1396907 |
--build=%{rust_triple} --host=%{rust_triple} --target=%{target_triple} \ |
779 |
akien |
1848766 |
--set target.%{target_triple}.linker=%{__cc} \ |
780 |
|
|
--set target.%{target_triple}.cc=%{__cc} \ |
781 |
|
|
--set target.%{target_triple}.cxx=%{__cxx} \ |
782 |
|
|
--set target.%{target_triple}.ar=%{__ar} \ |
783 |
|
|
--set target.%{target_triple}.ranlib=%{__ranlib} \ |
784 |
akien |
1769757 |
%{?mingw_target_config} \ |
785 |
|
|
%{?wasm_target_config} \ |
786 |
|
|
--python=%{__python3} \ |
787 |
akien |
1215099 |
--local-rust-root=%{local_rust_root} \ |
788 |
akien |
1848766 |
--set build.rustfmt=/bin/true \ |
789 |
akien |
1338691 |
%{!?with_bundled_llvm: --llvm-root=%{llvm_root} \ |
790 |
|
|
%{!?llvm_has_filecheck: --disable-codegen-tests} \ |
791 |
akien |
1085562 |
%{!?with_llvm_static: --enable-llvm-link-shared } } \ |
792 |
akien |
1861388 |
--disable-llvm-static-stdcpp \ |
793 |
akien |
1057871 |
--disable-rpath \ |
794 |
akien |
1179950 |
%{enable_debuginfo} \ |
795 |
akien |
1732055 |
--set rust.codegen-units-std=1 \ |
796 |
akien |
1228274 |
--enable-extended \ |
797 |
akien |
1623398 |
--tools=analysis,cargo,clippy,rls,rustfmt,src \ |
798 |
akien |
1093561 |
--enable-vendor \ |
799 |
akien |
1251113 |
--enable-verbose-tests \ |
800 |
akien |
1753612 |
--dist-compression-formats=gz \ |
801 |
tv |
1695215 |
--release-channel=%{channel} \ |
802 |
akien |
1732055 |
--release-description="%{?mageia:Mageia }%{?fedora:Fedora }%{?rhel:Red Hat }%{version}-%{release}" |
803 |
thatsamguy |
494699 |
|
804 |
akien |
1769757 |
%{__python3} ./x.py build -j "$ncpus" --stage 2 |
805 |
|
|
%{__python3} ./x.py doc --stage 2 |
806 |
thatsamguy |
494699 |
|
807 |
akien |
1769757 |
for triple in %{?mingw_targets} %{?wasm_targets}; do |
808 |
|
|
%{__python3} ./x.py build --stage 2 --target=$triple std |
809 |
akien |
1732055 |
done |
810 |
akien |
1057871 |
|
811 |
thatsamguy |
494699 |
%install |
812 |
akien |
1769757 |
%{export_rust_env} |
813 |
thatsamguy |
494699 |
|
814 |
akien |
1769757 |
DESTDIR=%{buildroot} %{__python3} ./x.py install |
815 |
akien |
1093561 |
|
816 |
akien |
1769757 |
for triple in %{?mingw_targets} %{?wasm_targets}; do |
817 |
|
|
DESTDIR=%{buildroot} %{__python3} ./x.py install --target=$triple std |
818 |
akien |
1732055 |
done |
819 |
|
|
|
820 |
akien |
1740984 |
# These are transient files used by x.py dist and install |
821 |
|
|
rm -rf ./build/dist/ ./build/tmp/ |
822 |
|
|
|
823 |
akien |
1107389 |
# Make sure the shared libraries are in the proper libdir |
824 |
|
|
%if "%{_libdir}" != "%{common_libdir}" |
825 |
|
|
mkdir -p %{buildroot}%{_libdir} |
826 |
|
|
find %{buildroot}%{common_libdir} -maxdepth 1 -type f -name '*.so' \ |
827 |
|
|
-exec mv -v -t %{buildroot}%{_libdir} '{}' '+' |
828 |
|
|
%endif |
829 |
akien |
1066912 |
|
830 |
akien |
1107389 |
# The shared libraries should be executable for debuginfo extraction. |
831 |
|
|
find %{buildroot}%{_libdir} -maxdepth 1 -type f -name '*.so' \ |
832 |
|
|
-exec chmod -v +x '{}' '+' |
833 |
|
|
|
834 |
|
|
# The libdir libraries are identical to those under rustlib/. It's easier on |
835 |
|
|
# library loading if we keep them in libdir, but we do need them in rustlib/ |
836 |
|
|
# to support dynamic linking for compiler plugins, so we'll symlink. |
837 |
|
|
(cd "%{buildroot}%{rustlibdir}/%{rust_triple}/lib" && |
838 |
akien |
1208625 |
find ../../../../%{_lib} -maxdepth 1 -name '*.so' | |
839 |
|
|
while read lib; do |
840 |
akien |
1449358 |
if [ -f "${lib##*/}" ]; then |
841 |
|
|
# make sure they're actually identical! |
842 |
|
|
cmp "$lib" "${lib##*/}" |
843 |
|
|
ln -v -f -s -t . "$lib" |
844 |
|
|
fi |
845 |
akien |
1208625 |
done) |
846 |
akien |
1107389 |
|
847 |
akien |
1057871 |
# Remove installer artifacts (manifests, uninstall scripts, etc.) |
848 |
akien |
1085562 |
find %{buildroot}%{rustlibdir} -maxdepth 1 -type f -exec rm -v '{}' '+' |
849 |
akien |
1057871 |
|
850 |
akien |
1251113 |
# Remove backup files from %%configure munging |
851 |
|
|
find %{buildroot}%{rustlibdir} -type f -name '*.orig' -exec rm -v '{}' '+' |
852 |
|
|
|
853 |
akien |
1308362 |
# https://fedoraproject.org/wiki/Changes/Make_ambiguous_python_shebangs_error |
854 |
|
|
# We don't actually need to ship any of those python scripts in rust-src anyway. |
855 |
|
|
find %{buildroot}%{rustlibdir}/src -type f -name '*.py' -exec rm -v '{}' '+' |
856 |
|
|
|
857 |
akien |
1057871 |
# FIXME: __os_install_post will strip the rlibs |
858 |
|
|
# -- should we find a way to preserve debuginfo? |
859 |
|
|
|
860 |
|
|
# Remove unwanted documentation files (we already package them) |
861 |
akien |
1085562 |
rm -f %{buildroot}%{_docdir}/%{name}/README.md |
862 |
|
|
rm -f %{buildroot}%{_docdir}/%{name}/COPYRIGHT |
863 |
akien |
1308362 |
rm -f %{buildroot}%{_docdir}/%{name}/LICENSE |
864 |
akien |
1085562 |
rm -f %{buildroot}%{_docdir}/%{name}/LICENSE-APACHE |
865 |
|
|
rm -f %{buildroot}%{_docdir}/%{name}/LICENSE-MIT |
866 |
akien |
1228274 |
rm -f %{buildroot}%{_docdir}/%{name}/LICENSE-THIRD-PARTY |
867 |
akien |
1215099 |
rm -f %{buildroot}%{_docdir}/%{name}/*.old |
868 |
akien |
1057871 |
|
869 |
|
|
# Sanitize the HTML documentation |
870 |
akien |
1085562 |
find %{buildroot}%{_docdir}/%{name}/html -empty -delete |
871 |
|
|
find %{buildroot}%{_docdir}/%{name}/html -type f -exec chmod -x '{}' '+' |
872 |
akien |
1057871 |
|
873 |
akien |
1228274 |
# Create the path for crate-devel packages |
874 |
|
|
mkdir -p %{buildroot}%{_datadir}/cargo/registry |
875 |
|
|
|
876 |
|
|
# Cargo no longer builds its own documentation |
877 |
|
|
# https://github.com/rust-lang/cargo/pull/4904 |
878 |
akien |
1308362 |
mkdir -p %{buildroot}%{_docdir}/cargo |
879 |
|
|
ln -sT ../rust/html/cargo/ %{buildroot}%{_docdir}/cargo/html |
880 |
akien |
1228274 |
|
881 |
akien |
1093561 |
%if %without lldb |
882 |
|
|
rm -f %{buildroot}%{_bindir}/rust-lldb |
883 |
akien |
1633704 |
rm -f %{buildroot}%{rustlibdir}/etc/lldb_* |
884 |
akien |
1093561 |
%endif |
885 |
akien |
1057871 |
|
886 |
tv |
1695215 |
# We don't want Rust copies of LLVM tools (rust-lld, rust-llvm-dwp) |
887 |
|
|
rm -f %{buildroot}%{rustlibdir}/%{rust_triple}/bin/rust-ll* |
888 |
akien |
1093561 |
|
889 |
akien |
1861388 |
%if 0%{?rhel} && 0%{?rhel} >= 8 |
890 |
|
|
# This allows users to build packages using Rust Toolset. |
891 |
|
|
%{__install} -D -m 644 %{S:100} %{buildroot}%{rpmmacrodir}/macros.rust-toolset |
892 |
|
|
%endif |
893 |
tv |
1695215 |
|
894 |
akien |
1861388 |
|
895 |
akien |
1057871 |
%check |
896 |
akien |
1769757 |
%{export_rust_env} |
897 |
akien |
1093561 |
|
898 |
akien |
1766230 |
# Sanity-check the installed binaries, debuginfo-stripped and all. |
899 |
|
|
%{buildroot}%{_bindir}/cargo new build/hello-world |
900 |
|
|
env RUSTC=%{buildroot}%{_bindir}/rustc \ |
901 |
|
|
LD_LIBRARY_PATH="%{buildroot}%{_libdir}:$LD_LIBRARY_PATH" \ |
902 |
|
|
%{buildroot}%{_bindir}/cargo run --manifest-path build/hello-world/Cargo.toml |
903 |
|
|
|
904 |
akien |
1846418 |
# Try a build sanity-check for other targets |
905 |
|
|
for triple in %{?mingw_targets} %{?wasm_targets}; do |
906 |
|
|
env RUSTC=%{buildroot}%{_bindir}/rustc \ |
907 |
|
|
LD_LIBRARY_PATH="%{buildroot}%{_libdir}:$LD_LIBRARY_PATH" \ |
908 |
|
|
%{buildroot}%{_bindir}/cargo build --manifest-path build/hello-world/Cargo.toml --target=$triple |
909 |
akien |
1848766 |
done |
910 |
akien |
1846418 |
|
911 |
akien |
1057871 |
# The results are not stable on koji, so mask errors and just log it. |
912 |
akien |
1740984 |
# Some of the larger test artifacts are manually cleaned to save space. |
913 |
akien |
1769757 |
%{__python3} ./x.py test --no-fail-fast --stage 2 || : |
914 |
akien |
1740984 |
rm -rf "./build/%{rust_triple}/test/" |
915 |
|
|
|
916 |
akien |
1769757 |
%{__python3} ./x.py test --no-fail-fast --stage 2 cargo || : |
917 |
akien |
1740984 |
rm -rf "./build/%{rust_triple}/stage2-tools/%{rust_triple}/cit/" |
918 |
|
|
|
919 |
akien |
1769757 |
%{__python3} ./x.py test --no-fail-fast --stage 2 clippy || : |
920 |
|
|
|
921 |
akien |
1753612 |
env RLS_TEST_WAIT_FOR_AGES=1 \ |
922 |
akien |
1769757 |
%{__python3} ./x.py test --no-fail-fast --stage 2 rls || : |
923 |
akien |
1753612 |
|
924 |
akien |
1769757 |
%{__python3} ./x.py test --no-fail-fast --stage 2 rustfmt || : |
925 |
akien |
1753612 |
|
926 |
akien |
1057871 |
|
927 |
akien |
1370979 |
%{?ldconfig_scriptlets} |
928 |
akien |
1085562 |
|
929 |
|
|
|
930 |
thatsamguy |
494699 |
%files |
931 |
akien |
1057871 |
%license COPYRIGHT LICENSE-APACHE LICENSE-MIT |
932 |
|
|
%doc README.md |
933 |
thatsamguy |
494699 |
%{_bindir}/rustc |
934 |
|
|
%{_bindir}/rustdoc |
935 |
akien |
1107389 |
%{_libdir}/*.so |
936 |
akien |
1057871 |
%{_mandir}/man1/rustc.1* |
937 |
|
|
%{_mandir}/man1/rustdoc.1* |
938 |
akien |
1085562 |
%dir %{rustlibdir} |
939 |
|
|
%dir %{rustlibdir}/%{rust_triple} |
940 |
|
|
%dir %{rustlibdir}/%{rust_triple}/lib |
941 |
|
|
%{rustlibdir}/%{rust_triple}/lib/*.so |
942 |
akien |
1396907 |
%if %defined bootstrap_build_arch |
943 |
|
|
%dir %{rustlibdir}/%{target_triple} |
944 |
|
|
%dir %{rustlibdir}/%{target_triple}/lib |
945 |
|
|
%{rustlibdir}/%{target_triple}/lib/*.so |
946 |
|
|
%endif |
947 |
thatsamguy |
494699 |
|
948 |
akien |
1057871 |
|
949 |
akien |
1066912 |
%files std-static |
950 |
|
|
%dir %{rustlibdir} |
951 |
|
|
%dir %{rustlibdir}/%{rust_triple} |
952 |
|
|
%dir %{rustlibdir}/%{rust_triple}/lib |
953 |
|
|
%{rustlibdir}/%{rust_triple}/lib/*.rlib |
954 |
akien |
1396907 |
%if %defined bootstrap_build_arch |
955 |
|
|
%dir %{rustlibdir}/%{target_triple} |
956 |
|
|
%dir %{rustlibdir}/%{target_triple}/lib |
957 |
|
|
%{rustlibdir}/%{target_triple}/lib/*.rlib |
958 |
|
|
%endif |
959 |
akien |
1066912 |
|
960 |
|
|
|
961 |
akien |
1769757 |
%if %defined mingw_targets |
962 |
akien |
1732055 |
%{lua: do |
963 |
akien |
1769757 |
for triple in string.gmatch(rpm.expand("%{mingw_targets}"), "%S+") do |
964 |
akien |
1732055 |
local subs = { |
965 |
|
|
triple = triple, |
966 |
|
|
rustlibdir = rpm.expand("%{rustlibdir}"), |
967 |
akien |
1769757 |
} |
968 |
|
|
local s = string.gsub([[ |
969 |
|
|
|
970 |
|
|
%files std-static-{{triple}} |
971 |
|
|
%dir {{rustlibdir}} |
972 |
|
|
%dir {{rustlibdir}}/{{triple}} |
973 |
|
|
%dir {{rustlibdir}}/{{triple}}/lib |
974 |
|
|
{{rustlibdir}}/{{triple}}/lib/*.rlib |
975 |
|
|
{{rustlibdir}}/{{triple}}/lib/rs*.o |
976 |
|
|
%exclude {{rustlibdir}}/{{triple}}/lib/*.dll |
977 |
|
|
%exclude {{rustlibdir}}/{{triple}}/lib/*.dll.a |
978 |
|
|
%exclude {{rustlibdir}}/{{triple}}/lib/self-contained |
979 |
|
|
|
980 |
|
|
]], "{{(%w+)}}", subs) |
981 |
|
|
print(s) |
982 |
|
|
end |
983 |
|
|
end} |
984 |
|
|
%endif |
985 |
|
|
|
986 |
|
|
|
987 |
|
|
%if %defined wasm_targets |
988 |
|
|
%{lua: do |
989 |
|
|
for triple in string.gmatch(rpm.expand("%{wasm_targets}"), "%S+") do |
990 |
|
|
local subs = { |
991 |
|
|
triple = triple, |
992 |
|
|
rustlibdir = rpm.expand("%{rustlibdir}"), |
993 |
akien |
1766230 |
wasi = string.find(triple, "-wasi") and 1 or 0, |
994 |
akien |
1732055 |
} |
995 |
|
|
local s = string.gsub([[ |
996 |
akien |
1766230 |
|
997 |
akien |
1732055 |
%files std-static-{{triple}} |
998 |
|
|
%dir {{rustlibdir}} |
999 |
|
|
%dir {{rustlibdir}}/{{triple}} |
1000 |
|
|
%dir {{rustlibdir}}/{{triple}}/lib |
1001 |
|
|
{{rustlibdir}}/{{triple}}/lib/*.rlib |
1002 |
akien |
1766230 |
%if {{wasi}} |
1003 |
|
|
%dir {{rustlibdir}}/{{triple}}/lib/self-contained |
1004 |
|
|
{{rustlibdir}}/{{triple}}/lib/self-contained/crt*.o |
1005 |
akien |
1769757 |
{{rustlibdir}}/{{triple}}/lib/self-contained/libc.a |
1006 |
akien |
1766230 |
%endif |
1007 |
|
|
|
1008 |
akien |
1732055 |
]], "{{(%w+)}}", subs) |
1009 |
|
|
print(s) |
1010 |
|
|
end |
1011 |
|
|
end} |
1012 |
|
|
%endif |
1013 |
|
|
|
1014 |
|
|
|
1015 |
akien |
1098716 |
%files debugger-common |
1016 |
akien |
1066912 |
%dir %{rustlibdir} |
1017 |
|
|
%dir %{rustlibdir}/etc |
1018 |
akien |
1623991 |
%{rustlibdir}/etc/rust_*.py* |
1019 |
akien |
1098716 |
|
1020 |
|
|
|
1021 |
|
|
%files gdb |
1022 |
|
|
%{_bindir}/rust-gdb |
1023 |
akien |
1633704 |
%{rustlibdir}/etc/gdb_* |
1024 |
akien |
1388944 |
%exclude %{_bindir}/rust-gdbgui |
1025 |
akien |
1057871 |
|
1026 |
|
|
|
1027 |
akien |
1093561 |
%if %with lldb |
1028 |
|
|
%files lldb |
1029 |
|
|
%{_bindir}/rust-lldb |
1030 |
akien |
1633704 |
%{rustlibdir}/etc/lldb_* |
1031 |
akien |
1093561 |
%endif |
1032 |
|
|
|
1033 |
|
|
|
1034 |
shlomif |
990941 |
%files doc |
1035 |
akien |
1098716 |
%docdir %{_docdir}/%{name} |
1036 |
akien |
1057871 |
%dir %{_docdir}/%{name} |
1037 |
akien |
1098716 |
%dir %{_docdir}/%{name}/html |
1038 |
|
|
%{_docdir}/%{name}/html/*/ |
1039 |
|
|
%{_docdir}/%{name}/html/*.html |
1040 |
|
|
%{_docdir}/%{name}/html/*.css |
1041 |
|
|
%{_docdir}/%{name}/html/*.js |
1042 |
akien |
1388944 |
%{_docdir}/%{name}/html/*.png |
1043 |
akien |
1215099 |
%{_docdir}/%{name}/html/*.svg |
1044 |
akien |
1098716 |
%{_docdir}/%{name}/html/*.woff |
1045 |
akien |
1724501 |
%{_docdir}/%{name}/html/*.woff2 |
1046 |
akien |
1098716 |
%license %{_docdir}/%{name}/html/*.txt |
1047 |
akien |
1419248 |
%license %{_docdir}/%{name}/html/*.md |
1048 |
akien |
1151630 |
|
1049 |
|
|
|
1050 |
akien |
1228274 |
%files -n cargo |
1051 |
|
|
%license src/tools/cargo/LICENSE-APACHE src/tools/cargo/LICENSE-MIT src/tools/cargo/LICENSE-THIRD-PARTY |
1052 |
|
|
%doc src/tools/cargo/README.md |
1053 |
|
|
%{_bindir}/cargo |
1054 |
tv |
1695215 |
%{_libexecdir}/cargo* |
1055 |
akien |
1228274 |
%{_mandir}/man1/cargo*.1* |
1056 |
|
|
%{_sysconfdir}/bash_completion.d/cargo |
1057 |
|
|
%{_datadir}/zsh/site-functions/_cargo |
1058 |
|
|
%dir %{_datadir}/cargo |
1059 |
|
|
%dir %{_datadir}/cargo/registry |
1060 |
|
|
|
1061 |
|
|
|
1062 |
|
|
%files -n cargo-doc |
1063 |
akien |
1308362 |
%docdir %{_docdir}/cargo |
1064 |
|
|
%dir %{_docdir}/cargo |
1065 |
akien |
1228274 |
%{_docdir}/cargo/html |
1066 |
|
|
|
1067 |
|
|
|
1068 |
akien |
1338691 |
%files -n rustfmt |
1069 |
akien |
1215099 |
%{_bindir}/rustfmt |
1070 |
|
|
%{_bindir}/cargo-fmt |
1071 |
|
|
%doc src/tools/rustfmt/{README,CHANGELOG,Configurations}.md |
1072 |
|
|
%license src/tools/rustfmt/LICENSE-{APACHE,MIT} |
1073 |
|
|
|
1074 |
|
|
|
1075 |
akien |
1338691 |
%files -n rls |
1076 |
akien |
1228274 |
%{_bindir}/rls |
1077 |
|
|
%doc src/tools/rls/{README.md,COPYRIGHT,debugging.md} |
1078 |
|
|
%license src/tools/rls/LICENSE-{APACHE,MIT} |
1079 |
|
|
|
1080 |
|
|
|
1081 |
akien |
1338691 |
%files -n clippy |
1082 |
akien |
1308362 |
%{_bindir}/cargo-clippy |
1083 |
|
|
%{_bindir}/clippy-driver |
1084 |
|
|
%doc src/tools/clippy/{README.md,CHANGELOG.md} |
1085 |
akien |
1338691 |
%license src/tools/clippy/LICENSE-{APACHE,MIT} |
1086 |
akien |
1308362 |
|
1087 |
|
|
|
1088 |
akien |
1151630 |
%files src |
1089 |
|
|
%dir %{rustlibdir} |
1090 |
|
|
%{rustlibdir}/src |
1091 |
akien |
1228274 |
|
1092 |
|
|
|
1093 |
|
|
%files analysis |
1094 |
|
|
%{rustlibdir}/%{rust_triple}/analysis/ |
1095 |
akien |
1396907 |
%if %defined bootstrap_build_arch |
1096 |
|
|
%{rustlibdir}/%{target_triple}/analysis/ |
1097 |
|
|
%endif |
1098 |
akien |
1861388 |
|
1099 |
|
|
|
1100 |
|
|
%if 0%{?rhel} && 0%{?rhel} >= 8 |
1101 |
|
|
%files toolset |
1102 |
|
|
%{rpmmacrodir}/macros.rust-toolset |
1103 |
|
|
%endif |