From: "Guilherme Amadio" <amadio@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] repo/gentoo:master commit in: sci-physics/geant/files/, sci-physics/geant/
Date: Wed, 14 Sep 2022 14:55:39 +0000 (UTC) [thread overview]
Message-ID: <1663167292.144edbafdebe29ac1d2d3edede2385364d740ea6.amadio@gentoo> (raw)
commit: 144edbafdebe29ac1d2d3edede2385364d740ea6
Author: listout <listout <AT> protonmail <DOT> com>
AuthorDate: Tue Sep 13 10:20:17 2022 +0000
Commit: Guilherme Amadio <amadio <AT> gentoo <DOT> org>
CommitDate: Wed Sep 14 14:54:52 2022 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=144edbaf
sci-physics/geant: Fix building on musl, avoid execinfo.h
Avoid including execinfo.h and calling backtrace function on system that
don't provide the header.
Closes: https://bugs.gentoo.org/829151
Closes: https://github.com/gentoo/gentoo/pull/26313
Signed-off-by: brahmajit das <listout <AT> protonmail.com>
Signed-off-by: Guilherme Amadio <amadio <AT> gentoo.org>
.../files/geant-4.11.0.2-musl-avoid-execinfo.patch | 100 +++++++++++++++++++++
sci-physics/geant/geant-4.11.0.2-r1.ebuild | 4 +
2 files changed, 104 insertions(+)
diff --git a/sci-physics/geant/files/geant-4.11.0.2-musl-avoid-execinfo.patch b/sci-physics/geant/files/geant-4.11.0.2-musl-avoid-execinfo.patch
new file mode 100644
index 000000000000..e73a9c24c597
--- /dev/null
+++ b/sci-physics/geant/files/geant-4.11.0.2-musl-avoid-execinfo.patch
@@ -0,0 +1,100 @@
+# Avoid including execinfo and calling backtrace function when execinfo.h is
+# not present or supplied by system's libc
+#
+# Closes: https://bugs.gentoo.org/829151
+--- a/source/global/management/include/G4Backtrace.hh
++++ b/source/global/management/include/G4Backtrace.hh
+@@ -85,23 +85,6 @@
+ # endif
+ #endif
+
+-#if defined(G4UNIX) && !defined(WIN32)
+-# include <cxxabi.h>
+-# include <execinfo.h>
+-# include <unistd.h>
+-#endif
+-
+-#if defined(G4LINUX)
+-# include <features.h>
+-#endif
+-
+-#include <cfenv>
+-#include <csignal>
+-#include <type_traits>
+-
+-template <typename FuncT, typename... ArgTypes>
+-using G4ResultOf_t = std::invoke_result_t<FuncT, ArgTypes...>;
+-
+ // compatible OS and compiler
+ #if defined(G4UNIX) && \
+ (defined(__GNUC__) || defined(__clang__) || defined(_INTEL_COMPILER))
+@@ -109,7 +92,9 @@ using G4ResultOf_t = std::invoke_result_t<FuncT, ArgTypes...>;
+ # define G4SIGNAL_AVAILABLE
+ # endif
+ # if !defined(G4DEMANGLE_AVAILABLE)
+-# define G4DEMANGLE_AVAILABLE
++# if defined(G4UNIX) && defined(HAVE_EXECINFO_H)
++# define G4DEMANGLE_AVAILABLE
++# endif
+ # endif
+ #endif
+
+@@ -121,6 +106,25 @@ using G4ResultOf_t = std::invoke_result_t<FuncT, ArgTypes...>;
+ # endif
+ #endif
+
++#if defined(G4UNIX) && !defined(WIN32)
++# include <cxxabi.h>
++#if defined(HAVE_EXECINFO_H)
++# include <execinfo.h>
++#endif
++# include <unistd.h>
++#endif
++
++#if defined(G4LINUX)
++# include <features.h>
++#endif
++
++#include <cfenv>
++#include <csignal>
++#include <type_traits>
++
++template <typename FuncT, typename... ArgTypes>
++using G4ResultOf_t = std::invoke_result_t<FuncT, ArgTypes...>;
++
+ //----------------------------------------------------------------------------//
+
+ inline G4String G4Demangle(const char* _str)
+@@ -368,6 +372,7 @@ G4Backtrace::GetMangled(FuncT&& func)
+ std::array<type, Depth> btrace;
+ btrace.fill((std::is_pointer<type>::value) ? nullptr : type{});
+
++#if defined(G4DEMANGLE_AVAILABLE)
+ // plus one for this stack-frame
+ std::array<void*, Depth + Offset> buffer;
+ // size of returned buffer
+@@ -387,6 +392,7 @@ G4Backtrace::GetMangled(FuncT&& func)
+ btrace[i] = func(bsym[i]);
+ free(bsym);
+ }
++#endif
+ return btrace;
+ }
+
+--- a/source/global/management/sources.cmake
++++ b/source/global/management/sources.cmake
+@@ -6,6 +6,14 @@ set(G4MULTITHREADED ${GEANT4_BUILD_MULTITHREADED})
+ set(G4_STORE_TRAJECTORY ${GEANT4_BUILD_STORE_TRAJECTORY})
+ set(G4VERBOSE ${GEANT4_BUILD_VERBOSE_CODE})
+
++include(CheckIncludeFile)
++
++check_include_file(execinfo.h HAVE_EXECINFO_H)
++
++if(HAVE_SYS_TYPES_H)
++ list(APPEND CMAKE_REQUIRED_DEFINITIONS -DHAVE_EXECINFO_H)
++endif()
++
+ configure_file(${CMAKE_CURRENT_LIST_DIR}/include/G4GlobalConfig.hh.in
+ ${CMAKE_CURRENT_BINARY_DIR}/include/G4GlobalConfig.hh)
+
diff --git a/sci-physics/geant/geant-4.11.0.2-r1.ebuild b/sci-physics/geant/geant-4.11.0.2-r1.ebuild
index 1eaf3d9af34b..e43a735dfdc4 100644
--- a/sci-physics/geant/geant-4.11.0.2-r1.ebuild
+++ b/sci-physics/geant/geant-4.11.0.2-r1.ebuild
@@ -75,6 +75,10 @@ RDEPEND="
S="${WORKDIR}/${MY_P}"
+PATCHES=(
+ "${FILESDIR}"/${PN}-4.11.0.2-musl-avoid-execinfo.patch
+)
+
src_configure() {
local mycmakeargs=(
-DCMAKE_INSTALL_DATADIR="${EPREFIX}/usr/share/geant4"
next reply other threads:[~2022-09-14 14:55 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-14 14:55 Guilherme Amadio [this message]
-- strict thread matches above, loose matches on Subject: below --
2021-08-23 11:48 [gentoo-commits] repo/gentoo:master commit in: sci-physics/geant/files/, sci-physics/geant/ Guilherme Amadio
2021-01-20 10:16 David Seifert
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1663167292.144edbafdebe29ac1d2d3edede2385364d740ea6.amadio@gentoo \
--to=amadio@gentoo.org \
--cc=gentoo-commits@lists.gentoo.org \
--cc=gentoo-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox