From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 29A6E158011 for ; Thu, 1 Sep 2022 02:06:34 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 5BB93E09E5; Thu, 1 Sep 2022 02:06:33 +0000 (UTC) Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 3AEB1E09E5 for ; Thu, 1 Sep 2022 02:06:33 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 348A7340D73 for ; Thu, 1 Sep 2022 02:06:32 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id AF6C65AF for ; Thu, 1 Sep 2022 02:06:30 +0000 (UTC) From: "Sam James" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Sam James" Message-ID: <1661997714.07f1954e0dd0fb941be3396f15257793f791b23a.sam@gentoo> Subject: [gentoo-commits] repo/gentoo:master commit in: media-gfx/blender/files/, media-gfx/blender/ X-VCS-Repository: repo/gentoo X-VCS-Files: media-gfx/blender/blender-3.2.2.ebuild media-gfx/blender/files/blender-3.2.2-musl-glibc-prereq.patch media-gfx/blender/files/blender-3.2.2-support-building-with-musl-libc.patch X-VCS-Directories: media-gfx/blender/files/ media-gfx/blender/ X-VCS-Committer: sam X-VCS-Committer-Name: Sam James X-VCS-Revision: 07f1954e0dd0fb941be3396f15257793f791b23a X-VCS-Branch: master Date: Thu, 1 Sep 2022 02:06:30 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 2654cdd5-55f8-4047-bdde-eaaa475d3040 X-Archives-Hash: 481eacd299f5a9999409e31059b661f1 commit: 07f1954e0dd0fb941be3396f15257793f791b23a Author: brahmajit das protonmail com> AuthorDate: Tue Aug 23 15:39:17 2022 +0000 Commit: Sam James gentoo org> CommitDate: Thu Sep 1 02:01:54 2022 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=07f1954e media-gfx/blender: Upstream musl libc fixes backport These are some of the patch that I submitted upstream and have been accepted. They will be a part of next blender release. However, this PR is a backport of those fixes for blender 3.2.2. Please refer: https://github.com/blender/blender/commit/f197b1a1f1bbc0334310fb1c911327246767a1a3, and https://github.com/blender/blender/commit/7be7280c5710f7831789cdde140d010722be9068 Closes: https://bugs.gentoo.org/739474 Signed-off-by: brahmajit das protonmail.com> Closes: https://github.com/gentoo/gentoo/pull/26860 Signed-off-by: Sam James gentoo.org> media-gfx/blender/blender-3.2.2.ebuild | 5 + .../files/blender-3.2.2-musl-glibc-prereq.patch | 27 ++++ ...der-3.2.2-support-building-with-musl-libc.patch | 177 +++++++++++++++++++++ 3 files changed, 209 insertions(+) diff --git a/media-gfx/blender/blender-3.2.2.ebuild b/media-gfx/blender/blender-3.2.2.ebuild index 8c82138b1e5a..70024e231bf6 100644 --- a/media-gfx/blender/blender-3.2.2.ebuild +++ b/media-gfx/blender/blender-3.2.2.ebuild @@ -123,6 +123,11 @@ BDEPEND=" nls? ( sys-devel/gettext ) " +PATCHES=( + "${FILESDIR}"/${PN}-3.2.2-support-building-with-musl-libc.patch + "${FILESDIR}"/${PN}-3.2.2-musl-glibc-prereq.patch +) + blender_check_requirements() { [[ ${MERGE_TYPE} != binary ]] && use openmp && tc-check-openmp diff --git a/media-gfx/blender/files/blender-3.2.2-musl-glibc-prereq.patch b/media-gfx/blender/files/blender-3.2.2-musl-glibc-prereq.patch new file mode 100644 index 000000000000..a572f25788de --- /dev/null +++ b/media-gfx/blender/files/blender-3.2.2-musl-glibc-prereq.patch @@ -0,0 +1,27 @@ +Fix build error in libc_compat when using musl libc + +Checking for the existence of and using __GLIBC_PREREQ can't be done in the +same conditional. + +Please refer: https://github.com/blender/blender/commit/7be7280c5710f7831789cdde140d010722be9068 +--- a/intern/libc_compat/libc_compat.c ++++ b/intern/libc_compat/libc_compat.c +@@ -13,7 +13,8 @@ + # include + # include + +-# if defined(__GLIBC_PREREQ) && __GLIBC_PREREQ(2, 31) ++# if defined(__GLIBC_PREREQ) ++# if __GLIBC_PREREQ(2, 31) + + double __exp_finite(double x); + double __exp2_finite(double x); +@@ -112,5 +113,6 @@ float __powf_finite(float x, float y) + return powf(x, y); + } + +-# endif /* __GLIBC_PREREQ */ +-#endif /* __linux__ */ ++# endif /* __GLIBC_PREREQ(2, 31) */ ++# endif /* __GLIBC_PREREQ */ ++#endif /* __linux__ */ diff --git a/media-gfx/blender/files/blender-3.2.2-support-building-with-musl-libc.patch b/media-gfx/blender/files/blender-3.2.2-support-building-with-musl-libc.patch new file mode 100644 index 000000000000..fb3f2584f0fe --- /dev/null +++ b/media-gfx/blender/files/blender-3.2.2-support-building-with-musl-libc.patch @@ -0,0 +1,177 @@ +CMake: support building with musl libc + +Instead of using macros like GLIBC we can use the CMake build +systems internal functions to check if some header or functions are +present on the running system's libc. + +Add ./build_files/cmake/have_features.cmake to add checks for +platform features which can be used to set defines for source +files that require them. + +Please refer: https://github.com/blender/blender/commit/f197b1a1f1bbc0334310fb1c911327246767a1a3 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -112,6 +112,11 @@ blender_project_hack_post() + + enable_testing() + ++#----------------------------------------------------------------------------- ++# Test compiler/library features. ++ ++include(build_files/cmake/have_features.cmake) ++ + #----------------------------------------------------------------------------- + # Redirect output files + +--- /dev/null ++++ b/build_files/cmake/have_features.cmake +@@ -0,0 +1,33 @@ ++# SPDX-License-Identifier: GPL-2.0-or-later ++# Copyright 2022 Blender Foundation. All rights reserved. ++ ++# This file is used to test the system for headers & symbols. ++# Variables should use the `HAVE_` prefix. ++# Defines should use the same name as the CMAKE variable. ++ ++include(CheckSymbolExists) ++ ++# Used for: `intern/guardedalloc/intern/mallocn_intern.h`. ++# Function `malloc_stats` is only available on GLIBC, ++# so check that before defining `HAVE_MALLOC_STATS`. ++check_symbol_exists(malloc_stats "malloc.h" HAVE_MALLOC_STATS_H) ++ ++# Used for: `source/creator/creator_signals.c`. ++# The function `feenableexcept` is not present non-GLIBC systems, ++# hence we need to check if it's available in the `fenv.h` file. ++set(HAVE_FEENABLEEXCEPT OFF) ++if(CMAKE_SYSTEM_NAME STREQUAL "Linux") ++ check_symbol_exists(feenableexcept "fenv.h" HAVE_FEENABLEEXCEPT) ++endif() ++ ++# Used for: `source/blender/blenlib/intern/system.c`. ++# `execinfo` is not available on non-GLIBC systems (at least not on MUSL-LIBC), ++# so check the presence of the header before including it and using the it for back-trace. ++set(HAVE_EXECINFO_H OFF) ++if(NOT MSVC) ++ include(CheckIncludeFiles) ++ check_include_files("execinfo.h" HAVE_EXECINFO_H) ++ if(HAVE_EXECINFO_H) ++ add_definitions(-DHAVE_EXECINFO_H) ++ endif() ++endif() +--- a/intern/guardedalloc/CMakeLists.txt ++++ b/intern/guardedalloc/CMakeLists.txt +@@ -1,6 +1,10 @@ + # SPDX-License-Identifier: GPL-2.0-or-later + # Copyright 2006 Blender Foundation. All rights reserved. + ++if(HAVE_MALLOC_STATS_H) ++ add_definitions(-DHAVE_MALLOC_STATS_H) ++endif() ++ + set(INC + . + ../atomic +--- a/intern/guardedalloc/intern/mallocn_intern.h ++++ b/intern/guardedalloc/intern/mallocn_intern.h +@@ -17,8 +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__)) || \ +- defined(__GLIBC__) ++#if defined(HAVE_MALLOC_STATS_H) + # include + # define HAVE_MALLOC_STATS + #elif defined(__FreeBSD__) +--- a/source/blender/blenlib/CMakeLists.txt ++++ b/source/blender/blenlib/CMakeLists.txt +@@ -1,6 +1,10 @@ + # SPDX-License-Identifier: GPL-2.0-or-later + # Copyright 2006 Blender Foundation. All rights reserved. + ++if(HAVE_EXECINFO_H) ++ add_definitions(-DHAVE_EXECINFO_H) ++endif() ++ + set(INC + . + # ../blenkernel # don't add this back! +--- a/source/blender/blenlib/intern/system.c ++++ b/source/blender/blenlib/intern/system.c +@@ -21,7 +21,9 @@ + + # include "BLI_winstuff.h" + #else +-# include ++# if defined(HAVE_EXECINFO_H) ++# include ++# endif + # include + #endif + +@@ -61,9 +63,9 @@ int BLI_cpu_support_sse2(void) + #if !defined(_MSC_VER) + void BLI_system_backtrace(FILE *fp) + { +- /* ------------- */ +- /* Linux / Apple */ +-# if defined(__linux__) || defined(__APPLE__) ++ /* ----------------------- */ ++ /* If system as execinfo.h */ ++# if defined(HAVE_EXECINFO_H) + + # define SIZE 100 + void *buffer[SIZE]; +--- a/source/blender/makesdna/intern/CMakeLists.txt ++++ b/source/blender/makesdna/intern/CMakeLists.txt +@@ -5,6 +5,11 @@ + + add_definitions(-DWITH_DNA_GHASH) + ++# Needed for `mallocn.c`. ++if(HAVE_MALLOC_STATS_H) ++ add_definitions(-DHAVE_MALLOC_STATS_H) ++endif() ++ + blender_include_dirs( + ../../../../intern/atomic + ../../../../intern/guardedalloc +--- a/source/blender/makesrna/intern/CMakeLists.txt ++++ b/source/blender/makesrna/intern/CMakeLists.txt +@@ -6,6 +6,11 @@ if(CMAKE_COMPILER_IS_GNUCC) + string(APPEND CMAKE_C_FLAGS " -Werror=implicit-function-declaration") + endif() + ++# Needed for `mallocn.c`. ++if(HAVE_MALLOC_STATS_H) ++ add_definitions(-DHAVE_MALLOC_STATS_H) ++endif() ++ + # files rna_access.c rna_define.c makesrna.c intentionally excluded. + set(DEFSRC + rna_ID.c +--- a/source/creator/CMakeLists.txt ++++ b/source/creator/CMakeLists.txt +@@ -22,6 +22,10 @@ set(LIB + bf_windowmanager + ) + ++if(HAVE_FEENABLEEXCEPT) ++ add_definitions(-DHAVE_FEENABLEEXCEPT) ++endif() ++ + if(WITH_TBB) + # Force TBB libraries to be in front of MKL (part of OpenImageDenoise), so + # that it is initialized before MKL and static library initialization order +--- a/source/creator/creator_signals.c ++++ b/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(HAVE_FEENABLEEXCEPT) + feenableexcept(FE_DIVBYZERO | FE_INVALID | FE_OVERFLOW); + # endif /* defined(__linux__) && defined(__GNUC__) */ + # if defined(OSX_SSE_FPE)