46 lines
1.3 KiB
Bash
Executable File
46 lines
1.3 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
set -euo pipefail
|
|
|
|
EMERALD_SCRIPT_DIR=$(dirname "$(realpath "$0")")
|
|
|
|
GCC_VER=11.3.0
|
|
GCC_SHA256=b47cf2818691f5b1e21df2bb38c795fac2cfbd640ede2d0a5e1c89e338a3ac39
|
|
|
|
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++ --with-pkgversion='Emerald' \
|
|
--enable-default-pie --enable-gnu-indirect-function \
|
|
--disable-libsanitizer --disable-nls
|
|
|
|
# Building
|
|
make -j4
|
|
export PATH="$PREFIX/bin:$PATH"
|
|
make install-strip -j1
|