Properly propagate the optimization flags to C extensions
Resolves: RHEL-49636
This commit is contained in:
		
							parent
							
								
									689e205f07
								
							
						
					
					
						commit
						1966c4e87a
					
				| @ -20,7 +20,7 @@ URL: https://www.python.org/ | ||||
| #global prerel ... | ||||
| %global upstream_version %{general_version}%{?prerel} | ||||
| Version: %{general_version}%{?prerel:~%{prerel}} | ||||
| Release: 4%{?dist} | ||||
| Release: 5%{?dist} | ||||
| License: Python | ||||
| 
 | ||||
| 
 | ||||
| @ -151,8 +151,6 @@ License: Python | ||||
| # The -O flag for the compiler, debug builds | ||||
| # -Wno-cpp avoids some warnings with -O0 | ||||
| %global optflags_debug -O0 -Wno-cpp | ||||
| # Remove the default -O2 flag, our flags are applied in %%build/%%install | ||||
| %global __global_compiler_flags %(echo '%{__global_compiler_flags}' | sed 's/-O[[:digit:]]//') | ||||
| 
 | ||||
| # Disable automatic bytecompilation. The python3 binary is not yet be | ||||
| # available in /usr/bin when Python is built. Also, the bytecompilation fails | ||||
| @ -819,6 +817,7 @@ BuildPython() { | ||||
|   ConfName=$1 | ||||
|   ExtraConfigArgs=$2 | ||||
|   MoreCFlags=$3 | ||||
|   MoreCFlagsNodist=$4 | ||||
| 
 | ||||
|   # Each build is done in its own directory | ||||
|   ConfDir=build/$ConfName | ||||
| @ -858,7 +857,7 @@ BuildPython() { | ||||
|   $ExtraConfigArgs \ | ||||
|   %{nil} | ||||
| 
 | ||||
| %global flags_override EXTRA_CFLAGS="$MoreCFlags" CFLAGS_NODIST="$CFLAGS_NODIST $MoreCFlags" | ||||
| %global flags_override EXTRA_CFLAGS="$MoreCFlags" CFLAGS_NODIST="$CFLAGS_NODIST $MoreCFlags $MoreCFlagsNodist" | ||||
| 
 | ||||
| %if %{without bootstrap} | ||||
|   # Regenerate generated files (needs python3) | ||||
| @ -881,11 +880,13 @@ BuildPython() { | ||||
| # See also: https://bugzilla.redhat.com/show_bug.cgi?id=1818857 | ||||
| BuildPython debug \ | ||||
|   "--without-ensurepip --with-pydebug" \ | ||||
|   "%{optflags_debug}" | ||||
|   "%{optflags_debug}" \ | ||||
|   "" | ||||
| %endif # with debug_build | ||||
| 
 | ||||
| BuildPython optimized \ | ||||
|   "--without-ensurepip %{optimizations_flag}" \ | ||||
|   "" \ | ||||
|   "%{optflags_optimized}" | ||||
| 
 | ||||
| # ====================================================== | ||||
| @ -992,7 +993,7 @@ InstallPython debug \ | ||||
| # Now the optimized build: | ||||
| InstallPython optimized \ | ||||
|   %{py_INSTSONAME_optimized} \ | ||||
|   "%{optflags_optimized}" \ | ||||
|   "" \ | ||||
|   %{LDVERSION_optimized} | ||||
| 
 | ||||
| # Install directories for additional packages | ||||
| @ -1860,6 +1861,9 @@ fi | ||||
| # ====================================================== | ||||
| 
 | ||||
| %changelog | ||||
| * Thu Jul 25 2024 Charalampos Stratakis <cstratak@redhat.com> - 3.11.9-5 | ||||
| - Properly propagate the optimization flags to C extensions | ||||
| 
 | ||||
| * Thu Jul 18 2024 Charalampos Stratakis <cstratak@redhat.com> - 3.11.9-4 | ||||
| - Build Python with -O3 | ||||
| - https://fedoraproject.org/wiki/Changes/Python_built_with_gcc_O3 | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user