1#!/bin/sh -e 2 3# Simple script to build GCC natively including its prerequisites. 4# 5# Depending on your needs you maybe able to speed up the GCC build: 6# 7# (a) Do not build a c++ compiler 8# c++ is only needed for "make check" and running regression tests 9# --> choose LANGUEGES=c below 10# (b) Do not build a compiler that can produce 32-bit executables 11# on a 64-bit platform 12# --> choose MULTILIB=--disable-multilib below 13# 14# Define the following 5 variables: 15 16BUILD_DIR=/tmp/build-gcc 17INSTALL_DIR=/tmp/install 18 19GCC_VERSION=5.1.0 20LANGUAGES=c,c++ 21MULTILIB= 22#LANGUAGES=c 23#MULTILIB=--disable-multilib 24 25#----------------------------------------------------------- 26# No changes should be needed below this line 27#----------------------------------------------------------- 28 29# Create build directory 30echo "...creating build directory $BUILD_DIR" 31mkdir -p $BUILD_DIR 32cd $BUILD_DIR 33 34# Download tarballs 35echo "...downloading tarball" 36wget ftp://ftp.gnu.org/gnu/gcc/gcc-$GCC_VERSION/gcc-$GCC_VERSION.tar.bz2 37 38# Build GCC 39echo "...building GCC" 40rm -rf gcc-$GCC_VERSION 41tar xf gcc-$GCC_VERSION.tar.bz2 42cd gcc-$GCC_VERSION 43./contrib/download_prerequisites 44cd .. 45rm -rf objdir 46mkdir objdir 47cd objdir 48../gcc-$GCC_VERSION/configure --prefix=$INSTALL_DIR --disable-bootstrap \ 49 $MULTILIB --enable-languages=$LANGUAGES 2>&1 > gcc-config.log 50make -s 2>&1 > gcc-make.log 51make -s install 2>&1 > gcc-install.log 52mv gcc-config.log gcc-make.log gcc-install.log .. 53 54# done 55echo "...done" 56