]>
Commit | Line | Data |
---|---|---|
e361528e ER |
1 | # TODO |
2 | # - consider a rust-std package containing .../rustlib/$target | |
3 | # This might allow multilib cross-compilation to work naturally. | |
8a758d34 | 4 | # - package additional tools |
e361528e ER |
5 | # |
6 | # Conditional build: | |
e8f16183 | 7 | %bcond_with bootstrap # bootstrap using precompiled binaries |
398b58dd | 8 | %bcond_with full_debuginfo # full debuginfo vs only std debuginfo (full takes gigabytes of memory to build) |
5b9d67b0 | 9 | %bcond_without system_llvm # system LLVM |
cace5bf9 | 10 | %bcond_with tests # build without tests |
e361528e | 11 | |
8a073211 JR |
12 | # The channel can be stable, beta, or nightly |
13 | %define channel stable | |
14 | ||
e361528e | 15 | %if "%{channel}" == "stable" |
8a073211 | 16 | %define rustc_package rustc-%{version}-src |
e361528e | 17 | %else |
8a073211 | 18 | %define rustc_package rustc-%{channel}-src |
e361528e ER |
19 | %endif |
20 | ||
fc3be51a | 21 | # To bootstrap from scratch, set the channel and date from src/stage0.json |
e361528e ER |
22 | # e.g. 1.10.0 wants rustc: 1.9.0-2016-05-24 |
23 | # or nightly wants some beta-YYYY-MM-DD | |
f397d93b | 24 | %define bootstrap_rust 1.63.0 |
aea1d260 | 25 | %define bootstrap_cargo %{bootstrap_rust} |
f397d93b | 26 | %define bootstrap_date 2022-08-11 |
e361528e | 27 | |
badbe44d | 28 | %ifarch x32 |
2eb30149 | 29 | %define with_cross 1 |
badbe44d | 30 | %endif |
c19e7faa JP |
31 | |
32 | %if %{without full_debuginfo} | |
33 | %define _enable_debug_packages 0 | |
34 | %endif | |
35 | ||
e361528e | 36 | Summary: The Rust Programming Language |
e8f16183 | 37 | Summary(pl.UTF-8): Język programowania Rust |
e361528e | 38 | Name: rust |
f397d93b | 39 | Version: 1.64.0 |
98f7667c | 40 | Release: 1 |
d1b96fd8 | 41 | # Licenses: (rust itself) and (bundled libraries) |
e8f16183 | 42 | License: (Apache v2.0 or MIT) and (BSD and ISC and MIT) |
e361528e | 43 | Group: Development/Languages |
be28e1f1 | 44 | Source0: https://static.rust-lang.org/dist/%{rustc_package}.tar.xz |
f397d93b | 45 | # Source0-md5: e77ac3a786d013604061b17f99dd9b27 |
be28e1f1 | 46 | Source1: https://static.rust-lang.org/dist/%{bootstrap_date}/rust-%{bootstrap_rust}-x86_64-unknown-linux-gnu.tar.xz |
f397d93b | 47 | # Source1-md5: fccd4c3722193f8753d2918260f8c770 |
be28e1f1 | 48 | Source2: https://static.rust-lang.org/dist/%{bootstrap_date}/rust-%{bootstrap_rust}-i686-unknown-linux-gnu.tar.xz |
f397d93b | 49 | # Source2-md5: 6802c415076b992b3122073e258aba80 |
9eb0511e | 50 | Source3: https://static.rust-lang.org/dist/%{bootstrap_date}/rust-%{bootstrap_rust}-aarch64-unknown-linux-gnu.tar.xz |
f397d93b | 51 | # Source3-md5: a38786367b5950df6e0da112df405aef |
1fe729c8 | 52 | Source4: https://static.rust-lang.org/dist/%{bootstrap_date}/rust-%{bootstrap_rust}-arm-unknown-linux-gnueabihf.tar.xz |
f397d93b | 53 | # Source4-md5: 6bcdb6c0c6378ada390180dbc0530995 |
ad044650 | 54 | Source5: https://static.rust-lang.org/dist/%{bootstrap_date}/rust-%{bootstrap_rust}-armv7-unknown-linux-gnueabihf.tar.xz |
f397d93b | 55 | # Source5-md5: 4877c64e55ae70eb4d0f93b262b37a1e |
e361528e | 56 | URL: https://www.rust-lang.org/ |
e8f16183 JB |
57 | # for src/compiler-rt |
58 | BuildRequires: cmake >= 3.4.3 | |
e361528e | 59 | BuildRequires: curl |
2eb30149 JB |
60 | # make check needs "ps" for src/test/run-pass/wait-forked-but-failed-child.rs |
61 | BuildRequires: procps | |
e65d284f JP |
62 | BuildRequires: python3 |
63 | BuildRequires: python3-modules | |
fc3be51a | 64 | BuildRequires: rpm-build >= 4.6 |
2eb30149 JB |
65 | BuildRequires: rpmbuild(macros) >= 1.752 |
66 | %if %{without cross} | |
8f176645 | 67 | BuildRequires: curl-devel |
8745efaa | 68 | BuildRequires: libgit2-devel >= 1.4.0 |
d1b96fd8 | 69 | BuildRequires: libstdc++-devel |
2cec66d3 | 70 | %if %{with system_llvm} |
aea1d260 JP |
71 | BuildRequires: llvm >= 12.0 |
72 | BuildRequires: llvm-devel >= 12.0 | |
2cec66d3 | 73 | %endif |
7da6653d | 74 | BuildRequires: openssl-devel >= 1.0.1 |
8a54bb92 JP |
75 | BuildRequires: tar >= 1:1.22 |
76 | BuildRequires: xz | |
79a067de | 77 | BuildRequires: xz-devel |
e361528e | 78 | BuildRequires: zlib-devel |
2eb30149 | 79 | %endif |
e361528e | 80 | %if %{without bootstrap} |
d6d4cb2b | 81 | BuildRequires: %{name} >= %{bootstrap_rust} |
d1b96fd8 | 82 | BuildRequires: cargo >= %{bootstrap_cargo} |
ff5a5e0b | 83 | BuildConflicts: %{name} > %{version} |
e361528e | 84 | %endif |
2eb30149 | 85 | %ifarch x32 |
cd0c1484 JR |
86 | BuildRequires: glibc-devel(x86-64) |
87 | BuildRequires: glibc-devel(x86-x32) | |
2eb30149 JB |
88 | %if "%{_host_cpu}" == "x86_64" |
89 | # building on x86_64 host with --target x32-pld-linux | |
8f176645 | 90 | BuildRequires: curl-devel |
2eb30149 | 91 | BuildRequires: gcc-multilib-x32 |
8745efaa | 92 | BuildRequires: libgit2-devel >= 1.4.0 |
2eb30149 | 93 | BuildRequires: libstdc++-devel |
aea1d260 | 94 | %{?with_system_llvm:BuildRequires: llvm-devel >= 12.0} |
2eb30149 | 95 | BuildRequires: openssl-devel >= 1.0.1 |
79a067de | 96 | BuildRequires: xz-devel |
2eb30149 JB |
97 | BuildRequires: zlib-devel |
98 | %else | |
99 | # building x86_64-hosted crosscompiler on x32 host | |
56b25e8b | 100 | BuildRequires: curl-devel(x86-64) |
cd0c1484 | 101 | BuildRequires: curl-devel(x86-x32) |
2eb30149 | 102 | BuildRequires: gcc-multilib-64 |
8745efaa JP |
103 | BuildRequires: libgit2-devel(x86-64) >= 1.4.0 |
104 | BuildRequires: libgit2-devel(x86-x32) >= 1.4.0 | |
2eb30149 | 105 | BuildRequires: libstdc++-multilib-64-devel |
cd0c1484 | 106 | %if %{with system_llvm} |
aea1d260 JP |
107 | BuildRequires: llvm-devel(x86-64) >= 12.0 |
108 | BuildRequires: llvm-devel(x86-x32) >= 12.0 | |
cd0c1484 | 109 | %endif |
56b25e8b | 110 | BuildRequires: openssl-devel(x86-64) |
cd0c1484 | 111 | BuildRequires: openssl-devel(x86-x32) |
79a067de JP |
112 | BuildRequires: xz-devel(x86-64) |
113 | BuildRequires: xz-devel(x86-x32) | |
56b25e8b | 114 | BuildRequires: zlib-devel(x86-64) |
cd0c1484 | 115 | BuildRequires: zlib-devel(x86-x32) |
2eb30149 JB |
116 | %endif |
117 | %endif | |
e361528e ER |
118 | # The C compiler is needed at runtime just for linking. Someday rustc might |
119 | # invoke the linker directly, and then we'll only need binutils. | |
120 | # https://github.com/rust-lang/rust/issues/11937 | |
121 | Requires: gcc | |
cd0c1484 JR |
122 | Requires: %{name}-std%{?_isa} = %{version}-%{release} |
123 | %ifarch x32 | |
124 | Requires: %{name}-std(x86-64) = %{version}-%{release} | |
417178e1 | 125 | Requires: gcc-multilib-64 |
cd0c1484 | 126 | %endif |
e361528e | 127 | # Only x86_64 and i686 are Tier 1 platforms at this time. |
badbe44d | 128 | # x32 is Tier 2, only rust-std is available (no rustc or cargo). |
4f433f76 | 129 | # https://doc.rust-lang.org/nightly/rustc/platform-support.html |
1fe729c8 | 130 | ExclusiveArch: %{x8664} %{ix86} x32 aarch64 armv6hl armv7hl armv7hnl |
6ed79af8 | 131 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) |
e361528e | 132 | |
e064fbd0 | 133 | %ifarch x32 |
badbe44d | 134 | %define rust_triple x86_64-unknown-linux-gnux32 |
2eb30149 | 135 | %define rust_host_triple x86_64-unknown-linux-gnu |
badbe44d | 136 | %define rust_bootstrap_triple x86_64-unknown-linux-gnu |
a973dc7e JR |
137 | # libs in _libdir are x86_64 64bit |
138 | %define _lib lib64 | |
139 | %define _libdir %{_prefix}/lib64 | |
e064fbd0 | 140 | %else |
ad044650 | 141 | %ifarch armv6hl |
1fe729c8 JP |
142 | %define rust_triple arm-unknown-linux-gnueabihf |
143 | %define rust_host_triple %{rust_triple} | |
144 | %define rust_bootstrap_triple %{rust_triple} | |
145 | %else | |
ad044650 JP |
146 | %ifarch armv7hl armv7hnl |
147 | %define rust_triple armv7-unknown-linux-gnueabihf | |
148 | %define rust_host_triple %{rust_triple} | |
149 | %define rust_bootstrap_triple %{rust_triple} | |
6c4856ce | 150 | %define rust_suppl_targets thumbv7neon-unknown-linux-gnueabihf |
ad044650 | 151 | %else |
badbe44d | 152 | %define rust_triple %{_target_cpu}-unknown-linux-gnu |
2eb30149 JB |
153 | %define rust_host_triple %{rust_triple} |
154 | %define rust_bootstrap_triple %{rust_triple} | |
e064fbd0 | 155 | %endif |
1fe729c8 | 156 | %endif |
ad044650 | 157 | %endif |
e361528e | 158 | |
62473c95 JP |
159 | %define rust_targets %rust_triple %{?rust_suppl_targets} |
160 | ||
e361528e | 161 | %if %{without bootstrap} |
8a073211 | 162 | %define local_rust_root %{_prefix} |
e361528e | 163 | %else |
badbe44d | 164 | %define bootstrap_root rust-%{bootstrap_rust}-%{rust_bootstrap_triple} |
8a073211 | 165 | %define local_rust_root %{_builddir}/%{rustc_package}/%{bootstrap_root} |
e361528e ER |
166 | %endif |
167 | ||
18a1004b JR |
168 | # We're going to override --libdir when configuring to get rustlib into a |
169 | # common path, but we'll fix the shared libraries during install. | |
5b9d67b0 | 170 | # Without this ugly hack, rust would not be able to build itself |
18a1004b JR |
171 | # for non-bootstrap build, lib64 is just too complicated for it. |
172 | %define common_libdir %{_prefix}/lib | |
173 | %define rustlibdir %{common_libdir}/rustlib | |
174 | ||
19f98749 | 175 | # once_call/once_callable non-function libstdc++ symbols |
8f4c23f4 | 176 | %define skip_post_check_so 'librustc.*llvm.*\.so.*' |
19f98749 | 177 | |
e361528e | 178 | # ALL Rust libraries are private, because they don't keep an ABI. |
8a073211 JR |
179 | %define _noautoreqfiles lib.*-[[:xdigit:]]{8}[.]so.* |
180 | %define _noautoprovfiles lib.*-[[:xdigit:]]{8}[.]so.* | |
e361528e | 181 | |
37765656 JP |
182 | %define x_py { \ |
183 | x_py() { \ | |
184 | local cmd="$1"; \ | |
185 | shift; \ | |
e65d284f | 186 | %{?__jobs:CARGO_BUILD_JOBS=%__jobs }%{__python3} ./x.py "$cmd" %{?__jobs:-j %__jobs} "$@"; \ |
37765656 JP |
187 | }; x_py } |
188 | ||
189 | ||
e361528e ER |
190 | %description |
191 | Rust is a systems programming language that runs blazingly fast, | |
192 | prevents segfaults, and guarantees thread safety. | |
193 | ||
194 | This package includes the Rust compiler, standard library, and | |
195 | documentation generator. | |
196 | ||
e8f16183 JB |
197 | %description -l pl.UTF-8 |
198 | Rust to systemowy język programowania działający bardzo szybko, | |
199 | zapobiegający naruszeniom ochrony pamięci i gwarantujący | |
200 | bezpieczną wielowątkowość. | |
201 | ||
cd0c1484 JR |
202 | %package analysis |
203 | Summary: Metadata about the standard library | |
204 | Summary(pl.UTF-8): Metadane o standardowej bibliotece | |
205 | Group: Development/Tools | |
89a1e043 | 206 | Requires: %{name} = %{version}-%{release} |
cd0c1484 JR |
207 | |
208 | %description analysis | |
209 | Metadata about the standard library. | |
210 | ||
211 | %description analysis -l pl.UTF-8 | |
212 | Metadane o standardowej bibliotece. | |
213 | ||
214 | %package std | |
215 | Summary: Standard library for Rust | |
216 | Summary(pl.UTF-8): Standardowa biblioteka Rusta | |
217 | Group: Development/Tools | |
89a1e043 | 218 | Requires: %{name} = %{version}-%{release} |
cd0c1484 JR |
219 | |
220 | %description std | |
221 | Standard library for Rust. | |
222 | ||
223 | %description std -l pl.UTF-8 | |
224 | Standardowa biblioteka Rusta. | |
225 | ||
f397d93b JP |
226 | %package analyzer |
227 | Summary: Implementation of Language Server Protocol for Rust | |
228 | Summary(pl.UTF-8): Implementacja Language Server Protocol dla Rusta | |
229 | Group: Development/Tools | |
230 | Requires: %{name} = %{version}-%{release} | |
231 | ||
232 | %description analyzer | |
233 | Implementation of Language Server Protocol for Rust. | |
234 | ||
235 | %description analyzer -l pl.UTF-8 | |
236 | Implementacja Language Server Protocol dla Rusta. | |
237 | ||
d1b96fd8 JR |
238 | %package debugger-common |
239 | Summary: Common debugger pretty printers for Rust | |
e8f16183 | 240 | Summary(pl.UTF-8): Narzędzia wypisujące struktury Rusa wspólne dla różnych debuggerów |
d1b96fd8 | 241 | Group: Development/Debuggers |
e67020b3 | 242 | BuildArch: noarch |
d1b96fd8 JR |
243 | |
244 | %description debugger-common | |
e8f16183 JB |
245 | This package includes the common functionality for rust-gdb and |
246 | rust-lldb. | |
247 | ||
248 | %description debugger-common -l pl.UTF-8 | |
249 | Ten pakiet zawiera wspólny kod dla pakietów rust-gdb i rust-lldb. | |
d1b96fd8 | 250 | |
e361528e ER |
251 | %package gdb |
252 | Summary: GDB pretty printers for Rust | |
e8f16183 | 253 | Summary(pl.UTF-8): Ładne wypisywanie struktur Rusta w GDB |
d1b96fd8 JR |
254 | Group: Development/Debuggers |
255 | Requires: %{name}-debugger-common = %{version}-%{release} | |
e361528e | 256 | Requires: gdb |
e67020b3 | 257 | BuildArch: noarch |
e361528e ER |
258 | |
259 | %description gdb | |
260 | This package includes the rust-gdb script, which allows easier | |
261 | debugging of Rust programs. | |
262 | ||
e8f16183 JB |
263 | %description gdb -l pl.UTF-8 |
264 | Ten pakiet zawiera skrypt rust-gdb, pozwalający na łatwiejsze | |
265 | odpluskwianie programów w języku Rust. | |
266 | ||
d1b96fd8 JR |
267 | %package lldb |
268 | Summary: LLDB pretty printers for Rust | |
e8f16183 | 269 | Summary(pl.UTF-8): Ładne wypisywanie struktur Rusta w LLDB |
d1b96fd8 JR |
270 | Group: Development/Debuggers |
271 | Requires: %{name}-debugger-common = %{version}-%{release} | |
272 | Requires: lldb | |
e67020b3 | 273 | BuildArch: noarch |
d1b96fd8 JR |
274 | |
275 | %description lldb | |
276 | This package includes the rust-lldb script, which allows easier | |
277 | debugging of Rust programs. | |
278 | ||
e8f16183 JB |
279 | %description lldb -l pl.UTF-8 |
280 | Ten pakiet zawiera skrypt rust-lldb, pozwalający na łatwiejsze | |
281 | odpluskwianie programów w języku Rust. | |
282 | ||
a7fda0f8 JP |
283 | %package rls |
284 | Summary: Rust Language Server for IDE integration | |
285 | Summary(pl.UTF-8): Rust Language Server do integracji z IDE | |
286 | Group: Development/Tools | |
89a1e043 JR |
287 | Requires: %{name} = %{version}-%{release} |
288 | Requires: %{name}-analysis = %{version}-%{release} | |
a7fda0f8 JP |
289 | |
290 | %description rls | |
291 | Rust Language Server for IDE integration. | |
292 | ||
293 | %description rls -l pl.UTF-8 | |
294 | Rust Language Server do integracji z IDE. | |
295 | ||
e361528e ER |
296 | %package doc |
297 | Summary: Documentation for Rust | |
e8f16183 | 298 | Summary(pl.UTF-8): Dokumentacja do Rusta |
d1b96fd8 | 299 | Group: Documentation |
e67020b3 | 300 | BuildArch: noarch |
e361528e ER |
301 | |
302 | %description doc | |
303 | This package includes HTML documentation for the Rust programming | |
304 | language and its standard library. | |
305 | ||
e8f16183 JB |
306 | %description doc -l pl.UTF-8 |
307 | Ten pakiet zawiera dokumentację w formacie HTML do języka | |
308 | programowania Rust i jego biblioteki standardowej. | |
309 | ||
8a758d34 JP |
310 | %package -n cargo |
311 | Summary: Rust's package manager and build tool | |
312 | Summary(pl.UTF-8): Zarządca pakietów i narzędzie do budowania | |
313 | Group: Development/Tools | |
cd0c1484 | 314 | Requires: %{name}%{?_isa} |
8a758d34 JP |
315 | |
316 | %description -n cargo | |
317 | Cargo is a tool that allows Rust projects to declare their various | |
318 | dependencies and ensure that you'll always get a repeatable build. | |
319 | ||
320 | %description -n cargo -l pl.UTF-8 | |
321 | Cargo to narzędzie pozwalające projektom w języku Rust deklarować ich | |
322 | zależności i zapewniające powtarzalność procesu budowania. | |
323 | ||
6ed79af8 JB |
324 | %package -n bash-completion-cargo |
325 | Summary: Bash completion for cargo command | |
326 | Summary(pl.UTF-8): Bashowe dopełnianie parametrów polecenia cargo | |
327 | Group: Applications/Shells | |
328 | Requires: %{name} = %{version}-%{release} | |
329 | Requires: bash-completion | |
330 | ||
331 | %description -n bash-completion-cargo | |
332 | Bash completion for cargo command. | |
333 | ||
334 | %description -n bash-completion-cargo -l pl.UTF-8 | |
335 | Bashowe dopełnianie parametrów polecenia cargo. | |
336 | ||
8a758d34 JP |
337 | %package -n zsh-completion-cargo |
338 | Summary: Zsh completion for cargo command | |
339 | Summary(pl.UTF-8): Dopełnianie parametrów polecenia cargo w powłoce Zsh | |
340 | Group: Applications/Shells | |
341 | Requires: %{name} = %{version}-%{release} | |
6ed79af8 | 342 | Requires: zsh |
8a758d34 JP |
343 | |
344 | %description -n zsh-completion-cargo | |
345 | Zsh completion for cargo command. | |
346 | ||
347 | %description -n zsh-completion-cargo -l pl.UTF-8 | |
348 | Dopełnianie parametrów polecenia cargo w powłoce Zsh. | |
349 | ||
e361528e ER |
350 | %prep |
351 | %setup -q -n %{rustc_package} | |
b5eceb5e | 352 | |
e361528e | 353 | %if %{with bootstrap} |
a1735efb | 354 | %ifarch %{x8664} x32 |
e361528e ER |
355 | tar xf %{SOURCE1} |
356 | %endif | |
357 | %ifarch %{ix86} | |
358 | tar xf %{SOURCE2} | |
359 | %endif | |
c160f211 | 360 | %ifarch aarch64 |
9eb0511e | 361 | tar xf %{SOURCE3} |
c160f211 | 362 | %endif |
ad044650 | 363 | %ifarch armv6hl |
1fe729c8 JP |
364 | tar xf %{SOURCE4} |
365 | %endif | |
ad044650 JP |
366 | %ifarch armv7hl armv7hnl |
367 | tar xf %{SOURCE5} | |
368 | %endif | |
d6d4cb2b JR |
369 | %{__mv} %{bootstrap_root} %{bootstrap_root}-root |
370 | %{bootstrap_root}-root/install.sh \ | |
badbe44d | 371 | --components=cargo,rustc,rust-std-%{rust_bootstrap_triple} \ |
d6d4cb2b JR |
372 | --prefix=%{local_rust_root} \ |
373 | --disable-ldconfig | |
374 | test -f %{local_rust_root}/bin/cargo | |
e361528e ER |
375 | test -f %{local_rust_root}/bin/rustc |
376 | %endif | |
377 | ||
378 | # unbundle | |
d4b51567 | 379 | # We're disabling jemalloc, but rust-src still wants it. |
5b9d67b0 | 380 | #%{__rm} -r src/jemalloc |
9e7854c5 JP |
381 | %if %{with system_llvm} |
382 | %{__rm} -r src/llvm-project | |
383 | mkdir -p src/llvm-project/libunwind | |
384 | %endif | |
e361528e | 385 | |
e361528e ER |
386 | # rust-gdb has hardcoded SYSROOT/lib -- let's make it noarch |
387 | sed -i -e 's#DIRECTORY=".*"#DIRECTORY="%{_datadir}/%{name}/etc"#' \ | |
388 | src/etc/rust-gdb | |
389 | ||
4b354bd7 JB |
390 | # cargo has hardcoded libexec path - honour rpm _libexecdir |
391 | %if "%{_libexecdir}" != "%{_prefix}/libexec" | |
392 | suffix="%(echo "%{_libexecdir}" | %{__sed} -e 's,^%{_prefix}/,,')" | |
393 | %{__sed} -i -e 's,"libexec","'${suffix}'",' \ | |
394 | src/bootstrap/dist.rs \ | |
395 | src/tools/cargo/src/cargo/ops/registry/auth.rs | |
396 | %{__sed} -i -e 's,libexec/,'${suffix}'/,' src/tools/cargo/tests/testsuite/credential_process.rs | |
397 | %endif | |
398 | ||
5ee06aa0 JR |
399 | # The configure macro will modify some autoconf-related files, which upsets |
400 | # cargo when it tries to verify checksums in those files. If we just truncate | |
401 | # that file list, cargo won't have anything to complain about. | |
fe49e3fc | 402 | find vendor -name .cargo-checksum.json \ |
5ee06aa0 | 403 | -exec sed -i.uncheck -e 's/"files":{[^}]*}/"files":{ }/' '{}' '+' |
e361528e | 404 | |
e361528e | 405 | %build |
863a59ff JP |
406 | export CC="%{__cc}" |
407 | export CXX="%{__cxx}" | |
408 | export AR="%{__ar}" | |
e361528e | 409 | %configure \ |
2eb30149 JB |
410 | --build=%{rust_bootstrap_triple} \ |
411 | --host=%{rust_host_triple} \ | |
62473c95 | 412 | --target="%(echo %rust_targets | tr ' ' ,)" \ |
18a1004b | 413 | --libdir=%{common_libdir} \ |
e8f16183 | 414 | --disable-codegen-tests \ |
5ee06aa0 | 415 | --disable-debuginfo-lines \ |
5b9d67b0 | 416 | %if %{with full_debuginfo} |
5ee06aa0 | 417 | --disable-debuginfo-only-std \ |
e361528e | 418 | --enable-debuginfo \ |
5b9d67b0 JB |
419 | %else |
420 | --enable-debuginfo-only-std \ | |
421 | --disable-debuginfo \ | |
422 | %endif | |
6ed79af8 JB |
423 | --disable-jemalloc \ |
424 | --disable-option-checking \ | |
425 | --disable-rpath \ | |
8a758d34 | 426 | --enable-extended \ |
e8f16183 | 427 | --enable-llvm-link-shared \ |
d6d4cb2b | 428 | --enable-vendor \ |
6ed79af8 | 429 | --local-rust-root=%{local_rust_root} \ |
e8f16183 | 430 | --llvm-root=%{_prefix} \ |
595dfba2 JP |
431 | --release-channel=%{channel} \ |
432 | --set=llvm.static-libstdcpp=false | |
e361528e | 433 | |
37765656 JP |
434 | export RUST_BACKTRACE=full |
435 | %x_py dist --verbose | |
e361528e | 436 | |
37765656 | 437 | %{?with_tests:%x_py test} |
8a073211 | 438 | |
e361528e ER |
439 | %install |
440 | rm -rf $RPM_BUILD_ROOT | |
e361528e | 441 | |
13ab0532 JP |
442 | export CC="%{__cc}" |
443 | export CXX="%{__cxx}" | |
444 | export AR="%{__ar}" | |
37765656 JP |
445 | export DESTDIR=$RPM_BUILD_ROOT |
446 | %x_py install | |
e361528e | 447 | |
18a1004b JR |
448 | # Make sure the shared libraries are in the proper libdir |
449 | %if "%{_libdir}" != "%{common_libdir}" | |
450 | mkdir -p %{buildroot}%{_libdir} | |
451 | find $RPM_BUILD_ROOT%{common_libdir} -maxdepth 1 -type f -name '*.so' \ | |
452 | -exec mv -v -t $RPM_BUILD_ROOT%{_libdir} '{}' '+' | |
453 | %endif | |
454 | ||
d1b96fd8 | 455 | # The shared libraries should be executable for debuginfo extraction. |
e361528e ER |
456 | find $RPM_BUILD_ROOT%{_libdir}/ -type f -name '*.so' -exec chmod -v +x '{}' '+' |
457 | ||
d1b96fd8 JR |
458 | # The libdir libraries are identical to those under rustlib/. It's easier on |
459 | # library loading if we keep them in libdir, but we do need them in rustlib/ | |
460 | # to support dynamic linking for compiler plugins, so we'll symlink. | |
62473c95 JP |
461 | for rust_target in %rust_targets; do |
462 | for l in libstd libtest ; do | |
463 | liblib=$RPM_BUILD_ROOT%{_libdir}/${l}-*.so | |
464 | libstd=$RPM_BUILD_ROOT%{rustlibdir}/${rust_target}/lib/${l}-*.so | |
465 | if [ "$(basename ${liblib})" = "$(basename ${libstd})" ]; then | |
466 | ln -vfsr ${libstd} $RPM_BUILD_ROOT%{_libdir}/ | |
467 | fi | |
468 | done | |
a973dc7e | 469 | done |
d1b96fd8 JR |
470 | |
471 | # Remove installer artifacts (manifests, uninstall scripts, etc.) | |
18a1004b | 472 | find $RPM_BUILD_ROOT%{rustlibdir}/ -maxdepth 1 -type f -exec rm -v '{}' '+' |
e361528e ER |
473 | |
474 | # FIXME: __os_install_post will strip the rlibs | |
475 | # -- should we find a way to preserve debuginfo? | |
476 | ||
477 | # Remove unwanted documentation files (we already package them) | |
e8f16183 JB |
478 | %{__rm} $RPM_BUILD_ROOT%{_docdir}/%{name}/README.md |
479 | %{__rm} $RPM_BUILD_ROOT%{_docdir}/%{name}/COPYRIGHT | |
480 | %{__rm} $RPM_BUILD_ROOT%{_docdir}/%{name}/LICENSE-APACHE | |
481 | %{__rm} $RPM_BUILD_ROOT%{_docdir}/%{name}/LICENSE-MIT | |
e361528e ER |
482 | |
483 | # Sanitize the HTML documentation | |
484 | find $RPM_BUILD_ROOT%{_docdir}/%{name}/html -empty -delete | |
485 | find $RPM_BUILD_ROOT%{_docdir}/%{name}/html -type f -exec chmod -x '{}' '+' | |
486 | ||
487 | # Move rust-gdb's python scripts so they're noarch | |
488 | install -d $RPM_BUILD_ROOT%{_datadir}/%{name} | |
e8f16183 | 489 | %{__mv} $RPM_BUILD_ROOT%{rustlibdir}/etc $RPM_BUILD_ROOT%{_datadir}/%{name} |
e361528e | 490 | |
4f353dba JR |
491 | # We don't need stdlib source |
492 | %{__rm} -r $RPM_BUILD_ROOT%{rustlibdir}/src | |
493 | ||
1dd26160 JP |
494 | # Create the path for crate-devel packages |
495 | install -d $RPM_BUILD_ROOT%{_datadir}/cargo/registry | |
496 | ||
e361528e ER |
497 | %clean |
498 | rm -rf $RPM_BUILD_ROOT | |
499 | ||
500 | %post -p /sbin/ldconfig | |
501 | %postun -p /sbin/ldconfig | |
502 | ||
503 | %files | |
504 | %defattr(644,root,root,755) | |
16ea23d8 | 505 | %doc COPYRIGHT LICENSE-APACHE LICENSE-MIT README.md |
1736a047 | 506 | %attr(755,root,root) %{_bindir}/rust-demangler |
e361528e ER |
507 | %attr(755,root,root) %{_bindir}/rustc |
508 | %attr(755,root,root) %{_bindir}/rustdoc | |
6ed79af8 | 509 | %attr(755,root,root) %{_bindir}/rustfmt |
a973dc7e | 510 | %attr(755,root,root) %{_libdir}/librustc_driver-*.so |
e8f16183 | 511 | %attr(755,root,root) %{_libdir}/libstd-*.so |
e8f16183 | 512 | %attr(755,root,root) %{_libdir}/libtest-*.so |
e361528e ER |
513 | %{_mandir}/man1/rustc.1* |
514 | %{_mandir}/man1/rustdoc.1* | |
18a1004b | 515 | %dir %{rustlibdir} |
cd0c1484 JR |
516 | |
517 | %files analysis | |
518 | %defattr(644,root,root,755) | |
62473c95 JP |
519 | %(for rust_target in %rust_targets; do |
520 | echo "%{rustlibdir}/$rust_target/analysis" | |
521 | done | |
522 | ) | |
cd0c1484 JR |
523 | |
524 | %files std | |
525 | %defattr(644,root,root,755) | |
62473c95 JP |
526 | %(for rust_target in %rust_targets; do |
527 | cat <<EOF | |
528 | %dir %{rustlibdir}/$rust_target | |
529 | %dir %{rustlibdir}/$rust_target/lib | |
530 | %attr(755,root,root) %{rustlibdir}/$rust_target/lib/*.so | |
531 | %{rustlibdir}/$rust_target/lib/*.rlib | |
532 | EOF | |
533 | done | |
534 | ) | |
e361528e | 535 | |
f397d93b JP |
536 | %files analyzer |
537 | %defattr(644,root,root,755) | |
538 | %attr(755,root,root) %{_bindir}/rust-analyzer | |
539 | %attr(755,root,root) %{_libexecdir}/rust-analyzer-proc-macro-srv | |
540 | ||
d1b96fd8 JR |
541 | %files debugger-common |
542 | %defattr(644,root,root,755) | |
543 | %dir %{_datadir}/%{name} | |
544 | %dir %{_datadir}/%{name}/etc | |
5aae056c JP |
545 | %{_datadir}/%{name}/etc/lldb_commands |
546 | %{_datadir}/%{name}/etc/rust_types.py | |
d1b96fd8 JR |
547 | |
548 | %files lldb | |
549 | %defattr(644,root,root,755) | |
550 | %attr(755,root,root) %{_bindir}/rust-lldb | |
551 | %{_datadir}/%{name}/etc/lldb_*.py* | |
552 | ||
e361528e ER |
553 | %files gdb |
554 | %defattr(644,root,root,755) | |
555 | %attr(755,root,root) %{_bindir}/rust-gdb | |
fe49e3fc | 556 | %attr(755,root,root) %{_bindir}/rust-gdbgui |
d1b96fd8 | 557 | %{_datadir}/%{name}/etc/gdb_*.py* |
e361528e | 558 | |
a7fda0f8 JP |
559 | %files rls |
560 | %defattr(644,root,root,755) | |
561 | %attr(755,root,root) %{_bindir}/rls | |
562 | ||
e361528e ER |
563 | %files doc |
564 | %defattr(644,root,root,755) | |
565 | %dir %{_docdir}/%{name} | |
d1b96fd8 | 566 | %doc %{_docdir}/%{name}/html |
8a758d34 JP |
567 | |
568 | %files -n cargo | |
569 | %defattr(644,root,root,755) | |
570 | %attr(755,root,root) %{_bindir}/cargo | |
6ed79af8 JB |
571 | %attr(755,root,root) %{_bindir}/cargo-clippy |
572 | %attr(755,root,root) %{_bindir}/cargo-fmt | |
573 | %attr(755,root,root) %{_bindir}/clippy-driver | |
8a54bb92 | 574 | %attr(755,root,root) %{_libexecdir}/cargo-credential-1password |
8a758d34 JP |
575 | %{_mandir}/man1/cargo*.1* |
576 | %dir %{_datadir}/cargo | |
577 | %dir %{_datadir}/cargo/registry | |
578 | ||
579 | %files -n bash-completion-cargo | |
580 | %defattr(644,root,root,755) | |
581 | %{_sysconfdir}/bash_completion.d/cargo | |
582 | ||
583 | %files -n zsh-completion-cargo | |
584 | %defattr(644,root,root,755) | |
585 | %{zsh_compdir}/_cargo |