backports/opencascade-dev: new aport

This commit is contained in:
Antoine Martin 2023-05-15 13:09:48 -04:00 committed by Antoine Martin
parent 3416531690
commit 1b178eb5a7
8 changed files with 342 additions and 0 deletions

View file

@ -0,0 +1,70 @@
# Maintainer: Marian Buschsieweke <marian.buschsieweke@ovgu.de>
# Contributor: Marian Buschsieweke <marian.buschsieweke@ovgu.de>
pkgname=opencascade
pkgver=7.6.3
pkgrel=1
pkgdesc="An SDK for development of applications dealing with 3D CAD data"
url="https://dev.opencascade.org/"
# s390x blocked by vtk -> netcdf
arch="all !s390x"
license="LGPL-2.1-only"
makedepends="
cmake
doxygen
freeimage-dev
freetype-dev
libtbb
libtbb-dev
libxi-dev
libxmu-dev
mesa-dev
ninja
tk
tk-dev
vtk-dev
"
subpackages="$pkgname-doc $pkgname-dev"
# remove updatecache on next update
source="$pkgname-$pkgver-updatecache.tar.gz::https://github.com/Open-Cascade-SAS/OCCT/archive/refs/tags/V${pkgver//./_}.tar.gz
no_mallinfo.patch
no_feenableexcept.patch
cmake_fix_install_dir.patch
cmake_add_buildtype_none.patch
no_backtrace.patch
fix-tbb-2021.patch
x11vtkconflict.patch
"
builddir="$srcdir/OCCT-${pkgver//./_}"
options="!check" # No tests provided :-/
build() {
# Disabling ffmpeg for now, as VTK already uses ffmpeg in version 5, while OCC only
# builds with ffmpeg4 right now. vtk-dev depends on ffmpeg-dev which conflics with
# ffmpeg4-dev. Once patched to build with ffmpeg-dev (not ffmpeg4-dev), ffmpeg support
# should be re-enabled.
cmake -B build -G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/usr \
-DUSE_GL2PS=OFF \
-DUSE_FREEIMAGE=ON \
-DUSE_FFMPEG=OFF \
-DUSE_VTK=ON \
-DUSE_TBB=ON \
-D3RDPARTY_VTK_INCLUDE_DIR=/usr/include/vtk-9.2/
cmake --build build
}
package() {
DESTDIR="$pkgdir" cmake --install build
}
sha512sums="
bdcdc79ce5bf1df4d7a4b90a4ce33fabf5fefeb75f33d58c571014c5cff9e4e2d444a518b741002654e29f0b50babad852b10636c3c888afb49628e1752abca7 opencascade-7.6.3-updatecache.tar.gz
e04cb898ec16c57ea5f2e9e79f6616153b7f6e4ddcad815f5d28898a692e26e1054a8f3321e6ee8616a915b10d45927f5e596c4f096c5333be910eaea751cce3 no_mallinfo.patch
b039b8fce696bfd0f53309a72adab4065780bf1755da6208040157e9383deb0061ad8927a6f160730f431cbebe3fdd1eaa7967b38da4a245a8d9306042d97629 no_feenableexcept.patch
10481f153adf1db55111d68da49dae1885a50e745d3a978f6316b5b13a3f2d7de6a2ed6a3c60c20ef967ea65c16b372da03bf2665ffe4493ad6fe329a3abf368 cmake_fix_install_dir.patch
4bdedc8f0e011530115777cddeeb898750242999725347c3392d8858e5cc9543c791814aa41e1543c575a6a79b0b32fd72970bb83c8948fe42f33993244db1cf cmake_add_buildtype_none.patch
86dceb6e8309e18f5ea72ce2e3524ff08dc761ffe76557d62a1a4f2824ca0e2f9dfc194cae22164aaaf5ad9a15a6ec0f1fef443241aa2ccb0a2140de217c8a90 no_backtrace.patch
80a5fdfec8159bfcfa2dce8f6635c8567eef64b0b142046ed2b7fc7a77849d14ae9b588b04daf5b5789d18130cbc40c5396af22787f38d8cd425f9f53d1fff9c fix-tbb-2021.patch
8f5abf58f4a1b84aee99c75bbaeb2267655f306b6a3e12600a4db34201106dd380c7e30e37d4db81841be8ba9455604a10bfaa6e50e73801097ce141840f3d8e x11vtkconflict.patch
"

View file

@ -0,0 +1,13 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1c6a41b..ff973e8 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -4,7 +4,7 @@ set (CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/adm/cmake")
set (CMAKE_SUPPRESS_REGENERATION TRUE)
-set (CMAKE_CONFIGURATION_TYPES Release Debug RelWithDebInfo CACHE INTERNAL "" FORCE)
+set (CMAKE_CONFIGURATION_TYPES Release Debug RelWithDebInfo None CACHE INTERNAL "" FORCE)
# macro: include patched file if it exists
macro (OCCT_INCLUDE_CMAKE_FILE BEING_INCLUDED_FILE)

View file

@ -0,0 +1,30 @@
Fixes:
> CMake Error at cmake_install.cmake:8340 (configure_file):
> configure_file Problem configuring file
First posted on Arch Linux
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 0b445de..1c6a41b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1122,7 +1122,7 @@ foreach (OCCT_CONFIGURATION ${CMAKE_CONFIGURATION_TYPES})
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 --git a/adm/cmake/occt_macros.cmake b/adm/cmake/occt_macros.cmake
index 8220ecd..d1ceea6 100644
--- a/adm/cmake/occt_macros.cmake
+++ b/adm/cmake/occt_macros.cmake
@@ -598,7 +598,7 @@ macro (OCCT_UPDATE_TARGET_FILE)
"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}\")

View file

@ -0,0 +1,45 @@
X-Git-Url: http://git.dev.opencascade.org/gitweb/?p=occt.git;a=blobdiff_plain;f=src%2FOSD%2FOSD_Parallel_TBB.cxx;h=0b9022b57630b98a47ed090eff8233c5d15148bb;hp=2344a6ca2df9c2d01c8a73579060c9cb44d3d789;hb=740833a6a88e481f474783c426b6f6311ed586d3;hpb=20095306111bc6e035c001e719231a894bdd6882
diff --git a/src/OSD/OSD_Parallel_TBB.cxx b/src/OSD/OSD_Parallel_TBB.cxx
index 2344a6ca2d..0b9022b576 100644
--- a/src/OSD/OSD_Parallel_TBB.cxx
+++ b/src/OSD/OSD_Parallel_TBB.cxx
@@ -25,7 +25,9 @@ Standard_DISABLE_DEPRECATION_WARNINGS
#include <tbb/parallel_for.h>
#include <tbb/parallel_for_each.h>
#include <tbb/blocked_range.h>
-#include <tbb/task_scheduler_init.h>
+#if TBB_VERSION_MAJOR < 2021
+ #include <tbb/task_scheduler_init.h>
+#endif
Standard_ENABLE_DEPRECATION_WARNINGS
//=======================================================================
@@ -38,12 +40,16 @@ void OSD_Parallel::forEachExternal (UniversalIterator& theBegin,
const FunctorInterface& theFunctor,
Standard_Integer theNbItems)
{
+#if TBB_VERSION_MAJOR >= 2021
+ // task_scheduler_init is removed,
+ // exceptions are captured without proxy tbb::captured_exception object
+ (void )theNbItems;
+ tbb::parallel_for_each (theBegin, theEnd, theFunctor);
+#else
try
{
const Handle(OSD_ThreadPool)& aThreadPool = OSD_ThreadPool::DefaultPool();
- const Standard_Integer aNbThreads = theNbItems > 0 ?
- aThreadPool->NbDefaultThreadsToLaunch() : -1;
-
+ const Standard_Integer aNbThreads = theNbItems > 0 ? aThreadPool->NbDefaultThreadsToLaunch() : -1;
tbb::task_scheduler_init aScheduler (aNbThreads);
tbb::parallel_for_each (theBegin, theEnd, theFunctor);
}
@@ -51,6 +57,7 @@ void OSD_Parallel::forEachExternal (UniversalIterator& theBegin,
{
throw Standard_ProgramError (anException.what());
}
+#endif
}
#endif /* HAVE_TBB */

View file

@ -0,0 +1,63 @@
--- ./src/Standard/Standard_StackTrace.cxx
+++ ./src/Standard/Standard_StackTrace.cxx
@@ -30,7 +30,6 @@
#elif defined(__QNX__)
//#include <backtrace.h> // requires linking to libbacktrace
#elif !defined(_WIN32) && !(defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE)
- #include <execinfo.h>
#elif defined(_WIN32) && !defined(OCCT_UWP)
#include <Standard_WarningsDisable.hxx>
@@ -314,51 +313,6 @@
return false;
#endif
#else
- const int aTopSkip = theNbTopSkip + 1; // skip this function call and specified extra number
- int aNbTraces = theNbTraces + aTopSkip;
- void** aStackArr = (void** )alloca (sizeof(void*) * aNbTraces);
- if (aStackArr == NULL)
- {
- return false;
- }
-
- aNbTraces = ::backtrace (aStackArr, aNbTraces);
- if (aNbTraces <= 1)
- {
- return false;
- }
-
- aNbTraces -= aTopSkip;
- char** aStrings = ::backtrace_symbols (aStackArr + aTopSkip, aNbTraces);
- if (aStrings == NULL)
- {
- return false;
- }
-
- const size_t aLenInit = strlen (theBuffer);
- size_t aLimit = (size_t) theBufferSize - aLenInit - 1;
- if (aLimit > 14)
- {
- strcat (theBuffer, "\n==Backtrace==");
- aLimit -= 14;
- }
- for (int aLineIter = 0; aLineIter < aNbTraces; ++aLineIter)
- {
- const size_t aLen = strlen (aStrings[aLineIter]);
- if (aLen + 1 >= aLimit)
- {
- break;
- }
-
- strcat (theBuffer, "\n");
- strcat (theBuffer, aStrings[aLineIter]);
- aLimit -= aLen + 1;
- }
- free (aStrings);
- if (aLimit > 14)
- {
- strcat (theBuffer, "\n=============");
- }
- return true;
+ return false;
#endif
}

View file

@ -0,0 +1,41 @@
musl does not provice feenableexcept and fedisableexcept. Those calls have
only been used on linux so far. This patch extends the #ifdef logic to only use
them on Linux if additionally glibc is used.
--- occt-V7_4_0-org/src/OSD/OSD_signal.cxx
+++ occt-V7_4_0/src/OSD/OSD_signal.cxx
@@ -678,7 +678,7 @@
// POSIX threads
#include <pthread.h>
-#ifdef __linux__
+#ifdef __linux__ && defined(__GLIBC__)
#include <cfenv>
//#include <fenv.h>
#endif
@@ -793,7 +793,7 @@
case SIGFPE:
sigaddset(&set, SIGFPE);
sigprocmask(SIG_UNBLOCK, &set, NULL) ;
-#ifdef __linux__
+#ifdef __linux__ && defined(__GLIBC__)
OSD::SetFloatingSignal (Standard_True);
#endif
#if (!defined (__sun)) && (!defined(SOLARIS))
@@ -914,7 +914,7 @@
//=======================================================================
void OSD::SetFloatingSignal (Standard_Boolean theFloatingSignal)
{
-#if defined (__linux__)
+#if defined (__linux__) && defined(__GLIBC__)
feclearexcept (FE_ALL_EXCEPT);
if (theFloatingSignal)
{
@@ -947,7 +947,7 @@
//=======================================================================
Standard_Boolean OSD::ToCatchFloatingSignals()
{
-#if defined (__linux__)
+#if defined (__linux__) && defined(__GLIBC__)
return (fegetexcept() & _OSD_FPX) != 0;
#else
return Standard_False;

View file

@ -0,0 +1,61 @@
--- ./src/OSD/OSD_MemInfo.cxx.old
+++ ./src/OSD/OSD_MemInfo.cxx
@@ -35,6 +35,9 @@
#include <sstream>
#include <fstream>
+#include <sys/time.h>
+#include <sys/resource.h>
+
#include <OSD_MemInfo.hxx>
#if defined(__EMSCRIPTEN__)
@@ -161,18 +164,22 @@
|| IsActive (MemWorkingSetPeak))
{
// /proc/%d/status is not emulated - get more info from mallinfo()
- const struct mallinfo aMI = mallinfo();
+ // mallinfo() not available with musl. We use getrusage to approximate it
+ // with the maximum resident set size
+ struct rusage ru = { .ru_maxrss = 0 };
+ getrusage(RUSAGE_SELF, &ru);
if (IsActive (MemHeapUsage))
{
- myCounters[MemHeapUsage] = aMI.uordblks;
+ myCounters[MemHeapUsage] = ru.ru_maxrss;
}
if (IsActive (MemWorkingSet))
{
- myCounters[MemWorkingSet] = aMI.uordblks;
+ myCounters[MemWorkingSet] = ru.ru_maxrss;
}
if (IsActive (MemWorkingSetPeak))
{
- myCounters[MemWorkingSetPeak] = aMI.usmblks;
+ //usmblks is always 0
+ myCounters[MemWorkingSetPeak] = 0;
}
}
if (IsActive (MemVirtual))
@@ -182,18 +189,9 @@
#elif (defined(__linux__) || defined(__linux))
if (IsActive (MemHeapUsage))
{
- #if defined(__GLIBC__) && defined(__GLIBC_PREREQ)
- #if __GLIBC_PREREQ(2,33)
- #define HAS_MALLINFO2
- #endif
- #endif
-
- #ifdef HAS_MALLINFO2
- const struct mallinfo2 aMI = mallinfo2();
- #else
- const struct mallinfo aMI = mallinfo();
- #endif
- myCounters[MemHeapUsage] = aMI.uordblks;
+ struct rusage ru = { .ru_maxrss = 0 };
+ getrusage(RUSAGE_SELF, &ru);
+ myCounters[MemHeapUsage] = ru.ru_maxrss;
}
if (!IsActive (MemVirtual)

View file

@ -0,0 +1,19 @@
--- ./src/IVtkDraw/IVtkDraw_Interactor.cxx.orig
+++ ./src/IVtkDraw/IVtkDraw_Interactor.cxx
@@ -27,6 +27,16 @@
#undef AllValues
#endif
+// Prevent naming collisions between X11
+// and VTK versions 9.2.0 and above.
+// X11 is included through glx
+#ifdef Status
+#undef Status
+#endif
+#ifdef Success
+#undef Success
+#endif
+
#include <vtkXRenderWindowInteractor.h>
#include <vtkXOpenGLRenderWindow.h>
#endif