summaryrefslogtreecommitdiff
path: root/tools/dep_builders/gcc
blob: 4c32b53429d14dd98ba897df253000bf869f3019 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/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/"
export CACHE="$(pwd)/toolchain/cache/"
export PATH="$(pwd)/toolchain/bin/:$PATH"
export TARGET=i686-elf


# 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

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 $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 $CACHE

echo "downloading required libraries..."
cd $CACHE/$TOOL-$VER
./contrib/download_prerequisites

echo "building..."
rm -rf $CACHE/$TOOL-$VER/builddir
mkdir $CACHE/$TOOL-$VER/builddir
cd $CACHE/$TOOL-$VER/builddir

../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