4 # version number is calculated as: <major>*10000+<minor>*100+<release>
5 # e.g. for gcc 3.2 it is equal to 30200, for gcc 3.3.2 - 30202
6 gcc_ver=`gcc -dumpversion | awk -F. '{v1=0;v2=0;v3=0;if(NF>0)v1=$1;if(NF>1)v2=$2;if(NF>2)v3=$3;print v1*10000+v2*100+v3}'`
7 if [ $gcc_ver -eq 30200 ] ; then
14 cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh <<EOF
15 #$DELIM ${PRODUCT_TYPE} $DELIM
16 export GCC_ROOT=\${INSTALL_ROOT}/${PRODUCT}
17 export CXX=\${GCC_ROOT}/bin/g++
18 export CC=\${GCC_ROOT}/bin/gcc
19 export PATH=\${GCC_ROOT}/bin:\${PATH}
20 export LD_LIBRARY_PATH=\${GCC_ROOT}/lib:\${LD_LIBRARY_PATH}
23 (test -w ${PRODUCT_DIR} && cp ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh ${PRODUCT_DIR})
24 make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}"
27 # looks for the native product and collects it's environment (used by make_env())
29 gcc_root="`where_gcc 3.2.0`"
30 if [ -n "${gcc_root}" ] ; then
31 gcc_root=`cd ${gcc_root}/..; pwd`
32 # get version number: <major>, <minor> and <release>
33 # <major> and <minor> numbers are checked strickly, but <release> number can be larger than required one
34 # version number is calculated as: <major>*10000+<minor>*100+<release>
35 # e.g. for gcc 3.2 it is equal to 30200, for gcc 3.3.2 - 30202
36 maj_ver=`${gcc_root}/bin/gcc -dumpversion | awk -F. '{if(NF>0) print $1; else print 0}'`
37 min_ver=`${gcc_root}/bin/gcc -dumpversion | awk -F. '{if(NF>1) print $2; else print 0}'`
38 rel_ver=`${gcc_root}/bin/gcc -dumpversion | awk -F. '{if(NF>2) print $3; else print 0}'`
39 let gcc_ver=$maj_ver*10000+$min_ver*100+$rel_ver
40 if [ $gcc_ver -ge 30200 ] ; then
41 tmp="\${GCC_ROOT}/bin ${gcc_root}/bin \${PATH} ${PATH}";
42 path=`sort_path ${tmp}`
43 tmp="\${GCC_ROOT}/lib ${gcc_root}/lib \${LD_LIBRARY_PATH} ${LD_LIBRARY_PATH}";
44 ld_library_path=`sort_path ${tmp}`
45 cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh <<EOF
46 #$DELIM ${PRODUCT_TYPE} $DELIM
47 export GCC_ROOT=${gcc_root}
48 export CXX=\${GCC_ROOT}/bin/g++
49 export CC=\${GCC_ROOT}/bin/gcc
51 export LD_LIBRARY_PATH=${ld_library_path}
54 make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}"
55 ####### THIS COULD BE USED FOR STRICT COMPARISON ##############################
56 # if [ $maj_ver -eq 3 ] && [ $min_ver -eq 2 ] && [ $rel_ver -eq 0 ] ; then
57 ######################################################################################
58 if [ $maj_ver -eq 3 ] && [ $min_ver -eq 2 ] && [ $rel_ver -ge 0 ] ; then
69 try_existing ${PRODUCT_DIR} ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" ${PRODUCT_TYPE}
77 echo "It impossible to build gcc-3.2 on your current compiler (gcc-3.2)."
78 echo "Installation aborted."
82 make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" ${PRODUCT_TYPE}
83 source ${INSTALL_WORK}/$SHRC
85 #check if $LIBRARY_PATH and $GCC_EXEC_PREFIX are set and then remove path to current dir from them
86 if [ -n "$LIBRARY_PATH" ]; then
87 export LIBRARY_PATH=`echo $LIBRARY_PATH | sed -e's/^[:\;]*//g' -e's/[:\;]*$//g' -e's/::*/:/g' -e's/;;*/;/g' -e's/[:\;].$//g' -e's/^.[:\;]//g' -e's/[:\;].[:\;]/:/g' -e's/^.$//g'`
89 if [ -n "$GCC_EXEC_PREFIX" ]; then
90 export GCC_EXEC_PREFIX=`echo $GCC_EXEC_PREFIX | sed -e's/^[:\;]*//g' -e's/[:\;]*$//g' -e's/::*/:/g' -e's/;;*/;/g' -e's/[:\;].$//g' -e's/^.[:\;]//g' -e's/[:\;].[:\;]/:/g' -e's/^.$//g'`
93 check_jb tar xfz ${SOURCE_DIR}/gcc-3.2.tar.gz -C ${INSTALL_WORK}
95 makedir ${PRODUCT_DIR}
97 makedir ${PRODUCT_WORK}-build
98 cd ${PRODUCT_WORK}-build
100 check_job ${PRODUCT_DIR}/CONFIGURE.LOG ${PRODUCT_WORK}/configure --prefix=${PRODUCT_DIR} --enable-static --enable-shared --enable-threads
101 check_job ${PRODUCT_DIR}/BOOTSTRAP.LOG make bootstrap
102 check_job ${PRODUCT_DIR}/INSTALL.LOG make install
104 cd ${PRODUCT_DIR}; rm -fr ${PRODUCT_WORK} ${PRODUCT_WORK}-build
110 echo "It impossible to install gcc from binaries, try install from sources."
115 export INSTALL_WORK=$2;
116 export SOURCE_DIR=$3;
117 export INSTALL_ROOT=$4;
118 export PRODUCT_SEQUENCE=$5;
119 if [ $# == 6 ] ; then export PRODUCT_TYPE=$6 ; else export PRODUCT_TYPE="gcc" ; fi
120 export PRODUCT="gcc-3.2"
121 export PRODUCT_DIR=${INSTALL_ROOT}/${PRODUCT}
122 export PRODUCT_WORK=${INSTALL_WORK}/${PRODUCT}