/[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 1544256 - (hide annotations) (download)
Wed Feb 19 12:09:02 2020 UTC (4 years, 1 month ago) by akien
File size: 23861 byte(s)
- Sync with Fedora: Thu Jan 30 2020 Josh Stone <jistone@redhat.com> - 1.41.0-1
  o Update to 1.41.0.
  o Build compiletest with in-tree libtest
  o Fix ARM EHABI unwinding
  o Reintroduce the workaround for LLVM library path

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

  ViewVC Help
Powered by ViewVC 1.1.30