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