@@ -486,7 +486,6 @@ def python_build_info(
486
486
version ,
487
487
platform ,
488
488
target_triple ,
489
- musl ,
490
489
lto ,
491
490
extensions ,
492
491
extra_metadata ,
@@ -506,7 +505,7 @@ def python_build_info(
506
505
)
507
506
)
508
507
509
- if not musl :
508
+ if not target_triple . endswith ( "-static" ) :
510
509
bi ["core" ]["shared_lib" ] = "install/lib/libpython%s%s.so.1.0" % (
511
510
version ,
512
511
binary_suffix ,
@@ -825,6 +824,8 @@ def build_cpython(
825
824
env ["CPYTHON_OPTIMIZED" ] = "1"
826
825
if "lto" in parsed_build_options :
827
826
env ["CPYTHON_LTO" ] = "1"
827
+ if target_triple .endswith ("-static" ):
828
+ env ["CPYTHON_STATIC" ] = "1"
828
829
829
830
add_target_env (env , host_platform , target_triple , build_env )
830
831
@@ -834,19 +835,26 @@ def build_cpython(
834
835
crt_features = []
835
836
836
837
if host_platform == "linux64" :
837
- if "musl" in target_triple :
838
+ if target_triple . endswith ( "-static" ) :
838
839
crt_features .append ("static" )
839
840
else :
840
841
extension_module_loading .append ("shared-library" )
841
- crt_features .append ("glibc-dynamic" )
842
842
843
- glibc_max_version = build_env . get_file ( "glibc_version.txt" ). strip ()
844
- if not glibc_max_version :
845
- raise Exception ( "failed to retrieve glibc max symbol version" )
843
+ if "musl" in target_triple :
844
+ crt_features . append ( "musl-dynamic" )
845
+ # TODO: Determine the dynamic musl libc version
846
846
847
- crt_features .append (
848
- "glibc-max-symbol-version:%s" % glibc_max_version .decode ("ascii" )
849
- )
847
+ else :
848
+ crt_features .append ("glibc-dynamic" )
849
+
850
+ glibc_max_version = build_env .get_file ("glibc_version.txt" ).strip ()
851
+ if not glibc_max_version :
852
+ raise Exception ("failed to retrieve glibc max symbol version" )
853
+
854
+ crt_features .append (
855
+ "glibc-max-symbol-version:%s"
856
+ % glibc_max_version .decode ("ascii" )
857
+ )
850
858
851
859
python_symbol_visibility = "global-default"
852
860
@@ -874,7 +882,9 @@ def build_cpython(
874
882
"python_stdlib_test_packages" : sorted (STDLIB_TEST_PACKAGES ),
875
883
"python_symbol_visibility" : python_symbol_visibility ,
876
884
"python_extension_module_loading" : extension_module_loading ,
877
- "libpython_link_mode" : "static" if "musl" in target_triple else "shared" ,
885
+ "libpython_link_mode" : (
886
+ "static" if target_triple .endswith ("-static" ) else "shared"
887
+ ),
878
888
"crt_features" : crt_features ,
879
889
"run_tests" : "build/run_tests.py" ,
880
890
"build_info" : python_build_info (
@@ -946,6 +956,7 @@ def main():
946
956
print ("unable to connect to Docker: %s" % e , file = sys .stderr )
947
957
return 1
948
958
959
+ # Note these arguments must be synced with `build-main.py`
949
960
parser = argparse .ArgumentParser ()
950
961
parser .add_argument (
951
962
"--host-platform" , required = True , help = "Platform we are building from"
@@ -962,6 +973,7 @@ def main():
962
973
default = "noopt" ,
963
974
help = "Build options to apply when compiling Python" ,
964
975
)
976
+
965
977
parser .add_argument (
966
978
"--toolchain" ,
967
979
action = "store_true" ,
0 commit comments