Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a standalone LibStdCxx jll #5331

Merged
merged 3 commits into from
Aug 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
272 changes: 1 addition & 271 deletions 0_RootFS/gcc_common.jl
Original file line number Diff line number Diff line change
Expand Up @@ -24,283 +24,13 @@
# for p in i686-linux-gnu x86_64-linux-gnu aarch64-linux-gnu armv7l-linux-gnueabihf powerpc64le-linux-gnu i686-linux-musl x86_64-linux-musl aarch64-linux-musl armv7l-linux-musleabihf x86_64-apple-darwin14 x86_64-unknown-freebsd12.2 i686-w64-mingw32 x86_64-w64-mingw32; do julia build_tarballs.jl --debug --verbose --deploy "${p}"; done

include("./common.jl")
include("./gcc_sources.jl")

using BinaryBuilder
using BinaryBuilder: BinaryBuilderBase
@eval BinaryBuilder.BinaryBuilderBase empty!(bootstrap_list)
@eval BinaryBuilder.BinaryBuilderBase push!(bootstrap_list, :rootfs, :platform_support)

function gcc_sources(gcc_version::VersionNumber, compiler_target::Platform; kwargs...)
# Since we can build a variety of GCC versions, track them and their hashes here.
# We download GCC, MPFR, MPC, ISL and GMP.
gcc_version_sources = Dict{VersionNumber,Vector}(
v"4.8.5" => [
ArchiveSource("https://mirrors.kernel.org/gnu/gcc/gcc-4.8.5/gcc-4.8.5.tar.bz2",
"22fb1e7e0f68a63cee631d85b20461d1ea6bda162f03096350e38c8d427ecf23"),
ArchiveSource("https://mirrors.kernel.org/gnu/mpfr/mpfr-2.4.2.tar.xz",
"d7271bbfbc9ddf387d3919df8318cd7192c67b232919bfa1cb3202d07843da1b"),
ArchiveSource("https://gcc.gnu.org/pub/gcc/infrastructure/mpc-0.8.1.tar.gz",
"e664603757251fd8a352848276497a4c79b7f8b21fd8aedd5cc0598a38fee3e4"),
ArchiveSource("https://mirrors.kernel.org/gnu/gmp/gmp-4.3.2.tar.bz2",
"936162c0312886c21581002b79932829aa048cfaf9937c6265aeaa14f1cd1775"),
],
v"5.2.0" => [
ArchiveSource("https://mirrors.kernel.org/gnu/gcc/gcc-5.2.0/gcc-5.2.0.tar.bz2",
"5f835b04b5f7dd4f4d2dc96190ec1621b8d89f2dc6f638f9f8bc1b1014ba8cad"),
ArchiveSource("https://mirrors.kernel.org/gnu/mpfr/mpfr-2.4.2.tar.xz",
"d7271bbfbc9ddf387d3919df8318cd7192c67b232919bfa1cb3202d07843da1b"),
ArchiveSource("https://gcc.gnu.org/pub/gcc/infrastructure/mpc-0.8.1.tar.gz",
"e664603757251fd8a352848276497a4c79b7f8b21fd8aedd5cc0598a38fee3e4"),
ArchiveSource("https://mirrors.kernel.org/gnu/gmp/gmp-4.3.2.tar.bz2",
"936162c0312886c21581002b79932829aa048cfaf9937c6265aeaa14f1cd1775"),
ArchiveSource("https://gcc.gnu.org/pub/gcc/infrastructure/isl-0.14.tar.bz2",
"7e3c02ff52f8540f6a85534f54158968417fd676001651c8289c705bd0228f36"),
],
v"6.1.0" => [
ArchiveSource("https://mirrors.kernel.org/gnu/gcc/gcc-6.1.0/gcc-6.1.0.tar.bz2",
"09c4c85cabebb971b1de732a0219609f93fc0af5f86f6e437fd8d7f832f1a351"),
ArchiveSource("https://mirrors.kernel.org/gnu/mpfr/mpfr-2.4.2.tar.xz",
"d7271bbfbc9ddf387d3919df8318cd7192c67b232919bfa1cb3202d07843da1b"),
ArchiveSource("https://gcc.gnu.org/pub/gcc/infrastructure/mpc-0.8.1.tar.gz",
"e664603757251fd8a352848276497a4c79b7f8b21fd8aedd5cc0598a38fee3e4"),
ArchiveSource("https://mirrors.kernel.org/gnu/gmp/gmp-4.3.2.tar.bz2",
"936162c0312886c21581002b79932829aa048cfaf9937c6265aeaa14f1cd1775"),
ArchiveSource("https://gcc.gnu.org/pub/gcc/infrastructure/isl-0.15.tar.bz2",
"8ceebbf4d9a81afa2b4449113cee4b7cb14a687d7a549a963deb5e2a41458b6b"),
],
v"7.1.0" => [
ArchiveSource("https://mirrors.kernel.org/gnu/gcc/gcc-7.1.0/gcc-7.1.0.tar.bz2",
"8a8136c235f64c6fef69cac0d73a46a1a09bb250776a050aec8f9fc880bebc17"),
ArchiveSource("https://mirrors.kernel.org/gnu/mpfr/mpfr-3.1.4.tar.xz",
"761413b16d749c53e2bfd2b1dfaa3b027b0e793e404b90b5fbaeef60af6517f5"),
ArchiveSource("https://mirrors.kernel.org/gnu/mpc/mpc-1.0.3.tar.gz",
"617decc6ea09889fb08ede330917a00b16809b8db88c29c31bfbb49cbf88ecc3"),
ArchiveSource("https://gcc.gnu.org/pub/gcc/infrastructure/isl-0.16.1.tar.bz2",
"412538bb65c799ac98e17e8cfcdacbb257a57362acfaaff254b0fcae970126d2"),
ArchiveSource("https://mirrors.kernel.org/gnu/gmp/gmp-6.1.0.tar.xz",
"68dadacce515b0f8a54f510edf07c1b636492bcdb8e8d54c56eb216225d16989"),
],
v"8.1.0" => [
ArchiveSource("https://mirrors.kernel.org/gnu/gcc/gcc-8.1.0/gcc-8.1.0.tar.xz",
"1d1866f992626e61349a1ccd0b8d5253816222cdc13390dcfaa74b093aa2b153"),
ArchiveSource("https://mirrors.kernel.org/gnu/mpfr/mpfr-4.0.1.tar.xz",
"67874a60826303ee2fb6affc6dc0ddd3e749e9bfcb4c8655e3953d0458a6e16e"),
ArchiveSource("https://mirrors.kernel.org/gnu/mpc/mpc-1.1.0.tar.gz",
"6985c538143c1208dcb1ac42cedad6ff52e267b47e5f970183a3e75125b43c2e"),
ArchiveSource("https://gcc.gnu.org/pub/gcc/infrastructure/isl-0.18.tar.bz2",
"6b8b0fd7f81d0a957beb3679c81bbb34ccc7568d5682844d8924424a0dadcb1b"),
ArchiveSource("https://mirrors.kernel.org/gnu/gmp/gmp-6.1.2.tar.xz",
"87b565e89a9a684fe4ebeeddb8399dce2599f9c9049854ca8c0dfbdea0e21912"),
],
v"9.1.0" => [
ArchiveSource("https://mirrors.kernel.org/gnu/gcc/gcc-9.1.0/gcc-9.1.0.tar.xz",
"79a66834e96a6050d8fe78db2c3b32fb285b230b855d0a66288235bc04b327a0"),
ArchiveSource("https://mirrors.kernel.org/gnu/mpfr/mpfr-4.0.2.tar.xz",
"1d3be708604eae0e42d578ba93b390c2a145f17743a744d8f3f8c2ad5855a38a"),
ArchiveSource("https://mirrors.kernel.org/gnu/mpc/mpc-1.1.0.tar.gz",
"6985c538143c1208dcb1ac42cedad6ff52e267b47e5f970183a3e75125b43c2e"),
ArchiveSource("https://gcc.gnu.org/pub/gcc/infrastructure/isl-0.18.tar.bz2",
"6b8b0fd7f81d0a957beb3679c81bbb34ccc7568d5682844d8924424a0dadcb1b"),
ArchiveSource("https://mirrors.kernel.org/gnu/gmp/gmp-6.1.2.tar.xz",
"87b565e89a9a684fe4ebeeddb8399dce2599f9c9049854ca8c0dfbdea0e21912"),
],
v"10.2.0" => [
ArchiveSource("https://mirrors.kernel.org/gnu/gcc/gcc-10.2.0/gcc-10.2.0.tar.xz",
"b8dd4368bb9c7f0b98188317ee0254dd8cc99d1e3a18d0ff146c855fe16c1d8c"),
ArchiveSource("https://mirrors.kernel.org/gnu/mpfr/mpfr-4.0.2.tar.xz",
"1d3be708604eae0e42d578ba93b390c2a145f17743a744d8f3f8c2ad5855a38a"),
ArchiveSource("https://mirrors.kernel.org/gnu/mpc/mpc-1.1.0.tar.gz",
"6985c538143c1208dcb1ac42cedad6ff52e267b47e5f970183a3e75125b43c2e"),
ArchiveSource("https://gcc.gnu.org/pub/gcc/infrastructure/isl-0.18.tar.bz2",
"6b8b0fd7f81d0a957beb3679c81bbb34ccc7568d5682844d8924424a0dadcb1b"),
ArchiveSource("https://mirrors.kernel.org/gnu/gmp/gmp-6.1.2.tar.xz",
"87b565e89a9a684fe4ebeeddb8399dce2599f9c9049854ca8c0dfbdea0e21912"),
],
v"11.1.0" => [
ArchiveSource("https://mirrors.kernel.org/gnu/gcc/gcc-11.1.0/gcc-11.1.0.tar.xz",
"4c4a6fb8a8396059241c2e674b85b351c26a5d678274007f076957afa1cc9ddf"),
ArchiveSource("https://mirrors.kernel.org/gnu/mpfr/mpfr-4.0.2.tar.xz",
"1d3be708604eae0e42d578ba93b390c2a145f17743a744d8f3f8c2ad5855a38a"),
ArchiveSource("https://mirrors.kernel.org/gnu/mpc/mpc-1.1.0.tar.gz",
"6985c538143c1208dcb1ac42cedad6ff52e267b47e5f970183a3e75125b43c2e"),
ArchiveSource("https://gcc.gnu.org/pub/gcc/infrastructure/isl-0.18.tar.bz2",
"6b8b0fd7f81d0a957beb3679c81bbb34ccc7568d5682844d8924424a0dadcb1b"),
ArchiveSource("https://mirrors.kernel.org/gnu/gmp/gmp-6.1.2.tar.xz",
"87b565e89a9a684fe4ebeeddb8399dce2599f9c9049854ca8c0dfbdea0e21912"),
],
v"12.1.0" => [
ArchiveSource("https://mirrors.kernel.org/gnu/gcc/gcc-12.1.0/gcc-12.1.0.tar.xz",
"62fd634889f31c02b64af2c468f064b47ad1ca78411c45abe6ac4b5f8dd19c7b"),
ArchiveSource("https://mirrors.kernel.org/gnu/gmp/gmp-6.2.1.tar.xz",
"fd4829912cddd12f84181c3451cc752be224643e87fac497b69edddadc49b4f2"),
ArchiveSource("https://mirrors.kernel.org/gnu/mpfr/mpfr-4.1.0.tar.xz",
"0c98a3f1732ff6ca4ea690552079da9c597872d30e96ec28414ee23c95558a7f"),
ArchiveSource("https://mirrors.kernel.org/gnu/mpc/mpc-1.2.1.tar.gz",
"17503d2c395dfcf106b622dc142683c1199431d095367c6aacba6eec30340459"),
ArchiveSource("https://gcc.gnu.org/pub/gcc/infrastructure/isl-0.24.tar.bz2",
"fcf78dd9656c10eb8cf9fbd5f59a0b6b01386205fe1934b3b287a0a1898145c0"),
],
)

# Map from GCC version and platform -> binutils sources
if Sys.isapple(compiler_target)
# The WIP branch by Iain Sandoe, who is working his toolchain magic to give us aarch64-darwin compilers
# Build this targeting aarch64-apple-darwin. To add new versions, go to
# https://github.com/iains/gcc-darwin-arm64/branches/all and find the most recent branch named
# `master-wip-apple-si-on-ABCDEF` and use the tip of that branch, see
# https://github.com/JuliaLang/julia/issues/44435#issuecomment-1059058949
gcc_version_sources[v"11.0.0-iains"] = [
GitSource("https://github.com/iains/gcc-darwin-arm64.git",
"ccc57f4ed3feed697f17d3230786389b1b410af9"),
ArchiveSource("https://mirrors.kernel.org/gnu/mpfr/mpfr-4.0.1.tar.xz",
"67874a60826303ee2fb6affc6dc0ddd3e749e9bfcb4c8655e3953d0458a6e16e"),
ArchiveSource("https://mirrors.kernel.org/gnu/mpc/mpc-1.1.0.tar.gz",
"6985c538143c1208dcb1ac42cedad6ff52e267b47e5f970183a3e75125b43c2e"),
ArchiveSource("https://gcc.gnu.org/pub/gcc/infrastructure/isl-0.18.tar.bz2",
"6b8b0fd7f81d0a957beb3679c81bbb34ccc7568d5682844d8924424a0dadcb1b"),
ArchiveSource("https://mirrors.kernel.org/gnu/gmp/gmp-6.2.0.tar.xz",
"258e6cd51b3fbdfc185c716d55f82c08aff57df0c6fbd143cf6ed561267a1526"),
]
gcc_version_sources[v"12.0.1-iains"] = [
GitSource("https://github.com/iains/gcc-darwin-arm64.git",
"af646bebaceed617775b5465cf06cb5d270a16f4"),
ArchiveSource("https://mirrors.kernel.org/gnu/mpfr/mpfr-4.0.2.tar.xz",
"1d3be708604eae0e42d578ba93b390c2a145f17743a744d8f3f8c2ad5855a38a"),
ArchiveSource("https://mirrors.kernel.org/gnu/mpc/mpc-1.1.0.tar.gz",
"6985c538143c1208dcb1ac42cedad6ff52e267b47e5f970183a3e75125b43c2e"),
ArchiveSource("https://gcc.gnu.org/pub/gcc/infrastructure/isl-0.18.tar.bz2",
"6b8b0fd7f81d0a957beb3679c81bbb34ccc7568d5682844d8924424a0dadcb1b"),
ArchiveSource("https://mirrors.kernel.org/gnu/gmp/gmp-6.2.0.tar.xz",
"258e6cd51b3fbdfc185c716d55f82c08aff57df0c6fbd143cf6ed561267a1526"),
]
# MacOS doesn't actually use binutils, it uses cctools
binutils_sources = [
GitSource("https://github.com/tpoechtrager/apple-libtapi.git",
"a66284251b46d591ee4a0cb4cf561b92a0c138d8"),
GitSource("https://github.com/tpoechtrager/cctools-port.git",
"634a084377ee2e2932c66459b0396edf76da2e9f"),
]
else
# Different versions of GCC should be pared with different versions of Binutils
binutils_gcc_version_mapping = Dict(
v"4.8.5" => v"2.24",
v"5.2.0" => v"2.25.1",
v"6.1.0" => v"2.26",
v"7.1.0" => v"2.27",
v"8.1.0" => v"2.31",
v"9.1.0" => v"2.33.1",
v"10.2.0" => v"2.34",
v"11.1.0" => v"2.36",
v"12.1.0" => v"2.38",
)

# Everyone else uses GNU Binutils, but we have to version carefully.
binutils_version_sources = Dict(
v"2.24" => [
ArchiveSource("https://ftp.gnu.org/gnu/binutils/binutils-2.24.tar.bz2",
"e5e8c5be9664e7f7f96e0d09919110ab5ad597794f5b1809871177a0f0f14137"),
],
v"2.25.1" => [
ArchiveSource("https://ftp.gnu.org/gnu/binutils/binutils-2.25.1.tar.bz2",
"b5b14added7d78a8d1ca70b5cb75fef57ce2197264f4f5835326b0df22ac9f22"),
],
v"2.26" => [
ArchiveSource("https://ftp.gnu.org/gnu/binutils/binutils-2.26.tar.bz2",
"c2ace41809542f5237afc7e3b8f32bb92bc7bc53c6232a84463c423b0714ecd9"),
],
v"2.27" => [
ArchiveSource("https://ftp.gnu.org/gnu/binutils/binutils-2.27.tar.bz2",
"369737ce51587f92466041a97ab7d2358c6d9e1b6490b3940eb09fb0a9a6ac88"),
],
v"2.31" => [
ArchiveSource("https://ftp.gnu.org/gnu/binutils/binutils-2.31.tar.bz2",
"2c49536b1ca6b8900531b9e34f211a81caf9bf85b1a71f82b81ae32fcd8ffe19"),
],
v"2.33.1" => [
ArchiveSource("https://ftp.gnu.org/gnu/binutils/binutils-2.33.1.tar.xz",
"ab66fc2d1c3ec0359b8e08843c9f33b63e8707efdff5e4cc5c200eae24722cbf"),
],
v"2.34" => [
ArchiveSource("https://ftp.gnu.org/gnu/binutils/binutils-2.34.tar.xz",
"f00b0e8803dc9bab1e2165bd568528135be734df3fabf8d0161828cd56028952"),
],
v"2.35.1" => [
ArchiveSource("https://ftp.gnu.org/gnu/binutils/binutils-2.35.1.tar.xz",
"3ced91db9bf01182b7e420eab68039f2083aed0a214c0424e257eae3ddee8607"),
],
v"2.36" => [
ArchiveSource("https://ftp.gnu.org/gnu/binutils/binutils-2.36.tar.xz",
"5788292cc5bbcca0848545af05986f6b17058b105be59e99ba7d0f9eb5336fb8"),
],
v"2.38" => [
ArchiveSource("https://ftp.gnu.org/gnu/binutils/binutils-2.38.tar.xz",
"e316477a914f567eccc34d5d29785b8b0f5a10208d36bbacedcc39048ecfe024"),
],
)
binutils_version = binutils_gcc_version_mapping[gcc_version]
binutils_sources = binutils_version_sources[binutils_version]
end


if Sys.islinux(compiler_target) && libc(compiler_target) == "glibc"
# Depending on our architecture, we choose different versions of glibc
if arch(compiler_target) in ["x86_64", "i686"]
libc_sources = [
ArchiveSource("https://mirrors.kernel.org/gnu/glibc/glibc-2.12.2.tar.xz",
"0eb4fdf7301a59d3822194f20a2782858955291dd93be264b8b8d4d56f87203f"),
]
elseif arch(compiler_target) in ["armv7l", "aarch64"]
libc_sources = [
ArchiveSource("https://mirrors.kernel.org/gnu/glibc/glibc-2.19.tar.xz",
"2d3997f588401ea095a0b27227b1d50cdfdd416236f6567b564549d3b46ea2a2"),
]
elseif arch(compiler_target) in ["powerpc64le"]
libc_sources = [
ArchiveSource("https://mirrors.kernel.org/gnu/glibc/glibc-2.17.tar.xz",
"6914e337401e0e0ade23694e1b2c52a5f09e4eda3270c67e7c3ba93a89b5b23e"),
]
else
error("Unknown arch for glibc for compiler target $(compiler_target)")
end
elseif Sys.islinux(compiler_target) && libc(compiler_target) == "musl"
libc_sources = [
ArchiveSource("https://www.musl-libc.org/releases/musl-1.1.19.tar.gz",
"db59a8578226b98373f5b27e61f0dd29ad2456f4aa9cec587ba8c24508e4c1d9"),
]
elseif Sys.isapple(compiler_target)
if arch(compiler_target) == "aarch64"
libc_sources = [
ArchiveSource("https://github.com/phracker/MacOSX-SDKs/releases/download/11.0-11.1/MacOSX11.1.sdk.tar.xz",
"9b86eab03176c56bb526de30daa50fa819937c54b280364784ce431885341bf6"),
]
else
libc_sources = [
ArchiveSource("https://github.com/phracker/MacOSX-SDKs/releases/download/10.15/MacOSX10.12.sdk.tar.xz",
"6852728af94399193599a55d00ae9c4a900925b6431534a3816496b354926774"),
]
end
elseif Sys.isfreebsd(compiler_target)
libc_sources = [
ArchiveSource("http://ftp-archive.freebsd.org/pub/FreeBSD-Archive/old-releases/amd64/12.2-RELEASE/base.txz",
"8bd49ce35c340a04029266fbbe82b1fdfeb914263e39579eecafb2e67d00693a"),
]
elseif Sys.iswindows(compiler_target)
libc_sources = [
ArchiveSource("https://sourceforge.net/projects/mingw-w64/files/mingw-w64/mingw-w64-release/mingw-w64-v7.0.0.tar.bz2",
"aa20dfff3596f08a7f427aab74315a6cb80c2b086b4a107ed35af02f9496b628"),
]
else
error("Unknown libc mapping for platform $(compiler_target)")
end

# We bundle together GCC, Binutils and libc.
return [
gcc_version_sources[gcc_version]...,
binutils_sources...,
libc_sources...,
DirectorySource("./bundled"; follow_symlinks=true),
]
end

function gcc_script(compiler_target::Platform)
script = raw"""
Expand Down
Loading