Summary: The Visualization Toolkit - A high level 3D visualization library
Name: vtk
Version: 3.1
Release: @BUILD@N
Copyright: Distributable
Group: Development/Libraries
Source: ftp://vtk.scorec.rpi.edu/pub/vtk.tar.gz
URL: http://www.kitware.com/vtk.html
Patch: vtk-linux.patch
#BuildPrereq: jdk, tk, python, python-devel, tcl
BuildPrereq: tk, python, python-devel, tcl

Buildroot: /usr/src/local/BUILD/vtk-root
Prefix: /usr

%description 
	VTK - the Visualization Toolkit is an object oriented, high
level library that allows one to easily write C++ programs, Tcl,
Python and Java scripts that do 3D visualization.  This package
provides the shared libraries needed to run C++ programs that use VTK.
The patented and contributed classes are also compiled. To compile
C++ code that uses VTK you have to install vtk-devel.

	VTK enables users to concentrate on their work by providing a
large number of excellent and feature packed high level functions that
do visualization.  The library needs OpenGL to render the graphics and
for Linux machines Mesa is necessary. The terms/copyright can be read
in /usr/doc/vtk-%{version}-%{release}/README.html. VTK-Linux-HOWTO has
information about using vtk, getting documentataion or help and
instructions on building VTK. The patented classes (few in number) are
not to be used commercially. Please read the files README.patented-dir
and README.patented-classes. This package is relocatable.

%changelog
* Thu Dec 1 2000 Daniel Blezek <blezek@crd.ge.com>
- Moved from /usr/local to /usr
- Checking into CVS
* Thu Nov 23 2000 David Gobbi <dgobbi@irus.rri.on.ca>
- put vtkpython.pth in /usr/lib/pythonX.X/site-packages
- changed prefix to /usr/local, set INSTALL_ROOT to RPM_BUILD_ROOT
- added /sbin/ldconfig to %post/%postun for each of tcl, python, java
* Wed Jul 12 2000 Daniel Blezek <blezek@crd.ge.com>: Removing the need for a patch by changing user.make
* Wed Dec 8 1999 Daniel Blezek <blezek@crd.ge.com>: adapted Aleksey's spec file to nightly releases
* Wed Oct 20 1999 Aleksey Nogin <ayn2@cornell.edu>
[vtk-2.4-1]
- Upgraded to vtk-2.4
- Made the SRPM a little more portable by removing Prabhu's "hardwired" paths
- Added tk sources to SRPM so that we do have access to tk header files.

* Fri Mar 26 1999 Prabhu Ramachandran <prabhu@aero.iitm.ernet.in>
- I am the current maintainer

# vtk-devel

%package devel
Summary: VTK header files for building C++ code.
Requires: vtk
Group: Development/Libraries
Prefix: /usr

%description devel 
	This provides the VTK header files required to compile C++
programs that use VTK to do 3D visualisation.

# vtk-tcl

%package tcl
Summary: Tcl bindings for VTK.
Group: X11/Libraries
Prefix: /usr
# Requires: tk = %{tk_version}

%description tcl
	VTK - the Visualization Toolkit is an object oriented, high level
library that allows one to easily write C++ programs, Tcl, Python and Java
scripts that do 3D visualization.  This package provides the shared
libraries that enable one to use VTK via Tcl scripts.  This version also
provides the vtkTkRenderWindow class. The patented and contributed classes
are also compiled. This package does not require the vtk package to be
installed.  The library needs OpenGL to render the graphics and for Linux
machines Mesa is necessary. 

	The terms/copyright can be read in usr/doc/vtk-tcl-%{version}-%{release}/README.html. VTK-Linux-HOWTO has information about using vtk, getting
documentataion or help and instructions on building VTK. The patented
classes (few in number) are not to be used commercially. Please read the
files README.patented-dir and README.patented-classes. This package is
relocatable.

# vtk-python

%package python
Summary: Python bindings for VTK.
Requires: vtk
Group: X11/Libraries
Prefix: /usr

%description python 
	This provides the shared libraries that enable one to use VTK from
python scripts.  You will need python and vtk installed to use this.
Remember to set your PYTHONPATH variable properly before running your
scripts.

# vtk-java
 
%package java
Summary: Java bindings for VTK.
Group: X11/Libraries
Prefix: /usr

%description java
	VTK - the Visualization Toolkit is an object oriented, high level
library that allows one to easily write C++ programs, Tcl, Python and Java
scripts that do 3D visualization.  This package provides the shared
libraries that enable one to use VTK with java scripts.  The patented and
contributed classes are also compiled.  This package does not require the
vtk package to be installed.  The library needs OpenGL to render the
graphics and for Linux machines Mesa is necessary.  You will need jdk..
jdk-1.2pre-2 was used to compile this. Remember to set your CLASSPATH to the
directory that has the java classes.  

	The terms/copyright can be read in usr/doc/vtk-java-%{version}-%{release}/README and
README.html. VTK-Linux-HOWTO has information about using vtk, getting
documentataion or help and instructions on building VTK. The patented
classes (few in number) are not to be used commercially. Please read the
files README.patented-dir and README.patented-classes. This package is
relocatable.

# vtk-examples

%package examples
Summary: C++, Tcl and Python example programs/scripts for VTK.
Group: Development/Libraries
Prefix: /usr

%description examples
	This package contains all the examples from the VTK source.
To compile the C++ examples you will need to install the vtk-devel
package as well. The Python and Tcl examples can be run with the
corresponding packages (vtk-python, vtk-tcl).


%prep

%setup -n vtk -q
%patch -p1

%build

export CLASSPATH=.:/usr/local/jdk1.2.2:`pwd`/java/classes:`pwd`/java:`pwd`/java/vtk
export PATH=/usr/local/jdk1.2.2/bin:$PATH
export LD_LIBRARY_PATH=`pwd`/common:`pwd`/graphics:`pwd`/patented:`pwd`/imaging:`pwd`/contrib:`pwd`/java 

# Can't build with Mesa, Threads and Java, so dropping Java
# ./configure --with-mesa --with-shared --with-tcl --with-tkwidget --with-python --with-java --with-contrib --with-patented --prefix=/usr

export CC=cc
export CXX=g++

./configure --with-java --with-shared --with-tcl --with-tkwidget --with-python --with-contrib --with-patented --prefix=/usr

# Setup dir for java compiled classes
mkdir -p `pwd`/java/classes

export VTK_HOMEDIR=`pwd`
# export MAKE='make -j 2'
make -j 2
# make

%install

# chmod 644 README
cp ./patented/README ./README.patented-dir
echo -e "A list of the patented classes.\n\n" > README.patented-classes
ls ./patented/*.h >> README.patented-classes

rm -rf $RPM_BUILD_ROOT

#creating all the directories
install -d $RPM_BUILD_ROOT/usr/bin
install -d $RPM_BUILD_ROOT/usr/lib/vtk/{contrib/examplesTcl,examplesTcl/frog}
install -d $RPM_BUILD_ROOT/usr/lib/vtk/graphics/examples{Cxx,Tcl/RenderMan/Shaders,Python}
install -d $RPM_BUILD_ROOT/usr/lib/vtk/imaging/examples{,Cxx,Tcl}
install -d $RPM_BUILD_ROOT/usr/lib/vtk/patented/examplesTcl
install -d $RPM_BUILD_ROOT/usr/lib/vtk/java/vtk
install -d $RPM_BUILD_ROOT/usr/include/vtk

# this installs the libs and the vtk tcl interpretor

make INSTALL_ROOT=$RPM_BUILD_ROOT install
# make prefix=/usr install

#stripping all the shared libraries and the vtk interpreter
strip $RPM_BUILD_ROOT/usr/bin/vtk
strip $RPM_BUILD_ROOT/usr/lib/lib*

# this installs all the header files.
install -m 644 ./common/*.h $RPM_BUILD_ROOT/usr/include/vtk
install -m 644 ./contrib/*.h $RPM_BUILD_ROOT/usr/include/vtk
install -m 644 ./wrap/*.h $RPM_BUILD_ROOT/usr/include/vtk
install -m 644 ./graphics/*.h $RPM_BUILD_ROOT/usr/include/vtk
install -m 644 ./imaging/*.h $RPM_BUILD_ROOT/usr/include/vtk
install -m 644 ./patented/*.h $RPM_BUILD_ROOT/usr/include/vtk

#installing all the examples...

install  -m 644 ./contrib/examplesTcl/*.tcl $RPM_BUILD_ROOT/usr/lib/vtk/contrib/examplesTcl/

install  -m 644 ./examplesTcl/*.tcl $RPM_BUILD_ROOT/usr/lib/vtk/examplesTcl/

install  -m 644 ./examplesTcl/frog/*.tcl $RPM_BUILD_ROOT/usr/lib/vtk/examplesTcl/frog

install  -m 644 ./graphics/examplesCxx/*.cxx $RPM_BUILD_ROOT/usr/lib/vtk/graphics/examplesCxx/
install  -m 644 ./graphics/examplesCxx/Makefile* $RPM_BUILD_ROOT/usr/lib/vtk/graphics/examplesCxx/
install  -m 644 ./graphics/examplesPython/*.py $RPM_BUILD_ROOT/usr/lib/vtk/graphics/examplesPython/
install  -m 644 ./graphics/examplesTcl/{*.tcl,*.ppm} $RPM_BUILD_ROOT/usr/lib/vtk/graphics/examplesTcl/
install  -m 644 ./graphics/examplesTcl/RenderMan/{*.so,*.tcl} $RPM_BUILD_ROOT/usr/lib/vtk/graphics/examplesTcl/RenderMan/
install  -m 644 ./graphics/examplesTcl/RenderMan/Shaders/*.sl $RPM_BUILD_ROOT/usr/lib/vtk/graphics/examplesTcl/RenderMan/Shaders

# install  -m 644 ./imaging/examples/* $RPM_BUILD_ROOT/usr/lib/vtk/imaging/examples/
install  -m 644 ./imaging/examplesTcl/*.tcl $RPM_BUILD_ROOT/usr/lib/vtk/imaging/examplesTcl/
install  -m 644 ./imaging/examplesCxx/*.cxx $RPM_BUILD_ROOT/usr/lib/vtk/imaging/examplesCxx/

install  -m 644 ./patented/examplesTcl/*.tcl $RPM_BUILD_ROOT/usr/lib/vtk/patented/examplesTcl/

# installing java classes

install  -m 644 ./java/vtk.jar $RPM_BUILD_ROOT/usr/lib/vtk/

%post
# Check for /usr/lib in /etc/ld.so.conf...
if grep "/usr/lib" /etc/ld.so.conf > /dev/null
then
	true
else
	echo "/usr/lib" >> /etc/ld.so.conf
fi
/sbin/ldconfig

%post tcl
/sbin/ldconfig

%post python
/sbin/ldconfig

%post java
/sbin/ldconfig


%postun
/sbin/ldconfig

%postun tcl
/sbin/ldconfig

%postun python
/sbin/ldconfig

%postun java
/sbin/ldconfig



%files
%attr(755, root, root) /usr/lib/libVTKCommon.so 
%attr(755, root, root) /usr/lib/libVTKContrib.so
%attr(755, root, root) /usr/lib/libVTKGraphics.so 
%attr(755, root, root) /usr/lib/libVTKImaging.so
%attr(755, root, root) /usr/lib/libVTKPatented.so

%attr(-, root, root) %doc README.html VTK-Linux-HOWTO README.patented-dir 
# %attr(644, root, root) %doc README.patented-classes README vtkLogo.jpg
%attr(644, root, root) %doc README.patented-classes vtkLogo.jpg

%files devel
%attr(644, root, root) /usr/include/vtk/

%files tcl
%attr(755, root, root) /usr/lib/libVTKCommonTcl.so 
%attr(755, root, root) /usr/lib/libVTKContribTcl.so
%attr(755, root, root) /usr/lib/libVTKGraphicsTcl.so 
%attr(755, root, root) /usr/lib/libVTKImagingTcl.so
%attr(755, root, root) /usr/lib/libVTKPatentedTcl.so
%attr(755, root, root) /usr/bin/vtk

%attr(-, root, root) %doc README.html VTK-Linux-HOWTO README.patented-dir 
# %attr(644, root, root) %doc README.patented-classes README vtkLogo.jpg
%attr(644, root, root) %doc README.patented-classes vtkLogo.jpg


%files python
%attr(755, root, root) /usr/lib/libVTKCommonPython.so 
%attr(755, root, root) /usr/lib/libVTKContribPython.so
%attr(755, root, root) /usr/lib/libVTKGraphicsPython.so 
%attr(755, root, root) /usr/lib/libVTKImagingPython.so
%attr(755, root, root) /usr/lib/libVTKPatentedPython.so
%attr(755, root, root) /usr/lib/vtkTkRenderWidget
%attr(755, root, root) /usr/lib/vtkTkImageWindowWidget
%attr(755, root, root) /usr/lib/vtkTkImageViewerWidget
%attr(-, root, root)   /usr/lib/vtk/python/
%attr(644, root, root) %(python -c "import sys, os; print os.path.join(sys.prefix,'lib','python'+sys.version[0:3],'site-packages','vtkpython.pth')")


%files java
%attr(755, root, root) /usr/lib/libVTKCommonJava.so 
%attr(755, root, root) /usr/lib/libVTKContribJava.so
%attr(755, root, root) /usr/lib/libVTKGraphicsJava.so 
%attr(755, root, root) /usr/lib/libVTKImagingJava.so
%attr(755, root, root) /usr/lib/libVTKPatentedJava.so
%attr(755, root, root) /usr/lib/libvtkJava.so
%attr(-, root, root) /usr/lib/vtk.jar

# 
# %attr(-, root, root) %doc README.html VTK-Linux-HOWTO README.patented-dir 
# %attr(644, root, root) %doc README.patented-classes README vtkLogo.jpg


%files examples
%attr(-, root, root) /usr/lib/vtk/contrib
%attr(-, root, root) /usr/lib/vtk/examplesTcl
%attr(-, root, root) /usr/lib/vtk/graphics
%attr(-, root, root) /usr/lib/vtk/imaging
%attr(-, root, root) /usr/lib/vtk/patented


%clean 
rm -rf $RPM_BUILD_ROOT

