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