]> SALOME platform Git repositories - tools/install.git/blob - config_files/CALCULATOR_BIN.sh
Salome HOME
replace /bin/sh by /bin/bash to avoid ambiguity
[tools/install.git] / config_files / CALCULATOR_BIN.sh
1 #!/bin/bash -noprofile
2
3 ####################################################################################
4 #  File      : CALCULATOR_BIN.sh
5 #  Created   : Thu Dec 18 12:01:00 2002
6 #  Author    : Vadim SANDLER, Open CASCADE SAS (vadim.sandler@opencascade.com)
7 #  Project   : SALOME
8 #  Module    : Installation Wizard
9 #  Copyright : 2002-2006 CEA
10 #
11 #  This script is the part of the SALOME installation procedure.
12 #
13 ####################################################################################
14
15 check_version(){
16 if [ -n "${CALCULATOR_ROOT_DIR}" ]; then
17     check_lib_version VERSION ${CALCULATOR_ROOT_DIR}/bin/salome
18     if [ "$?" -eq "0" ]; then
19         ver=`cat ${CALCULATOR_ROOT_DIR}/bin/salome/VERSION | awk -F: '{print $2}' | tr -d '[:space:]' ` 
20         if [ "$ver" = "3.2.3" ]; then
21             return 0
22         fi
23     fi
24 fi
25 return 1
26 }
27
28 print_env(){
29
30 if test `uname -m` = "x86_64" ; then
31 export LIB_PREFIX=64
32 else
33 export LIB_PREFIX=""
34 fi
35
36 cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh <<EOF 
37 #$DELIM ${PRODUCT_TYPE} $DELIM
38 export CALCULATOR_ROOT_DIR=\${INSTALL_ROOT}/${PRODUCT}
39 if [ -n "\${ENV_FOR_LAUNCH}" ] ; then
40   if [ "\${ENV_FOR_LAUNCH}" == "1" ] ; then
41     export PATH=\${CALCULATOR_ROOT_DIR}/bin/salome:\${PATH}
42     export LD_LIBRARY_PATH=\${CALCULATOR_ROOT_DIR}/lib${LIB_PREFIX}/salome:\${LD_LIBRARY_PATH}
43     export PYTHONPATH=\${CALCULATOR_ROOT_DIR}/bin/salome:\${CALCULATOR_ROOT_DIR}/lib${LIB_PREFIX}/salome:\${CALCULATOR_ROOT_DIR}/lib${LIB_PREFIX}/python\${PYTHON_VERSION}/site-packages/salome:\${PYTHONPATH}
44   fi
45 fi
46 ##
47 EOF
48 (test -w ${PRODUCT_DIR} && cp ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh ${PRODUCT_DIR})
49 make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}"
50 }
51
52 # looks for the native product and collects it's environment (used by make_env())
53 try_native(){
54 check_version
55 if test `uname -m` = "x86_64" ; then
56 export LIB_PREFIX=64
57 else
58 export LIB_PREFIX=""
59 fi
60 if [ $? -eq 0 ] ; then
61     cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh <<EOF 
62 #$DELIM ${PRODUCT_TYPE} $DELIM
63 export CALCULATOR_ROOT_DIR=\${INSTALL_ROOT}/${PRODUCT}
64 if [ -n "\${ENV_FOR_LAUNCH}" ] ; then
65   if [ "\${ENV_FOR_LAUNCH}" == "1" ] ; then
66     export PATH=\${CALCULATOR_ROOT_DIR}/bin/salome:\${PATH}
67     export LD_LIBRARY_PATH=\${CALCULATOR_ROOT_DIR}/lib${LIB_PREFIX}/salome:\${LD_LIBRARY_PATH}
68     export PYTHONPATH=\${CALCULATOR_ROOT_DIR}/bin/salome:\${CALCULATOR_ROOT_DIR}/lib${LIB_PREFIX}/salome:\${CALCULATOR_ROOT_DIR}/lib${LIB_PREFIX}/python\${PYTHON_VERSION}/site-packages/salome:\${PYTHONPATH}
69   fi
70 fi
71 ##
72 EOF
73     make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}"
74     return 0
75 fi
76 return 1;
77 }
78
79 try_preinstalled(){
80 try_existing ${PRODUCT_DIR} ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" ${PRODUCT_TYPE}
81 return $?
82 }
83
84 install_source()
85 {
86 return 1
87 }
88
89 install_binary()
90 {
91 make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" ${PRODUCT_TYPE}
92 source ${INSTALL_WORK}/$SHRC
93
94 check_jb tar xfz ${SOURCE_DIR}/CALCULATORbinariesV3.2.3.tar.gz -C ${INSTALL_ROOT}
95
96 # modify all *.la files
97 export CALCULATOR_ROOT_DIR=${PRODUCT_DIR}
98 modif_la_files ${PRODUCT_DIR}
99
100 cd ${PRODUCT_DIR}/bin/salome
101 sed -e "s%export KERNEL_ROOT_DIR=.*%export KERNEL_ROOT_DIR=${KERNEL_ROOT_DIR}%g"             runAppli > _runAppli
102 sed -e "s%export CALCULATOR_ROOT_DIR=.*%export CALCULATOR_ROOT_DIR=${CALCULATOR_ROOT_DIR}%g" _runAppli > runAppli
103 rm -f _runAppli
104 chmod a+x runAppli
105
106 print_env
107 }
108
109 export PROCEDURE=$1;
110 export INSTALL_WORK=$2;
111 export SOURCE_DIR=$3;
112 export INSTALL_ROOT=$4;
113 export PRODUCT_SEQUENCE=$5;
114 if [ $# == 6 ] ; then export PRODUCT_TYPE=$6 ; else export PRODUCT_TYPE="CalculatorBin" ; fi
115 export PRODUCT="CALCULATOR_3.2.3"
116 export PRODUCT_DIR=${INSTALL_ROOT}/${PRODUCT}
117 export PRODUCT_WORK=${INSTALL_WORK}/${PRODUCT}
118 source ./common.sh
119 $PROCEDURE