29
29
add_licenses_to_extension_entry ,
30
30
download_entry ,
31
31
get_targets ,
32
+ get_target_settings ,
32
33
target_needs ,
33
34
validate_python_json ,
34
35
write_package_versions ,
@@ -263,6 +264,7 @@ def install_binutils(platform):
263
264
264
265
265
266
def simple_build (
267
+ settings ,
266
268
client ,
267
269
image ,
268
270
entry ,
@@ -275,13 +277,14 @@ def simple_build(
275
277
archive = download_entry (entry , DOWNLOADS_PATH )
276
278
277
279
with build_environment (client , image ) as build_env :
278
- build_env .install_toolchain (
279
- BUILD ,
280
- host_platform ,
281
- binutils = install_binutils (host_platform ),
282
- clang = True ,
283
- musl = "musl" in target_triple ,
284
- )
280
+ if settings .get ("needs_toolchain" ):
281
+ build_env .install_toolchain (
282
+ BUILD ,
283
+ host_platform ,
284
+ binutils = install_binutils (host_platform ),
285
+ clang = True ,
286
+ musl = "musl" in target_triple ,
287
+ )
285
288
286
289
for a in extra_archives or []:
287
290
build_env .install_artifact_archive (BUILD , a , target_triple , optimizations )
@@ -448,18 +451,19 @@ def build_musl(client, image, host_platform):
448
451
449
452
450
453
def build_libedit (
451
- client , image , host_platform , target_triple , optimizations , dest_archive
454
+ settings , client , image , host_platform , target_triple , optimizations , dest_archive
452
455
):
453
456
libedit_archive = download_entry ("libedit" , DOWNLOADS_PATH )
454
457
455
458
with build_environment (client , image ) as build_env :
456
- build_env .install_toolchain (
457
- BUILD ,
458
- host_platform ,
459
- binutils = install_binutils (host_platform ),
460
- clang = True ,
461
- musl = "musl" in target_triple ,
462
- )
459
+ if settings .get ("needs_toolchain" ):
460
+ build_env .install_toolchain (
461
+ BUILD ,
462
+ host_platform ,
463
+ binutils = install_binutils (host_platform ),
464
+ clang = True ,
465
+ musl = "musl" in target_triple ,
466
+ )
463
467
464
468
build_env .install_artifact_archive (
465
469
BUILD , "ncurses" , target_triple , optimizations
@@ -483,18 +487,19 @@ def build_libedit(
483
487
484
488
485
489
def build_readline (
486
- client , image , host_platform , target_triple , optimizations , dest_archive
490
+ settings , client , image , host_platform , target_triple , optimizations , dest_archive
487
491
):
488
492
readline_archive = download_entry ("readline" , DOWNLOADS_PATH )
489
493
490
494
with build_environment (client , image ) as build_env :
491
- build_env .install_toolchain (
492
- BUILD ,
493
- host_platform ,
494
- binutils = True ,
495
- clang = True ,
496
- musl = "musl" in target_triple ,
497
- )
495
+ if settings .get ("needs_toolchain" ):
496
+ build_env .install_toolchain (
497
+ BUILD ,
498
+ host_platform ,
499
+ binutils = True ,
500
+ clang = True ,
501
+ musl = "musl" in target_triple ,
502
+ )
498
503
499
504
build_env .install_artifact_archive (
500
505
BUILD , "ncurses" , target_triple , optimizations
@@ -517,19 +522,22 @@ def build_readline(
517
522
build_env .get_tools_archive (dest_archive , "deps" )
518
523
519
524
520
- def build_tix (client , image , host_platform , target_triple , optimizations , dest_archive ):
525
+ def build_tix (
526
+ settings , client , image , host_platform , target_triple , optimizations , dest_archive
527
+ ):
521
528
tcl_archive = download_entry ("tcl" , DOWNLOADS_PATH )
522
529
tk_archive = download_entry ("tk" , DOWNLOADS_PATH )
523
530
tix_archive = download_entry ("tix" , DOWNLOADS_PATH )
524
531
525
532
with build_environment (client , image ) as build_env :
526
- build_env .install_toolchain (
527
- BUILD ,
528
- host_platform ,
529
- binutils = install_binutils (host_platform ),
530
- clang = True ,
531
- musl = "musl" in target_triple ,
532
- )
533
+ if settings .get ("needs_toolchain" ):
534
+ build_env .install_toolchain (
535
+ BUILD ,
536
+ host_platform ,
537
+ binutils = install_binutils (host_platform ),
538
+ clang = True ,
539
+ musl = "musl" in target_triple ,
540
+ )
533
541
534
542
depends = {"tcl" , "tk" }
535
543
if host_platform != "macos" :
@@ -794,6 +802,7 @@ def get_target_support_file(prefix, python_version, host_platform, target_triple
794
802
795
803
796
804
def build_cpython (
805
+ settings ,
797
806
client ,
798
807
image ,
799
808
host_platform ,
@@ -838,13 +847,14 @@ def build_cpython(
838
847
extra_make_content = setup ["make_data" ]
839
848
840
849
with build_environment (client , image ) as build_env :
841
- build_env .install_toolchain (
842
- BUILD ,
843
- host_platform ,
844
- binutils = install_binutils (host_platform ),
845
- clang = True ,
846
- musl = "musl" in target_triple ,
847
- )
850
+ if settings .get ("needs_toolchain" ):
851
+ build_env .install_toolchain (
852
+ BUILD ,
853
+ host_platform ,
854
+ binutils = install_binutils (host_platform ),
855
+ clang = True ,
856
+ musl = "musl" in target_triple ,
857
+ )
848
858
849
859
packages = target_needs (TARGETS_CONFIG , target_triple )
850
860
# Toolchain packages are handled specially.
@@ -1044,6 +1054,8 @@ def main():
1044
1054
dest_archive = pathlib .Path (args .dest_archive )
1045
1055
docker_image = args .docker_image
1046
1056
1057
+ settings = get_target_settings (TARGETS_CONFIG , target_triple )
1058
+
1047
1059
if args .action == "makefiles" :
1048
1060
log_name = "makefiles"
1049
1061
elif args .action .startswith ("image-" ):
@@ -1088,6 +1100,7 @@ def main():
1088
1100
1089
1101
elif action == "libedit" :
1090
1102
build_libedit (
1103
+ settings ,
1091
1104
client ,
1092
1105
get_image (client , ROOT , BUILD , docker_image ),
1093
1106
host_platform = host_platform ,
@@ -1098,6 +1111,7 @@ def main():
1098
1111
1099
1112
elif action == "readline" :
1100
1113
build_readline (
1114
+ settings ,
1101
1115
client ,
1102
1116
get_image (client , ROOT , BUILD , docker_image ),
1103
1117
host_platform = host_platform ,
@@ -1130,6 +1144,7 @@ def main():
1130
1144
"zlib" ,
1131
1145
):
1132
1146
simple_build (
1147
+ settings ,
1133
1148
client ,
1134
1149
get_image (client , ROOT , BUILD , docker_image ),
1135
1150
action ,
@@ -1141,6 +1156,7 @@ def main():
1141
1156
1142
1157
elif action == "libX11" :
1143
1158
simple_build (
1159
+ settings ,
1144
1160
client ,
1145
1161
get_image (client , ROOT , BUILD , docker_image ),
1146
1162
action ,
@@ -1164,6 +1180,7 @@ def main():
1164
1180
1165
1181
elif action == "libXau" :
1166
1182
simple_build (
1183
+ settings ,
1167
1184
client ,
1168
1185
get_image (client , ROOT , BUILD , docker_image ),
1169
1186
action ,
@@ -1176,6 +1193,7 @@ def main():
1176
1193
1177
1194
elif action == "xcb-proto" :
1178
1195
simple_build (
1196
+ settings ,
1179
1197
client ,
1180
1198
get_image (client , ROOT , BUILD , docker_image ),
1181
1199
action ,
@@ -1187,6 +1205,7 @@ def main():
1187
1205
1188
1206
elif action == "libxcb" :
1189
1207
simple_build (
1208
+ settings ,
1190
1209
client ,
1191
1210
get_image (client , ROOT , BUILD , docker_image ),
1192
1211
action ,
@@ -1199,6 +1218,7 @@ def main():
1199
1218
1200
1219
elif action == "tix" :
1201
1220
build_tix (
1221
+ settings ,
1202
1222
client ,
1203
1223
get_image (client , ROOT , BUILD , docker_image ),
1204
1224
host_platform = host_platform ,
@@ -1219,6 +1239,7 @@ def main():
1219
1239
}
1220
1240
1221
1241
simple_build (
1242
+ settings ,
1222
1243
client ,
1223
1244
get_image (client , ROOT , BUILD , docker_image ),
1224
1245
action ,
@@ -1231,6 +1252,7 @@ def main():
1231
1252
1232
1253
elif action in ("cpython-3.8" , "cpython-3.9" , "cpython-3.10" ):
1233
1254
build_cpython (
1255
+ settings ,
1234
1256
client ,
1235
1257
get_image (client , ROOT , BUILD , docker_image ),
1236
1258
host_platform = host_platform ,
0 commit comments