]> SALOME platform Git repositories - tools/install.git/blob - config_files/LIGHT.sh
Salome HOME
1) getSize() just returns required size that read from XML now;
[tools/install.git] / config_files / LIGHT.sh
1 #!/bin/bash -noprofile
2
3 ####################################################################################
4 #  File      : LIGHT_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-2007 CEA
10 #
11 #  This script is the part of the SALOME installation procedure.
12 #
13 ####################################################################################
14
15 VERSION="3.2.7"
16
17 check_version(){
18 if [ -n "${LIGHT_ROOT_DIR}" ]; then
19     if [ -f ${LIGHT_ROOT_DIR}/bin/salome/VERSION ]; then
20         ver=`cat ${LIGHT_ROOT_DIR}/bin/salome/VERSION | awk -F: '{print $NF}' | tr -d '[:space:]' ` 
21         if [ "$ver" = "${VERSION}" ]; then
22             return 0
23         fi
24     fi
25 elif [ -n "${LIGHT_SRC_DIR}" ]; then
26     if [ -f ${LIGHT_SRC_DIR}/configure.in.base ]; then
27         ver=`grep -E "^VERSION=" ${LIGHT_SRC_DIR}/configure.in.base | awk -F= '{print $NF}' | tr -d '[:space:]' ` 
28         if [ "$ver" = "${VERSION}" ]; then
29             return 0
30         fi
31     fi
32 fi
33 return 1
34 }
35
36 print_env_bin(){
37 if test `uname -m` = "x86_64" ; then
38 export LIB_PREFIX=64
39 else
40 export LIB_PREFIX=""
41 fi
42 cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh <<EOF 
43 #$DELIM ${PRODUCT_TYPE} $DELIM
44 export LIGHT_ROOT_DIR=\${INSTALL_ROOT}/${PRODUCT}
45 if [ -n "\${ENV_FOR_LAUNCH}" ] ; then
46   if [ "\${ENV_FOR_LAUNCH}" == "1" ] ; then
47     export LD_LIBRARY_PATH=\${LIGHT_ROOT_DIR}/lib${LIB_PREFIX}/salome:\${LD_LIBRARY_PATH}
48   fi
49 fi
50 ##
51 EOF
52 (test -w ${PRODUCT_DIR} && cp ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh ${PRODUCT_DIR})
53 make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}"
54 }
55
56 print_env_src(){
57 cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}_src.sh <<EOF
58 #$DELIM ${PRODUCT_TYPE}_src $DELIM
59 export LIGHT_SRC_DIR=\${INSTALL_ROOT}/${PRODUCT_SRC}
60 ##
61 EOF
62
63 (test -w ${PRODUCT_SRC_DIR} && cp ${INSTALL_WORK}/env_${PRODUCT_TYPE}_src.sh ${PRODUCT_SRC_DIR})
64 make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}"
65 }
66
67 try_preinstalled(){
68 try_existing ${PRODUCT_DIR} ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}
69 try_existing ${PRODUCT_SRC_DIR} ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}_src
70 return $?
71 }
72
73 install_source()
74 {
75 make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}_src
76 source ${INSTALL_WORK}/$SHRC
77
78 check_jb tar xfz ${SOURCE_DIR}/LIGHTsourcesV${VERSION}.tar.gz -C ${INSTALL_ROOT}
79
80 # to generate environment scripts
81 try_preinstalled
82 }
83
84 install_source_and_build()
85 {
86 # install sources
87 install_source
88
89 # build sources
90 mkdir -p ${PRODUCT_DIR}
91
92 if [ -e ./build.sh ] ; then
93     cp -f ./build.sh ${INSTALL_ROOT}
94 fi
95
96 CUR_DIR=`pwd`
97 cd ${INSTALL_ROOT}
98 check_jb build.sh -o -b -d -v 0 -p $INSTALL_ROOT LIGHT
99
100 cd $CUR_DIR
101
102 # remove sources and temporary files after building
103 if [ ${REMOVE_SRC_TMP} == "TRUE" ] ; then
104     test -d ${PRODUCT_SRC_DIR} && rm -fr ${PRODUCT_SRC_DIR}
105     test -d ${INSTALL_ROOT}/"LIGHT_BUILD" && rm -fr ${INSTALL_ROOT}/"LIGHT_BUILD"
106 fi
107
108 # to generate environment scripts
109 try_preinstalled
110 }
111
112 install_binary()
113 {
114 make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}
115 source ${INSTALL_WORK}/$SHRC
116
117 check_jb tar xfz ${SOURCE_DIR}/LIGHTbinariesV${VERSION}.tar.gz -C ${INSTALL_ROOT}
118 check_jb tar xfz ${SRC_DIR}/LIGHTsourcesV${VERSION}.tar.gz -C ${INSTALL_ROOT}
119
120 # modify all *.la files
121 export LIGHT_ROOT_DIR=${PRODUCT_DIR}
122 modif_la_files ${PRODUCT_DIR}
123
124 # to generate environment scripts
125 try_preinstalled
126 }
127
128 export PROCEDURE=$1;
129 export INSTALL_WORK=$2;
130 export SOURCE_DIR=$3;
131 export INSTALL_ROOT=$4;
132 export PRODUCT_SEQUENCE=$5;
133 export PRODUCT_TYPE=$6;
134 export INSTALL_PRODUCTS=$7;
135 SRC_DIR=$8;
136 shift
137 REMOVE_SRC_TMP=$8;
138 export PRODUCT="LIGHT_${VERSION}"
139 export PRODUCT_SRC="LIGHT_SRC_${VERSION}"
140 export PRODUCT_DIR=${INSTALL_ROOT}/${PRODUCT}
141 export PRODUCT_SRC_DIR=${INSTALL_ROOT}/${PRODUCT_SRC}
142 source ./common.sh
143 $PROCEDURE