1From acf752757ee4bf2913289ee1142f4968fdb22a4a Mon Sep 17 00:00:00 2001
2From: Peter Seiderer <ps.report@gmx.net>
3Date: Wed, 15 Sep 2021 23:05:52 +0200
4Subject: [PATCH] 3rdparty: mapbox-gl-native: fix musl compile
5 (pthread_getname_np)
6MIME-Version: 1.0
7Content-Type: text/plain; charset=UTF-8
8Content-Transfer-Encoding: 8bit
9
10- pthread_getname_np not available with musl libc (patch inspired/ported
11  from [1])
12
13Fixes:
14
15  platform/default/thread.cpp: In function ‘std::string mbgl::platform::getCurrentThreadName()’:
16  platform/default/thread.cpp:14:5: error: ‘pthread_getname_np’ was not declared in this scope; did you mean ‘pthread_setname_np’?
17     14 |     pthread_getname_np(pthread_self(), name, sizeof(name));
18        |     ^~~~~~~~~~~~~~~~~~
19        |     pthread_setname_np
20
21[1] https://github.com/void-linux/void-packages/blob/e64dd67f43c409d2b2db08214084e842d92ad620/srcpkgs/qt5/patches/0014-musl-set_thread_name_np.patch
22
23Signed-off-by: Peter Seiderer <ps.report@gmx.net>
24[yann.morin.1998@free.fr: add uClibc]
25Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
26---
27 src/3rdparty/mapbox-gl-native/platform/default/thread.cpp | 3 ++-
28 1 file changed, 2 insertions(+), 1 deletion(-)
29
30diff --git a/src/3rdparty/mapbox-gl-native/platform/default/thread.cpp b/src/3rdparty/mapbox-gl-native/platform/default/thread.cpp
31index c7c79b4..3f135eb 100644
32--- a/src/3rdparty/mapbox-gl-native/platform/default/thread.cpp
33+++ b/src/3rdparty/mapbox-gl-native/platform/default/thread.cpp
34@@ -11,8 +11,9 @@ namespace platform {
35
36 std::string getCurrentThreadName() {
37     char name[32] = "unknown";
38+#if defined(__GLIBC__) || defined(__UCLIBC__)
39     pthread_getname_np(pthread_self(), name, sizeof(name));
40-
41+#endif
42     return name;
43 }
44
45--
462.33.0
47
48