]> SALOME platform Git repositories - tools/install.git/blob - config_files/HELLO.sh
Salome HOME
Add path to common libs into 'LD_LIBRARY_PATH'
[tools/install.git] / config_files / HELLO.sh
1 #!/bin/bash -noprofile
2
3 ####################################################################################
4 #  File      : HELLO_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 "${HELLO_ROOT_DIR}" ]; then
19     if [ -f ${HELLO_ROOT_DIR}/bin/salome/VERSION ]; then
20         ver=`cat ${HELLO_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 "${HELLO_SRC_DIR}" ]; then
26   check_salome_src_version HELLO_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 HELLO_ROOT_DIR=\${INSTALL_ROOT}/${PRODUCT}
42 if [ -n "\${ENV_FOR_LAUNCH}" ] ; then
43   if [ "\${ENV_FOR_LAUNCH}" == "1" ] ; then
44     export PATH=\${HELLO_ROOT_DIR}/bin/salome:\${PATH}
45     export LD_LIBRARY_PATH=\${HELLO_ROOT_DIR}/lib${LIB_PREFIX}/salome:\${LD_LIBRARY_PATH}
46     export PYTHONPATH=\${HELLO_ROOT_DIR}/bin/salome:\${HELLO_ROOT_DIR}/lib${LIB_PREFIX}/salome:\${HELLO_ROOT_DIR}/lib${LIB_PREFIX}/python\${PYTHON_VERSION}/site-packages/salome:\${PYTHONPATH}
47   fi
48 fi
49 ##
50 EOF
51 (test -w ${PRODUCT_DIR} && cp ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh ${PRODUCT_DIR})
52 make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}"
53 }
54
55 print_env_src(){
56 cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}_src.sh <<EOF
57 #$DELIM ${PRODUCT_TYPE}_src $DELIM
58 export HELLO_SRC_DIR=\${INSTALL_ROOT}/${PRODUCT_SRC}
59 ##
60 EOF
61
62 (test -w ${PRODUCT_SRC_DIR} && cp ${INSTALL_WORK}/env_${PRODUCT_TYPE}_src.sh ${PRODUCT_SRC_DIR})
63 make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}"
64 }
65
66 try_preinstalled(){
67 try_existing ${PRODUCT_DIR} ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}
68 try_existing ${PRODUCT_SRC_DIR} ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}_src
69 return $?
70 }
71
72 install_source()
73 {
74 make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}_src
75 source ${INSTALL_WORK}/$SHRC
76
77 check_jb tar xfz ${SOURCE_DIR}/HELLOsourcesV${VERSION}.tar.gz -C ${INSTALL_ROOT}
78
79 # to generate environment scripts
80 try_preinstalled
81 }
82
83 install_source_and_build()
84 {
85 # install sources
86 install_source
87
88 # build sources
89 mkdir -p ${PRODUCT_DIR}
90
91 if [ -e ./build.sh ] ; then
92     cp -f ./build.sh ${INSTALL_ROOT}
93 fi
94
95 CUR_DIR=`pwd`
96 cd ${INSTALL_ROOT}
97 check_jb build.sh -o -b -d -v 0 -p $INSTALL_ROOT HELLO
98
99 cd $CUR_DIR
100
101 # remove sources and temporary files after building
102 if [ ${REMOVE_SRC_TMP} == "TRUE" ] ; then
103     test -d ${PRODUCT_SRC_DIR} && rm -fr ${PRODUCT_SRC_DIR}
104     test -d ${INSTALL_ROOT}/"HELLO_BUILD" && rm -fr ${INSTALL_ROOT}/"HELLO_BUILD"
105 fi
106
107 # to generate environment scripts
108 try_preinstalled
109 }
110
111 install_binary()
112 {
113 make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}
114 source ${INSTALL_WORK}/$SHRC
115
116 check_jb tar xfz ${SOURCE_DIR}/HELLObinariesV${VERSION}.tar.gz -C ${INSTALL_ROOT}
117 check_jb tar xfz ${SRC_DIR}/HELLOsourcesV${VERSION}.tar.gz -C ${INSTALL_ROOT}
118
119 # modify all *.la files
120 export HELLO_ROOT_DIR=${PRODUCT_DIR}
121 modif_la_files ${PRODUCT_DIR}
122
123 cd ${PRODUCT_DIR}/bin/salome
124 sed -e "s%export KERNEL_ROOT_DIR=.*%export KERNEL_ROOT_DIR=${KERNEL_ROOT_DIR}%g" runAppli > _runAppli
125 sed -e "s%export HELLO_ROOT_DIR=.*%export HELLO_ROOT_DIR=${HELLO_ROOT_DIR}%g"    _runAppli > runAppli
126 rm -f _runAppli
127 chmod a+x runAppli
128
129 # to generate environment scripts
130 try_preinstalled
131 }
132
133 export PROCEDURE=$1;
134 export INSTALL_WORK=$2;
135 export SOURCE_DIR=$3;
136 export INSTALL_ROOT=$4;
137 export PRODUCT_SEQUENCE=$5;
138 export PRODUCT_TYPE=$6;
139 export INSTALL_PRODUCTS=$7;
140 SRC_DIR=$8;
141 shift
142 REMOVE_SRC_TMP=$8;
143 export PRODUCT="HELLO_${VERSION}"
144 export PRODUCT_SRC="HELLO_SRC_${VERSION}"
145 export PRODUCT_DIR=${INSTALL_ROOT}/${PRODUCT}
146 export PRODUCT_SRC_DIR=${INSTALL_ROOT}/${PRODUCT_SRC}
147 source ./common.sh
148 $PROCEDURE