Split compiler flag out of %configure to separate %set_build_flags macro

Not all the world is autotools based, mercifully. Let the other build
systems benefit from the central rpm macros as well by splitting
the XXFLAGS setting out of %configure.

Based on Florian Weimer's work in Fedoras redhat-rpm-config macros.
This commit is contained in:
Panu Matilainen 2019-05-06 14:50:35 +03:00
parent 9a50846cee
commit 3940c6f32e
1 changed files with 11 additions and 5 deletions

View File

@ -1017,6 +1017,16 @@ package or when debugging this package.\
# Link editor flags. This is usually called LDFLAGS in makefiles.
#%build_ldflags -Wl,-z,relro %{?_lto_cflags}
# Expands to shell code to seot the compiler/linker environment
# variables CFLAGS, CXXFLAGS, FFLAGS, FCFLAGS, LDFLAGS if they have
# not been set already.
%set_build_flags \
CFLAGS="${CFLAGS:-%{build_cflags}}" ; export CFLAGS ; \
CXXFLAGS="${CXXFLAGS:-%{build_cxxflags}}" ; export CXXFLAGS ; \
FFLAGS="${FFLAGS:-%{build_fflags}}" ; export FFLAGS ; \
FCFLAGS="${FCFLAGS:-%{build_fflags}}" ; export FCFLAGS ; \
LDFLAGS="${LDFLAGS:-%{build_ldflags}}" ; export LDFLAGS
#==============================================================================
# ---- specfile macros.
# Macro(s) here can be used reliably for reproducible builds.
@ -1028,11 +1038,7 @@ package or when debugging this package.\
#
%_configure ./configure
%configure \
CFLAGS="${CFLAGS:-%{build_cflags}}" ; export CFLAGS ; \
CXXFLAGS="${CXXFLAGS:-%{build_cxxflags}}" ; export CXXFLAGS ; \
FFLAGS="${FFLAGS:-%{build_fflags}}" ; export FFLAGS ; \
FCFLAGS="${FCFLAGS:-%{build_fflags}}" ; export FCFLAGS ; \
LDFLAGS="${LDFLAGS:-%{build_ldflags}}" ; export LDFLAGS ; \
%{set_build_flags}; \
%{_configure} --host=%{_host} --build=%{_build} \\\
--program-prefix=%{?_program_prefix} \\\
--disable-dependency-tracking \\\