Luna/tools/setup-binutils.sh
apio 0c5a84f932
Some checks failed
continuous-integration/drone/push Build is failing
toolchain: Update to binutils 2.39
CI will fail, it's normal. Wait for me to build a new toolchain for it.
2023-01-07 21:23:01 +01:00

51 lines
1.1 KiB
Bash
Executable File

#!/usr/bin/env bash
set -e
source $(dirname $0)/setup-env.sh
cd $LUNA_ROOT
mkdir -p toolchain/tarballs
mkdir -p toolchain/build
if [ ! -f toolchain/tarballs/binutils-$LUNA_BINUTILS_VERSION_REQUIRED.tar.xz ]; then
echo Downloading Binutils...
wget -Otoolchain/tarballs/binutils-$LUNA_BINUTILS_VERSION_REQUIRED.tar.xz https://ftp.gnu.org/gnu/binutils/binutils-$LUNA_BINUTILS_VERSION_REQUIRED.tar.xz
fi
rm -rf toolchain/build/binutils
rm -rf toolchain/build/binutils-$LUNA_BINUTILS_VERSION_REQUIRED
echo Extracting Binutils...
tar xf toolchain/tarballs/binutils-$LUNA_BINUTILS_VERSION_REQUIRED.tar.xz -C toolchain/build/
echo Patching Binutils...
cd toolchain
patch -u -i $LUNA_ROOT/tools/binutils.patch -p 1 -d build
cd -
echo Configuring Binutils...
mkdir -p toolchain/build/binutils
cd toolchain/build/binutils
unset CC
unset CXX
unset LD
unset AR
../binutils-$LUNA_BINUTILS_VERSION_REQUIRED/configure --prefix="$BUILD_PREFIX" --target=$BUILD_TARGET --disable-nls --with-sysroot=$BUILD_SYSROOT --disable-werror --enable-warn-rwx-segments=no
echo Building Binutils...
make -j$(nproc)
echo Installing Binutils...
make install