2 |
# The aim is to work with them on a rust packaging policy we could share, |
# 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. |
# so that we can ensure a good packaging and share the workload. |
4 |
|
|
|
%global _python_bytecompile_extra 0 |
|
5 |
|
|
6 |
# Only x86_64 and i686 are Tier 1 platforms at this time. |
# Only x86_64 and i686 are Tier 1 platforms at this time. |
7 |
# https://forge.rust-lang.org/platform-support.html |
# https://forge.rust-lang.org/platform-support.html |
14 |
# e.g. 1.10.0 wants rustc: 1.9.0-2016-05-24 |
# e.g. 1.10.0 wants rustc: 1.9.0-2016-05-24 |
15 |
# or nightly wants some beta-YYYY-MM-DD |
# or nightly wants some beta-YYYY-MM-DD |
16 |
# Note that cargo matches the program version here, not its crate version. |
# Note that cargo matches the program version here, not its crate version. |
17 |
%global bootstrap_rust 1.36.0 |
%global bootstrap_rust 1.37.0 |
18 |
%global bootstrap_cargo 1.36.0 |
%global bootstrap_cargo 1.37.0 |
19 |
%global bootstrap_channel 1.36.0 |
%global bootstrap_channel 1.37.0 |
20 |
%global bootstrap_date 2019-07-04 |
%global bootstrap_date 2019-08-15 |
21 |
|
|
22 |
# Only the specified arches will use bootstrap binaries. |
# Only the specified arches will use bootstrap binaries. |
23 |
#global bootstrap_arches %%{rust_arches} |
#global bootstrap_arches %%{rust_arches} |
38 |
|
|
39 |
# We can also choose to just use Rust's bundled LLVM, in case the system LLVM |
# We can also choose to just use Rust's bundled LLVM, in case the system LLVM |
40 |
# is insufficient. Rust currently requires LLVM 6.0+. |
# is insufficient. Rust currently requires LLVM 6.0+. |
41 |
%if 0%{?mageia} || 0%{?rhel} && !0%{?epel} |
%if 0%{?rhel} && !0%{?epel} |
42 |
|
# (akien) Hacks below are needed on mga's buildsystem when we have to rebootstrap llvm. |
43 |
# Bundled LLVM has underlinking issues: |
# Bundled LLVM has underlinking issues: |
44 |
%global _disable_ld_no_undefined 1 |
%global _disable_ld_no_undefined 1 |
45 |
# We run out of memory building LLVM |
%ifarch %{arm} %ix86 |
46 |
%ifarch %{ix86} aarch64 |
# Decrease debuginfo verbosity to reduce memory consumption during final library linking |
47 |
%global _smp_ncpus_max 4 |
%global optflags %(echo %{optflags} | sed 's/-g /-g1 /') |
48 |
%endif |
%endif |
49 |
%bcond_without bundled_llvm |
%bcond_without bundled_llvm |
50 |
%else |
%else |
51 |
%bcond_with bundled_llvm |
%bcond_with bundled_llvm |
52 |
%endif |
%endif |
53 |
|
|
|
%ifarch s390 s390x %{arm} %ix86 |
|
|
# Decrease debuginfo verbosity to reduce memory consumption during final library linking |
|
|
%global optflags %(echo %{optflags} | sed 's/-g /-g1 /') |
|
|
%endif |
|
|
|
|
54 |
# libgit2-sys expects to use its bundled library, which is sometimes just a |
# 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 |
# 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. |
# won't match our released libgit2.so, e.g. having changed struct fields. |
70 |
%bcond_with lldb |
%bcond_with lldb |
71 |
%endif |
%endif |
72 |
|
|
73 |
|
%if 0%{?mageia} |
74 |
|
# (akien) Added by tv in mga8/rust 1.37.0. |
75 |
|
%global _python_bytecompile_extra 0 |
76 |
|
%endif |
77 |
|
|
78 |
Name: rust |
Name: rust |
79 |
Version: 1.37.0 |
Version: 1.38.0 |
80 |
Release: %mkrel 2 |
Release: %mkrel 1 |
81 |
Summary: The Rust Programming Language |
Summary: The Rust Programming Language |
82 |
%if 0%{?mageia} |
%if 0%{?mageia} |
83 |
Group: Development/Other |
Group: Development/Other |
98 |
# We do have the necessary fix in our LLVM 7. |
# We do have the necessary fix in our LLVM 7. |
99 |
Patch1: rust-pr57840-llvm7-debuginfo-variants.patch |
Patch1: rust-pr57840-llvm7-debuginfo-variants.patch |
100 |
|
|
101 |
|
# Mask a warning-as-error when rebuilding 1.38 with 1.38 |
102 |
|
Patch2: rustc-1.38.0-rebuild-bootstrap.patch |
103 |
|
|
104 |
|
# Reduce the size of rust-std |
105 |
|
# https://github.com/rust-lang/rust/pull/64823 |
106 |
|
Patch3: 0001-WIP-minimize-the-rust-std-component.patch |
107 |
|
|
108 |
# Upstream patch to fix typenum crate build on i386/i486/i586. |
# Upstream patch to fix typenum crate build on i386/i486/i586. |
109 |
Patch2: typenum-pr115-fix-log2-rounding-error.patch |
Patch4: typenum-pr115-fix-log2-rounding-error.patch |
110 |
|
|
111 |
# Upstream patch to solve: "git could not determine the LLVM submodule commit hash. |
# Upstream patch to solve: "git could not determine the LLVM submodule commit hash. |
112 |
# Assuming that an LLVM build is necessary." |
# Assuming that an LLVM build is necessary." |
113 |
Patch3: rust-pr64156-assume-non-git-llvm-is-fresh.patch |
Patch5: rust-pr64156-assume-non-git-llvm-is-fresh.patch |
114 |
|
|
115 |
# Get the Rust triple for any arch. |
# Get the Rust triple for any arch. |
116 |
%{lua: function rust_triple(arch) |
%{lua: function rust_triple(arch) |
454 |
%patch1 -p1 -R |
%patch1 -p1 -R |
455 |
%patch2 -p1 |
%patch2 -p1 |
456 |
%patch3 -p1 |
%patch3 -p1 |
457 |
|
%patch4 -p1 |
458 |
|
%patch5 -p1 |
459 |
|
|
460 |
%if "%{python}" == "python3" |
%if "%{python}" == "python3" |
461 |
sed -i.try-py3 -e '/try python2.7/i try python3 "$@"' ./configure |
sed -i.try-py3 -e '/try python2.7/i try python3 "$@"' ./configure |
508 |
find vendor -name .cargo-checksum.json \ |
find vendor -name .cargo-checksum.json \ |
509 |
-exec sed -i.uncheck -e 's/"files":{[^}]*}/"files":{ }/' '{}' '+' |
-exec sed -i.uncheck -e 's/"files":{[^}]*}/"files":{ }/' '{}' '+' |
510 |
|
|
511 |
|
# 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 |
|
|
515 |
|
|
516 |
%build |
%build |
517 |
|
|
518 |
%if %without bundled_libgit2 |
%if %without bundled_libgit2 |
519 |
# convince libgit2-sys to use the distro libgit2 |
# convince libgit2-sys to use the distro libgit2 |
520 |
export LIBGIT2_SYS_USE_PKG_CONFIG=1 |
export LIBGIT2_SYS_USE_PKG_CONFIG=1 |
536 |
%ifarch %{arm} %{ix86} s390x |
%ifarch %{arm} %{ix86} s390x |
537 |
# full debuginfo is exhausting memory; just do libstd for now |
# full debuginfo is exhausting memory; just do libstd for now |
538 |
# https://github.com/rust-lang/rust/issues/45854 |
# https://github.com/rust-lang/rust/issues/45854 |
539 |
%if (0%{?mageia} && 0%{?mageia} < 27) || (0%{?rhel} && 0%{?rhel} <= 7) |
%if (0%{?fedora} && 0%{?fedora} < 27) || (0%{?rhel} && 0%{?rhel} <= 7) |
540 |
# Older rpmbuild didn't work with partial debuginfo coverage. |
# Older rpmbuild didn't work with partial debuginfo coverage. |
541 |
%global debug_package %{nil} |
%global debug_package %{nil} |
542 |
%define enable_debuginfo --debuginfo-level=0 |
%define enable_debuginfo --debuginfo-level=0 |
554 |
%define codegen_units_std --set rust.codegen-units-std=1 |
%define codegen_units_std --set rust.codegen-units-std=1 |
555 |
%endif |
%endif |
556 |
|
|
|
%if %with bundled_llvm |
|
|
%ifnarch x86_64 |
|
|
# Limit build jobs when linking llvm to avoid OOM |
|
|
%define llvm_link_jobs --set llvm.link-jobs=1 |
|
|
%endif |
|
|
%endif |
|
|
|
|
557 |
%configure2_5x --disable-option-checking \ |
%configure2_5x --disable-option-checking \ |
558 |
--libdir=%{common_libdir} \ |
--libdir=%{common_libdir} \ |
559 |
--build=%{rust_triple} --host=%{rust_triple} --target=%{target_triple} \ |
--build=%{rust_triple} --host=%{rust_triple} --target=%{target_triple} \ |
562 |
%{!?with_bundled_llvm: --llvm-root=%{llvm_root} \ |
%{!?with_bundled_llvm: --llvm-root=%{llvm_root} \ |
563 |
%{!?llvm_has_filecheck: --disable-codegen-tests} \ |
%{!?llvm_has_filecheck: --disable-codegen-tests} \ |
564 |
%{!?with_llvm_static: --enable-llvm-link-shared } } \ |
%{!?with_llvm_static: --enable-llvm-link-shared } } \ |
|
%{?llvm_link_jobs} \ |
|
565 |
--disable-rpath \ |
--disable-rpath \ |
566 |
%{enable_debuginfo} \ |
%{enable_debuginfo} \ |
567 |
--enable-extended \ |
--enable-extended \ |
597 |
(cd "%{buildroot}%{rustlibdir}/%{rust_triple}/lib" && |
(cd "%{buildroot}%{rustlibdir}/%{rust_triple}/lib" && |
598 |
find ../../../../%{_lib} -maxdepth 1 -name '*.so' | |
find ../../../../%{_lib} -maxdepth 1 -name '*.so' | |
599 |
while read lib; do |
while read lib; do |
600 |
# make sure they're actually identical! |
if [ -f "${lib##*/}" ]; then |
601 |
cmp "$lib" "${lib##*/}" |
# make sure they're actually identical! |
602 |
ln -v -f -s -t . "$lib" |
cmp "$lib" "${lib##*/}" |
603 |
|
ln -v -f -s -t . "$lib" |
604 |
|
fi |
605 |
done) |
done) |
606 |
|
|
607 |
# Remove installer artifacts (manifests, uninstall scripts, etc.) |
# Remove installer artifacts (manifests, uninstall scripts, etc.) |