Build Python with -O3

https://fedoraproject.org/wiki/Changes/Python_built_with_gcc_O3

Resolves: RHEL-49644
This commit is contained in:
Miro Hrončok 2024-05-06 11:41:41 +02:00 committed by Charalampos Stratakis
parent 8f802af859
commit c26d703083

View File

@ -14,7 +14,7 @@ URL: https://www.python.org/
# WARNING When rebasing to a new Python version, # WARNING When rebasing to a new Python version,
# remember to update the python3-docs package as well # remember to update the python3-docs package as well
Version: %{pybasever}.8 Version: %{pybasever}.8
Release: 64%{?dist} Release: 65%{?dist}
License: Python License: Python
@ -158,6 +158,12 @@ License: Python
%global py_INSTSONAME_optimized libpython%{LDVERSION_optimized}.so.%{py_SOVERSION} %global py_INSTSONAME_optimized libpython%{LDVERSION_optimized}.so.%{py_SOVERSION}
%global py_INSTSONAME_debug libpython%{LDVERSION_debug}.so.%{py_SOVERSION} %global py_INSTSONAME_debug libpython%{LDVERSION_debug}.so.%{py_SOVERSION}
# The -O flag for the compiler, optimized builds
# https://fedoraproject.org/wiki/Changes/Python_built_with_gcc_O3
%global optflags_optimized -O3
# The -O flag for the compiler, debug builds
%global optflags_debug -Og
# Disable automatic bytecompilation. The python3 binary is not yet be # Disable automatic bytecompilation. The python3 binary is not yet be
# available in /usr/bin when Python is built. Also, the bytecompilation fails # available in /usr/bin when Python is built. Also, the bytecompilation fails
# on files that test invalid syntax. # on files that test invalid syntax.
@ -1353,12 +1359,12 @@ BuildPython() {
%if %{with debug_build} %if %{with debug_build}
BuildPython debug \ BuildPython debug \
"--without-ensurepip --with-pydebug" \ "--without-ensurepip --with-pydebug" \
"-Og" "%{optflags_debug}"
%endif # with debug_build %endif # with debug_build
BuildPython optimized \ BuildPython optimized \
"--without-ensurepip %{optimizations_flag}" \ "--without-ensurepip %{optimizations_flag}" \
"" "%{optflags_optimized}"
# ====================================================== # ======================================================
# Installing the built code: # Installing the built code:
@ -1475,14 +1481,14 @@ EOF
%if %{with debug_build} %if %{with debug_build}
InstallPython debug \ InstallPython debug \
%{py_INSTSONAME_debug} \ %{py_INSTSONAME_debug} \
-O0 \ "%{optflags_debug}" \
%{LDVERSION_debug} %{LDVERSION_debug}
%endif # with debug_build %endif # with debug_build
# Now the optimized build: # Now the optimized build:
InstallPython optimized \ InstallPython optimized \
%{py_INSTSONAME_optimized} \ %{py_INSTSONAME_optimized} \
"" \ "%{optflags_optimized}" \
%{LDVERSION_optimized} %{LDVERSION_optimized}
# Install directories for additional packages # Install directories for additional packages
@ -2178,6 +2184,10 @@ fi
# ====================================================== # ======================================================
%changelog %changelog
* Wed Jul 24 2024 Charalampos Stratakis <cstratak@redhat.com> - 3.6.8-65
- Build Python with -O3
- https://fedoraproject.org/wiki/Changes/Python_built_with_gcc_O3
* Thu Jul 18 2024 Miro Hrončok <mhroncok@redhat.com> - 3.6.8-64 * Thu Jul 18 2024 Miro Hrončok <mhroncok@redhat.com> - 3.6.8-64
- Add explicit RPM Provides for /usr/libexec/platform-python - Add explicit RPM Provides for /usr/libexec/platform-python
Resolves: RHEL-48605 Resolves: RHEL-48605