5 if [ -z "$VTKHOME" ]; then
8 check_lib_version libvtkCommon.so ${VTKHOME}/lib/vtk
9 if [ "$?" -eq "0" ]; then
17 cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh <<EOF
18 #$DELIM ${PRODUCT_TYPE} $DELIM
19 export VTKHOME=\${INSTALL_ROOT}/${PRODUCT}
20 export PATH=\${VTKHOME}/bin:\${PATH}
21 export LD_LIBRARY_PATH=\${VTKHOME}/lib/vtk:\${LD_LIBRARY_PATH}
22 export PYTHONPATH=\${VTKHOME}/lib/vtk:\${VTKHOME}/lib/python\${PYTHON_VERSION}/site-packages/vtk_python:\${PYTHONPATH}
23 export TCLLIBPATH="\${VTKHOME}/lib/vtk/tcl \${TCLLIBPATH}"
26 (test -w ${PRODUCT_DIR} && cp ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh ${PRODUCT_DIR})
27 make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}"
30 # looks for the native product and collects it's environment (used by make_env())
33 if [ $? -eq 0 ] ; then
34 python_version="`python -c 'import sys; print sys.version[:3]'`"
35 tmp="\${VTKHOME}/bin ${VTKHOME}/bin \${PATH} ${PATH}";
36 path=`sort_path ${tmp}`
37 tmp="\${VTKHOME}/lib/vtk ${VTKHOME}/lib/vtk \${LD_LIBRARY_PATH} ${LD_LIBRARY_PATH}";
38 ld_library_path=`sort_path ${tmp}`
39 tmp="\${VTKHOME}/lib/vtk:\${VTKHOME}/lib/python${PYTHON_VERSION}/site-packages/vtk_python ${VTKHOME}/lib/vtk:${VTKHOME}/lib/python${python_version}/site-packages/vtk_python \${PYTHONPATH} ${PYTHONPATH}";
40 python_path=`sort_path ${tmp}`
41 cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh <<EOF
42 #$DELIM ${PRODUCT_TYPE} $DELIM
43 export VTKHOME=${VTKHOME}
45 export LD_LIBRARY_PATH=${ld_library_path}
46 export PYTHONPATH=${python_path}
47 export TCLLIBPATH="\${VTKHOME}/lib/vtk/tcl \${TCLLIBPATH}"
50 make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}"
57 try_existing ${PRODUCT_DIR} ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" ${PRODUCT_TYPE}
63 make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" ${PRODUCT_TYPE}
64 source ${INSTALL_WORK}/$SHRC
66 makedir ${PRODUCT_DIR}
68 check_jb tar xfz ${SOURCE_DIR}/cmake-1.6.6.tar.gz -C ${INSTALL_WORK}
69 cd ${INSTALL_WORK}/cmake-1.6.6
70 check_job ${PRODUCT_DIR}/CONFIGUREcmake.LOG ./configure
71 cat >> ${PRODUCT_DIR}/MAKEcmake.LOG <<EOF
74 check_job ${PRODUCT_DIR}/MAKEcmake.LOG make
76 check_jb tar xfz ${SOURCE_DIR}/VTK-4.2.6.tar.gz -C ${INSTALL_WORK}
79 # apply a small patch for VTK (needed for gcc-3.4)
80 sed -e "s%seekg(self->GetFile()->tellg()%seekg(static_cast<long>(self->GetFile()->tellg())%g" IO/vtkBMPReader.cxx > IO/vtkBMPReader.cxx.orig
81 mv -f IO/vtkBMPReader.cxx.orig IO/vtkBMPReader.cxx
82 sed -e "s%seekg(self->GetFile()->tellg()%seekg(static_cast<long>(self->GetFile()->tellg())%g" IO/vtkImageReader.cxx > IO/vtkImageReader.cxx.orig
83 mv -f IO/vtkImageReader.cxx.orig IO/vtkImageReader.cxx
85 # get Python and tcl/tk version
86 python_version="`python -c 'import sys; print sys.version[:3]'`"
91 if [ $? -eq 0 ] && [ -e ${tcldir}/tclConfig.sh ] ; then
92 tcl_version=`grep -e "TCL_VERSION=.*" ${tcldir}/tclConfig.sh | sed -e "s%TCL_VERSION=[\'|\"]\(.*\)[\'|\"]%\1%g"`
93 tcl_includes=`grep -e "TCL_INCLUDE_SPEC=.*" ${tcldir}/tclConfig.sh | sed -e "s%TCL_INCLUDE_SPEC=[\'|\"]-I\(.*\)[\'|\"]%\1%g"`
94 if [ -z "$tcl_includes" ] ; then tcl_includes=/usr/include ; fi
95 tcl_libs=`grep -e "TCL_PACKAGE_PATH=.*" ${tcldir}/tclConfig.sh | sed -e "s%TCL_PACKAGE_PATH=[\'|\"]\(.*\)[\'|\"]%\1%g"`
99 ### common VTK settings
100 VTK_CMAKE_OPTIONS=$VTK_CMAKE_OPTIONS" -DBUILD_SHARED_LIBS:BOOL=ON"
101 VTK_CMAKE_OPTIONS=$VTK_CMAKE_OPTIONS" -DCMAKE_BUILD_TYPE:STRING=Release"
102 VTK_CMAKE_OPTIONS=$VTK_CMAKE_OPTIONS" -DCMAKE_CXX_COMPILER:STRING=`which g++`"
103 VTK_CMAKE_OPTIONS=$VTK_CMAKE_OPTIONS" -DCMAKE_C_COMPILER:STRING=`which gcc`"
104 VTK_CMAKE_OPTIONS=$VTK_CMAKE_OPTIONS" -DCMAKE_INSTALL_PREFIX:STRING=${PRODUCT_DIR}"
105 VTK_CMAKE_OPTIONS=$VTK_CMAKE_OPTIONS" -DVTK_USE_HYBRID:BOOL=ON"
106 VTK_CMAKE_OPTIONS=$VTK_CMAKE_OPTIONS" -DVTK_USE_PARALLEL:BOOL=ON"
107 VTK_CMAKE_OPTIONS=$VTK_CMAKE_OPTIONS" -DVTK_USE_PATENTED:BOOL=OFF"
108 VTK_CMAKE_OPTIONS=$VTK_CMAKE_OPTIONS" -DVTK_USE_RENDERING:BOOL=ON"
109 ### Wrap Python settings
110 if [ "${python_version}" != "" ]; then
111 VTK_CMAKE_OPTIONS=$VTK_CMAKE_OPTIONS" -DVTK_WRAP_PYTHON:BOOL=ON"
112 VTK_CMAKE_OPTIONS=$VTK_CMAKE_OPTIONS" -DPYTHON_EXECUTABLE:STRING=${PYTHONHOME}/bin/python${python_version}"
113 VTK_CMAKE_OPTIONS=$VTK_CMAKE_OPTIONS" -DPYTHON_INCLUDE_PATH:STRING=${PYTHONHOME}/include/python${python_version}"
114 VTK_CMAKE_OPTIONS=$VTK_CMAKE_OPTIONS" -DPYTHON_LIBRARY:STRING=${PYTHONHOME}/lib/python${python_version}/config/libpython${python_version}.a"
116 ### Wrap Tcl settings
117 if [ "${tcl_version}" != "" ] && [ "${tcl_includes}" != "" ] && [ "${tcl_libs}" != "" ] ; then
118 # suppose that tcl and tk are installed in the same dir
119 VTK_CMAKE_OPTIONS=$VTK_CMAKE_OPTIONS" -DVTK_WRAP_TCL:BOOL=ON"
120 VTK_CMAKE_OPTIONS=$VTK_CMAKE_OPTIONS" -DTCL_INCLUDE_PATH:STRING=${tcl_includes}"
121 VTK_CMAKE_OPTIONS=$VTK_CMAKE_OPTIONS" -DTCL_LIBRARY:STRING=${tcl_libs}/libtcl${tcl_version}.so"
122 VTK_CMAKE_OPTIONS=$VTK_CMAKE_OPTIONS" -DTCL_STUB_LIBRARY:STRING=${tcl_libs}/libtclstub${tcl_version}.a"
123 VTK_CMAKE_OPTIONS=$VTK_CMAKE_OPTIONS" -DTCL_TCLSH:STRING=${TCLHOME}/bin/tclsh${tcl_version}"
124 VTK_CMAKE_OPTIONS=$VTK_CMAKE_OPTIONS" -DTK_INCLUDE_PATH:STRING=${tcl_includes}"
125 VTK_CMAKE_OPTIONS=$VTK_CMAKE_OPTIONS" -DTK_LIBRARY:STRING=${tcl_libs}/libtk${tcl_version}.so"
126 VTK_CMAKE_OPTIONS=$VTK_CMAKE_OPTIONS" -DTK_STUB_LIBRARY:STRING=${tcl_libs}/libtkstub${tcl_version}.a"
127 VTK_CMAKE_OPTIONS=$VTK_CMAKE_OPTIONS" -DTK_WISH:STRING=${TCLHOME}/bin/wish${tcl_version}"
129 ### if Mesa is pre-installed
130 if [ -n "$MESA_HOME" ]; then
131 VTK_CMAKE_OPTIONS=$VTK_CMAKE_OPTIONS" -DOPENGL_INCLUDE_DIR:STRING=${MESA_HOME}/include"
132 VTK_CMAKE_OPTIONS=$VTK_CMAKE_OPTIONS" -DOPENGL_gl_LIBRARY:STRING=${MESA_HOME}/lib/libGL.so"
133 VTK_CMAKE_OPTIONS=$VTK_CMAKE_OPTIONS" -DOPENGL_glu_LIBRARY:STRING=${MESA_HOME}/lib/libGLU.so"
134 VTK_CMAKE_OPTIONS=$VTK_CMAKE_OPTIONS" -DOPENGL_xmesa_INCLUDE_DIR:STRING=${MESA_HOME}/include"
137 cat > ${PRODUCT_DIR}/CONFIGURE.LOG <<EOF
141 check_job ${PRODUCT_DIR}/CONFIGURE.LOG ${INSTALL_WORK}/cmake-1.6.6/Source/cmake . $VTK_CMAKE_OPTIONS
143 cat > ${PRODUCT_DIR}/MAKE.LOG <<EOF
146 check_job ${PRODUCT_DIR}/MAKE.LOG make
148 check_job ${PRODUCT_DIR}/MAKEINSTALL.LOG make install
150 cd ${PRODUCT_WORK}/Wrapping/Python
151 check_job ${PRODUCT_DIR}/SETUPPYTHON.LOG python setup.py install --prefix=${PRODUCT_DIR}
153 #du -sk ${PRODUCT_WORK} > ${PRODUCT_DIR}/size.log
154 #du -sk ${INSTALL_WORK}/cmake-1.6.6 >> ${PRODUCT_DIR}/size.log
155 cd ${PRODUCT_DIR}; rm -fr ${PRODUCT_WORK} ${INSTALL_WORK}/cmake-1.6.6
157 # set correct symbolic links - bug of python wrappings installation
158 cd ${PRODUCT_DIR}/lib/python${python_version}/site-packages/vtk_python
159 ln -sf ../../../vtk/*Python*.so .
166 make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" ${PRODUCT_TYPE}
167 source ${INSTALL_WORK}/$SHRC
169 if [ -n "$MESA_HOME" ]; then
170 check_jb tar xfz ${SOURCE_DIR}/VTK-4.2.6-with-Mesa.tar.gz -C ${INSTALL_ROOT}
172 check_jb tar xfz ${SOURCE_DIR}/VTK-4.2.6.tar.gz -C ${INSTALL_ROOT}
179 export INSTALL_WORK=$2;
180 export SOURCE_DIR=$3;
181 export INSTALL_ROOT=$4;
182 export PRODUCT_SEQUENCE=$5;
183 if [ $# == 6 ] ; then export PRODUCT_TYPE=$6 ; else export PRODUCT_TYPE="vtk" ; fi
184 export PRODUCT="VTK-4.2.6"
185 export PRODUCT_DIR=${INSTALL_ROOT}/${PRODUCT}
186 export PRODUCT_WORK=${INSTALL_WORK}/${PRODUCT}