summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbrahmajit das <listout@protonmail.com>2022-07-30 00:23:09 +0530
committerJoonas Niilola <juippis@gentoo.org>2022-08-17 19:17:56 +0300
commitb2812d756f23179a480f982ef877f3ff5b7e4116 (patch)
tree00a812ce436acd3c286f30fdc548af020aaafc9e /dev-libs
parentdev-lang/icon: shuffle dependencies on 9.5.22e to make them correct (diff)
downloadgentoo-b2812d756f23179a480f982ef877f3ff5b7e4116.tar.gz
gentoo-b2812d756f23179a480f982ef877f3ff5b7e4116.tar.bz2
gentoo-b2812d756f23179a480f982ef877f3ff5b7e4116.zip
dev-libs/sink: Musl fix build error, missing execinfo.h
On musl execinfo.h is not present, it results in build error for missing header file. Hence we are going check first for execinfo.h then include and use it for backtrace. Closes: https://bugs.gentoo.org/830945 Signed-off-by: brahmajit das <listout@protonmail.com> Closes: https://github.com/gentoo/gentoo/pull/26655 Signed-off-by: Joonas Niilola <juippis@gentoo.org>
Diffstat (limited to 'dev-libs')
-rw-r--r--dev-libs/sink/files/sink-0.8.0-musl-execinfo.patch48
-rw-r--r--dev-libs/sink/sink-0.8.0-r3.ebuild6
2 files changed, 53 insertions, 1 deletions
diff --git a/dev-libs/sink/files/sink-0.8.0-musl-execinfo.patch b/dev-libs/sink/files/sink-0.8.0-musl-execinfo.patch
new file mode 100644
index 000000000000..b5085702a33e
--- /dev/null
+++ b/dev-libs/sink/files/sink-0.8.0-musl-execinfo.patch
@@ -0,0 +1,48 @@
+# Since musl doesn't have execinfo. We're going to avoid including it and make
+# the printStacktrace function void
+# Closes: https://bugs.gentoo.org/830945
+--- a/synchronizer/CMakeLists.txt
++++ b/synchronizer/CMakeLists.txt
+@@ -2,6 +2,12 @@ project(sink_synchronizer)
+
+ include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR})
+
++INCLUDE(CheckIncludeFiles)
++CHECK_INCLUDE_FILES("execinfo.h" HAVE_EXECINFO)
++IF (HAVE_EXECINFO)
++ add_compile_definitions(HAVE_EXECINFO_H)
++ENDIF(HAVE_EXECINFO)
++
+ set(sinksynchronizer_SRCS
+ main.cpp
+ backtrace.cpp
+--- a/synchronizer/backtrace.cpp
++++ b/synchronizer/backtrace.cpp
+@@ -31,7 +31,9 @@
+ #include <chrono>
+
+ #ifndef Q_OS_WIN
++#ifdef HAVE_EXECINFO_H
+ #include <execinfo.h>
++#endif // HAVE_EXECINFO_H
+ #include <unistd.h>
+ #include <cxxabi.h>
+ #include <dlfcn.h>
+@@ -143,7 +145,7 @@ private:
+ //Print a demangled stacktrace
+ static void printStacktrace()
+ {
+-#ifndef Q_OS_WIN
++#if !defined(Q_OS_WIN) && defined(HAVE_EXECINFO_H)
+ int skip = 1;
+ void *callstack[128];
+ const int nMaxFrames = sizeof(callstack) / sizeof(callstack[0]);
+@@ -178,7 +180,7 @@ static void printStacktrace()
+ trace_buf << "[truncated]\n";
+ }
+ std::cerr << trace_buf.str();
+-#else
++#elif defined(Q_OS_WIN)
+ enum { maxStackFrames = 100 };
+ DebugSymbolResolver resolver(GetCurrentProcess());
+ if (resolver.isValid()) {
diff --git a/dev-libs/sink/sink-0.8.0-r3.ebuild b/dev-libs/sink/sink-0.8.0-r3.ebuild
index 78d2b574ac2b..c8108f329bf4 100644
--- a/dev-libs/sink/sink-0.8.0-r3.ebuild
+++ b/dev-libs/sink/sink-0.8.0-r3.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2021 Gentoo Authors
+# Copyright 1999-2022 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=7
@@ -42,6 +42,10 @@ DEPEND="${RDEPEND}
# fails to build
RESTRICT+=" test"
+PATCHES=(
+ "${FILESDIR}"/${PN}-0.8.0-musl-execinfo.patch
+)
+
src_prepare() {
cmake_src_prepare
# tests are sprinkled all over the place, and examples are needed...