commit:     2508a62f0eb80f2c60e8fa5a9c461c3431348778
Author:     Aric Belsito <lluixhi <AT> gmail <DOT> com>
AuthorDate: Wed Dec 13 00:50:10 2017 +0000
Commit:     Aric Belsito <lluixhi <AT> gmail <DOT> com>
CommitDate: Wed Dec 13 00:50:10 2017 +0000
URL:        https://gitweb.gentoo.org/proj/musl.git/commit/?id=2508a62f

media-libs/mesa: add more musl compat patches

 .../mesa/files/mesa-17-musl-invocation_name.patch  | 47 ++++++++++++++++
 media-libs/mesa/files/mesa-17-musl-pthread.patch   | 49 +++++++++++++++++
 media-libs/mesa/files/mesa-17-musl-string_h.patch  | 63 ++++++++++++++++++++++
 media-libs/mesa/mesa-17.3.0.ebuild                 |  5 +-
 4 files changed, 163 insertions(+), 1 deletion(-)

diff --git a/media-libs/mesa/files/mesa-17-musl-invocation_name.patch 
b/media-libs/mesa/files/mesa-17-musl-invocation_name.patch
new file mode 100644
index 0000000..80b02f5
--- /dev/null
+++ b/media-libs/mesa/files/mesa-17-musl-invocation_name.patch
@@ -0,0 +1,47 @@
+diff -Naur mesa-17.3.0.orig/src/gallium/auxiliary/os/os_process.c 
mesa-17.3.0/src/gallium/auxiliary/os/os_process.c
+--- mesa-17.3.0.orig/src/gallium/auxiliary/os/os_process.c     2017-12-08 
05:49:11.000000000 -0800
++++ mesa-17.3.0/src/gallium/auxiliary/os/os_process.c  2017-12-11 
14:24:35.200797607 -0800
+@@ -32,7 +32,7 @@
+ 
+ #if defined(PIPE_SUBSYSTEM_WINDOWS_USER)
+ #  include <windows.h>
+-#elif defined(__GLIBC__) || defined(__CYGWIN__)
++#elif defined(__linux__) || defined(__CYGWIN__)
+ #  include <errno.h>
+ #elif defined(PIPE_OS_BSD) || defined(PIPE_OS_APPLE) || 
defined(PIPE_OS_ANDROID)
+ #  include <stdlib.h>
+@@ -84,7 +84,7 @@
+ 
+       name = lpProcessName;
+ 
+-#elif defined(__GLIBC__) || defined(__CYGWIN__)
++#elif defined(__linux__) || defined(__CYGWIN__)
+       name = program_invocation_short_name;
+ #elif defined(PIPE_OS_BSD) || defined(PIPE_OS_APPLE) || 
defined(PIPE_OS_ANDROID)
+       /* *BSD and OS X */
+diff -Naur 
mesa-17.3.0.orig/src/gallium/winsys/virgl/vtest/virgl_vtest_socket.c 
mesa-17.3.0/src/gallium/winsys/virgl/vtest/virgl_vtest_socket.c
+--- mesa-17.3.0.orig/src/gallium/winsys/virgl/vtest/virgl_vtest_socket.c       
2017-12-08 05:49:11.000000000 -0800
++++ mesa-17.3.0/src/gallium/winsys/virgl/vtest/virgl_vtest_socket.c    
2017-12-11 14:23:35.312798680 -0800
+@@ -84,7 +84,7 @@
+    ret = os_get_process_name(cmdline, 63);
+    if (ret == FALSE)
+       strcpy(cmdline, nstr);
+-#if defined(__GLIBC__) || defined(__CYGWIN__)
++#if defined(__linux__) || defined(__CYGWIN__)
+    if (!strcmp(cmdline, "shader_runner")) {
+       const char *name;
+       /* hack to get better testname */
+diff -Naur mesa-17.3.0.orig/src/util/xmlconfig.c 
mesa-17.3.0/src/util/xmlconfig.c
+--- mesa-17.3.0.orig/src/util/xmlconfig.c      2017-12-08 05:49:11.000000000 
-0800
++++ mesa-17.3.0/src/util/xmlconfig.c   2017-12-11 14:22:54.052799419 -0800
+@@ -40,8 +40,8 @@
+ 
+ #undef GET_PROGRAM_NAME
+ 
+-#if (defined(__GNU_LIBRARY__) || defined(__GLIBC__)) && !defined(__UCLIBC__)
+-#    if !defined(__GLIBC__) || (__GLIBC__ < 2)
++#if defined(__linux__)
++#    if defined(__GLIBC__) && (__GLIBC__ < 2)
+ /* These aren't declared in any libc5 header */
+ extern char *program_invocation_name, *program_invocation_short_name;
+ #    endif

diff --git a/media-libs/mesa/files/mesa-17-musl-pthread.patch 
b/media-libs/mesa/files/mesa-17-musl-pthread.patch
new file mode 100644
index 0000000..a488b69
--- /dev/null
+++ b/media-libs/mesa/files/mesa-17-musl-pthread.patch
@@ -0,0 +1,49 @@
+diff -Naur mesa-17.3.0.orig/src/gallium/state_trackers/nine/nine_debug.c 
mesa-17.3.0/src/gallium/state_trackers/nine/nine_debug.c
+--- mesa-17.3.0.orig/src/gallium/state_trackers/nine/nine_debug.c      
2017-12-08 05:49:11.000000000 -0800
++++ mesa-17.3.0/src/gallium/state_trackers/nine/nine_debug.c   2017-12-11 
14:24:00.264798233 -0800
+@@ -73,11 +73,8 @@
+     }
+ 
+ #if defined(HAVE_PTHREAD)
+-#  if defined(__GNU_LIBRARY__) && defined(__GLIBC__) && 
defined(__GLIBC_MINOR__) && \
+-      (__GLIBC__ >= 3 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 12))
+     if (dbg_flags & DBG_TID)
+         tid = pthread_self();
+-#  endif
+ #endif
+ 
+     if (dbg_flags & flag) {
+diff -Naur mesa-17.3.0.orig/src/util/u_thread.h mesa-17.3.0/src/util/u_thread.h
+--- mesa-17.3.0.orig/src/util/u_thread.h       2017-12-08 05:49:11.000000000 
-0800
++++ mesa-17.3.0/src/util/u_thread.h    2017-12-11 14:19:54.898802627 -0800
+@@ -34,6 +34,7 @@
+ 
+ #ifdef HAVE_PTHREAD
+ #include <signal.h>
++#include <sys/prctl.h>
+ #endif
+ 
+ 
+@@ -61,10 +62,7 @@
+ static inline void u_thread_setname( const char *name )
+ {
+ #if defined(HAVE_PTHREAD)
+-#  if defined(__GNU_LIBRARY__) && defined(__GLIBC__) && 
defined(__GLIBC_MINOR__) && \
+-      (__GLIBC__ >= 3 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 12))
+-   pthread_setname_np(pthread_self(), name);
+-#  endif
++   prctl(PR_SET_NAME, name);
+ #endif
+    (void)name;
+ }
+@@ -92,10 +90,7 @@
+ static inline bool u_thread_is_self(thrd_t thread)
+ {
+ #if defined(HAVE_PTHREAD)
+-#  if defined(__GNU_LIBRARY__) && defined(__GLIBC__) && 
defined(__GLIBC_MINOR__) && \
+-      (__GLIBC__ >= 3 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 12))
+    return pthread_equal(pthread_self(), thread);
+-#  endif
+ #endif
+    return false;
+ }

diff --git a/media-libs/mesa/files/mesa-17-musl-string_h.patch 
b/media-libs/mesa/files/mesa-17-musl-string_h.patch
new file mode 100644
index 0000000..f3ec9e9
--- /dev/null
+++ b/media-libs/mesa/files/mesa-17-musl-string_h.patch
@@ -0,0 +1,63 @@
+diff -Naur mesa-17.3.0.orig/src/compiler/glsl/glcpp/glcpp-parse.c 
mesa-17.3.0/src/compiler/glsl/glcpp/glcpp-parse.c
+--- mesa-17.3.0.orig/src/compiler/glsl/glcpp/glcpp-parse.c     2017-12-08 
05:49:48.000000000 -0800
++++ mesa-17.3.0/src/compiler/glsl/glcpp/glcpp-parse.c  2017-12-11 
14:07:34.299815890 -0800
+@@ -1220,7 +1220,7 @@
+ #if YYERROR_VERBOSE
+ 
+ # ifndef yystrlen
+-#  if defined __GLIBC__ && defined _STRING_H
++#  if defined __linux__ && defined _STRING_H
+ #   define yystrlen strlen
+ #  else
+ /* Return the length of YYSTR.  */
+@@ -1236,7 +1236,7 @@
+ # endif
+ 
+ # ifndef yystpcpy
+-#  if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
++#  if defined __linux__ && defined _STRING_H && defined _GNU_SOURCE
+ #   define yystpcpy stpcpy
+ #  else
+ /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
+diff -Naur mesa-17.3.0.orig/src/compiler/glsl/glsl_parser.cpp 
mesa-17.3.0/src/compiler/glsl/glsl_parser.cpp
+--- mesa-17.3.0.orig/src/compiler/glsl/glsl_parser.cpp 2017-12-08 
05:49:49.000000000 -0800
++++ mesa-17.3.0/src/compiler/glsl/glsl_parser.cpp      2017-12-11 
14:07:04.530816423 -0800
+@@ -2815,7 +2815,7 @@
+ #if YYERROR_VERBOSE
+ 
+ # ifndef yystrlen
+-#  if defined __GLIBC__ && defined _STRING_H
++#  if defined __linux__ && defined _STRING_H
+ #   define yystrlen strlen
+ #  else
+ /* Return the length of YYSTR.  */
+@@ -2831,7 +2831,7 @@
+ # endif
+ 
+ # ifndef yystpcpy
+-#  if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
++#  if defined __linux__ && defined _STRING_H && defined _GNU_SOURCE
+ #   define yystpcpy stpcpy
+ #  else
+ /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
+diff -Naur mesa-17.3.0.orig/src/mesa/program/program_parse.tab.c 
mesa-17.3.0/src/mesa/program/program_parse.tab.c
+--- mesa-17.3.0.orig/src/mesa/program/program_parse.tab.c      2017-12-08 
05:49:53.000000000 -0800
++++ mesa-17.3.0/src/mesa/program/program_parse.tab.c   2017-12-11 
14:10:08.621813126 -0800
+@@ -1440,7 +1440,7 @@
+ #if YYERROR_VERBOSE
+ 
+ # ifndef yystrlen
+-#  if defined __GLIBC__ && defined _STRING_H
++#  if defined __linux__ && defined _STRING_H
+ #   define yystrlen strlen
+ #  else
+ /* Return the length of YYSTR.  */
+@@ -1456,7 +1456,7 @@
+ # endif
+ 
+ # ifndef yystpcpy
+-#  if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
++#  if defined __linux__ && defined _STRING_H && defined _GNU_SOURCE
+ #   define yystpcpy stpcpy
+ #  else
+ /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in

diff --git a/media-libs/mesa/mesa-17.3.0.ebuild 
b/media-libs/mesa/mesa-17.3.0.ebuild
index 49ae075..040450c 100644
--- a/media-libs/mesa/mesa-17.3.0.ebuild
+++ b/media-libs/mesa/mesa-17.3.0.ebuild
@@ -280,8 +280,11 @@ pkg_setup() {
 }
 
 src_prepare() {
-       eapply "${FILESDIR}"/${PN}-17-execinfo.patch
        eapply "${FILESDIR}"/${PN}-13-musl_endian.patch
+       eapply "${FILESDIR}"/${PN}-17-execinfo.patch
+       eapply "${FILESDIR}"/${PN}-17-musl-string_h.patch
+       eapply "${FILESDIR}"/${PN}-17-musl-invocation_name.patch
+       eapply "${FILESDIR}"/${PN}-17-musl-pthread.patch
 
        eautoreconf
 

Reply via email to