]> SALOME platform Git repositories - tools/install.git/blob - config_files/LIGHT.sh
Salome HOME
Add path to common libs into 'LD_LIBRARY_PATH'
[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="4.0.0"
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   check_salome_src_version LIGHT_SRC_DIR $VERSION
27   if [ $? -eq 0 ] ; then return 0 ; fi
28   return 1
29 fi
30 return 1
31 }
32
33 print_env_bin(){
34 if test `uname -m` = "x86_64" ; then
35 export LIB_PREFIX=64
36 else
37 export LIB_PREFIX=""
38 fi
39 cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh <<EOF 
40 #$DELIM ${PRODUCT_TYPE} $DELIM
41 export LIGHT_ROOT_DIR=\${INSTALL_ROOT}/${PRODUCT}
42 if [ -n "\${ENV_FOR_LAUNCH}" ] ; then
43   if [ "\${ENV_FOR_LAUNCH}" == "1" ] ; then
44     export LD_LIBRARY_PATH=\${LIGHT_ROOT_DIR}/lib${LIB_PREFIX}/salome:\${LD_LIBRARY_PATH}
45   fi
46 fi
47 ##
48 EOF
49 (test -w ${PRODUCT_DIR} && cp ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh ${PRODUCT_DIR})
50 make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}"
51 }
52
53 print_env_src(){
54 cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}_src.sh <<EOF
55 #$DELIM ${PRODUCT_TYPE}_src $DELIM
56 export LIGHT_SRC_DIR=\${INSTALL_ROOT}/${PRODUCT_SRC}
57 ##
58 EOF
59
60 (test -w ${PRODUCT_SRC_DIR} && cp ${INSTALL_WORK}/env_${PRODUCT_TYPE}_src.sh ${PRODUCT_SRC_DIR})
61 make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}"
62 }
63
64 try_preinstalled(){
65 try_existing ${PRODUCT_DIR} ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}
66 try_existing ${PRODUCT_SRC_DIR} ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}_src
67 return $?
68 }
69
70 install_source()
71 {
72 make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}_src
73 source ${INSTALL_WORK}/$SHRC
74
75 check_jb tar xfz ${SOURCE_DIR}/LIGHTsourcesV${VERSION}.tar.gz -C ${INSTALL_ROOT}
76
77 # to generate environment scripts
78 try_preinstalled
79 }
80
81 install_source_and_build()
82 {
83 # install sources
84 install_source
85
86 # build sources
87 mkdir -p ${PRODUCT_DIR}
88
89 if [ -e ./build.sh ] ; then
90     cp -f ./build.sh ${INSTALL_ROOT}
91 fi
92
93 CUR_DIR=`pwd`
94 cd ${INSTALL_ROOT}
95 check_jb build.sh -o -b -d -v 0 -p $INSTALL_ROOT LIGHT
96
97 cd $CUR_DIR
98
99 # remove sources and temporary files after building
100 if [ ${REMOVE_SRC_TMP} == "TRUE" ] ; then
101     test -d ${PRODUCT_SRC_DIR} && rm -fr ${PRODUCT_SRC_DIR}
102     test -d ${INSTALL_ROOT}/"LIGHT_BUILD" && rm -fr ${INSTALL_ROOT}/"LIGHT_BUILD"
103 fi
104
105 # to generate environment scripts
106 try_preinstalled
107 }
108
109 install_binary()
110 {
111 make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}
112 source ${INSTALL_WORK}/$SHRC
113
114 check_jb tar xfz ${SOURCE_DIR}/LIGHTbinariesV${VERSION}.tar.gz -C ${INSTALL_ROOT}
115 check_jb tar xfz ${SRC_DIR}/LIGHTsourcesV${VERSION}.tar.gz -C ${INSTALL_ROOT}
116
117 # modify all *.la files
118 export LIGHT_ROOT_DIR=${PRODUCT_DIR}
119 modif_la_files ${PRODUCT_DIR}
120
121 # to generate environment scripts
122 try_preinstalled
123 }
124
125 export PROCEDURE=$1;
126 export INSTALL_WORK=$2;
127 export SOURCE_DIR=$3;
128 export INSTALL_ROOT=$4;
129 export PRODUCT_SEQUENCE=$5;
130 export PRODUCT_TYPE=$6;
131 export INSTALL_PRODUCTS=$7;
132 SRC_DIR=$8;
133 shift
134 REMOVE_SRC_TMP=$8;
135 export PRODUCT="LIGHT_${VERSION}"
136 export PRODUCT_SRC="LIGHT_SRC_${VERSION}"
137 export PRODUCT_DIR=${INSTALL_ROOT}/${PRODUCT}
138 export PRODUCT_SRC_DIR=${INSTALL_ROOT}/${PRODUCT_SRC}
139 source ./common.sh
140 $PROCEDURE