Luna/tools/setup-binutils.sh

48 lines
1.2 KiB
Bash
Raw Normal View History

#!/usr/bin/env bash
2022-09-05 14:13:51 +00:00
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
2022-10-02 17:58:52 +00:00
rm -rf toolchain/build/binutils
rm -rf toolchain/build/binutils-$LUNA_BINUTILS_VERSION_REQUIRED
2022-09-05 14:13:51 +00:00
echo Extracting Binutils...
tar xf toolchain/tarballs/binutils-$LUNA_BINUTILS_VERSION_REQUIRED.tar.xz -C toolchain/build/
2022-10-02 08:33:34 +00:00
echo Patching Binutils...
cd toolchain
patch -u -i $LUNA_ROOT/tools/binutils.patch -p 1 -d build | filter-lines "binutils" "patch"
2022-10-02 08:33:34 +00:00
cd -
2022-09-05 14:13:51 +00:00
echo Configuring Binutils...
mkdir -p toolchain/build/binutils
cd toolchain/build/binutils
2022-10-02 17:58:52 +00:00
unset CC
unset CXX
../binutils-$LUNA_BINUTILS_VERSION_REQUIRED/configure --prefix="$BUILD_PREFIX" --target=$BUILD_TARGET --disable-nls --with-sysroot=$BUILD_SYSROOT --disable-werror | filter-lines "binutils" "configure"
2022-09-05 14:13:51 +00:00
echo Building Binutils...
make -j$(nproc) | filter-lines "binutils" "build"
2022-09-05 14:13:51 +00:00
echo Installing Binutils...
make install | filter-lines "binutils" "install"