Skip to content

Commit 0b01778

Browse files
committed
[GCC 14] Add some version-based conditionals in the scripts
1 parent 7efd742 commit 0b01778

File tree

2 files changed

+27
-15
lines changed

2 files changed

+27
-15
lines changed

0_RootFS/gcc_common.jl

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,14 @@ using BinaryBuilder: BinaryBuilderBase
3232
@eval BinaryBuilder.BinaryBuilderBase push!(bootstrap_list, :rootfs, :platform_support)
3333

3434

35-
function gcc_script(compiler_target::Platform)
36-
script = raw"""
35+
function gcc_script(gcc_version::VersionNumber, compiler_target::Platform)
36+
script = """
37+
GCC_VERSION_MAJOR=$(gcc_version.major)
38+
GCC_VERSION_MINOR=$(gcc_version.minor)
39+
GCC_VERSION_PATCH=$(gcc_version.pach)
40+
"""
41+
42+
script *= raw"""
3743
cd ${WORKSPACE}/srcdir
3844
COMPILER_TARGET=${target}
3945
HOST_TARGET=${MACHTYPE}
@@ -213,8 +219,10 @@ function gcc_script(compiler_target::Platform)
213219
mkdir -p ${WORKSPACE}/srcdir/cctools_build
214220
cd ${WORKSPACE}/srcdir/cctools_build
215221
216-
# TODO: Update RootFS to v3.17 or later, and preinstall libdispatch (and libdispatch-dev only when building GCC 14+ for macOS).
217-
apk add libdispatch libdispatch-dev --repository=http://dl-cdn.alpinelinux.org/alpine/v3.17/community
222+
# TODO: Update RootFS to v3.17 or later, and preinstall libdispatch (and libdispatch-dev here only when building for macOS).
223+
if [[ "${GCC_VERSION_MAJOR}" -ge 14 ]]; then
224+
apk add libdispatch libdispatch-dev --repository=http://dl-cdn.alpinelinux.org/alpine/v3.17/community
225+
fi
218226
219227
${WORKSPACE}/srcdir/cctools-port/cctools/configure \
220228
--prefix=${prefix} \
@@ -375,11 +383,10 @@ function gcc_script(compiler_target::Platform)
375383
# trying to build. Various configure tests would fail otherwise. (Why
376384
# declare variables or functions if they default to int anyway?)
377385
GLIBC_CFLAGS="${CFLAGS} -g -O2"
378-
if test -d ${WORKSPACE}/srcdir/gcc-14*; then
386+
if [[ "${GCC_VERSION_MAJOR}" -ge 14 ]]; then
379387
GLIBC_CFLAGS="${GLIBC_CFLAGS} -Wno-implicit-int -Wno-implicit-function-declaration -Wno-builtin-declaration-mismatch -Wno-array-parameter -Wno-int-conversion"
380388
fi
381389
382-
383390
# Configure glibc
384391
mkdir ${WORKSPACE}/srcdir/glibc_build
385392
cd ${WORKSPACE}/srcdir/glibc_build
@@ -642,7 +649,7 @@ function build_and_upload_gcc(version::VersionNumber, ARGS=ARGS)
642649
deleteat!(ARGS, length(ARGS))
643650

644651
sources = gcc_sources(version, compiler_target)
645-
script = gcc_script(compiler_target)
652+
script = gcc_script(version, compiler_target)
646653
products = gcc_products()
647654

648655
# Build the tarballs, and possibly a `build.jl` as well.

0_RootFS/gcc_sources.jl

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -170,14 +170,19 @@ function gcc_sources(gcc_version::VersionNumber, compiler_target::Platform; kwar
170170
binutils_sources = [
171171
GitSource("https://github.com/tpoechtrager/apple-libtapi.git",
172172
"a66284251b46d591ee4a0cb4cf561b92a0c138d8"),
173-
# GitSource("https://github.com/tpoechtrager/cctools-port.git",
174-
# "634a084377ee2e2932c66459b0396edf76da2e9f"),
175-
# # 1300.6.5; API: 1.6.0
176-
# GitSource("https://github.com/tpoechtrager/apple-libtapi.git",
177-
# "aa37c11ad1a817248c9d1578ac99e133875b4eb5"),
178-
# cctools-877.8-ld64-253.9-1
179-
GitSource("https://github.com/tpoechtrager/cctools-port.git",
180-
"81f205e8ca6bbf2fdbcb6948132454fd1f97839e"),
173+
]
174+
if gcc_version v"14"
175+
push!(binutils_sources,
176+
GitSource("https://github.com/tpoechtrager/cctools-port.git",
177+
"81f205e8ca6bbf2fdbcb6948132454fd1f97839e"),
178+
)
179+
else
180+
push!(binutils_sources,
181+
GitSource("https://github.com/tpoechtrager/cctools-port.git",
182+
"634a084377ee2e2932c66459b0396edf76da2e9f"),
183+
)
184+
end
185+
181186
]
182187
else
183188
# Different versions of GCC should be paired with different versions of Binutils

0 commit comments

Comments
 (0)