diff --git a/mariadb10.11.spec b/mariadb10.11.spec index 9447ba9..2cf25c0 100644 --- a/mariadb10.11.spec +++ b/mariadb10.11.spec @@ -926,6 +926,27 @@ fi fi %endif + +# Adjust the compliation flags: +# First initialize the distribution default values +%{set_build_flags} +# Add custom tweaks +CFLAGS="$CFLAGS -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE" +# Force the 'PIC' mode so that we can build libmysqld.so +CFLAGS="$CFLAGS -fPIC" + +# When making a debug build, remove all optimizations +%if %{with debug} +# -D_FORTIFY_SOURCE requires optimizations enabled. Disable the fortify. +%undefine _fortify_level +CFLAGS=`echo "$CFLAGS" | sed -r 's/-O[0123]//'` +CFLAGS="$CFLAGS -O0 -g" +%endif + +# Apply the updated values +CXXFLAGS="$CFLAGS"; CPPFLAGS="$CFLAGS"; export CFLAGS CXXFLAGS CPPFLAGS + + # The INSTALL_xxx macros have to be specified relative to CMAKE_INSTALL_PREFIX # so we can't use %%{_datadir} and so forth here. %cmake \ @@ -1001,27 +1022,8 @@ fi # The issue is that the MariaDB upstream level of hardening is lower than expected by Red Hat # We disable this option to the default compilation flags (which have higher level of hardening) will be used - -CFLAGS="$CFLAGS -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE" -# force PIC mode so that we can build libmysqld.so -CFLAGS="$CFLAGS -fPIC" - -%if %{with debug} -# Override all optimization flags when making a debug build -# -D_FORTIFY_SOURCE requires optimizations enabled. Disable the fortify. -%undefine _fortify_level -CFLAGS=`echo "$CFLAGS" | sed -r 's/-O[0123]//'` - -CFLAGS="$CFLAGS -O0 -g" -%endif - -CXXFLAGS="$CFLAGS" -CPPFLAGS="$CFLAGS" -export CFLAGS CXXFLAGS CPPFLAGS - - -# Print all Cmake options values; "-LAH" means "List Advanced Help" -cmake -B %{_vpath_builddir} -LAH +# Print all cached CMake options values; "-N" means to run in read-only mode; "-LAH" means "List Advanced Help" for each option +cmake -B %{_vpath_builddir} -N -LAH %cmake_build