#!/usr/bin/env bash set -euo pipefail EMERALD_SCRIPT_DIR=$(dirname "$(realpath "$0")") GCC_VER=12.1.0 GCC_SHA256=62fd634889f31c02b64af2c468f064b47ad1ca78411c45abe6ac4b5f8dd19c7b EMERALD_BUILD_DIR="$EMERALD_SCRIPT_DIR"/build EMERALD_DL_DIR="$EMERALD_SCRIPT_DIR"/dl source "$EMERALD_SCRIPT_DIR"/common.sh # Make sure build and dl directory exists mkdir -vp "$EMERALD_BUILD_DIR" "$EMERALD_DL_DIR" # Getting source download https://ftp.gnu.org/gnu/gcc/gcc-"$GCC_VER"/gcc-"$GCC_VER".tar.xz "$EMERALD_DL_DIR"/gcc-"$GCC_VER".tar.xz "$GCC_SHA256" if [ ! -d "$EMERALD_BUILD_DIR"/gcc-"$GCC_VER" ]; then tar --directory="$EMERALD_BUILD_DIR" -xJf "$EMERALD_DL_DIR"/gcc-"$GCC_VER".tar.xz fi cd "$EMERALD_BUILD_DIR"/gcc-"$GCC_VER" # Apply patches find "$EMERALD_SCRIPT_DIR"/patches/gcc/"$GCC_VER" -type f -name '*.patch' -exec patch -p0 -i {} \; ./contrib/download_prerequisites # Its suggested to run configure from a seperate directory mkdir -vp build && cd "$_" # Configuration ../configure --target="$TARGET" --prefix="$PREFIX" \ --enable-plugins --without-headers \ --with-gnu-as --with-gnu-ld \ --enable-languages=c,c++,fortran --with-pkgversion='Emerald' \ --enable-default-pie --enable-gnu-indirect-function \ --disable-libsanitizer --disable-nls \ --enable-threads=posix --enable-__cxa_atexit \ --enable-clocale=gnu --disable-libstdcxx-pch \ --with-bugurl='https://tildegit.org/PeroSar/emerald-gcc/issues' # Building make -j4 export PATH="$PREFIX/bin:$PATH" make install-strip -j1