/[packages]/cauldron/rust/current/SPECS/rust.spec
ViewVC logotype

Contents of /cauldron/rust/current/SPECS/rust.spec

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1695232 - (show annotations) (download)
Mon Mar 1 17:09:28 2021 UTC (3 years, 1 month ago) by tv
File size: 23952 byte(s)
drop last remains of bundled_libssh2 (SILENT)
1 # (akien) This package is synced with Fedora / Josh Stone's spec.
2 # The aim is to work with them on a rust packaging policy we could share,
3 # so that we can ensure a good packaging and share the workload.
4
5
6 # Only x86_64 and i686 are Tier 1 platforms at this time.
7 # https://doc.rust-lang.org/nightly/rustc/platform-support.html
8 %global rust_arches x86_64 %ix86 armv7hl aarch64 ppc64 ppc64le s390x
9
10 # The channel can be stable, beta, or nightly
11 %{!?channel: %global channel stable}
12
13 # To bootstrap from scratch, set the channel and date from src/stage0.txt
14 # e.g. 1.10.0 wants rustc: 1.9.0-2016-05-24
15 # or nightly wants some beta-YYYY-MM-DD
16 # Note that cargo matches the program version here, not its crate version.
17 %global bootstrap_rust 1.49.0
18 %global bootstrap_cargo 1.49.0
19 %global bootstrap_channel 1.49.0
20 %global bootstrap_date 2020-12-31
21
22 # Only the specified arches will use bootstrap binaries.
23 #global bootstrap_arches %%{rust_arches}
24
25 # To bootstrap a compiler for a Tier 2 platform, we first need to build a
26 # compiler for a Tier 1 platform that targets the Tier 2 platform, then use
27 # the resulting compiler in a second build. Set bootstrap_build_arch to the
28 # Tier 1 arch for the first build, leave it undefined for the second build.
29 %bcond_with bootstrap_i586
30 %if %with bootstrap_i586
31 %ifarch i586
32 %global bootstrap_build_arch i686
33 %endif
34 %endif
35
36 # Using llvm-static may be helpful as an opt-in, e.g. to aid LLVM rebases.
37 %bcond_with llvm_static
38
39 # We can also choose to just use Rust's bundled LLVM, in case the system LLVM
40 # is insufficient. Rust currently requires LLVM 9.0+.
41 %bcond_with bundled_llvm
42 # (akien) Hacks below are needed on mga's buildsystem when we have to rebootstrap llvm.
43 ## Bundled LLVM has underlinking issues:
44 #%%global _disable_ld_no_undefined 1
45 #%%ifarch %%{arm} %%ix86
46 ## Decrease debuginfo verbosity to reduce memory consumption during final library linking
47 #%%global optflags %%(echo %%{optflags} | sed 's/-g /-g1 /')
48 #%%endif
49
50 # Requires stable libgit2 1.1
51 %if 0%{?fedora} >= 34 || 0%{?mageia} >= 8
52 %bcond_with bundled_libgit2
53 %else
54 %bcond_without bundled_libgit2
55 %endif
56
57 %if 0%{?rhel}
58 # Disable cargo->libgit2->libssh2 on RHEL, as it's not approved for FIPS (rhbz1732949)
59 %bcond_without disabled_libssh2
60 %else
61 %bcond_with disabled_libssh2
62 %endif
63
64 %if 0%{?rhel} && 0%{?rhel} < 8
65 %bcond_with curl_http2
66 %else
67 %bcond_without curl_http2
68 %endif
69
70 # LLDB isn't available everywhere...
71 %if 0%{?rhel} && 0%{?rhel} < 8
72 %bcond_with lldb
73 %else
74 %bcond_without lldb
75 %endif
76
77 %if 0%{?mageia}
78 # (akien) Added by tv in mga8/rust 1.37.0.
79 %global _python_bytecompile_extra 0
80 %endif
81
82 Name: rust
83 Version: 1.50.0
84 Release: %mkrel 2
85 Summary: The Rust Programming Language
86 %if 0%{?mageia}
87 Group: Development/Other
88 %endif
89 License: (ASL 2.0 or MIT) and (BSD and MIT)
90 # ^ written as: (rust itself) and (bundled libraries)
91 URL: https://www.rust-lang.org
92 ExclusiveArch: %{rust_arches}
93
94 %if "%{channel}" == "stable"
95 %global rustc_package rustc-%{version}-src
96 %else
97 %global rustc_package rustc-%{channel}-src
98 %endif
99 Source0: https://static.rust-lang.org/dist/%{rustc_package}.tar.xz
100
101 # This internal rust-abi change broke s390x -- revert for now.
102 # https://github.com/rust-lang/rust/issues/80810#issuecomment-781784032
103 Patch1: 0001-Revert-Auto-merge-of-79547.patch
104
105 ### RHEL-specific patches below ###
106
107 # Disable cargo->libgit2->libssh2 on RHEL, as it's not approved for FIPS (rhbz1732949)
108 Patch100: rustc-1.48.0-disable-libssh2.patch
109
110 # libcurl on RHEL7 doesn't have http2, but since cargo requests it, curl-sys
111 # will try to build it statically -- instead we turn off the feature.
112 Patch101: rustc-1.49.0-disable-http2.patch
113
114 # kernel rh1410097 causes too-small stacks for PIE.
115 # (affects RHEL6 kernels when building for RHEL7)
116 Patch102: rustc-1.48.0-no-default-pie.patch
117
118
119 # Get the Rust triple for any arch.
120 %{lua: function rust_triple(arch)
121 local abi = "gnu"
122 if arch == "armv7hl" then
123 arch = "armv7"
124 abi = "gnueabihf"
125 elseif arch == "ppc64" then
126 arch = "powerpc64"
127 elseif arch == "ppc64le" then
128 arch = "powerpc64le"
129 elseif arch == "riscv64" then
130 arch = "riscv64gc"
131 end
132 return arch.."-unknown-linux-"..abi
133 end}
134
135 %if %defined bootstrap_build_arch
136 %global rust_triple %{lua: print(rust_triple(rpm.expand("%{bootstrap_build_arch}")))}
137 %global target_triple %{lua: print(rust_triple(rpm.expand("%{_target_cpu}")))}
138 %else
139 %global rust_triple %{lua: print(rust_triple(rpm.expand("%{_target_cpu}")))}
140 %global target_triple %{rust_triple}
141 %endif
142
143 %if %defined bootstrap_arches
144 # For each bootstrap arch, add an additional binary Source.
145 # Also define bootstrap_source just for the current target.
146 %{lua: do
147 local bootstrap_arches = {}
148 for arch in string.gmatch(rpm.expand("%{bootstrap_arches}"), "%S+") do
149 table.insert(bootstrap_arches, arch)
150 end
151 local base = rpm.expand("https://static.rust-lang.org/dist/%{bootstrap_date}"
152 .."/rust-%{bootstrap_channel}")
153 local target_arch = rpm.expand("%{_target_cpu}")
154 for i, arch in ipairs(bootstrap_arches) do
155 print(string.format("Source%d: %s-%s.tar.xz\n",
156 i, base, rust_triple(arch)))
157 if arch == target_arch then
158 rpm.define("bootstrap_source "..i)
159 end
160 end
161 end}
162 %endif
163
164 %ifarch %{bootstrap_arches}
165 %global bootstrap_root rust-%{bootstrap_channel}-%{rust_triple}
166 %global local_rust_root %{_builddir}/%{bootstrap_root}/usr
167 Provides: bundled(%{name}-bootstrap) = %{bootstrap_rust}
168 %else
169 BuildRequires: cargo >= %{bootstrap_cargo}
170 %if (0%{?rhel} && 0%{?rhel} < 8) || 0%{?mageia}
171 BuildRequires: %{name} >= %{bootstrap_rust}
172 BuildConflicts: %{name} > %{version}
173 %else
174 BuildRequires: (%{name} >= %{bootstrap_rust} with %{name} <= %{version})
175 %endif
176 %global local_rust_root %{_prefix}
177 %endif
178
179 BuildRequires: make
180 BuildRequires: gcc
181 BuildRequires: gcc-c++
182 BuildRequires: ncurses-devel
183 BuildRequires: curl
184 # explicit curl-devel to avoid httpd24-curl (rhbz1540167)
185 BuildRequires: curl-devel
186 BuildRequires: pkgconfig(libcurl)
187 BuildRequires: pkgconfig(liblzma)
188 BuildRequires: pkgconfig(openssl)
189 BuildRequires: pkgconfig(zlib)
190
191 %if %without bundled_libgit2
192 BuildRequires: pkgconfig(libgit2) >= 1.1.0
193 %endif
194
195 %if %{without disabled_libssh2}
196 # needs libssh2_userauth_publickey_frommemory
197 BuildRequires: pkgconfig(libssh2) >= 1.6.0
198 %endif
199
200 %global python python3
201 BuildRequires: %{python}
202
203 %if %with bundled_llvm
204 BuildRequires: cmake3 >= 3.4.3
205 Provides: bundled(llvm) = 11.0.0
206 %else
207 BuildRequires: cmake >= 2.8.11
208 %if 0%{?epel} == 7
209 %global llvm llvm9.0
210 %endif
211 %if %defined llvm
212 %global llvm_root %{_libdir}/%{llvm}
213 %else
214 %global llvm llvm
215 %global llvm_root %{_prefix}
216 %endif
217 BuildRequires: %{llvm}-devel >= 9.0
218 %if %with llvm_static
219 BuildRequires: %{llvm}-static
220 BuildRequires: libffi-devel
221 %endif
222 %endif
223
224 # make check needs "ps" for src/test/run-pass/wait-forked-but-failed-child.rs
225 BuildRequires: procps-ng
226
227 # debuginfo-gdb tests need gdb
228 BuildRequires: gdb
229
230 # Virtual provides for folks who attempt "dnf install rustc"
231 Provides: rustc = %{version}-%{release}
232 Provides: rustc%{?_isa} = %{version}-%{release}
233
234 # Always require our exact standard library
235 Requires: %{name}-std-static%{?_isa} = %{version}-%{release}
236
237 # The C compiler is needed at runtime just for linking. Someday rustc might
238 # invoke the linker directly, and then we'll only need binutils.
239 # https://github.com/rust-lang/rust/issues/11937
240 %if 0%{?mageia}
241 Requires: gcc
242 %else
243 Requires: /usr/bin/cc
244 %endif
245
246 # ALL Rust libraries are private, because they don't keep an ABI.
247 %global _privatelibs lib(.*-[[:xdigit:]]{16}*|rustc.*)[.]so.*
248 %global __provides_exclude ^(%{_privatelibs})$
249 %global __requires_exclude ^(%{_privatelibs})$
250 %global __provides_exclude_from ^(%{_docdir}|%{rustlibdir}/src)/.*$
251 %global __requires_exclude_from ^(%{_docdir}|%{rustlibdir}/src)/.*$
252
253 # While we don't want to encourage dynamic linking to Rust shared libraries, as
254 # there's no stable ABI, we still need the unallocated metadata (.rustc) to
255 # support custom-derive plugins like #[proc_macro_derive(Foo)].
256 %if 0%{?rhel} && 0%{?rhel} < 8 || 0%{?mageia} == 7
257 # eu-strip is very eager by default, so we have to limit it to -g, only debugging symbols.
258 %global _find_debuginfo_opts -g
259 %undefine _include_minidebuginfo
260 %else
261 # Newer find-debuginfo.sh supports --keep-section, which is preferable. rhbz1465997
262 %global _find_debuginfo_opts --keep-section .rustc
263 %endif
264
265 # Use hardening ldflags.
266 %global rustflags -Clink-arg=-Wl,-z,relro,-z,now
267
268 %if %{without bundled_llvm}
269 %if "%{llvm_root}" == "%{_prefix}" || 0%{?scl:1}
270 %global llvm_has_filecheck 1
271 %endif
272 %endif
273
274 %description
275 Rust is a systems programming language that runs blazingly fast, prevents
276 segfaults, and guarantees thread safety.
277
278 This package includes the Rust compiler and documentation generator.
279
280
281 %package std-static
282 Summary: Standard library for Rust
283
284 %description std-static
285 This package includes the standard libraries for building applications
286 written in Rust.
287
288
289 %package debugger-common
290 Summary: Common debugger pretty printers for Rust
291 BuildArch: noarch
292
293 %description debugger-common
294 This package includes the common functionality for %{name}-gdb and %{name}-lldb.
295
296
297 %package gdb
298 Summary: GDB pretty printers for Rust
299 BuildArch: noarch
300 Requires: gdb
301 Requires: %{name}-debugger-common = %{version}-%{release}
302
303 %description gdb
304 This package includes the rust-gdb script, which allows easier debugging of Rust
305 programs.
306
307
308 %if %with lldb
309
310 %package lldb
311 Summary: LLDB pretty printers for Rust
312 BuildArch: noarch
313 Requires: lldb
314 Requires: %{python}-lldb
315 Requires: %{name}-debugger-common = %{version}-%{release}
316
317 %description lldb
318 This package includes the rust-lldb script, which allows easier debugging of Rust
319 programs.
320
321 %endif
322
323
324 %package doc
325 Summary: Documentation for Rust
326 # NOT BuildArch: noarch
327 # Note, while docs are mostly noarch, some things do vary by target_arch.
328 # Koji will fail the build in rpmdiff if two architectures build a noarch
329 # subpackage differently, so instead we have to keep its arch.
330
331 %description doc
332 This package includes HTML documentation for the Rust programming language and
333 its standard library.
334
335
336 %package -n cargo
337 Summary: Rust's package manager and build tool
338 %if %with bundled_libgit2
339 Provides: bundled(libgit2) = 1.1.0
340 %endif
341 # For tests:
342 BuildRequires: git
343 # Cargo is not much use without Rust
344 Requires: rust
345
346 # "cargo vendor" is a builtin command starting with 1.37. The Obsoletes and
347 # Provides are mostly relevant to RHEL, but harmless to have on Fedora/etc. too
348 Obsoletes: cargo-vendor <= 0.1.23
349 Provides: cargo-vendor = %{version}-%{release}
350
351 %description -n cargo
352 Cargo is a tool that allows Rust projects to declare their various dependencies
353 and ensure that you'll always get a repeatable build.
354
355
356 %package -n cargo-doc
357 Summary: Documentation for Cargo
358 BuildArch: noarch
359 # Cargo no longer builds its own documentation
360 # https://github.com/rust-lang/cargo/pull/4904
361 Requires: rust-doc = %{version}-%{release}
362
363 %description -n cargo-doc
364 This package includes HTML documentation for Cargo.
365
366
367 %package -n rustfmt
368 Summary: Tool to find and fix Rust formatting issues
369 Requires: cargo
370
371 # The component/package was rustfmt-preview until Rust 1.31.
372 Obsoletes: rustfmt-preview < 1.0.0
373 Provides: rustfmt-preview = %{version}-%{release}
374
375 %description -n rustfmt
376 A tool for formatting Rust code according to style guidelines.
377
378
379 %package -n rls
380 Summary: Rust Language Server for IDE integration
381 %if %with bundled_libgit2
382 Provides: bundled(libgit2) = 1.1.0
383 %endif
384 Requires: rust-analysis
385 # /usr/bin/rls is dynamically linked against internal rustc libs
386 Requires: %{name}%{?_isa} = %{version}-%{release}
387
388 # The component/package was rls-preview until Rust 1.31.
389 Obsoletes: rls-preview < 1.31.6
390 Provides: rls-preview = %{version}-%{release}
391
392 %description -n rls
393 The Rust Language Server provides a server that runs in the background,
394 providing IDEs, editors, and other tools with information about Rust programs.
395 It supports functionality such as 'goto definition', symbol search,
396 reformatting, and code completion, and enables renaming and refactorings.
397
398
399 %package -n clippy
400 Summary: Lints to catch common mistakes and improve your Rust code
401 Requires: cargo
402 # /usr/bin/clippy-driver is dynamically linked against internal rustc libs
403 Requires: %{name}%{?_isa} = %{version}-%{release}
404
405 # The component/package was clippy-preview until Rust 1.31.
406 Obsoletes: clippy-preview <= 0.0.212
407 Provides: clippy-preview = %{version}-%{release}
408
409 %description -n clippy
410 A collection of lints to catch common mistakes and improve your Rust code.
411
412
413 %package src
414 Summary: Sources for the Rust standard library
415 BuildArch: noarch
416
417 %description src
418 This package includes source files for the Rust standard library. It may be
419 useful as a reference for code completion tools in various editors.
420
421
422 %package analysis
423 Summary: Compiler analysis data for the Rust standard library
424 Requires: rust-std-static%{?_isa} = %{version}-%{release}
425
426 %description analysis
427 This package contains analysis data files produced with rustc's -Zsave-analysis
428 feature for the Rust standard library. The RLS (Rust Language Server) uses this
429 data to provide information about the Rust standard library.
430
431
432 %prep
433
434 %ifarch %{bootstrap_arches}
435 %setup -q -n %{bootstrap_root} -T -b %{bootstrap_source}
436 ./install.sh --components=cargo,rustc,rust-std-%{rust_triple} \
437 --prefix=%{local_rust_root} --disable-ldconfig
438 test -f '%{local_rust_root}/bin/cargo'
439 test -f '%{local_rust_root}/bin/rustc'
440 %endif
441
442 %setup -q -n %{rustc_package}
443
444 %patch1 -p1
445
446 %if %with disabled_libssh2
447 %patch100 -p1
448 %endif
449
450 %if %without curl_http2
451 %patch101 -p1
452 rm -rf vendor/libnghttp2-sys/
453 %endif
454
455 %if 0%{?rhel} && 0%{?rhel} < 8
456 %patch102 -p1
457 %endif
458
459 %if "%{python}" != "python3"
460 # Use our preferred python first
461 sed -i.try-python -e '/^try python3 /i try "%{python}" "$@"' ./configure
462 %endif
463
464 %if %without bundled_llvm
465 rm -rf src/llvm-project/
466 mkdir -p src/llvm-project/libunwind/
467 %endif
468
469 # Remove other unused vendored libraries
470 rm -rf vendor/curl-sys/curl/
471 rm -rf vendor/jemalloc-sys/jemalloc/
472 rm -rf vendor/libssh2-sys/libssh2/
473 rm -rf vendor/libz-sys/src/zlib/
474 rm -rf vendor/libz-sys/src/zlib-ng/
475 rm -rf vendor/lzma-sys/xz-*/
476 rm -rf vendor/openssl-src/openssl/
477
478 %if %without bundled_libgit2
479 rm -rf vendor/libgit2-sys/libgit2/
480 %endif
481
482 %if %with disabled_libssh2
483 rm -rf vendor/libssh2-sys/
484 %endif
485
486 # This only affects the transient rust-installer, but let it use our dynamic xz-libs
487 sed -i.lzma -e '/LZMA_API_STATIC/d' src/bootstrap/tool.rs
488
489 %if %{with bundled_llvm} && 0%{?epel} == 7
490 mkdir -p cmake-bin
491 ln -s /usr/bin/cmake3 cmake-bin/cmake
492 %global cmake_path $PWD/cmake-bin
493 %endif
494
495 %if %{without bundled_llvm} && %{with llvm_static}
496 # Static linking to distro LLVM needs to add -lffi
497 # https://github.com/rust-lang/rust/issues/34486
498 sed -i.ffi -e '$a #[link(name = "ffi")] extern {}' \
499 compiler/rustc_llvm/src/lib.rs
500 %endif
501
502 # The configure macro will modify some autoconf-related files, which upsets
503 # cargo when it tries to verify checksums in those files. If we just truncate
504 # that file list, cargo won't have anything to complain about.
505 find vendor -name .cargo-checksum.json \
506 -exec sed -i.uncheck -e 's/"files":{[^}]*}/"files":{ }/' '{}' '+'
507
508 # Sometimes Rust sources start with #![...] attributes, and "smart" editors think
509 # it's a shebang and make them executable. Then brp-mangle-shebangs gets upset...
510 find -name '*.rs' -type f -perm /111 -exec chmod -v -x '{}' '+'
511
512 # Set up shared environment variables for build/install/check
513 %global rust_env RUSTFLAGS="%{rustflags}"
514 %if 0%{?cmake_path:1}
515 %global rust_env %{rust_env} PATH="%{cmake_path}:$PATH"
516 %endif
517 %if %without bundled_libgit2
518 # convince libgit2-sys to use the distro libgit2
519 %global rust_env %{rust_env} LIBGIT2_SYS_USE_PKG_CONFIG=1
520 %endif
521 %if %without disabled_libssh2
522 # convince libssh2-sys to use the distro libssh2
523 %global rust_env %{rust_env} LIBSSH2_SYS_USE_PKG_CONFIG=1
524 %endif
525
526
527 %build
528 export %{rust_env}
529
530 # We're going to override --libdir when configuring to get rustlib into a
531 # common path, but we'll fix the shared libraries during install.
532 %global common_libdir %{_prefix}/lib
533 %global rustlibdir %{common_libdir}/rustlib
534
535 %ifarch aarch64 %{arm} %{ix86} s390x
536 # full debuginfo is exhausting memory; just do libstd for now
537 # https://github.com/rust-lang/rust/issues/45854
538 %if 0%{?rhel} && 0%{?rhel} < 8
539 # Older rpmbuild didn't work with partial debuginfo coverage.
540 %global debug_package %{nil}
541 %define enable_debuginfo --debuginfo-level=0
542 %else
543 %define enable_debuginfo --debuginfo-level=0 --debuginfo-level-std=2
544 %endif
545 %else
546 %define enable_debuginfo --debuginfo-level=2
547 %endif
548
549 # We want the best optimization for std, but it caused problems for rpm-ostree
550 # on ppc64le to have all of the compiler_builtins in a single object:
551 # https://bugzilla.redhat.com/show_bug.cgi?id=1713090
552 %ifnarch %{power64}
553 %define codegen_units_std --set rust.codegen-units-std=1
554 %endif
555
556 # Some builders have relatively little memory for their CPU count.
557 # At least 2GB per CPU is a good rule of thumb for building rustc.
558 ncpus=$(/usr/bin/getconf _NPROCESSORS_ONLN)
559 max_cpus=$(( ($(free -g | awk '/^Mem:/{print $2}') + 1) / 2 ))
560 if [ "$max_cpus" -ge 1 -a "$max_cpus" -lt "$ncpus" ]; then
561 ncpus="$max_cpus"
562 fi
563
564 %configure --disable-option-checking \
565 --libdir=%{common_libdir} \
566 --build=%{rust_triple} --host=%{rust_triple} --target=%{target_triple} \
567 --python=%{python} \
568 --local-rust-root=%{local_rust_root} \
569 %{!?with_bundled_llvm: --llvm-root=%{llvm_root} \
570 %{!?llvm_has_filecheck: --disable-codegen-tests} \
571 %{!?with_llvm_static: --enable-llvm-link-shared } } \
572 --disable-rpath \
573 %{enable_debuginfo} \
574 --enable-extended \
575 --tools=analysis,cargo,clippy,rls,rustfmt,src \
576 --enable-vendor \
577 --enable-verbose-tests \
578 %{?codegen_units_std} \
579 --release-channel=%{channel} \
580 --release-description="%{?mageia:Mageia }%{?rhel:Red Hat }%{version}-%{release}"
581
582 %{python} ./x.py build -j "$ncpus" --stage 2
583 %{python} ./x.py doc --stage 2
584
585
586 %install
587 export %{rust_env}
588
589 DESTDIR=%{buildroot} %{python} ./x.py install
590
591 # Make sure the shared libraries are in the proper libdir
592 %if "%{_libdir}" != "%{common_libdir}"
593 mkdir -p %{buildroot}%{_libdir}
594 find %{buildroot}%{common_libdir} -maxdepth 1 -type f -name '*.so' \
595 -exec mv -v -t %{buildroot}%{_libdir} '{}' '+'
596 %endif
597
598 # The shared libraries should be executable for debuginfo extraction.
599 find %{buildroot}%{_libdir} -maxdepth 1 -type f -name '*.so' \
600 -exec chmod -v +x '{}' '+'
601
602 # The libdir libraries are identical to those under rustlib/. It's easier on
603 # library loading if we keep them in libdir, but we do need them in rustlib/
604 # to support dynamic linking for compiler plugins, so we'll symlink.
605 (cd "%{buildroot}%{rustlibdir}/%{rust_triple}/lib" &&
606 find ../../../../%{_lib} -maxdepth 1 -name '*.so' |
607 while read lib; do
608 if [ -f "${lib##*/}" ]; then
609 # make sure they're actually identical!
610 cmp "$lib" "${lib##*/}"
611 ln -v -f -s -t . "$lib"
612 fi
613 done)
614
615 # Remove installer artifacts (manifests, uninstall scripts, etc.)
616 find %{buildroot}%{rustlibdir} -maxdepth 1 -type f -exec rm -v '{}' '+'
617
618 # Remove backup files from %%configure munging
619 find %{buildroot}%{rustlibdir} -type f -name '*.orig' -exec rm -v '{}' '+'
620
621 # https://fedoraproject.org/wiki/Changes/Make_ambiguous_python_shebangs_error
622 # We don't actually need to ship any of those python scripts in rust-src anyway.
623 find %{buildroot}%{rustlibdir}/src -type f -name '*.py' -exec rm -v '{}' '+'
624
625 # FIXME: __os_install_post will strip the rlibs
626 # -- should we find a way to preserve debuginfo?
627
628 # Remove unwanted documentation files (we already package them)
629 rm -f %{buildroot}%{_docdir}/%{name}/README.md
630 rm -f %{buildroot}%{_docdir}/%{name}/COPYRIGHT
631 rm -f %{buildroot}%{_docdir}/%{name}/LICENSE
632 rm -f %{buildroot}%{_docdir}/%{name}/LICENSE-APACHE
633 rm -f %{buildroot}%{_docdir}/%{name}/LICENSE-MIT
634 rm -f %{buildroot}%{_docdir}/%{name}/LICENSE-THIRD-PARTY
635 rm -f %{buildroot}%{_docdir}/%{name}/*.old
636
637 # Sanitize the HTML documentation
638 find %{buildroot}%{_docdir}/%{name}/html -empty -delete
639 find %{buildroot}%{_docdir}/%{name}/html -type f -exec chmod -x '{}' '+'
640
641 # Create the path for crate-devel packages
642 mkdir -p %{buildroot}%{_datadir}/cargo/registry
643
644 # Cargo no longer builds its own documentation
645 # https://github.com/rust-lang/cargo/pull/4904
646 mkdir -p %{buildroot}%{_docdir}/cargo
647 ln -sT ../rust/html/cargo/ %{buildroot}%{_docdir}/cargo/html
648
649 %if %without lldb
650 rm -f %{buildroot}%{_bindir}/rust-lldb
651 rm -f %{buildroot}%{rustlibdir}/etc/lldb_*
652 %endif
653
654 # We don't want Rust copies of LLVM tools (rust-lld, rust-llvm-dwp)
655 rm -f %{buildroot}%{rustlibdir}/%{rust_triple}/bin/rust-ll*
656
657
658 %check
659 export %{rust_env}
660
661 # The results are not stable on koji, so mask errors and just log it.
662 %{python} ./x.py test --no-fail-fast --stage 2 || :
663 %{python} ./x.py test --no-fail-fast --stage 2 cargo || :
664 %{python} ./x.py test --no-fail-fast --stage 2 clippy || :
665 %{python} ./x.py test --no-fail-fast --stage 2 rls || :
666 %{python} ./x.py test --no-fail-fast --stage 2 rustfmt || :
667
668
669 %{?ldconfig_scriptlets}
670
671
672 %files
673 %license COPYRIGHT LICENSE-APACHE LICENSE-MIT
674 %doc README.md
675 %{_bindir}/rustc
676 %{_bindir}/rustdoc
677 %{_libdir}/*.so
678 %{_mandir}/man1/rustc.1*
679 %{_mandir}/man1/rustdoc.1*
680 %dir %{rustlibdir}
681 %dir %{rustlibdir}/%{rust_triple}
682 %dir %{rustlibdir}/%{rust_triple}/lib
683 %{rustlibdir}/%{rust_triple}/lib/*.so
684 %if %defined bootstrap_build_arch
685 %dir %{rustlibdir}/%{target_triple}
686 %dir %{rustlibdir}/%{target_triple}/lib
687 %{rustlibdir}/%{target_triple}/lib/*.so
688 %endif
689
690
691 %files std-static
692 %dir %{rustlibdir}
693 %dir %{rustlibdir}/%{rust_triple}
694 %dir %{rustlibdir}/%{rust_triple}/lib
695 %{rustlibdir}/%{rust_triple}/lib/*.rlib
696 %if %defined bootstrap_build_arch
697 %dir %{rustlibdir}/%{target_triple}
698 %dir %{rustlibdir}/%{target_triple}/lib
699 %{rustlibdir}/%{target_triple}/lib/*.rlib
700 %endif
701
702
703 %files debugger-common
704 %dir %{rustlibdir}
705 %dir %{rustlibdir}/etc
706 %{rustlibdir}/etc/rust_*.py*
707
708
709 %files gdb
710 %{_bindir}/rust-gdb
711 %{rustlibdir}/etc/gdb_*
712 %exclude %{_bindir}/rust-gdbgui
713
714
715 %if %with lldb
716 %files lldb
717 %{_bindir}/rust-lldb
718 %{rustlibdir}/etc/lldb_*
719 %endif
720
721
722 %files doc
723 %docdir %{_docdir}/%{name}
724 %dir %{_docdir}/%{name}
725 %dir %{_docdir}/%{name}/html
726 %{_docdir}/%{name}/html/*/
727 %{_docdir}/%{name}/html/*.html
728 %{_docdir}/%{name}/html/*.css
729 %{_docdir}/%{name}/html/*.js
730 %{_docdir}/%{name}/html/*.png
731 %{_docdir}/%{name}/html/*.svg
732 %{_docdir}/%{name}/html/*.woff
733 %license %{_docdir}/%{name}/html/*.txt
734 %license %{_docdir}/%{name}/html/*.md
735
736
737 %files -n cargo
738 %license src/tools/cargo/LICENSE-APACHE src/tools/cargo/LICENSE-MIT src/tools/cargo/LICENSE-THIRD-PARTY
739 %doc src/tools/cargo/README.md
740 %{_bindir}/cargo
741 %{_libexecdir}/cargo*
742 %{_mandir}/man1/cargo*.1*
743 %{_sysconfdir}/bash_completion.d/cargo
744 %{_datadir}/zsh/site-functions/_cargo
745 %dir %{_datadir}/cargo
746 %dir %{_datadir}/cargo/registry
747
748
749 %files -n cargo-doc
750 %docdir %{_docdir}/cargo
751 %dir %{_docdir}/cargo
752 %{_docdir}/cargo/html
753
754
755 %files -n rustfmt
756 %{_bindir}/rustfmt
757 %{_bindir}/cargo-fmt
758 %doc src/tools/rustfmt/{README,CHANGELOG,Configurations}.md
759 %license src/tools/rustfmt/LICENSE-{APACHE,MIT}
760
761
762 %files -n rls
763 %{_bindir}/rls
764 %doc src/tools/rls/{README.md,COPYRIGHT,debugging.md}
765 %license src/tools/rls/LICENSE-{APACHE,MIT}
766
767
768 %files -n clippy
769 %{_bindir}/cargo-clippy
770 %{_bindir}/clippy-driver
771 %doc src/tools/clippy/{README.md,CHANGELOG.md}
772 %license src/tools/clippy/LICENSE-{APACHE,MIT}
773
774
775 %files src
776 %dir %{rustlibdir}
777 %{rustlibdir}/src
778
779
780 %files analysis
781 %{rustlibdir}/%{rust_triple}/analysis/
782 %if %defined bootstrap_build_arch
783 %{rustlibdir}/%{target_triple}/analysis/
784 %endif

  ViewVC Help
Powered by ViewVC 1.1.30