From fb5af9f443a3d01cb4853db53d5d04cd2117b3d9 Mon Sep 17 00:00:00 2001 From: Kevin Mihelich Date: Mon, 27 Dec 2021 00:15:08 +0000 Subject: [PATCH] added community/opencascade --- community/opencascade/PKGBUILD | 82 +++++++++++++++++++ .../opencascade/cmake-fix-variable.patch | 12 +++ .../fix-install-dir-references.patch | 24 ++++++ .../opencascade/opencascade-tbb-2021.patch | 34 ++++++++ community/opencascade/opencascade.sh | 24 ++++++ community/opencascade/vtk9.patch | 37 +++++++++ 6 files changed, 213 insertions(+) create mode 100644 community/opencascade/PKGBUILD create mode 100644 community/opencascade/cmake-fix-variable.patch create mode 100644 community/opencascade/fix-install-dir-references.patch create mode 100644 community/opencascade/opencascade-tbb-2021.patch create mode 100644 community/opencascade/opencascade.sh create mode 100644 community/opencascade/vtk9.patch diff --git a/community/opencascade/PKGBUILD b/community/opencascade/PKGBUILD new file mode 100644 index 000000000..90051482f --- /dev/null +++ b/community/opencascade/PKGBUILD @@ -0,0 +1,82 @@ +# Maintainer: Kyle Keen +# Contributor: Gabriel Souza Franco +# Contributor: Florian Pritz +# Contributor: Giuseppe Borzi +# Contributor: Brice Méalier +# Contributor: Michele Mocciola + +# ALARM: Kevin Mihelich +# - removed makedepends on adios2 + +pkgname=opencascade +pkgver=7.5.3 +_pkgver=V7_5_3 +#_pkgver=${pkgver//_/} +#_pkgver=V${_pkgver//./_} +pkgrel=4 +pkgdesc="Open CASCADE Technology, 3D modeling & numerical simulation" +arch=('x86_64') +url="https://www.opencascade.org" +license=('custom') +depends=('tk' 'vtk' 'gl2ps' 'ffmpeg' 'freeimage' 'intel-tbb') +makedepends=('cmake' 'qt5-base' 'rapidjson' 'eigen' 'utf8cpp' 'python' 'pugixml' 'glew' + 'gdal' 'proj' 'boost' 'liblas' 'pdal' 'libharu' 'unixodbc' + 'python-mpi4py' 'openvr') # VTK requires these to build +source=("opencascade-${pkgver}.tgz::https://git.dev.opencascade.org/gitweb/?p=occt.git;a=snapshot;h=refs/tags/${_pkgver};sf=tgz" + 'opencascade.sh' 'fix-install-dir-references.patch' + 'cmake-fix-variable.patch' + 'vtk9.patch' + "fix-freecad-build.patch::https://git.dev.opencascade.org/gitweb/?p=occt.git;a=patch;h=5e7632824302761b84cfceb5bfb2241d906d0eb4" + 'opencascade-tbb-2021.patch') +sha256sums=('cc3d3fd9f76526502c3d9025b651f45b034187430f231414c97dda756572410b' + '2064536a85d46fee368a8f1a712b2c6c77ca79c5bffcc68cba79d70d36efa2f4' + 'afb584aa453993ae8d9e2b983594558531ede735a5892754b812be30650c9fb5' + 'c7427082400b2d1ac58c59549d4dd1ee5b27d06847b7907842e9e2f2b68980fa' + 'ae24da8eac8b57af8f612c872c8ec1962b6e5243758aa39c92e805223fdfe157' + '4782d4d93cbd7f5489d23a855a1d31801bd61383d7cf9dc0e613fae34541cfde' + 'b0c4601fd9b2905e4b3bc3ed8af1493960c80bfe10332a0c562c59786efd57a2') + +prepare() { + cd "occt-${_pkgver}" + patch -Np1 -i "$srcdir/fix-install-dir-references.patch" + patch -Np1 -i "$srcdir/cmake-fix-variable.patch" + patch -p1 -i ../vtk9.patch # Fix build with VTK 9 https://gitlab.kitware.com/vtk/vtk/-/issues/18240 + patch -p1 -i ../fix-freecad-build.patch # Fix build of FreeCAD + patch -p1 -i ../opencascade-tbb-2021.patch # Fix build with TBB 2021 +} + +build() { + cd "occt-${_pkgver}" + mkdir -p build && cd build + + cmake .. \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_INSTALL_PREFIX=/usr \ + -DBUILD_RELEASE_DISABLE_EXCEPTIONS=OFF \ + -DUSE_GL2PS=ON \ + -DUSE_FREEIMAGE=ON \ + -DUSE_FFMPEG=ON \ + -DUSE_VTK=ON \ + -DUSE_RAPIDJSON=ON \ + -DUSE_TBB=ON \ + -D3RDPARTY_VTK_INCLUDE_DIR=/usr/include/vtk + + make +} + +package() { + cd "occt-${_pkgver}/build" + + make DESTDIR="$pkgdir" install + + cd .. + + install -Dm755 "$srcdir/opencascade.sh" "$pkgdir/etc/profile.d/opencascade.sh" + install -dm755 "$pkgdir/usr/share/licenses/$pkgname/" + mv "$pkgdir/usr/share/doc/opencascade/"* "$pkgdir/usr/share/licenses/$pkgname" + rm -r "$pkgdir/usr/share/doc" + + rm "$pkgdir/usr/bin/"*.sh +} + +# vim:set ts=2 sw=2 et: diff --git a/community/opencascade/cmake-fix-variable.patch b/community/opencascade/cmake-fix-variable.patch new file mode 100644 index 000000000..a59741f3d --- /dev/null +++ b/community/opencascade/cmake-fix-variable.patch @@ -0,0 +1,12 @@ +diff -Naur occt-V7_3_0/adm/templates/OpenCASCADEConfig.cmake.in occt-V7_3_0_new/adm/templates/OpenCASCADEConfig.cmake.in +--- occt-V7_3_0/adm/templates/OpenCASCADEConfig.cmake.in 2018-05-29 12:14:02.000000000 +0200 ++++ occt-V7_3_0.new/adm/templates/OpenCASCADEConfig.cmake.in 2018-05-29 12:14:02.000000000 +0200 +@@ -26,7 +26,7 @@ + if (OpenCASCADE_INSTALL_PREFIX MATCHES "/cmake$") + get_filename_component (OpenCASCADE_INSTALL_PREFIX "${OpenCASCADE_INSTALL_PREFIX}" PATH) + endif() +-if (OpenCASCADE_INSTALL_PREFIX MATCHES "/lib$") ++if (OpenCASCADE_INSTALL_PREFIX MATCHES "/lib(64)?$") + get_filename_component (OpenCASCADE_INSTALL_PREFIX "${OpenCASCADE_INSTALL_PREFIX}" PATH) + endif() + diff --git a/community/opencascade/fix-install-dir-references.patch b/community/opencascade/fix-install-dir-references.patch new file mode 100644 index 000000000..0d3c8c833 --- /dev/null +++ b/community/opencascade/fix-install-dir-references.patch @@ -0,0 +1,24 @@ +diff -aur occt-V7_1_0/CMakeLists.txt occt-V7_1_0.new/CMakeLists.txt +--- occt-V7_1_0/CMakeLists.txt 2016-11-25 11:50:18.000000000 +0100 ++++ occt-V7_1_0.new/CMakeLists.txt 2017-03-18 08:44:10.406668714 +0100 +@@ -906,7 +906,7 @@ + endforeach() + # install OpenCASCADE config file with compile definitions and C/C++ flags ONLY for current configuration + install (CODE "string (TOLOWER \"\${CMAKE_INSTALL_CONFIG_NAME}\" CMAKE_INSTALL_CONFIG_NAME_LOWER)") +-install (CODE "configure_file(\"${CMAKE_BINARY_DIR}/OpenCASCADECompileDefinitionsAndFlags-\${CMAKE_INSTALL_CONFIG_NAME_LOWER}.cmake\" \"${INSTALL_DIR}/${INSTALL_DIR_CMAKE}/OpenCASCADECompileDefinitionsAndFlags-\${CMAKE_INSTALL_CONFIG_NAME_LOWER}.cmake\" COPYONLY)") ++install (CODE "configure_file(\"${CMAKE_BINARY_DIR}/OpenCASCADECompileDefinitionsAndFlags-\${CMAKE_INSTALL_CONFIG_NAME_LOWER}.cmake\" \"\$ENV{DESTDIR}${INSTALL_DIR}/${INSTALL_DIR_CMAKE}/OpenCASCADECompileDefinitionsAndFlags-\${CMAKE_INSTALL_CONFIG_NAME_LOWER}.cmake\" COPYONLY)") + + foreach (OCCT_MODULE ${OCCT_MODULES}) + if (BUILD_MODULE_${OCCT_MODULE}) +diff -aur occt-V7_1_0/adm/cmake/occt_macros.cmake occt-V7_1_0.new/adm/cmake/occt_macros.cmake +--- occt-V7_1_0/adm/cmake/occt_macros.cmake 2016-11-25 11:50:18.000000000 +0100 ++++ occt-V7_1_0.new/adm/cmake/occt_macros.cmake 2017-03-18 08:44:10.406668714 +0100 +@@ -558,7 +558,7 @@ + "cmake_policy(PUSH) + cmake_policy(SET CMP0007 NEW) + string (TOLOWER \"\${CMAKE_INSTALL_CONFIG_NAME}\" CMAKE_INSTALL_CONFIG_NAME_LOWERCASE) +- file (GLOB ALL_OCCT_TARGET_FILES \"${INSTALL_DIR}/${INSTALL_DIR_CMAKE}/OpenCASCADE*Targets-\${CMAKE_INSTALL_CONFIG_NAME_LOWERCASE}.cmake\") ++ file (GLOB ALL_OCCT_TARGET_FILES \"\$ENV{DESTDIR}${INSTALL_DIR}/${INSTALL_DIR_CMAKE}/OpenCASCADE*Targets-\${CMAKE_INSTALL_CONFIG_NAME_LOWERCASE}.cmake\") + foreach(TARGET_FILENAME \${ALL_OCCT_TARGET_FILES}) + file (STRINGS \"\${TARGET_FILENAME}\" TARGET_FILE_CONTENT) + file (REMOVE \"\${TARGET_FILENAME}\") diff --git a/community/opencascade/opencascade-tbb-2021.patch b/community/opencascade/opencascade-tbb-2021.patch new file mode 100644 index 000000000..fae8982e3 --- /dev/null +++ b/community/opencascade/opencascade-tbb-2021.patch @@ -0,0 +1,34 @@ +diff --git a/src/OSD/OSD_Parallel_TBB.cxx b/src/OSD/OSD_Parallel_TBB.cxx +index 2344a6ca2..e1a3d89de 100644 +--- a/src/OSD/OSD_Parallel_TBB.cxx ++++ b/src/OSD/OSD_Parallel_TBB.cxx +@@ -25,7 +25,7 @@ Standard_DISABLE_DEPRECATION_WARNINGS + #include + #include + #include +-#include ++#include + Standard_ENABLE_DEPRECATION_WARNINGS + + //======================================================================= +@@ -38,19 +38,12 @@ void OSD_Parallel::forEachExternal (UniversalIterator& theBegin, + const FunctorInterface& theFunctor, + Standard_Integer theNbItems) + { +- try +- { + const Handle(OSD_ThreadPool)& aThreadPool = OSD_ThreadPool::DefaultPool(); + const Standard_Integer aNbThreads = theNbItems > 0 ? + aThreadPool->NbDefaultThreadsToLaunch() : -1; + +- tbb::task_scheduler_init aScheduler (aNbThreads); ++ tbb::global_control global_limit(tbb::global_control::max_allowed_parallelism, aNbThreads); + tbb::parallel_for_each (theBegin, theEnd, theFunctor); +- } +- catch (tbb::captured_exception& anException) +- { +- throw Standard_ProgramError (anException.what()); +- } + } + + #endif /* HAVE_TBB */ diff --git a/community/opencascade/opencascade.sh b/community/opencascade/opencascade.sh new file mode 100644 index 000000000..4d30d9ff1 --- /dev/null +++ b/community/opencascade/opencascade.sh @@ -0,0 +1,24 @@ +export CASROOT=/usr + +export CSF_LANGUAGE=us +export MMGT_CLEAR=1 +export CSF_EXCEPTION_PROMPT=1 + +export CSF_OCCTResourcePath=$CASROOT/share/opencascade/resources +export CSF_SHMessage=$CSF_OCCTResourcePath/SHMessage +export CSF_MDTVTexturesDirectory=$CSF_OCCTResourcePath/Textures +export CSF_ShadersDirectory=$CSF_OCCTResourcePath/Shaders +export CSF_XSMessage=$CSF_OCCTResourcePath/XSMessage +export CSF_TObjMessage=$CSF_OCCTResourcePath/TObj +export CSF_StandardDefaults=$CSF_OCCTResourcePath/StdResource +export CSF_PluginDefaults=$CSF_OCCTResourcePath/StdResource +export CSF_XCAFDefaults=$CSF_OCCTResourcePath/StdResource +export CSF_TObjDefaults=$CSF_OCCTResourcePath/StdResource +export CSF_StandardLiteDefaults=$CSF_OCCTResourcePath/StdResource +export CSF_IGESDefaults=$CSF_OCCTResourcePath/XSTEPResource +export CSF_STEPDefaults=$CSF_OCCTResourcePath/XSTEPResource +export CSF_XmlOcafResource=$CSF_OCCTResourcePath/XmlOcafResource +export CSF_MIGRATION_TYPES=$CSF_OCCTResourcePath/StdResource/MigrationSheet.txt +export CSF_DrawPluginDefaults=$CSF_OCCTResourcePath/DrawResources +export DRAWHOME=$CSF_OCCTResourcePath/DrawResources +export DRAWDEFAULT=$CSF_OCCTResourcePath/DrawResources/DrawDefault diff --git a/community/opencascade/vtk9.patch b/community/opencascade/vtk9.patch new file mode 100644 index 000000000..66bd07588 --- /dev/null +++ b/community/opencascade/vtk9.patch @@ -0,0 +1,37 @@ +diff --git a/src/IVtkDraw/IVtkDraw_HighlightAndSelectionPipeline.hxx b/src/IVtkDraw/IVtkDraw_HighlightAndSelectionPipeline.hxx +index 9e8a4e028a..8491febece 100644 +--- a/src/IVtkDraw/IVtkDraw_HighlightAndSelectionPipeline.hxx ++++ b/src/IVtkDraw/IVtkDraw_HighlightAndSelectionPipeline.hxx +@@ -23,6 +23,7 @@ + + // prevent disabling some MSVC warning messages by VTK headers + #include ++#undef AllValues + #include + #include + #include +diff --git a/src/IVtkVTK/IVtkVTK_ShapeData.hxx b/src/IVtkVTK/IVtkVTK_ShapeData.hxx +index 0fda1748ab..3ca3a8eeb9 100644 +--- a/src/IVtkVTK/IVtkVTK_ShapeData.hxx ++++ b/src/IVtkVTK/IVtkVTK_ShapeData.hxx +@@ -23,6 +23,7 @@ + #include + #include + #include ++#include + #include + + class vtkIdTypeArray; +diff --git a/src/InterfaceGraphic/InterfaceGraphic.hxx b/src/InterfaceGraphic/InterfaceGraphic.hxx +index c533f68cd5..6410892618 100644 +--- a/src/InterfaceGraphic/InterfaceGraphic.hxx ++++ b/src/InterfaceGraphic/InterfaceGraphic.hxx +@@ -40,6 +40,8 @@ + #include + #include + ++#undef AllValues ++ + #endif + + #endif // __INTERFACE_GRAPHIC_HXX