]> SALOME platform Git repositories - tools/install.git/blob - config_files/KERNEL.sh
Salome HOME
Add path to common libs into 'LD_LIBRARY_PATH'
[tools/install.git] / config_files / KERNEL.sh
1 #!/bin/bash -noprofile
2
3 ####################################################################################
4 #  File      : KERNEL_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 "${KERNEL_ROOT_DIR}" ]; then
19     check_lib_version VERSION ${KERNEL_ROOT_DIR}/bin/salome
20     if [ "$?" -eq "0" ]; then
21         ver=`cat ${KERNEL_ROOT_DIR}/bin/salome/VERSION | awk -F: '{print $2}' | tr -d '[:space:]' ` 
22         if [ "$ver" = "${VERSION}" ]; then
23             return 0
24         fi
25     fi
26 elif [ -n "${KERNEL_SRC_DIR}" ]; then
27   check_salome_src_version KERNEL_SRC_DIR $VERSION
28   if [ $? -eq 0 ] ; then return 0 ; fi
29   return 1
30 fi
31 return 1
32 }
33
34 print_env_bin(){
35 if test `uname -m` = "x86_64" ; then
36 export LIB_PREFIX=64
37 else
38 export LIB_PREFIX=""
39 fi
40 cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh <<EOF 
41 #$DELIM ${PRODUCT_TYPE} $DELIM
42 export KERNEL_ROOT_DIR=\${INSTALL_ROOT}/${PRODUCT}
43 if [ -n "\${ENV_FOR_LAUNCH}" ] ; then
44   if [ "\${ENV_FOR_LAUNCH}" == "1" ] ; then
45     export PATH=\${KERNEL_ROOT_DIR}/bin/salome:\${PATH}
46     export LD_LIBRARY_PATH=\${KERNEL_ROOT_DIR}/lib${LIB_PREFIX}/salome:\${LD_LIBRARY_PATH}
47     export PYTHONPATH=\${KERNEL_ROOT_DIR}/bin/salome:\${KERNEL_ROOT_DIR}/lib${LIB_PREFIX}/salome:\${KERNEL_ROOT_DIR}/lib${LIB_PREFIX}/python\${PYTHON_VERSION}/site-packages/salome:\${PYTHONPATH}
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 KERNEL_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 # unpack
78 check_jb tar xfz ${SOURCE_DIR}/KERNELsourcesV${VERSION}.tar.gz -C ${INSTALL_ROOT}
79
80 # to generate environment scripts
81 try_preinstalled
82 }
83
84 install_source_and_build()
85 {
86 # remove previously existing sources directory
87 if [ -f $PRODUCT_DIR ] ; then
88     rm -rf $PRODUCT_DIR
89 fi
90
91 # install sources
92 install_source
93
94 # build sources
95 mkdir -p ${PRODUCT_DIR}
96
97 if [ -e ./build.sh ] ; then
98     cp -f ./build.sh ${INSTALL_ROOT}
99 fi
100
101 CUR_DIR=`pwd`
102 cd ${INSTALL_ROOT}
103 check_jb build.sh -o -c -d -v 0 -p $INSTALL_ROOT KERNEL
104
105 # create environment for the built binaries
106 cd $CUR_DIR
107
108 # remove sources and temporary files after building
109 if [ ${REMOVE_SRC_TMP} == "TRUE" ] ; then
110     test -d ${PRODUCT_SRC_DIR} && rm -fr ${PRODUCT_SRC_DIR}
111     test -d ${INSTALL_ROOT}/"KERNEL_BUILD" && rm -fr ${INSTALL_ROOT}/"KERNEL_BUILD"
112 fi
113
114 # to generate environment scripts
115 try_preinstalled
116 }
117
118 install_binary()
119 {
120 make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}
121 source ${INSTALL_WORK}/$SHRC
122
123 check_jb tar xfz ${SOURCE_DIR}/KERNELbinariesV${VERSION}.tar.gz -C ${INSTALL_ROOT}
124 check_jb tar xfz ${SRC_DIR}/KERNELsourcesV${VERSION}.tar.gz -C ${INSTALL_ROOT}
125
126 # The next two symbolic links are created only for Red Hat 9 and Scientific Linux 3.0.5
127 if [ -f /lib/libcrypto.so.0.9.7a ]; then
128     ln -sf /lib/libcrypto.so.0.9.7a ${PRODUCT_DIR}/lib/salome/libcrypto.so.2
129 fi
130 if [ -f /lib/libssl.so.0.9.7a ]; then
131     ln -sf /lib/libssl.so.0.9.7a ${PRODUCT_DIR}/lib/salome/libssl.so.2
132 fi
133
134 # modify all *.la files
135 export KERNEL_ROOT_DIR=${PRODUCT_DIR}
136 modif_la_files ${PRODUCT_DIR}
137
138 # to generate environment scripts
139 try_preinstalled
140 }
141
142 pickup_env()
143 {
144 make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE} ${PRODUCT_DIR}
145 if [ -d ${PRODUCT_DIR} ] ; then
146     cd ${PRODUCT_DIR}
147     version=`cat bin/salome/VERSION | awk -F: '{print $2}' | tr -d '[:space:]'`
148     dir="${HOME}/salome_appli_$version"
149     bin/salome/createAppli.sh $dir
150     rm -rf $dir/env.d/*.sh
151     cp -f ${PRODUCT_DIR}/salome.sh $dir/env.d
152 fi
153 make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}_src ${PRODUCT_SRC_DIR}
154 }
155
156 export PROCEDURE=$1;
157 export INSTALL_WORK=$2;
158 export SOURCE_DIR=$3;
159 export INSTALL_ROOT=$4;
160 export PRODUCT_SEQUENCE=$5;
161 export PRODUCT_TYPE=$6;
162 export INSTALL_PRODUCTS=$7;
163 SRC_DIR=$8;
164 shift
165 REMOVE_SRC_TMP=$8;
166 export PRODUCT="KERNEL_${VERSION}"
167 export PRODUCT_SRC="KERNEL_SRC_${VERSION}"
168 export PRODUCT_DIR=${INSTALL_ROOT}/${PRODUCT}
169 export PRODUCT_SRC_DIR=${INSTALL_ROOT}/${PRODUCT_SRC}
170 source ./common.sh
171 $PROCEDURE