Accepting request 729946 from home:federico-mena:branches:devel:languages:rust
Update for SLE12-SP5 OBS-URL: https://build.opensuse.org/request/show/729946 OBS-URL: https://build.opensuse.org/package/show/devel:languages:rust/rust?expand=0&rev=227
This commit is contained in:
parent
00e7250e8a
commit
5d9a019862
73
rust-61206-assume-tarball-llvm-is-fresh.patch
Normal file
73
rust-61206-assume-tarball-llvm-is-fresh.patch
Normal file
@ -0,0 +1,73 @@
|
|||||||
|
commit 53fe76479aab03b1fbe5b7184f45484886f769b1
|
||||||
|
Author: Josh Stone <jistone@redhat.com>
|
||||||
|
Date: Wed Sep 4 16:02:31 2019 -0700
|
||||||
|
|
||||||
|
Assume non-git LLVM is fresh if the stamp file exists
|
||||||
|
|
||||||
|
Rustbuild usually writes the LLVM submodule commit in a stamp file, so
|
||||||
|
we can avoid rebuilding it unnecessarily. However, for builds from a
|
||||||
|
source tarball (non-git), we were assuming a rebuild is always needed.
|
||||||
|
This can cause a lot of extra work if any environment like `CFLAGS`
|
||||||
|
changed between steps like build and install, which are often separate
|
||||||
|
in distro builds.
|
||||||
|
|
||||||
|
Now we also write an empty stamp file if the git commit is unknown, and
|
||||||
|
its presence is trusted to indicate that no rebuild is needed. An info
|
||||||
|
message reports that this is happening, along with the stamp file path
|
||||||
|
that can be deleted to force a rebuild anyway.
|
||||||
|
|
||||||
|
diff --git a/src/bootstrap/native.rs b/src/bootstrap/native.rs
|
||||||
|
index f02def3e1b0..7bf9ea2688f 100644
|
||||||
|
--- a/src/bootstrap/native.rs
|
||||||
|
+++ b/src/bootstrap/native.rs
|
||||||
|
@@ -81,26 +81,29 @@ impl Step for Llvm {
|
||||||
|
(info, "src/llvm-project/llvm", builder.llvm_out(target), dir.join("bin"))
|
||||||
|
};
|
||||||
|
|
||||||
|
- if !llvm_info.is_git() {
|
||||||
|
- println!(
|
||||||
|
- "git could not determine the LLVM submodule commit hash. \
|
||||||
|
- Assuming that an LLVM build is necessary.",
|
||||||
|
- );
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
let build_llvm_config = llvm_config_ret_dir
|
||||||
|
.join(exe("llvm-config", &*builder.config.build));
|
||||||
|
let done_stamp = out_dir.join("llvm-finished-building");
|
||||||
|
|
||||||
|
- if let Some(llvm_commit) = llvm_info.sha() {
|
||||||
|
- if done_stamp.exists() {
|
||||||
|
+ if done_stamp.exists() {
|
||||||
|
+ if let Some(llvm_commit) = llvm_info.sha() {
|
||||||
|
let done_contents = t!(fs::read(&done_stamp));
|
||||||
|
|
||||||
|
// If LLVM was already built previously and the submodule's commit didn't change
|
||||||
|
// from the previous build, then no action is required.
|
||||||
|
if done_contents == llvm_commit.as_bytes() {
|
||||||
|
- return build_llvm_config
|
||||||
|
+ return build_llvm_config;
|
||||||
|
}
|
||||||
|
+ } else {
|
||||||
|
+ builder.info(
|
||||||
|
+ "Could not determine the LLVM submodule commit hash. \
|
||||||
|
+ Assuming that an LLVM rebuild is not necessary.",
|
||||||
|
+ );
|
||||||
|
+ builder.info(&format!(
|
||||||
|
+ "To force LLVM to rebuild, remove the file `{}`",
|
||||||
|
+ done_stamp.display()
|
||||||
|
+ ));
|
||||||
|
+ return build_llvm_config;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -303,9 +306,7 @@ impl Step for Llvm {
|
||||||
|
|
||||||
|
cfg.build();
|
||||||
|
|
||||||
|
- if let Some(llvm_commit) = llvm_info.sha() {
|
||||||
|
- t!(fs::write(&done_stamp, llvm_commit));
|
||||||
|
- }
|
||||||
|
+ t!(fs::write(&done_stamp, llvm_info.sha().unwrap_or("")));
|
||||||
|
|
||||||
|
build_llvm_config
|
||||||
|
}
|
@ -1,3 +1,11 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Tue Sep 10 18:11:30 UTC 2019 - federico@suse.com
|
||||||
|
|
||||||
|
- Use gcc7 on all of SLE12, since the embedded LLVM wants at least gcc 5.1.
|
||||||
|
|
||||||
|
- Add rust-61206-assume-tarball-llvm-is-fresh.patch - Upstream fix to make
|
||||||
|
LLVM not be rebuilt during the installation phase.
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Wed Aug 28 01:00:37 UTC 2019 - Luke Jones <luke@ljones.dev>
|
Wed Aug 28 01:00:37 UTC 2019 - Luke Jones <luke@ljones.dev>
|
||||||
|
|
||||||
|
49
rust.spec
49
rust.spec
@ -82,8 +82,23 @@
|
|||||||
%define codegen_units --set rust.codegen-units=0
|
%define codegen_units --set rust.codegen-units=0
|
||||||
%define debug_info --enable-debuginfo --disable-debuginfo-only-std --enable-debuginfo-tools --disable-debuginfo-lines
|
%define debug_info --enable-debuginfo --disable-debuginfo-only-std --enable-debuginfo-tools --disable-debuginfo-lines
|
||||||
%endif
|
%endif
|
||||||
# Use hardening ldflags.
|
|
||||||
|
%if 0%{?sle_version} >= 120000 && 0%{?sle_version} <= 120500
|
||||||
|
# Use hardening ldflags, plus link path for gcc7's libstdc++
|
||||||
|
%global gcc_arch %{_arch}
|
||||||
|
%ifarch %{ix86}
|
||||||
|
# This is where gcc7 puts things in 32-bit x86.
|
||||||
|
%global gcc_arch i586
|
||||||
|
%endif
|
||||||
|
%ifarch ppc64le
|
||||||
|
# This is where gcc7 puts things in ppc64le.
|
||||||
|
%global gcc_arch powerpc64le
|
||||||
|
%endif
|
||||||
|
%global rustflags -Clink-arg=-Wl,-z,relro,-z,now -L%{_libdir}/gcc/%{gcc_arch}-suse-linux/7
|
||||||
|
%else
|
||||||
|
# Use hardening ldflags
|
||||||
%global rustflags -Clink-arg=-Wl,-z,relro,-z,now
|
%global rustflags -Clink-arg=-Wl,-z,relro,-z,now
|
||||||
|
%endif
|
||||||
|
|
||||||
# Exclude implicitly-scanned Provides, especially the libLLVM.so ones:
|
# Exclude implicitly-scanned Provides, especially the libLLVM.so ones:
|
||||||
%global __provides_exclude_from ^%{rustlibdir}/.*$
|
%global __provides_exclude_from ^%{rustlibdir}/.*$
|
||||||
@ -107,6 +122,8 @@ Source107: %{dl_url}/rust-%{version_bootstrap}-s390x-unknown-linux-gnu.tar.
|
|||||||
Source108: %{dl_url}/rust-%{version_bootstrap}-powerpc-unknown-linux-gnu.tar.xz
|
Source108: %{dl_url}/rust-%{version_bootstrap}-powerpc-unknown-linux-gnu.tar.xz
|
||||||
# PATCH-FIX-OPENSUSE: edit src/librustc_llvm/build.rs to ignore GCC incompatible flag
|
# PATCH-FIX-OPENSUSE: edit src/librustc_llvm/build.rs to ignore GCC incompatible flag
|
||||||
Patch0: ignore-Wstring-conversion.patch
|
Patch0: ignore-Wstring-conversion.patch
|
||||||
|
# PATCH-FIX-UPSTREAM: Fix bug with timestamps which caused LLVM to rebuild - https://github.com/rust-lang/rust/issues/61206
|
||||||
|
Patch1: rust-61206-assume-tarball-llvm-is-fresh.patch
|
||||||
BuildRequires: ccache
|
BuildRequires: ccache
|
||||||
# Leap 42 to 42.3, SLE12 SP1, SP2
|
# Leap 42 to 42.3, SLE12 SP1, SP2
|
||||||
%if 0%{?sle_version} >= 120000 && 0%{?sle_version} <= 120200
|
%if 0%{?sle_version} >= 120000 && 0%{?sle_version} <= 120200
|
||||||
@ -118,7 +135,13 @@ BuildRequires: cmake
|
|||||||
%endif
|
%endif
|
||||||
BuildRequires: curl
|
BuildRequires: curl
|
||||||
BuildRequires: fdupes
|
BuildRequires: fdupes
|
||||||
|
# In all of SLE12, the default gcc is 4.8. Rust's LLVM wants 5.1 at least.
|
||||||
|
# So, we'll just use gcc7.
|
||||||
|
%if 0%{?sle_version} >= 120000 && 0%{?sle_version} <= 120500
|
||||||
|
BuildRequires: gcc7-c++
|
||||||
|
%else
|
||||||
BuildRequires: gcc-c++
|
BuildRequires: gcc-c++
|
||||||
|
%endif
|
||||||
BuildRequires: git
|
BuildRequires: git
|
||||||
BuildRequires: pkgconfig
|
BuildRequires: pkgconfig
|
||||||
BuildRequires: procps
|
BuildRequires: procps
|
||||||
@ -127,7 +150,7 @@ BuildRequires: pkgconfig(libcurl)
|
|||||||
# The following requires must mirror:
|
# The following requires must mirror:
|
||||||
# LIBGIT2_SYS_USE_PKG_CONFIG &&
|
# LIBGIT2_SYS_USE_PKG_CONFIG &&
|
||||||
# LIBSSH2_SYS_USE_PKG_CONFIG
|
# LIBSSH2_SYS_USE_PKG_CONFIG
|
||||||
%if !%with rust_bootstrap || 0%{?sle_version} >= 120000 && 0%{?sle_version} <= 120400
|
%if !%with rust_bootstrap || 0%{?sle_version} >= 120000 && 0%{?sle_version} <= 120500
|
||||||
BuildRequires: pkgconfig(libgit2) >= 0.23
|
BuildRequires: pkgconfig(libgit2) >= 0.23
|
||||||
BuildRequires: pkgconfig(libssh2) >= 1.4.3
|
BuildRequires: pkgconfig(libssh2) >= 1.4.3
|
||||||
%endif
|
%endif
|
||||||
@ -352,6 +375,7 @@ This package includes HTML documentation for Cargo.
|
|||||||
%setup -q -n rustc-%{version}-src
|
%setup -q -n rustc-%{version}-src
|
||||||
|
|
||||||
%patch0 -p1
|
%patch0 -p1
|
||||||
|
%patch1 -p1
|
||||||
|
|
||||||
# use python3
|
# use python3
|
||||||
sed -i -e "1s|#!.*|#!%{_bindir}/python3|" x.py
|
sed -i -e "1s|#!.*|#!%{_bindir}/python3|" x.py
|
||||||
@ -427,14 +451,19 @@ fi
|
|||||||
# If the environments between build and install and different,
|
# If the environments between build and install and different,
|
||||||
# everything will be rebuilt during installation!
|
# everything will be rebuilt during installation!
|
||||||
export RUSTFLAGS="%{rustflags}"
|
export RUSTFLAGS="%{rustflags}"
|
||||||
|
%if 0%{?sle_version} >= 120000 && 0%{?sle_version} <= 120500
|
||||||
|
export CC=gcc-7
|
||||||
|
export CXX=g++-7
|
||||||
|
%endif
|
||||||
# Cargo use system libs if not bootstrapping
|
# Cargo use system libs if not bootstrapping
|
||||||
# restircted only to libgit due to version changes causing with cargo rpm deps
|
# restircted only to libgit due to version changes causing with cargo rpm deps
|
||||||
%if !%with rust_bootstrap || 0%{?sle_version} >= 120000 && 0%{?sle_version} <= 120400
|
%if !%with rust_bootstrap || 0%{?sle_version} >= 120000 && 0%{?sle_version} <= 120500
|
||||||
export LIBGIT2_SYS_USE_PKG_CONFIG=1
|
export LIBGIT2_SYS_USE_PKG_CONFIG=1
|
||||||
export LIBSSH2_SYS_USE_PKG_CONFIG=1
|
export LIBSSH2_SYS_USE_PKG_CONFIG=1
|
||||||
%endif
|
%endif
|
||||||
# eliminate complain from RPMlint
|
# eliminate complain from RPMlint
|
||||||
export CPPFLAGS="%{optflags}"
|
export CPPFLAGS="%{optflags}"
|
||||||
|
export DESTDIR=%{buildroot}
|
||||||
# END EXPORTS
|
# END EXPORTS
|
||||||
|
|
||||||
./x.py build -v
|
./x.py build -v
|
||||||
@ -448,18 +477,23 @@ export CPPFLAGS="%{optflags}"
|
|||||||
# If the environments between build and install and different,
|
# If the environments between build and install and different,
|
||||||
# everything will be rebuilt during installation!
|
# everything will be rebuilt during installation!
|
||||||
export RUSTFLAGS="%{rustflags}"
|
export RUSTFLAGS="%{rustflags}"
|
||||||
|
%if 0%{?sle_version} >= 120000 && 0%{?sle_version} <= 120500
|
||||||
|
export CC=gcc-7
|
||||||
|
export CXX=g++-7
|
||||||
|
%endif
|
||||||
# Cargo use system libs if not bootstrapping
|
# Cargo use system libs if not bootstrapping
|
||||||
# restircted only to libgit due to version changes causing with cargo rpm deps
|
# restircted only to libgit due to version changes causing with cargo rpm deps
|
||||||
%if !%with rust_bootstrap || 0%{?sle_version} >= 120000 && 0%{?sle_version} <= 120400
|
%if !%with rust_bootstrap || 0%{?sle_version} >= 120000 && 0%{?sle_version} <= 120500
|
||||||
export LIBGIT2_SYS_USE_PKG_CONFIG=1
|
export LIBGIT2_SYS_USE_PKG_CONFIG=1
|
||||||
export LIBSSH2_SYS_USE_PKG_CONFIG=1
|
export LIBSSH2_SYS_USE_PKG_CONFIG=1
|
||||||
%endif
|
%endif
|
||||||
# eliminate complain from RPMlint
|
# eliminate complain from RPMlint
|
||||||
export CPPFLAGS="%{optflags}"
|
export CPPFLAGS="%{optflags}"
|
||||||
|
export DESTDIR=%{buildroot}
|
||||||
# END EXPORTS
|
# END EXPORTS
|
||||||
|
|
||||||
DESTDIR=%{buildroot} ./x.py install
|
./x.py install
|
||||||
DESTDIR=%{buildroot} ./x.py install src
|
./x.py install src
|
||||||
|
|
||||||
# Remove executable permission from HTML documentation
|
# Remove executable permission from HTML documentation
|
||||||
# to prevent RPMLINT errors.
|
# to prevent RPMLINT errors.
|
||||||
@ -501,6 +535,9 @@ install -D %{buildroot}%{_sysconfdir}/bash_completion.d/cargo %{buildroot}%{_dat
|
|||||||
# There should be nothing here at all
|
# There should be nothing here at all
|
||||||
rm -rf %{buildroot}%{_sysconfdir}
|
rm -rf %{buildroot}%{_sysconfdir}
|
||||||
|
|
||||||
|
# Remove llvm installation
|
||||||
|
rm -rf %{buildroot}/home
|
||||||
|
|
||||||
%post -p /sbin/ldconfig
|
%post -p /sbin/ldconfig
|
||||||
%postun -p /sbin/ldconfig
|
%postun -p /sbin/ldconfig
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user