]> SALOME platform Git repositories - tools/install.git/blob - config_files/VTK-4.2.2.sh
Salome HOME
1) getSize() just returns required size that read from XML now;
[tools/install.git] / config_files / VTK-4.2.2.sh
1 #!/bin/bash -noprofile
2
3 ####################################################################################
4 #  File      : VTK-4.2.2.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 check_version()
16 {
17 if [ -z "$VTKHOME" ]; then
18    return 1 
19 fi
20 check_lib_version libvtkCommon.so ${VTKHOME}/lib/vtk
21 if [ "$?" -eq "0" ]; then
22    return 0
23 fi
24 return 1
25 }
26
27 print_env_bin()
28 {
29 cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh <<EOF 
30 #$DELIM ${PRODUCT_TYPE} $DELIM
31 export VTKHOME=\${INSTALL_ROOT}/${PRODUCT}
32 export PATH=\${VTKHOME}/bin:\${PATH}
33 export LD_LIBRARY_PATH=\${VTKHOME}/lib/vtk:\${LD_LIBRARY_PATH}
34 export PYTHONPATH=\${VTKHOME}/lib/vtk:\${VTKHOME}/lib/python\${PYTHON_VERSION}/site-packages/vtk_python:\${PYTHONPATH}
35 export TCLLIBPATH="\${VTKHOME}/lib/vtk/tcl \${TCLLIBPATH}"
36 ##
37 EOF
38 (test -w ${PRODUCT_DIR} && cp ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh ${PRODUCT_DIR})
39 make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}"
40 }
41
42 print_env_src()
43 {
44 cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}_src.sh <<EOF
45 #$DELIM ${PRODUCT_TYPE}_src $DELIM
46 # nothing to do
47 ##
48 EOF
49 (test -w ${PRODUCT_DIR}_SRC && cp ${INSTALL_WORK}/env_${PRODUCT_TYPE}_src.sh ${PRODUCT_DIR}_SRC)
50 make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}"
51 }
52
53 try_preinstalled(){
54 try_existing ${PRODUCT_DIR} ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}
55 try_existing ${PRODUCT_DIR}_SRC ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}_src
56 return $?
57 }
58
59 install_source()
60 {
61 make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}_src
62 source ${INSTALL_WORK}/$SHRC
63
64 makedir ${PRODUCT_DIR}_SRC
65
66 check_jb tar xfz ${SOURCE_DIR}/cmake-1.6.6.tar.gz -C ${PRODUCT_DIR}_SRC
67 check_jb tar xfz ${SOURCE_DIR}/${PRODUCT}.tar.gz -C ${PRODUCT_DIR}_SRC
68
69 # to generate environment scripts
70 try_preinstalled
71 }
72
73 install_source_and_build()
74 {
75 # install sources
76 install_source
77
78 # build sources
79 makedir ${PRODUCT_DIR}
80 cd ${PRODUCT_DIR}_SRC/cmake-1.6.6_SRC
81 check_job ${PRODUCT_DIR}/CONFIGUREcmake.LOG ./configure
82 cat >> ${PRODUCT_DIR}/MAKEcmake.LOG <<EOF
83 used gcc=$GCC
84 EOF
85 check_job ${PRODUCT_DIR}/MAKEcmake.LOG make
86
87 cd ${PRODUCT_DIR}_SRC/${PRODUCT}_SRC
88
89 # get Python and tcl/tk version
90 python_version="`python -c 'import sys; print sys.version[:3]'`"
91 tcl_version=""
92 tcldir="`where_tcl`"
93 if [ $? -eq 0 ] && [ -e ${tcldir}/tclConfig.sh ] ; then
94     tcl_version=`grep -e "TCL_VERSION=.*" ${tcldir}/tclConfig.sh | sed -e "s%TCL_VERSION=[\'|\"]\(.*\)[\'|\"]%\1%g"`
95 fi
96     
97 VTK_CMAKE_OPTIONS=""
98 ### common VTK settings
99 VTK_CMAKE_OPTIONS=$VTK_CMAKE_OPTIONS" -DBUILD_SHARED_LIBS:BOOL=ON"
100 VTK_CMAKE_OPTIONS=$VTK_CMAKE_OPTIONS" -DCMAKE_BUILD_TYPE:STRING=Release"
101 VTK_CMAKE_OPTIONS=$VTK_CMAKE_OPTIONS" -DCMAKE_CXX_COMPILER:STRING=`which g++`"
102 VTK_CMAKE_OPTIONS=$VTK_CMAKE_OPTIONS" -DCMAKE_C_COMPILER:STRING=`which gcc`"
103 VTK_CMAKE_OPTIONS=$VTK_CMAKE_OPTIONS" -DCMAKE_INSTALL_PREFIX:STRING=${PRODUCT_DIR}"
104 VTK_CMAKE_OPTIONS=$VTK_CMAKE_OPTIONS" -DVTK_USE_HYBRID:BOOL=ON"
105 VTK_CMAKE_OPTIONS=$VTK_CMAKE_OPTIONS" -DVTK_USE_PARALLEL:BOOL=ON"
106 VTK_CMAKE_OPTIONS=$VTK_CMAKE_OPTIONS" -DVTK_USE_PATENTED:BOOL=OFF" 
107 VTK_CMAKE_OPTIONS=$VTK_CMAKE_OPTIONS" -DVTK_USE_RENDERING:BOOL=ON"
108 ### Wrap Python settings
109 if [ "${python_version}" != "" ]; then
110 VTK_CMAKE_OPTIONS=$VTK_CMAKE_OPTIONS" -DVTK_WRAP_PYTHON:BOOL=ON"
111 VTK_CMAKE_OPTIONS=$VTK_CMAKE_OPTIONS" -DPYTHON_EXECUTABLE:STRING=${PYTHONHOME}/bin/python${python_version}"
112 VTK_CMAKE_OPTIONS=$VTK_CMAKE_OPTIONS" -DPYTHON_INCLUDE_PATH:STRING=${PYTHONHOME}/include/python${python_version}"
113 VTK_CMAKE_OPTIONS=$VTK_CMAKE_OPTIONS" -DPYTHON_LIBRARY:STRING=${PYTHONHOME}/lib/python${python_version}/config/libpython${python_version}.a"
114 fi
115 ### Wrap Tcl settings
116 if [ "${tcl_version}" != "" ]; then
117 VTK_CMAKE_OPTIONS=$VTK_CMAKE_OPTIONS" -DVTK_WRAP_TCL:BOOL=ON"
118 VTK_CMAKE_OPTIONS=$VTK_CMAKE_OPTIONS" -DTCL_INCLUDE_PATH:STRING=${TCLHOME}/include"
119 VTK_CMAKE_OPTIONS=$VTK_CMAKE_OPTIONS" -DTCL_LIBRARY:STRING=${TCLHOME}/lib/libtcl${tcl_version}.so"
120 VTK_CMAKE_OPTIONS=$VTK_CMAKE_OPTIONS" -DTCL_STUB_LIBRARY:STRING=${TCLHOME}/lib/libtclstub${tcl_version}.a"
121 VTK_CMAKE_OPTIONS=$VTK_CMAKE_OPTIONS" -DTCL_TCLSH:STRING=${TCLHOME}/bin/tclsh"
122 VTK_CMAKE_OPTIONS=$VTK_CMAKE_OPTIONS" -DTK_INCLUDE_PATH:STRING=${TCLHOME}/include"
123 VTK_CMAKE_OPTIONS=$VTK_CMAKE_OPTIONS" -DTK_LIBRARY:STRING=${TCLHOME}/lib/libtk${tcl_version}.so"
124 VTK_CMAKE_OPTIONS=$VTK_CMAKE_OPTIONS" -DTK_STUB_LIBRARY:STRING=${TCLHOME}/lib/libtkstub${tcl_version}.a"
125 VTK_CMAKE_OPTIONS=$VTK_CMAKE_OPTIONS" -DTK_WISH:STRING=${TCLHOME}/bin/wish"
126 fi
127 ### if Mesa is pre-installed
128 if [ -n "$MESA_HOME" ]; then
129   VTK_CMAKE_OPTIONS=$VTK_CMAKE_OPTIONS" -DOPENGL_INCLUDE_DIR:STRING=${MESA_HOME}/include"
130   VTK_CMAKE_OPTIONS=$VTK_CMAKE_OPTIONS" -DOPENGL_gl_LIBRARY:STRING=${MESA_HOME}/lib/libGL.so"
131   VTK_CMAKE_OPTIONS=$VTK_CMAKE_OPTIONS" -DOPENGL_glu_LIBRARY:STRING=${MESA_HOME}/lib/libGLU.so"
132   VTK_CMAKE_OPTIONS=$VTK_CMAKE_OPTIONS" -DOPENGL_xmesa_INCLUDE_DIR:STRING=${MESA_HOME}/include"
133 fi
134
135 cat > ${PRODUCT_DIR}/CONFIGURE.LOG <<EOF
136 used VTK settings:
137 $VTK_CMAKE_OPTIONS
138 EOF
139 check_job ${PRODUCT_DIR}/CONFIGURE.LOG ${PRODUCT_DIR}_SRC/cmake-1.6.6_SRC/Source/cmake . $VTK_CMAKE_OPTIONS
140
141 cat > ${PRODUCT_DIR}/MAKE.LOG <<EOF
142 used gcc=$GCC
143 EOF
144 check_job ${PRODUCT_DIR}/MAKE.LOG make
145
146 check_job ${PRODUCT_DIR}/MAKEINSTALL.LOG make install
147
148 cd ${PRODUCT_DIR}_SRC/${PRODUCT}_SRC/Wrapping/Python
149 check_job ${PRODUCT_DIR}/SETUPPYTHON.LOG python setup.py install --prefix=${PRODUCT_DIR}
150
151 #du -sk ${PRODUCT_DIR}_SRC > ${PRODUCT_DIR}/size.log
152 cd ${PRODUCT_DIR};
153
154 # set correct symbolic links - bug of python wrappings installation
155 cd ${PRODUCT_DIR}/lib/python${python_version}/site-packages/vtk_python
156 ln -sf ../../../vtk/*Python*.so .
157
158 # remove sources and temporary files after building
159 if [ ${REMOVE_SRC_TMP} == "TRUE" ] ; then
160     test -d ${PRODUCT_DIR}_SRC && rm -fr ${PRODUCT_DIR}_SRC
161 fi
162
163 # to generate environment scripts
164 try_preinstalled
165 }
166
167 install_binary()
168 {
169 make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}
170 source ${INSTALL_WORK}/$SHRC
171
172 check_jb tar xfz ${SOURCE_DIR}/${PRODUCT}.tar.gz -C ${INSTALL_ROOT}
173
174 # to generate environment script for sources
175 try_preinstalled
176 }
177
178 export PROCEDURE=$1;
179 export INSTALL_WORK=$2;
180 export SOURCE_DIR=$3;
181 export INSTALL_ROOT=$4;
182 export PRODUCT_SEQUENCE=$5;
183 export PRODUCT_TYPE=$6;
184 export INSTALL_PRODUCTS=$7;
185 shift
186 REMOVE_SRC_TMP=$8;
187 export PRODUCT="VTK-4.2.2"
188 export PRODUCT_DIR=${INSTALL_ROOT}/${PRODUCT}
189 export PRODUCT_WORK=${INSTALL_WORK}/${PRODUCT}
190 source ./common.sh
191 $PROCEDURE