diff --git a/mariadb10.11.spec b/mariadb10.11.spec index 0afb9f4..3a0a776 100644 --- a/mariadb10.11.spec +++ b/mariadb10.11.spec @@ -918,6 +918,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 \ @@ -991,35 +1012,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" - -# Fixes for Fedora 32 & Rawhide (GCC 10.0): -%if 0%{?fedora} >= 32 -CFLAGS="$CFLAGS -Wno-error=class-memaccess" -CFLAGS="$CFLAGS -Wno-error=enum-conversion" -# endif f32 -%endif -# endif debug -%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