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