From 3591b6d4c5f870ac7d5dd8ece3cbac3e571f9966 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Poulhi=C3=A8s?= Date: Sun, 28 Apr 2024 18:59:17 +0200 Subject: [PATCH] Add config to build "renovated" GCC (#24) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit These branches are ""maintained"" by jwakely and can be used to build old GCC on more recent linux distribution. They mainly contains workarounds for glibc API change, bison version, ... refs https://github.com/compiler-explorer/compiler-explorer/issues/6323 Signed-off-by: Marc Poulhiès --- build/build.sh | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/build/build.sh b/build/build.sh index 4ae4a39..f65bd1c 100755 --- a/build/build.sh +++ b/build/build.sh @@ -15,7 +15,12 @@ BINUTILS_GITURL=https://sourceware.org/git/binutils-gdb.git BINUTILS_VERSION=2.40 BINUTILS_REVISION=$BINUTILS_VERSION CONFIG="" + +# Defaults used for nearly every builds for recent GCC. +BOOTSTRAP_CONFIG="--disable-bootstrap" +INSTALL_TARGET=install-strip MULTILIB_ENABLED="--enable-multilib" +WITH_ABI="--with-abi=m64" if echo "${VERSION}" | grep 'embed-trunk'; then VERSION=embed-trunk-$(date +%Y%m%d) @@ -101,6 +106,24 @@ elif echo "${VERSION}" | grep 'trunk'; then MAJOR_MINOR=13-trunk LANGUAGES="${LANGUAGES},go,d,rust,m2" CONFIG+=" --enable-libstdcxx-backtrace=yes" +elif echo "${VERSION}" | grep 'renovated'; then + SUB_VERSION=$(echo "${VERSION}" | cut -d'-' -f2) + URL="https://github.com/jwakely/gcc" + BRANCH="renovated/gcc-${SUB_VERSION}" + MAJOR=$(echo "${SUB_VERSION}" | cut -d'.' -f1) + MAJOR_MINOR=renovated-$(echo "${SUB_VERSION}" | cut -d'.' -f1-2) + INSTALL_TARGET=install + LANGUAGES="objc,c,c++" + + # we need to bootstrap, as recent compiler will choke on some C++ code. + BOOTSTRAP_CONFIG=" " + + if [[ "${MAJOR}" -le 4 ]]; then + WITH_ABI=" " + MULTILIB_ENABLED=" --disable-multilib" + fi + + MAJOR="renovated-${MAJOR}" else MAJOR=$(echo "${VERSION}" | grep -oE '^[0-9]+') MAJOR_MINOR=$(echo "${VERSION}" | grep -oE '^[0-9]+\.[0-9]+') @@ -153,7 +176,6 @@ fi # Workaround for Ubuntu builds export LIBRARY_PATH=/usr/lib/x86_64-linux-gnu STAGING_DIR=$(pwd)/staging -INSTALL_TARGET=install-strip rm -rf "${STAGING_DIR}" mkdir -p "${STAGING_DIR}" @@ -196,9 +218,9 @@ applyPatchesAndConfig() { CONFIG+=" --build=x86_64-linux-gnu" CONFIG+=" --host=x86_64-linux-gnu" CONFIG+=" --target=x86_64-linux-gnu" -CONFIG+=" --disable-bootstrap" +CONFIG+=" ${BOOTSTRAP_CONFIG}" CONFIG+=" --enable-multiarch" -CONFIG+=" --with-abi=m64" +CONFIG+=" ${WITH_ABI}" CONFIG+=" --with-multilib-list=m32,m64,mx32" CONFIG+=" ${MULTILIB_ENABLED}" CONFIG+=" --enable-clocale=gnu"