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