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

  ViewVC Help
Powered by ViewVC 1.1.30