gcc_fullbuild

$ cat gcc_fullbuild
#!/bin/sh

#
# mayank@21st June, 2007
# This script will be used to kickoff gcc fullbuild for
# the new gcc 4.2.0 suite.
# This is version 1 and very rudimentary. Will refine as
# and when we make progress.
#

#
# Here is the directory structure to start with
# All sources are in current directory and so is this script
# gcc_build:
#               Place where all build activity take place
# logs:
#               All logs go here
# gcc4.2obj:
#               gcc 4.2.0 builds here
# binutils2.17obj:
#               binutils2.17 builds here
#


startdir=$(pwd)

#
# we assume at this point that all code has been checked
# out and is ready to build. Before we go ahead with the
# build we will flip all code once and chmod them
#
chmod -R 777 *
find . -type f -exec flip -u {} \;


#
#
# Cleanup all old binaries if present
#
#

mkdir gcc_build
cd gcc_build

#
# Initialize Logs
#
rm -rf logs
mkdir logs

#
# Install all prereqs
#

##########################################
#       Install gnu make 3.81
##########################################
mkdir make3.81obj
cd make3.81obj
$startdir/make-3.81/configure --build=i586-pc-interix3 --host=i586-pc-interix3 >>$startdir/gcc_build/logs/make.configure 2>&1
make >$startdir/gcc_build/logs/make.make 2>&1
make install  >$startdir/gcc_build/logs/make.install 2>&1
cp /usr/local/bin/make /bin/gmake

#########################################
#       Install m4 1.4.9
#########################################
cd ..
mkdir m41.4.9obj
cd m41.4.9obj
$startdir/m4-1.4.9/configure --build=i586-pc-interix3 --host=i586-pc-interix3 >$startdir/gcc_build/logs/m4.configure 2>&1
gmake >$startdir/gcc_build/logs/m4.gmake 2>&1
gmake install >$startdir/gcc_build/logs/m4.install 2>&1
cp /usr/local/bin/m4 /bin/m4


########################################
#       Install sed 4.1.5
########################################
cd ..
mkdir sed4.1.5obj
cd sed4.1.5obj
$startdir/sed-4.1.5/configure --build=i586-pc-interix3 --host=i586-pc-interix3 >$startdir/gcc_build/logs/sed.configure 2>&1
gmake >$startdir/gcc_build/logs/sed.gmake 2>&1
gmake install >$startdir/gcc_build/logs/sed.install 2>&1
cp /usr/local/bin/sed /bin/sed

########################################
#       Install bison 2.3
########################################
rm /bin/bison
rm /usr/local/bin/bison
rm /usr/local/lib/libintl.so*
cd ..
mkdir bison2.3obj
cd bison2.3obj
$startdir/bison-2.3/configure --build=i586-pc-interix3 --host=i586-pc-interix3 >$startdir/gcc_build/logs/bison.configure 2>&1
gmake >$startdir/gcc_build/logs/bison.gmake 2>&1
gmake install >$startdir/gcc_build/logs/bison.install 2>&1
cp /usr/local/bin/bison /bin/bison

########################################
#       Install flex 2.5.33
########################################
rm /bin/flex
rm /usr/local/bin/flex
rm /usr/local/lib/libintl.so*
rm /usr/lib/libintl.so*
cd ..
mkdir flex2.5.33obj
cd flex2.5.33obj
$startdir/flex-2.5.33/configure --build=i586-pc-interix3 --host=i586-pc-interix3 >$startdir/gcc_build/logs/flex.configure 2>&1
gmake >$startdir/gcc_build/logs/flex.gmake 2>&1
gmake install >$startdir/gcc_build/logs/flex.install 2>&1
cp /usr/local/bin/flex /bin/flex

########################################
#       Install gettext 0.16
########################################
rm /usr/local/lib/libintl.so*
cd ..
mkdir gettext0.16obj
cd gettext0.16obj
export CXXFLAGS=-D_ALL_SOURCE
$startdir/gettext-0.16/configure --build=i586-pc-interix3 --host=i586-pc-interix3 >$startdir/gcc_build/logs/gettext.configure 2>&1
gmake >$startdir/gcc_build/logs/gettext.gmake 2>&1
gmake install >$startdir/gcc_build/logs/gettext.install 2>&1
cp /usr/local/bin/msgattrib /bin
cp /usr/local/bin/msgcat /bin
cp /usr/local/bin/msgcmp /bin
cp /usr/local/bin/msgcomm /bin
cp /usr/local/bin/msgconv /bin
cp /usr/local/bin/msgexec /bin
cp /usr/local/bin/msgen /bin
cp /usr/local/bin/msgfilter /bin
cp /usr/local/bin/msgfmt /bin
cp /usr/local/bin/msggrep /bin
cp /usr/local/bin/msginit /bin
cp /usr/local/bin/msgmerge /bin
cp /usr/local/bin/msgunfmt /bin
cp /usr/local/bin/msguniq /bin

cp /usr/local/lib/libintl.so.* /usr/lib
chmod 777 /usr/local/lib/libintl.so.*
chmod 777 /usr/lib/libintl.so.*


########################################
#       Install gmp 4.2.1
########################################
cd ..
mkdir gmp4.2.1obj
cd gmp4.2.1obj
$startdir/gmp-4.2.1/configure --build=i586-pc-interix3 --host=i586-pc-interix3 >$startdir/gcc_build/logs/gmp.configure 2>&1
gmake >$startdir/gcc_build/logs/gmp.gmake 2>&1
gmake install >$startdir/gcc_build/logs/gmp.install 2>&1
cp /usr/local/bin/msgattrib /bin

########################################
#       Install mpfr 2.2.1
########################################
cd ..
mkdir mpfr2.2.1obj
cd mpfr2.2.1obj
$startdir/mpfr-2.2.1/configure --build=i586-pc-interix3 --host=i586-pc-interix3 --with-gmp=/usr/local >$startdir/gcc_build/logs/mpfr.configure 2>&1
gmake >$startdir/gcc_build/logs/mpfr.gmake 2>&1
gmake install >$startdir/gcc_build/logs/mpfr.install 2>&1
cp /usr/local/bin/msgattrib /bin

########################################
#       Install dejagnu 1.4.4 (For Running GCC Testsuites)
########################################
cd ..
mkdir dejagnu1.4.4obj
cd dejagnu1.4.4obj
$startdir/dejagnu-1.4.4/configure --build=i586-pc-interix3 --host=i586-pc-interix3 >$startdir/gcc_build/logs/dejagnu.configure 2>&1
gmake >$startdir/gcc_build/logs/dejagnu.gmake 2>&1
gmake install >$startdir/gcc_build/logs/dejagnu.install 2>&1
cp /usr/local/bin/runtest  /bin


########################################
#       Install Tcl 8.4.15 (For Running GCC Testsuites)
########################################
cd ..
mkdir tcl8.4.15obj
cd tcl8.4.15obj
export CFLAGS=-D_ALL_SOURCE
$startdir/tcl8.4.15/unix/configure --build=i586-pc-interix3 --host=i586-pc-interix3 >$startdir/gcc_build/logs/tcl.configure 2>&1
gmake >$startdir/gcc_build/logs/tcl.gmake 2>&1
gmake install >$startdir/gcc_build/logs/tcl.install 2>&1

########################################
#       Install expect 5.26(For Running GCC Testsuites)
########################################
cd ..
mkdir expect5.26obj
cd expect5.26obj
$startdir/expect/configure --build=i586-pc-interix3 --host=i586-pc-interix3 --with-tclinclude=$startdir/tcl8.4.15/generic >$startdir/gcc_build/logs/expect.configure 2>&1
gmake >$startdir/gcc_build/logs/expect.gmake 2>&1
gmake install >$startdir/gcc_build/logs/expect.install 2>&1
cp /usr/local/bin/expect /bin


########################################
#       Kick gcc 4.2.0 build
########################################
if (
cd ..
rm -rf gcc4.2obj
mkdir gcc4.2obj
cd gcc4.2obj

## Configure the gcc 4.2.0 suite
$startdir/gcc-4.2.0/configure --prefix=/opt/gcc.4.2 --enable-languages=c,c++,objc --enable-threads=posix --with-stabs --enable-nls --enable-shared --disable-libssp --with-gnu-as --with-gnu-ld --with-gmp=/usr/local --with-mpfr=/usr/local --host=i586-pc-interix3 >$startdir/gcc_build/logs/gcc4.2.configure 2>&1

##make all three stages
gmake >$startdir/gcc_build/logs/gcc4.2.gmake 2>&1

##install gcc
gmake install >$startdir/gcc_build/logs/gcc4.2.install 2>&1
)
then    :
else
        echo "\nGCC BUILD FAILED"
fi

##run gcc internal testsuites
export TCL_LIBRARY=$startdir/tcl8.4.15/library
export DEJAGNULIBS=/usr/local/share/dejagnu
cd ..\gcc4.2obj
gmake -k check >$startdir/gcc_build/logs/gcc4.2.tests 2>&1
cd ..


########################################
#       Kick binutils 2.17 built
########################################
rm -rf binutils2.17obj
mkdir binutils2.17obj
cd binutils2.17obj
$startdir/binutils-2.17/configure --prefix=/opt/gcc.4.2 --host=i586-pc-interix3 >$startdir/gcc_build/logs/binutils.configure 2>&1
gmake >$startdir/gcc_build/logs/binutils.gmake 2>&1
gmake install >$startdir/gcc_build/logs/binutils.install 2>&1
cp /usr/local/bin/ar /opt/gcc.4.2/bin
cp /usr/local/bin/as /opt/gcc.4.2/bin
cp /usr/local/bin/ld /opt/gcc.4.2/bin
cp /usr/local/bin/nm /opt/gcc.4.2/bin
cp /usr/local/bin/objdump /opt/gcc.4.2/bin
cp /usr/local/bin/objcopy /opt/gcc.4.2/bin
cp /usr/local/bin/ranlib /opt/gcc.4.2/bin
cp /usr/local/bin/strip /opt/gcc.4.2/bin
cp /usr/local/bin/size /opt/gcc.4.2/bin
cp /usr/local/bin/strings /opt/gcc.4.2/bin
cp /usr/local/bin/addr2line /opt/gcc.4.2/bin
cp /usr/local/bin/c++filt /opt/gcc.4.2/bin

export PATH=/bin:/opt/gcc.4.2/bin:/usr/contrib/bin:/usr/X11R6/bin:/usr/local/bin:/usr/contrib/win32/bin:/dev/fs/E/Windows/System32:/dev/fs/E/Windows/SUA/common:/dev/fs/E/Program Files/Vim/vim70

cp -f /opt/gcc.3.3/include/dlfcn.h /opt/gcc.4.2/include/
chmod 775 /opt/gcc.4.2/include/dlfcn.h

##run gcc internal testsuites with binutils2.17
cd ..\gcc4.2obj\gcc
mv testsuite testsuite_with_binutils2.33
cd ..
gmake -k check


$