diff --git a/rust.changes b/rust.changes index 1ee581c..013bfe1 100644 --- a/rust.changes +++ b/rust.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Sat Feb 23 01:58:47 UTC 2019 - Luke Jones + +- 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 diff --git a/rust.spec b/rust.spec index 870da9b..386be0a 100644 --- a/rust.spec +++ b/rust.spec @@ -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