Luna/tools/setup-binutils.sh

51 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
rm -rf toolchain/build/binutils-$LUNA_ARCH
2022-10-02 17:58:52 +00:00
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
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-$LUNA_ARCH
2022-09-05 14:13:51 +00:00
cd toolchain/build/binutils-$LUNA_ARCH
2022-09-05 14:13:51 +00:00
2022-10-02 17:58:52 +00:00
unset CC
unset CXX
unset LD
unset AR
2022-10-02 17:58:52 +00:00
../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
2022-09-05 14:13:51 +00:00
echo Building Binutils...
make -j$(nproc)
2022-09-05 14:13:51 +00:00
echo Installing Binutils...
make install