Accepting request 678319 from home:luke_nukem:branches:devel:languages:rust

- Ensure install environment is the same as build environment to
  prevent building everything twice (second time without correct
  flags).

OBS-URL: https://build.opensuse.org/request/show/678319
OBS-URL: https://build.opensuse.org/package/show/devel:languages:rust/rust?expand=0&rev=180
This commit is contained in:
Luke Jones 2019-02-23 02:08:42 +00:00 committed by Git OBS Bridge
parent c5c57d02d8
commit b363312045
2 changed files with 41 additions and 10 deletions

View File

@ -1,3 +1,10 @@
-------------------------------------------------------------------
Sat Feb 23 01:58:47 UTC 2019 - Luke Jones <jones_ld@protonmail.com>
- Ensure install environment is the same as build environment to
prevent building everything twice (second time without correct
flags).
-------------------------------------------------------------------
Thu Jan 17 21:22:11 UTC 2019 - Luke Jones <jones_ld@protonmail.com>

View File

@ -47,20 +47,33 @@
%global rust_triple %{rust_arch}-unknown-linux-%{abi}
# All sources and bootstraps are fetched form here
%global dl_url https://static.rust-lang.org/dist
# Rust doesn't function well when put in /usr/lib64
%global common_libdir %{_prefix}/lib
%global rustlibdir %{common_libdir}/rustlib
# Use hardening ldflags.
%global rustflags -Clink-arg=-Wl,-z,relro,-z,now
# 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
%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
%else
%define debug_info --enable-debuginfo --disable-debuginfo-only-std --enable-debuginfo-tools --disable-debuginfo-lines
%endif
Name: rust
Version: 1.32.0
Release: 0
@ -350,29 +363,29 @@ sed -i '1s|^|#!/bin/bash\n|' src/liblibc/ci/emscripten-entry.sh
sed -i '1s|^|#!/bin/bash\n|' src/stdsimd/ci/run-docker.sh
%build
# Keep all the "export VARIABLE" together here, so they can be
# cut&pasted to the %install section below. And please keep them in
# sync! If the environments between build and install and different,
# everything will be rebuilt during installation!
# This should eventually migrate to distro policy
# Enable optimization, debuginfo, and link hardening.
export RUSTFLAGS="%{rustflags}"
# Cargo use system libs
export LIBGIT2_SYS_USE_PKG_CONFIG=1
export LIBSSH2_SYS_USE_PKG_CONFIG=1
# 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
%else
%define debug_info --enable-debuginfo --disable-debuginfo-only-std --enable-debuginfo-tools --disable-debuginfo-lines
%endif
export CPPFLAGS="%{optflags}" # eliminate complain from RPMlint
%configure \
--disable-option-checking \
--build=%{rust_triple} --host=%{rust_triple} --target=%{rust_triple} \
--enable-local-rust \
--local-rust-root=%{rust_root} \
--libdir=%{common_libdir} \
--docdir=%{_docdir}/%{name} \
%{!?with_bundled_llvm: --llvm-root=%{_prefix} --enable-llvm-link-shared} \
--disable-codegen-tests \
--enable-optimize \
--enable-docs \
--enable-verbose-tests \
--disable-jemalloc \
@ -382,8 +395,6 @@ export LIBSSH2_SYS_USE_PKG_CONFIG=1
--enable-vendor \
--release-channel="stable"
export CPPFLAGS="%{optflags}" # eliminate complain from RPMlint
# 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}
@ -394,6 +405,19 @@ sed -i -e "s|#codegen-units = 1|codegen-units = 2|" config.toml
./x.py doc -v
%install
# Keep all the "export VARIABLE" together here, so they can be
# cut&pasted to the %install section below. And please keep them in
# sync! If the environments between build and install and different,
# everything will be rebuilt during installation!
# This should eventually migrate to distro policy
# Enable optimization, debuginfo, and link hardening.
export RUSTFLAGS="%{rustflags}"
# Cargo use system libs
export LIBGIT2_SYS_USE_PKG_CONFIG=1
export LIBSSH2_SYS_USE_PKG_CONFIG=1
export CPPFLAGS="%{optflags}" # eliminate complain from RPMlint
DESTDIR=%{buildroot} python3 ./x.py install
DESTDIR=%{buildroot} python3 ./x.py install src