3 ####################################################################################
5 # Created : Thu Dec 18 12:01:00 2002
6 # Author : Vadim SANDLER, Open CASCADE SAS (vadim.sandler@opencascade.com)
8 # Module : Installation Wizard
9 # Copyright : 2002-2006 CEA
11 # This script is the part of the SALOME installation procedure.
13 ####################################################################################
16 # version number is calculated as: <major>*10000+<minor>*100+<release>
17 # e.g. for gcc 3.2 it is equal to 30200, for gcc 3.3.2 - 30202
18 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}'`
19 if [ $gcc_ver -eq 30200 ] ; then
26 cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh <<EOF
27 #$DELIM ${PRODUCT_TYPE} $DELIM
28 export GCC_ROOT=\${INSTALL_ROOT}/${PRODUCT}
29 export CXX=\${GCC_ROOT}/bin/g++
30 export CC=\${GCC_ROOT}/bin/gcc
31 export PATH=\${GCC_ROOT}/bin:\${PATH}
32 export LD_LIBRARY_PATH=\${GCC_ROOT}/lib:\${LD_LIBRARY_PATH}
35 (test -w ${PRODUCT_DIR} && cp ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh ${PRODUCT_DIR})
36 make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}"
39 # looks for the native product and collects it's environment (used by make_env())
41 gcc_root="`where_gcc 3.2.0`"
42 if [ -n "${gcc_root}" ] ; then
43 gcc_root=`cd ${gcc_root}/..; pwd`
44 # get version number: <major>, <minor> and <release>
45 # <major> and <minor> numbers are checked strickly, but <release> number can be larger than required one
46 # version number is calculated as: <major>*10000+<minor>*100+<release>
47 # e.g. for gcc 3.2 it is equal to 30200, for gcc 3.3.2 - 30202
48 maj_ver=`${gcc_root}/bin/gcc -dumpversion | awk -F[.-] '{if(NF>0) print $1; else print 0}'`
49 min_ver=`${gcc_root}/bin/gcc -dumpversion | awk -F[.-] '{if(NF>1) print $2; else print 0}'`
50 rel_ver=`${gcc_root}/bin/gcc -dumpversion | awk -F[.-] '{if(NF>2) print $3; else print 0}'`
51 let gcc_ver=$maj_ver*10000+$min_ver*100+$rel_ver
52 if [ $gcc_ver -ge 30200 ] ; then
53 tmp="\${GCC_ROOT}/bin ${gcc_root}/bin \${PATH} ${PATH}";
54 path=`sort_path ${tmp}`
55 tmp="\${GCC_ROOT}/lib ${gcc_root}/lib \${LD_LIBRARY_PATH} ${LD_LIBRARY_PATH}";
56 ld_library_path=`sort_path ${tmp}`
57 cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh <<EOF
58 #$DELIM ${PRODUCT_TYPE} $DELIM
59 export GCC_ROOT=${gcc_root}
60 export CXX=\${GCC_ROOT}/bin/g++
61 export CC=\${GCC_ROOT}/bin/gcc
63 export LD_LIBRARY_PATH=${ld_library_path}
66 make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}"
67 ####### THIS COULD BE USED FOR STRICT COMPARISON ##############################
68 # if [ $maj_ver -eq 3 ] && [ $min_ver -eq 2 ] && [ $rel_ver -eq 0 ] ; then
69 ######################################################################################
70 if [ $maj_ver -eq 3 ] && [ $min_ver -eq 2 ] && [ $rel_ver -ge 0 ] ; then
81 try_existing ${PRODUCT_DIR} ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" ${PRODUCT_TYPE}
89 echo "It impossible to build gcc-3.2 on your current compiler (gcc-3.2)."
90 echo "Installation aborted."
94 make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" ${PRODUCT_TYPE}
95 source ${INSTALL_WORK}/$SHRC
97 #check if $LIBRARY_PATH and $GCC_EXEC_PREFIX are set and then remove path to current dir from them
98 if [ -n "$LIBRARY_PATH" ]; then
99 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'`
101 if [ -n "$GCC_EXEC_PREFIX" ]; then
102 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'`
105 check_jb tar xfz ${SOURCE_DIR}/gcc-3.2.tar.gz -C ${INSTALL_WORK}
107 makedir ${PRODUCT_DIR}
109 makedir ${PRODUCT_WORK}-build
110 cd ${PRODUCT_WORK}-build
112 check_job ${PRODUCT_DIR}/CONFIGURE.LOG ${PRODUCT_WORK}/configure --prefix=${PRODUCT_DIR} --enable-static --enable-shared --enable-threads
113 check_job ${PRODUCT_DIR}/BOOTSTRAP.LOG make bootstrap
114 check_job ${PRODUCT_DIR}/INSTALL.LOG make install
116 cd ${PRODUCT_DIR}; rm -fr ${PRODUCT_WORK} ${PRODUCT_WORK}-build
122 echo "It impossible to install gcc from binaries, try install from sources."
127 export INSTALL_WORK=$2;
128 export SOURCE_DIR=$3;
129 export INSTALL_ROOT=$4;
130 export PRODUCT_SEQUENCE=$5;
131 if [ $# == 6 ] ; then export PRODUCT_TYPE=$6 ; else export PRODUCT_TYPE="gcc" ; fi
132 export PRODUCT="gcc-3.2"
133 export PRODUCT_DIR=${INSTALL_ROOT}/${PRODUCT}
134 export PRODUCT_WORK=${INSTALL_WORK}/${PRODUCT}