emerald-gcc/emerald-binutils.sh

40 lines
1.2 KiB
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
EMERALD_SCRIPT_DIR=$(dirname "$(realpath "$0")")
BINUTILS_VER=2.41
BINUTILS_SHA256=ae9a5789e23459e59606e6714723f2d3ffc31c03174191ef0d015bdf06007450
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"
# Bit of patching
sed -i 's|DCL_FGETPOS64 (fgetpos64)||g' gprofng/libcollector/iotrace.c
sed -i 's|DCL_FSETPOS (fsetpos)||g' gprofng/libcollector/iotrace.c
sed -i 's|DCL_OPEN64 (open64)||g' gprofng/libcollector/iotrace.c
# 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 || cat config.log
# Building
make -j$(nproc --all)
make install -j1