blob: 4f3a48ab7d4e316142871a306952b54be1f1b23a [file] [log] [blame]
bart523c3042008-06-18 08:26:45 +00001#!/bin/bash
barte3f40712008-06-04 18:08:10 +00002
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
bart6d606582008-06-12 13:49:49 +00009GCC_VERSION=4.3.1
barte3f40712008-06-04 18:08:10 +000010FSF_MIRROR=ftp://ftp.easynet.be/gnu
11SRCDIR=$HOME/software
12DOWNLOADS=$SRCDIR/downloads
13SRC=$HOME/software/gcc-${GCC_VERSION}
14BUILD=${SRC}-build
15TAR=gcc-${GCC_VERSION}.tar.bz2
16PREFIX=$HOME/gcc-${GCC_VERSION}
bart6d606582008-06-12 13:49:49 +000017export LC_ALL=C
bartf0fca442008-06-04 18:57:08 +000018export MAKEFLAGS="-j$(($(grep -c '^processor' /proc/cpuinfo) + 1))"
barte3f40712008-06-04 18:08:10 +000019
20if [ ! -e /usr/include/gmp.h ]; then
21 echo "Please install the gmp library development package first."
22 exit 1
23fi
24
25if [ ! -e /usr/include/mpfr.h ]; then
26 echo "Please install the mpfr library development package first."
27 exit 1
28fi
29
30rm -rf ${BUILD} || exit $?
31rm -rf ${PREFIX} || exit $?
barte3f40712008-06-04 18:08:10 +000032mkdir -p ${DOWNLOADS} || exit $?
bart62bc4122008-06-28 09:59:35 +000033mkdir -p ${BUILD} || exit $?
barte3f40712008-06-04 18:08:10 +000034cd ${BUILD} || exit $?
35
36if [ ! -e $DOWNLOADS/$TAR ]; then
37 ( cd $DOWNLOADS && wget -q $FSF_MIRROR/gcc/gcc-${GCC_VERSION}/$TAR )
38fi
39
40if [ ! -e $SRC ]; then
41 ( cd $SRCDIR && tar -xjf $DOWNLOADS/$TAR )
42fi
43
44${SRC}/configure \
45 --disable-linux-futex \
46 --disable-mudflap \
47 --disable-nls \
48 --enable-languages=c,c++ \
49 --enable-threads=posix \
50 --enable-tls \
51 --prefix=$PREFIX
52
bartf0fca442008-06-04 18:57:08 +000053time { make -s && make -s install; }