Skip to content

Commit

Permalink
Split compiler flag out of %configure to separate %set_build_flags macro
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
pmatilai committed May 14, 2019
1 parent 9a50846 commit 3940c6f
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions macros.in
Expand Up @@ -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.
Expand All @@ -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 \\\
Expand Down

0 comments on commit 3940c6f

Please sign in to comment.