# Copyright 1999-2004 Gentoo Technologies, Inc. # Distributed under the terms of the GNU General Public License v2 # $Header: $ # TODO: # o fix the VTK_DATA_ROOT problem (workaround in place now I think) # o /usr/lib/vtk/VTKConfig.cmake has some problems (usr/blah instead of # /usr/blah in many places). As far as I know, this means you can't # build the Cxx examples... # o java bindings work? (I don't think so...) inherit flag-o-matic distutils DESCRIPTION="visualization toolkit" HOMEPAGE="http://www.vtk.org" LICENSE="VTK" SLOT="0" KEYWORDS="~x86" IUSE="doc data python tcltk java patented" RDEPEND="python? ( >=dev-lang/python-2.0 ) tcltk? ( >=dev-lang/tcl-8.2.3 >=dev-lang/tk-8.2.3 ) java? ( virtual/jdk ) media-libs/jpeg media-libs/tiff media-libs/libpng sys-libs/zlib dev-libs/expat" DEPEND=">=dev-util/cmake-1.8 ${RDEPEND}" SHORT_PV=`echo ${PV} | sed -e "s/\(^[0-9]*\.[0-9]*\).*/\1/"` SRC_URI="ftp://public.kitware.com/pub/vtk/vtk${SHORT_PV}/moved_to_sourceforge/VTK-${PV}.tar.gz doc? ( ftp://public.kitware.com/pub/vtk/vtk${SHORT_PV}/moved_to_sourceforge/VTKDocHtml-${SHORT_PV}.tar.gz ) data? ( ftp://public.kitware.com/pub/vtk/vtk${SHORT_PV}/moved_to_sourceforge/VTKData-${SHORT_PV}.tar.gz )" S=${WORKDIR}/VTK src_compile() { # gcc versions 3.2.x seem to have sse-related bugs that are triggered # by VTK when compiling for pentium3/4 filter-mfpmath sse filter-flags "-msse -msse2" use x86 && append-flags "-mno-sse" # build list of config variable defines to pass to cmake CMAKE_VARIABLES="-DCMAKE_INSTALL_PREFIX:PATH=${D}/usr" CMAKE_VARIABLES="${CMAKE_VARIABLES} -DBUILD_SHARED_LIBS:BOOL=ON" # is local flag the right way to deal with this? use patented && CMAKE_VARIABLES="${CMAKE_VARIABLES} -DVTK_USE_PATENTED:BOOL=ON" CMAKE_VARIABLES="${CMAKE_VARIABLES} -DVTK_USE_HYBRID:BOOL=ON" # should this be configurable? CMAKE_VARIABLES="${CMAKE_VARIABLES} -DVTK_USE_PARALLEL:BOOL=ON" use tcltk && CMAKE_VARIABLES="${CMAKE_VARIABLES} -DVTK_WRAP_TCL:BOOL=ON" use python && CMAKE_VARIABLES="${CMAKE_VARIABLES} -DVTK_WRAP_PYTHON:BOOL=ON" use java && CMAKE_VARIABLES="${CMAKE_VARIABLES} -DVTK_WRAP_JAVA:BOOL=ON" CMAKE_VARIABLES="${CMAKE_VARIABLES} -DVTK_USE_SYSTEM_JPEG:BOOL=ON" CMAKE_VARIABLES="${CMAKE_VARIABLES} -DVTK_USE_SYSTEM_PNG:BOOL=ON" CMAKE_VARIABLES="${CMAKE_VARIABLES} -DVTK_USE_SYSTEM_TIFF:BOOL=ON" CMAKE_VARIABLES="${CMAKE_VARIABLES} -DVTK_USE_SYSTEM_ZLIB:BOOL=ON" CMAKE_VARIABLES="${CMAKE_VARIABLES} -DVTK_USE_SYSTEM_EXPAT:BOOL=ON" # we do not run tests (but it might be a good idea to do so) CMAKE_VARIABLES="${CMAKE_VARIABLES} -DBUILD_TESTING:BOOL=OFF" # build the examples (presumably the Cxx ones -- haven't test this yet) #CMAKE_VARIABLES="${CMAKE_VARIABLES} -DBUILD_EXAMPLES:BOOL=OFF" # FIXME: setting VTK_DATA_ROOT here doesn't work!! If I try to open one # of the examples, I get errors like this: # $ vtk Medical1.tcl # ERROR: In /var/tmp/portage/vtk-4.2.6-r1/work/VTK/IO/vtkVolume16Reader.cxx, line 334 # vtkVolume16Reader (0x81270d8): Can't find file: /usr/lib/vtk/tcl/vtkbase/../../../../VTKData/Data/headsq/quarter.1 # ERROR: In /var/tmp/portage/vtk-4.2.6-r1/work/VTK/Graphics/vtkPolyDataNormals.cxx, line 88 # vtkPolyDataNormals (0x811d828): No data to generate normals for! use data && CMAKE_VARIABLES="${CMAKE_VARIABLES} -DVTK_DATA_ROOT:PATH=/usr/share/vtkdata" # I provide a kludge to make this work below using /etc/env # make cmake prefer searching libraries in /usr/lib (otherwise wrong ones - # like /opt/ibm-jdk-1.4.1/jre/bin/libjpeg.so instead of /usr/lib/libjpeg.so # - might be selected) export PATH="/usr/lib:${PATH}" cmake ${CMAKE_VARIABLES} . || die "cmake configuration failed" emake || die "emake failed" } src_install() { # 4.4 ebuild has make DESTDIR=${D} install || die # Does this matter? make install || die "make install failed" # fix the config file cat ${D}/usr/lib/vtk/VTKConfig.cmake | sed -e "s:${D}::g" > ${D}/usr/lib/vtk/VTKConfig.cmake.fixed mv -f ${D}/usr/lib/vtk/VTKConfig.cmake.fixed ${D}/usr/lib/vtk/VTKConfig.cmake # paths for dynamic linking LD_PATHS="/usr/lib/vtk" # python are not installed by 'make install' if [ `use python` ]; then cd ${S}/Wrapping/Python docinto vtk_python distutils_src_install distutils_python_version LD_PATHS="${LD_PATHS}:/usr/lib/python${PY_VER}/site-packages/vtk_python" # fix broken symlinks cd ${D}/usr/lib/python${PY_VER}/site-packages/vtk_python ln -s ../../../libvtk*Python*.so . fi if [ `use doc` ]; then docinto "" dohtml -r ${WORKDIR}/html/ cd ${S} tar cf ${WORKDIR}/examples.tar Examples dodoc ${WORKDIR}/examples.tar fi #install vtk data used in many of the examples if [ `use data` ]; then dodir /usr/share/vtkdata #VTKData uses a hyphen instead of a dot SHORT_PV_HYPHEN=`echo ${SHORT_PV} | sed -e "s/\./-/"` mv ${WORKDIR}/VTKData-release-${SHORT_PV_HYPHEN}/* ${D}/usr/share/vtkdata/. fi # env.d stuff insinto /etc/env.d/ echo "LDPATH=${LD_PATHS}" > 40vtk # Because setting VTK_DATA_ROOT doesn't seem to work during compiling, I'll set # it here until I can work out the problem above. if [ 'use data' ]; then echo "VTK_DATA_ROOT=/usr/share/vtkdata" >> 40vtk fi doins 40vtk } pkg_postinst() { if [ `use patented` ]; then ewarn "Using patented classes in commercial application requires a licence." ewarn "For more information read" ewarn "http://public.kitware.com/cgi-bin/vtkfaq?req=show&file=faq07.005.htp" fi }