diff --git a/Project.toml b/Project.toml index 63921a0b..eddbdead 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "BinaryBuilderBase" uuid = "7f725544-6523-48cd-82d1-3fa08ff4056e" authors = ["Elliot Saba "] -version = "1.41.0" +version = "1.42.0" [deps] Bzip2_jll = "6e34b625-4abd-537c-b88f-471c36dfa7a0" diff --git a/src/Rootfs.jl b/src/Rootfs.jl index aa7f00da..35b93f36 100644 --- a/src/Rootfs.jl +++ b/src/Rootfs.jl @@ -831,16 +831,18 @@ function supported_platforms(;exclude::Union{Vector{<:Platform},Function}=Return end """ - expand_gfortran_versions(p::AbstractPlatform) + expand_gfortran_versions(p::AbstractPlatform; old_abis::Bool=false) Given a `Platform`, returns an array of `Platforms` with a spread of identical entries with the exception of the `libgfortran_version` tag within the `Platform`. This is used to take, for example, a list of supported platforms and expand them to include multiple GCC versions for the purposes of ABI matching. If the given `Platform` already specifies a `libgfortran_version` -(as opposed to `nothing`) only that `Platform` is returned. +(as opposed to `nothing`) only that `Platform` is returned. If `old_abis` is +`true`, old ABIs are included in the expanded list, otherwise only the new +ones are included. """ -function expand_gfortran_versions(platform::AbstractPlatform) +function expand_gfortran_versions(platform::AbstractPlatform; old_abis::Bool=false) # If this platform is already explicitly libgfortran-versioned, exit out fast here. if libgfortran_version(platform) !== nothing return [platform] @@ -852,14 +854,13 @@ function expand_gfortran_versions(platform::AbstractPlatform) # If this is an platform that has limited GCC support (such as aarch64-apple-darwin), # the libgfortran versions we can expand to are similarly limited. - local libgfortran_versions - if Sys.isbsd(platform) && arch(platform) == "aarch64" - libgfortran_versions = [v"5"] + libgfortran_versions = if Sys.isbsd(platform) && arch(platform) == "aarch64" + [v"5"] elseif arch(platform) == "riscv64" # We don't have older GCC versions - libgfortran_versions = [v"5"] + [v"5"] else - libgfortran_versions = [v"3", v"4", v"5"] + old_abis ? [v"3", v"4", v"5"] : [v"5"] end # Create a new platform for each libgfortran version @@ -869,12 +870,12 @@ function expand_gfortran_versions(platform::AbstractPlatform) return p end end -function expand_gfortran_versions(ps::Vector{T}) where {T<:AbstractPlatform} - return collect(T,Iterators.flatten(expand_gfortran_versions.(ps))) +function expand_gfortran_versions(ps::Vector{T}; old_abis::Bool=false) where {T<:AbstractPlatform} + return collect(T,Iterators.flatten(expand_gfortran_versions.(ps; old_abis))) end """ - expand_cxxstring_abis(p::AbstractPlatform; skip=Sys.isbsd) + expand_cxxstring_abis(p::AbstractPlatform; skip=Sys.isbsd, old_abis::Bool=false) Given a `Platform`, returns an array of `Platforms` with a spread of identical entries with the exception of the `cxxstring_abi` tag within the `Platform` @@ -886,8 +887,12 @@ If the given `Platform` already specifies a `cxxstring_abi` (as opposed to `skip(platform)` evaluates to `true`, the given platform is not expanded. By default FreeBSD and macOS platforms are skipped, due to their lack of a dependence on `libstdc++` and not needing this compatibility shim. + +If `old_abis` is `true`, old ABIs are included in the expanded list, otherwise +only the new ones are included. + """ -function expand_cxxstring_abis(platform::AbstractPlatform; skip=Sys.isbsd) +function expand_cxxstring_abis(platform::AbstractPlatform; skip=Sys.isbsd, old_abis::Bool=false) # If this platform cannot/should not be expanded, then exit out fast here. if cxxstring_abi(platform) !== nothing || skip(platform) return [platform] @@ -899,8 +904,9 @@ function expand_cxxstring_abis(platform::AbstractPlatform; skip=Sys.isbsd) return [p] end - # Otherwise, generate new versions! - map(["cxx03", "cxx11"]) do abi + # Otherwise, generate new versions! At the moment we only support the C++11 string ABI. + abis = old_abis ? ["cxx03", "cxx11"] : ["cxx11"] + map(abis) do abi p = deepcopy(platform) p["cxxstring_abi"] = abi return p diff --git a/test/rootfs.jl b/test/rootfs.jl index 9081d1d0..73241d8c 100644 --- a/test/rootfs.jl +++ b/test/rootfs.jl @@ -6,11 +6,18 @@ using BinaryBuilderBase: RustBuild, CompilerShard @testset "Expand platforms" begin # expand_gfortran_versions @test expand_gfortran_versions(Platform("i686", "windows")) == [ + Platform("i686", "windows"; libgfortran_version=v"5"), + ] + @test expand_gfortran_versions(Platform("i686", "windows"); old_abis=true) == [ Platform("i686", "windows"; libgfortran_version=v"3"), Platform("i686", "windows"; libgfortran_version=v"4"), Platform("i686", "windows"; libgfortran_version=v"5"), ] @test expand_gfortran_versions([Platform("i686", "windows"), Platform("x86_64", "windows")]) == [ + Platform("i686", "windows"; libgfortran_version=v"5"), + Platform("x86_64", "windows"; libgfortran_version=v"5"), + ] + @test expand_gfortran_versions([Platform("i686", "windows"), Platform("x86_64", "windows")]; old_abis=true) == [ Platform("i686", "windows"; libgfortran_version=v"3"), Platform("i686", "windows"; libgfortran_version=v"4"), Platform("i686", "windows"; libgfortran_version=v"5"), @@ -21,6 +28,10 @@ using BinaryBuilderBase: RustBuild, CompilerShard @test expand_gfortran_versions([Platform("x86_64", "freebsd"; libgfortran_version=v"3")]) == [Platform("x86_64", "freebsd"; libgfortran_version=v"3")] @test expand_gfortran_versions([Platform("x86_64", "macos"), Platform("aarch64", "macos")]) == [ + Platform("x86_64", "macos"; libgfortran_version=v"5"), + Platform("aarch64", "macos"; libgfortran_version=v"5"), + ] + @test expand_gfortran_versions([Platform("x86_64", "macos"), Platform("aarch64", "macos")]; old_abis=true) == [ Platform("x86_64", "macos"; libgfortran_version=v"3"), Platform("x86_64", "macos"; libgfortran_version=v"4"), Platform("x86_64", "macos"; libgfortran_version=v"5"), @@ -34,6 +45,9 @@ using BinaryBuilderBase: RustBuild, CompilerShard # expand_cxxstring_abis @test expand_cxxstring_abis(Platform("x86_64", "linux"; libc="musl")) == [ + Platform("x86_64", "linux", libc="musl", cxxstring_abi="cxx11"), + ] + @test expand_cxxstring_abis(Platform("x86_64", "linux"; libc="musl"); old_abis=true) == [ Platform("x86_64", "linux", libc="musl", cxxstring_abi="cxx03"), Platform("x86_64", "linux", libc="musl", cxxstring_abi="cxx11"), ] @@ -42,12 +56,20 @@ using BinaryBuilderBase: RustBuild, CompilerShard Platform("x86_64", "macos"), ] @test expand_cxxstring_abis([Platform("x86_64", "freebsd"), Platform("x86_64", "macos")]; skip=_->false) == [ + Platform("x86_64", "freebsd"; cxxstring_abi="cxx11"), + Platform("x86_64", "macos"; cxxstring_abi="cxx11"), + ] + @test expand_cxxstring_abis([Platform("x86_64", "freebsd"), Platform("x86_64", "macos")]; skip=_->false, old_abis=true) == [ Platform("x86_64", "freebsd"; cxxstring_abi="cxx03"), Platform("x86_64", "freebsd"; cxxstring_abi="cxx11"), Platform("x86_64", "macos"; cxxstring_abi="cxx03"), Platform("x86_64", "macos"; cxxstring_abi="cxx11"), ] @test expand_cxxstring_abis([Platform("x86_64", "freebsd"), Platform("x86_64", "linux")]; skip=Sys.islinux) == [ + Platform("x86_64", "freebsd"; cxxstring_abi="cxx11"), + Platform("x86_64", "linux"), + ] + @test expand_cxxstring_abis([Platform("x86_64", "freebsd"), Platform("x86_64", "linux")]; skip=Sys.islinux, old_abis=true) == [ Platform("x86_64", "freebsd"; cxxstring_abi="cxx03"), Platform("x86_64", "freebsd"; cxxstring_abi="cxx11"), Platform("x86_64", "linux"),