1
0
Fork 0
mirror of https://gitlab.alpinelinux.org/alpine/aports.git synced 2025-07-20 09:45:12 +03:00
aports/testing/blender/musl-fixes.patch
2020-01-02 11:23:29 +00:00

78 lines
2.9 KiB
Diff

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 0c2e4f8..5b7b747 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -185,6 +185,18 @@ if(UNIX AND NOT APPLE)
set(_init_OPENSUBDIV OFF)
set(_init_OPENVDB OFF)
set(_init_OPENIMAGEDENOISE OFF)
+ # musl-libc related checks (missing execinfo.h, and feenableexcept())
+ include(CheckIncludeFiles)
+ check_include_files(execinfo.h HAVE_EXECINFO_H)
+ if (HAVE_EXECINFO_H)
+ add_definitions(-DHAVE_EXECINFO_H)
+ endif()
+
+ include(CheckLibraryExists)
+ check_library_exists(m feenableexcept "fenv.h" HAVE_FEENABLEEXCEPT)
+ if (HAVE_FEENABLEEXCEPT)
+ add_definitions(-DHAVE_FEENABLEEXCEPT)
+ endif()
elseif(WIN32)
set(_init_JACK OFF)
elseif(APPLE)
diff --git a/intern/guardedalloc/intern/mallocn_intern.h b/intern/guardedalloc/intern/mallocn_intern.h
index e6e0907..6868a88 100644
--- a/intern/guardedalloc/intern/mallocn_intern.h
+++ b/intern/guardedalloc/intern/mallocn_intern.h
@@ -40,7 +40,8 @@
#undef HAVE_MALLOC_STATS
#define USE_MALLOC_USABLE_SIZE /* internal, when we have malloc_usable_size() */
-#if defined(__linux__) || (defined(__FreeBSD_kernel__) && !defined(__FreeBSD__)) || \
+#if (defined(__linux__) && defined(HAVE_EXECINFO_H)) \
+ || (defined(__FreeBSD_kernel__) && !defined(__FreeBSD__)) || \
defined(__GLIBC__)
# include <malloc.h>
# define HAVE_MALLOC_STATS
diff --git a/source/blender/blenlib/intern/system.c b/source/blender/blenlib/intern/system.c
index 941c2b6..2b710a4 100644
--- a/source/blender/blenlib/intern/system.c
+++ b/source/blender/blenlib/intern/system.c
@@ -38,7 +38,9 @@
# include <dbghelp.h>
# pragma warning(pop)
#else
-# include <execinfo.h>
+# if defined(HAVE_EXECINFO_H)
+# include <execinfo.h>
+# endif
# include <unistd.h>
#endif
diff --git a/source/creator/creator_signals.c b/source/creator/creator_signals.c
index e8c6e92..5b54ea9 100644
--- a/source/creator/creator_signals.c
+++ b/source/creator/creator_signals.c
@@ -329,7 +329,7 @@ void main_signal_setup_fpe(void)
* set breakpoints on sig_handle_fpe */
signal(SIGFPE, sig_handle_fpe);
-# if defined(__linux__) && defined(__GNUC__)
+# if defined(__linux__) && defined(__GNUC__) && defined(HAVE_FEENABLEEXCEPT)
feenableexcept(FE_DIVBYZERO | FE_INVALID | FE_OVERFLOW);
# endif /* defined(__linux__) && defined(__GNUC__) */
# if defined(OSX_SSE_FPE)
diff --git a/source/blender/blenlib/intern/system.c b/source/blender/blenlib/intern/system.c
index 2b710a4..0e2948c 100644
--- a/source/blender/blenlib/intern/system.c
+++ b/source/blender/blenlib/intern/system.c
@@ -83,7 +83,7 @@ void BLI_system_backtrace(FILE *fp)
{
/* ------------- */
/* Linux / Apple */
-#if defined(__linux__) || defined(__APPLE__)
+#if (defined(__linux__) && defined(HAVE_EXECINFO_H)) || defined(__APPLE__)
# define SIZE 100
void *buffer[SIZE];