2020-01-22 01:45:13 +03:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
set -e
|
|
|
|
set -x
|
|
|
|
|
|
|
|
PREFIX="$(pwd)"
|
|
|
|
TARGET=i386-elf
|
2020-03-13 19:04:51 +03:00
|
|
|
BINUTILSVERSION=2.34
|
2020-07-24 16:56:58 +03:00
|
|
|
GCCVERSION=10.2.0
|
2020-01-22 01:45:13 +03:00
|
|
|
|
|
|
|
if [ -z "$MAKEFLAGS" ]; then
|
|
|
|
MAKEFLAGS="$1"
|
|
|
|
fi
|
|
|
|
export MAKEFLAGS
|
|
|
|
|
|
|
|
export PATH="$PREFIX/bin:$PATH"
|
|
|
|
|
|
|
|
if [ -x "$(command -v gmake)" ]; then
|
|
|
|
mkdir -p "$PREFIX/bin"
|
|
|
|
cat <<EOF >"$PREFIX/bin/make"
|
|
|
|
#!/usr/bin/env sh
|
|
|
|
gmake "\$@"
|
|
|
|
EOF
|
|
|
|
chmod +x "$PREFIX/bin/make"
|
|
|
|
fi
|
|
|
|
|
|
|
|
mkdir -p build
|
|
|
|
cd build
|
|
|
|
|
|
|
|
if [ ! -f binutils-$BINUTILSVERSION.tar.gz ]; then
|
|
|
|
wget https://ftp.gnu.org/gnu/binutils/binutils-$BINUTILSVERSION.tar.gz
|
|
|
|
fi
|
|
|
|
if [ ! -f gcc-$GCCVERSION.tar.gz ]; then
|
|
|
|
wget https://ftp.gnu.org/gnu/gcc/gcc-$GCCVERSION/gcc-$GCCVERSION.tar.gz
|
|
|
|
fi
|
|
|
|
|
|
|
|
tar -xf binutils-$BINUTILSVERSION.tar.gz
|
|
|
|
tar -xf gcc-$GCCVERSION.tar.gz
|
|
|
|
|
|
|
|
rm -rf build-gcc build-binutils
|
|
|
|
|
|
|
|
mkdir build-binutils
|
|
|
|
cd build-binutils
|
|
|
|
../binutils-$BINUTILSVERSION/configure --target=$TARGET --prefix="$PREFIX" --with-sysroot --disable-nls --disable-werror
|
|
|
|
make
|
|
|
|
make install
|
|
|
|
cd ..
|
|
|
|
|
|
|
|
cd gcc-$GCCVERSION
|
|
|
|
contrib/download_prerequisites
|
|
|
|
cd ..
|
|
|
|
mkdir build-gcc
|
|
|
|
cd build-gcc
|
|
|
|
../gcc-$GCCVERSION/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
|