3 ####################################################################################
5 # Created : Thu Dec 18 12:01:00 2002
6 # Author : Vadim SANDLER, Open CASCADE SAS (vadim.sandler@opencascade.com)
8 # Module : Installation Wizard
9 # Copyright : 2002-2007 CEA
11 # This script is the part of the SALOME installation procedure.
13 ####################################################################################
17 if [ -z "$VTKHOME" ]; then
20 check_lib_version libvtkCommon.so ${VTKHOME}/lib/vtk
21 if [ "$?" -eq "0" ]; then
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}"
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}"
44 cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}_src.sh <<EOF
45 #$DELIM ${PRODUCT_TYPE}_src $DELIM
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}"
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
61 make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}_src
62 source ${INSTALL_WORK}/$SHRC
64 makedir ${PRODUCT_DIR}_SRC
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
69 # apply patches for 64-bit platforms
70 if test `uname -m` = "x86_64" ; then
71 if [ -f patches/cmake-1.6.6-lib64.patch ] ; then
72 cp patches/cmake-1.6.6-lib64.patch ${PRODUCT_DIR}_SRC/cmake-1.6.6_SRC
73 ( cd ${PRODUCT_DIR}_SRC/cmake-1.6.6_SRC ; patch -p1 < cmake-1.6.6-lib64.patch )
75 if [ -f patches/vtk-4.2.6-lib64.patch ] ; then
76 cp patches/vtk-4.2.6-lib64.patch ${PRODUCT_DIR}_SRC/${PRODUCT}_SRC
77 ( cd ${PRODUCT_DIR}_SRC/${PRODUCT}_SRC ; patch -p1 < vtk-4.2.6-lib64.patch )
80 # apply patch: fix pb with importing Python vtk modules on some platforms
81 if [ -f patches/vtk-4.2.6-patented.patch ] ; then
82 cp patches/vtk-4.2.6-patented.patch ${PRODUCT_DIR}_SRC/${PRODUCT}_SRC
83 ( cd ${PRODUCT_DIR}_SRC/${PRODUCT}_SRC ; patch -p1 < vtk-4.2.6-patented.patch )
86 # to generate environment scripts
90 install_source_and_build()
96 makedir ${PRODUCT_DIR}
98 cd ${PRODUCT_DIR}_SRC/cmake-1.6.6_SRC
100 check_job ${PRODUCT_DIR}/CONFIGUREcmake.LOG ./configure
101 cat >> ${PRODUCT_DIR}/MAKEcmake.LOG <<EOF
104 check_job ${PRODUCT_DIR}/MAKEcmake.LOG make
106 cd ${PRODUCT_DIR}_SRC/${PRODUCT}_SRC
108 # apply a small patch for VTK (needed for gcc-3.4)
109 sed -e "s%seekg(self->GetFile()->tellg()%seekg(static_cast<long>(self->GetFile()->tellg())%g" IO/vtkBMPReader.cxx > IO/vtkBMPReader.cxx.orig
110 mv -f IO/vtkBMPReader.cxx.orig IO/vtkBMPReader.cxx
111 sed -e "s%seekg(self->GetFile()->tellg()%seekg(static_cast<long>(self->GetFile()->tellg())%g" IO/vtkImageReader.cxx > IO/vtkImageReader.cxx.orig
112 mv -f IO/vtkImageReader.cxx.orig IO/vtkImageReader.cxx
114 # get Python and tcl/tk version
115 python_version="`python -c 'import sys; print sys.version[:3]'`"
120 if [ $? -eq 0 ] && [ -e ${tcldir}/tclConfig.sh ] ; then
121 tcl_version=`grep -e "TCL_VERSION=.*" ${tcldir}/tclConfig.sh | sed -e "s%TCL_VERSION=[\'|\"]\(.*\)[\'|\"]%\1%g"`
122 tcl_includes=`grep -e "TCL_INCLUDE_SPEC=.*" ${tcldir}/tclConfig.sh | sed -e "s%TCL_INCLUDE_SPEC=[\'|\"]-I\(.*\)[\'|\"]%\1%g"`
123 if [ -z "$tcl_includes" ] ; then tcl_includes=/usr/include ; fi
124 tcl_libs=`grep -e "TCL_PACKAGE_PATH=.*" ${tcldir}/tclConfig.sh | sed -e "s%TCL_PACKAGE_PATH=[\'|\"]\(.*\)[\'|\"]%\1%g"`
128 ### common VTK settings
129 VTK_CMAKE_OPTIONS=$VTK_CMAKE_OPTIONS" -DBUILD_SHARED_LIBS:BOOL=ON"
130 VTK_CMAKE_OPTIONS=$VTK_CMAKE_OPTIONS" -DCMAKE_BUILD_TYPE:STRING=Release"
131 VTK_CMAKE_OPTIONS=$VTK_CMAKE_OPTIONS" -DCMAKE_CXX_COMPILER:STRING=`which g++`"
132 VTK_CMAKE_OPTIONS=$VTK_CMAKE_OPTIONS" -DCMAKE_C_COMPILER:STRING=`which gcc`"
133 VTK_CMAKE_OPTIONS=$VTK_CMAKE_OPTIONS" -DCMAKE_INSTALL_PREFIX:STRING=${PRODUCT_DIR}"
134 VTK_CMAKE_OPTIONS=$VTK_CMAKE_OPTIONS" -DVTK_USE_HYBRID:BOOL=ON"
135 VTK_CMAKE_OPTIONS=$VTK_CMAKE_OPTIONS" -DVTK_USE_PARALLEL:BOOL=ON"
136 VTK_CMAKE_OPTIONS=$VTK_CMAKE_OPTIONS" -DVTK_USE_PATENTED:BOOL=OFF"
137 VTK_CMAKE_OPTIONS=$VTK_CMAKE_OPTIONS" -DVTK_USE_RENDERING:BOOL=ON"
138 if test `uname -m` = "x86_64" ; then
139 VTK_CMAKE_OPTIONS=$VTK_CMAKE_OPTIONS" -DCMAKE_CXX_FLAGS:STRING=-m64"
140 VTK_CMAKE_OPTIONS=$VTK_CMAKE_OPTIONS" -DCMAKE_C_FLAGS:STRING=-m64"
143 ### Wrap Python settings
144 if [ "${python_version}" != "" ]; then
145 VTK_CMAKE_OPTIONS=$VTK_CMAKE_OPTIONS" -DVTK_WRAP_PYTHON:BOOL=ON"
146 VTK_CMAKE_OPTIONS=$VTK_CMAKE_OPTIONS" -DPYTHON_EXECUTABLE:STRING=${PYTHONHOME}/bin/python${python_version}"
147 VTK_CMAKE_OPTIONS=$VTK_CMAKE_OPTIONS" -DPYTHON_INCLUDE_PATH:STRING=${PYTHONHOME}/include/python${python_version}"
148 VTK_CMAKE_OPTIONS=$VTK_CMAKE_OPTIONS" -DPYTHON_LIBRARY:STRING=${PYTHONHOME}/lib/python${python_version}/config/libpython${python_version}.a"
150 ### Wrap Tcl settings
151 if [ "${tcl_version}" != "" ] && [ "${tcl_includes}" != "" ] && [ "${tcl_libs}" != "" ] ; then
152 # suppose that tcl and tk are installed in the same dir
153 VTK_CMAKE_OPTIONS=$VTK_CMAKE_OPTIONS" -DVTK_WRAP_TCL:BOOL=ON"
154 VTK_CMAKE_OPTIONS=$VTK_CMAKE_OPTIONS" -DTCL_INCLUDE_PATH:STRING=${tcl_includes}"
155 VTK_CMAKE_OPTIONS=$VTK_CMAKE_OPTIONS" -DTCL_LIBRARY:STRING=${tcl_libs}/libtcl${tcl_version}.so"
156 VTK_CMAKE_OPTIONS=$VTK_CMAKE_OPTIONS" -DTCL_STUB_LIBRARY:STRING=${tcl_libs}/libtclstub${tcl_version}.a"
157 VTK_CMAKE_OPTIONS=$VTK_CMAKE_OPTIONS" -DTCL_TCLSH:STRING=${TCLHOME}/bin/tclsh${tcl_version}"
158 VTK_CMAKE_OPTIONS=$VTK_CMAKE_OPTIONS" -DTK_INCLUDE_PATH:STRING=${tcl_includes}"
159 VTK_CMAKE_OPTIONS=$VTK_CMAKE_OPTIONS" -DTK_LIBRARY:STRING=${tcl_libs}/libtk${tcl_version}.so"
160 VTK_CMAKE_OPTIONS=$VTK_CMAKE_OPTIONS" -DTK_STUB_LIBRARY:STRING=${tcl_libs}/libtkstub${tcl_version}.a"
161 VTK_CMAKE_OPTIONS=$VTK_CMAKE_OPTIONS" -DTK_WISH:STRING=${TCLHOME}/bin/wish${tcl_version}"
163 ### if Mesa is pre-installed
164 if [ -n "$MESA_HOME" ]; then
165 VTK_CMAKE_OPTIONS=$VTK_CMAKE_OPTIONS" -DOPENGL_INCLUDE_DIR:STRING=${MESA_HOME}/include"
166 if test `uname -m` = "x86_64" ; then
167 VTK_CMAKE_OPTIONS=$VTK_CMAKE_OPTIONS" -DOPENGL_gl_LIBRARY:STRING=${MESA_HOME}/lib64/libGL.so"
168 VTK_CMAKE_OPTIONS=$VTK_CMAKE_OPTIONS" -DOPENGL_glu_LIBRARY:STRING=${MESA_HOME}/lib64/libGLU.so"
170 VTK_CMAKE_OPTIONS=$VTK_CMAKE_OPTIONS" -DOPENGL_gl_LIBRARY:STRING=${MESA_HOME}/lib/libGL.so"
171 VTK_CMAKE_OPTIONS=$VTK_CMAKE_OPTIONS" -DOPENGL_glu_LIBRARY:STRING=${MESA_HOME}/lib/libGLU.so"
173 VTK_CMAKE_OPTIONS=$VTK_CMAKE_OPTIONS" -DOPENGL_xmesa_INCLUDE_DIR:STRING=${MESA_HOME}/include"
176 cat > ${PRODUCT_DIR}/CONFIGURE.LOG <<EOF
180 check_job ${PRODUCT_DIR}/CONFIGURE.LOG ${PRODUCT_DIR}_SRC/cmake-1.6.6_SRC/Source/cmake . $VTK_CMAKE_OPTIONS
182 cat > ${PRODUCT_DIR}/MAKE.LOG <<EOF
185 check_job ${PRODUCT_DIR}/MAKE.LOG make
187 check_job ${PRODUCT_DIR}/MAKEINSTALL.LOG make install
189 cd ${PRODUCT_DIR}_SRC/${PRODUCT}_SRC/Wrapping/Python
191 check_job ${PRODUCT_DIR}/SETUPPYTHON.LOG python setup.py install --prefix=${PRODUCT_DIR}
193 # set correct symbolic links - bug of python wrappings installation
194 if test `uname -m` = "x86_64" ; then
195 cd ${PRODUCT_DIR}/lib64/python${python_version}/site-packages/vtk_python
197 cd ${PRODUCT_DIR}/lib/python${python_version}/site-packages/vtk_python
199 ln -sf ../../../vtk/*Python*.so .
201 if test `uname -m` = "x86_64" ; then
202 cd ${PRODUCT_DIR}; ln -s lib64 lib
205 #du -sk ${PRODUCT_DIR}_SRC > ${PRODUCT_DIR}/size.log
208 # remove sources and temporary files after building
209 if [ ${REMOVE_SRC_TMP} == "TRUE" ] ; then
210 test -d ${PRODUCT_DIR}_SRC && rm -fr ${PRODUCT_DIR}_SRC
213 # to generate environment scripts
219 make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}
220 source ${INSTALL_WORK}/$SHRC
222 if [ -n "$MESA_HOME" ]; then
223 check_jb tar xfz ${SOURCE_DIR}/${PRODUCT}_with_Mesa.tar.gz -C ${INSTALL_ROOT}
225 check_jb tar xfz ${SOURCE_DIR}/${PRODUCT}.tar.gz -C ${INSTALL_ROOT}
228 # to generate environment script for sources
233 export INSTALL_WORK=$2;
234 export SOURCE_DIR=$3;
235 export INSTALL_ROOT=$4;
236 export PRODUCT_SEQUENCE=$5;
237 export PRODUCT_TYPE=$6;
238 export INSTALL_PRODUCTS=$7;
241 export PRODUCT="VTK-4.2.6"
242 export PRODUCT_DIR=${INSTALL_ROOT}/${PRODUCT}
243 export PRODUCT_WORK=${INSTALL_WORK}/${PRODUCT}