@@ -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. patch)
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 commit comments