@@ -336,16 +336,20 @@ LLVMBuild(v::VersionNumber) = LLVMBuild(v, CompilerABI())
336336getversion (c:: CompilerBuild ) = c. version
337337getabi (c:: CompilerBuild ) = c. abi
338338
339- const available_gcc_builds = [GCCBuild (v " 4.8.5" , CompilerABI (libgfortran_version = v " 3" , libstdcxx_version = v " 3.4.19" , cxxstring_abi = :cxx03 )),
340- GCCBuild (v " 5.2.0" , CompilerABI (libgfortran_version = v " 3" , libstdcxx_version = v " 3.4.21" , cxxstring_abi = :cxx11 )),
341- GCCBuild (v " 6.1.0" , CompilerABI (libgfortran_version = v " 3" , libstdcxx_version = v " 3.4.22" , cxxstring_abi = :cxx11 )),
342- GCCBuild (v " 7.1.0" , CompilerABI (libgfortran_version = v " 4" , libstdcxx_version = v " 3.4.23" , cxxstring_abi = :cxx11 )),
343- GCCBuild (v " 8.1.0" , CompilerABI (libgfortran_version = v " 5" , libstdcxx_version = v " 3.4.25" , cxxstring_abi = :cxx11 )),
344- GCCBuild (v " 9.1.0" , CompilerABI (libgfortran_version = v " 5" , libstdcxx_version = v " 3.4.26" , cxxstring_abi = :cxx11 ))]
345- const available_llvm_builds = [LLVMBuild (v " 6.0.1" ),
346- LLVMBuild (v " 7.1.0" ),
347- LLVMBuild (v " 8.0.1" ),
348- LLVMBuild (v " 9.0.1" )]
339+ const available_gcc_builds = [
340+ GCCBuild (v " 4.8.5" , CompilerABI (libgfortran_version = v " 3" , libstdcxx_version = v " 3.4.19" , cxxstring_abi = :cxx03 )),
341+ GCCBuild (v " 5.2.0" , CompilerABI (libgfortran_version = v " 3" , libstdcxx_version = v " 3.4.21" , cxxstring_abi = :cxx11 )),
342+ GCCBuild (v " 6.1.0" , CompilerABI (libgfortran_version = v " 3" , libstdcxx_version = v " 3.4.22" , cxxstring_abi = :cxx11 )),
343+ GCCBuild (v " 7.1.0" , CompilerABI (libgfortran_version = v " 4" , libstdcxx_version = v " 3.4.23" , cxxstring_abi = :cxx11 )),
344+ GCCBuild (v " 8.1.0" , CompilerABI (libgfortran_version = v " 5" , libstdcxx_version = v " 3.4.25" , cxxstring_abi = :cxx11 )),
345+ GCCBuild (v " 9.1.0" , CompilerABI (libgfortran_version = v " 5" , libstdcxx_version = v " 3.4.26" , cxxstring_abi = :cxx11 )),
346+ ]
347+ const available_llvm_builds = [
348+ LLVMBuild (v " 6.0.1" ),
349+ LLVMBuild (v " 7.1.0" ),
350+ LLVMBuild (v " 8.0.1" ),
351+ LLVMBuild (v " 9.0.1" ),
352+ ]
349353
350354"""
351355 gcc_version(cabi::CompilerABI, GCC_builds::Vector{GCCBuild})
@@ -598,11 +602,13 @@ function expand_cxxstring_abis(ps::Vector{<:Platform})
598602end
599603
600604"""
601- preferred_libgfortran_version(platform::Platform, shard::CompilerShard)
605+ preferred_libgfortran_version(platform::Platform, shard::CompilerShard;
606+ gcc_builds::Vector{GCCBuild} = available_gcc_builds)
602607
603608Return the libgfortran version preferred by the given platform or GCCBootstrap shard.
604609"""
605- function preferred_libgfortran_version (platform:: Platform , shard:: CompilerShard )
610+ function preferred_libgfortran_version (platform:: Platform , shard:: CompilerShard ;
611+ gcc_builds:: Vector{GCCBuild} = available_gcc_builds)
606612 # Some input validation
607613 if shard. name != " GCCBootstrap"
608614 error (" Shard must be `GCCBootstrap`" )
@@ -615,21 +621,24 @@ function preferred_libgfortran_version(platform::Platform, shard::CompilerShard)
615621 # Here we can't use `shard.target` because the shard always has the
616622 # target as ABI-agnostic, thus we have also to ask for the platform.
617623 return compiler_abi (platform). libgfortran_version
618- elseif shard. version < v " 7"
619- return v " 3"
620- elseif v " 7" <= shard. version < v " 8"
621- return v " 4"
622624 else
623- return v " 5"
625+ idx = findfirst (b -> getversion (b) == shard. version, available_gcc_builds)
626+ if isnothing (idx)
627+ error (" The shard doesn't match any version of the avaiable GCC builds" )
628+ else
629+ return getabi (gcc_builds[idx]). libgfortran_version
630+ end
624631 end
625632end
626633
627634"""
628- preferred_cxxstring_abi(platform::Platform, shard::CompilerShard)
635+ preferred_cxxstring_abi(platform::Platform, shard::CompilerShard;
636+ gcc_builds::Vector{GCCBuild} = available_gcc_builds)
629637
630638Return the C++ string ABI preferred by the given platform or GCCBootstrap shard.
631639"""
632- function preferred_cxxstring_abi (platform:: Platform , shard:: CompilerShard )
640+ function preferred_cxxstring_abi (platform:: Platform , shard:: CompilerShard ;
641+ gcc_builds:: Vector{GCCBuild} = available_gcc_builds)
633642 # Some input validation
634643 if shard. name != " GCCBootstrap"
635644 error (" Shard must be `GCCBootstrap`" )
@@ -642,10 +651,13 @@ function preferred_cxxstring_abi(platform::Platform, shard::CompilerShard)
642651 # Here we can't use `shard.target` because the shard always has the
643652 # target as ABI-agnostic, thus we have also to ask for the platform.
644653 return compiler_abi (platform). cxxstring_abi
645- elseif shard. version < v " 5"
646- return :cxx03
647654 else
648- return :cxx11
655+ idx = findfirst (b -> getversion (b) == shard. version, available_gcc_builds)
656+ if isnothing (idx)
657+ error (" The shard doesn't match any version of the avaiable GCC builds" )
658+ else
659+ return getabi (gcc_builds[idx]). cxxstring_abi
660+ end
649661 end
650662end
651663
0 commit comments