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