diff options
author | Jani Välimaa <wally@mageia.org> | 2019-12-28 22:04:54 +0200 |
---|---|---|
committer | Jani Välimaa <wally@mageia.org> | 2019-12-28 22:04:54 +0200 |
commit | 256856a3cc3f350d94d9e1ffb5c62e81802d51cb (patch) | |
tree | eb7d44a61c0aaa421731f931d645beec6d5db92f /build.macros.in | |
parent | 4ac236a0a415165a327bc15d606da875d6f58d5b (diff) | |
download | rpm-setup-256856a3cc3f350d94d9e1ffb5c62e81802d51cb.tar rpm-setup-256856a3cc3f350d94d9e1ffb5c62e81802d51cb.tar.gz rpm-setup-256856a3cc3f350d94d9e1ffb5c62e81802d51cb.tar.bz2 rpm-setup-256856a3cc3f350d94d9e1ffb5c62e81802d51cb.tar.xz rpm-setup-256856a3cc3f350d94d9e1ffb5c62e81802d51cb.zip |
build.macros: add build_* flags and set_build_flags macro from upstream rpm
%build_cflags
%build_cxxflags
%build_fflags
%build_ldflags
Diffstat (limited to 'build.macros.in')
-rw-r--r-- | build.macros.in | 40 |
1 files changed, 34 insertions, 6 deletions
diff --git a/build.macros.in b/build.macros.in index 9c93cc5..6000cbd 100644 --- a/build.macros.in +++ b/build.macros.in @@ -152,6 +152,40 @@ GCONF_CONFIG_SOURCE=`%{_gconftool_bin} --get-default-source` %{_gconftool_bin} - # C compiler flags. This is traditionally called CFLAGS in makefiles. # Historically also available as %%{optflags}, and %%build sets the # environment variable RPM_OPT_FLAGS to this value. +%build_cflags %{optflags} + +# C++ compiler flags. This is traditionally called CXXFLAGS in makefiles. +%build_cxxflags %{optflags} + +# Fortran compiler flags. Makefiles use both FFLAGS and FCFLAGS as +# the corresponding variable names. +%build_fflags %{optflags} %{?_fmoddir:-I%_fmoddir} + +# Link editor flags. This is usually called LDFLAGS in makefiles. +# (Some makefiles use LFLAGS instead.) The default value assumes that +# the flags, while intended for ld, are still passed through the gcc +# compiler driver. At the beginning of %%build, the environment +# variable RPM_LD_FLAGS to this value. +%build_ldflags %{?!_disable_ld_as_needed: -Wl,--as-needed}%{?!_disable_ld_no_undefined: -Wl,--no-undefined}%{?!_disable_ld_relro: -Wl,-z,relro}%{?!_disable_ld_O1: -Wl,-O1}%{?!_disable_ld_build_id: -Wl,--build-id}%{?!_disable_ld_enable_new_dtags: -Wl,--enable-new-dtags} + +# For compatibility +%ldflags %build_ldflags + +# Expands to shell code to seot the compiler/linker environment +# variables CFLAGS, CXXFLAGS, FFLAGS, FCFLAGS, LDFLAGS if they have +# not been set already. RPM_OPT_FLAGS and RPM_LD_FLAGS have already +# been set implicitly at the start of the %%build section. +%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 + +# For compatibility +%setup_compile_flags \ + %{warn:%%setup_compile_flags is deprecated, use %%set_build_flags instead} \ + %set_build_flags %debugcflags %{?_enable_debug_packages:-g} @@ -187,12 +221,6 @@ export CFLAGS="%optflags"; export CXXFLAGS="%optflags"; export RPM_OPT_FLAGS="%o %__libtoolize_configure %{?__libtoolize:(cd $CONFIGURE_TOP; [ ! -f configure.in -a ! -f configure.ac ] || %{__libtoolize} --copy --force)} -%ldflags %{?!_disable_ld_as_needed: -Wl,--as-needed}%{?!_disable_ld_no_undefined: -Wl,--no-undefined}%{?!_disable_ld_relro: -Wl,-z,relro}%{?!_disable_ld_O1: -Wl,-O1}%{?!_disable_ld_build_id: -Wl,--build-id}%{?!_disable_ld_enable_new_dtags: -Wl,--enable-new-dtags} - -%setup_compile_flags \ - %{warn:%%setup_compile_flags is deprecated, use %%set_build_flags instead} \ - %set_build_flags - %before_configure \ %set_build_flags \ CONFIGURE_TOP="${CONFIGURE_TOP:-.}"; \ |