@@ -1098,7 +1098,12 @@ def run_msbuild(
1098
1098
1099
1099
1100
1100
def build_openssl_for_arch (
1101
- perl_path , arch : str , openssl_archive , nasm_archive , build_root : pathlib .Path
1101
+ perl_path ,
1102
+ arch : str ,
1103
+ openssl_archive ,
1104
+ nasm_archive ,
1105
+ build_root : pathlib .Path ,
1106
+ profile : str ,
1102
1107
):
1103
1108
openssl_version = DOWNLOADS ["openssl" ]["version" ]
1104
1109
nasm_version = DOWNLOADS ["nasm-windows-bin" ]["version" ]
@@ -1116,6 +1121,16 @@ def build_openssl_for_arch(
1116
1121
1117
1122
source_root = build_root / ("openssl-%s" % openssl_version )
1118
1123
1124
+ # uplink.c tries to find the OPENSSL_Applink function exported from the current
1125
+ # executable. However, it is exported from _ssl[_d].pyd in shared builds. So
1126
+ # update its sounce to look for it from there.
1127
+ if "shared" in profile :
1128
+ static_replace_in_file (
1129
+ source_root / "ms" / "uplink.c" ,
1130
+ b"((h = GetModuleHandle(NULL)) == NULL)" ,
1131
+ b'((h = GetModuleHandleA("_ssl.pyd")) == NULL) if ((h = GetModuleHandleA("_ssl_d.pyd")) == NULL) if ((h = GetModuleHandle(NULL)) == NULL)' ,
1132
+ )
1133
+
1119
1134
if arch == "x86" :
1120
1135
configure = "VC-WIN32"
1121
1136
prefix = "32"
@@ -1164,7 +1179,7 @@ def build_openssl_for_arch(
1164
1179
shutil .copyfile (source , dest )
1165
1180
1166
1181
1167
- def build_openssl (perl_path : pathlib .Path , arch : str ):
1182
+ def build_openssl (perl_path : pathlib .Path , arch : str , profile : str ):
1168
1183
"""Build OpenSSL from sources using the Perl executable specified."""
1169
1184
1170
1185
# First ensure the dependencies are in place.
@@ -1180,12 +1195,12 @@ def build_openssl(perl_path: pathlib.Path, arch: str):
1180
1195
if arch == "x86" :
1181
1196
root_32 .mkdir ()
1182
1197
build_openssl_for_arch (
1183
- perl_path , "x86" , openssl_archive , nasm_archive , root_32
1198
+ perl_path , "x86" , openssl_archive , nasm_archive , root_32 , profile
1184
1199
)
1185
1200
elif arch == "amd64" :
1186
1201
root_64 .mkdir ()
1187
1202
build_openssl_for_arch (
1188
- perl_path , "amd64" , openssl_archive , nasm_archive , root_64
1203
+ perl_path , "amd64" , openssl_archive , nasm_archive , root_64 , profile
1189
1204
)
1190
1205
else :
1191
1206
raise ValueError ("unhandled arch: %s" % arch )
@@ -1197,7 +1212,7 @@ def build_openssl(perl_path: pathlib.Path, arch: str):
1197
1212
else :
1198
1213
shutil .copytree (root_64 / "install" / "64" , install / "openssl" / "amd64" )
1199
1214
1200
- dest_archive = BUILD / ("openssl-windows-%s.tar" % arch )
1215
+ dest_archive = BUILD / ("openssl-windows-%s-%s .tar" % ( arch , profile ) )
1201
1216
with dest_archive .open ("wb" ) as fh :
1202
1217
create_tar_from_directory (fh , install )
1203
1218
@@ -1596,9 +1611,7 @@ def build_cpython(arch: str, profile):
1596
1611
for test in sorted (tests ):
1597
1612
# test_regrtest hangs for some reason. It is the test for the
1598
1613
# test harness itself and isn't exercising useful code. Skip it.
1599
- #
1600
- # test_ssl also seems to hang.
1601
- if test in ("test_regrtest" , "test_ssl" ):
1614
+ if test == "test_regrtest" :
1602
1615
continue
1603
1616
1604
1617
exec_and_log (
@@ -1804,11 +1817,11 @@ def main():
1804
1817
arch = "x86" if os .environ .get ("Platform" ) == "x86" else "amd64"
1805
1818
1806
1819
# TODO need better dependency checking.
1807
- openssl_out = BUILD / ("openssl-windows-%s.tar" % arch )
1820
+ openssl_out = BUILD / ("openssl-windows-%s-%s .tar" % ( arch , args . profile ) )
1808
1821
if not openssl_out .exists ():
1809
1822
perl_path = fetch_strawberry_perl () / "perl" / "bin" / "perl.exe"
1810
1823
LOG_PREFIX [0 ] = "openssl"
1811
- build_openssl (perl_path , arch )
1824
+ build_openssl (perl_path , arch , profile = args . profile )
1812
1825
1813
1826
LOG_PREFIX [0 ] = "cpython"
1814
1827
tar_path = build_cpython (arch , profile = args .profile )
0 commit comments