emerald-gcc/emerald-gcc.sh

48 lines
1.4 KiB
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
EMERALD_SCRIPT_DIR=$(dirname "$(realpath "$0")")
GCC_VER=13.2.0
GCC_SHA256=e275e76442a6067341a27f04c5c6b83d8613144004c0413528863dc6b5c743da
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"
# Download prerequisites
./contrib/download_prerequisites
# Apply patches
find "$EMERALD_SCRIPT_DIR"/patches/gcc/"$GCC_VER" -type f -name '*.patch' -exec patch -p0 -i {} \;
# 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 -j$(nproc --all)
export PATH="$PREFIX/bin:$PATH"
make install-strip -j1