2022-05-01 18:54:13 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
set -euo pipefail
|
|
|
|
|
|
|
|
EMERALD_SCRIPT_DIR=$(dirname "$(realpath "$0")")
|
|
|
|
|
2023-09-24 06:54:48 +00:00
|
|
|
BINUTILS_VER=2.41
|
|
|
|
BINUTILS_SHA256=ae9a5789e23459e59606e6714723f2d3ffc31c03174191ef0d015bdf06007450
|
2022-05-01 18:54:13 +00:00
|
|
|
|
|
|
|
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"
|
|
|
|
|
2023-09-24 07:15:40 +00:00
|
|
|
# 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
|
|
|
|
|
2022-05-01 18:54:13 +00:00
|
|
|
# Its suggested to run configure from a seperate directory
|
|
|
|
mkdir -vp build && cd "$_"
|
|
|
|
|
|
|
|
# Configuration
|
|
|
|
../configure --target="$TARGET" --prefix="$PREFIX" \
|
|
|
|
--disable-werror --enable-gold \
|
2023-09-24 07:15:40 +00:00
|
|
|
--enable-plugins --disable-nls || cat config.log
|
2022-05-01 18:54:13 +00:00
|
|
|
|
|
|
|
# Building
|
2023-09-24 07:15:40 +00:00
|
|
|
make -j$(nproc --all)
|
2022-05-01 18:54:13 +00:00
|
|
|
make install -j1
|