@@ -436,6 +436,14 @@ def library_recipes(): |
|
|
436 |
436 |
|
437 |
437 |
return result |
438 |
438 |
|
|
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) |
439 |
447 |
|
440 |
448 |
# Instructions for building packages inside the .mpkg. |
441 |
449 |
def pkg_recipes(): |
@@ -1176,6 +1184,7 @@ def buildPython(): |
|
|
1176 |
1184 |
"%s " |
1177 |
1185 |
"%s " |
1178 |
1186 |
"%s " |
|
1187 |
+"%s " |
1179 |
1188 |
"LDFLAGS='-g -L%s/libraries/usr/local/lib' " |
1180 |
1189 |
"CFLAGS='-g -I%s/libraries/usr/local/include' 2>&1"%( |
1181 |
1190 |
shellQuote(os.path.join(SRCDIR, 'configure')), |
@@ -1188,6 +1197,7 @@ def buildPython(): |
|
|
1188 |
1197 |
shellQuote(WORKDIR)[1:-1],))[internalTk()], |
1189 |
1198 |
(' ', "--with-tcltk-libs='-L%s/libraries/usr/local/lib -ltcl8.6 -ltk8.6'"%( |
1190 |
1199 |
shellQuote(WORKDIR)[1:-1],))[internalTk()], |
|
1200 |
+ (' ', "--enable-optimizations --with-lto")[compilerCanOptimize()], |
1191 |
1201 |
shellQuote(WORKDIR)[1:-1], |
1192 |
1202 |
shellQuote(WORKDIR)[1:-1])) |
1193 |
1203 |
|