LogoopenSUSE Build Service > Projects
Sign Up | Log In

View File python-vtk.spec of Package python-vtk (Project home:stecue)

#
# spec file for package python-vtk
#
# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#


Name:           python-vtk 
Version:        7.1.0
Release:        0
%define series 7.0
# This is a variant BSD license, a cross between BSD and ZLIB.
# For all intents, it has the same rights and restrictions as BSD.
# http://fedoraproject.org/wiki/Licensing/BSD#VTKBSDVariant
Summary:        Python bindings for VTK
License:        BSD-3-Clause
Group:          System/Libraries
Url:            http://vtk.org/
Source:         http://www.vtk.org/files/release/%{series}/VTK-%{version}.tar.gz
# FIXME See if packaging can be tweaked to accommodate %{name}'s devel files in a devel package later
Source1:        vtk-rpmlintrc
# PATCH-FIX-UPSTREAM vtk-fix-file-contains-date-time.patch badshah400@gmail.com -- Fix file containing DATE and TIME
Patch1:         vtk-fix-file-contains-date-time.patch
# PATCH-FIX-UPSTREAM vtk-Rinterface-uintptr_t.patch badshah400@gmail.com -- Only use uintptr_t definition from R headers; no longer include stdint.h
Patch2:         vtk-Rinterface-uintptr_t.patch
# PATCH-FIX-UPSTREAM vtk-gcc6.patch dmueller@suse.com -- Fix compilation with GCC >= 6.0
# No longer needed for vtk-7.1.0.
# Patch3:         vtk-gcc6.patch
BuildRequires:  Mesa-libGL-devel
BuildRequires:  R-base-devel
BuildRequires:  boost-devel
BuildRequires:  chrpath
BuildRequires:  cmake
BuildRequires:  doxygen
BuildRequires:  fdupes
# FIXME: System freetype2 does not work on openSUSE 13.1.
%if 0%{?suse_version} > 1310
BuildRequires:  freetype2-devel
%endif
BuildRequires:  gcc-c++
BuildRequires:  gl2ps-devel
BuildRequires:  gnuplot
BuildRequires:  graphviz
BuildRequires:  hdf5-devel
#BuildRequires:  java-devel
BuildRequires:  freetype2-devel
BuildRequires:  libQtWebKit-devel
BuildRequires:  libX11-devel
BuildRequires:  libXt-devel
BuildRequires:  libexpat-devel
BuildRequires:  libiodbc-devel
BuildRequires:  libjpeg-devel
BuildRequires:  libmysqlclient-devel
BuildRequires:  libnetcdf_c++-devel
BuildRequires:  libpng-devel
BuildRequires:  libtheora-devel
BuildRequires:  libtiff-devel
BuildRequires:  netcdf-devel
BuildRequires:  openmpi-devel
BuildRequires:  python-devel
%if 0%{?suse_version} <= 1320
BuildRequires:  python-mpi4py-devel
%endif
BuildRequires:  tcl-devel
BuildRequires:  tk-devel
BuildRequires:  wget
BuildRequires:  zlib-devel
%if 0%{?suse_version} > 1320 || 0%{suse_version} == 1315
BuildRequires:  python-qt5-devel
BuildRequires:  pkgconfig(Qt5OpenGL)
BuildRequires:  pkgconfig(Qt5OpenGLExtensions)
BuildRequires:  pkgconfig(Qt5Sql)
BuildRequires:  pkgconfig(Qt5WebKitWidgets)
BuildRequires:  pkgconfig(Qt5Widgets)
%else
BuildRequires:  libqt4-devel
BuildRequires:  python-qt4-devel
%endif
%if %{?sles_version}
BuildRequires:  libxml2-devel
%else
BuildRequires:  pkgconfig(libxml-2.0)
%endif
# jsoncpp and others available for openSUSE > 13.2
%if 0%{?suse_version} > 1320 || 0%{suse_version} == 1315
BuildRequires:  jsoncpp-devel
%endif
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
%if 0%{?suse_version} > 1320 || 0%{suse_version} == 1315
%define qtdir   %{_lib}/qt5
%else
%define qtdir   %{_lib}/qt4
%endif
%if 0%{?suse_version} <= 1320
Requires:       python-mpi4py
%endif
Requires:       vtk = %{version}
# DESPITE NOT BEING A DEVEL PACKAGE, THIS REQUIRES OPENMPI-DEVEL TO RUN
Requires:       openmpi-devel
Conflicts:      python3-vtk

%description
VTK is an open-source software system for image processing, 3D
graphics, volume rendering and visualization. VTK includes many
advanced algorithms (e.g., surface reconstruction, implicit modelling,
decimation) and rendering techniques (e.g., hardware-accelerated
volume rendering, LOD control).

This package provides python2 bindings for VTK.


%package -n %{name}-qt
Summary:        Qt Python VTK widget
Group:          System/Libraries
Requires:       %{name} = %{version}
Requires:       vtk = %{version}
Requires:       vtk-qt = %{version}
%if 0%{?suse_version} > 1320 || 0%{suse_version} == 1315
Requires:       libQt5OpenGL-devel
Requires:       libQt5OpenGLExtensions-devel-static
Requires:       libQt5Sql-devel
Requires:       libQt5WebKitWidgets-devel
Requires:       libQt5Widgets-devel
Requires:       python-qt5
%else
Requires:       libqt4-devel
Requires:       python-qt4
%endif

%description -n %{name}-qt
VTK is an open-source software system for image processing, 3D
graphics, volume rendering and visualization. VTK includes many
advanced algorithms (e.g., surface reconstruction, implicit modelling,
decimation) and rendering techniques (e.g., hardware-accelerated
volume rendering, LOD control).

This package provides python-qt bindings for VTK.

%prep
%setup -q -n VTK-%{version}
%patch1 -p1
%patch2 -p1
#%patch3 -p1

# Replace relative path ../../../VTKData with %%{_datadir}/%vtkdata-%%{version}
# otherwise it will break on symlinks.
grep -rl '\.\./\.\./\.\./\.\./VTKData' . | xargs perl -pi -e's,\.\./\.\./\.\./\.\./VTKData,%{_datadir}/vtk,g'

%build
export CFLAGS="%{optflags}"
export CXXFLAGS="%{optflags}"

mkdir build
pushd build
cmake .. \
    -DCMAKE_CXX_COMPILER:STRING='mpicxx' \
    -DCMAKE_C_COMPILER:STRING='mpicc' \
    -DBUILD_DOCUMENTATION:BOOL=ON \
    -DBUILD_EXAMPLES:BOOL=OFF \
    -DBUILD_SHARED_LIBS:BOOL=ON \
    -DBUILD_TESTING:BOOL=OFF \
    -DVTK_CUSTOM_LIBRARY_SUFFIX="" \
    -DCMAKE_INSTALL_PREFIX:PATH=%{_prefix} \
    -DSIP_INCLUDE_DIR:Path=%{py_incdir} \
    -DVTK_INSTALL_ARCHIVE_DIR:PATH=%{_lib}/vtk \
    -DVTK_INSTALL_LIBRARY_DIR:PATH=%{_lib}/vtk\
    -DVTK_INSTALL_PACKAGE_DIR:PATH=%{_lib}/cmake/vtk \
    -DVTK_INSTALL_TCL_DIR:PATH=share/tcl/vtk \
%if 0%{?suse_version} > 1320 || 0%{suse_version} == 1315
    -DVTK_QT_VERSION=5 \
%endif
    -DVTK_INSTALL_QT_DIR:STRING=/%{qtdir}/plugins/designer \
    -DVTK_USE_OGGTHEORA_ENCODER:BOOL=ON \
    -DVTK_USE_RENDERING:BOOL=ON \
%if 0%{?suse_version} > 1320 || 0%{suse_version} == 1315
    -DVTK_USE_SYSTEM_LIBRARIES:BOOL=ON \
%else
    -DVTK_USE_SYSTEM_LIBRARIES:BOOL=OFF \
%endif
    -DVTK_USE_SYSTEM_LIBPROJ4:BOOL=OFF \
    -DVTK_INSTALL_PYTHON_MODULE_DIR:PATH=%{_lib}/python%{py_ver}/site-packages \
    -DVTK_WRAP_PYTHON:BOOL=ON \
    -DVTK_WRAP_JAVA:BOOL=OFF \
    -DVTK_WRAP_PYTHON_SIP:BOOL=ON \
    -DVTK_WRAP_TCL:BOOL=OFF \
    -DVTK_Group_MPI:BOOL=ON \
    -DVTK_Group_Imaging:BOOL=ON \
    -DVTK_Group_Qt:BOOL=ON \
    -DModule_vtkTestingCore:BOOL=ON \
    -DModule_vtkTestingRendering:BOOL=ON \
    -DVTK_Group_Rendering:BOOL=ON \
    -DVTK_Group_StandAlone:BOOL=ON \
    -DVTK_Group_Tk:BOOL=ON \
    -DVTK_Group_Views:BOOL=ON \
    -DModule_vtkFiltersStatisticsGnuR:BOOL=ON \
    -DVTK_WRAP_TCL:BOOL=OFF \
    -DVTK_USE_SYSTEM_HDF5:BOOL=ON \
    -DVTK_USE_SYSTEM_NETCDF:BOOL=ON \
%if 0%{?suse_version} <= 1320
    -DVTK_USE_SYSTEM_MPI4PY:BOOL=ON \
%else
    -DVTK_USE_SYSTEM_MPI4PY:BOOL=OFF \
%endif
%if 0%{?suse_version} > 1310
    -DVTK_USE_SYSTEM_FREETYPE:BOOL=ON \
%endif
%if 0%{?suse_version} > 1320 || 0%{suse_version} == 1315
    -DVTK_USE_SYSTEM_JSONCPP:BOOL=ON \
%endif
    -DVTK_USE_SYSTEM_GL2PS:BOOL=ON \
    -DVTK_USE_SYSTEM_LIBXML2:BOOL=ON \
    -DVTK_PYTHON_VERSION=2 \
    -DCMAKE_NO_BUILTIN_CHRPATH:BOOL=ON \
    -DVTK_USE_SYSTEM_DIY2=OFF \
    -DVTK_USE_SYSTEM_GL2PS=OFF

make %{?_smp_mflags} VERBOSE=1

# Remove executable bits from sources (some of which are generated)
find . -name \*.c -or -name \*.cxx -or -name \*.h -or -name \*.hxx -or -name \*.gif | xargs chmod -x
popd

%install
pushd build
%makeinstall

# Install conf file to enable vtk to find its libraries
mkdir -p %{buildroot}/%{_sysconfdir}/ld.so.conf.d
echo %{_libdir}/vtk > %{buildroot}/%{_sysconfdir}/ld.so.conf.d/vtk.conf

# Remove redundant 3rd party libraries (already in package vtk)
%if 0%{?suse_version} > 1320
rm -r %{buildroot}/%{_libdir}/vtk/site-packages
%endif

# Remove rpaths from installed binaries
chrpath -d %{buildroot}%{_bindir}/*

%fdupes -s %{buildroot}

%post   -p /sbin/ldconfig
%postun -p /sbin/ldconfig

%post   -n %{name}-qt -p /sbin/ldconfig
%postun -n %{name}-qt -p /sbin/ldconfig

#only python2 related files are packed
%define _unpackaged_files_terminate_build 0

%files
%defattr(-,root,root,-)
%{_bindir}/vtkpython
%{_bindir}/pvtkpython
%{_bindir}/vtkWrapPython
%{_bindir}/vtkWrapPythonInit
%{_libdir}/vtk/*Python*.so.*
%{python_sitearch}/vtk/
%dir %{_libdir}/vtk/
%exclude %{_libdir}/vtk/*QtPython*.so.*

%files -n %{name}-qt
%defattr(-,root,root,-)
%{_libdir}/vtk/*QtPython*.so.*

%changelog