3 # Make sure that libgmp and libmpfr are installed before you run this script.
4 # On Debian systems, e.g. Ubuntu, you can install these libraries as follows:
5 # sudo apt-get install libgmp3-dev libmpfr-dev. In openSUSE these packages
6 # are called gmp-devel and mpfr-devel.
10 FSF_MIRROR=ftp://ftp.easynet.be/gnu
12 DOWNLOADS=$SRCDIR/downloads
13 SRC=$HOME/software/gcc-${GCC_VERSION}
15 TAR=gcc-${GCC_VERSION}.tar.bz2
16 PREFIX=$HOME/gcc-${GCC_VERSION}
18 export MAKEFLAGS="-j$(($(grep -c '^processor' /proc/cpuinfo) + 1))"
20 if [ ! -e /usr/include/gmp.h ]; then
21 echo "Please install the gmp library development package first."
25 if [ ! -e /usr/include/mpfr.h ]; then
26 echo "Please install the mpfr library development package first."
30 if [ ! -e /usr/include/mpc.h ]; then
31 echo "Please install the mpc library development package first."
35 rm -rf ${BUILD} || exit $?
36 rm -rf ${PREFIX} || exit $?
37 mkdir -p ${DOWNLOADS} || exit $?
38 mkdir -p ${BUILD} || exit $?
39 cd ${BUILD} || exit $?
41 if [ ! -e $DOWNLOADS/$TAR ]; then
43 if cd $DOWNLOADS; then
44 wget -q $FSF_MIRROR/gcc/gcc-${GCC_VERSION}/$TAR \
45 || { wget -q -O- $FSF_MIRROR/gcc/gcc-${GCC_VERSION}/${TAR%bz2}gz \
46 | gzip -cd | bzip2 -9 >${TAR}; }
51 if [ ! -e $SRC ]; then
52 ( cd $SRCDIR && tar -xjf $DOWNLOADS/$TAR )
56 --disable-linux-futex \
59 --enable-languages=c,c++ \
60 --enable-threads=posix \
64 time { make -s && make -s install; }