scriptgcc-4.7.3_UBUNTU12_64BITS.sh compila e instala o gcc-4.7.3 no ubuntu 64bits
tempo de compilação em um AMD M300 = ~ 3 horas
http://sourceforge.net/projects/scriptkernel/files/?source=navbar#!/bin/bash
#
# Script de compilação automatica do GCC para UBUNTU 12.04+ 64 BITS,
# baixa e instala todas as dependencias e compiladores automaticamente
#
# GPL-3.0
#
#
# como executar:
#
# $ time sudo bash scriptgcc-4.X.X_UBUNTU12_64BITS.sh
#
#
# tempo de compilação em um Acer Aspire 4540 AMD Athlon M300 4GB: ~3 horas
#
##################################################################################
###########################################
### escolha aqui a versão do GCC a ser compilada ##################
vs=4.7.3
###################
# versão das dependencias principais ################################
gmpvs=5.1.1
mpfrvs=3.1.2
mpcvs=1.0.1
###################
#CL=$(grep -c processor /proc/cpuinfo)
# baixando dependencias do GCC via apt-get ########
sudo apt-get install gcc g++ build-essential make libgmp3-dev libgmp3c2 libmpfr-dev libmpc-dev flex bison -y
sudo apt-get build-dep gcc-4.6 g++-4.6 gcj-4.6 -y
sudo apt-get install gmpc mpc fixincludes -y
sudo mkdir /home/gcc-$vs
cd /home/gcc-$vs
# baixando e compilando as dependencias principais #################
wget -c http://mirrors.kernel.org/gnu/gmp/gmp-$gmpvs.tar.bz2
tar -jxpvf gmp-$gmpvs.tar.bz2
cd /home/gcc-$vs/gmp-$gmpvs
sudo ./configure
sudo make -j2
sudo make -j2 check
sudo make -j2 install
#
cd /home/gcc-$vs
#
wget -c http://mirrors.kernel.org/gnu/mpfr/mpfr-$mpfrvs.tar.bz2
tar -jxpvf mpfr-$mpfrvs.tar.bz2
cd /home/gcc-$vs/mpfr-$mpfrvs
sudo ./configure
sudo make -j2
sudo make -j2 check
sudo make -j2 install
#
cd /home/gcc-$vs
wget -c http://mirrors.kernel.org/gnu/mpc/mpc-$mpcvs.tar.gz
tar -zxpvf mpc-$mpcvs.tar.gz
cd /home/gcc-$vs/mpc-$mpcvs
sudo ./configure
sudo make -j2
sudo make -j2 check
sudo make -j2 install
#
#########################################################################################################
cd /home/gcc-$vs
#
# baixando e decompactando o source do GCC
wget -c http://gcc.petsads.us/releases/gcc-$vs/gcc-$vs.tar.bz2
tar -jxpvf gcc-$vs.tar.bz2
#
cd /home/gcc-$vs/gcc-$vs
#
# arquitetura utilizada na compilação ###################
#export C_INCLUDE_PATH=/usr/include/x86_64-linux-gnu
#export CPLUS_INCLUDE_PATH=/usr/include/x86_64-linux-gnu
#LIBRARY_PATH=/usr/lib/x86_64-linux-gnu
# executando a configuração das dependencias e os compiladores que serão suportados nessa versão ###########
#./configure --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --enable-shared --enable-multiarch --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --enable-nls --enable-clocale=gnu --enable-plugin --enable-objc-gc --disable-werror --with-arch-32=i686 --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu --with-gmp --with-mpfr --with-gmp-include=/home/gcc-$vs/gmp-$gmpvs/gmp --with-gmp-lib=/home/gcc-$vs/gmp-$gmpvs/.libs --with-mpfr-include=/home/gcc-$vs/mpfr-$mpfrvs/mpfr --with-mpfr-lib=/home/gcc-$vs/mpfr-$mpfrvs/.libs
#./configure -v --enable-languages=c,c++,fortran,objc --prefix=/usr --with-gmp --with-mpfr --with-gmp-include=/home/gcc-$vs/gmp-$gmpvs/gmp --with-gmp-lib=/home/gcc-$vs/gmp-$gmpvs/.libs --with-mpfr-include=/home/gcc-$vs/mpfr-$mpfrvs/mpfr --with-mpfr-lib=/home/gcc-$vs/mpfr-$mpfrvs/.libs --with-gmp-lib=/usr/local/lib --with-mpfr-lib=/usr/local/lib --with-mpc-lib=/usr/local/lib --enable-shared --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-gnu-unique-object --enable-plugin --disable-werror --with-arch-32=i686 --with-tune=generic --enable-checking=release --build=x86_64-unknown-linux-gnu --host=x86_64-unknown-linux-gnu --target=x86_64-unknown-linux-gnu
#export PROJECT_DIR=$(cd /home/gcc-4.7 && pwd && cd - &>/dev/null)
./configure -v --enable-languages=c,c++,fortran,objc,obj-c++,java --prefix=/usr --with-gmp-include=$(pwd)/../gcc-4.7.3/gmp/src --with-gmp-lib=$(pwd)/gmp/src/.libs --with-mpfr-include=$(pwd)/../gcc-4.7.3/mpfr/src --with-mpfr-lib=$(pwd)/mpfr/src/.libs --enable-shared --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --enable-java-gc=boehm --enable-java-awt=xlib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-gnu-unique-object --enable-plugin --disable-werror --with-arch-32=i686 --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
# inicia a compilação e logo depois a instalação ######################
make -j2
make -j2 install
echo 'processo terminado com exito'
executando no terminal:
$ time sudo bash scriptgcc-4.7.3_UBUNTU12_64BITS.sh