3 ####################################################################################
5 # Created : Mon Jan 22 14:23:10 2007
6 # Author : Vadim SANDLER, Open CASCADE SAS (vadim.sandler@opencascade.com)
8 # Module : Installation Wizard
9 # Copyright : 2002-2007 CEA
11 # This script is the part of the SALOME installation procedure.
13 ####################################################################################
15 if [ "x$GCC_VERSION" == "x" ] ; then
18 GCC_VERSION_MAJ=`echo $GCC_VERSION | awk -F[.-] '{if(NF>0) print $1; else print 0}'`
19 GCC_VERSION_MIN=`echo $GCC_VERSION | awk -F[.-] '{if(NF>1) print $2; else print 0}'`
20 GCC_VERSION_REL=`echo $GCC_VERSION | awk -F[.-] '{if(NF>2) print $3; else print 0}'`
21 let GCC_VERSION_ID=$GCC_VERSION_MAJ*10000+$GCC_VERSION_MIN*100+$GCC_VERSION_REL
25 # version number is calculated as: <major>*10000+<minor>*100+<release>
26 # e.g. for gcc 3.2 it is equal to 30200, for gcc 3.3.2 - 30202
27 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}'`
28 if [ $gcc_ver -eq $GCC_VERSION_ID ] ; then
34 # looks for the native product and collects it's environment (used by make_env())
36 gcc_root="`where_gcc $GCC_VERSION`"
37 if [ -n "${gcc_root}" ] ; then
38 gcc_root=`cd ${gcc_root}/..; pwd`
39 # get version number: <major>, <minor> and <release>
40 # <major> and <minor> numbers are checked strickly, but <release> number can be larger than required one
41 # version number is calculated as: <major>*10000+<minor>*100+<release>
42 # e.g. for gcc 3.2 it is equal to 30200, for gcc 3.3.2 - 30202
43 maj_ver=`${gcc_root}/bin/gcc -dumpversion | awk -F[.-] '{if(NF>0) print $1; else print 0}'`
44 min_ver=`${gcc_root}/bin/gcc -dumpversion | awk -F[.-] '{if(NF>1) print $2; else print 0}'`
45 rel_ver=`${gcc_root}/bin/gcc -dumpversion | awk -F[.-] '{if(NF>2) print $3; else print 0}'`
46 let gcc_ver=$maj_ver*10000+$min_ver*100+$rel_ver
47 if [ $gcc_ver -ge $GCC_VERSION_ID ] ; then
48 tmp="\${GCC_ROOT}/bin ${gcc_root}/bin \${PATH} ${PATH}";
49 path=`sort_path ${tmp}`
50 tmp="\${GCC_ROOT}/lib ${gcc_root}/lib \${LD_LIBRARY_PATH} ${LD_LIBRARY_PATH}";
51 ld_library_path=`sort_path ${tmp}`
52 cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh <<EOF
53 #$DELIM ${PRODUCT_TYPE} $DELIM
54 export GCC_ROOT=${gcc_root}
55 export CXX=\${GCC_ROOT}/bin/g++
56 export CC=\${GCC_ROOT}/bin/gcc
58 export LD_LIBRARY_PATH=${ld_library_path}
61 make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}"
62 ####### THIS COULD BE USED FOR STRICT COMPARISON ##############################
63 # if [ $maj_ver -eq 3 ] && [ $min_ver -eq 2 ] && [ $rel_ver -eq 0 ] ; then
64 ######################################################################################
65 if [ $maj_ver -eq $GCC_VERSION_MAJ ] && [ $min_ver -eq $GCC_VERSION_MIN ] && [ $rel_ver -ge $GCC_VERSION_REL ] ; then
76 #echo "It is impossible to install gcc from binaries or sources! So native gcc will be used."
81 export INSTALL_WORK=$2;
83 export INSTALL_ROOT=$4;
84 export PRODUCT_SEQUENCE=$5;
85 export PRODUCT_TYPE=$6;
86 export INSTALL_PRODUCTS=$7;
87 export PRODUCT="gcc-$GCC_VERSION"
88 export PRODUCT_DIR=${INSTALL_ROOT}/${PRODUCT}
89 export PRODUCT_WORK=${INSTALL_WORK}/${PRODUCT}