Salome HOME
*** empty log message ***
[tools/install.git] / config_files / common.sh
index f5a0c1f720538b99bd1a5ba8b5bd70c678b7062a..b2acc2bafcec811ab11c85f31111c2eecb99f6ad 100755 (executable)
@@ -6,7 +6,7 @@
 #  Author    : Vadim SANDLER, Open CASCADE SAS (vadim.sandler@opencascade.com)
 #  Project   : SALOME
 #  Module    : Installation Wizard
-#  Copyright : 2002-2007 CEA
+#  Copyright : 2002-2008 CEA
 #
 #  This script is the part of the SALOME installation procedure.
 #
@@ -16,23 +16,38 @@ export DELIM="------"
 export SHRC="salome.sh"
 export CSHRC="salome.csh"
 
+#####################################################
+# !WARNING! This is current SALOME version number 
+####################################################
+export SALOME_VERSION="6.1.0"
+export YACSGEN_VERSION="6.1.0"
+export JOBMANAGER_VERSION="0.1"
 
-#this function takes several parameters
-#first parameter contains path to module source filder
-#second parameters is value of $VERSION variables form MODULE.sh file
+# Name of the single directory for SALOME modules
+export SDIR_NAME="SALOME_${SALOME_VERSION}"
 
+#this function takes one parameter - path to module source folder
 check_salome_src_version(){
 root_dir=`printenv $1`
-module_version=$2
 
 if [ -n "$root_dir" ]; then
     cfg_file=configure.ac
     if [ ! -f ${root_dir}/${cfg_file} ] ; then
        cfg_file=configure.in.base
-    fi
+       else
+           cfg_file=CMakeLists.txt
+       fi
     if [ -f ${root_dir}/${cfg_file} ] ; then
-       ver=`grep -e "^AC_INIT" ${root_dir}/${cfg_file} | sed -e "s%.*\[\([[:digit:].]*\)\].*%\1%g"`
-       if [ "$ver" = "${module_version}" ]; then
+       if [ "${cfg_file}" = "CMakeLists.txt" ] ; then
+           ver_maj=`cat ${root_dir}/${cfg_file} | grep SET\(VERSION_MAJOR | sed -e "s%[A-Z_() ]%%g"`
+           ver_min=`cat ${root_dir}/${cfg_file} | grep SET\(VERSION_MINOR | sed -e "s%[A-Z_() ]%%g"`
+           ver_maintenance=`cat ${root_dir}/${cfg_file} | grep SET\(VERSION_MAINTENANCE | sed -e "s%[A-Z_() ]%%g"`
+           ver="${ver_maj}.${ver_min}.${ver_maintenance}"
+       else
+           ver=`grep -e "^AC_INIT" ${root_dir}/${cfg_file} | sed -e "s%.*\[\([[:digit:].]*\)\].*%\1%g"`
+       fi
+
+       if [ "$ver" = "${SALOME_VERSION}" ]; then
            return 0
        fi
     fi
@@ -113,10 +128,10 @@ if [ $# -eq 4 ] ; then
     product_env=${install_work}/env_${product_name}.sh
     (test -e ${product_env} && rm ${product_env} )
 fi
-### !!! writing salome.sh file !!!  -> define INSTALL_ROOT
+### !!! writing salome.sh file !!!  -> define INST_ROOT
 cat >> ${install_work}/$SHRC <<EOF
 #${DELIM} Setting products installation directory ${DELIM}
-export INSTALL_ROOT=${install_root}
+export INST_ROOT=${install_root}
 
 #${DELIM} Environment switch: 0 for SALOME building, 1 for SALOME launching ${DELIM}
 export ENV_FOR_LAUNCH=1
@@ -150,13 +165,26 @@ done
 ### are created without using setenv(a|p) aliases.
 
 # 0. add /usr/lib or /usr/lib64 dir to the LD_LIBRARY_PATH
-if test `uname -m` = "x86_64" ; then
-echo 'export LD_LIBRARY_PATH=/usr/lib64:${LD_LIBRARY_PATH}' >> ${install_work}/$SHRC 2>/dev/null
+#if test `uname -m` = "x86_64" ; then
+#echo 'export LD_LIBRARY_PATH=/usr/lib64:${LD_LIBRARY_PATH}' >> ${install_work}/$SHRC 2>/dev/null
+#echo '' >> ${install_work}/$SHRC 2>/dev/null
+#else
+#echo 'export LD_LIBRARY_PATH=/usr/lib:${LD_LIBRARY_PATH}' >> ${install_work}/$SHRC 2>/dev/null
+#echo '' >> ${install_work}/$SHRC 2>/dev/null
+#fi
+
+# Licence activation 
+
+# Source of license environment file
+
+echo '#------ License activation ------' >> ${install_work}/$SHRC 2>/dev/null
+echo 'export LICENSE_FILE=/product/distene/dlim8.var.sh' >> ${install_work}/$SHRC 2>/dev/null
 echo '' >> ${install_work}/$SHRC 2>/dev/null
-else
-echo 'export LD_LIBRARY_PATH=/usr/lib:${LD_LIBRARY_PATH}' >> ${install_work}/$SHRC 2>/dev/null
+echo 'if [ -e "${LICENSE_FILE}" ] ; then' >> ${install_work}/$SHRC 2>/dev/null
+echo 'export SIMULOGD_LICENSE_FILE=29029@soleil' >> ${install_work}/$SHRC 2>/dev/null
+echo 'source ${LICENSE_FILE}' >> ${install_work}/$SHRC 2>/dev/null
+echo 'fi' >> ${install_work}/$SHRC 2>/dev/null
 echo '' >> ${install_work}/$SHRC 2>/dev/null
-fi
 
 # 1. first dump all environment files into the $SHRC file
 product_sequence="$2"
@@ -349,13 +377,13 @@ sed -e 's%export\([[:blank:]]*\)PYTHONPATH=\$[{]\?PYTHONPATH[}]\?:\(.*\)%exporta
 sed -e 's%export\([[:blank:]]*\)LD_RUN_PATH=\$[{]\?LD_RUN_PATH[}]\?:\(.*\)%exporta\1LD_RUN_PATH \2%g' -e 's%export\([[:blank:]]*\)LD_RUN_PATH=\(.*\):\$[{]\?LD_RUN_PATH[}]\?%exportp\1LD_RUN_PATH \2%g' ${INSTALL_WORK}/_tmp1 > ${INSTALL_WORK}/_tmp2
 
 # Setting "/usr/X11R6/lib" path in LD_LIBRARY_PATH for the libGL.so.1 file
-if test `uname -m` = "x86_64" ; then
-echo '# Setting /usr/X11R6/lib64 path in LD_LIBRARY_PATH for the libGL.so.1 file' >> ${INSTALL_WORK}/_tmp2
-echo 'export LD_LIBRARY_PATH=/usr/X11R6/lib64:${LD_LIBRARY_PATH}' >> ${INSTALL_WORK}/_tmp2
-else
-echo '# Setting /usr/X11R6/lib path in LD_LIBRARY_PATH for the libGL.so.1 file' >> ${INSTALL_WORK}/_tmp2
-echo 'export LD_LIBRARY_PATH=/usr/X11R6/lib:${LD_LIBRARY_PATH}' >> ${INSTALL_WORK}/_tmp2
-fi
+#if test `uname -m` = "x86_64" ; then
+#echo '# Setting /usr/X11R6/lib64 path in LD_LIBRARY_PATH for the libGL.so.1 file' >> ${INSTALL_WORK}/_tmp2
+#echo 'export LD_LIBRARY_PATH=/usr/X11R6/lib64:${LD_LIBRARY_PATH}' >> ${INSTALL_WORK}/_tmp2
+#else
+#echo '# Setting /usr/X11R6/lib path in LD_LIBRARY_PATH for the libGL.so.1 file' >> ${INSTALL_WORK}/_tmp2
+#echo 'export LD_LIBRARY_PATH=/usr/X11R6/lib:${LD_LIBRARY_PATH}' >> ${INSTALL_WORK}/_tmp2
+#fi
 
 cat ${INSTALL_WORK}/_tmp2 >> ${install_work}/_$SHRC
 
@@ -367,10 +395,14 @@ cat ${INSTALL_WORK}/_tmp1 >> ${install_work}/$CSHRC
 sed -e 's%export \([[:alnum:]_[:blank:]]*\)\=%setenv \1 %g' ${INSTALL_WORK}/_tmp2 > ${INSTALL_WORK}/_tmp1 2>/dev/null
 sed -e 's%exporta \([[:alnum:]_[:blank:]]*\)%setenva \1%g'  ${INSTALL_WORK}/_tmp1 > ${INSTALL_WORK}/_tmp2 2>/dev/null
 sed -e 's%exportp \([[:alnum:]_[:blank:]]*\)%setenvp \1%g'  ${INSTALL_WORK}/_tmp2 > ${INSTALL_WORK}/_tmp1 2>/dev/null
-sed -e 's%if \[ -n "\${ENV_FOR_LAUNCH}" \] ; then%if ( ${?ENV_FOR_LAUNCH} ) then%g' ${INSTALL_WORK}/_tmp1 > ${INSTALL_WORK}/_tmp2 2>/dev/null
-sed -e 's%if \[ "\${ENV_FOR_LAUNCH}" == "1" \] ; then%if ( "\${ENV_FOR_LAUNCH}" == "1" ) then%g' ${INSTALL_WORK}/_tmp2 > ${INSTALL_WORK}/_tmp1 2>/dev/null
-sed -e 's%^\([[:blank:]]*\)fi\([[:blank:]]*\)$%\1endif\2%g' ${INSTALL_WORK}/_tmp1 > ${INSTALL_WORK}/_tmp2 2>/dev/null
-cat ${INSTALL_WORK}/_tmp2 >> ${install_work}/_$CSHRC 2>/dev/null
+sed -e 's%if \[ -n "\${PYTHONPATH}" \] ; then%if ( ${?PYTHONPATH} ) then%g' ${INSTALL_WORK}/_tmp1 > ${INSTALL_WORK}/_tmp2 2>/dev/null
+sed -e 's%if \[ -n "\${ENV_FOR_LAUNCH}" \] ; then%if ( ${?ENV_FOR_LAUNCH} ) then%g' ${INSTALL_WORK}/_tmp2 > ${INSTALL_WORK}/_tmp1 2>/dev/null
+sed -e 's%if \[ "\${ENV_FOR_LAUNCH}" == "1" \] ; then%if ( "\${ENV_FOR_LAUNCH}" == "1" ) then%g' ${INSTALL_WORK}/_tmp1 > ${INSTALL_WORK}/_tmp2 2>/dev/null
+sed -e 's%^\([[:blank:]]*\)fi\([[:blank:]]*\)$%\1endif\2%g' ${INSTALL_WORK}/_tmp2 > ${INSTALL_WORK}/_tmp1 2>/dev/null
+sed -e 's%var.sh%var.csh%g' ${INSTALL_WORK}/_tmp1 > ${INSTALL_WORK}/_tmp2 2>/dev/null
+sed -e 's%if \[ -e "\${LICENSE_FILE}" \] ; then%if ( -e ${LICENSE_FILE} ) then%g' ${INSTALL_WORK}/_tmp2 > ${INSTALL_WORK}/_tmp1 2>/dev/null
+
+cat ${INSTALL_WORK}/_tmp1 >> ${install_work}/_$CSHRC 2>/dev/null
 
 rm -f ${INSTALL_WORK}/_tmp1 ${INSTALL_WORK}/_tmp2
 
@@ -632,7 +664,8 @@ if [ -z "$ldir" ] || [ ! -d "$ldir" ]; then return 1; fi
 
 srcdir=`pwd`
 
-SALOME_MODULES="`env | awk -F_ '/[[:alnum:]]*_ROOT_DIR/ { print $1 }'`"
+#SALOME_MODULES="`env | awk -F_ '/[[:alnum:]]*_ROOT_DIR/ { print $1 }'`"
+SALOME_MODULES="`env | awk -F_ '/[a-zA-Z0-9]*_ROOT_DIR/ { print $1 }'`"
 
 cd $ldir
 ldir=`pwd`
@@ -644,14 +677,23 @@ if [ "$l" != "X" ] ; then
     l=`basename $l`
     cd $ldir; cd $d
     # 1. process salome modules dependencies
+
     for mod in $SALOME_MODULES; do
        moddir=`printenv ${mod}_ROOT_DIR`
        if [ -n "${moddir}" ] ; then
            #echo $l $mod $moddir
-           sed -e "s%[[:space:]]\(-L\)\?[^[:space:]]*${mod}[^[:space:]/]*/lib% \1${moddir}/lib%g" $l > $l"_"
+#          sed -e "s%[[:space:]]\(-L\)\?[^[:space:]]*${mod}[^[:space:]/]*/\(lib\|lib64\)% \1${moddir}/${myldir}%g" $l > $l"_"
+#          sed -e "s%[[:space:]]\(-L\)\?[^[:space:]]*${mod}[^[:space:]/]*/lib% \1${moddir}/lib%g" $l > $l"_"
+           sed -e "s%[[:space:]]\(-L\)\?[^[:space:]]*${mod}[^[:space:]/]*/lib% \1${moddir}/lib%g" \
+               -e "s%^libdir='[^[:space:]]*${mod}[^[:space:]]*/\(lib.*\)'%libdir='${moddir}/\1'%g" $l > $l"_"
            mv -f $l"_" $l
+#          for mod1 in $SALOME_MODULES; do
+#              sed     -e "s%[[:space:]]\(-L\)\?[^[:space:]]*${mod1}[^[:space:]]*/${mod1}_build%%g" $l > $l"_"
+#              mv -f $l"_" $l
+#          done
        fi
     done
+
     # 2. process CAS.CADE dependencies
     casdir=`printenv CASROOT`/lib
     if [ ! -d ${casdir} ] ; then casdir=`printenv CASROOT`/Linux/lib ; fi
@@ -662,24 +704,34 @@ if [ "$l" != "X" ] ; then
            -e "s%[[:space:]]\(-L\)\?[^[:space:]]*\(OCT\|CAS\)[^[:space:]/]*/lin/lib% \1${casdir}%g"   \
            -e "s%[[:space:]]\(-L\)\?[^[:space:]]*\(OCT\|CAS\)[^[:space:]/]*/lib% \1${casdir}%g" $l > $l"_"
        mv -f $l"_" $l
+       sed -e "s%-L[^[:space:]]*OCCT[^[:space:]]*/Linux/lib%-L${casdir}%g" \
+           -e "s%[^[:space:]]*OCCT[^[:space:]]*/lib/%${casdir}/%g" $l > $l"_"
+       mv -f $l"_" $l
     fi
     # 3. process omniORB dependencies
     omnidir=`printenv OMNIORBDIR`/lib/i586_linux_2.0_glibc2.1
     if [ ! -d ${omnidir} ] ; then omnidir=`printenv OMNIORBDIR`/lib ; fi
     if [ -n "${OMNIORBDIR}" ] && [ -d "${omnidir}" ] ; then
        # echo $l $OMNIORBDIR $omnidir
-       sed -e "s%-L[^[:space:]]*omni[^[:space:]]*%-L${omnidir}%g" $l > $l"_"
+       sed -e "s%-L[^[:space:]]*omni[^[:space:]]*%-L${omnidir}%g" \
+           -e "s%-R[^[:space:]]*omni[^[:space:]]*%-R${omnidir}%g" $l > $l"_"
        mv -f $l"_" $l
     fi
     # 4. process VTK dependencies
-    if test `uname -m` = "x86_64" ; then
-    vtkdir=`printenv VTKHOME`/lib64/vtk
+    vtkpath=`printenv VTKHOME`
+    if [ `uname -m` = "x86_64" ] && [ -d ${vtkpath}/lib64 ] ; then
+       LIB_PREFIX=64
+    elif [ -d ${vtkpath}/lib ] ; then
+       LIB_PREFIX=""
     else
-    vtkdir=`printenv VTKHOME`/lib/vtk
+       LIB_PREFIX=64
     fi
-    if [ -n "${VTKHOME}" ] && [ -d "${vtkdir}" ] ; then
+    vtkldir=${vtkpath}/lib${LIB_PREFIX}
+    vtkdir=${vtkldir}/vtk-5.0
+    if [ -n "${VTKHOME}" ] && [ -d "${vtkdir}" ] && [ -d "${vtkldir}" ] ; then
        # echo $l $VTKHOME $vtkdir
-       sed -e "s%-L[^[:space:]]*VTK[^[:space:]]*/\(lib\|lib64\)/vtk%-L${vtkdir}%g" $l > $l"_"
+       sed -e "s%-L[^[:space:]]*VTK[^[:space:]]*/\(lib\|lib64\)/vtk\-5\.0%-L${vtkdir}%g" \
+           -e "s%-L[^[:space:]]*VTK[^[:space:]]*/\(lib\|lib64\)%-L${vtkldir}%g" $l > $l"_"
        mv -f $l"_" $l
     fi
     # 5. process HDF dependencies
@@ -728,7 +780,7 @@ if [ "$l" != "X" ] ; then
        mv -f $l"_" $l
     fi
     # 11. process PyQt dependencies
-    pyqtdir=`find_in_path qt.so ${LD_LIBRARY_PATH}`
+    pyqtdir=`find_in_path Qt.so ${LD_LIBRARY_PATH}`
     if [ -n "${pyqtdir}" ] && [ -d "${pyqtdir}" ] ; then
        # echo $l $pyqtdir
        sed -e "s%-L[^[:space:]]*PyQt[^[:space:]]*%-L${pyqtdir}%g" $l > $l"_"
@@ -748,19 +800,28 @@ if [ "$l" != "X" ] ; then
        sed -e "s%-L[^[:space:]]*boost[^[:space:]]*/lib%-L${boostdir}%g" $l > $l"_"
        mv -f $l"_" $l
     fi
-    # 14. modify libdir
-    #sed -e "s%^libdir='\(.*\)'%libdir='${PRODUCT_DIR}/lib/salome'%g" $l > $l"_"
-    mod=`basename $ldir | awk -F_ '{print $1}'`
-    moddir=`printenv ${mod}_ROOT_DIR`
-    sed -e "s%^libdir='[^[:space:]]*${mod}[^[:space:]]*/\(lib.*\)'%libdir='${moddir}/\1'%g" $l > $l"_"
-    mv -f $l"_" $l
+
+    blsurfdir=`printenv BLSURFHOME`/lib
+    if [ -n "${blsurfdir}" ] && [ -d "${blsurfdir}" ] ; then
+       # echo $l $BOOSTDIR $boostdir
+       sed -e "s%-L[^[:space:]]*BLSurf[^[:space:]]*/lib%-L${blsurfdir}%g" $l > $l"_"
+       mv -f $l"_" $l
+    fi
+
+#    # 14. modify libdir
+#    #sed -e "s%^libdir='\(.*\)'%libdir='${PRODUCT_DIR}/lib/salome'%g" $l > $l"_"
+#    mod=`basename $ldir | awk -F_ '{print $1}'`
+#    moddir=`printenv ${mod}_ROOT_DIR`
+#    sed -e "s%^libdir='[^[:space:]]*${mod}[^[:space:]]*/\(lib.*\)'%libdir='${moddir}/\1'%g" $l > $l"_"
+#    mv -f $l"_" $l
 
     # 15. process libxml dependencies
     libxmldir=`printenv LIBXML_DIR`/lib
     if [ ! -d ${libxmldir} ] ; then libxmldir=`printenv  LIBXML_DIR`/lib ; fi
-    sed -e "s%\(.*\)\([[:space:]].*/lib/libxml2.la[[:space:]]\)\(.*\)%\1 ${libxmldir}/libxml2.la \3%g" \
-        -e "s%-L[^[:space:]]*libxml2[^[:space:]]*/lib%-L${libxmldir}%g" $l > $l"_"
+    sed -e "s%[[:space:]]\(-L\)\?[^[:space:]]*libxml2-[0-9]\.[0-9]\.[0-9][0-9]/lib% \1${libxmldir}%g" $l > $l"_"
     mv -f $l"_" $l     
+    sed -e "s%[[:space:]]\(-L\)\?[^[:space:]]*libxml2/lib% \1${libxmldir}%g" $l > $l"_"
+    mv -f $l"_" $l
 
     # 16. process metis dependencies
     metisdir=`printenv METISDIR`
@@ -768,12 +829,49 @@ if [ "$l" != "X" ] ; then
     sed -e "s%-L[^[:space:]]*metis[^[:space:]]*%-L${metisdir}%g" $l > $l"_"
     mv -f $l"_" $l     
 
-    # 3. process scotch dependencies
+    # 17. process scotch dependencies
     scotchdir=`printenv SCOTCHDIR`/bin
     if [ ! -d ${scotchdir} ] ; then scotchdir=`printenv SCOTCHDIR`/bin ; fi
     sed    -e "s%-L[^[:space:]]*scotch[^[:space:]]*/bin%-L${scotchdir}%g" $l > $l"_"
     mv -f $l"_" $l     
 
+    # 18. process libGL.la dependencies
+    if test `uname -m` = "x86_64" ; then
+    libGLpath=/usr/lib64/libGL.la
+    else
+    libGLpath=/usr/lib/libGL.la
+    fi
+       sed -e "s%$libGLpath%""%g" $l > $l"_"
+       mv -f $l"_" $l
+
+    # 19. process graphviz dependencies
+    graphvizdir=`printenv GRAPHVIZHOME`/lib
+    if [ ! -d ${graphvizdir} ] ; then graphvizdir=`printenv GRAPHVIZHOME`/lib ; fi
+    sed -e "s%[[:space:]]\(-L\)\?[^[:space:]]*graphviz-[0-9]\.[0-9]\+\.[0-9]/lib% \1${graphvizdir}%g" \
+       -e "s%[[:space:]]\(-L\)\?[^[:space:]]*graphviz/lib% \1${graphvizdir}%g" $l > $l"_"
+    chmod -f --reference=$l $l"_"
+    mv -f $l"_" $l     
+   # 20. process QScintilla-2.3 dependencies
+    qscintilladir=`printenv QSCINTILLA_DIR`/lib
+    if [ ! -d ${qscintilladir} ] ; then qscintilladir=`printenv QSCINTILLA_DIR`/lib ; fi
+    sed -e "s%[[:space:]]\(-L\)\?[^[:space:]]*QScintilla-[0-9]\.[0-9]\(\.[0-9]\)\?/lib% \1${qscintilladir}%g" $l > $l"_"
+    chmod -f --reference=$l $l"_"
+    mv -f $l"_" $l     
+
+   # 21. process expat-2.0.1 dependencies
+       expatdir=${EXPAT_ROOT}/lib
+       sed -e "s%-L[^[:space:]]*expat[^[:space:]]*/lib%-L${expatdir}%g" \
+           -e "s%[^[:space:]]*expat[^[:space:]]*/lib/libexpat.la%-lexpat%g" $l > $l"_"
+       chmod -f --reference=$l $l"_"
+       mv -f $l"_" $l          
+
+    # 22. process ParaView dependencies
+    paraviewdir=`printenv PVHOME`/lib
+    if [ ! -d ${paraviewdir} ] ; then paraviewdir=`printenv PVHOME`/lib ; fi
+    sed -e "s%[[:space:]]\(-L\)\?[^[:space:]]*ParaView-[0-9]\.[0-9]/lib% \1${paraviewdir}%g" $l > $l"_"
+    chmod -f --reference=$l $l"_"
+    mv -f $l"_" $l 
 
 fi
 done