#
####################################################################################
-check_version(){
-# version number is calculated as: <major>*10000+<minor>*100+<release>
-# e.g. for gcc 3.2 it is equal to 30200, for gcc 3.3.2 - 30202
-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}'`
-if [ $gcc_ver -eq 30200 ] ; then
- return 0
-fi
-return 1
-}
-
-print_env(){
-cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh <<EOF
-#$DELIM ${PRODUCT_TYPE} $DELIM
-export GCC_ROOT=\${INSTALL_ROOT}/${PRODUCT}
-export CXX=\${GCC_ROOT}/bin/g++
-export CC=\${GCC_ROOT}/bin/gcc
-export PATH=\${GCC_ROOT}/bin:\${PATH}
-export LD_LIBRARY_PATH=\${GCC_ROOT}/lib:\${LD_LIBRARY_PATH}
-##
-EOF
-(test -w ${PRODUCT_DIR} && cp ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh ${PRODUCT_DIR})
-make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}"
-}
-
-# looks for the native product and collects it's environment (used by make_env())
-try_native(){
-gcc_root="`where_gcc 3.2.0`"
-if [ -n "${gcc_root}" ] ; then
- gcc_root=`cd ${gcc_root}/..; pwd`
- # get version number: <major>, <minor> and <release>
- # <major> and <minor> numbers are checked strickly, but <release> number can be larger than required one
- # version number is calculated as: <major>*10000+<minor>*100+<release>
- # e.g. for gcc 3.2 it is equal to 30200, for gcc 3.3.2 - 30202
- maj_ver=`${gcc_root}/bin/gcc -dumpversion | awk -F[.-] '{if(NF>0) print $1; else print 0}'`
- min_ver=`${gcc_root}/bin/gcc -dumpversion | awk -F[.-] '{if(NF>1) print $2; else print 0}'`
- rel_ver=`${gcc_root}/bin/gcc -dumpversion | awk -F[.-] '{if(NF>2) print $3; else print 0}'`
- let gcc_ver=$maj_ver*10000+$min_ver*100+$rel_ver
- if [ $gcc_ver -ge 30200 ] ; then
- tmp="\${GCC_ROOT}/bin ${gcc_root}/bin \${PATH} ${PATH}";
- path=`sort_path ${tmp}`
- tmp="\${GCC_ROOT}/lib ${gcc_root}/lib \${LD_LIBRARY_PATH} ${LD_LIBRARY_PATH}";
- ld_library_path=`sort_path ${tmp}`
- cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh <<EOF
-#$DELIM ${PRODUCT_TYPE} $DELIM
-export GCC_ROOT=${gcc_root}
-export CXX=\${GCC_ROOT}/bin/g++
-export CC=\${GCC_ROOT}/bin/gcc
-export PATH=${path}
-export LD_LIBRARY_PATH=${ld_library_path}
-##
-EOF
- make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}"
-####### THIS COULD BE USED FOR STRICT COMPARISON ##############################
-# if [ $maj_ver -eq 3 ] && [ $min_ver -eq 2 ] && [ $rel_ver -eq 0 ] ; then
-######################################################################################
- if [ $maj_ver -eq 3 ] && [ $min_ver -eq 2 ] && [ $rel_ver -ge 0 ] ; then
- return 0
- else
- return 2
- fi
- fi
-fi
-return 1
-}
-
-try_preinstalled(){
-try_existing ${PRODUCT_DIR} ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" ${PRODUCT_TYPE}
-return $?
-}
-
-install_source()
-{
-check_version
-if [ $? == 0 ] ; then
- echo "It impossible to build gcc-3.2 on your current compiler (gcc-3.2)."
- echo "Installation aborted."
- return 1
-fi
-
-make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" ${PRODUCT_TYPE}
-source ${INSTALL_WORK}/$SHRC
-
-#check if $LIBRARY_PATH and $GCC_EXEC_PREFIX are set and then remove path to current dir from them
-if [ -n "$LIBRARY_PATH" ]; then
-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'`
-fi
-if [ -n "$GCC_EXEC_PREFIX" ]; then
-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'`
-fi
-
-check_jb tar xfz ${SOURCE_DIR}/gcc-3.2.tar.gz -C ${INSTALL_WORK}
-
-makedir ${PRODUCT_DIR}
-
-makedir ${PRODUCT_WORK}-build
-cd ${PRODUCT_WORK}-build
-
-check_job ${PRODUCT_DIR}/CONFIGURE.LOG ${PRODUCT_WORK}/configure --prefix=${PRODUCT_DIR} --enable-static --enable-shared --enable-threads
-check_job ${PRODUCT_DIR}/BOOTSTRAP.LOG make bootstrap
-check_job ${PRODUCT_DIR}/INSTALL.LOG make install
-
-cd ${PRODUCT_DIR}; rm -fr ${PRODUCT_WORK} ${PRODUCT_WORK}-build
-print_env
-}
-
-install_binary()
-{
-echo "It impossible to install gcc from binaries, try install from sources."
-return 1
-}
-
-export PROCEDURE=$1;
-export INSTALL_WORK=$2;
-export SOURCE_DIR=$3;
-export INSTALL_ROOT=$4;
-export PRODUCT_SEQUENCE=$5;
-if [ $# == 6 ] ; then export PRODUCT_TYPE=$6 ; else export PRODUCT_TYPE="gcc" ; fi
-export PRODUCT="gcc-3.2"
-export PRODUCT_DIR=${INSTALL_ROOT}/${PRODUCT}
-export PRODUCT_WORK=${INSTALL_WORK}/${PRODUCT}
-source ./common.sh
-$PROCEDURE
+export GCC_VERSION="3.2"
+./gcc-common.sh $*
#
####################################################################################
-check_version(){
-# version number is calculated as: <major>*10000+<minor>*100+<release>
-# e.g. for gcc 3.2 it is equal to 30200, for gcc 3.4.1 - 30401, for gcc 3.3.5 - 30305
-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}'`
-if [ $gcc_ver -eq 30305 ] ; then
- return 0
-fi
-return 1
-}
-
-print_env(){
-cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh <<EOF
-#$DELIM ${PRODUCT_TYPE} $DELIM
-export GCC_ROOT=\${INSTALL_ROOT}/${PRODUCT}
-export CXX=\${GCC_ROOT}/bin/g++
-export CC=\${GCC_ROOT}/bin/gcc
-export PATH=\${GCC_ROOT}/bin:\${PATH}
-export LD_LIBRARY_PATH=\${GCC_ROOT}/lib:\${LD_LIBRARY_PATH}
-##
-EOF
-(test -w ${PRODUCT_DIR} && cp ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh ${PRODUCT_DIR})
-make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}"
-}
-
-# looks for the native product and collects it's environment (used by make_env())
-try_native(){
-gcc_root="`where_gcc 3.3.5`"
-if [ -n "${gcc_root}" ] ; then
- gcc_root=`cd ${gcc_root}/..; pwd`
- # get version number: <major>, <minor> and <release>
- # <major> and <minor> numbers are checked strickly, but <release> number can be larger than required one
- # version number is calculated as: <major>*10000+<minor>*100+<release>
- # e.g. for gcc 3.2 it is equal to 30200, for gcc 3.4.1 - 30401, for gcc 3.3.5 - 30305
- maj_ver=`${gcc_root}/bin/gcc -dumpversion | awk -F[.-] '{if(NF>0) print $1; else print 0}'`
- min_ver=`${gcc_root}/bin/gcc -dumpversion | awk -F[.-] '{if(NF>1) print $2; else print 0}'`
- rel_ver=`${gcc_root}/bin/gcc -dumpversion | awk -F[.-] '{if(NF>2) print $3; else print 0}'`
- let gcc_ver=$maj_ver*10000+$min_ver*100+$rel_ver
- if [ $gcc_ver -ge 30305 ] ; then
- tmp="\${GCC_ROOT}/bin ${gcc_root}/bin \${PATH} ${PATH}";
- path=`sort_path ${tmp}`
- tmp="\${GCC_ROOT}/lib ${gcc_root}/lib \${LD_LIBRARY_PATH} ${LD_LIBRARY_PATH}";
- ld_library_path=`sort_path ${tmp}`
- cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh <<EOF
-#$DELIM ${PRODUCT_TYPE} $DELIM
-export GCC_ROOT=${gcc_root}
-export CXX=\${GCC_ROOT}/bin/g++
-export CC=\${GCC_ROOT}/bin/gcc
-export PATH=${path}
-export LD_LIBRARY_PATH=${ld_library_path}
-##
-EOF
- make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}"
-####### THIS COULD BE USED FOR STRICT COMPARISON ##############################
-# if [ $maj_ver -eq 3 ] && [ $min_ver -eq 4 ] && [ $rel_ver -eq 1 ] ; then
-######################################################################################
- if [ $maj_ver -eq 3 ] && [ $min_ver -eq 3 ] && [ $rel_ver -ge 5 ] ; then
- return 0
- else
- return 2
- fi
- fi
-fi
-return 1
-}
-
-try_preinstalled(){
-try_existing ${PRODUCT_DIR} ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" ${PRODUCT_TYPE}
-return $?
-}
-
-install_source()
-{
-echo "The installation of gcc 3.3.5 from sources is not provided! Use native gcc."
-return 1
-}
-
-install_binary()
-{
-echo "The installation of gcc 3.3.5 from binaries is not provided! Use native gcc."
-return 1
-}
-
-export PROCEDURE=$1;
-export INSTALL_WORK=$2;
-export SOURCE_DIR=$3;
-export INSTALL_ROOT=$4;
-export PRODUCT_SEQUENCE=$5;
-if [ $# == 6 ] ; then export PRODUCT_TYPE=$6 ; else export PRODUCT_TYPE="gcc" ; fi
-export PRODUCT="gcc-3.3.5"
-export PRODUCT_DIR=${INSTALL_ROOT}/${PRODUCT}
-export PRODUCT_WORK=${INSTALL_WORK}/${PRODUCT}
-source ./common.sh
-$PROCEDURE
+export GCC_VERSION="3.3.5"
+./gcc-common.sh $*
#
####################################################################################
-check_version(){
-# version number is calculated as: <major>*10000+<minor>*100+<release>
-# e.g. for gcc 3.2 it is equal to 30200, for gcc 3.4.1 - 30401
-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}'`
-if [ $gcc_ver -eq 30401 ] ; then
- return 0
-fi
-return 1
-}
-
-print_env(){
-cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh <<EOF
-#$DELIM ${PRODUCT_TYPE} $DELIM
-export GCC_ROOT=\${INSTALL_ROOT}/${PRODUCT}
-export CXX=\${GCC_ROOT}/bin/g++
-export CC=\${GCC_ROOT}/bin/gcc
-export PATH=\${GCC_ROOT}/bin:\${PATH}
-export LD_LIBRARY_PATH=\${GCC_ROOT}/lib:\${LD_LIBRARY_PATH}
-##
-EOF
-(test -w ${PRODUCT_DIR} && cp ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh ${PRODUCT_DIR})
-make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}"
-}
-
-# looks for the native product and collects it's environment (used by make_env())
-try_native(){
-gcc_root="`where_gcc 3.4.1`"
-if [ -n "${gcc_root}" ] ; then
- gcc_root=`cd ${gcc_root}/..; pwd`
- # get version number: <major>, <minor> and <release>
- # <major> and <minor> numbers are checked strickly, but <release> number can be larger than required one
- # version number is calculated as: <major>*10000+<minor>*100+<release>
- # e.g. for gcc 3.2 it is equal to 30200, for gcc 3.4.1 - 30401
- maj_ver=`${gcc_root}/bin/gcc -dumpversion | awk -F[.-] '{if(NF>0) print $1; else print 0}'`
- min_ver=`${gcc_root}/bin/gcc -dumpversion | awk -F[.-] '{if(NF>1) print $2; else print 0}'`
- rel_ver=`${gcc_root}/bin/gcc -dumpversion | awk -F[.-] '{if(NF>2) print $3; else print 0}'`
- let gcc_ver=$maj_ver*10000+$min_ver*100+$rel_ver
- if [ $gcc_ver -ge 30401 ] ; then
- tmp="\${GCC_ROOT}/bin ${gcc_root}/bin \${PATH} ${PATH}";
- path=`sort_path ${tmp}`
- tmp="\${GCC_ROOT}/lib ${gcc_root}/lib \${LD_LIBRARY_PATH} ${LD_LIBRARY_PATH}";
- ld_library_path=`sort_path ${tmp}`
- cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh <<EOF
-#$DELIM ${PRODUCT_TYPE} $DELIM
-export GCC_ROOT=${gcc_root}
-export CXX=\${GCC_ROOT}/bin/g++
-export CC=\${GCC_ROOT}/bin/gcc
-export PATH=${path}
-export LD_LIBRARY_PATH=${ld_library_path}
-##
-EOF
- make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}"
-####### THIS COULD BE USED FOR STRICT COMPARISON ##############################
-# if [ $maj_ver -eq 3 ] && [ $min_ver -eq 4 ] && [ $rel_ver -eq 1 ] ; then
-######################################################################################
- if [ $maj_ver -eq 3 ] && [ $min_ver -eq 4 ] && [ $rel_ver -ge 1 ] ; then
- return 0
- else
- return 2
- fi
- fi
-fi
-return 1
-}
-
-try_preinstalled(){
-try_existing ${PRODUCT_DIR} ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" ${PRODUCT_TYPE}
-return $?
-}
-
-install_source()
-{
-echo "The installation of gcc 3.4.1 from sources is not provided! Use native gcc."
-return 1
-}
-
-install_binary()
-{
-echo "The installation of gcc 3.4.1 from binaries is not provided! Use native gcc."
-return 1
-}
-
-export PROCEDURE=$1;
-export INSTALL_WORK=$2;
-export SOURCE_DIR=$3;
-export INSTALL_ROOT=$4;
-export PRODUCT_SEQUENCE=$5;
-if [ $# == 6 ] ; then export PRODUCT_TYPE=$6 ; else export PRODUCT_TYPE="gcc" ; fi
-export PRODUCT="gcc-3.4.1"
-export PRODUCT_DIR=${INSTALL_ROOT}/${PRODUCT}
-export PRODUCT_WORK=${INSTALL_WORK}/${PRODUCT}
-source ./common.sh
-$PROCEDURE
+export GCC_VERSION="3.4.1"
+./gcc-common.sh $*
--- /dev/null
+#!/bin/bash -noprofile
+
+####################################################################################
+# File : gcc-4.0.0.sh
+# Created : Thu Dec 18 12:01:00 2002
+# Author : Vadim SANDLER, Open CASCADE SAS (vadim.sandler@opencascade.com)
+# Project : SALOME
+# Module : Installation Wizard
+# Copyright : 2002-2006 CEA
+#
+# This script is the part of the SALOME installation procedure.
+#
+####################################################################################
+
+export GCC_VERSION="4.0.0"
+./gcc-common.sh $*
#
####################################################################################
-check_version(){
-# version number is calculated as: <major>*10000+<minor>*100+<release>
-# e.g. for gcc 3.2 it is equal to 30200, for gcc 3.4.1 - 30401, for gcc 4.0.1 - 40001
-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}'`
-if [ $gcc_ver -eq 40001 ] ; then
- return 0
-fi
-return 1
-}
-
-print_env(){
-cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh <<EOF
-#$DELIM ${PRODUCT_TYPE} $DELIM
-export GCC_ROOT=\${INSTALL_ROOT}/${PRODUCT}
-export CXX=\${GCC_ROOT}/bin/g++
-export CC=\${GCC_ROOT}/bin/gcc
-export PATH=\${GCC_ROOT}/bin:\${PATH}
-export LD_LIBRARY_PATH=\${GCC_ROOT}/lib:\${LD_LIBRARY_PATH}
-##
-EOF
-(test -w ${PRODUCT_DIR} && cp ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh ${PRODUCT_DIR})
-make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}"
-}
-
-# looks for the native product and collects it's environment (used by make_env())
-try_native(){
-gcc_root="`where_gcc 4.0.1`"
-if [ -n "${gcc_root}" ] ; then
- gcc_root=`cd ${gcc_root}/..; pwd`
- # get version number: <major>, <minor> and <release>
- # <major> and <minor> numbers are checked strickly, but <release> number can be larger than required one
- # version number is calculated as: <major>*10000+<minor>*100+<release>
- # e.g. for gcc 3.2 it is equal to 30200, for gcc 3.4.1 - 30401, for gcc 4.0.1 - 40001
- maj_ver=`${gcc_root}/bin/gcc -dumpversion | awk -F[.-] '{if(NF>0) print $1; else print 0}'`
- min_ver=`${gcc_root}/bin/gcc -dumpversion | awk -F[.-] '{if(NF>1) print $2; else print 0}'`
- rel_ver=`${gcc_root}/bin/gcc -dumpversion | awk -F[.-] '{if(NF>2) print $3; else print 0}'`
- let gcc_ver=$maj_ver*10000+$min_ver*100+$rel_ver
- if [ $gcc_ver -ge 40001 ] ; then
- tmp="\${GCC_ROOT}/bin ${gcc_root}/bin \${PATH} ${PATH}";
- path=`sort_path ${tmp}`
- tmp="\${GCC_ROOT}/lib ${gcc_root}/lib \${LD_LIBRARY_PATH} ${LD_LIBRARY_PATH}";
- ld_library_path=`sort_path ${tmp}`
- cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh <<EOF
-#$DELIM ${PRODUCT_TYPE} $DELIM
-export GCC_ROOT=${gcc_root}
-export CXX=\${GCC_ROOT}/bin/g++
-export CC=\${GCC_ROOT}/bin/gcc
-export PATH=${path}
-export LD_LIBRARY_PATH=${ld_library_path}
-##
-EOF
- make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}"
-####### THIS COULD BE USED FOR STRICT COMPARISON ##############################
-# if [ $maj_ver -eq 4 ] && [ $min_ver -eq 0 ] && [ $rel_ver -eq 1 ] ; then
-######################################################################################
- if [ $maj_ver -eq 4 ] && [ $min_ver -eq 0 ] && [ $rel_ver -ge 1 ] ; then
- return 0
- else
- return 2
- fi
- fi
-fi
-return 1
-}
-
-try_preinstalled(){
-try_existing ${PRODUCT_DIR} ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" ${PRODUCT_TYPE}
-return $?
-}
-
-install_source()
-{
-echo "The installation of gcc 4.0.1 from sources is not provided! Use native gcc."
-return 1
-}
-
-install_binary()
-{
-echo "The installation of gcc 4.0.1 from binaries is not provided! Use native gcc."
-return 1
-}
-
-export PROCEDURE=$1;
-export INSTALL_WORK=$2;
-export SOURCE_DIR=$3;
-export INSTALL_ROOT=$4;
-export PRODUCT_SEQUENCE=$5;
-if [ $# == 6 ] ; then export PRODUCT_TYPE=$6 ; else export PRODUCT_TYPE="gcc" ; fi
-export PRODUCT="gcc-3.4.1"
-export PRODUCT_DIR=${INSTALL_ROOT}/${PRODUCT}
-export PRODUCT_WORK=${INSTALL_WORK}/${PRODUCT}
-source ./common.sh
-$PROCEDURE
+export GCC_VERSION="4.0.1"
+./gcc-common.sh $*
--- /dev/null
+#!/bin/bash -noprofile
+
+####################################################################################
+# File : gcc-common.sh
+# Created : Mon Jan 22 14:23:10 2007
+# Author : Vadim SANDLER, Open CASCADE SAS (vadim.sandler@opencascade.com)
+# Project : SALOME
+# Module : Installation Wizard
+# Copyright : 2002-2007 CEA
+#
+# This script is the part of the SALOME installation procedure.
+#
+####################################################################################
+
+if [ "x$GCC_VERSION" == "x" ] ; then
+ GCC_VERSION="3.2"
+fi
+GCC_VERSION_MAJ=`echo $GCC_VERSION | awk -F[.-] '{if(NF>0) print $1; else print 0}'`
+GCC_VERSION_MIN=`echo $GCC_VERSION | awk -F[.-] '{if(NF>1) print $2; else print 0}'`
+GCC_VERSION_REL=`echo $GCC_VERSION | awk -F[.-] '{if(NF>2) print $3; else print 0}'`
+let GCC_VERSION_ID=$GCC_VERSION_MAJ*10000+$GCC_VERSION_MIN*100+$GCC_VERSION_REL
+
+check_version(){
+# version number is calculated as: <major>*10000+<minor>*100+<release>
+# e.g. for gcc 3.2 it is equal to 30200, for gcc 3.3.2 - 30202
+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}'`
+if [ $gcc_ver -eq $GCC_VERSION_ID ] ; then
+ return 0
+fi
+return 1
+}
+
+print_env(){
+cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh <<EOF
+#$DELIM ${PRODUCT_TYPE} $DELIM
+export GCC_ROOT=\${INSTALL_ROOT}/${PRODUCT}
+export CXX=\${GCC_ROOT}/bin/g++
+export CC=\${GCC_ROOT}/bin/gcc
+export PATH=\${GCC_ROOT}/bin:\${PATH}
+export LD_LIBRARY_PATH=\${GCC_ROOT}/lib:\${LD_LIBRARY_PATH}
+##
+EOF
+(test -w ${PRODUCT_DIR} && cp ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh ${PRODUCT_DIR})
+make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}"
+}
+
+# looks for the native product and collects it's environment (used by make_env())
+try_native(){
+gcc_root="`where_gcc $GCC_VERSION`"
+if [ -n "${gcc_root}" ] ; then
+ gcc_root=`cd ${gcc_root}/..; pwd`
+ # get version number: <major>, <minor> and <release>
+ # <major> and <minor> numbers are checked strickly, but <release> number can be larger than required one
+ # version number is calculated as: <major>*10000+<minor>*100+<release>
+ # e.g. for gcc 3.2 it is equal to 30200, for gcc 3.3.2 - 30202
+ maj_ver=`${gcc_root}/bin/gcc -dumpversion | awk -F[.-] '{if(NF>0) print $1; else print 0}'`
+ min_ver=`${gcc_root}/bin/gcc -dumpversion | awk -F[.-] '{if(NF>1) print $2; else print 0}'`
+ rel_ver=`${gcc_root}/bin/gcc -dumpversion | awk -F[.-] '{if(NF>2) print $3; else print 0}'`
+ let gcc_ver=$maj_ver*10000+$min_ver*100+$rel_ver
+ if [ $gcc_ver -ge $GCC_VERSION_ID ] ; then
+ tmp="\${GCC_ROOT}/bin ${gcc_root}/bin \${PATH} ${PATH}";
+ path=`sort_path ${tmp}`
+ tmp="\${GCC_ROOT}/lib ${gcc_root}/lib \${LD_LIBRARY_PATH} ${LD_LIBRARY_PATH}";
+ ld_library_path=`sort_path ${tmp}`
+ cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh <<EOF
+#$DELIM ${PRODUCT_TYPE} $DELIM
+export GCC_ROOT=${gcc_root}
+export CXX=\${GCC_ROOT}/bin/g++
+export CC=\${GCC_ROOT}/bin/gcc
+export PATH=${path}
+export LD_LIBRARY_PATH=${ld_library_path}
+##
+EOF
+ make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}"
+####### THIS COULD BE USED FOR STRICT COMPARISON ##############################
+# if [ $maj_ver -eq 3 ] && [ $min_ver -eq 2 ] && [ $rel_ver -eq 0 ] ; then
+######################################################################################
+ if [ $maj_ver -eq $GCC_VERSION_MAJ ] && [ $min_ver -eq $GCC_VERSION_MIN ] && [ $rel_ver -ge $GCC_VERSION_REL ] ; then
+ return 0
+ else
+ return 2
+ fi
+ fi
+fi
+return 1
+}
+
+try_preinstalled(){
+try_existing ${PRODUCT_DIR} ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" ${PRODUCT_TYPE}
+return $?
+}
+
+install_source()
+{
+echo "The installation of gcc $GCC_VERSION from sources is not provided! Use native gcc."
+return 1
+}
+
+install_binary()
+{
+echo "It impossible to install gcc $GCC_VERSION from binaries, try install from sources."
+return 1
+}
+
+export PROCEDURE=$1;
+export INSTALL_WORK=$2;
+export SOURCE_DIR=$3;
+export INSTALL_ROOT=$4;
+export PRODUCT_SEQUENCE=$5;
+if [ $# == 6 ] ; then export PRODUCT_TYPE=$6 ; else export PRODUCT_TYPE="gcc" ; fi
+export PRODUCT="gcc-$GCC_VERSION"
+export PRODUCT_DIR=${INSTALL_ROOT}/${PRODUCT}
+export PRODUCT_WORK=${INSTALL_WORK}/${PRODUCT}
+source ./common.sh
+$PROCEDURE