commit:     5e2d9cb1e3a5ae5e530bef03d12b6b44d7a8c252
Author:     Violet Purcell <vimproved <AT> inventati <DOT> org>
AuthorDate: Tue Jul 11 20:24:57 2023 +0000
Commit:     Joonas Niilola <juippis <AT> gentoo <DOT> org>
CommitDate: Mon Jul 31 08:43:08 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=5e2d9cb1

sci-libs/opencascade: Fix build on musl

Signed-off-by: Violet Purcell <vimproved <AT> inventati.org>
Closes: https://github.com/gentoo/gentoo/pull/31496
Signed-off-by: Joonas Niilola <juippis <AT> gentoo.org>

 .../opencascade/files/opencascade-7.7.0-musl.patch | 97 ++++++++++++++++++++++
 ...7.6.3-r1.ebuild => opencascade-7.6.3-r2.ebuild} |  3 +-
 ...7.7.0-r1.ebuild => opencascade-7.7.0-r2.ebuild} |  1 +
 3 files changed, 100 insertions(+), 1 deletion(-)

diff --git a/sci-libs/opencascade/files/opencascade-7.7.0-musl.patch 
b/sci-libs/opencascade/files/opencascade-7.7.0-musl.patch
new file mode 100644
index 000000000000..45aeb449ac73
--- /dev/null
+++ b/sci-libs/opencascade/files/opencascade-7.7.0-musl.patch
@@ -0,0 +1,97 @@
+From 4351ac37b19bf43ff9a8f21e5126deb7f43f751e Mon Sep 17 00:00:00 2001
+From: Violet Purcell <vimpro...@inventati.org>
+Date: Tue, 11 Jul 2023 16:13:32 -0400
+Subject: [PATCH] Fix building with musl
+
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -554,6 +554,10 @@ OCCT_IS_PRODUCT_REQUIRED (CSF_EIGEN CAN_USE_EIGEN)
+ # define CSF variable
+ OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/occt_csf")
+ 
++# Check for execinfo.h
++include(CheckIncludeFile)
++CHECK_INCLUDE_FILE("execinfo.h" HAS_EXECINFO_H)
++
+ # Tcl (mandatory for Draw Harness)
+ if (USE_TCL)
+   message (STATUS "Info: TCL is used by OCCT")
+--- a/src/OSD/OSD_MemInfo.cxx
++++ b/src/OSD/OSD_MemInfo.cxx
+@@ -184,12 +184,16 @@ void OSD_MemInfo::Update()
+     #endif
+   #endif
+ 
++  #if defined(__GLIBC__)
+   #ifdef HAS_MALLINFO2
+     const struct mallinfo2 aMI = mallinfo2();
+   #else
+     const struct mallinfo aMI = mallinfo();
+   #endif
+     myCounters[MemHeapUsage] = aMI.uordblks;
++  #else
++    myCounters[MemHeapUsage] = 0;
++  #endif
+   }
+ 
+   if (!IsActive (MemVirtual)
+--- a/src/OSD/OSD_signal.cxx
++++ b/src/OSD/OSD_signal.cxx
+@@ -758,7 +758,7 @@ typedef void (* SIG_PFV) (int);
+ 
+ #include <signal.h>
+ 
+-#if !defined(__ANDROID__) && !defined(__QNX__) && !defined(__EMSCRIPTEN__)
++#if !defined(__ANDROID__) && !defined(__QNX__) && !defined(__EMSCRIPTEN__) && 
 defined(__GLIBC__)
+   #include <sys/signal.h>
+ #endif
+ 
+@@ -974,7 +974,7 @@ static void SegvHandler(const int theSignal,
+ //=======================================================================
+ void OSD::SetFloatingSignal (Standard_Boolean theFloatingSignal)
+ {
+-#if defined (__linux__)
++#if defined (__linux__) && defined(__GLIBC__)
+   feclearexcept (FE_ALL_EXCEPT);
+   if (theFloatingSignal)
+   {
+@@ -1007,7 +1007,7 @@ void OSD::SetFloatingSignal (Standard_Boolean 
theFloatingSignal)
+ //=======================================================================
+ Standard_Boolean OSD::ToCatchFloatingSignals()
+ {
+-#if defined (__linux__)
++#if defined (__linux__) && defined(__GLIBC__)
+   return (fegetexcept() & _OSD_FPX) != 0;
+ #else
+   return Standard_False;
+--- a/src/Standard/Standard_StackTrace.cxx
++++ b/src/Standard/Standard_StackTrace.cxx
+@@ -29,7 +29,7 @@
+   //#include <unwind.h>
+ #elif defined(__QNX__)
+   //#include <backtrace.h> // requires linking to libbacktrace
+-#elif !defined(_WIN32) && !(defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE)
++#elif defined (HAS_EXECINFO_H)
+   #include <execinfo.h>
+ #elif defined(_WIN32) && !defined(OCCT_UWP)
+ 
+@@ -313,7 +313,7 @@ Standard_Boolean Standard::StackTrace (char* theBuffer,
+   Message::SendTrace ("Standard::StackTrace() is not implemented for this CPU 
architecture");
+   return false;
+ #endif
+-#else
++#elif defined (HAS_EXECINFO_H)
+   const int aTopSkip = theNbTopSkip + 1; // skip this function call and 
specified extra number
+   int aNbTraces = theNbTraces + aTopSkip;
+   void** aStackArr = (void** )alloca (sizeof(void*) * aNbTraces);
+@@ -360,5 +360,7 @@ Standard_Boolean Standard::StackTrace (char* theBuffer,
+     strcat (theBuffer, "\n=============");
+   }
+   return true;
++#else
++  return false;
+ #endif
+ }
+-- 
+2.41.0
+

diff --git a/sci-libs/opencascade/opencascade-7.6.3-r1.ebuild 
b/sci-libs/opencascade/opencascade-7.6.3-r2.ebuild
similarity index 98%
rename from sci-libs/opencascade/opencascade-7.6.3-r1.ebuild
rename to sci-libs/opencascade/opencascade-7.6.3-r2.ebuild
index 82352ba3e3a2..0ea3c5736c42 100644
--- a/sci-libs/opencascade/opencascade-7.6.3-r1.ebuild
+++ b/sci-libs/opencascade/opencascade-7.6.3-r2.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2022 Gentoo Authors
+# Copyright 1999-2023 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=8
@@ -69,6 +69,7 @@ PATCHES=(
        "${FILESDIR}"/${PN}-7.6.2-avoid-pre-stripping-binaries.patch
        "${FILESDIR}"/${PN}-7.5.3-tbb-2021.patch
        "${FILESDIR}"/${PN}-7.7.0-build-against-vtk-9.2.patch
+       "${FILESDIR}"/${PN}-7.7.0-musl.patch
 )
 
 src_prepare() {

diff --git a/sci-libs/opencascade/opencascade-7.7.0-r1.ebuild 
b/sci-libs/opencascade/opencascade-7.7.0-r2.ebuild
similarity index 99%
rename from sci-libs/opencascade/opencascade-7.7.0-r1.ebuild
rename to sci-libs/opencascade/opencascade-7.7.0-r2.ebuild
index c22348558869..076a308ee9ba 100644
--- a/sci-libs/opencascade/opencascade-7.7.0-r1.ebuild
+++ b/sci-libs/opencascade/opencascade-7.7.0-r2.ebuild
@@ -64,6 +64,7 @@ PATCHES=(
        "${FILESDIR}"/${PN}-7.7.0-fix-installation-of-cmake-config-files.patch
        "${FILESDIR}"/${PN}-7.7.0-avoid-pre-stripping-binaries.patch
        "${FILESDIR}"/${PN}-7.7.0-build-against-vtk-9.2.patch
+       "${FILESDIR}"/${PN}-7.7.0-musl.patch
 )
 
 src_prepare() {

Reply via email to