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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1208625 - (show annotations) (download)
Mon Mar 12 17:57:01 2018 UTC (6 years, 1 month ago) by akien
File size: 16291 byte(s)
- Sync with Fedora: Thu Mar 01 2018 Josh Stone <jistone@redhat.com> - 1.24.1-1
  o Update to 1.24.1.
  o Backport a rebuild fix for rust#48308.
  o rhbz1546541: drop full-bootstrap; cmp libs before symlinking.
  o Backport pr46592 to fix local_rebuild bootstrapping.
  o Backport pr48362 to fix relative/absolute libdir.
  o Patch binaryen for GCC 8
1 # (akien) This package is synced with Fedora / Josh Stone's spec.
2 # The aim is to work with them on a rust packaging policy we could share,
3 # so that we can ensure a good packaging and share the workload.
4
5
6 # Only x86_64 and i686 are Tier 1 platforms at this time.
7 # https://forge.rust-lang.org/platform-support.html
8 %global rust_arches x86_64 i686 i586 armv7hl aarch64 ppc64 ppc64le s390x
9
10 # The channel can be stable, beta, or nightly
11 %{!?channel: %global channel stable}
12
13 # To bootstrap from scratch, set the channel and date from src/stage0.txt
14 # e.g. 1.10.0 wants rustc: 1.9.0-2016-05-24
15 # or nightly wants some beta-YYYY-MM-DD
16 %global bootstrap_rust 1.23.0
17 %global bootstrap_cargo 0.24.0
18 %global bootstrap_channel %{bootstrap_rust}
19 %global bootstrap_date 2018-01-04
20
21 # Only the specified arches will use bootstrap binaries.
22 #global bootstrap_arches %%{rust_arches}
23
24 # We generally don't want llvm-static present at all, since llvm-config will
25 # make us link statically. But we can opt in, e.g. to aid LLVM rebases.
26 # FIXME: LLVM 3.9 prefers shared linking now! Which is good, but next time we
27 # *want* static we'll have to force it with "llvm-config --link-static".
28 # See also https://github.com/rust-lang/rust/issues/36854
29 # The new rustbuild accepts `--enable-llvm-link-shared`, else links static.
30 %bcond_with llvm_static
31
32 # We can also choose to just use Rust's bundled LLVM, in case the system LLVM
33 # is insufficient. Rust currently requires LLVM 3.9+.
34 %if 0%{?rhel} && !0%{?epel}
35 %bcond_without bundled_llvm
36 %else
37 %bcond_with bundled_llvm
38 %endif
39
40 # LLDB only works on some architectures
41 %ifarch %{arm} aarch64 %{ix86} x86_64
42 # LLDB isn't available everywhere...
43 %if !0%{?rhel}
44 %bcond_without lldb
45 %else
46 %bcond_with lldb
47 %endif
48 %else
49 %bcond_with lldb
50 %endif
51
52
53
54 Name: rust
55 Version: 1.24.1
56 Release: %mkrel 1
57 Summary: The Rust Programming Language
58 %if 0%{?mageia}
59 Group: Development/Other
60 %endif
61 License: (ASL 2.0 or MIT) and (BSD and ISC and MIT)
62 # ^ written as: (rust itself) and (bundled libraries)
63 URL: https://www.rust-lang.org
64 ExclusiveArch: %{rust_arches}
65
66 %if "%{channel}" == "stable"
67 %global rustc_package rustc-%{version}-src
68 %else
69 %global rustc_package rustc-%{channel}-src
70 %endif
71 Source0: https://static.rust-lang.org/dist/%{rustc_package}.tar.xz
72
73 # https://github.com/WebAssembly/binaryen/pull/1400
74 Patch1: 0001-Fix-Wcatch-value-from-GCC-8.patch
75
76 # https://github.com/rust-lang/rust/pull/47610
77 Patch2: 0001-Update-DW_OP_plus-to-DW_OP_plus_uconst.patch
78
79 # https://github.com/rust-lang/rust/pull/47688
80 Patch3: 0001-Let-LLVM-5-add-DW_OP_deref-to-indirect-args-itself.patch
81
82 # https://github.com/rust-lang/rust/pull/47884
83 Patch4: 0001-Ignore-run-pass-sse2-when-using-system-LLVM.patch
84
85 # https://github.com/rust-lang/rust/pull/47912
86 Patch5: 0001-Enable-stack-probe-tests-with-system-LLVM-5.0.patch
87 Patch6: 0002-Use-a-range-to-identify-SIGSEGV-in-stack-guards.patch
88
89 # fix for https://github.com/rust-lang/rust/issues/47469
90 # via https://github.com/rust-lang/rust/pull/46592
91 Patch7: rust-pr46592-bootstrap-libdir.patch
92 Patch8: rust-pr48362-libdir-relative.patch
93
94 # Get the Rust triple for any arch.
95 %{lua: function rust_triple(arch)
96 local abi = "gnu"
97 if arch == "armv7hl" then
98 arch = "armv7"
99 abi = "gnueabihf"
100 elseif arch == "ppc64" then
101 arch = "powerpc64"
102 elseif arch == "ppc64le" then
103 arch = "powerpc64le"
104 elseif arch == "i586" then
105 arch = "i686"
106 end
107 return arch.."-unknown-linux-"..abi
108 end}
109
110 %global rust_triple %{lua: print(rust_triple(rpm.expand("%{_target_cpu}")))}
111
112 %if %defined bootstrap_arches
113 # For each bootstrap arch, add an additional binary Source.
114 # Also define bootstrap_source just for the current target.
115 %{lua: do
116 local bootstrap_arches = {}
117 for arch in string.gmatch(rpm.expand("%{bootstrap_arches}"), "%S+") do
118 table.insert(bootstrap_arches, arch)
119 end
120 local base = rpm.expand("https://static.rust-lang.org/dist/%{bootstrap_date}"
121 .."/rust-%{bootstrap_channel}")
122 local target_arch = rpm.expand("%{_target_cpu}")
123 for i, arch in ipairs(bootstrap_arches) do
124 print(string.format("Source%d: %s-%s.tar.xz\n",
125 i, base, rust_triple(arch)))
126 if arch == target_arch then
127 rpm.define("bootstrap_source "..i)
128 end
129 end
130 end}
131 %endif
132
133 %ifarch %{bootstrap_arches}
134 %global bootstrap_root rust-%{bootstrap_channel}-%{rust_triple}
135 %global local_rust_root %{_builddir}/%{bootstrap_root}/usr
136 Provides: bundled(%{name}-bootstrap) = %{bootstrap_rust}
137 %else
138 BuildRequires: cargo >= %{bootstrap_cargo}
139 BuildRequires: %{name} >= %{bootstrap_rust}
140 BuildConflicts: %{name} > %{version}
141 %global local_rust_root %{_prefix}
142 %endif
143
144 BuildRequires: make
145 BuildRequires: gcc
146 BuildRequires: gcc-c++
147 BuildRequires: ncurses-devel
148 BuildRequires: zlib-devel
149 BuildRequires: curl
150
151 %if 0%{?rhel} && 0%{?rhel} <= 7
152 %global python python2
153 %else
154 %global python python3
155 %endif
156 BuildRequires: %{python}
157
158 %if %with bundled_llvm
159 BuildRequires: cmake3 >= 3.4.3
160 Provides: bundled(llvm) = 4.0
161 %else
162 BuildRequires: cmake >= 2.8.7
163 %if 0%{?epel} || 0%{?fedora} >= 28
164 %global llvm llvm5.0
165 %endif
166 %if %defined llvm
167 %global llvm_root %{_libdir}/%{llvm}
168 %else
169 %global llvm llvm
170 %global llvm_root %{_prefix}
171 %endif
172 BuildRequires: %{llvm}-devel >= 3.7
173 %if %with llvm_static
174 BuildRequires: %{llvm}-static
175 BuildRequires: libffi-devel
176 %else
177 # Make sure llvm-config doesn't see it.
178 BuildConflicts: %{llvm}-static
179 %endif
180 %endif
181
182 # make check needs "ps" for src/test/run-pass/wait-forked-but-failed-child.rs
183 BuildRequires: procps-ng
184
185 # debuginfo-gdb tests need gdb
186 BuildRequires: gdb
187
188 # TODO: work on unbundling these!
189 Provides: bundled(hoedown) = 3.0.7
190 Provides: bundled(jquery) = 2.1.4
191 Provides: bundled(libbacktrace) = 6.1.0
192 Provides: bundled(miniz) = 1.16~beta+r1
193
194 # Virtual provides for folks who attempt "dnf install rustc"
195 Provides: rustc = %{version}-%{release}
196 Provides: rustc%{?_isa} = %{version}-%{release}
197
198 # Always require our exact standard library
199 Requires: %{name}-std-static%{?_isa} = %{version}-%{release}
200
201 # The C compiler is needed at runtime just for linking. Someday rustc might
202 # invoke the linker directly, and then we'll only need binutils.
203 # https://github.com/rust-lang/rust/issues/11937
204 %if 0%{?mageia}
205 Requires: gcc
206 %else
207 Requires: /usr/bin/cc
208 %endif
209
210 # ALL Rust libraries are private, because they don't keep an ABI.
211 %global _privatelibs lib.*-[[:xdigit:]]*[.]so.*
212 %global __provides_exclude ^(%{_privatelibs})$
213 %global __requires_exclude ^(%{_privatelibs})$
214 %global __provides_exclude_from ^%{_docdir}/.*$
215 %global __requires_exclude_from ^%{_docdir}/.*$
216
217 # While we don't want to encourage dynamic linking to Rust shared libraries, as
218 # there's no stable ABI, we still need the unallocated metadata (.rustc) to
219 # support custom-derive plugins like #[proc_macro_derive(Foo)]. But eu-strip is
220 # very eager by default, so we have to limit it to -g, only debugging symbols.
221 %if 0%{?fedora} >= 27 || 0%{?mageia} >= 7
222 # Newer find-debuginfo.sh supports --keep-section, which is preferable. rhbz1465997
223 %global _find_debuginfo_opts --keep-section .rustc
224 %else
225 %global _find_debuginfo_opts -g
226 %undefine _include_minidebuginfo
227 %endif
228
229 # Use hardening ldflags.
230 %global rustflags -Clink-arg=-Wl,-z,relro,-z,now
231
232 %if %{without bundled_llvm} && "%{llvm_root}" != "%{_prefix}"
233 # https://github.com/rust-lang/rust/issues/40717
234 %global library_path $(%{llvm_root}/bin/llvm-config --libdir)
235 %endif
236
237 %description
238 Rust is a systems programming language that runs blazingly fast, prevents
239 segfaults, and guarantees thread safety.
240
241 This package includes the Rust compiler and documentation generator.
242
243
244 %package std-static
245 Summary: Standard library for Rust
246
247 %description std-static
248 This package includes the standard libraries for building applications
249 written in Rust.
250
251
252 %package debugger-common
253 Summary: Common debugger pretty printers for Rust
254 BuildArch: noarch
255
256 %description debugger-common
257 This package includes the common functionality for %{name}-gdb and %{name}-lldb.
258
259
260 %package gdb
261 Summary: GDB pretty printers for Rust
262 BuildArch: noarch
263 Requires: gdb
264 Requires: %{name}-debugger-common = %{version}-%{release}
265
266 %if 0%{?mageia} == 6
267 # (akien) Handle moved files between our old Mageia package and this Fedora-based one
268 Conflicts: rust < 1.11.0-3
269 %endif
270
271 %description gdb
272 This package includes the rust-gdb script, which allows easier debugging of Rust
273 programs.
274
275
276 %if %with lldb
277
278 %package lldb
279 Summary: LLDB pretty printers for Rust
280
281 # It could be noarch, but lldb has limited availability
282 #BuildArch: noarch
283
284 Requires: lldb
285 %if 0%{?mageia} == 6
286 Requires: python-lldb
287 %else
288 Requires: python2-lldb
289 %endif
290 Requires: %{name}-debugger-common = %{version}-%{release}
291
292 %description lldb
293 This package includes the rust-lldb script, which allows easier debugging of Rust
294 programs.
295
296 %endif
297
298
299 %package doc
300 Summary: Documentation for Rust
301 # NOT BuildArch: noarch
302 # Note, while docs are mostly noarch, some things do vary by target_arch.
303 # Koji will fail the build in rpmdiff if two architectures build a noarch
304 # subpackage differently, so instead we have to keep its arch.
305
306 %description doc
307 This package includes HTML documentation for the Rust programming language and
308 its standard library.
309
310
311 %package src
312 Summary: Sources for the Rust standard library
313 BuildArch: noarch
314
315 %description src
316 This package includes source files for the Rust standard library. It may be
317 useful as a reference for code completion tools in various editors.
318
319
320 %prep
321
322 %ifarch %{bootstrap_arches}
323 %setup -q -n %{bootstrap_root} -T -b %{bootstrap_source}
324 ./install.sh --components=cargo,rustc,rust-std-%{rust_triple} \
325 --prefix=%{local_rust_root} --disable-ldconfig
326 test -f '%{local_rust_root}/bin/cargo'
327 test -f '%{local_rust_root}/bin/rustc'
328 %endif
329
330 %setup -q -n %{rustc_package}
331
332 pushd src/binaryen
333 %patch1 -p1 -b .catch-value
334 popd
335
336 %patch2 -p1 -b .DW_OP_plus_uconst
337 %patch3 -p1 -b .DW_OP_deref
338 %patch4 -p1 -b .sse2
339 %patch5 -p1 -b .out-of-stack
340 %patch6 -p1 -b .out-of-stack
341 %patch7 -p1 -b .bootstrap-libdir
342 %patch8 -p1 -b .bootstrap-libdir-relative
343
344 %if "%{python}" == "python3"
345 sed -i.try-py3 -e '/try python2.7/i try python3 "$@"' ./configure
346 %endif
347
348 # We're disabling jemalloc, but rust-src still wants it.
349 # rm -rf src/jemalloc/
350
351 %if %without bundled_llvm
352 rm -rf src/llvm/
353 %endif
354
355 # extract bundled licenses for packaging
356 cp src/rt/hoedown/LICENSE src/rt/hoedown/LICENSE-hoedown
357 sed -e '/*\//q' src/libbacktrace/backtrace.h \
358 >src/libbacktrace/LICENSE-libbacktrace
359
360 # This tests a problem of exponential growth, which seems to be less-reliably
361 # fixed when running on older LLVM and/or some arches. Just skip it for now.
362 sed -i.ignore -e '1i // ignore-test may still be exponential...' \
363 src/test/run-pass/issue-41696.rs
364
365 %if %{with bundled_llvm} && 0%{?epel}
366 mkdir -p cmake-bin
367 ln -s /usr/bin/cmake3 cmake-bin/cmake
368 %global cmake_path $PWD/cmake-bin
369 %endif
370
371 %if %{without bundled_llvm} && %{with llvm_static}
372 # Static linking to distro LLVM needs to add -lffi
373 # https://github.com/rust-lang/rust/issues/34486
374 sed -i.ffi -e '$a #[link(name = "ffi")] extern {}' \
375 src/librustc_llvm/lib.rs
376 %endif
377
378 # The configure macro will modify some autoconf-related files, which upsets
379 # cargo when it tries to verify checksums in those files. If we just truncate
380 # that file list, cargo won't have anything to complain about.
381 find src/vendor -name .cargo-checksum.json \
382 -exec sed -i.uncheck -e 's/"files":{[^}]*}/"files":{ }/' '{}' '+'
383
384
385 %build
386
387 %{?cmake_path:export PATH=%{cmake_path}:$PATH}
388 %{?library_path:export LIBRARY_PATH="%{library_path}"}
389 %{?rustflags:export RUSTFLAGS="%{rustflags}"}
390
391 # We're going to override --libdir when configuring to get rustlib into a
392 # common path, but we'll fix the shared libraries during install.
393 %global common_libdir %{_prefix}/lib
394 %global rustlibdir %{common_libdir}/rustlib
395
396 %ifarch %{arm}
397 # full debuginfo is exhausting memory; just do libstd for now
398 # https://github.com/rust-lang/rust/issues/45854
399 %define enable_debuginfo --enable-debuginfo --enable-debuginfo-only-std --disable-debuginfo-lines
400 %else
401 %define enable_debuginfo --enable-debuginfo --disable-debuginfo-only-std --disable-debuginfo-lines
402 %endif
403
404 %configure --disable-option-checking \
405 --libdir=%{common_libdir} \
406 --build=%{rust_triple} --host=%{rust_triple} --target=%{rust_triple} \
407 --enable-local-rust --local-rust-root=%{local_rust_root} \
408 %{!?with_bundled_llvm: --llvm-root=%{llvm_root} --disable-codegen-tests \
409 %{!?with_llvm_static: --enable-llvm-link-shared } } \
410 --disable-jemalloc \
411 --disable-rpath \
412 %{enable_debuginfo} \
413 --enable-vendor \
414 --release-channel=%{channel}
415
416 %{python} ./x.py build
417 %{python} ./x.py doc
418
419
420 %install
421 %{?cmake_path:export PATH=%{cmake_path}:$PATH}
422 %{?library_path:export LIBRARY_PATH="%{library_path}"}
423 %{?rustflags:export RUSTFLAGS="%{rustflags}"}
424
425 DESTDIR=%{buildroot} %{python} ./x.py install
426 DESTDIR=%{buildroot} %{python} ./x.py install src
427
428
429 # Make sure the shared libraries are in the proper libdir
430 %if "%{_libdir}" != "%{common_libdir}"
431 mkdir -p %{buildroot}%{_libdir}
432 find %{buildroot}%{common_libdir} -maxdepth 1 -type f -name '*.so' \
433 -exec mv -v -t %{buildroot}%{_libdir} '{}' '+'
434 %endif
435
436 # The shared libraries should be executable for debuginfo extraction.
437 find %{buildroot}%{_libdir} -maxdepth 1 -type f -name '*.so' \
438 -exec chmod -v +x '{}' '+'
439
440 # The libdir libraries are identical to those under rustlib/. It's easier on
441 # library loading if we keep them in libdir, but we do need them in rustlib/
442 # to support dynamic linking for compiler plugins, so we'll symlink.
443 (cd "%{buildroot}%{rustlibdir}/%{rust_triple}/lib" &&
444 find ../../../../%{_lib} -maxdepth 1 -name '*.so' |
445 while read lib; do
446 # make sure they're actually identical!
447 cmp "$lib" "${lib##*/}"
448 ln -v -f -s -t . "$lib"
449 done)
450
451 # Remove installer artifacts (manifests, uninstall scripts, etc.)
452 find %{buildroot}%{rustlibdir} -maxdepth 1 -type f -exec rm -v '{}' '+'
453
454 # FIXME: __os_install_post will strip the rlibs
455 # -- should we find a way to preserve debuginfo?
456
457 # Remove unwanted documentation files (we already package them)
458 rm -f %{buildroot}%{_docdir}/%{name}/README.md
459 rm -f %{buildroot}%{_docdir}/%{name}/COPYRIGHT
460 rm -f %{buildroot}%{_docdir}/%{name}/LICENSE-APACHE
461 rm -f %{buildroot}%{_docdir}/%{name}/LICENSE-MIT
462
463 # Sanitize the HTML documentation
464 find %{buildroot}%{_docdir}/%{name}/html -empty -delete
465 find %{buildroot}%{_docdir}/%{name}/html -type f -exec chmod -x '{}' '+'
466
467 %if %without lldb
468 rm -f %{buildroot}%{_bindir}/rust-lldb
469 rm -f %{buildroot}%{rustlibdir}/etc/lldb_*.py*
470 %endif
471
472
473 %check
474 %{?cmake_path:export PATH=%{cmake_path}:$PATH}
475 %{?library_path:export LIBRARY_PATH="%{library_path}"}
476 %{?rustflags:export RUSTFLAGS="%{rustflags}"}
477
478 # The results are not stable on koji, so mask errors and just log it.
479 %{python} ./x.py test --no-fail-fast || :
480
481
482 %if ! 0%{?mageia}
483 %ldconfig_scriptlets
484 %endif
485
486
487 %files
488 %license COPYRIGHT LICENSE-APACHE LICENSE-MIT
489 %license src/libbacktrace/LICENSE-libbacktrace
490 %license src/rt/hoedown/LICENSE-hoedown
491 %doc README.md
492 %{_bindir}/rustc
493 %{_bindir}/rustdoc
494 %{_libdir}/*.so
495 %{_mandir}/man1/rustc.1*
496 %{_mandir}/man1/rustdoc.1*
497 %dir %{rustlibdir}
498 %dir %{rustlibdir}/%{rust_triple}
499 %dir %{rustlibdir}/%{rust_triple}/lib
500 %{rustlibdir}/%{rust_triple}/lib/*.so
501
502
503 %files std-static
504 %dir %{rustlibdir}
505 %dir %{rustlibdir}/%{rust_triple}
506 %dir %{rustlibdir}/%{rust_triple}/lib
507 %{rustlibdir}/%{rust_triple}/lib/*.rlib
508
509
510 %files debugger-common
511 %dir %{rustlibdir}
512 %dir %{rustlibdir}/etc
513 %{rustlibdir}/etc/debugger_*.py*
514
515
516 %files gdb
517 %{_bindir}/rust-gdb
518 %{rustlibdir}/etc/gdb_*.py*
519
520
521 %if %with lldb
522 %files lldb
523 %{_bindir}/rust-lldb
524 %{rustlibdir}/etc/lldb_*.py*
525 %endif
526
527
528 %files doc
529 %docdir %{_docdir}/%{name}
530 %dir %{_docdir}/%{name}
531 %dir %{_docdir}/%{name}/html
532 %{_docdir}/%{name}/html/*/
533 %{_docdir}/%{name}/html/*.html
534 %{_docdir}/%{name}/html/*.css
535 %{_docdir}/%{name}/html/*.js
536 %{_docdir}/%{name}/html/*.woff
537 %license %{_docdir}/%{name}/html/*.txt
538
539
540 %files src
541 %dir %{rustlibdir}
542 %{rustlibdir}/src

  ViewVC Help
Powered by ViewVC 1.1.30