]> SALOME platform Git repositories - tools/install.git/blob - config_files/COMPONENT.sh
Salome HOME
1) getSize() just returns required size that read from XML now;
[tools/install.git] / config_files / COMPONENT.sh
1 #!/bin/bash -noprofile
2
3 ####################################################################################
4 #  File      : COMPONENT_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 "${COMPONENT_ROOT_DIR}" ]; then
19     check_lib_version VERSION ${COMPONENT_ROOT_DIR}/bin/salome
20     if [ "$?" -eq "0" ]; then
21         ver=`cat ${COMPONENT_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 "${COMPONENT_SRC_DIR}" ]; then
27     if [ -f ${COMPONENT_SRC_DIR}/configure.in.base ]; then
28         ver=`grep -E "^VERSION=" ${COMPONENT_SRC_DIR}/configure.in.base | awk -F= '{print $NF}' | tr -d '[:space:]' ` 
29         if [ "$ver" = "${VERSION}" ]; then
30             return 0
31         fi
32     fi
33 fi
34 return 1
35 }
36
37 print_env_bin(){
38
39 if test `uname -m` = "x86_64" ; then
40 export LIB_PREFIX=64
41 else
42 export LIB_PREFIX=""
43 fi
44
45 cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh <<EOF 
46 #$DELIM ${PRODUCT_TYPE} $DELIM
47 export COMPONENT_ROOT_DIR=\${INSTALL_ROOT}/${PRODUCT}
48 if [ -n "\${ENV_FOR_LAUNCH}" ] ; then
49   if [ "\${ENV_FOR_LAUNCH}" == "1" ] ; then
50     export PATH=\${COMPONENT_ROOT_DIR}/bin/salome:\${PATH}
51     export LD_LIBRARY_PATH=\${COMPONENT_ROOT_DIR}/lib${LIB_PREFIX}/salome:\${LD_LIBRARY_PATH}
52     export PYTHONPATH=\${COMPONENT_ROOT_DIR}/bin/salome:\${COMPONENT_ROOT_DIR}/lib${LIB_PREFIX}/salome:\${COMPONENT_ROOT_DIR}/lib${LIB_PREFIX}/python\${PYTHON_VERSION}/site-packages/salome:\${PYTHONPATH}
53   fi
54 fi
55 ##
56 EOF
57 (test -w ${PRODUCT_DIR} && cp ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh ${PRODUCT_DIR})
58 make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}"
59 }
60
61 print_env_src(){
62 cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}_src.sh <<EOF
63 #$DELIM ${PRODUCT_TYPE}_src $DELIM
64 export COMPONENT_SRC_DIR=\${INSTALL_ROOT}/${PRODUCT_SRC}
65 ##
66 EOF
67
68 (test -w ${PRODUCT_SRC_DIR} && cp ${INSTALL_WORK}/env_${PRODUCT_TYPE}_src.sh ${PRODUCT_SRC_DIR})
69 make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}"
70 }
71
72 try_preinstalled(){
73 try_existing ${PRODUCT_DIR} ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}
74 try_existing ${PRODUCT_SRC_DIR} ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}_src
75 return $?
76 }
77
78 install_source()
79 {
80 make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}_src
81 source ${INSTALL_WORK}/$SHRC
82
83 check_jb tar xfz ${SOURCE_DIR}/COMPONENTsourcesV${VERSION}.tar.gz -C ${INSTALL_ROOT}
84
85 # to generate environment scripts
86 try_preinstalled
87 }
88
89 install_source_and_build()
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 -b -d -v 0 -p $INSTALL_ROOT COMPONENT
104
105 cd $CUR_DIR
106
107 # remove sources and temporary files after building
108 if [ ${REMOVE_SRC_TMP} == "TRUE" ] ; then
109     test -d ${PRODUCT_SRC_DIR} && rm -fr ${PRODUCT_SRC_DIR}
110     test -d ${INSTALL_ROOT}/"COMPONENT_BUILD" && rm -fr ${INSTALL_ROOT}/"COMPONENT_BUILD"
111 fi
112
113 # to generate environment scripts
114 try_preinstalled
115 }
116
117 install_binary()
118 {
119 make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}
120 source ${INSTALL_WORK}/$SHRC
121
122 check_jb tar xfz ${SOURCE_DIR}/COMPONENTbinariesV${VERSION}.tar.gz -C ${INSTALL_ROOT}
123 check_jb tar xfz ${SRC_DIR}/COMPONENTsourcesV${VERSION}.tar.gz -C ${INSTALL_ROOT}
124
125 # modify all *.la files
126 export COMPONENT_ROOT_DIR=${PRODUCT_DIR}
127 modif_la_files ${PRODUCT_DIR}
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="COMPONENT_${VERSION}"
144 export PRODUCT_SRC="COMPONENT_SRC_${VERSION}"
145 export PRODUCT_DIR=${INSTALL_ROOT}/${PRODUCT}
146 export PRODUCT_SRC_DIR=${INSTALL_ROOT}/${PRODUCT_SRC}
147 source ./common.sh
148 $PROCEDURE