X Tutup
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions Mac/BuildScript/build-installer.py
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,14 @@ def library_recipes():

return result

def compilerCanOptimize():
"""
Return True iff the default Xcode version can use PGO and LTO
"""
# bpo-42235: The version check is pretty conservative, can be
# adjusted after testing
mac_ver = tuple(map(int, platform.mac_ver()[0].split('.')))
return mac_ver >= (10, 15)

# Instructions for building packages inside the .mpkg.
def pkg_recipes():
Expand Down Expand Up @@ -1128,6 +1136,7 @@ def buildPython():
"%s "
"%s "
"%s "
"%s "
"LDFLAGS='-g -L%s/libraries/usr/local/lib' "
"CFLAGS='-g -I%s/libraries/usr/local/include' 2>&1"%(
shellQuote(os.path.join(SRCDIR, 'configure')),
Expand All @@ -1140,6 +1149,7 @@ def buildPython():
shellQuote(WORKDIR)[1:-1],))[internalTk()],
(' ', "--with-tcltk-libs='-L%s/libraries/usr/local/lib -ltcl8.6 -ltk8.6'"%(
shellQuote(WORKDIR)[1:-1],))[internalTk()],
(' ', "--enable-optimizations --with-lto")[compilerCanOptimize()],
shellQuote(WORKDIR)[1:-1],
shellQuote(WORKDIR)[1:-1]))

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
``Mac/BuildScript/build-installer.py`` will now use "--enable-optimizations"
and ``--with-lto`` when building on macOS 10.15 or later.
X Tutup