%debugcppflags %{nil}
%debugldflags %{nil}
-%optldflags -Wl,--as-needed -Wl,--no-copy-dt-needed-entries -Wl,-z,relro -Wl,-z,combreloc %{?use_ld:-Wl,-fuse-ld=%{use_ld}}
-%optcppflags %{nil}
+%optldflags -Wl,--as-needed -Wl,--no-copy-dt-needed-entries -Wl,-z,relro -Wl,-z,combreloc %{?use_ld:-Wl,-fuse-ld=%{use_ld}}
+%optcppflags -DNDEBUG -DQT_NO_DEBUG
# common compilation flags
%_fortify_cflags -Wp,-D_FORTIFY_SOURCE=2
# cf http://wiki.mandriva.com/en/Development/Packaging/Problems#format_not_a_string_literal_and_no_format_arguments
%Werror_cflags -Wformat -Werror=format-security
+# silent line truncation causes errors hard to track
+%Werror_fflags -Werror=line-truncation
+
# Use -Werror=trampolines to prevent GCC from generating code that require executable stack
%_ssp_cflags -fstack-protector-strong --param=ssp-buffer-size=4 -Werror=trampolines
-%__common_cflags -O2 -fwrapv -pipe %{Werror_cflags} %{debuginfocflags} %{?_fortify_cflags} %{!?nospecflags:%{?specflags}}
+%__common_cflags -O2 -fwrapv -pipe %{debuginfocflags} %{?_fortify_cflags} %{!?nospecflags:%{?specflags}}
%__common_cflags_with_ssp %{__common_cflags} %{?_ssp_cflags}
# arch macros
# BuildRequires: rpmbuild(macros) >= 1.315
#
# Flags specified in %filterout_* are removed from %rpm*flags, exactly:
-# %rpmcflags = %optflags - %filterout - %filterout_c - %filterout_ld
-# %rpmcxxflags = %optflags - %filterout - %filterout_cxx - %filterout_ld
-# %rpmcppflags = %optcppflags - %filterout - %filterout_cpp - %filterout_ld
-# %rpmldflags = %optldflags - %filterout_ld
+# %rpmcflags = %optflags|%debufcflags %Werror_cflags - %filterout - %filterout_c - %filterout_ld
+# %rpmcxxflags = %optflags|%debufcflags %Werror_cflags - %filterout - %filterout_cxx - %filterout_ld
+# %rpmfflags = %optflags|%debugcflags %Werror_fflags - %filterout - %filterout_f - %filterout_ld
+# %rpmcppflags = %optcppflags|%debugcppflags - %filterout - %filterout_cpp - %filterout_ld
+# %rpmldflags = %optldflags|%debugldflags - %filterout_ld
#
# Regular expressions are supported, but to avoid some character be treated
# as regular expression it must be escaped twice.
}
%rpmcflags %(awk 'BEGIN {
- split("%{?debug:%debugcflags}%{!?debug:%optflags}%{?debuginfocflags}",I);
+ split("%{?debug:%debugcflags}%{!?debug:%optflags}%{?debuginfocflags} %{Werror_cflags}",I);
split("%{?filterout} %{?filterout_c} %{?filterout_ld}",F);
%{filter_out}
}')
%build_fflags %{rpmcflags} %{?_fmoddir:-I%{_fmoddir}}
%rpmcxxflags %(awk 'BEGIN {
- split("%{?debug:%debugcflags}%{!?debug:%optflags}%{?debuginfocflags}",I);
+ split("%{?debug:%debugcflags}%{!?debug:%optflags}%{?debuginfocflags} %{Werror_cflags}",I);
split("%{?filterout} %{?filterout_cxx} %{?filterout_ld}",F);
%{filter_out}
}')
%build_cxxflags %{rpmcxxflags}
+%rpmfflags %(awk 'BEGIN {
+ split("%{?debug:%debugcflags}%{!?debug:%optflags}%{?debuginfocflags} %{Werror_fflags}",I);
+ split("%{?filterout} %{?filterout_f} %{?filterout_ld}",F);
+ %{filter_out}
+}')
+%build_fflags %{rpmfflags}
+
%rpmcppflags %(awk 'BEGIN {
split("%{?debug:%debugcppflags}%{!?debug:%optcppflags}%{?debuginfocppflags}",I);
split("%{?filterout} %{?filterout_cpp} %{?filterout_cpp}",F);
%{?__cpp:CPP="%{__cpp}" ; export CPP ; } \
CFLAGS="${CFLAGS:-%rpmcflags}" ; export CFLAGS ; \
CXXFLAGS="${CXXFLAGS:-%rpmcxxflags}" ; export CXXFLAGS ; \
- FFLAGS="${FFLAGS:-%rpmcflags}" ; export FFLAGS ; \
- FCFLAGS="${FCFLAGS:-%rpmcflags}" ; export FCFLAGS ; \
+ FFLAGS="${FFLAGS:-%rpmfflags}" ; export FFLAGS ; \
+ FCFLAGS="${FCFLAGS:-%rpmfflags}" ; export FCFLAGS ; \
CPPFLAGS="${CPPFLAGS:-%rpmcppflags}" ; export CPPFLAGS ; \
LDFLAGS="${LDFLAGS:-%rpmldflags}" ; export LDFLAGS ; \
RUSTC="${RUSTC:-%__rustc}" ; export RUSTC ; \
-DCMAKE_BUILD_TYPE=%{!?debug:TLD}%{?debug:Debug} \\\
-DCMAKE_SYSTEM_NAME=Linux \\\
-DCMAKE_SYSTEM_VERSION="%(uname -r)" \\\
- -DCMAKE_CROSSCOMPILING:BOOL=FALSE \\\
+ -DCMAKE_CROSSCOMPILING:BOOL=OFF \\\
%ifarch x32\
-DCMAKE_SYSTEM_PROCESSOR=x86_64 \\\
%else\
-DCMAKE_INSTALL_DOCDIR:PATH=%{_docdir} \\\
-DCMAKE_INSTALL_PREFIX:PATH=%{_prefix} \\\
-DSYSCONF_INSTALL_DIR:PATH=%{_sysconfdir} \\\
- -DCMAKE_CXX_FLAGS_TLD="${CXXFLAGS:-%{rpmcxxflags} -DNDEBUG -DQT_NO_DEBUG}" \\\
- -DCMAKE_C_FLAGS_TLD="${CFLAGS:-%{rpmcflags} -DNDEBUG -DQT_NO_DEBUG}" \\\
- -DCMAKE_Fortran_FLAGS_TLD="${CFLAGS:-%{rpmcflags} -DNDEBUG -DQT_NO_DEBUG}" \\\
- -DCMAKE_EXE_LINKER_FLAGS_TLD="${LDFLAGS:-%{rpmldflags}}" \\\
- -DCMAKE_SHARED_LINKER_FLAGS_TLD="${LDFLAGS:-%{rpmldflags}}" \\\
- -DCMAKE_MODULE_LINKER_FLAGS_TLD="${LDFLAGS:-%{rpmldflags}}" \\\
+ -DCMAKE_CXX_FLAGS_TLD="${CXXFLAGS} ${CPPFLAGS}" \\\
+ -DCMAKE_C_FLAGS_TLD="${CFLAGS} ${CPPFLAGS}" \\\
+ -DCMAKE_Fortran_FLAGS_TLD="${FFLAGS} ${CPPFLAGS}" \\\
+ -DCMAKE_EXE_LINKER_FLAGS_TLD="${LDFLAGS}" \\\
+ -DCMAKE_SHARED_LINKER_FLAGS_TLD="${LDFLAGS}" \\\
+ -DCMAKE_MODULE_LINKER_FLAGS_TLD="${LDFLAGS}" \\\
%if "%{_lib}" == "lib64" \
-DLIB_SUFFIX=64 \\\
%endif \
LDFLAGS="${LDFLAGS:-%rpmldflags}" \
CFLAGS="${CFLAGS:-%rpmcflags}" \
CXXFLAGS="${CXXFLAGS:-%rpmcxxflags}" \
- FFLAGS="${FFLAGS:-%rpmcflags}" \
+ FFLAGS="${FFLAGS:-%rpmfflags}" \
CPPFLAGS="${CPPFLAGS:-%rpmcppflags}" \
%{?__cc:CC="%{__cc}"} \
%{?__cxx:CXX="%{__cxx}"} \
%__true_false() %{expand:%%{?with_%{1}:true}%%{!?with_%{1}:false}}
%__true_false_not() %{expand:%%{?with_%{1}:false}%%{!?with_%{1}:true}}
-# expands to enabled or disabled based on bcond; for use with meson or cmake (since 2.000)
+# expands to enabled or disabled based on bcond; for use with meson (since 2.000)
%__enabled_disabled() %{expand:%%{?with_%{1}:enabled}%%{!?with_%{1}:disabled}}
%__enabled_disabled_not() %{expand:%%{?with_%{1}:disabled}%%{!?with_%{1}:enabled}}
-# for use with cmake:
+# expands to enabled or disabled based on bcond; for use with cmake (since 2.047)
+%__ON_OFF() %{expand:%%{?with_%{1}:ON}%%{!?with_%{1}:OFF}}
+%__ON_OFF_not() %{expand:%%{?with_%{1}:OFF}%%{!?with_%{1}:ON}}
+
+# for use with cmake (since 1.742):
# Usage: cmake_on_off BCOND_NAME [OPTION_NAME]
-# BuildRequires: rpmbuild(macros) >= 1.742
+# Deprecated: use clearer -DOPTION_NAME=%{__ON_OFF BCOND_NAME} instead
%cmake_on_off() -D%{?2}%{!?2:%{1}}:BOOL=%{expand:%%{?with_%{1}:ON}%%{!?with_%{1}:OFF}}
#-----------------------------------------------------------------