@@ -39,8 +39,8 @@ struct CompilerShard
39
39
# by higher-level things to choose e.g. which version of GCC
40
40
# to use, but once we're at this level we only care about the
41
41
# larger-scale things, not the ABI).
42
- host = abi_agnostic (host)
43
- if target != nothing
42
+ host = abi_agnostic (host:: AbstractPlatform )
43
+ if target != = nothing
44
44
target = abi_agnostic (target)
45
45
end
46
46
@@ -64,8 +64,8 @@ Return the bound artifact name for a particular shard.
64
64
"""
65
65
function artifact_name (cs:: CompilerShard )
66
66
target_str = " "
67
- if cs. target != nothing
68
- target_str = " -$(triplet (cs. target)) "
67
+ if cs. target != = nothing
68
+ target_str = " -$(triplet (cs. target:: Platform )) "
69
69
70
70
if cs. name in (" GCCBootstrap" , " PlatformSupport" )
71
71
# armv6l uses the same GCC shards as armv7l, so we just rename here.
@@ -84,15 +84,15 @@ function CompilerShard(art_name::String)
84
84
end
85
85
return CompilerShard (
86
86
m. captures[1 ],
87
- VersionNumber (m. captures[3 ]),
87
+ VersionNumber (m. captures[3 ]:: AbstractString ),
88
88
m. captures[4 ],
89
89
Symbol (m. captures[5 ]);
90
90
target= m. captures[2 ]
91
91
)
92
92
end
93
93
94
94
const ALL_SHARDS = Ref {Union{Vector{CompilerShard},Nothing}} (nothing )
95
- function all_compiler_shards ()
95
+ function all_compiler_shards ():: Vector{CompilerShard}
96
96
if ALL_SHARDS[] === nothing
97
97
artifacts_toml = joinpath (dirname (@__DIR__ ), " Artifacts.toml" )
98
98
artifact_dict = load_artifacts_toml (artifacts_toml)
@@ -114,13 +114,13 @@ function all_compiler_shards()
114
114
end
115
115
116
116
# If this compiler shard has an os_version, that should be interpreted as the bound it is.
117
- if cs. target != = nothing && os_version (cs. target) != = nothing
118
- set_compare_strategy! (cs. target, " os_version" , compare_version_cap)
117
+ if cs. target != = nothing && os_version (cs. target:: Platform ) != = nothing
118
+ set_compare_strategy! (cs. target:: Platform , " os_version" , compare_version_cap)
119
119
end
120
- push! (ALL_SHARDS[], cs)
120
+ push! (ALL_SHARDS[]:: Vector{CompilerShard} , cs)
121
121
end
122
122
end
123
- return ALL_SHARDS[]
123
+ return ALL_SHARDS[]:: Vector{CompilerShard}
124
124
end
125
125
126
126
function shard_source_artifact_hash (cs:: CompilerShard )
@@ -168,7 +168,7 @@ function map_target(cs::CompilerShard)
168
168
return " /"
169
169
elseif lowercase (cs. name) == " rusttoolchain"
170
170
# We override RustToolchain because they all have to sit in the same location
171
- return " /opt/$(aatriplet (cs. host)) /$(cs. name) -$(cs. version) -$(aatriplet (cs. target)) )"
171
+ return " /opt/$(aatriplet (cs. host)) /$(cs. name) -$(cs. version) -$(aatriplet (cs. target:: Platform )) )"
172
172
else
173
173
return joinpath (" /opt" , aatriplet (something (cs. target, cs. host)), " $(cs. name) -$(cs. version) " )
174
174
end
@@ -231,7 +231,7 @@ function mount(cs::CompilerShard, build_prefix::AbstractString; verbose::Bool =
231
231
# they must accept the Xcode EULA. This will be skipped if either the
232
232
# environment variable BINARYBUILDER_AUTOMATIC_APPLE has been set to `true`
233
233
# or if the SDK has been downloaded in the past.
234
- if cs. target != = nothing && Sys. isapple (cs. target) && ! isfile (enable_apple_file ()) && ! macos_sdk_already_installed ()
234
+ if cs. target != = nothing && Sys. isapple (cs. target:: Platform ) && ! isfile (enable_apple_file ()) && ! macos_sdk_already_installed ()
235
235
if ! isinteractive ()
236
236
msg = strip ("""
237
237
This is not an interactive Julia session, so we will not prompt you
@@ -343,7 +343,7 @@ Returns `true` if any piece of the MacOS SDK is already installed.
343
343
function macos_sdk_already_installed ()
344
344
# Get all compiler shards we know about
345
345
css = all_compiler_shards ()
346
- macos_artifact_names = artifact_name .(filter (cs -> cs. target != = nothing && Sys. isapple (cs. target), css))
346
+ macos_artifact_names = artifact_name .(filter (cs -> cs. target != = nothing && Sys. isapple (cs. target:: Platform ), css))
347
347
348
348
artifacts_toml = joinpath (dirname (@__DIR__ ), " Artifacts.toml" )
349
349
macos_artifact_hashes = artifact_hash .(macos_artifact_names, artifacts_toml; platform= default_host_platform)
481
481
482
482
function llvm_version (p:: AbstractPlatform , LLVM_builds:: Vector{LLVMBuild} )
483
483
if march (p) in (" armv8_2_crypto" , " armv8_4_crypto_sve" )
484
- LLVM_builds = filter (b -> getversion (b) >= v " 9.0" )
484
+ LLVM_builds = filter (b -> getversion (b) >= v " 9.0" , LLVM_builds )
485
485
end
486
486
return getversion .(LLVM_builds)
487
487
end
@@ -527,7 +527,7 @@ function choose_shards(p::AbstractPlatform;
527
527
LLVM_builds:: Vector{LLVMBuild} = available_llvm_builds,
528
528
Rust_build:: VersionNumber = v " 1.57.0" ,
529
529
Go_build:: VersionNumber = v " 1.16.3" ,
530
- archive_type:: Symbol = (use_squashfs ? :squashfs : :unpacked ),
530
+ archive_type:: Symbol = (use_squashfs[] ? :squashfs : :unpacked ),
531
531
bootstrap_list:: Vector{Symbol} = bootstrap_list,
532
532
# Because GCC has lots of compatibility issues, we always default to
533
533
# the earliest version possible.
@@ -714,7 +714,7 @@ matching. If the given `Platform` already specifies a `libgfortran_version`
714
714
"""
715
715
function expand_gfortran_versions (platform:: AbstractPlatform )
716
716
# If this platform is already explicitly libgfortran-versioned, exit out fast here.
717
- if libgfortran_version (platform) != nothing
717
+ if libgfortran_version (platform) != = nothing
718
718
return [platform]
719
719
end
720
720
@@ -857,11 +857,11 @@ function preferred_libgfortran_version(platform::AbstractPlatform, shard::Compil
857
857
if shard. name != " GCCBootstrap"
858
858
error (" Shard must be `GCCBootstrap`" )
859
859
end
860
- if arch (shard. target) != arch (platform) || libc (shard. target) != libc (platform)
860
+ if arch (shard. target:: Platform ) != arch (platform) || libc (shard. target:: Platform ) != libc (platform)
861
861
error (" Incompatible platform and shard target" )
862
862
end
863
863
864
- if libgfortran_version (platform) != nothing
864
+ if libgfortran_version (platform) != = nothing
865
865
# Here we can't use `shard.target` because the shard always has the
866
866
# target as ABI-agnostic, thus we have also to ask for the platform.
867
867
return libgfortran_version (platform)
@@ -887,11 +887,11 @@ function preferred_cxxstring_abi(platform::AbstractPlatform, shard::CompilerShar
887
887
if shard. name != " GCCBootstrap"
888
888
error (" Shard must be `GCCBootstrap`" )
889
889
end
890
- if arch (shard. target) != arch (platform) || libc (shard. target) != libc (platform)
890
+ if arch (shard. target:: Platform ) != arch (platform) || libc (shard. target:: Platform ) != libc (platform)
891
891
error (" Incompatible platform and shard target" )
892
892
end
893
893
894
- if cxxstring_abi (platform) != nothing
894
+ if cxxstring_abi (platform) != = nothing
895
895
# Here we can't use `shard.target` because the shard always has the
896
896
# target as ABI-agnostic, thus we have also to ask for the platform.
897
897
return cxxstring_abi (platform)
@@ -922,26 +922,26 @@ function download_all_artifacts(; verbose::Bool = false)
922
922
)
923
923
end
924
924
925
- _sudo_cmd = nothing
926
- function sudo_cmd ()
925
+ const _sudo_cmd = Ref {Union{Cmd,Nothing}} ( nothing )
926
+ function sudo_cmd ():: Cmd
927
927
global _sudo_cmd
928
928
929
929
# Use cached value if we've already run this
930
- if _sudo_cmd ! = nothing
931
- return _sudo_cmd
930
+ if _sudo_cmd[] != = nothing
931
+ return _sudo_cmd[] :: Cmd
932
932
end
933
933
934
- if getuid () == 0
934
+ _sudo_cmd[] = if getuid () == 0
935
935
# If we're already root, don't use any kind of sudo program
936
- _sudo_cmd = ` `
936
+ ` `
937
937
elseif success (` sudo -V` )
938
938
# If `sudo` is available, use that
939
- _sudo_cmd = ` sudo`
939
+ ` sudo`
940
940
else
941
941
# Fall back to `su` if all else fails
942
- _sudo_cmd = ` su root -c`
942
+ ` su root -c`
943
943
end
944
- return _sudo_cmd
944
+ return _sudo_cmd[] :: Cmd
945
945
end
946
946
947
947
"""
0 commit comments