void-packages/srcpkgs/blender/patches/musl.patch

91 lines
3.2 KiB
Diff

diff -ru blender-2.82.org/CMakeLists.txt blender-2.82/CMakeLists.txt
--- blender-2.82.org/CMakeLists.txt 2020-02-13 01:42:10.000000000 -0800
+++ blender-2.82/CMakeLists.txt 2020-02-28 03:28:50.491903370 -0800
@@ -848,6 +848,19 @@
endif()
endif()
+# 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()
+
# See TEST_SSE_SUPPORT() for how this is defined.
# Do it globally, SSE2 is required for quite some time now.
diff -ru blender-2.78.orig/source/blender/blenlib/intern/system.c blender-2.78a/source/blender/blenlib/intern/system.c
--- blender-2.78.orig/source/blender/blenlib/intern/system.c 2016-10-25 09:59:23.000000000 +0000
+++ blender-2.78a/source/blender/blenlib/intern/system.c 2017-02-07 14:44:35.213040733 +0000
@@ -77,7 +77,7 @@
{
/* ------------- */
/* Linux / Apple */
-#if defined(__linux__) || defined(__APPLE__)
+#if (defined(__linux__) && defined(HAVE_EXECINFO_H)) || defined(__APPLE__)
#define SIZE 100
void *buffer[SIZE];
diff -ru blender-2.78.orig/source/creator/creator_signals.c blender-2.78a/source/creator/creator_signals.c
--- blender-2.78.orig/source/creator/creator_signals.c 2016-10-24 14:13:56.000000000 +0000
+++ blender-2.78a/source/creator/creator_signals.c 2017-02-07 14:47:01.888625973 +0000
@@ -309,7 +309,7 @@
* 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)
--- a/source/blender/blenlib/intern/system.c 2019-07-30 21:05:30.702224608 +0200
+++ - 2019-07-30 21:13:21.535328709 +0200
@@ -38,10 +38,13 @@
# include <dbghelp.h>
# pragma warning(pop)
#else
-# include <execinfo.h>
# include <unistd.h>
#endif
+#if (defined(__linux__) && defined(HAVE_EXECINFO_H)) || defined(__APPLE__)
+# include <execinfo.h>
+#endif
+
int BLI_cpu_support_sse2(void)
{
#if defined(__x86_64__) || defined(_M_X64)
--- a/intern/guardedalloc/intern/mallocn_intern.h 2019-07-24 09:41:39.000000000 +0200
+++ - 2019-10-20 00:03:13.450031866 +0200
@@ -40,7 +40,7 @@
#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(__FreeBSD_kernel__) && !defined(__FreeBSD__)) || \
defined(__GLIBC__)
# include <malloc.h>
# define HAVE_MALLOC_STATS
--- a/intern/libc_compat/libc_compat.c
+++ b/intern/libc_compat/libc_compat.c
@@ -21,10 +21,10 @@
* incompatible with the system libraries that Blender is built on. To solve
* this we add a few -ffast-math symbols that can be missing. */
-#ifdef __linux__
# include <features.h>
# include <math.h>
+#ifdef __GLIBC__
# if defined(__GLIBC_PREREQ) && __GLIBC_PREREQ(2, 31)
double __exp_finite(double x);