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

  ViewVC Help
Powered by ViewVC 1.1.30