From 816482df4bd6dfca1e0e11da98da9d6ad640406a0d57c0bfc98f694f98feb6f8 Mon Sep 17 00:00:00 2001 From: Luke Jones Date: Sun, 24 Feb 2019 04:06:19 +0000 Subject: [PATCH] Accepting request 678447 from home:luke_nukem:branches:devel:languages:rust - Fix bootstrap conditionals - Fix bundled_llvm conditionals - Don't build stage0 if compiler used to build package is the same version as package OBS-URL: https://build.opensuse.org/request/show/678447 OBS-URL: https://build.opensuse.org/package/show/devel:languages:rust/rust?expand=0&rev=182 --- rust.changes | 8 ++++++++ rust.spec | 41 ++++++++++++++++++++--------------------- 2 files changed, 28 insertions(+), 21 deletions(-) diff --git a/rust.changes b/rust.changes index 013bfe1..e5643a5 100644 --- a/rust.changes +++ b/rust.changes @@ -1,3 +1,11 @@ +------------------------------------------------------------------- +Sun Feb 24 01:52:06 UTC 2019 - Luke Jones + +- Fix bootstrap conditionals +- Fix bundled_llvm conditionals +- Don't build stage0 if compiler used to build package is the + same version as package + ------------------------------------------------------------------- Sat Feb 23 01:58:47 UTC 2019 - Luke Jones diff --git a/rust.spec b/rust.spec index 2a2dab2..753357d 100644 --- a/rust.spec +++ b/rust.spec @@ -52,22 +52,20 @@ %global common_libdir %{_prefix}/lib %global rustlibdir %{common_libdir}/rustlib -# We occasionally need to bootstrap builds due to breakage etc. Rust only guarantees -# v-1 will build v -%bcond_with rust_bootstrap - -# Distro LLVM should be sufficient, this also cuts compile times byu almost half -%if 0%{?suse_version} <= 1315 +# Distro LLVM should be sufficient, this also cuts compile times by almost half +%if 0%{?suse_version} <= 1315 && 0%{?is_opensuse} +%bcond_without bundled_llvm +%endif +%if 0%{?sle_version} < 120400 && 0%{?is_backports} %bcond_without bundled_llvm -%else -%bcond_with bundled_llvm %endif # Debuginfo can exhaust memory on these architecture workers %ifarch %{arm} %{ix86} -%define codegen_units --set codegen-units=4 -%define debug_info --disable-debuginfo --enable-debuginfo-only-std --disable-debuginfo-tools --disable-debuginfo-lines +%define codegen_units --set rust.codegen-units=2 +%define debug_info --disable-debuginfo --disable-debuginfo-only-std --disable-debuginfo-tools --disable-debuginfo-lines %else +%define codegen_units --set rust.codegen-units=0 %define debug_info --enable-debuginfo --disable-debuginfo-only-std --enable-debuginfo-tools --disable-debuginfo-lines %endif # Use hardening ldflags. @@ -128,11 +126,11 @@ ExclusiveArch: x86_64 %{arm} aarch64 ppc64 ppc64le s390x %{ix86} %ifarch %{ix86} ExclusiveArch: i686 %endif -%if %{without bundled_llvm} +%if !%with bundled_llvm # LLVM gives incorrect C++ flags for GCC -BuildRequires: llvm-devel >= 5.0 +BuildRequires: llvm-devel >= 6.0 %endif -%if %{without rust_bootstrap} +%if !%with rust_bootstrap # We will now package cargo using the version number of rustc since # it is being built from rust sources. Old cargo packages have a 0.x number BuildRequires: cargo <= %{version} @@ -345,7 +343,7 @@ rm -rf src/tools/clang rm -rf src/tools/lld rm -rf src/tools/lldb -%if %without bundled_llvm +%if !%with bundled_llvm rm -rf src/llvm/ %endif @@ -379,7 +377,7 @@ sed -i '1s|^|#!/bin/bash\n|' src/stdsimd/ci/run-docker.sh --local-rust-root=%{rust_root} \ --libdir=%{common_libdir} \ --docdir=%{_docdir}/%{name} \ - %{!?with_bundled_llvm: --llvm-root=%{_prefix} --enable-llvm-link-shared} \ + %{!?with_bundled_llvm: --llvm-root=%{_prefix} --enable-llvm-link-shared --set llvm.link-jobs=1} \ --disable-codegen-tests \ --enable-optimize \ --enable-docs \ @@ -387,15 +385,16 @@ sed -i '1s|^|#!/bin/bash\n|' src/stdsimd/ci/run-docker.sh --disable-jemalloc \ --disable-rpath \ %{debug_info} \ + %{codegen_units} \ --enable-extended \ --enable-vendor \ --release-channel="stable" -# We need less codegen units for these arches since the workers are running out of memory -# This means we must apply a minimum of 2 CPUs to a worker in constraints. -%ifarch %{arm} %{ix86} -sed -i -e "s|#codegen-units = 1|codegen-units = 2|" config.toml -%endif +# Sometimes we may be rebuilding with the same compiler, +# setting local-rebuild will skip stage0 build, reducing build time +if [ $(%{rust_root}/bin/rustc --version | sed -En 's/rustc ([0-9].[0-9][0-9].[0-9]).*/\1/p') == '%{version}' ]; then +sed -i -e "s|#local-rebuild = false|local-rebuild = true|" config.toml; +fi # Keep all the "export VARIABLE" together here, so they can be # cut&pasted to the %install section below. And please keep them @@ -566,4 +565,4 @@ rm -rf %{buildroot}%{_sysconfdir} %dir %{_docdir}/cargo %{_docdir}/cargo/html -%changelog +%changelog \ No newline at end of file