Michael Schröder
7f9a154e3c
OBS-URL: https://build.opensuse.org/package/show/Base:System/rpm?expand=0&rev=498
64 lines
2.5 KiB
Diff
64 lines
2.5 KiB
Diff
From 9a50846ceeef2add2344dd463c5562bd69496a23 Mon Sep 17 00:00:00 2001
|
|
From: Panu Matilainen <pmatilai@redhat.com>
|
|
Date: Mon, 6 May 2019 14:44:30 +0300
|
|
Subject: [PATCH] Adopt language-specific %build_fooflags macros from Fedora
|
|
|
|
%{optflags} has been the catchall for all compiler options but this
|
|
is quite limiting as there's no way to add for example C++ specific
|
|
options distro-wide. This adds separate %build_cflags, %build_cxxflags,
|
|
%build_fflags for the gcc-supported languages, and additionally
|
|
%build_ldflags for distro-wide LDFLAGS setting.
|
|
|
|
Based on Florian Weimer's work in Fedoras redhat-rpm-config macros.
|
|
---
|
|
macros.in | 26 +++++++++++++++++++++++---
|
|
1 file changed, 23 insertions(+), 3 deletions(-)
|
|
|
|
diff --git a/macros.in b/macros.in
|
|
index 2ab108776..b6cb52951 100644
|
|
--- a/macros.in
|
|
+++ b/macros.in
|
|
@@ -999,6 +999,24 @@ package or when debugging this package.\
|
|
%_target_vendor %{_host_vendor}
|
|
%_target_os %{_host_os}
|
|
|
|
+#==============================================================================
|
|
+# ---- compiler flags.
|
|
+
|
|
+# 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.
|
|
+#%build_ldflags -Wl,-z,relro %{?_lto_cflags}
|
|
+
|
|
#==============================================================================
|
|
# ---- specfile macros.
|
|
# Macro(s) here can be used reliably for reproducible builds.
|
|
@@ -1010,9 +1028,11 @@ package or when debugging this package.\
|
|
#
|
|
%_configure ./configure
|
|
%configure \
|
|
- CFLAGS="${CFLAGS:-%optflags}" ; export CFLAGS ; \
|
|
- CXXFLAGS="${CXXFLAGS:-%optflags}" ; export CXXFLAGS ; \
|
|
- FFLAGS="${FFLAGS:-%optflags}" ; export FFLAGS ; \
|
|
+ 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 ; \
|
|
%{_configure} --host=%{_host} --build=%{_build} \\\
|
|
--program-prefix=%{?_program_prefix} \\\
|
|
--disable-dependency-tracking \\\
|
|
--
|
|
2.21.0
|
|
|