Imported from https://git.alpinelinux.org/aports/plain/testing/blender/0001-musl-fixes.patch?id=42cee48643cb6ccc1a110e66446aa74408ee0160 adapted to not use __MUSL__ definition From e530dc5b32695c208aa46bfe460ac7d76159a6d3 Mon Sep 17 00:00:00 2001 From: Leon Marz Date: Wed, 25 Nov 2020 10:10:41 +0100 Subject: [PATCH 1/3] musl fixes Original patch by Nathanael Copa --- intern/guardedalloc/intern/mallocn_intern.h | 2 +- intern/libc_compat/libc_compat.c | 2 -- source/blender/blenlib/intern/system.c | 4 +++- source/blender/gpu/GPU_vertex_buffer.h | 1 - source/creator/creator_signals.c | 2 +- 5 files changed, 5 insertions(+), 6 deletions(-) Index: blender-3.3.0/intern/guardedalloc/intern/mallocn_intern.h =================================================================== --- blender-3.3.0.orig/intern/guardedalloc/intern/mallocn_intern.h +++ blender-3.3.0/intern/guardedalloc/intern/mallocn_intern.h @@ -17,7 +17,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 # define HAVE_MALLOC_STATS Index: blender-3.3.0/intern/libc_compat/libc_compat.c =================================================================== --- blender-3.3.0.orig/intern/libc_compat/libc_compat.c +++ blender-3.3.0/intern/libc_compat/libc_compat.c @@ -13,8 +13,6 @@ # include # include -# if defined(__GLIBC_PREREQ) -# if __GLIBC_PREREQ(2, 31) double __exp_finite(double x); double __exp2_finite(double x); @@ -113,6 +111,4 @@ float __powf_finite(float x, float y) return powf(x, y); } -# endif /* __GLIBC_PREREQ(2, 31) */ -# endif /* __GLIBC_PREREQ */ #endif /* __linux__ */ Index: blender-3.3.0/source/blender/blenlib/intern/system.c =================================================================== --- blender-3.3.0.orig/source/blender/blenlib/intern/system.c +++ blender-3.3.0/source/blender/blenlib/intern/system.c @@ -21,7 +21,9 @@ # include "BLI_winstuff.h" #else +#if defined(__GLIBC__) # include +#endif # include #endif @@ -63,7 +65,7 @@ void BLI_system_backtrace(FILE *fp) { /* ------------- */ /* Linux / Apple */ -# if defined(__linux__) || defined(__APPLE__) +# if defined(__linux__) && defined(__GLIBC__) || defined(__APPLE__) # define SIZE 100 void *buffer[SIZE]; Index: blender-3.3.0/source/blender/gpu/GPU_vertex_buffer.h =================================================================== --- blender-3.3.0.orig/source/blender/gpu/GPU_vertex_buffer.h +++ blender-3.3.0/source/blender/gpu/GPU_vertex_buffer.h @@ -133,7 +133,6 @@ GPU_INLINE void *GPU_vertbuf_raw_step(GP { unsigned char *data = a->data; a->data += a->stride; - BLI_assert(data < a->_data_end); return (void *)data; } Index: blender-3.3.0/source/creator/creator_signals.c =================================================================== --- blender-3.3.0.orig/source/creator/creator_signals.c +++ blender-3.3.0/source/creator/creator_signals.c @@ -258,7 +258,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(__GLIBC__) feenableexcept(FE_DIVBYZERO | FE_INVALID | FE_OVERFLOW); # endif /* defined(__linux__) && defined(__GNUC__) */ # if defined(OSX_SSE_FPE)