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

Better way to use exported vars

OBS-URL: https://build.opensuse.org/request/show/678326
OBS-URL: https://build.opensuse.org/package/show/devel:languages:rust/rust?expand=0&rev=181
This commit is contained in:
Luke Jones 2019-02-23 05:58:34 +00:00 committed by Git OBS Bridge
parent b363312045
commit 555d2841ad

View File

@ -2,7 +2,7 @@
# spec file for package rust
#
# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
# Copyright (c) 2018 Luke Jones, jones_ld@protonmail.com
# Copyright (c) 2019 Luke Jones, jones_ld@protonmail.com
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@ -52,9 +52,6 @@
%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
@ -73,6 +70,18 @@
%else
%define debug_info --enable-debuginfo --disable-debuginfo-only-std --enable-debuginfo-tools --disable-debuginfo-lines
%endif
# Use hardening ldflags.
%global rustflags -Clink-arg=-Wl,-z,relro,-z,now
# Cargo use system libs
%global cargo_git LIBGIT2_SYS_USE_PKG_CONFIG=1
%global cargo_ssh LIBSSH2_SYS_USE_PKG_CONFIG=1
# eliminate complain from RPMlint
%global nocomplain CPPFLAGS="%{optflags}"
# Must be exported before running x.py in both build and install
# If the environments between build and install and different,
# everything will be rebuilt during installation!
%global build_env_vars RUSTFLAGS="%{rustflags}" %{cargo_git} %{cargo_ssh} %{nocomplain}
Name: rust
Version: 1.32.0
@ -363,19 +372,6 @@ 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
export CPPFLAGS="%{optflags}" # eliminate complain from RPMlint
%configure \
--disable-option-checking \
--build=%{rust_triple} --host=%{rust_triple} --target=%{rust_triple} \
@ -401,25 +397,26 @@ export CPPFLAGS="%{optflags}" # eliminate complain from RPMlint
sed -i -e "s|#codegen-units = 1|codegen-units = 2|" config.toml
%endif
# 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!
export %{build_env_vars}
./x.py build -v
./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,
# cut&pasted to the %build section above. And please keep them
# in sync!
# If the environments between build and install and different,
# everything will be rebuilt during installation!
export %{build_env_vars}
# 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
DESTDIR=%{buildroot} ./x.py install
DESTDIR=%{buildroot} ./x.py install src
# Remove executable permission from HTML documentation
# to prevent RPMLINT errors.