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