From e2b9d3d34b54767e01c8555e7e672e7ce2dc400c Mon Sep 17 00:00:00 2001 From: dzwdz Date: Fri, 6 Aug 2021 15:38:06 +0000 Subject: a (seemingly broken) gcc build script It compiles, but the resulting gcc binary doesn't actually work. Maybe it's too new for the binutils? --- tools/dep_builders/gcc | 53 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100755 tools/dep_builders/gcc (limited to 'tools') diff --git a/tools/dep_builders/gcc b/tools/dep_builders/gcc new file mode 100755 index 0000000..69b4fcc --- /dev/null +++ b/tools/dep_builders/gcc @@ -0,0 +1,53 @@ +#!/bin/sh +set -eu + +TOOL="gcc" +VER="11.2.0" +# this is ugly +{ HASHES=$(cat) ; } <<'HASHES' +f0837f1bf8244a5cc23bd96ff6366712a791cfae01df8e25b137698aca26efc1 toolchain/cache/gcc-11.2.0.tar.gz +HASHES + +export PREFIX="$(pwd)/toolchain/$TOOL-$VER/" +export TARGET=i686-elf +export PATH="$(pwd)/toolchain/binutils-2.37/bin/:$PATH" + + +# ensure that we're in the repo root +if [ ! -d .git ]; then + echo please cd to the repo\'s main directory + exit +fi + +mkdir -p $PREFIX/build + + +echo "downloading missing files..." +tools/dep_builders/dl "https://ftp.gnu.org/gnu/$TOOL/$TOOL-$VER/$TOOL-$VER.tar.gz" +tools/dep_builders/dl "https://ftp.gnu.org/gnu/$TOOL/$TOOL-$VER/$TOOL-$VER.tar.gz.sig" +tools/dep_builders/dl "https://ftp.gnu.org/gnu/gnu-keyring.gpg" + +echo "verifying signatures..." +if ! gpg --verify --keyring toolchain/cache/gnu-keyring.gpg toolchain/cache/$TOOL-$VER.tar.gz.sig +then + echo "THE SIGNATURE COULDN'T BE VERIFIED. something's fishy." + exit +fi +echo "$HASHES" | sha256sum --check || exit + +echo "unpacking the tarball..." +tar xf toolchain/cache/$TOOL-$VER.tar.gz -C toolchain/cache +UNPACKED="$(pwd)/toolchain/cache/$TOOL-$VER/" + +echo "downloading required libraries..." +cd $UNPACKED +./contrib/download_prerequisites + +echo "building..." +cd $PREFIX/build + +$UNPACKED/configure --target=$TARGET --prefix="$PREFIX" --disable-nls --enable-languages=c --without-headers +make all-gcc +make all-target-libgcc +make install-gcc +make install-target-libgcc -- cgit v1.2.3