Sophie

Sophie

distrib > Mandriva > 10.2 > x86_64 > by-pkgid > 5ad827826ceed2845cb39554b497d6c7 > files > 3

vtk-4.4.2-6mdk.src.rpm

%define build_java 0
%{?_with_java: %{expand: %%global build_java 1}}

%define build_patented 0
%{?_with_patented: %{expand: %%global build_patented 1}}


%define name 	vtk
%define version 4.4.2
%define release %mkrel 6

%define short_version %(echo %{version} | cut -d. -f1,2)
%define libname %mklibname %{name}
%define libname_devel %mklibname %{name} -d

%define python_include_path $(python -c"import os,sys; print os.path.join(sys.exec_prefix, 'include', 'python' + sys.version[:3])")
%define python_library $(python -c"import os,sys; print os.path.join(sys.exec_prefix, 'lib', 'python' + sys.version[:3], 'config/libpython' + sys.version[:3] + '.a')")
%define python_site_package %(python -c"import os,sys; print os.path.join(sys.exec_prefix, 'lib', 'python' + sys.version[:3],'site-packages')")


Summary:   	Toolkit for 3D computer graphics, image processing, and visualization
Name:      	%name
Version:   	%version
Release:   	%release
License:   	BSD
Group:     	Graphics
Url:	   	http://public.kitware.com/VTK/
Source0:   	ftp://public.kitware.com/pub/vtk/vtk%{short_version}/VTK-%{version}.tar.bz2
# fix import patented exception 
Patch0:		vtk-python-import.patch.bz2
BuildRoot: 	%{_tmppath}/%name-root
BuildRequires: 	cmake >= 1.8 
BuildRequires:  python-devel tcl XFree86-devel  expat-devel jpeg-devel png-devel tiff-devel zlib-devel perl
#Requires:	libexpat0 libjpeg62 libpng3 libtiff3 zlib1
BuildRequires: 	doxygen graphviz perl cvs gnuplot

%description
The Visualization ToolKit (VTK) is an object oriented software system for 3D
computer graphics, image processing, and visualization. VTK includes a
textbook, a C++ class library, and several interpreted interface layers
including Tcl/Tk, Java, and Python. VTK supports a wide variety of
visualization algorithms including scalar, vector, tensor, texture, and
volumetric methods. It also supports advanced modeling techniques like
implicit modeling, polygon reduction, mesh smoothing, cutting, contouring,
and Delaunay triangulation.  Moreover, dozens of imaging algorithms have been
integrated into the system. This allows mixing 2D imaging / 3D graphics
algorithms and data.

NOTE: The java wrapper is not included by default.  You may rebuild the srpm
      using "--with java" with JDK installed.

NOTE: All patented routines which are part of the package have been removed in
      this version.

%package -n %libname
Summary:	Toolkit for 3D computer graphics, image processing, and visualization
Group:		System/Libraries
Provides:	%{name} = %{version}-%{release}
Obsoletes:	%{name}

%description -n %libname
The Visualization ToolKit (VTK) is an object oriented software system for 3D
computer graphics, image processing, and visualization. VTK includes a
textbook, a C++ class library, and several interpreted interface layers
including Tcl/Tk, Java, and Python. VTK supports a wide variety of
visualization algorithms including scalar, vector, tensor, texture, and
volumetric methods. It also supports advanced modeling techniques like
implicit modeling, polygon reduction, mesh smoothing, cutting, contouring,
and Delaunay triangulation.  Moreover, dozens of imaging algorithms have been
integrated into the system. This allows mixing 2D imaging / 3D graphics
algorithms and data.

NOTE: The java wrapper is not included by default.  You may rebuild the srpm
      using "--with java" with JDK installed.

NOTE: All patented routines which are part of the package have been removed in
      this version.

%package -n %libname_devel
Summary:	VTK header files for building C++ code
Requires:	%{libname} = %{version}
Group:		Development/C++
Provides:	%{name}-devel = %{version}-%{release}
Obsoletes:	%{name}-devel

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

%package -n tcl-%name
Summary:  Tcl bindings for VTK
Group:    Development/Other
Requires: %{libname} = %{version}
Obsoletes:	%{name}-tcl
Provides:	%{name}-tcl

%description -n tcl-%name
The Visualization ToolKit (VTK) is an object oriented software system for 3D
computer graphics, image processing, and visualization. VTK includes a
textbook, a C++ class library, and several interpreted interface layers
including Tcl/Tk, Java, and Python. VTK supports a wide variety of
visualization algorithms including scalar, vector, tensor, texture, and
volumetric methods. It also supports advanced modeling techniques like
implicit modeling, polygon reduction, mesh smoothing, cutting, contouring,
and Delaunay triangulation.  Moreover, dozens of imaging algorithms have been
integrated into the system. This allows mixing 2D imaging / 3D graphics
algorithms and data.

This package contains tcl bindings for VTK.

%package -n python-%name
Summary: Python bindings for VTK
Requires: %{libname} = %{version}
Group:   Development/Python
Obsoletes:	%{name}-python
Provides:	%{name}-python

%description -n python-%name 
The Visualization ToolKit (VTK) is an object oriented software system for 3D
computer graphics, image processing, and visualization. VTK includes a
textbook, a C++ class library, and several interpreted interface layers
including Tcl/Tk, Java, and Python. VTK supports a wide variety of
visualization algorithms including scalar, vector, tensor, texture, and
volumetric methods. It also supports advanced modeling techniques like
implicit modeling, polygon reduction, mesh smoothing, cutting, contouring,
and Delaunay triangulation.  Moreover, dozens of imaging algorithms have been
integrated into the system. This allows mixing 2D imaging / 3D graphics
algorithms and data.

This package contains python bindings for VTK.

%if %build_java
%package -n java-%{name}
Summary: Java bindings for VTK
Group:   Development/Java
Requires: %{libname} = %{version}
Obsoletes:	%{name}-java
Provides:	%{name}-java

%description -n java-%{name}
The Visualization ToolKit (VTK) is an object oriented software system for 3D
computer graphics, image processing, and visualization. VTK includes a
textbook, a C++ class library, and several interpreted interface layers
including Tcl/Tk, Java, and Python. VTK supports a wide variety of
visualization algorithms including scalar, vector, tensor, texture, and
volumetric methods. It also supports advanced modeling techniques like
implicit modeling, polygon reduction, mesh smoothing, cutting, contouring,
and Delaunay triangulation.  Moreover, dozens of imaging algorithms have been
integrated into the system. This allows mixing 2D imaging / 3D graphics
algorithms and data.

This package contains java bindings for VTK.

%endif

%package examples
Summary:  C++, Tcl and Python example programs/scripts for VTK
Group:    Development/Other
Requires: %{name}-data = %{short_version}
Requires: %{libname} = %{version}

%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).

%package test-suite
Summary:  Tests programs for VTK
Requires: %{libname} = %{version}
Requires: %{name}-data = %{short_version}
Group:    Development/Other

%description test-suite
This package contains all testing programs from the VTK
source. The source code of these programs can be found in the
vtk-examples package.

%package doc
Summary: Documentation for VTK
Group:   Development/Other
Obsoletes: %{name}-docs
Provides: %{name}-docs

%description doc
This package contains class api generated with doxygen.

%prep
%setup -q -n VTK
%patch0 -p1

# fix data path
find -type f | xargs perl -pi -e 's#../../../../VTKData#%{_datadir}/vtk-data#g'

%build
CMAKE_CMD="cmake	-DCMAKE_INSTALL_PREFIX:PATH=%{_prefix} \
	-DCMAKE_SKIP_RPATH:BOOL=ON \
	-DCMAKE_CXX_FLAGS:STRING=$RPM_OPT_FLAGS \
	-DCMAKE_C_FLAGS:STRING=$RPM_OPT_FLAGS	\
	-DPYTHON_INCLUDE_PATH:PATH=%{python_include_path} \
	-DPYTHON_LIBRARY:FILEPATH=%{python_library} \
	-DVTK_DATA_ROOT:PATH=%{_datadir}/vtk-data-%{version} \
	-DVTK_WRAP_PYTHON:BOOL=ON \
	-DVTK_WRAP_JAVA:BOOL=off \
	-DVTK_WRAP_TCL:BOOL=ON \
	-DVTK_USE_HYBRID:BOOL=ON \
	-DVTK_USE_PARALLEL:BOOL=ON \
	-DVTK_USE_RENDERING:BOOL=ON \
	-DVTK_USE_X:BOOL=ON \
	-DBUILD_DOCUMENTATION:BOOL=ON \
	-DBUILD_EXAMPLES:BOOL=ON \
	-DBUILD_SHARED_LIBS:BOOL=ON \
	-DBUILD_TESTING:BOOL=ON \
	-DOPENGL_INCLUDE_PATH:FILEPATH=/usr/X11R6/include/GL \
	-DVTK_USE_SYSTEM_EXPAT:BOOL=ON \
	-DVTK_USE_SYSTEM_JPEG:BOOL=ON \
	-DVTK_USE_SYSTEM_PNG:BOOL=ON \
	-DVTK_USE_SYSTEM_TIFF:BOOL=ON \
	-DVTK_USE_SYSTEM_ZLIB:BOOL=ON \
	-DVTK_USE_ANSI_STDLIB:BOOL=ON \
"
%if %build_java
CMAKE_CMD="$CMAKE_CMD \
	-DJAVA_INCLUDE_PATH:PATH=$JAVA_HOME/include \
	-DJAVA_INCLUDE_PATH2:PATH=$JAVA_HOME/include/linux \
	-DJAVA_AWT_INCLUDE_PATH:PATH=$JAVA_HOME/include \
	-DJAVA_AWT_LIBRARY:PATH=$JAVA_HOME/jre/lib/i386/libawt.so \
	-DVTK_WRAP_JAVA:BOOL=ON \
"
%endif

%if %build_patented
CMAKE_CMD="$CMAKE_CMD \
        -DVTK_USE_PATENTED:BOOL=ON \
"
%endif


$CMAKE_CMD .

# 	-DOPENGL_LIBRARY:FILEPATH=/usr/X11R6/lib/libGL.so.1.0
#	-DCMAKE_SKIP_RPATH:BOOL=ON \
#	-DLIBRARY_OUTPUT_PATH:PATH=$RPM_BUILD_DIR/VTK-%version/lib \
#	-DEXECUTABLE_OUTPUT_PATH:PATH=$RPM_BUILD_DIR/VTK-%version/bin \
# -Wno-deprecated -fpermissive 

%make

# build docs
(
cd Utilities/Doxygen
make DoxygenDoc
)

%install

rm -rf $RPM_BUILD_ROOT

make install DESTDIR=$RPM_BUILD_ROOT

# instal python
(
cd Wrapping/Python/
python setup.py install --root $RPM_BUILD_ROOT
)
mv $RPM_BUILD_ROOT/%{python_site_package}/vtk_python $RPM_BUILD_ROOT/%{_libdir}/vtk/python
mv $RPM_BUILD_ROOT/%{_libdir}/vtk/*Python*.so $RPM_BUILD_ROOT/%{_libdir}/vtk/python
cat > $RPM_BUILD_ROOT/%{python_site_package}/vtk.pth <<_EOF
%{_libdir}/vtk/python
_EOF
# python libs or not in /usr/lib/vtk but in /usr/lib/vtk/python
perl -pi -e 's#SET(VTK_LIBRARY_DIRS "%{_libdir}/vtk")#SET(VTK_LIBRARY_DIRS "%{_libdir}/vtk;%{_libdir}/vtk/python")#g' $RPM_BUILD_ROOT/%{_libdir}/vtk/VTKConfig.cmake


# install ld.so.conf path
install -d -m 755 $RPM_BUILD_ROOT/%{_sysconfdir}/ld.so.conf.d
cat > $RPM_BUILD_ROOT/%{_sysconfdir}/ld.so.conf.d/%{name}.conf <<_EOF
%{_libdir}/%{name}
_EOF

%if %build_java
#install java
install -d -m 755 $RPM_BUILD_ROOT%{_libdir}/vtk/java
install  -m 644 lib/vtk.jar     $RPM_BUILD_ROOT%{_libdir}/vtk/java
install  -m 644 java/vtk/*.java $RPM_BUILD_ROOT%{_libdir}/vtk/java
%endif

#install doc
install -d -m 755 $RPM_BUILD_ROOT/%_datadir/vtk-docs
cp -a Utilities/Doxygen/doc/html $RPM_BUILD_ROOT/%_datadir/vtk-docs/api

#install test-suite and examples
for d in Common Filtering Graphics Hybrid IO Imaging Parallel Patented Rendering
do
	mkdir -p $RPM_BUILD_ROOT/%_datadir/vtk-examples/Testing/$d
	cp -a $d/Testing/* $RPM_BUILD_ROOT/%_datadir/vtk-examples/Testing/$d
done
cp -a Examples $RPM_BUILD_ROOT/%_datadir/vtk-examples

# get rid of unwanted files
find $RPM_BUILD_ROOT/%_datadir/vtk-examples -name "*.o" -exec rm {} \;
find $RPM_BUILD_ROOT/%_datadir/vtk-examples -name CMakeCache.txt -exec rm {} \;
find $RPM_BUILD_ROOT/%_datadir/vtk-examples -name Makefile -exec rm {} \;
find $RPM_BUILD_ROOT/%_datadir/vtk-examples -name DartTestfile.txt -exec rm {} \;
find $RPM_BUILD_ROOT/%_datadir/vtk-examples -name .NoDartCoverage -exec rm {} \;
find $RPM_BUILD_ROOT/%_datadir/vtk-examples -name "CMake*" -exec rm {} \;
find $RPM_BUILD_ROOT/%_datadir/vtk-examples -name "cmake.*" -exec rm {} \;

# install test suite binaries and add each prg path in test-suite-files
touch test-suite-files
(
cd bin
for f in `find -type f | grep -v '.so$' | grep -v vtk`; do
   cp $f $RPM_BUILD_ROOT/%{_bindir}
   echo %{_bindir}/$f >> ../test-suite-files
done
)

%multiarch_includes  $RPM_BUILD_ROOT/%{_includedir}/vtk/vtkConfigure.h

%post -n %{libname} -p /sbin/ldconfig
%post -n tcl-%{name} -p /sbin/ldconfig
%post -n python-%{name} -p /sbin/ldconfig
%if %build_java
%post -n java-%{name} -p /sbin/ldconfig
%endif

%postun -n %{libname} -p /sbin/ldconfig
%postun -n tcl-%{name} -p /sbin/ldconfig
%postun -n python-%{name} -p /sbin/ldconfig 
%if %build_java
%postun -n java-%{name} -p /sbin/ldconfig
%endif

%files -n %{libname}
%defattr(0755,root,root,0755)
%doc README.html vtkLogo.jpg Copyright.txt
%dir %{_libdir}/vtk
%{_libdir}/vtk/libvtkCommon.so 
%{_libdir}/vtk/libvtkFiltering.so 
%{_libdir}/vtk/libvtkGraphics.so
%{_libdir}/vtk/libvtkHybrid.so
%{_libdir}/vtk/libvtkImaging.so
%{_libdir}/vtk/libvtkIO.so
%{_libdir}/vtk/libvtkParallel.so
%{_libdir}/vtk/libvtkRendering.so
%{_libdir}/vtk/libvtkfreetype.so
%{_libdir}/vtk/libvtkftgl.so
%{_libdir}/vtk/libvtkDICOMParser.so
%attr(0644,root,root) %{_sysconfdir}/ld.so.conf.d/%{name}.conf
%attr(0644,root,root) %{_libdir}/vtk/hints

%files -n %{libname_devel}
%defattr(0644,root,root,0755)
%doc %{_libdir}/vtk/doxygen
%{_includedir}/*
%{_libdir}/vtk/CMake
%{_libdir}/vtk/*.cmake
%doc Utilities/Upgrading/*

%files test-suite -f test-suite-files
%defattr(0755,root,root,0755)

%files -n tcl-%{name}
%defattr(0644,root,root,0755)
%attr(0755,root,root) %{_bindir}/vtk
%attr(0755,root,root) %{_bindir}/vtkWrapTcl
%attr(0755,root,root) %{_bindir}/vtkWrapTclInit
%attr(0755,root,root) %{_libdir}/vtk/*TCL*.so 
%{_libdir}/vtk/tcl
%dir %{_libdir}/vtk/testing
%{_libdir}/vtk/testing/*.tcl
%doc README.html 
%doc vtkLogo.jpg

%files -n python-%{name}
%defattr(0644,root,root,0755)
%attr(0755,root,root) %_bindir/vtkWrapPython
%attr(0755,root,root) %_bindir/vtkpython
%attr(0755,root,root) %_libdir/vtk/python/*Python*.so 
%_libdir/vtk/python/*.py
%_libdir/vtk/python/*.pyc
%_libdir/vtk/python/vtk
%dir %_libdir/vtk/testing
%_libdir/vtk/testing/*.py
%{python_site_package}/vtk.pth

%if %build_java
%files -n java-%{name}
%defattr(0644,root,root,0755)
%attr(0755,root,root) %{_bindir}/vtkParseJava
%attr(0755,root,root) %{_bindir}/vtkWrapJava
%{_bindir}/VTKJavaExecutable
%attr(0755,root,root) %{_libdir}/vtk/libvtk*Java.so 
%{_libdir}/vtk/java
%endif

%files examples
%defattr(0644,root,root,0755)
%dir %_datadir/vtk-examples
%_datadir/vtk-examples/Examples
%_datadir/vtk-examples/Testing

%files doc
%defattr(0644,root,root,0755)
%_datadir/vtk-docs/api

%clean 
rm -rf $RPM_BUILD_ROOT

%changelog
* Thu Mar 31 2005 Olivier Thauvin <nanardon@mandrake.org> 4.4.2-6mdk
- fix %%mkrel
- split data into another spec

* Thu Mar 31 2005 Olivier Thauvin <nanardon@mandrake.org> 4.4.2-5mdk
- use macro for few path, ensure spec will not going outside %buildroot
- %%mkrel

* Thu Mar 24 2005 Gaetan Lehmann <gaetan.lehmann@jouy.inra.fr> 4.4.2-4mdk
- Use mkrel
- add "--with patented" switch

* Fri Mar  4 2005 Gaetan Lehmann <gaetan.lehmann@jouy.inra.fr> 4.4.2-3mdk
- BuildRequires cmake >= 1.8 (thanks to Marc Koschewski)

* Thu Feb 17 2005 Gaetan Lehmann <gaetan.lehmann@jouy.inra.fr> 4.4.2-2mdk
- fix data path for c++ and tcl examples
- fix vtk python lib dir
- add ldconfig call for libvtk package
- vtk-test-suite package is back

* Wed Feb 09 2005 Gaetan Lehmann <gaetan.lehmann@jouy.inra.fr> 4.4.2-1mdk
- 4.4.2
- remove conditionnal doc build
- use more consistent names
- files attributes cleanup
- fix data path for python testing
- fix import patented exception

* Sun Jan 9 2005 Austin Acton <austin@mandrake.org> 4.2.6-1mdk
- fix some lint
- from Gaetan Lehmann <gaetan.lehmann@jouy.inra.fr> :
  - 4.2.6
  - add ld.so.conf path
  - fix python data path
  - compile python modules
  - add docs package
  - use system libs
  - fix JAVA_AWT_INCLUDE_PATH
  - USE_ANSI_STDLIB
  - add url to sources (to be able to update with rpmbuildupdate)
  - remove most of rpmlint warnings and errors
  - add version requirement to subpackages

* Sun Dec 05 2004 Michael Scherer <misc@mandrake.org> 4.2.2-6mdk	
 - Rebuild for new python	

* Tue Jun 29 2004 Thierry Vignaud <tvignaud@mandrakesoft.com> 4.2.2-5mdk
- rebuild for new g++
- patch 0: fix compiling with new g++

* Mon Mar 01 2004 Olivier Thauvin <thauvin@aerov.jussieu.fr> 4.2.2-4mdk
- Own dir (again)

* Sun Feb 29 2004 Olivier Thauvin <thauvin@aerov.jussieu.fr> 4.2.2-3mdk
- Own dir

* Sat Aug 9 2003 Austin Acton <aacton@yorku.ca> 4.2.2-2mdk
- python 2.3

* Thu Jul 17 2003 Austin Acton <aacton@yorku.ca> 4.2.2-1mdk
- 4.2.2
- some DIRM
- some removal of some lint
- some java conditionals

* Sun Feb 2 2003 Austin Acton <aacton@yorku.ca> 4.0-1mdk
- initial package
- stole most of specfile from http://www.creatis.insa-lyon.fr/vtk/