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 16 BUILD_DIR=/tmp/build-gcc 17 INSTALL_DIR=/tmp/install 18 19 GCC_VERSION=5.1.0 20 LANGUAGES=c,c++ 21 MULTILIB= 22 #LANGUAGES=c 23 #MULTILIB=--disable-multilib 24 25 #----------------------------------------------------------- 26 # No changes should be needed below this line 27 #----------------------------------------------------------- 28 29 # Create build directory 30 echo "...creating build directory $BUILD_DIR" 31 mkdir -p $BUILD_DIR 32 cd $BUILD_DIR 33 34 # Download tarballs 35 echo "...downloading tarball" 36 wget ftp://ftp.gnu.org/gnu/gcc/gcc-$GCC_VERSION/gcc-$GCC_VERSION.tar.bz2 37 38 # Build GCC 39 echo "...building GCC" 40 rm -rf gcc-$GCC_VERSION 41 tar xf gcc-$GCC_VERSION.tar.bz2 42 cd gcc-$GCC_VERSION 43 ./contrib/download_prerequisites 44 cd .. 45 rm -rf objdir 46 mkdir objdir 47 cd objdir 48 ../gcc-$GCC_VERSION/configure --prefix=$INSTALL_DIR --disable-bootstrap \ 49 $MULTILIB --enable-languages=$LANGUAGES 2>&1 > gcc-config.log 50 make -s 2>&1 > gcc-make.log 51 make -s install 2>&1 > gcc-install.log 52 mv gcc-config.log gcc-make.log gcc-install.log .. 53 54 # done 55 echo "...done" 56