From 914eac4c4b53e61cf96ebf1bc97527fcf9b12af9 Mon Sep 17 00:00:00 2001 From: Orion Poplawski Date: Fri, 18 Feb 2011 11:27:48 -0700 Subject: [PATCH] Add patch to support gcc 4.6 Add patch to make using system libraries easier Update pythondestdir patch to use --prefix and --root Use system gl2ps and libxml2 Use standard cmake build macro, out of tree builds Add patch from upstream to add sonames to libCosmo and libVPIC (bug #622840) --- vtk-5.2.0-pythondestdir.patch | 2 +- vtk-5.6.1-gcc46.patch | 23 +++++++++++ vtk-5.6.1-soversion.patch | 30 +++++++++++++++ vtk-5.6.1-system.patch | 39 +++++++++++++++++++ vtk.spec | 72 +++++++++++++++++++---------------- 5 files changed, 133 insertions(+), 33 deletions(-) create mode 100644 vtk-5.6.1-gcc46.patch create mode 100644 vtk-5.6.1-soversion.patch create mode 100644 vtk-5.6.1-system.patch diff --git a/vtk-5.2.0-pythondestdir.patch b/vtk-5.2.0-pythondestdir.patch index 3668d55..a793f25 100644 --- a/vtk-5.2.0-pythondestdir.patch +++ b/vtk-5.2.0-pythondestdir.patch @@ -5,7 +5,7 @@ # Create default python setup arguments if they are not set. IF(NOT DEFINED VTK_PYTHON_SETUP_ARGS) - SET(VTK_PYTHON_SETUP_ARGS "--prefix=\"${DOLLAR}{CMAKE_INSTALL_PREFIX}\"" -+ SET(VTK_PYTHON_SETUP_ARGS "--root=\"${DOLLAR}{CMAKE_INSTALL_PREFIX}\"" ++ SET(VTK_PYTHON_SETUP_ARGS "--prefix=\"${DOLLAR}{CMAKE_INSTALL_PREFIX}\" --root=\"${DOLLAR}ENV{DESTDIR}\"" CACHE STRING "Arguments passed to \"python setup.py install ...\" during installation.") MARK_AS_ADVANCED(VTK_PYTHON_SETUP_ARGS) ENDIF(NOT DEFINED VTK_PYTHON_SETUP_ARGS) diff --git a/vtk-5.6.1-gcc46.patch b/vtk-5.6.1-gcc46.patch new file mode 100644 index 0000000..156b094 --- /dev/null +++ b/vtk-5.6.1-gcc46.patch @@ -0,0 +1,23 @@ +diff -up VTK/Common/vtkPythonUtil.cxx.gcc46 VTK/Common/vtkPythonUtil.cxx +--- VTK/Common/vtkPythonUtil.cxx.gcc46 2010-09-27 14:40:01.000000000 -0600 ++++ VTK/Common/vtkPythonUtil.cxx 2011-02-08 11:15:39.596308982 -0700 +@@ -31,6 +31,8 @@ + #include + #include + ++#include ++ + // Silent warning like + // "dereferencing type-punned pointer will break strict-aliasing rules" + // it happens because this kind of expression: (long *)&ptr +diff -up VTK/Utilities/vtkmetaio/metaUtils.cxx.gcc46 VTK/Utilities/vtkmetaio/metaUtils.cxx +--- VTK/Utilities/vtkmetaio/metaUtils.cxx.gcc46 2010-09-27 14:40:10.000000000 -0600 ++++ VTK/Utilities/vtkmetaio/metaUtils.cxx 2011-02-08 10:43:25.265499011 -0700 +@@ -34,6 +34,7 @@ + #include + #endif + ++#include + #include + #include + #include diff --git a/vtk-5.6.1-soversion.patch b/vtk-5.6.1-soversion.patch new file mode 100644 index 0000000..3470538 --- /dev/null +++ b/vtk-5.6.1-soversion.patch @@ -0,0 +1,30 @@ +diff -up VTK/Utilities/Cosmo/CMakeLists.txt.soversion VTK/Utilities/Cosmo/CMakeLists.txt +--- VTK/Utilities/Cosmo/CMakeLists.txt.soversion 2010-09-27 14:40:07.000000000 -0600 ++++ VTK/Utilities/Cosmo/CMakeLists.txt 2011-02-18 09:23:40.749509891 -0700 +@@ -35,6 +35,11 @@ INCLUDE_DIRECTORIES (${Cosmo_SOURCE_DIR} + ADD_LIBRARY(Cosmo ${Cosmo_SOURCES}) + TARGET_LINK_LIBRARIES(Cosmo vtksys vtkCommon ${Cosmo_LIBS}) + ++# Apply user-defined properties to the library target. Such as SO Version ++IF(VTK_LIBRARY_PROPERTIES) ++ SET_TARGET_PROPERTIES(Cosmo PROPERTIES ${VTK_LIBRARY_PROPERTIES}) ++ENDIF(VTK_LIBRARY_PROPERTIES) ++ + IF(NOT VTK_INSTALL_NO_LIBRARIES) + INSTALL(TARGETS Cosmo + RUNTIME DESTINATION ${VTK_INSTALL_BIN_DIR_CM24} COMPONENT RuntimeLibraries +diff -up VTK/Utilities/VPIC/CMakeLists.txt.soversion VTK/Utilities/VPIC/CMakeLists.txt +--- VTK/Utilities/VPIC/CMakeLists.txt.soversion 2010-09-27 14:40:08.000000000 -0600 ++++ VTK/Utilities/VPIC/CMakeLists.txt 2011-02-18 09:24:46.991211358 -0700 +@@ -31,6 +31,11 @@ TARGET_LINK_LIBRARIES(VPIC ${MPI_LIBRARY + ENDIF(MPI_EXTRA_LIBRARY) + ENDIF(VTK_USE_MPI) + ++# Apply user-defined properties to the library target. Such as SO Version ++IF(VTK_LIBRARY_PROPERTIES) ++ SET_TARGET_PROPERTIES(VPIC PROPERTIES ${VTK_LIBRARY_PROPERTIES}) ++ENDIF(VTK_LIBRARY_PROPERTIES) ++ + IF(NOT VTK_INSTALL_NO_LIBRARIES) + INSTALL(TARGETS VPIC + RUNTIME DESTINATION ${VTK_INSTALL_BIN_DIR_CM24} COMPONENT RuntimeLibraries diff --git a/vtk-5.6.1-system.patch b/vtk-5.6.1-system.patch new file mode 100644 index 0000000..2a39233 --- /dev/null +++ b/vtk-5.6.1-system.patch @@ -0,0 +1,39 @@ +diff -up VTK/CMakeLists.txt.system VTK/CMakeLists.txt +--- VTK/CMakeLists.txt.system 2010-09-27 14:40:00.000000000 -0600 ++++ VTK/CMakeLists.txt 2011-02-08 14:08:29.367122550 -0700 +@@ -106,6 +106,11 @@ IF(CMAKE_CONFIGURATION_TYPES) + ENDIF(CMAKE_CONFIGURATION_TYPES) + + #----------------------------------------------------------------------------- ++# Do we try to use system libraries by default? ++OPTION(VTK_USE_SYSTEM_LIBRARIES "Use the system's libraries by default." OFF) ++MARK_AS_ADVANCED(VTK_USE_SYSTEM_LIBRARIES) ++ ++#----------------------------------------------------------------------------- + # Load some macros. + INCLUDE(vtkDependentOption) + INCLUDE(vtkThirdParty) +diff -up VTK/CMake/vtkThirdParty.cmake.system VTK/CMake/vtkThirdParty.cmake +--- VTK/CMake/vtkThirdParty.cmake.system 2010-09-27 14:40:00.000000000 -0600 ++++ VTK/CMake/vtkThirdParty.cmake 2011-02-08 14:07:46.424662568 -0700 +@@ -1,6 +1,6 @@ + #----------------------------------------------------------------------------- + MACRO(VTK_THIRD_PARTY_OPTION upper lower) +- OPTION(VTK_USE_SYSTEM_${upper} "Use the system's ${lower} library." OFF) ++ OPTION(VTK_USE_SYSTEM_${upper} "Use the system's ${lower} library." ${VTK_USE_SYSTEM_LIBRARIES}) + MARK_AS_ADVANCED(VTK_USE_SYSTEM_${upper}) + IF(VTK_USE_SYSTEM_${upper}) + IF(EXISTS ${CMAKE_ROOT}/Modules/Find${upper}.cmake) +diff -up VTK/Rendering/CMakeLists.txt.system VTK/Rendering/CMakeLists.txt +--- VTK/Rendering/CMakeLists.txt.system 2010-09-27 14:40:06.000000000 -0600 ++++ VTK/Rendering/CMakeLists.txt 2011-02-08 14:11:47.379633170 -0700 +@@ -202,7 +202,8 @@ ENDIF (NOT VTK_LEGACY_REMOVE) + + IF(VTK_USE_GL2PS) + SET(Kit_SRCS ${Kit_SRCS} vtkGL2PSExporter.cxx) +- ++ OPTION(VTK_USE_SYSTEM_GL2PS "Use the system's gl2ps library." ${VTK_USE_SYSTEM_LIBRARIES}) ++ MARK_AS_ADVANCED(VTK_USE_SYSTEM_GL2PS) + IF(VTK_USE_SYSTEM_GL2PS) + ELSE(VTK_USE_SYSTEM_GL2PS) + SET(Kit_GL2PS_SRCS ${VTK_SOURCE_DIR}/Utilities/vtkgl2ps/gl2ps.c) diff --git a/vtk.spec b/vtk.spec index eb33393..efade5c 100644 --- a/vtk.spec +++ b/vtk.spec @@ -6,7 +6,7 @@ Summary: The Visualization Toolkit - A high level 3D visualization library Name: vtk Version: 5.6.1 -Release: 2%{?dist} +Release: 3%{?dist} # 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 @@ -16,13 +16,20 @@ Source: http://www.vtk.org/files/release/5.6/%{name}-%{version}.tar.gz Patch0: vtk-5.2.0-pythondestdir.patch Patch1: vtk-5.2.0-gcc43.patch Patch2: vtk-5.6.0-testcxxjavaremove.patch - # Python 2.7 compatibility: not yet sent upstream: Patch3: vtk-5.6.0-python27.patch +# Add needed includes for gcc 4.6 +# http://public.kitware.com/Bug/view.php?id=11824 +Patch4: vtk-5.6.1-gcc46.patch +# Use system libraries +# http://public.kitware.com/Bug/view.php?id=11823 +Patch5: vtk-5.6.1-system.patch +# Upstream patch to add soversions to libCosmo and libVPIC +Patch6: vtk-5.6.1-soversion.patch URL: http://vtk.org/ BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root -BuildRequires: cmake >= 2.0.4 +BuildRequires: cmake BuildRequires: gcc-c++ #%{?with_java:BuildRequires: gcc-java, libgcj-devel, java-devel} %{?with_java:BuildRequires: java-devel} @@ -32,7 +39,9 @@ BuildRequires: libICE-devel, libGL-devel BuildRequires: tk-devel, tcl-devel BuildRequires: python-devel BuildRequires: expat-devel, freetype-devel, libjpeg-devel, libpng-devel +BuildRequires: gl2ps-devel BuildRequires: libtiff-devel, zlib-devel +BuildRequires: libxml2-devel BuildRequires: qt4-devel BuildRequires: chrpath BuildRequires: doxygen, graphviz @@ -120,6 +129,9 @@ programming languages. %patch1 -p1 -b .gcc43 %patch2 -p1 -b .testcxxjava %patch3 -p1 -b .python27 +%patch4 -p1 -b .gcc46 +%patch5 -p1 -b .system +%patch6 -p1 -b .soversion # Replace relative path ../../../VTKData with %{_datadir}/vtkdata-%{version} # otherwise it will break on symlinks. @@ -140,19 +152,14 @@ export CXXFLAGS="%{optflags} -D_UNICODE" export JAVA_HOME=/usr/lib/jvm/java %endif -# Not every subbuild respects build != install -tmpinstall=`pwd`/tmpinstall - -cmake_command="cmake . \ - -DBUILD_SHARED_LIBS:BOOL=ON \ +mkdir build +pushd build +%{cmake} .. \ -DBUILD_DOCUMENTATION:BOOL=ON \ -DBUILD_EXAMPLES:BOOL=ON \ -DBUILD_TESTING:BOOL=ON \ - -DCMAKE_INSTALL_PREFIX:PATH=$tmpinstall \ - -DVTK_INSTALL_BIN_DIR:PATH=%{_bindir} \ - -DVTK_INSTALL_INCLUDE_DIR:PATH=%{_includedir}/vtk \ - -DVTK_INSTALL_LIB_DIR:PATH=%{_libdir}/vtk-5.6 \ - -DVTK_DATA_ROOT:PATH=%{_datadir}/vtkdata-%{version} \ + -DVTK_INSTALL_INCLUDE_DIR:PATH=include/vtk \ + -DVTK_INSTALL_QT_DIR=/%{_lib}/qt4/plugins/designer \ -DTK_INTERNAL_PATH:PATH=/usr/include/tk-private/generic \ %if %{with OSMesa} -DVTK_OPENGL_HAS_OSMESA:BOOL=ON \ @@ -170,19 +177,10 @@ cmake_command="cmake . \ -DVTK_USE_GL2PS:BOOL=ON \ -DVTK_USE_GUISUPPORT:BOOL=ON \ -DVTK_USE_PARALLEL:BOOL=ON \ - -DVTK_USE_SYSTEM_EXPAT=ON \ - -DVTK_USE_SYSTEM_FREETYPE=ON \ - -DVTK_USE_SYSTEM_JPEG=ON \ - -DVTK_USE_SYSTEM_PNG=ON \ - -DVTK_USE_SYSTEM_TIFF=ON \ - -DVTK_USE_SYSTEM_ZLIB=ON \ + -DVTK_USE_SYSTEM_LIBRARIES=ON \ + -DVTK_USE_SYSTEM_LIBPROJ4=OFF \ -DVTK_USE_QVTK=ON \ - -DVTK_USE_QT=ON \ - -DVTK_INSTALL_QT_DIR=`qmake-qt4 -query QT_INSTALL_PREFIX`/plugins/designer \ -" -# Second cmake is neccessary for vtk -eval $cmake_command -eval $cmake_command + -DVTK_USE_QT=ON # Commented old flags in case we'd like to reactive some of them # -DVTK_USE_DISPLAY:BOOL=OFF \ # This prevents building of graphics tests @@ -193,7 +191,8 @@ eval $cmake_command # -DVTK_USE_X:BOOL=ON \ # -DOPENGL_INCLUDE_DIR:PATH=/usr/include/GL \ -make +# Got intermittent build error with -j +make #%{?_smp_mflags} # Remove executable bits from sources (some of which are generated) find . -name \*.c -or -name \*.cxx -or -name \*.h -or -name \*.hxx -or \ @@ -202,8 +201,8 @@ find . -name \*.c -or -name \*.cxx -or -name \*.h -or -name \*.hxx -or \ %install rm -rf %{buildroot} mkdir -p %{buildroot} -make install -mv tmpinstall/* %{buildroot}/ +pushd build +make install DESTDIR=%{buildroot} if [ "%{_lib}" != lib -a "`ls %{buildroot}%{_prefix}/lib/*`" != "" ]; then mkdir -p %{buildroot}%{_libdir} @@ -278,6 +277,7 @@ done # Main package contains utils and core libs cat libs.list utils.list > main.list +popd # Make shared libs and scripts executable chmod a+x %{buildroot}%{_libdir}/lib*.so.* @@ -327,7 +327,7 @@ rm -rf %{buildroot} %postun qt -p /sbin/ldconfig -%files -f main.list +%files -f build/main.list %defattr(-,root,root,-) %doc --parents Copyright.txt README.html vtkLogo.jpg vtkBanner.gif Wrapping/*/README* @@ -371,17 +371,25 @@ rm -rf %{buildroot} %files qt %defattr(-,root,root,-) %{_libdir}/libQVTK.so.* -%{_libdir}/qt*/plugins/designer +%{_libdir}/qt4/plugins/designer -%files testing -f testing.list +%files testing -f build/testing.list %defattr(-,root,root,-) %{_libdir}/vtk-5.6/testing -%files examples -f examples.list +%files examples -f build/examples.list %defattr(-,root,root,-) %doc vtk-examples-5.6/Examples %changelog +* Fri Feb 18 2011 Orion Poplawski - 5.6.1-3 +- Add patch to support gcc 4.6 +- Add patch to make using system libraries easier +- Update pythondestdir patch to use --prefix and --root +- Use system gl2ps and libxml2 +- Use standard cmake build macro, out of tree builds +- Add patch from upstream to add sonames to libCosmo and libVPIC (bug #622840) + * Mon Feb 07 2011 Fedora Release Engineering - 5.6.1-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild