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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1623398 - (hide annotations) (download)
Mon Sep 7 21:35:27 2020 UTC (3 years, 7 months ago) by akien
File size: 23098 byte(s)
- Sync with Fedora: Mon Aug 03 2020 Josh Stone <jistone@redhat.com> - 1.45.2-1
  o Update to 1.45.2.

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

  ViewVC Help
Powered by ViewVC 1.1.30