Browse Source

rust bootstrap effort

Signed-off-by: basebuilder_pel7ppc64lebuilder0 <basebuilder@powerel.org>
master
basebuilder_pel7ppc64lebuilder0 3 years ago
parent
commit
f353eab5f9
  1. 162
      SPECS/rust.spec

162
SPECS/rust.spec

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
# Only x86_64 and i686 are Tier 1 platforms at this time.
# https://forge.rust-lang.org/platform-support.html
# https://doc.rust-lang.org/nightly/rustc/platform-support.html
%global rust_arches x86_64 i686 armv7hl aarch64 ppc64 ppc64le s390x

# The channel can be stable, beta, or nightly
@ -9,23 +9,23 @@ @@ -9,23 +9,23 @@
# e.g. 1.10.0 wants rustc: 1.9.0-2016-05-24
# or nightly wants some beta-YYYY-MM-DD
# Note that cargo matches the program version here, not its crate version.
%global bootstrap_rust 1.45.2
%global bootstrap_cargo 1.45.2
%global bootstrap_channel 1.45.2
%global bootstrap_date 2020-08-03
%global bootstrap_rust 1.49.0
%global bootstrap_cargo 1.49.0
%global bootstrap_channel 1.49.0
%global bootstrap_date 2020-12-31

# Only the specified arches will use bootstrap binaries.
#global bootstrap_arches %%{rust_arches}
%global bootstrap_arches %%{rust_arches}

# Using llvm-static may be helpful as an opt-in, e.g. to aid LLVM rebases.
%bcond_with llvm_static
%bcond_without llvm_static

# We can also choose to just use Rust's bundled LLVM, in case the system LLVM
# is insufficient. Rust currently requires LLVM 8.0+.
%bcond_with bundled_llvm
# is insufficient. Rust currently requires LLVM 9.0+.
%bcond_without bundled_llvm

# Requires stable libgit2 1.0
%if 0%{?fedora} >= 32
# Requires stable libgit2 1.1
%if 0%{?fedora} >= 34
%bcond_with bundled_libgit2
%else
%bcond_without bundled_libgit2
@ -52,8 +52,8 @@ @@ -52,8 +52,8 @@
%endif

Name: rust
Version: 1.46.0
Release: 2%{?dist}
Version: 1.50.0
Release: 1%{?dist}
Summary: The Rust Programming Language
License: (ASL 2.0 or MIT) and (BSD and MIT)
# ^ written as: (rust itself) and (bundled libraries)
@ -67,24 +67,24 @@ ExclusiveArch: %{rust_arches} @@ -67,24 +67,24 @@ ExclusiveArch: %{rust_arches}
%endif
Source0: https://static.rust-lang.org/dist/%{rustc_package}.tar.xz

# https://github.com/rust-lang/cargo/pull/8598
Patch1: 0001-Fix-jobserver_exists-test-on-single-cpu-systems.patch
# https://github.com/rust-lang/cargo/pull/8657 (backported)
Patch2: 0002-Fix-LTO-with-doctests.patch
# This internal rust-abi change broke s390x -- revert for now.
# https://github.com/rust-lang/rust/issues/80810#issuecomment-781784032
Patch1: 0001-Revert-Auto-merge-of-79547.patch

### RHEL-specific patches below ###

# Disable cargo->libgit2->libssh2 on RHEL, as it's not approved for FIPS (rhbz1732949)
Patch100: rustc-1.42.0-disable-libssh2.patch
Patch100: rustc-1.48.0-disable-libssh2.patch

# libcurl on RHEL7 doesn't have http2, but since cargo requests it, curl-sys
# will try to build it statically -- instead we turn off the feature.
Patch101: rustc-1.45.0-disable-http2.patch
Patch101: rustc-1.49.0-disable-http2.patch

# kernel rh1410097 causes too-small stacks for PIE.
# (affects RHEL6 kernels when building for RHEL7)
Patch102: rustc-1.45.0-no-default-pie.patch
Patch102: rustc-1.48.0-no-default-pie.patch

Patch500: rust-llvm-cmake-config-ppc64le.patch

# Get the Rust triple for any arch.
%{lua: function rust_triple(arch)
@ -153,10 +153,10 @@ BuildRequires: pkgconfig(openssl) @@ -153,10 +153,10 @@ BuildRequires: pkgconfig(openssl)
BuildRequires: pkgconfig(zlib)

%if %without bundled_libgit2
BuildRequires: pkgconfig(libgit2) >= 1.0.0
BuildRequires: pkgconfig(libgit2) >= 1.1.0
%endif

%if %{without disabled_libssh2} && %{without bundled_libssh2}
%if %{without disabled_libssh2}
# needs libssh2_userauth_publickey_frommemory
BuildRequires: pkgconfig(libssh2) >= 1.6.0
%endif
@ -166,7 +166,7 @@ BuildRequires: %{python} @@ -166,7 +166,7 @@ BuildRequires: %{python}

%if %with bundled_llvm
BuildRequires: cmake3 >= 3.4.3
Provides: bundled(llvm) = 10.0.1
Provides: bundled(llvm) = 11.0.0
%else
BuildRequires: cmake >= 2.8.11
%if 0%{?epel} == 7
@ -178,7 +178,7 @@ BuildRequires: cmake >= 2.8.11 @@ -178,7 +178,7 @@ BuildRequires: cmake >= 2.8.11
%global llvm llvm
%global llvm_root %{_prefix}
%endif
BuildRequires: %{llvm}-devel >= 8.0
BuildRequires: %{llvm}-devel >= 9.0
%if %with llvm_static
BuildRequires: %{llvm}-static
BuildRequires: libffi-devel
@ -191,9 +191,6 @@ BuildRequires: procps-ng @@ -191,9 +191,6 @@ BuildRequires: procps-ng
# debuginfo-gdb tests need gdb
BuildRequires: gdb

# TODO: work on unbundling these!
Provides: bundled(libbacktrace) = 1.0.20200219

# Virtual provides for folks who attempt "dnf install rustc"
Provides: rustc = %{version}-%{release}
Provides: rustc%{?_isa} = %{version}-%{release}
@ -299,10 +296,7 @@ its standard library. @@ -299,10 +296,7 @@ its standard library.
%package -n cargo
Summary: Rust's package manager and build tool
%if %with bundled_libgit2
Provides: bundled(libgit2) = 1.0.0
%endif
%if %with bundled_libssh2
Provides: bundled(libssh2) = 1.9.0~dev
Provides: bundled(libgit2) = 1.1.0
%endif
# For tests:
BuildRequires: git
@ -345,10 +339,7 @@ A tool for formatting Rust code according to style guidelines. @@ -345,10 +339,7 @@ A tool for formatting Rust code according to style guidelines.
%package -n rls
Summary: Rust Language Server for IDE integration
%if %with bundled_libgit2
Provides: bundled(libgit2) = 1.0.0
%endif
%if %with bundled_libssh2
Provides: bundled(libssh2) = 1.9.0~dev
Provides: bundled(libgit2) = 1.1.0
%endif
Requires: rust-analysis
# /usr/bin/rls is dynamically linked against internal rustc libs
@ -410,8 +401,7 @@ test -f '%{local_rust_root}/bin/rustc' @@ -410,8 +401,7 @@ test -f '%{local_rust_root}/bin/rustc'

%setup -q -n %{rustc_package}

%patch1 -p1 -d src/tools/cargo
%patch2 -p1
%patch1 -p1

%if %with disabled_libssh2
%patch100 -p1
@ -423,7 +413,7 @@ rm -rf vendor/libnghttp2-sys/ @@ -423,7 +413,7 @@ rm -rf vendor/libnghttp2-sys/
%endif

%if 0%{?rhel} && 0%{?rhel} < 8
%patch102 -p1 -b .no-pie
%patch102 -p1
%endif

%if "%{python}" != "python3"
@ -433,12 +423,15 @@ sed -i.try-python -e '/^try python3 /i try "%{python}" "$@"' ./configure @@ -433,12 +423,15 @@ sed -i.try-python -e '/^try python3 /i try "%{python}" "$@"' ./configure

%if %without bundled_llvm
rm -rf src/llvm-project/
mkdir -p src/llvm-project/libunwind/
%endif

# Remove other unused vendored libraries
rm -rf vendor/curl-sys/curl/
rm -rf vendor/jemalloc-sys/jemalloc/
rm -rf vendor/libssh2-sys/libssh2/
rm -rf vendor/libz-sys/src/zlib/
rm -rf vendor/libz-sys/src/zlib-ng/
rm -rf vendor/lzma-sys/xz-*/
rm -rf vendor/openssl-src/openssl/

@ -446,9 +439,6 @@ rm -rf vendor/openssl-src/openssl/ @@ -446,9 +439,6 @@ rm -rf vendor/openssl-src/openssl/
rm -rf vendor/libgit2-sys/libgit2/
%endif

%if %without bundled_libssh2
rm -rf vendor/libssh2-sys/libssh2/
%endif
%if %with disabled_libssh2
rm -rf vendor/libssh2-sys/
%endif
@ -456,9 +446,6 @@ rm -rf vendor/libssh2-sys/ @@ -456,9 +446,6 @@ rm -rf vendor/libssh2-sys/
# This only affects the transient rust-installer, but let it use our dynamic xz-libs
sed -i.lzma -e '/LZMA_API_STATIC/d' src/bootstrap/tool.rs

# rename bundled license for packaging
cp -a vendor/backtrace-sys/src/libbacktrace/LICENSE{,-libbacktrace}

%if %{with bundled_llvm} && 0%{?epel} == 7
mkdir -p cmake-bin
ln -s /usr/bin/cmake3 cmake-bin/cmake
@ -482,26 +469,28 @@ find vendor -name .cargo-checksum.json \ @@ -482,26 +469,28 @@ find vendor -name .cargo-checksum.json \
# it's a shebang and make them executable. Then brp-mangle-shebangs gets upset...
find -name '*.rs' -type f -perm /111 -exec chmod -v -x '{}' '+'


%build
# This package fails to build with LTO due to undefined symbols. LTO
# was disabled in OpenSuSE as well, but with no real explanation why
# beyond the undefined symbols. It really should be investigated further.
# Disable LTO
%define _lto_cflags %{nil}

# Set up shared environment variables for build/install/check
%global rust_env RUSTFLAGS="%{rustflags}"
%if 0%{?cmake_path:1}
%global rust_env %{rust_env} PATH="%{cmake_path}:$PATH"
%endif
%if %without bundled_libgit2
# convince libgit2-sys to use the distro libgit2
export LIBGIT2_SYS_USE_PKG_CONFIG=1
%global rust_env %{rust_env} LIBGIT2_SYS_USE_PKG_CONFIG=1
%endif

%if %without bundled_libssh2
%if %without disabled_libssh2
# convince libssh2-sys to use the distro libssh2
export LIBSSH2_SYS_USE_PKG_CONFIG=1
%global rust_env %{rust_env} LIBSSH2_SYS_USE_PKG_CONFIG=1
%endif

%{?cmake_path:export PATH=%{cmake_path}:$PATH}
%{?rustflags:export RUSTFLAGS="%{rustflags}"}
sed 's/3\.13\.4/3.12.2/' -i src/llvm-project/llvm/CMakeLists.txt
sed 's/5\.1/4.8/' -i src/llvm-project/llvm/cmake/modules/CheckCompilerVersion.cmake

%patch500 -p0


%build
export %{rust_env}

# We're going to override --libdir when configuring to get rustlib into a
# common path, but we'll fix the shared libraries during install.
@ -552,15 +541,15 @@ fi @@ -552,15 +541,15 @@ fi
--enable-vendor \
--enable-verbose-tests \
%{?codegen_units_std} \
--release-channel=%{channel}
--release-channel=%{channel} \
--release-description="PowerEL %{version}-%{release}"

%{python} ./x.py build -j "$ncpus" --stage 2
%{python} ./x.py doc
%{python} ./x.py doc --stage 2


%install
%{?cmake_path:export PATH=%{cmake_path}:$PATH}
%{?rustflags:export RUSTFLAGS="%{rustflags}"}
export %{rust_env}

DESTDIR=%{buildroot} %{python} ./x.py install

@ -624,20 +613,22 @@ ln -sT ../rust/html/cargo/ %{buildroot}%{_docdir}/cargo/html @@ -624,20 +613,22 @@ ln -sT ../rust/html/cargo/ %{buildroot}%{_docdir}/cargo/html

%if %without lldb
rm -f %{buildroot}%{_bindir}/rust-lldb
rm -f %{buildroot}%{rustlibdir}/etc/lldb_*.py*
rm -f %{buildroot}%{rustlibdir}/etc/lldb_*
%endif

# We don't want Rust copies of LLVM tools (rust-lld, rust-llvm-dwp)
rm -f %{buildroot}%{rustlibdir}/%{rust_triple}/bin/rust-ll*


%check
%{?cmake_path:export PATH=%{cmake_path}:$PATH}
%{?rustflags:export RUSTFLAGS="%{rustflags}"}
export %{rust_env}

# The results are not stable on koji, so mask errors and just log it.
%{python} ./x.py test --no-fail-fast || :
%{python} ./x.py test --no-fail-fast cargo || :
%{python} ./x.py test --no-fail-fast clippy || :
%{python} ./x.py test --no-fail-fast rls || :
%{python} ./x.py test --no-fail-fast rustfmt || :
%{python} ./x.py test --no-fail-fast --stage 2 || :
%{python} ./x.py test --no-fail-fast --stage 2 cargo || :
%{python} ./x.py test --no-fail-fast --stage 2 clippy || :
%{python} ./x.py test --no-fail-fast --stage 2 rls || :
%{python} ./x.py test --no-fail-fast --stage 2 rustfmt || :


%ldconfig_scriptlets
@ -645,7 +636,6 @@ rm -f %{buildroot}%{rustlibdir}/etc/lldb_*.py* @@ -645,7 +636,6 @@ rm -f %{buildroot}%{rustlibdir}/etc/lldb_*.py*

%files
%license COPYRIGHT LICENSE-APACHE LICENSE-MIT
%license vendor/backtrace-sys/src/libbacktrace/LICENSE-libbacktrace
%doc README.md
%{_bindir}/rustc
%{_bindir}/rustdoc
@ -673,14 +663,14 @@ rm -f %{buildroot}%{rustlibdir}/etc/lldb_*.py* @@ -673,14 +663,14 @@ rm -f %{buildroot}%{rustlibdir}/etc/lldb_*.py*

%files gdb
%{_bindir}/rust-gdb
%{rustlibdir}/etc/gdb_*.py*
%{rustlibdir}/etc/gdb_*
%exclude %{_bindir}/rust-gdbgui


%if %with lldb
%files lldb
%{_bindir}/rust-lldb
%{rustlibdir}/etc/lldb_*.py*
%{rustlibdir}/etc/lldb_*
%endif


@ -691,7 +681,6 @@ rm -f %{buildroot}%{rustlibdir}/etc/lldb_*.py* @@ -691,7 +681,6 @@ rm -f %{buildroot}%{rustlibdir}/etc/lldb_*.py*
%{_docdir}/%{name}/html/*/
%{_docdir}/%{name}/html/*.html
%{_docdir}/%{name}/html/*.css
%{_docdir}/%{name}/html/*.ico
%{_docdir}/%{name}/html/*.js
%{_docdir}/%{name}/html/*.png
%{_docdir}/%{name}/html/*.svg
@ -704,6 +693,7 @@ rm -f %{buildroot}%{rustlibdir}/etc/lldb_*.py* @@ -704,6 +693,7 @@ rm -f %{buildroot}%{rustlibdir}/etc/lldb_*.py*
%license src/tools/cargo/LICENSE-APACHE src/tools/cargo/LICENSE-MIT src/tools/cargo/LICENSE-THIRD-PARTY
%doc src/tools/cargo/README.md
%{_bindir}/cargo
%{_libexecdir}/cargo*
%{_mandir}/man1/cargo*.1*
%{_sysconfdir}/bash_completion.d/cargo
%{_datadir}/zsh/site-functions/_cargo
@ -747,6 +737,30 @@ rm -f %{buildroot}%{rustlibdir}/etc/lldb_*.py* @@ -747,6 +737,30 @@ rm -f %{buildroot}%{rustlibdir}/etc/lldb_*.py*


%changelog
* Thu Feb 11 2021 Josh Stone <jistone@redhat.com> - 1.50.0-1
- Update to 1.50.0.

* Wed Jan 27 2021 Fedora Release Engineering <releng@fedoraproject.org> - 1.49.0-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild

* Tue Jan 05 2021 Josh Stone <jistone@redhat.com> - 1.49.0-1
- Update to 1.49.0.

* Tue Dec 29 2020 Igor Raits <ignatenkobrain@fedoraproject.org> - 1.48.0-3
- De-bootstrap

* Mon Dec 28 2020 Igor Raits <ignatenkobrain@fedoraproject.org> - 1.48.0-2
- Rebuild for libgit2 1.1.x

* Thu Nov 19 2020 Josh Stone <jistone@redhat.com> - 1.48.0-1
- Update to 1.48.0.

* Sat Oct 10 2020 Jeff Law <law@redhat.com> - 1.47.0-2
- Re-enable LTO

* Thu Oct 08 2020 Josh Stone <jistone@redhat.com> - 1.47.0-1
- Update to 1.47.0.

* Fri Aug 28 2020 Fabio Valentini <decathorpe@gmail.com> - 1.46.0-2
- Fix LTO with doctests (backported cargo PR#8657).


Loading…
Cancel
Save