tools: Build autoconf if needed and use it to patch libstdc++
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
apio 2023-08-14 11:18:53 +02:00
parent db3151d93b
commit cad0bd8c48
Signed by: apio
GPG Key ID: B8A7D06E42258954
4 changed files with 67 additions and 1 deletions

40
tools/setup-autoconf.sh Executable file
View File

@ -0,0 +1,40 @@
#!/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.xz -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

View File

@ -36,6 +36,10 @@ patch -u -i $LUNA_ROOT/tools/gcc.patch -p 1 -d build
cd -
cd toolchain/build/gcc-$LUNA_GCC_VERSION_REQUIRED/libstdc++-v3
autoconf
cd -
echo Configuring GCC...
mkdir -p toolchain/build/gcc-$LUNA_ARCH

View File

@ -1,6 +1,12 @@
#!/usr/bin/env bash
set -e
if ! $(dirname $0)/test-autoconf.sh
then
echo Building autoconf...
$(dirname $0)/setup-autoconf.sh
fi
if ! $(dirname $0)/test-binutils.sh
then
echo Building Binutils...

16
tools/test-autoconf.sh Executable file
View File

@ -0,0 +1,16 @@
#!/usr/bin/env bash
set -e
source $(dirname $0)/setup-env.sh
if [ -x "$(command -v autoconf)" ]
then
if [ "$(autoconf --version | head -n 1 | awk '{ print $4 }')" == "2.69" ]
then
exit 0
else
echo "You have autoconf installed, but it is not version 2.69, which is required by libstdc++. Thus, we must build autoconf from source."
exit 1
fi
else
exit 1
fi