8b84c5b
%bcond_without OSMesa
8b84c5b
%bcond_with qt4
865e6c8
%bcond_without java
8b84c5b
8b84c5b
%{!?python_sitearch:%global python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)")}
8b84c5b
8b84c5b
Summary: The Visualization Toolkit - A high level 3D visualization library
8b84c5b
Name: vtk
19bc098
Version: 5.0.4
865e6c8
Release: 23%{?dist}
865e6c8
# This is a variant BSD license, a cross between BSD and ZLIB.
865e6c8
# For all intents, it has the same rights and restrictions as BSD.
865e6c8
# http://fedoraproject.org/wiki/Licensing/BSD#VTKBSDVariant
865e6c8
License: BSD
8b84c5b
Group: System Environment/Libraries
8b84c5b
Source: http://www.vtk.org/files/release/5.0/%{name}-%{version}.tar.gz
8b84c5b
Patch0: vtk-5.0.0-pythondestdir.patch
865e6c8
Patch1: vtk-5.0.4-gcc43.patch
8b84c5b
URL: http://vtk.org/
8b84c5b
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
8b84c5b
BuildRequires: cmake >= 2.0.4
8b84c5b
BuildRequires: gcc-c++
8b84c5b
%{?with_java:BuildRequires: java-devel}
8b84c5b
BuildRequires: libX11-devel, libXt-devel, libXext-devel
8b84c5b
BuildRequires: libICE-devel, libGL-devel
8b84c5b
%{?with_OSMesa:BuildRequires: mesa-libOSMesa-devel}
8b84c5b
BuildRequires: tk-devel, tcl-devel
8b84c5b
BuildRequires: python-devel
8b84c5b
BuildRequires: expat-devel, freetype-devel, libjpeg-devel, libpng-devel
8b84c5b
BuildRequires: libtiff-devel, zlib-devel
865e6c8
BuildRequires: qt3-devel
8b84c5b
%{?with_qt4:BuildRequires: qt4-devel}
8b84c5b
BuildRequires: chrpath
19bc098
BuildRequires: doxygen, graphviz
8b84c5b
8b84c5b
%description
8b84c5b
VTK is an open-source software system for image processing, 3D
8b84c5b
graphics, volume rendering and visualization. VTK includes many
8b84c5b
advanced algorithms (e.g., surface reconstruction, implicit modelling,
8b84c5b
decimation) and rendering techniques (e.g., hardware-accelerated
8b84c5b
volume rendering, LOD control).
8b84c5b
8b84c5b
%package devel
8b84c5b
Summary: VTK header files for building C++ code
8b84c5b
Requires: vtk = %{version}-%{release}
8b84c5b
Group: Development/Libraries
8b84c5b
8b84c5b
%description devel 
8b84c5b
This provides the VTK header files required to compile C++ programs that
8b84c5b
use VTK to do 3D visualisation.
8b84c5b
8b84c5b
%package tcl
8b84c5b
Summary: Tcl bindings for VTK
8b84c5b
Requires: vtk = %{version}-%{release}
8b84c5b
Group: System Environment/Libraries
8b84c5b
8b84c5b
%description tcl
8b84c5b
tcl bindings for VTK
8b84c5b
8b84c5b
%package python
8b84c5b
Summary: Python bindings for VTK
8b84c5b
Requires: vtk = %{version}-%{release}
8b84c5b
Group: System Environment/Libraries
8b84c5b
8b84c5b
%description python
8b84c5b
python bindings for VTK
8b84c5b
8b84c5b
%if %{with java}
8b84c5b
%package java
8b84c5b
Summary: Java bindings for VTK
8b84c5b
Requires: vtk = %{version}-%{release}
8b84c5b
Group: System Environment/Libraries
8b84c5b
8b84c5b
%description java
8b84c5b
Java bindings for VTK
8b84c5b
%endif
8b84c5b
8b84c5b
%package qt
8b84c5b
Summary: Qt bindings for VTK
8b84c5b
Requires: vtk = %{version}-%{release}
8b84c5b
Group: System Environment/Libraries
8b84c5b
8b84c5b
%description qt
8b84c5b
Qt bindings for VTK
8b84c5b
8b84c5b
%package testing
8b84c5b
Summary: Testing programs for VTK
8b84c5b
Requires: vtk = %{version}-%{release}, vtkdata = %{version}
8b84c5b
Group: Applications/Engineering
8b84c5b
8b84c5b
%description testing
8b84c5b
Testing programs for VTK
8b84c5b
8b84c5b
%package examples
8b84c5b
Summary: Examples for VTK
8b84c5b
Requires: vtk = %{version}-%{release}, vtkdata = %{version}
8b84c5b
Group: Applications/Engineering
8b84c5b
8b84c5b
%description examples
8b84c5b
This package contains many well-commented examples showing how to use
8b84c5b
VTK. Examples are available in the C++, Tcl, Python and Java
8b84c5b
programming languages.
8b84c5b
8b84c5b
8b84c5b
%prep
8b84c5b
%setup -q -n VTK
8b84c5b
%patch0 -p1
865e6c8
%patch1 -p1 -b .gcc43
8b84c5b
8b84c5b
# Replace relative path ../../../VTKData with %{_datadir}/vtkdata-%{version}
8b84c5b
# otherwise it will break on symlinks.
8b84c5b
grep -rl '\.\./\.\./\.\./\.\./VTKData' . | xargs \
8b84c5b
  perl -pi -e's,\.\./\.\./\.\./\.\./VTKData,%{_datadir}/vtkdata-%{version},g'
8b84c5b
8b84c5b
# Remove executable bits from sources
8b84c5b
find . -name \*.c -or -name \*.cxx -or -name \*.h | xargs chmod -x
8b84c5b
8b84c5b
# Save an unbuilt copy of the Example's sources for %doc
8b84c5b
mkdir vtk-examples-5.0
8b84c5b
cp -a Examples vtk-examples-5.0
8b84c5b
find vtk-examples-5.0 -type f | xargs chmod -R a-x
8b84c5b
8b84c5b
%build
8b84c5b
export CFLAGS="%{optflags} -D_UNICODE"
8b84c5b
export CXXFLAGS="%{optflags} -D_UNICODE"
8b84c5b
%if %{with java}
8b84c5b
export JAVA_HOME=/usr/lib/jvm/java
8b84c5b
%endif
8b84c5b
%if %{with qt4}
8b84c5b
unset QTINC QTLIB QTPATH_LRELEASE QMAKESPEC
8b84c5b
export QTDIR=%{_libdir}/qt4
8b84c5b
%endif
8b84c5b
8b84c5b
tmpinstall=`pwd`/tmpinstall
8b84c5b
8b84c5b
cmake_command="cmake . \
8b84c5b
 -DBUILD_SHARED_LIBS:BOOL=ON \
8b84c5b
 -DBUILD_DOCUMENTATION:BOOL=ON \
8b84c5b
 -DBUILD_EXAMPLES:BOOL=ON \
8b84c5b
 -DBUILD_TESTING:BOOL=ON \
8b84c5b
 -DCMAKE_INSTALL_PREFIX:PATH=$tmpinstall \
8b84c5b
 -DVTK_INSTALL_BIN_DIR:PATH=%{_bindir} \
8b84c5b
 -DVTK_INSTALL_INCLUDE_DIR:PATH=%{_includedir}/vtk \
8b84c5b
 -DVTK_INSTALL_LIB_DIR:PATH=%{_libdir} \
8b84c5b
 -DVTK_DATA_ROOT:PATH=%{_datadir}/vtkdata-%{version} \
19bc098
 -DTK_INTERNAL_PATH:PATH=/usr/include/tk-private/generic \
8b84c5b
%if %{with OSMesa}
8b84c5b
 -DVTK_OPENGL_HAS_OSMESA:BOOL=ON \
8b84c5b
%endif
8b84c5b
 -DVTK_WRAP_PYTHON:BOOL=ON \
8b84c5b
%if %{with java}
8b84c5b
 -DVTK_WRAP_JAVA:BOOL=ON \
8b84c5b
 -DJAVA_INCLUDE_PATH:PATH=$JAVA_HOME/include \
8b84c5b
 -DJAVA_INCLUDE_PATH2:PATH=$JAVA_HOME/include/linux \
8b84c5b
 -DJAVA_AWT_INCLUDE_PATH:PATH=$JAVA_HOME/include \
8b84c5b
%else
8b84c5b
 -DVTK_WRAP_JAVA:BOOL=OFF \
8b84c5b
%endif
8b84c5b
 -DVTK_WRAP_TCL:BOOL=ON \
8b84c5b
 -DVTK_USE_GL2PS:BOOL=ON \
8b84c5b
 -DVTK_USE_GUISUPPORT:BOOL=ON \
8b84c5b
 -DVTK_USE_PARALLEL:BOOL=ON \
8b84c5b
 -DVTK_USE_SYSTEM_EXPAT=ON \
8b84c5b
 -DVTK_USE_SYSTEM_FREETYPE=ON \
8b84c5b
 -DVTK_USE_SYSTEM_JPEG=ON \
8b84c5b
 -DVTK_USE_SYSTEM_PNG=ON \
8b84c5b
 -DVTK_USE_SYSTEM_TIFF=ON \
8b84c5b
 -DVTK_USE_SYSTEM_ZLIB=ON \
8b84c5b
 -DVTK_USE_QVTK=ON \
8b84c5b
%if %{with qt4}
8b84c5b
 -DDESIRED_QT_VERSION=4 \
8b84c5b
 -DQT_MOC_EXECUTABLE=%{_libdir}/qt4/bin/moc \
8b84c5b
 -DVTK_INSTALL_QT_DIR=`qmake-qt4 -query QT_INSTALL_PREFIX`/plugins/designer \
8b84c5b
%else
8b84c5b
 -DVTK_INSTALL_QT_DIR=`qmake -query QT_INSTALL_PREFIX`/plugins/designer \
8b84c5b
%endif
8b84c5b
"
8b84c5b
# Second cmake is neccessary for vtk
8b84c5b
eval $cmake_command
8b84c5b
eval $cmake_command
8b84c5b
8b84c5b
# Commented old flags in case we'd like to reactive some of them
8b84c5b
# -DVTK_USE_DISPLAY:BOOL=OFF \ # This prevents building of graphics tests
8b84c5b
# -DVTK_USE_HYBRID:BOOL=ON \
8b84c5b
# -DVTK_USE_PATENTED:BOOL=ON \
8b84c5b
# -DVTK_USE_RENDERING:BOOL=ON \
8b84c5b
# -DVTK_USE_MPI:BOOL=OFF \
8b84c5b
# -DVTK_USE_X:BOOL=ON \
8b84c5b
# -DOPENGL_INCLUDE_DIR:PATH=/usr/include/GL \
8b84c5b
fc75002
make
8b84c5b
8b84c5b
%install
8b84c5b
rm -rf %{buildroot}
8b84c5b
mkdir -p %{buildroot}
8b84c5b
make install
8b84c5b
mv tmpinstall/* %{buildroot}/
8b84c5b
8b84c5b
if [ "%{_lib}" != lib -a "`ls %{buildroot}%{_prefix}/lib/*`" != "" ]; then
8b84c5b
  mkdir -p %{buildroot}%{_libdir}
8b84c5b
  mv %{buildroot}%{_prefix}/lib/* %{buildroot}%{_libdir}/
8b84c5b
fi
8b84c5b
8b84c5b
# Gather list of non-python/tcl libraries
8b84c5b
ls %{buildroot}%{_libdir}/*.so.* \
8b84c5b
  | grep -Ev '(Java|QVTK|PythonD|TCL)' | sed -e's,^%{buildroot},,' > libs.list
8b84c5b
8b84c5b
mkdir -p %{buildroot}%{_libdir}/vtk-examples-5.0 \
8b84c5b
         %{buildroot}%{_libdir}/vtk-testing-5.0
8b84c5b
8b84c5b
# List of executable utilities
8b84c5b
cat > utils.list << EOF
8b84c5b
vtkParseOGLExt
8b84c5b
vtkVREncodeString
8b84c5b
EOF
8b84c5b
8b84c5b
# List of executable examples
8b84c5b
cat > examples.list << EOF
8b84c5b
HierarchicalBoxPipeline
8b84c5b
MultiBlock
8b84c5b
Arrays
8b84c5b
Cube
8b84c5b
RGrid
8b84c5b
SGrid
8b84c5b
Medical1
8b84c5b
Medical2
8b84c5b
Medical3
8b84c5b
finance
8b84c5b
AmbientSpheres
8b84c5b
Cylinder
8b84c5b
DiffuseSpheres
8b84c5b
SpecularSpheres
8b84c5b
Cone
8b84c5b
Cone2
8b84c5b
Cone3
8b84c5b
Cone4
8b84c5b
Cone5
8b84c5b
Cone6
8b84c5b
EOF
8b84c5b
8b84c5b
# List of executable test binaries
8b84c5b
cat > testing.list << EOF
8b84c5b
CommonCxxTests
8b84c5b
TestCxxFeatures
8b84c5b
TestInstantiator
8b84c5b
FilteringCxxTests
8b84c5b
GraphicsCxxTests
8b84c5b
GenericFilteringCxxTests
8b84c5b
ImagingCxxTests
8b84c5b
IOCxxTests
8b84c5b
RenderingCxxTests
8b84c5b
VTKBenchMark
8b84c5b
VolumeRenderingCxxTests
8b84c5b
WidgetsCxxTests
8b84c5b
SocketClient
8b84c5b
SocketServer
8b84c5b
EOF
8b84c5b
8b84c5b
# Install utils/examples/testing, too
8b84c5b
for filelist in utils.list examples.list testing.list; do
8b84c5b
  for file in `cat $filelist`; do
8b84c5b
    install -p bin/$file %{buildroot}%{_bindir}
8b84c5b
  done
8b84c5b
  perl -pi -e's,^,%{_bindir}/,' $filelist
8b84c5b
done
8b84c5b
8b84c5b
# Remove any remnants of rpaths
8b84c5b
for file in `cat examples.list`; do
8b84c5b
  chrpath -d %{buildroot}$file
8b84c5b
done
8b84c5b
8b84c5b
# Main package contains utils and core libs
8b84c5b
cat libs.list utils.list > main.list
8b84c5b
8b84c5b
# Make shared libs and scripts executable
8b84c5b
chmod a+x %{buildroot}%{_libdir}/lib*.so.*
8b84c5b
chmod a+x %{buildroot}%{_libdir}/vtk-5.0/doxygen/*.pl
8b84c5b
chmod a+x %{buildroot}%{_libdir}/vtk-5.0/testing/*.{py,tcl}
8b84c5b
8b84c5b
# Remove exec bit from non-scripts and %%doc
8b84c5b
for file in `find %{buildroot} -type f -perm 0755 \
8b84c5b
  | xargs -r file | grep ASCII | awk -F: '{print $1}'`; do
8b84c5b
  head -1 $file | grep '^#!' > /dev/null && continue
8b84c5b
  chmod 0644 $file
8b84c5b
done
8b84c5b
find Utilities/Upgrading -type f | xargs chmod -x
8b84c5b
8b84c5b
# Add exec bits to shared libs ...
8b84c5b
chmod 0755 %{buildroot}%{_libdir}/vtk-5.0/CMake/*.so
8b84c5b
865e6c8
%check
8b84c5b
#LD_LIBARARY_PATH=`pwd`/bin ctest -V
8b84c5b
8b84c5b
%clean
8b84c5b
rm -rf %{buildroot}
8b84c5b
8b84c5b
%post -p /sbin/ldconfig
8b84c5b
8b84c5b
%postun -p /sbin/ldconfig
8b84c5b
8b84c5b
%post tcl -p /sbin/ldconfig
8b84c5b
8b84c5b
%postun tcl -p /sbin/ldconfig
8b84c5b
8b84c5b
%post python -p /sbin/ldconfig
8b84c5b
8b84c5b
%postun python -p /sbin/ldconfig
8b84c5b
8b84c5b
%if %{with java}
8b84c5b
%post java -p /sbin/ldconfig
8b84c5b
8b84c5b
%postun java -p /sbin/ldconfig
8b84c5b
%endif
8b84c5b
8b84c5b
%post qt -p /sbin/ldconfig
8b84c5b
8b84c5b
%postun qt -p /sbin/ldconfig
8b84c5b
8b84c5b
%files -f main.list
8b84c5b
%defattr(-,root,root,-)
8b84c5b
%doc --parents Copyright.txt README.html vtkLogo.jpg vtkBanner.gif Wrapping/*/README*
8b84c5b
8b84c5b
%files devel
8b84c5b
%defattr(-,root,root,-)
8b84c5b
%doc Utilities/Upgrading
8b84c5b
%{_libdir}/vtk-5.0/doxygen
8b84c5b
%{_includedir}/vtk
8b84c5b
%{_libdir}/*.so
8b84c5b
%{_libdir}/vtk-5.0/CMake
8b84c5b
%{_libdir}/vtk-5.0/*.cmake
8b84c5b
%{_libdir}/vtk-5.0/hints
8b84c5b
8b84c5b
%files tcl
8b84c5b
%defattr(-,root,root,-)
8b84c5b
%{_libdir}/*TCL.so.*
8b84c5b
%{_bindir}/vtk
8b84c5b
%{_bindir}/vtkWrapTcl
8b84c5b
%{_bindir}/vtkWrapTclInit
8b84c5b
%{_libdir}/vtk-5.0/pkgIndex.tcl
8b84c5b
%{_libdir}/vtk-5.0/tcl
8b84c5b
8b84c5b
%files python
8b84c5b
%defattr(-,root,root,-)
19bc098
#%{python_sitearch}/vtk
19bc098
%{python_sitearch}/*
8b84c5b
%{_libdir}/*PythonD.so.*
8b84c5b
%{_bindir}/vtkpython
8b84c5b
%{_bindir}/vtkWrapPython
8b84c5b
%{_bindir}/vtkWrapPythonInit
8b84c5b
8b84c5b
%if %{with java}
8b84c5b
%files java
8b84c5b
%defattr(-,root,root,-)
8b84c5b
%{_libdir}/*Java.so.*
8b84c5b
%{_bindir}/vtkParseJava
8b84c5b
%{_bindir}/vtkWrapJava
8b84c5b
%endif
8b84c5b
8b84c5b
%files qt
8b84c5b
%defattr(-,root,root,-)
8b84c5b
%{_libdir}/libQVTK.so.*
8b84c5b
%{_libdir}/qt*/plugins/designer/libQVTKWidgetPlugin.so
8b84c5b
8b84c5b
%files testing -f testing.list
8b84c5b
%defattr(-,root,root,-)
8b84c5b
%{_libdir}/vtk-5.0/testing
8b84c5b
%{_libdir}/vtk-testing-5.0
8b84c5b
8b84c5b
%files examples -f examples.list
8b84c5b
%defattr(-,root,root,-)
8b84c5b
%doc vtk-examples-5.0/Examples
8b84c5b
%{_libdir}/vtk-examples-5.0
8b84c5b
8b84c5b
%changelog
865e6c8
* Sun Aug 24 2008 Axel Thimm <Axel.Thimm@ATrpms.net> - 5.0.4-23
865e6c8
- %%check || : does not work anymore.
865e6c8
- enable java by default.
865e6c8
865e6c8
* Wed May 21 2008 Tom "spot" Callaway <tcallawa@redhat.com> - 5.0.4-22
865e6c8
- fix license tag
865e6c8
865e6c8
* Sat Apr 12 2008 Axel Thimm <Axel.Thimm@ATrpms.net> - 5.0.4-21
865e6c8
- Fixes for gcc 4.3 by Orion Poplawski.
865e6c8
865e6c8
* Sat Apr  5 2008 Axel Thimm <Axel.Thimm@ATrpms.net> - 5.0.4-20
865e6c8
- Change BR to qt-devel to qt3-devel.
865e6c8
19bc098
* Sat Feb 23 2008 Axel Thimm <Axel.Thimm@ATrpms.net> - 5.0.4-19
19bc098
- Update to 5.0.4.
fa7a0d2
8b84c5b
* Mon May 28 2007 Axel Thimm <Axel.Thimm@ATrpms.net> - 5.0.3-18
8b84c5b
- Move headers to %%{_includedir}/vtk.
8b84c5b
- Remove executable bit from sources.
8b84c5b
8b84c5b
* Mon Apr 16 2007 Axel Thimm <Axel.Thimm@ATrpms.net> - 5.0.3-17
8b84c5b
- Make java build conditional.
8b84c5b
- Add ldconfig %%post/%%postun for java/qt subpackages.
8b84c5b
8b84c5b
* Sun Apr 15 2007 Axel Thimm <Axel.Thimm@ATrpms.net> - 5.0.3-16
8b84c5b
- Remove %%ghosting pyc/pyo.
8b84c5b
8b84c5b
* Wed Apr 04 2007 Paulo Roma <roma@lcg.ufrj.br> - 5.0.3-15
8b84c5b
- Update to 5.0.4.
8b84c5b
- Added support for qt4 plugin.
8b84c5b
8b84c5b
* Wed Feb  7 2007 Orion Poplawski <orion@cora.nwra.com> - 5.0.2-14
8b84c5b
- Enable Java, Qt, GL2PS, OSMESA
8b84c5b
8b84c5b
* Mon Sep 11 2006 Axel Thimm <Axel.Thimm@ATrpms.net> - 5.0.2-13
8b84c5b
- Update to 5.0.2.
8b84c5b
8b84c5b
* Sun Aug  6 2006 Axel Thimm <Axel.Thimm@ATrpms.net> - 5.0.1-12
8b84c5b
- cmake needs to be >= 2.0.4.
8b84c5b
8b84c5b
* Fri Aug  4 2006 Axel Thimm <Axel.Thimm@ATrpms.net> - 5.0.1-11
8b84c5b
- Fix some python issues including pyo management.
8b84c5b
8b84c5b
* Sun Jul 23 2006 Axel Thimm <Axel.Thimm@ATrpms.net> - 5.0.1-10
8b84c5b
- Embed feedback from bug 199405 comment 5.
8b84c5b
- Fix some Group entries.
8b84c5b
- Remove redundant dependencies.
8b84c5b
- Use system libs.
8b84c5b
- Comment specfile more.
8b84c5b
- Change buildroot handling with CMAKE_INSTALL_PREFIX.
8b84c5b
- Enable qt designer plugin.
8b84c5b
8b84c5b
* Wed Jul 19 2006 Axel Thimm <Axel.Thimm@ATrpms.net> - 5.0.1-7
8b84c5b
- Fix some permissions for rpmlint and debuginfo.
8b84c5b
8b84c5b
* Sun Jul 16 2006 Axel Thimm <Axel.Thimm@ATrpms.net> - 5.0.1-7
8b84c5b
- Remove rpath and some further rpmlint warnings.
8b84c5b
8b84c5b
* Thu Jul 13 2006 Axel Thimm <Axel.Thimm@ATrpms.net> - 5.0.1-6
8b84c5b
- Update to 5.0.1.
8b84c5b
8b84c5b
* Wed May 31 2006 Axel Thimm <Axel.Thimm@ATrpms.net>
8b84c5b
- Update to 5.0.
8b84c5b
8b84c5b
* Mon Apr 04 2004 Intrinsic Spin <spin@freakbait.com> 2.mr
8b84c5b
- built on a machine with a stock libGL.so
8b84c5b
8b84c5b
* Sun Apr 04 2004 Intrinsic Spin <spin@freakbait.com>
8b84c5b
- little cleanups
8b84c5b
- Built for FC1
8b84c5b
8b84c5b
* Sun Jan 11 2004 Intrinsic Spin <spin@freakbait.com>
8b84c5b
- Built against a reasonably good (according to dashboard) CVS version so-as
8b84c5b
 to get GL2PS support.
8b84c5b
- Rearranged. Cleaned up. Added some comments. 
8b84c5b
8b84c5b
* Sat Jan 10 2004 Intrinsic Spin <spin@freakbait.com>
8b84c5b
- Blatently stole this spec file for my own nefarious purposes.
8b84c5b
- Removed Java (for now). Merged the Python and Tcl stuff into 
8b84c5b
 the main rpm.
8b84c5b
8b84c5b
* Fri Dec 05 2003 Fabrice Bellet <Fabrice.Bellet@creatis.insa-lyon.fr>
8b84c5b
- (See Fabrice's RPMs for any more comments --Spin)