Gentoo Archives: gentoo-commits

From: Jory Pratt <anarchy@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/musl:master commit in: media-libs/mesa/files/, media-libs/mesa/
Date: Sun, 11 Aug 2019 22:46:54
Message-Id: 1565563599.72f1b5f8ad45bcc86fab7ca18d6f49a4aea4ee26.anarchy@gentoo
1 commit: 72f1b5f8ad45bcc86fab7ca18d6f49a4aea4ee26
2 Author: Jory Pratt <anarchy <AT> gentoo <DOT> org>
3 AuthorDate: Sun Aug 11 22:46:39 2019 +0000
4 Commit: Jory Pratt <anarchy <AT> gentoo <DOT> org>
5 CommitDate: Sun Aug 11 22:46:39 2019 +0000
6 URL: https://gitweb.gentoo.org/proj/musl.git/commit/?id=72f1b5f8
7
8 media-libs/mesa: use patch from upstream for musl support
9
10 Package-Manager: Portage-2.3.71, Repoman-2.3.17
11 Signed-off-by: Jory Pratt <anarchy <AT> gentoo.org>
12
13 .../mesa/files/mesa-19.1.4-musl-upstream-fix.patch | 227 +++++++++++++++++++++
14 media-libs/mesa/mesa-19.1.4.ebuild | 3 +-
15 2 files changed, 228 insertions(+), 2 deletions(-)
16
17 diff --git a/media-libs/mesa/files/mesa-19.1.4-musl-upstream-fix.patch b/media-libs/mesa/files/mesa-19.1.4-musl-upstream-fix.patch
18 new file mode 100644
19 index 0000000..5c02abd
20 --- /dev/null
21 +++ b/media-libs/mesa/files/mesa-19.1.4-musl-upstream-fix.patch
22 @@ -0,0 +1,227 @@
23 +From 9c411e020d164563fb6fcd92a28a435277bf0745 Mon Sep 17 00:00:00 2001
24 +From: Matt Turner <mattst88@×××××.com>
25 +Date: Wed, 24 Jul 2019 18:26:49 -0700
26 +Subject: [PATCH 1/5] util: Drop preprocessor guards for glibc-2.12
27 +
28 +glibc-2.12 was released in 2010. No one is building new Mesa against 9
29 +year old glibc, and removing these checks allows the code to work on
30 +other C libraries like musl.
31 +
32 +Acked-by: Eric Engestrom <eric.engestrom@×××××.com>
33 +---
34 + src/util/u_thread.h | 7 -------
35 + 1 file changed, 7 deletions(-)
36 +
37 +diff --git a/src/util/u_thread.h b/src/util/u_thread.h
38 +index a46c18d3db2..8c8cc803199 100644
39 +--- a/src/util/u_thread.h
40 ++++ b/src/util/u_thread.h
41 +@@ -61,11 +61,7 @@ static inline thrd_t u_thread_create(int (*routine)(void *), void *param)
42 + static inline void u_thread_setname( const char *name )
43 + {
44 + #if defined(HAVE_PTHREAD)
45 +-# if defined(__GNU_LIBRARY__) && defined(__GLIBC__) && defined(__GLIBC_MINOR__) && \
46 +- (__GLIBC__ >= 3 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 12)) && \
47 +- defined(__linux__)
48 + pthread_setname_np(pthread_self(), name);
49 +-# endif
50 + #endif
51 + (void)name;
52 + }
53 +@@ -150,10 +146,7 @@ u_thread_get_time_nano(thrd_t thread)
54 + static inline bool u_thread_is_self(thrd_t thread)
55 + {
56 + #if defined(HAVE_PTHREAD)
57 +-# if defined(__GNU_LIBRARY__) && defined(__GLIBC__) && defined(__GLIBC_MINOR__) && \
58 +- (__GLIBC__ >= 3 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 12))
59 + return pthread_equal(pthread_self(), thread);
60 +-# endif
61 + #endif
62 + return false;
63 + }
64 +--
65 +2.21.0
66 +
67 +
68 +From 9cc4311d86a797bba26448bcaf24db4887c6ec8d Mon Sep 17 00:00:00 2001
69 +From: Matt Turner <mattst88@×××××.com>
70 +Date: Wed, 24 Jul 2019 18:28:38 -0700
71 +Subject: [PATCH 2/5] st/nine: Drop preprocessor guards for glibc-2.12
72 +
73 +Same rationale as the previous patch, but additionally these checks just
74 +seem entirely unnecessary. pthread_self() has been used in Mesa since at
75 +least 1999.
76 +
77 +Acked-by: Eric Engestrom <eric.engestrom@×××××.com>
78 +---
79 + src/gallium/state_trackers/nine/nine_debug.c | 3 ---
80 + 1 file changed, 3 deletions(-)
81 +
82 +diff --git a/src/gallium/state_trackers/nine/nine_debug.c b/src/gallium/state_trackers/nine/nine_debug.c
83 +index 904a40fde83..784d535d213 100644
84 +--- a/src/gallium/state_trackers/nine/nine_debug.c
85 ++++ b/src/gallium/state_trackers/nine/nine_debug.c
86 +@@ -73,11 +73,8 @@ _nine_debug_printf( unsigned long flag,
87 + }
88 +
89 + #if defined(HAVE_PTHREAD)
90 +-# if defined(__GNU_LIBRARY__) && defined(__GLIBC__) && defined(__GLIBC_MINOR__) && \
91 +- (__GLIBC__ >= 3 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 12))
92 + if (dbg_flags & DBG_TID)
93 + tid = pthread_self();
94 +-# endif
95 + #endif
96 +
97 + if (dbg_flags & flag) {
98 +--
99 +2.21.0
100 +
101 +
102 +From c96407f37ef8325db11ae5fdb16e372cbc663bf4 Mon Sep 17 00:00:00 2001
103 +From: Matt Turner <mattst88@×××××.com>
104 +Date: Wed, 24 Jul 2019 18:44:35 -0700
105 +Subject: [PATCH 3/5] meson: Test for random_r()
106 +
107 +It's better to test for needed functions instead of using external
108 +knowledge about presence in this or that C library.
109 +
110 +Reviewed-by: Eric Engestrom <eric.engestrom@×××××.com>
111 +---
112 + meson.build | 2 +-
113 + src/glx/glxhash.c | 2 +-
114 + 2 files changed, 2 insertions(+), 2 deletions(-)
115 +
116 +diff --git a/meson.build b/meson.build
117 +index 542c35d525b..8dc431cfc5b 100644
118 +--- a/meson.build
119 ++++ b/meson.build
120 +@@ -1029,7 +1029,7 @@ foreach h : ['xlocale.h', 'sys/sysctl.h', 'linux/futex.h', 'endian.h', 'dlfcn.h'
121 + endif
122 + endforeach
123 +
124 +-foreach f : ['strtof', 'mkostemp', 'posix_memalign', 'timespec_get', 'memfd_create']
125 ++foreach f : ['strtof', 'mkostemp', 'posix_memalign', 'timespec_get', 'memfd_create', 'random_r']
126 + if cc.has_function(f)
127 + pre_args += '-DHAVE_@0@'.format(f.to_upper())
128 + endif
129 +diff --git a/src/glx/glxhash.c b/src/glx/glxhash.c
130 +index b76ec323459..5a89bf99b1c 100644
131 +--- a/src/glx/glxhash.c
132 ++++ b/src/glx/glxhash.c
133 +@@ -88,7 +88,7 @@
134 +
135 + #define HASH_ALLOC malloc
136 + #define HASH_FREE free
137 +-#ifndef __GLIBC__
138 ++#ifndef HAVE_RANDOM_R
139 + #define HASH_RANDOM_DECL char *ps, rs[256]
140 + #define HASH_RANDOM_INIT(seed) ps = initstate(seed, rs, sizeof(rs))
141 + #define HASH_RANDOM random()
142 +--
143 +2.21.0
144 +
145 +
146 +From 597bddad47e831474a33cde054c40bbd2cbc0600 Mon Sep 17 00:00:00 2001
147 +From: Matt Turner <mattst88@×××××.com>
148 +Date: Mon, 29 Jul 2019 15:31:34 -0700
149 +Subject: [PATCH 4/5] scons: Test for random_r()
150 +
151 +Suggested-by: Eric Engestrom <eric.engestrom@×××××.com>
152 +---
153 + scons/gallium.py | 3 +++
154 + 1 file changed, 3 insertions(+)
155 +
156 +diff --git a/scons/gallium.py b/scons/gallium.py
157 +index 27727612d14..6d5b2fccc17 100755
158 +--- a/scons/gallium.py
159 ++++ b/scons/gallium.py
160 +@@ -368,6 +368,9 @@ def generate(env):
161 + if check_functions(env, ['strtod_l', 'strtof_l']):
162 + cppdefines += ['HAVE_STRTOD_L']
163 +
164 ++ if check_functions(env, 'random_r'):
165 ++ cppdefines += ['HAVE_RANDOM_R']
166 ++
167 + if check_functions(env, ['timespec_get']):
168 + cppdefines += ['HAVE_TIMESPEC_GET']
169 +
170 +--
171 +2.21.0
172 +
173 +
174 +From c9b86cf52692f1d76314dce345080af8ce786792 Mon Sep 17 00:00:00 2001
175 +From: Matt Turner <mattst88@×××××.com>
176 +Date: Mon, 29 Jul 2019 13:51:55 -0700
177 +Subject: [PATCH 5/5] meson: Test for program_invocation_name
178 +
179 +program_invocation_name and program_invocation_short_name are both GNU
180 +extensions. I don't believe one can exist without the other, so only
181 +check for program_invocation_name.
182 +
183 +Reviewed-by: Eric Engestrom <eric.engestrom@×××××.com>
184 +---
185 + meson.build | 7 +++++++
186 + src/gallium/winsys/virgl/vtest/virgl_vtest_socket.c | 2 +-
187 + src/util/u_process.c | 8 ++------
188 + 3 files changed, 10 insertions(+), 7 deletions(-)
189 +
190 +diff --git a/meson.build b/meson.build
191 +index 8dc431cfc5b..c9f96e7135d 100644
192 +--- a/meson.build
193 ++++ b/meson.build
194 +@@ -1035,6 +1035,13 @@ foreach f : ['strtof', 'mkostemp', 'posix_memalign', 'timespec_get', 'memfd_crea
195 + endif
196 + endforeach
197 +
198 ++if cc.has_header_symbol('errno.h', 'program_invocation_name',
199 ++ args : '-D_GNU_SOURCE')
200 ++ pre_args += '-DHAVE_PROGRAM_INVOCATION_NAME'
201 ++elif with_tools.contains('intel')
202 ++ error('Intel tools require the program_invocation_name variable')
203 ++endif
204 ++
205 + # strtod locale support
206 + if cc.links('''
207 + #define _GNU_SOURCE
208 +diff --git a/src/gallium/winsys/virgl/vtest/virgl_vtest_socket.c b/src/gallium/winsys/virgl/vtest/virgl_vtest_socket.c
209 +index 58005df5595..42a58a6dcc1 100644
210 +--- a/src/gallium/winsys/virgl/vtest/virgl_vtest_socket.c
211 ++++ b/src/gallium/winsys/virgl/vtest/virgl_vtest_socket.c
212 +@@ -125,7 +125,7 @@ static int virgl_vtest_send_init(struct virgl_vtest_winsys *vws)
213 + ret = os_get_process_name(cmdline, 63);
214 + if (ret == FALSE)
215 + strcpy(cmdline, nstr);
216 +-#if defined(__GLIBC__) || defined(__CYGWIN__)
217 ++#if defined(HAVE_PROGRAM_INVOCATION_NAME)
218 + if (!strcmp(cmdline, "shader_runner")) {
219 + const char *name;
220 + /* hack to get better testname */
221 +diff --git a/src/util/u_process.c b/src/util/u_process.c
222 +index 94c975df396..cbccf48ed01 100644
223 +--- a/src/util/u_process.c
224 ++++ b/src/util/u_process.c
225 +@@ -32,11 +32,7 @@
226 +
227 + #undef GET_PROGRAM_NAME
228 +
229 +-#if (defined(__GNU_LIBRARY__) || defined(__GLIBC__)) && !defined(__UCLIBC__)
230 +-# if !defined(__GLIBC__) || (__GLIBC__ < 2)
231 +-/* These aren't declared in any libc5 header */
232 +-extern char *program_invocation_name, *program_invocation_short_name;
233 +-# endif
234 ++#if defined(__linux__) && defined(HAVE_PROGRAM_INVOCATION_NAME)
235 + static const char *
236 + __getProgramName()
237 + {
238 +@@ -79,7 +75,7 @@ __getProgramName()
239 + return program_invocation_name;
240 + }
241 + # define GET_PROGRAM_NAME() __getProgramName()
242 +-#elif defined(__CYGWIN__)
243 ++#elif defined(HAVE_PROGRAM_INVOCATION_NAME)
244 + # define GET_PROGRAM_NAME() program_invocation_short_name
245 + #elif defined(__FreeBSD__) && (__FreeBSD__ >= 2)
246 + # include <osreldate.h>
247 +--
248 +2.21.0
249 +
250
251 diff --git a/media-libs/mesa/mesa-19.1.4.ebuild b/media-libs/mesa/mesa-19.1.4.ebuild
252 index 5333c84..5ce4189 100644
253 --- a/media-libs/mesa/mesa-19.1.4.ebuild
254 +++ b/media-libs/mesa/mesa-19.1.4.ebuild
255 @@ -240,8 +240,7 @@ x86? (
256 )"
257
258 PATCHES=(
259 - "${FILESDIR}"/${PN}-18-musl-invocation_name.patch
260 - "${FILESDIR}"/${PN}-18-musl-pthread.patch
261 + "${FILESDIR}"/${PN}-19.1.4-musl-upstream-fix.patch
262 "${FILESDIR}"/${PN}-18.2.4-add-disable-tls-support.patch
263 )