#!/usr/bin/env bash set -e source $(dirname $0)/setup-env.sh cd $LUNA_ROOT # libstdc++ needs autoconf (precisely version 2.69) so if the user has an older/more recent version, we must build autoconf from source. export AUTOCONF_VERSION=2.69 mkdir -p toolchain/tarballs mkdir -p toolchain/build if [ ! -f toolchain/tarballs/autoconf-$AUTOCONF_VERSION.tar.gz ]; then echo "Downloading autoconf (precisely version 2.69)..." wget -Otoolchain/tarballs/autoconf-$AUTOCONF_VERSION.tar.gz https://ftp.gnu.org/gnu/autoconf/autoconf-$AUTOCONF_VERSION.tar.gz fi rm -rf toolchain/build/build-autoconf rm -rf toolchain/build/autoconf-$AUTOCONF_VERSION echo "Extracting autoconf (precisely version 2.69)..." tar xf toolchain/tarballs/autoconf-$AUTOCONF_VERSION.tar.gz -C toolchain/build/ mkdir -p toolchain/build/build-autoconf cd toolchain/build/build-autoconf unset CC unset CXX unset LD unset AR echo "Building autoconf (precisely version 2.69)..." ../autoconf-$AUTOCONF_VERSION/configure --prefix="/" make DESTDIR=$LUNA_ROOT/toolchain/dist make install cd $LUNA_ROOT mv toolchain/dist/bin/* toolchain/dist