From d75ec96234a53ad9b2885190cced6bc21b6b3c13 Mon Sep 17 00:00:00 2001 From: mark Date: Tue, 14 Jun 2016 12:42:23 +0200 Subject: [PATCH] ENH: add a patch mechanism for ParaView build - this adds some flexiblity/robustness to the build --- README.org | 16 ++++++++++--- etc/patches/mkdiff-paraview-5.0.1 | 13 +++++++++++ etc/patches/paraview-5.0.1 | 39 +++++++++++++++++++++++++++++++ etc/tools/ParaViewFunctions | 30 +++++++++++++++++++++++- makeParaView | 17 ++++++++++++-- 5 files changed, 109 insertions(+), 6 deletions(-) create mode 100644 etc/patches/mkdiff-paraview-5.0.1 create mode 100644 etc/patches/paraview-5.0.1 diff --git a/README.org b/README.org index 7280012..9a5f9f7 100644 --- a/README.org +++ b/README.org @@ -2,7 +2,7 @@ # #+TITLE: OpenFOAM Third-Party packages #+AUTHOR: The OpenFOAM Foundation -#+DATE: 31th May 2016 +#+DATE: 2016-06-14 #+LINK: http://www.openfoam.org #+OPTIONS: author:nil ^:{} # Copyright (c) 2014-2016 OpenFOAM Foundation. @@ -15,6 +15,8 @@ + makeCmake (if the system cmake version is < 2.8.8) + makeParaView *** Optional Build Components: + + makeLLVM (Replaces makeGcc in the above description + - to use clang as compiler) + makeCCMIO (Only required for conversion of STAR-CCM+ meshes) + Allclean (Only required to save disk space) * Versions and locations to download the third party packages @@ -65,13 +67,21 @@ directory: + wget https://raw.githubusercontent.com/Kitware/VTK/40937e934308e5009e80769dc0c451ee4f157749/IO/Geometry/vtkSTLReader.cxx -O ParaView-4.4.0/VTK/IO/Geometry/vtkSTLReader.cxx See also http://www.openfoam.org/mantisbt/view.php?id=1887 + + For ParaView-5.0.1, the necessary patches are supplied with the + ThirdParty repository (see the etc/patches directory) and are applied + when building paraview. + *** Building ParaView-5.0.1 with gcc-6.1.0 ***** Add support for gcc-6.?.? The following cmake files + ParaView-5.0.1/VTK/CMake/vtkCompilerExtras.cmake + ParaView-5.0.1/VTK/CMake/GenerateExportHeader.cmake - specifically limit the gcc versions supported. To add support gcc-6.?.? - replace '[345]' with '[3456]' + specifically limit the gcc versions supported. + To add support gcc-6.?.? replace the '[345]' with '[3456]'. + This patch is also supplied with the ThirdParty repository and + applied when building paraview. + ***** SciberQuestToolKit The SciberQuestToolKit plugin fails to compile with gcc-6.1.0 and causes the compilation of ParaView to halt. The easiest solution is to delete diff --git a/etc/patches/mkdiff-paraview-5.0.1 b/etc/patches/mkdiff-paraview-5.0.1 new file mode 100644 index 0000000..c6a7343 --- /dev/null +++ b/etc/patches/mkdiff-paraview-5.0.1 @@ -0,0 +1,13 @@ +#!/bin/sh + +# simple script to generate patches +paraview=ParaView-5.0.1 + +for i in \ + $paraview/VTK/CMake/vtkCompilerExtras.cmake \ + $paraview/VTK/CMake/GenerateExportHeader.cmake \ + $paraview/Qt/Components/CMakeLists.txt \ + ; +do + diff -uw $i.orig $i +done diff --git a/etc/patches/paraview-5.0.1 b/etc/patches/paraview-5.0.1 new file mode 100644 index 0000000..0c7156c --- /dev/null +++ b/etc/patches/paraview-5.0.1 @@ -0,0 +1,39 @@ +--- ParaView-5.0.1/VTK/CMake/vtkCompilerExtras.cmake.orig 2016-03-28 17:07:10.000000000 +0200 ++++ ParaView-5.0.1/VTK/CMake/vtkCompilerExtras.cmake 2016-06-11 15:10:14.820958942 +0200 +@@ -32,7 +32,7 @@ + OUTPUT_VARIABLE _gcc_version_info + ERROR_VARIABLE _gcc_version_info) + +- string (REGEX MATCH "[345]\\.[0-9]\\.[0-9]*" ++ string (REGEX MATCH "[3-6]\\.[0-9]\\.[0-9]*" + _gcc_version "${_gcc_version_info}") + if(NOT _gcc_version) + string (REGEX REPLACE ".*\\(GCC\\).*([34]\\.[0-9]).*" "\\1.0" +--- ParaView-5.0.1/VTK/CMake/GenerateExportHeader.cmake.orig 2016-03-28 17:07:10.000000000 +0200 ++++ ParaView-5.0.1/VTK/CMake/GenerateExportHeader.cmake 2016-06-11 15:12:16.344357746 +0200 +@@ -166,7 +166,7 @@ + execute_process(COMMAND ${CMAKE_C_COMPILER} ARGS --version + OUTPUT_VARIABLE _gcc_version_info + ERROR_VARIABLE _gcc_version_info) +- string(REGEX MATCH "[345]\\.[0-9]\\.[0-9]*" ++ string(REGEX MATCH "[3-6]\\.[0-9]\\.[0-9]*" + _gcc_version "${_gcc_version_info}") + # gcc on mac just reports: "gcc (GCC) 3.3 20030304 ..." without the + # patch level, handle this here: +--- ParaView-5.0.1/Qt/Components/CMakeLists.txt.orig 2016-06-13 09:27:27.827849525 +0200 ++++ ParaView-5.0.1/Qt/Components/CMakeLists.txt 2016-06-13 09:29:28.599318445 +0200 +@@ -656,10 +656,10 @@ + #the pqSGExportStateWizard has subclasses that directly access + #the UI file, and currently we don't have a clean way to break this hard + #dependency, so for no we install this ui file. +-if(PARAVIEW_INSTALL_DEVELOPMENT_FILES) +- install(FILES "${CMAKE_CURRENT_BINARY_DIR}/ui_pqExportStateWizard.h" +- DESTINATION "${VTK_INSTALL_INCLUDE_DIR}") +-endif() ++#OPENFOAM patch#if(PARAVIEW_INSTALL_DEVELOPMENT_FILES) ++#OPENFOAM patch# install(FILES "${CMAKE_CURRENT_BINARY_DIR}/ui_pqExportStateWizard.h" ++#OPENFOAM patch# DESTINATION "${VTK_INSTALL_INCLUDE_DIR}") ++#OPENFOAM patch#endif() + + #IF (NOT PV_INSTALL_NO_DEVELOPMENT) + # # Headers diff --git a/etc/tools/ParaViewFunctions b/etc/tools/ParaViewFunctions index e5fb200..0ba774a 100644 --- a/etc/tools/ParaViewFunctions +++ b/etc/tools/ParaViewFunctions @@ -3,7 +3,7 @@ # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / O peration | # \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation -# \\/ M anipulation | +# \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd. #------------------------------------------------------------------------------ # License # This file is part of OpenFOAM. @@ -364,6 +364,34 @@ addQtSupport() } +# +# Apply source-code patch if possible +# +applyPatch() +{ + local patch="$WM_THIRD_PARTY_DIR/etc/patches/paraview-$ParaView_VERSION" + local sentinel="PATCHED_DURING_OPENFOAM_BUILD" + + if [ -r "$patch" ] + then + ( + cd $ParaView_SOURCE_DIR || exit 1 + if [ -f "$sentinel" ] + then + echo "patch for paraview-$ParaView_VERSION was already applied" + else + echo "apply patch for paraview-$ParaView_VERSION" + touch "$sentinel" + patch -p1 < $patch + + fi + ) + else + echo "no patch found for paraview-$ParaView_VERSION" + fi +} + + # # Configure via cmake, but don't actually build anything # diff --git a/makeParaView b/makeParaView index 10db8a8..8016a86 100755 --- a/makeParaView +++ b/makeParaView @@ -4,7 +4,7 @@ # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / O peration | # \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation -# \\/ M anipulation | +# \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd. #------------------------------------------------------------------------------ # License # This file is part of OpenFOAM. @@ -111,6 +111,7 @@ For example, to add tests For finer control, the build stages can be selected or deselected individually: + -patch -no-patch -config -no-config -make -no-make -install -no-install @@ -144,7 +145,7 @@ setVersion # # various building stages # -unset runCONFIG runMAKE runINSTALL +unset runPATCH runCONFIG runMAKE runINSTALL runDEFAULT=true buildType=Release @@ -163,6 +164,15 @@ do export CXX=g++ # use g++ shift ;; + -patch) # stage 0: patch sources + runPATCH=true + unset runDEFAULT + shift + ;; + -no-patch) + runPATCH=false + shift + ;; -config) # stage 1: config only runCONFIG=true unset runDEFAULT @@ -285,6 +295,7 @@ done if [ "$runDEFAULT" = true ] then + : ${runPATCH:=true} : ${runCONFIG:=true} : ${runMAKE:=true} : ${runINSTALL:=true} @@ -309,6 +320,7 @@ cat<