bart | 523c304 | 2008-06-18 08:26:45 +0000 | [diff] [blame] | 1 | #!/bin/bash |
bart | e3f4071 | 2008-06-04 18:08:10 +0000 | [diff] [blame] | 2 | |
| 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. |
| 7 | |
| 8 | |
bart | 6897818 | 2009-07-28 08:01:40 +0000 | [diff] [blame] | 9 | GCC_VERSION=4.4.1 |
bart | e3f4071 | 2008-06-04 18:08:10 +0000 | [diff] [blame] | 10 | FSF_MIRROR=ftp://ftp.easynet.be/gnu |
| 11 | SRCDIR=$HOME/software |
| 12 | DOWNLOADS=$SRCDIR/downloads |
| 13 | SRC=$HOME/software/gcc-${GCC_VERSION} |
| 14 | BUILD=${SRC}-build |
| 15 | TAR=gcc-${GCC_VERSION}.tar.bz2 |
| 16 | PREFIX=$HOME/gcc-${GCC_VERSION} |
bart | 6d60658 | 2008-06-12 13:49:49 +0000 | [diff] [blame] | 17 | export LC_ALL=C |
bart | f0fca44 | 2008-06-04 18:57:08 +0000 | [diff] [blame] | 18 | export MAKEFLAGS="-j$(($(grep -c '^processor' /proc/cpuinfo) + 1))" |
bart | e3f4071 | 2008-06-04 18:08:10 +0000 | [diff] [blame] | 19 | |
| 20 | if [ ! -e /usr/include/gmp.h ]; then |
| 21 | echo "Please install the gmp library development package first." |
| 22 | exit 1 |
| 23 | fi |
| 24 | |
| 25 | if [ ! -e /usr/include/mpfr.h ]; then |
| 26 | echo "Please install the mpfr library development package first." |
| 27 | exit 1 |
| 28 | fi |
| 29 | |
| 30 | rm -rf ${BUILD} || exit $? |
| 31 | rm -rf ${PREFIX} || exit $? |
bart | e3f4071 | 2008-06-04 18:08:10 +0000 | [diff] [blame] | 32 | mkdir -p ${DOWNLOADS} || exit $? |
bart | 62bc412 | 2008-06-28 09:59:35 +0000 | [diff] [blame] | 33 | mkdir -p ${BUILD} || exit $? |
bart | e3f4071 | 2008-06-04 18:08:10 +0000 | [diff] [blame] | 34 | cd ${BUILD} || exit $? |
| 35 | |
| 36 | if [ ! -e $DOWNLOADS/$TAR ]; then |
bart | 4e267ff | 2008-07-04 14:47:27 +0000 | [diff] [blame] | 37 | ( |
| 38 | if cd $DOWNLOADS; then |
| 39 | wget -q $FSF_MIRROR/gcc/gcc-${GCC_VERSION}/$TAR \ |
| 40 | || { wget -q -O- $FSF_MIRROR/gcc/gcc-${GCC_VERSION}/${TAR%bz2}gz \ |
| 41 | | gzip -cd | bzip2 -9 >${TAR}; } |
| 42 | fi |
| 43 | ) |
bart | e3f4071 | 2008-06-04 18:08:10 +0000 | [diff] [blame] | 44 | fi |
| 45 | |
| 46 | if [ ! -e $SRC ]; then |
| 47 | ( cd $SRCDIR && tar -xjf $DOWNLOADS/$TAR ) |
| 48 | fi |
| 49 | |
| 50 | ${SRC}/configure \ |
| 51 | --disable-linux-futex \ |
| 52 | --disable-mudflap \ |
| 53 | --disable-nls \ |
| 54 | --enable-languages=c,c++ \ |
| 55 | --enable-threads=posix \ |
| 56 | --enable-tls \ |
| 57 | --prefix=$PREFIX |
| 58 | |
bart | f0fca44 | 2008-06-04 18:57:08 +0000 | [diff] [blame] | 59 | time { make -s && make -s install; } |