37 lines
1.0 KiB
Bash
Executable File
37 lines
1.0 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
set -euo pipefail
|
|
|
|
EMERALD_SCRIPT_DIR=$(dirname "$(realpath "$0")")
|
|
|
|
BINUTILS_VER=2.38
|
|
BINUTILS_SHA256=e316477a914f567eccc34d5d29785b8b0f5a10208d36bbacedcc39048ecfe024
|
|
|
|
EMERALD_BUILD_DIR="$EMERALD_SCRIPT_DIR"/build
|
|
EMERALD_DL_DIR="$EMERALD_SCRIPT_DIR"/dl
|
|
source "$EMERALD_SCRIPT_DIR"/common.sh
|
|
|
|
# Make sure build/dl directory exists
|
|
mkdir -vp "$EMERALD_BUILD_DIR" "$EMERALD_DL_DIR"
|
|
|
|
# Getting source
|
|
download https://ftp.gnu.org/gnu/binutils/binutils-"$BINUTILS_VER".tar.xz "$EMERALD_DL_DIR"/binutils-"$BINUTILS_VER".tar.xz "$BINUTILS_SHA256"
|
|
|
|
if [ ! -d "$EMERALD_BUILD_DIR"/binutils-"$BINUTILS_VER" ]; then
|
|
tar --directory="$EMERALD_BUILD_DIR" -xJf "$EMERALD_DL_DIR"/binutils-"$BINUTILS_VER".tar.xz
|
|
fi
|
|
|
|
cd "$EMERALD_BUILD_DIR"/binutils-"$BINUTILS_VER"
|
|
|
|
# Its suggested to run configure from a seperate directory
|
|
mkdir -vp build && cd "$_"
|
|
|
|
# Configuration
|
|
../configure --target="$TARGET" --prefix="$PREFIX" \
|
|
--disable-werror --enable-gold \
|
|
--enable-plugins --disable-nls
|
|
|
|
# Building
|
|
make -j4
|
|
make install -j1
|