export VTKHOME=\${INSTALL_ROOT}/${PRODUCT}
export PATH=\${VTKHOME}/bin:\${PATH}
export LD_LIBRARY_PATH=\${VTKHOME}/lib/vtk:\${LD_LIBRARY_PATH}
+export PYTHONPATH=\${VTKHOME}/lib/vtk:\${VTKHOME}/lib/python\${PYTHON_VERSION}/site-packages/vtk_python:\${PYTHONPATH}
+export TCLLIBPATH="\${VTKHOME}/lib/vtk/tcl \${TCLLIBPATH}"
##
EOF
(test -w ${PRODUCT_DIR} && cp ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh ${PRODUCT_DIR})
try_native(){
check_version
if [ $? -eq 0 ] ; then
+ python_version="`python -c 'import sys; print sys.version[:3]'`"
tmp="\${VTKHOME}/bin ${VTKHOME}/bin \${PATH} ${PATH}";
path=`sort_path ${tmp}`
tmp="\${VTKHOME}/lib/vtk ${VTKHOME}/lib/vtk \${LD_LIBRARY_PATH} ${LD_LIBRARY_PATH}";
ld_library_path=`sort_path ${tmp}`
+ 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}";
+ python_path=`sort_path ${tmp}`
cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh <<EOF
#$DELIM ${PRODUCT_TYPE} $DELIM
export VTKHOME=${VTKHOME}
export PATH=${path}
export LD_LIBRARY_PATH=${ld_library_path}
+export PYTHONPATH=${python_path}
+export TCLLIBPATH="\${VTKHOME}/lib/vtk/tcl \${TCLLIBPATH}"
##
EOF
make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}"
check_jb tar xfz ${SOURCE_DIR}/VTK-4.2-LatestRelease.tar.gz -C ${INSTALL_WORK}
cd ${PRODUCT_WORK}
+# get Python and tcl/tk version
+python_version="`python -c 'import sys; print sys.version[:3]'`"
+tcl_version="`find ${TCLHOME}/lib -name 'libtcl*.so' | awk '/libtcl[0-9.]+.so/ { print $0}' | sed -e 's%^.*libtcl\([0-9\.]*\)\.so%\1%'`"
+
VTK_CMAKE_OPTIONS=""
### common VTK settings
VTK_CMAKE_OPTIONS=$VTK_CMAKE_OPTIONS" -DBUILD_SHARED_LIBS:BOOL=ON"
VTK_CMAKE_OPTIONS=$VTK_CMAKE_OPTIONS" -DVTK_USE_RENDERING:BOOL=ON"
### Wrap Python settings
VTK_CMAKE_OPTIONS=$VTK_CMAKE_OPTIONS" -DVTK_WRAP_PYTHON:BOOL=ON"
-VTK_CMAKE_OPTIONS=$VTK_CMAKE_OPTIONS" -DPYTHON_EXECUTABLE:STRING=${PYTHONHOME}/bin/python2.2"
-VTK_CMAKE_OPTIONS=$VTK_CMAKE_OPTIONS" -DPYTHON_INCLUDE_PATH:STRING=${PYTHONHOME}/include/python2.2"
-VTK_CMAKE_OPTIONS=$VTK_CMAKE_OPTIONS" -DPYTHON_LIBRARY:STRING=${PYTHONHOME}/lib/python2.2/config/libpython2.2.a"
+VTK_CMAKE_OPTIONS=$VTK_CMAKE_OPTIONS" -DPYTHON_EXECUTABLE:STRING=${PYTHONHOME}/bin/python${python_version}"
+VTK_CMAKE_OPTIONS=$VTK_CMAKE_OPTIONS" -DPYTHON_INCLUDE_PATH:STRING=${PYTHONHOME}/include/python${python_version}"
+VTK_CMAKE_OPTIONS=$VTK_CMAKE_OPTIONS" -DPYTHON_LIBRARY:STRING=${PYTHONHOME}/lib/python${python_version}/config/libpython${python_version}.a"
+### Wrap Tcl settings
+VTK_CMAKE_OPTIONS=$VTK_CMAKE_OPTIONS" -DVTK_WRAP_TCL:BOOL=ON"
+VTK_CMAKE_OPTIONS=$VTK_CMAKE_OPTIONS" -DTCL_INCLUDE_PATH:STRING=${TCLHOME}/include"
+VTK_CMAKE_OPTIONS=$VTK_CMAKE_OPTIONS" -DTCL_LIBRARY:STRING=${TCLHOME}/lib/libtcl${tcl_version}.so"
+VTK_CMAKE_OPTIONS=$VTK_CMAKE_OPTIONS" -DTCL_STUB_LIBRARY:STRING=${TCLHOME}/lib/libtclstub${tcl_version}.a"
+VTK_CMAKE_OPTIONS=$VTK_CMAKE_OPTIONS" -DTCL_TCLSH:STRING=${TCLHOME}/bin/tclsh"
+VTK_CMAKE_OPTIONS=$VTK_CMAKE_OPTIONS" -DTK_INCLUDE_PATH:STRING=${TCLHOME}/include"
+VTK_CMAKE_OPTIONS=$VTK_CMAKE_OPTIONS" -DTK_LIBRARY:STRING=${TCLHOME}/lib/libtk${tcl_version}.so"
+VTK_CMAKE_OPTIONS=$VTK_CMAKE_OPTIONS" -DTK_STUB_LIBRARY:STRING=${TCLHOME}/lib/libtkstub${tcl_version}.a"
+VTK_CMAKE_OPTIONS=$VTK_CMAKE_OPTIONS" -DTK_WISH:STRING=${TCLHOME}/bin/wish"
### if Mesa is pre-installed
if [ -n "$MESA_HOME" ]; then
VTK_CMAKE_OPTIONS=$VTK_CMAKE_OPTIONS" -DOPENGL_INCLUDE_DIR:STRING=${MESA_HOME}/include"
check_job ${PRODUCT_DIR}/MAKEINSTALL.LOG make install
+cd ${PRODUCT_WORK}/Wrapping/Python
+check_job ${PRODUCT_DIR}/SETUPPYTHON.LOG python setup.py install --prefix=${PRODUCT_DIR}
+
rm -fr ${PRODUCT_WORK} ${INSTALL_WORK}/cmake-1.6.6
+
+# set correct symbolic links - bug of python wrappings installation
+cd ${PRODUCT_DIR}/lib/python${python_version}/site-packages/vtk_python
+ln -sf ../../../vtk/*Python*.so .
+
print_env
}