15
15
import sys
16
16
import tempfile
17
17
import zipfile
18
+ import multiprocessing
18
19
19
20
from pythonbuild .downloads import DOWNLOADS
20
21
from pythonbuild .cpython import parse_config_c , STDLIB_TEST_PACKAGES
21
22
from pythonbuild .utils import (
22
23
create_tar_from_directory ,
23
24
download_entry ,
24
25
extract_tar_to_directory ,
26
+ extract_zip_to_directory ,
25
27
compress_python_archive ,
26
28
)
27
29
@@ -1093,20 +1095,26 @@ def build_openssl_for_arch(
1093
1095
nasm_archive ,
1094
1096
build_root : pathlib .Path ,
1095
1097
profile : str ,
1098
+ * ,
1099
+ jom_archive ,
1096
1100
):
1097
1101
openssl_version = DOWNLOADS ["openssl" ]["version" ]
1098
1102
nasm_version = DOWNLOADS ["nasm-windows-bin" ]["version" ]
1099
-
1103
+ jom_version = DOWNLOADS ["jom-windows-bin" ]["version" ]
1104
+
1100
1105
log ("extracting %s to %s" % (openssl_archive , build_root ))
1101
1106
extract_tar_to_directory (openssl_archive , build_root )
1102
1107
log ("extracting %s to %s" % (nasm_archive , build_root ))
1103
1108
extract_tar_to_directory (nasm_archive , build_root )
1109
+ log ("extracting %s to %s" % (jom_archive , build_root ))
1110
+ extract_zip_to_directory (jom_archive , build_root / "jom" )
1104
1111
1105
1112
nasm_path = build_root / ("cpython-bin-deps-nasm-%s" % nasm_version )
1106
-
1113
+ jom_path = build_root / "jom"
1114
+
1107
1115
env = dict (os .environ )
1108
1116
# Add Perl and nasm paths to front of PATH.
1109
- env ["PATH" ] = "%s;%s;%s" % (perl_path .parent , nasm_path , env ["PATH" ])
1117
+ env ["PATH" ] = "%s;%s;%s;%s " % (perl_path .parent , nasm_path , jom_path , env ["PATH" ])
1110
1118
1111
1119
source_root = build_root / ("openssl-%s" % openssl_version )
1112
1120
@@ -1150,10 +1158,14 @@ def build_openssl_for_arch(
1150
1158
"--prefix=/%s" % prefix ,
1151
1159
],
1152
1160
source_root ,
1153
- env ,
1161
+ {
1162
+ ** env ,
1163
+ 'CFLAGS' : env .get ('CFLAGS' , '' ) + ' /FS' ,
1164
+ },
1154
1165
)
1155
1166
1156
- exec_and_log (["nmake" ], source_root , env )
1167
+ #exec_and_log(["nmake"], source_root, env)
1168
+ exec_and_log ([str (jom_path / "jom" ), "/J" , str (multiprocessing .cpu_count ())], source_root , env )
1157
1169
1158
1170
# We don't care about accessory files, docs, etc. So just run `install_sw`
1159
1171
# target to get the main files.
@@ -1174,6 +1186,7 @@ def build_openssl(perl_path: pathlib.Path, arch: str, profile: str):
1174
1186
# First ensure the dependencies are in place.
1175
1187
openssl_archive = download_entry ("openssl" , BUILD )
1176
1188
nasm_archive = download_entry ("nasm-windows-bin" , BUILD )
1189
+ jom_archive = download_entry ("jom-windows-bin" , BUILD )
1177
1190
1178
1191
with tempfile .TemporaryDirectory (prefix = "openssl-build-" ) as td :
1179
1192
td = pathlib .Path (td )
@@ -1184,12 +1197,12 @@ def build_openssl(perl_path: pathlib.Path, arch: str, profile: str):
1184
1197
if arch == "x86" :
1185
1198
root_32 .mkdir ()
1186
1199
build_openssl_for_arch (
1187
- perl_path , "x86" , openssl_archive , nasm_archive , root_32 , profile
1200
+ perl_path , "x86" , openssl_archive , nasm_archive , root_32 , profile , jom_archive = jom_archive ,
1188
1201
)
1189
1202
elif arch == "amd64" :
1190
1203
root_64 .mkdir ()
1191
1204
build_openssl_for_arch (
1192
- perl_path , "amd64" , openssl_archive , nasm_archive , root_64 , profile
1205
+ perl_path , "amd64" , openssl_archive , nasm_archive , root_64 , profile , jom_archive = jom_archive ,
1193
1206
)
1194
1207
else :
1195
1208
raise ValueError ("unhandled arch: %s" % arch )
0 commit comments