Skip to content

Instantly share code, notes, and snippets.

@RTfXGaGeqSeItbMUgpFlekUs
Created July 4, 2010 01:05
Show Gist options
  • Save RTfXGaGeqSeItbMUgpFlekUs/462987 to your computer and use it in GitHub Desktop.
Save RTfXGaGeqSeItbMUgpFlekUs/462987 to your computer and use it in GitHub Desktop.
#!/bin/sh
# This should be pretty straightforward, and yes I know that it
# supports GNU way too much.
BINUTILS_VERSION=2.20.1
GMP_VERSION=5.0.1
MPFR_VERSION=3.0.0
GCC_VERSION=4.4.3
TARGET=x86_64-elf
PREFIX=`pwd`/../Root.$TARGET
echo "Creating toolkit."
echo "Downloading files..."
echo "Binutils..."
if [ ! -e binutils-$BINUTILS_VERSION.tar.bz2 ]; then
ftp ftp://ftp.gnu.org/gnu/binutils/binutils-$BINUTILS_VERSION.tar.bz2
fi
echo "Done downloading Binutils."
echo "GMP..."
if [ ! -e gmp-$GMP_VERSION.tar.bz2 ]; then
ftp ftp://ftp.gnu.org/gnu/gmp/gmp-$GMP_VERSION.tar.bz2
fi
echo "Done downloading GMP."
echo "MPFR..."
if [ ! -e mpfr-$MPFR_VERSION.tar.bz2 ]; then
ftp ftp://ftp.gnu.org/gnu/mpfr/mpfr-$MPFR_VERSION.tar.bz2
fi
echo "Done downloading MPFR."
echo "GCC..."
if [ ! -e gcc-$GCC_VERSION.tar.bz2 ]; then
ftp ftp://ftp.gnu.org/gnu/gcc/gcc-$GCC_VERSION/gcc-$GCC_VERSION.tar.bz2
fi
echo "Done downloading GCC."
echo "Done downloading files."
echo "Cleaning files."
rm -rf binutils-$BINUTILS_VERSION
rm -rf gmp-$GMP_VERSION
rm -rf mpfr-$MPFR_VERSION
rm -rf gcc-$GCC_VERSION
echo -n "Unextracting Binutils..."
bzcat binutils-$BINUTILS_VERSION.tar.bz2 | tar xf -
echo "Done."
cd binutils-$BINUTILS_VERSION
echo "Configuring Binutils."
./configure --target=$TARGET --prefix=$PREFIX --disable-nls
echo "Done configuring Binutils."
echo "Making Binutils."
gmake -j5 all
echo "Done making Binutils."
echo "Installing Binutils."
gmake -j5 install
echo "Done installing Binutils."
cd ..
echo -n "Unextracting GMP..."
bzcat gmp-$GMP_VERSION.tar.bz2 | tar xf -
echo "Done."
cd gmp-$GMP_VERSION
echo "Configuring GMP."
./configure --prefix=$PREFIX
echo "Done configuring GMP."
echo "Making GMP."
gmake -j5 all
echo "Done making GMP."
echo "Installing GMP."
gmake -j5 install
echo "Done installing GMP."
cd ..
echo -n "Unextracting MPFR..."
bzcat mpfr-$MPFR_VERSION.tar.bz2 | tar xf -
echo "Done."
cd mpfr-$MPFR_VERSION
echo "Configuring MPFR."
./configure --prefix=$PREFIX --with-gmp=$PREFIX
echo "Done configuring MPFR."
echo "Making MPFR."
gmake -j5 all
echo "Done making MPFR."
echo "Installing MPFR."
gmake -j5 install
echo "Done installing MPFR."
cd ..
echo -n "Unextracting GCC..."
bzcat gcc-$GCC_VERSION.tar.bz2 | tar xf -
echo "Done."
cd gcc-$GCC_VERSION
echo "Configuring GCC."
./configure --target=$TARGET --prefix=$PREFIX --disable-nls \
--enable-languages=c --without-headers --with-gmp=$PREFIX \
--with-mpfr=$PREFIX
echo "Done configuring GCC."
echo "Making GCC."
gmake -j5 all-gcc
echo "Done making GCC."
echo "Installing GCC."
gmake -j5 install-gcc
echo "Done installing GCC."
cd ..
echo "Done creating toolkit."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment