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