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

  ViewVC Help
Powered by ViewVC 1.1.30