Gentoo Archives: gentoo-commits

From: Bernard Cafarelli <voyageur@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: x11-plugins/wmpinboard/, x11-plugins/wmpinboard/files/
Date: Tue, 14 Mar 2023 20:59:13
Message-Id: 1678827498.34c7d9e75fcc02ceb56c17f4da622e6d46ba3c6c.voyageur@gentoo
1 commit: 34c7d9e75fcc02ceb56c17f4da622e6d46ba3c6c
2 Author: Bernard Cafarelli <voyageur <AT> gentoo <DOT> org>
3 AuthorDate: Tue Mar 14 20:03:12 2023 +0000
4 Commit: Bernard Cafarelli <voyageur <AT> gentoo <DOT> org>
5 CommitDate: Tue Mar 14 20:58:18 2023 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=34c7d9e7
7
8 x11-plugins/wmpinboard: drop custom memcmp, causing issues with MUSL
9
10 Also update EAPI 6 -> 8
11
12 Closes: https://bugs.gentoo.org/715458
13 Closes: https://bugs.gentoo.org/899044
14 Signed-off-by: Bernard Cafarelli <voyageur <AT> gentoo.org>
15
16 .../wmpinboard/files/wmpinboard-1.0.1-memcmp.patch | 443 +++++++++++++++++++++
17 x11-plugins/wmpinboard/wmpinboard-1.0.1-r1.ebuild | 28 ++
18 2 files changed, 471 insertions(+)
19
20 diff --git a/x11-plugins/wmpinboard/files/wmpinboard-1.0.1-memcmp.patch b/x11-plugins/wmpinboard/files/wmpinboard-1.0.1-memcmp.patch
21 new file mode 100644
22 index 000000000000..616b4b8ddc59
23 --- /dev/null
24 +++ b/x11-plugins/wmpinboard/files/wmpinboard-1.0.1-memcmp.patch
25 @@ -0,0 +1,443 @@
26 +diff -Naur wmpinboard-1.0.1.orig/src/Makefile.am wmpinboard-1.0.1/src/Makefile.am
27 +--- wmpinboard-1.0.1.orig/src/Makefile.am 2015-05-25 02:30:37.000000000 +0200
28 ++++ wmpinboard-1.0.1/src/Makefile.am 2023-03-14 20:57:29.415810929 +0100
29 +@@ -5,7 +5,7 @@
30 +
31 + bin_PROGRAMS = wmpinboard
32 +
33 +-wmpinboard_SOURCES = memcmp.c \
34 ++wmpinboard_SOURCES = \
35 + misc.c misc.h \
36 + notes.c notes.h \
37 + wmpinboard.c wmpinboard.h \
38 +@@ -13,6 +13,5 @@
39 + wmpinboard_CFLAGS = -g
40 +
41 + EXTRA_wmpinboard_SOURCES = \
42 +- getopt.c getopt1.c getopt.h \
43 +- memcmp.c memcmp.h
44 ++ getopt.c getopt1.c getopt.h
45 +
46 +diff -Naur wmpinboard-1.0.1.orig/src/memcmp.c wmpinboard-1.0.1/src/memcmp.c
47 +--- wmpinboard-1.0.1.orig/src/memcmp.c 2015-05-25 02:30:37.000000000 +0200
48 ++++ wmpinboard-1.0.1/src/memcmp.c 1970-01-01 01:00:00.000000000 +0100
49 +@@ -1,394 +0,0 @@
50 +-/* Copyright (C) 1991, 1993, 1995, 1997, 1998 Free Software Foundation, Inc.
51 +- This file is part of the GNU C Library.
52 +- Contributed by Torbjorn Granlund (tege@××××.se).
53 +-
54 +- The GNU C Library is free software; you can redistribute it and/or
55 +- modify it under the terms of the GNU Library General Public License as
56 +- published by the Free Software Foundation; either version 2 of the
57 +- License, or (at your option) any later version.
58 +-
59 +- The GNU C Library is distributed in the hope that it will be useful,
60 +- but WITHOUT ANY WARRANTY; without even the implied warranty of
61 +- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
62 +- Library General Public License for more details.
63 +-
64 +- You should have received a copy of the GNU Library General Public
65 +- License along with the GNU C Library; see the file COPYING.LIB. If not,
66 +- write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
67 +- Boston, MA 02111-1307, USA. */
68 +-
69 +-#ifdef HAVE_CONFIG_H
70 +-# include <config.h>
71 +-#endif
72 +-
73 +-#undef __ptr_t
74 +-#if defined __cplusplus || (defined __STDC__ && __STDC__)
75 +-# define __ptr_t void *
76 +-#else /* Not C++ or ANSI C. */
77 +-# undef const
78 +-# define const
79 +-# define __ptr_t char *
80 +-#endif /* C++ or ANSI C. */
81 +-
82 +-#ifndef __P
83 +-# if defined __GNUC__ || (defined __STDC__ && __STDC__)
84 +-# define __P(args) args
85 +-# else
86 +-# define __P(args) ()
87 +-# endif /* GCC. */
88 +-#endif /* Not __P. */
89 +-
90 +-#if defined HAVE_STRING_H || defined _LIBC
91 +-# include <string.h>
92 +-#endif
93 +-
94 +-#undef memcmp
95 +-
96 +-#ifdef _LIBC
97 +-
98 +-# include <memcopy.h>
99 +-# include <endian.h>
100 +-
101 +-# if __BYTE_ORDER == __BIG_ENDIAN
102 +-# define WORDS_BIGENDIAN
103 +-# endif
104 +-
105 +-#else /* Not in the GNU C library. */
106 +-
107 +-# include <sys/types.h>
108 +-
109 +-/* Type to use for aligned memory operations.
110 +- This should normally be the biggest type supported by a single load
111 +- and store. Must be an unsigned type. */
112 +-# define op_t unsigned long int
113 +-# define OPSIZ (sizeof(op_t))
114 +-
115 +-/* Threshold value for when to enter the unrolled loops. */
116 +-# define OP_T_THRES 16
117 +-
118 +-/* Type to use for unaligned operations. */
119 +-typedef unsigned char byte;
120 +-
121 +-# ifndef WORDS_BIGENDIAN
122 +-# define MERGE(w0, sh_1, w1, sh_2) (((w0) >> (sh_1)) | ((w1) << (sh_2)))
123 +-# else
124 +-# define MERGE(w0, sh_1, w1, sh_2) (((w0) << (sh_1)) | ((w1) >> (sh_2)))
125 +-# endif
126 +-
127 +-#endif /* In the GNU C library. */
128 +-
129 +-#ifdef WORDS_BIGENDIAN
130 +-# define CMP_LT_OR_GT(a, b) ((a) > (b) ? 1 : -1)
131 +-#else
132 +-# define CMP_LT_OR_GT(a, b) memcmp_bytes ((a), (b))
133 +-#endif
134 +-
135 +-/* BE VERY CAREFUL IF YOU CHANGE THIS CODE! */
136 +-
137 +-/* The strategy of this memcmp is:
138 +-
139 +- 1. Compare bytes until one of the block pointers is aligned.
140 +-
141 +- 2. Compare using memcmp_common_alignment or
142 +- memcmp_not_common_alignment, regarding the alignment of the other
143 +- block after the initial byte operations. The maximum number of
144 +- full words (of type op_t) are compared in this way.
145 +-
146 +- 3. Compare the few remaining bytes. */
147 +-
148 +-#ifndef WORDS_BIGENDIAN
149 +-/* memcmp_bytes -- Compare A and B bytewise in the byte order of the machine.
150 +- A and B are known to be different.
151 +- This is needed only on little-endian machines. */
152 +-
153 +-static int memcmp_bytes __P((op_t, op_t));
154 +-
155 +-# ifdef __GNUC__
156 +-__inline
157 +-# endif
158 +-static int
159 +-memcmp_bytes (a, b)
160 +- op_t a, b;
161 +-{
162 +- long int srcp1 = (long int) &a;
163 +- long int srcp2 = (long int) &b;
164 +- op_t a0, b0;
165 +-
166 +- do
167 +- {
168 +- a0 = ((byte *) srcp1)[0];
169 +- b0 = ((byte *) srcp2)[0];
170 +- srcp1 += 1;
171 +- srcp2 += 1;
172 +- }
173 +- while (a0 == b0);
174 +- return a0 - b0;
175 +-}
176 +-#endif
177 +-
178 +-static int memcmp_common_alignment __P((long, long, size_t));
179 +-
180 +-/* memcmp_common_alignment -- Compare blocks at SRCP1 and SRCP2 with LEN `op_t'
181 +- objects (not LEN bytes!). Both SRCP1 and SRCP2 should be aligned for
182 +- memory operations on `op_t's. */
183 +-#ifdef __GNUC__
184 +-__inline
185 +-#endif
186 +-static int
187 +-memcmp_common_alignment (srcp1, srcp2, len)
188 +- long int srcp1;
189 +- long int srcp2;
190 +- size_t len;
191 +-{
192 +- op_t a0, a1;
193 +- op_t b0, b1;
194 +-
195 +- switch (len % 4)
196 +- {
197 +- default: /* Avoid warning about uninitialized local variables. */
198 +- case 2:
199 +- a0 = ((op_t *) srcp1)[0];
200 +- b0 = ((op_t *) srcp2)[0];
201 +- srcp1 -= 2 * OPSIZ;
202 +- srcp2 -= 2 * OPSIZ;
203 +- len += 2;
204 +- goto do1;
205 +- case 3:
206 +- a1 = ((op_t *) srcp1)[0];
207 +- b1 = ((op_t *) srcp2)[0];
208 +- srcp1 -= OPSIZ;
209 +- srcp2 -= OPSIZ;
210 +- len += 1;
211 +- goto do2;
212 +- case 0:
213 +- if (OP_T_THRES <= 3 * OPSIZ && len == 0)
214 +- return 0;
215 +- a0 = ((op_t *) srcp1)[0];
216 +- b0 = ((op_t *) srcp2)[0];
217 +- goto do3;
218 +- case 1:
219 +- a1 = ((op_t *) srcp1)[0];
220 +- b1 = ((op_t *) srcp2)[0];
221 +- srcp1 += OPSIZ;
222 +- srcp2 += OPSIZ;
223 +- len -= 1;
224 +- if (OP_T_THRES <= 3 * OPSIZ && len == 0)
225 +- goto do0;
226 +- /* Fall through. */
227 +- }
228 +-
229 +- do
230 +- {
231 +- a0 = ((op_t *) srcp1)[0];
232 +- b0 = ((op_t *) srcp2)[0];
233 +- if (a1 != b1)
234 +- return CMP_LT_OR_GT (a1, b1);
235 +-
236 +- do3:
237 +- a1 = ((op_t *) srcp1)[1];
238 +- b1 = ((op_t *) srcp2)[1];
239 +- if (a0 != b0)
240 +- return CMP_LT_OR_GT (a0, b0);
241 +-
242 +- do2:
243 +- a0 = ((op_t *) srcp1)[2];
244 +- b0 = ((op_t *) srcp2)[2];
245 +- if (a1 != b1)
246 +- return CMP_LT_OR_GT (a1, b1);
247 +-
248 +- do1:
249 +- a1 = ((op_t *) srcp1)[3];
250 +- b1 = ((op_t *) srcp2)[3];
251 +- if (a0 != b0)
252 +- return CMP_LT_OR_GT (a0, b0);
253 +-
254 +- srcp1 += 4 * OPSIZ;
255 +- srcp2 += 4 * OPSIZ;
256 +- len -= 4;
257 +- }
258 +- while (len != 0);
259 +-
260 +- /* This is the right position for do0. Please don't move
261 +- it into the loop. */
262 +- do0:
263 +- if (a1 != b1)
264 +- return CMP_LT_OR_GT (a1, b1);
265 +- return 0;
266 +-}
267 +-
268 +-static int memcmp_not_common_alignment __P((long, long, size_t));
269 +-
270 +-/* memcmp_not_common_alignment -- Compare blocks at SRCP1 and SRCP2 with LEN
271 +- `op_t' objects (not LEN bytes!). SRCP2 should be aligned for memory
272 +- operations on `op_t', but SRCP1 *should be unaligned*. */
273 +-#ifdef __GNUC__
274 +-__inline
275 +-#endif
276 +-static int
277 +-memcmp_not_common_alignment (srcp1, srcp2, len)
278 +- long int srcp1;
279 +- long int srcp2;
280 +- size_t len;
281 +-{
282 +- op_t a0, a1, a2, a3;
283 +- op_t b0, b1, b2, b3;
284 +- op_t x;
285 +- int shl, shr;
286 +-
287 +- /* Calculate how to shift a word read at the memory operation
288 +- aligned srcp1 to make it aligned for comparison. */
289 +-
290 +- shl = 8 * (srcp1 % OPSIZ);
291 +- shr = 8 * OPSIZ - shl;
292 +-
293 +- /* Make SRCP1 aligned by rounding it down to the beginning of the `op_t'
294 +- it points in the middle of. */
295 +- srcp1 &= -OPSIZ;
296 +-
297 +- switch (len % 4)
298 +- {
299 +- default: /* Avoid warning about uninitialized local variables. */
300 +- case 2:
301 +- a1 = ((op_t *) srcp1)[0];
302 +- a2 = ((op_t *) srcp1)[1];
303 +- b2 = ((op_t *) srcp2)[0];
304 +- srcp1 -= 1 * OPSIZ;
305 +- srcp2 -= 2 * OPSIZ;
306 +- len += 2;
307 +- goto do1;
308 +- case 3:
309 +- a0 = ((op_t *) srcp1)[0];
310 +- a1 = ((op_t *) srcp1)[1];
311 +- b1 = ((op_t *) srcp2)[0];
312 +- srcp2 -= 1 * OPSIZ;
313 +- len += 1;
314 +- goto do2;
315 +- case 0:
316 +- if (OP_T_THRES <= 3 * OPSIZ && len == 0)
317 +- return 0;
318 +- a3 = ((op_t *) srcp1)[0];
319 +- a0 = ((op_t *) srcp1)[1];
320 +- b0 = ((op_t *) srcp2)[0];
321 +- srcp1 += 1 * OPSIZ;
322 +- goto do3;
323 +- case 1:
324 +- a2 = ((op_t *) srcp1)[0];
325 +- a3 = ((op_t *) srcp1)[1];
326 +- b3 = ((op_t *) srcp2)[0];
327 +- srcp1 += 2 * OPSIZ;
328 +- srcp2 += 1 * OPSIZ;
329 +- len -= 1;
330 +- if (OP_T_THRES <= 3 * OPSIZ && len == 0)
331 +- goto do0;
332 +- /* Fall through. */
333 +- }
334 +-
335 +- do
336 +- {
337 +- a0 = ((op_t *) srcp1)[0];
338 +- b0 = ((op_t *) srcp2)[0];
339 +- x = MERGE(a2, shl, a3, shr);
340 +- if (x != b3)
341 +- return CMP_LT_OR_GT (x, b3);
342 +-
343 +- do3:
344 +- a1 = ((op_t *) srcp1)[1];
345 +- b1 = ((op_t *) srcp2)[1];
346 +- x = MERGE(a3, shl, a0, shr);
347 +- if (x != b0)
348 +- return CMP_LT_OR_GT (x, b0);
349 +-
350 +- do2:
351 +- a2 = ((op_t *) srcp1)[2];
352 +- b2 = ((op_t *) srcp2)[2];
353 +- x = MERGE(a0, shl, a1, shr);
354 +- if (x != b1)
355 +- return CMP_LT_OR_GT (x, b1);
356 +-
357 +- do1:
358 +- a3 = ((op_t *) srcp1)[3];
359 +- b3 = ((op_t *) srcp2)[3];
360 +- x = MERGE(a1, shl, a2, shr);
361 +- if (x != b2)
362 +- return CMP_LT_OR_GT (x, b2);
363 +-
364 +- srcp1 += 4 * OPSIZ;
365 +- srcp2 += 4 * OPSIZ;
366 +- len -= 4;
367 +- }
368 +- while (len != 0);
369 +-
370 +- /* This is the right position for do0. Please don't move
371 +- it into the loop. */
372 +- do0:
373 +- x = MERGE(a2, shl, a3, shr);
374 +- if (x != b3)
375 +- return CMP_LT_OR_GT (x, b3);
376 +- return 0;
377 +-}
378 +-
379 +-int
380 +-memcmp (s1, s2, len)
381 +- const __ptr_t s1;
382 +- const __ptr_t s2;
383 +- size_t len;
384 +-{
385 +- op_t a0;
386 +- op_t b0;
387 +- long int srcp1 = (long int) s1;
388 +- long int srcp2 = (long int) s2;
389 +- op_t res;
390 +-
391 +- if (len >= OP_T_THRES)
392 +- {
393 +- /* There are at least some bytes to compare. No need to test
394 +- for LEN == 0 in this alignment loop. */
395 +- while (srcp2 % OPSIZ != 0)
396 +- {
397 +- a0 = ((byte *) srcp1)[0];
398 +- b0 = ((byte *) srcp2)[0];
399 +- srcp1 += 1;
400 +- srcp2 += 1;
401 +- res = a0 - b0;
402 +- if (res != 0)
403 +- return res;
404 +- len -= 1;
405 +- }
406 +-
407 +- /* SRCP2 is now aligned for memory operations on `op_t'.
408 +- SRCP1 alignment determines if we can do a simple,
409 +- aligned compare or need to shuffle bits. */
410 +-
411 +- if (srcp1 % OPSIZ == 0)
412 +- res = memcmp_common_alignment (srcp1, srcp2, len / OPSIZ);
413 +- else
414 +- res = memcmp_not_common_alignment (srcp1, srcp2, len / OPSIZ);
415 +- if (res != 0)
416 +- return res;
417 +-
418 +- /* Number of bytes remaining in the interval [0..OPSIZ-1]. */
419 +- srcp1 += len & -OPSIZ;
420 +- srcp2 += len & -OPSIZ;
421 +- len %= OPSIZ;
422 +- }
423 +-
424 +- /* There are just a few bytes to compare. Use byte memory operations. */
425 +- while (len != 0)
426 +- {
427 +- a0 = ((byte *) srcp1)[0];
428 +- b0 = ((byte *) srcp2)[0];
429 +- srcp1 += 1;
430 +- srcp2 += 1;
431 +- res = a0 - b0;
432 +- if (res != 0)
433 +- return res;
434 +- len -= 1;
435 +- }
436 +-
437 +- return 0;
438 +-}
439 +-
440 +-#ifdef weak_alias
441 +-# undef bcmp
442 +-weak_alias (memcmp, bcmp)
443 +-#endif
444 +diff -Naur wmpinboard-1.0.1.orig/src/memcmp.h wmpinboard-1.0.1/src/memcmp.h
445 +--- wmpinboard-1.0.1.orig/src/memcmp.h 2015-05-25 02:30:37.000000000 +0200
446 ++++ wmpinboard-1.0.1/src/memcmp.h 1970-01-01 01:00:00.000000000 +0100
447 +@@ -1,8 +0,0 @@
448 +-#ifndef MEMCMP_H_INCLUDED
449 +-#define MEMCMP_H_INCLUDED
450 +-
451 +-extern int memcmp __P ((__const __ptr_t __s1, __const __ptr_t __s2,
452 +- size_t __n));
453 +-
454 +-#endif /* MEMCMP_H_INCLUDED */
455 +-
456 +diff -Naur wmpinboard-1.0.1.orig/src/notes.c wmpinboard-1.0.1/src/notes.c
457 +--- wmpinboard-1.0.1.orig/src/notes.c 2015-05-25 02:30:37.000000000 +0200
458 ++++ wmpinboard-1.0.1/src/notes.c 2023-03-14 20:58:50.523898242 +0100
459 +@@ -20,9 +20,6 @@
460 + #ifdef HAVE_STRING_H
461 + #include <string.h>
462 + #endif
463 +-#ifndef HAVE_MEMCMP
464 +-#include "memcmp.h"
465 +-#endif
466 +
467 + /* a list of the upper left corners of the separate areas of the alarm panel,
468 + numbered from left to right and from top to bottom (double digits followed
469
470 diff --git a/x11-plugins/wmpinboard/wmpinboard-1.0.1-r1.ebuild b/x11-plugins/wmpinboard/wmpinboard-1.0.1-r1.ebuild
471 new file mode 100644
472 index 000000000000..c7278245a254
473 --- /dev/null
474 +++ b/x11-plugins/wmpinboard/wmpinboard-1.0.1-r1.ebuild
475 @@ -0,0 +1,28 @@
476 +# Copyright 1999-2023 Gentoo Authors
477 +# Distributed under the terms of the GNU General Public License v2
478 +
479 +EAPI=8
480 +
481 +inherit autotools
482 +
483 +DESCRIPTION="Window Maker dock applet resembling a miniature pinboard"
484 +HOMEPAGE="https://github.com/bbidulock/wmpinboard"
485 +SRC_URI="https://github.com/bbidulock/${PN}/releases/download/${PV}/${P}.tar.gz"
486 +
487 +LICENSE="GPL-2"
488 +SLOT="0"
489 +KEYWORDS="~alpha ~amd64 ~ppc ~sparc ~x86"
490 +IUSE=""
491 +
492 +RDEPEND="x11-libs/libX11
493 + x11-libs/libXext
494 + x11-libs/libXpm"
495 +DEPEND="${RDEPEND}
496 + x11-base/xorg-proto"
497 +
498 +PATCHES=( "${FILESDIR}"/${P}-memcmp.patch )
499 +
500 +src_prepare() {
501 + default
502 + eautoreconf
503 +}