# 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%'`"
+tcl_version=""
+tcldir="`where_tcl`"
+if [ $? -eq 0 ] && [ -e ${tcldir}/tclConfig.sh ] ; then
+ tcl_version=`grep -e "TCL_VERSION=.*" ${tcldir}/tclConfig.sh | sed -e "s%TCL_VERSION=[\'|\"]\(.*\)[\'|\"]%\1%g"`
+fi
VTK_CMAKE_OPTIONS=""
### common VTK settings
VTK_CMAKE_OPTIONS=$VTK_CMAKE_OPTIONS" -DVTK_USE_PATENTED:BOOL=OFF"
VTK_CMAKE_OPTIONS=$VTK_CMAKE_OPTIONS" -DVTK_USE_RENDERING:BOOL=ON"
### Wrap Python settings
+if [ "${python_version}" != "" ]; then
VTK_CMAKE_OPTIONS=$VTK_CMAKE_OPTIONS" -DVTK_WRAP_PYTHON:BOOL=ON"
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"
+fi
### Wrap Tcl settings
+if [ "${tcl_version}" != "" ]; then
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" -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"
+fi
### if Mesa is pre-installed
if [ -n "$MESA_HOME" ]; then
VTK_CMAKE_OPTIONS=$VTK_CMAKE_OPTIONS" -DOPENGL_INCLUDE_DIR:STRING=${MESA_HOME}/include"
EOF
check_job ${PRODUCT_DIR}/MAKE.LOG make
-check_job ${PRODUCT_DIR}/INSTALL.LOG make install
+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}
+#du -sk ${PRODUCT_WORK} > ${PRODUCT_DIR}/size.log
+#du -sk ${INSTALL_WORK}/cmake-1.6.6 >> ${PRODUCT_DIR}/size.log
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 .
-#du -sk ${PRODUCT_WORK} > ${PRODUCT_DIR}/size.log
-rm -fr ${PRODUCT_WORK}
print_env
}