pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: http://github.com/python/cpython/commit/e08059edef3be07ada3058d68ad2c9cc13b7418e

tylesheet" href="https://github.githubassets.com/assets/global-d18f184ea1a06a2c.css" /> bpo-42235: [macOS] Use LTO/PGO in build-installer.py with new enough … · python/cpython@e08059e · GitHub
Skip to content

Commit e08059e

Browse files
bpo-42235: [macOS] Use LTO/PGO in build-installer.py with new enough compilers (GH-23079)
With recent enough compilers we can build binaries with LTO/PGO on macOS. This patch enables this when building on macOS 10.15 or later (Xcode 11 or later).
1 parent 8c598db commit e08059e

2 files changed

Lines changed: 12 additions & 0 deletions

File tree

Mac/BuildScript/build-installer.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -436,6 +436,14 @@ def library_recipes():
436436

437437
return result
438438

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

440448
# Instructions for building packages inside the .mpkg.
441449
def pkg_recipes():
@@ -1176,6 +1184,7 @@ def buildPython():
11761184
"%s "
11771185
"%s "
11781186
"%s "
1187+
"%s "
11791188
"LDFLAGS='-g -L%s/libraries/usr/local/lib' "
11801189
"CFLAGS='-g -I%s/libraries/usr/local/include' 2>&1"%(
11811190
shellQuote(os.path.join(SRCDIR, 'configure')),
@@ -1188,6 +1197,7 @@ def buildPython():
11881197
shellQuote(WORKDIR)[1:-1],))[internalTk()],
11891198
(' ', "--with-tcltk-libs='-L%s/libraries/usr/local/lib -ltcl8.6 -ltk8.6'"%(
11901199
shellQuote(WORKDIR)[1:-1],))[internalTk()],
1200+
(' ', "--enable-optimizations --with-lto")[compilerCanOptimize()],
11911201
shellQuote(WORKDIR)[1:-1],
11921202
shellQuote(WORKDIR)[1:-1]))
11931203

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
``Mac/BuildScript/build-installer.py`` will now use "--enable-optimizations"
2+
and ``--with-lto`` when building on macOS 10.15 or later.

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy