Gentoo Archives: gentoo-commits

From: Sergei Trofimovich <slyfox@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: sys-devel/m4/files/, sys-devel/m4/
Date: Sat, 13 Oct 2018 17:50:55
Message-Id: 1539453035.a31c6c21fb030d75256ff042e0352f90330545b2.slyfox@gentoo
1 commit: a31c6c21fb030d75256ff042e0352f90330545b2
2 Author: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
3 AuthorDate: Sat Oct 13 17:21:38 2018 +0000
4 Commit: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
5 CommitDate: Sat Oct 13 17:50:35 2018 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a31c6c21
7
8 sys-devel/m4: fix build against glibc-2.28, bug #663924
9
10 Patch by milan hodoscek.
11
12 While at it added 'epatch_user'.
13
14 Closes: https://bugs.gentoo.org/663924
15 Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>
16 Package-Manager: Portage-2.3.51, Repoman-2.3.11
17
18 sys-devel/m4/files/m4-1.4.18-glibc228.patch | 310 ++++++++++++++++++++++++++++
19 sys-devel/m4/m4-1.4.18.ebuild | 4 +-
20 2 files changed, 313 insertions(+), 1 deletion(-)
21
22 diff --git a/sys-devel/m4/files/m4-1.4.18-glibc228.patch b/sys-devel/m4/files/m4-1.4.18-glibc228.patch
23 new file mode 100644
24 index 00000000000..6b5593bfa63
25 --- /dev/null
26 +++ b/sys-devel/m4/files/m4-1.4.18-glibc228.patch
27 @@ -0,0 +1,310 @@
28 +Fix build failure on glibc-2.28:
29 + fseeko.c: In function 'rpl_fseeko':
30 + fseeko.c:110:4: error: #error "Please port gnulib fseeko.c to your platform! Look at the code in fseeko.c, then report this to bug-gnulib."
31 + #error "Please port gnulib fseeko.c to your platform! Look at the code in fseeko.c, then report this to bug-gnulib."
32 +
33 +Patch by milan hodoscek.
34 +
35 +https://bugs.gentoo.org/663924
36 +--- a/old/stdio-impl.h
37 ++++ b/lib/stdio-impl.h
38 +@@ -1,5 +1,5 @@
39 + /* Implementation details of FILE streams.
40 +- Copyright (C) 2007-2008, 2010-2016 Free Software Foundation, Inc.
41 ++ Copyright (C) 2007-2008, 2010-2018 Free Software Foundation, Inc.
42 +
43 + This program is free software: you can redistribute it and/or modify
44 + it under the terms of the GNU General Public License as published by
45 +@@ -12,12 +12,18 @@
46 + GNU General Public License for more details.
47 +
48 + You should have received a copy of the GNU General Public License
49 +- along with this program. If not, see <http://www.gnu.org/licenses/>. */
50 ++ along with this program. If not, see <https://www.gnu.org/licenses/>. */
51 +
52 + /* Many stdio implementations have the same logic and therefore can share
53 + the same implementation of stdio extension API, except that some fields
54 + have different naming conventions, or their access requires some casts. */
55 +
56 ++/* Glibc 2.28 made _IO_IN_BACKUP private. For now, work around this
57 ++ problem by defining it ourselves. FIXME: Do not rely on glibc
58 ++ internals. */
59 ++#if !defined _IO_IN_BACKUP && defined _IO_EOF_SEEN
60 ++# define _IO_IN_BACKUP 0x100
61 ++#endif
62 +
63 + /* BSD stdio derived implementations. */
64 +
65 +@@ -29,10 +35,10 @@
66 + #include <errno.h> /* For detecting Plan9. */
67 +
68 + #if defined __sferror || defined __DragonFly__ || defined __ANDROID__
69 +- /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Android */
70 ++ /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Minix 3, Android */
71 +
72 + # if defined __DragonFly__ /* DragonFly */
73 +- /* See <http://www.dragonflybsd.org/cvsweb/src/lib/libc/stdio/priv_stdio.h?rev=HEAD&content-type=text/x-cvsweb-markup>. */
74 ++ /* See <https://gitweb.dragonflybsd.org/dragonfly.git/blob_plain/HEAD:/lib/libc/stdio/priv_stdio.h>. */
75 + # define fp_ ((struct { struct __FILE_public pub; \
76 + struct { unsigned char *_base; int _size; } _bf; \
77 + void *cookie; \
78 +@@ -49,30 +55,84 @@
79 + fpos_t _offset; \
80 + /* More fields, not relevant here. */ \
81 + } *) fp)
82 +- /* See <http://www.dragonflybsd.org/cvsweb/src/include/stdio.h?rev=HEAD&content-type=text/x-cvsweb-markup>. */
83 ++ /* See <https://gitweb.dragonflybsd.org/dragonfly.git/blob_plain/HEAD:/include/stdio.h>. */
84 + # define _p pub._p
85 + # define _flags pub._flags
86 + # define _r pub._r
87 + # define _w pub._w
88 ++# elif defined __ANDROID__ /* Android */
89 ++ /* Up to this commit from 2015-10-12
90 ++ <https://android.googlesource.com/platform/bionic.git/+/f0141dfab10a4b332769d52fa76631a64741297a>
91 ++ the innards of FILE were public, and fp_ub could be defined like for OpenBSD,
92 ++ see <https://android.googlesource.com/platform/bionic.git/+/e78392637d5086384a5631ddfdfa8d7ec8326ee3/libc/stdio/fileext.h>
93 ++ and <https://android.googlesource.com/platform/bionic.git/+/e78392637d5086384a5631ddfdfa8d7ec8326ee3/libc/stdio/local.h>.
94 ++ After this commit, the innards of FILE are hidden. */
95 ++# define fp_ ((struct { unsigned char *_p; \
96 ++ int _r; \
97 ++ int _w; \
98 ++ int _flags; \
99 ++ int _file; \
100 ++ struct { unsigned char *_base; size_t _size; } _bf; \
101 ++ int _lbfsize; \
102 ++ void *_cookie; \
103 ++ void *_close; \
104 ++ void *_read; \
105 ++ void *_seek; \
106 ++ void *_write; \
107 ++ struct { unsigned char *_base; size_t _size; } _ext; \
108 ++ unsigned char *_up; \
109 ++ int _ur; \
110 ++ unsigned char _ubuf[3]; \
111 ++ unsigned char _nbuf[1]; \
112 ++ struct { unsigned char *_base; size_t _size; } _lb; \
113 ++ int _blksize; \
114 ++ fpos_t _offset; \
115 ++ /* More fields, not relevant here. */ \
116 ++ } *) fp)
117 + # else
118 + # define fp_ fp
119 + # endif
120 +
121 +-# if (defined __NetBSD__ && __NetBSD_Version__ >= 105270000) || defined __OpenBSD__ || defined __ANDROID__ /* NetBSD >= 1.5ZA, OpenBSD, Android */
122 ++# if (defined __NetBSD__ && __NetBSD_Version__ >= 105270000) || defined __OpenBSD__ || defined __minix /* NetBSD >= 1.5ZA, OpenBSD, Minix 3 */
123 + /* See <http://cvsweb.netbsd.org/bsdweb.cgi/src/lib/libc/stdio/fileext.h?rev=HEAD&content-type=text/x-cvsweb-markup>
124 +- and <http://www.openbsd.org/cgi-bin/cvsweb/src/lib/libc/stdio/fileext.h?rev=HEAD&content-type=text/x-cvsweb-markup> */
125 ++ and <https://cvsweb.openbsd.org/cgi-bin/cvsweb/src/lib/libc/stdio/fileext.h?rev=HEAD&content-type=text/x-cvsweb-markup>
126 ++ and <https://github.com/Stichting-MINIX-Research-Foundation/minix/blob/master/lib/libc/stdio/fileext.h> */
127 + struct __sfileext
128 + {
129 + struct __sbuf _ub; /* ungetc buffer */
130 + /* More fields, not relevant here. */
131 + };
132 + # define fp_ub ((struct __sfileext *) fp->_ext._base)->_ub
133 +-# else /* FreeBSD, NetBSD <= 1.5Z, DragonFly, Mac OS X, Cygwin, Android */
134 ++# elif defined __ANDROID__ /* Android */
135 ++ struct __sfileext
136 ++ {
137 ++ struct { unsigned char *_base; size_t _size; } _ub; /* ungetc buffer */
138 ++ /* More fields, not relevant here. */
139 ++ };
140 ++# define fp_ub ((struct __sfileext *) fp_->_ext._base)->_ub
141 ++# else /* FreeBSD, NetBSD <= 1.5Z, DragonFly, Mac OS X, Cygwin */
142 + # define fp_ub fp_->_ub
143 + # endif
144 +
145 + # define HASUB(fp) (fp_ub._base != NULL)
146 +
147 ++# if defined __ANDROID__ /* Android */
148 ++ /* Needed after this commit from 2016-01-25
149 ++ <https://android.googlesource.com/platform/bionic.git/+/e70e0e9267d069bf56a5078c99307e08a7280de7> */
150 ++# ifndef __SEOF
151 ++# define __SLBF 1
152 ++# define __SNBF 2
153 ++# define __SRD 4
154 ++# define __SWR 8
155 ++# define __SRW 0x10
156 ++# define __SEOF 0x20
157 ++# define __SERR 0x40
158 ++# endif
159 ++# ifndef __SOFF
160 ++# define __SOFF 0x1000
161 ++# endif
162 ++# endif
163 ++
164 + #endif
165 +
166 +
167 +@@ -81,7 +141,7 @@
168 + #ifdef __TANDEM /* NonStop Kernel */
169 + # ifndef _IOERR
170 + /* These values were determined by the program 'stdioext-flags' at
171 +- <http://lists.gnu.org/archive/html/bug-gnulib/2010-12/msg00165.html>. */
172 ++ <https://lists.gnu.org/r/bug-gnulib/2010-12/msg00165.html>. */
173 + # define _IOERR 0x40
174 + # define _IOREAD 0x80
175 + # define _IOWRT 0x4
176 +@@ -99,6 +159,8 @@
177 + int _file; \
178 + unsigned int _flag; \
179 + } *) fp)
180 ++# elif defined __VMS /* OpenVMS */
181 ++# define fp_ ((struct _iobuf *) fp)
182 + # else
183 + # define fp_ fp
184 + # endif
185 +@@ -110,7 +172,7 @@
186 + # define _flag __flag
187 + # endif
188 +
189 +-#elif (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ /* newer Windows with MSVC */
190 ++#elif defined _WIN32 && ! defined __CYGWIN__ /* newer Windows with MSVC */
191 +
192 + /* <stdio.h> does not define the innards of FILE any more. */
193 + # define WINDOWS_OPAQUE_FILE
194 +@@ -130,7 +192,7 @@ struct _gl_real_FILE
195 + # define fp_ ((struct _gl_real_FILE *) fp)
196 +
197 + /* These values were determined by a program similar to the one at
198 +- <http://lists.gnu.org/archive/html/bug-gnulib/2010-12/msg00165.html>. */
199 ++ <https://lists.gnu.org/r/bug-gnulib/2010-12/msg00165.html>. */
200 + # define _IOREAD 0x1
201 + # define _IOWRT 0x2
202 + # define _IORW 0x4
203 +--- a/old/fseeko.c
204 ++++ b/lib/fseeko.c
205 +@@ -1,5 +1,5 @@
206 + /* An fseeko() function that, together with fflush(), is POSIX compliant.
207 +- Copyright (C) 2007-2016 Free Software Foundation, Inc.
208 ++ Copyright (C) 2007-2018 Free Software Foundation, Inc.
209 +
210 + This program is free software; you can redistribute it and/or modify
211 + it under the terms of the GNU General Public License as published by
212 +@@ -12,7 +12,7 @@
213 + GNU General Public License for more details.
214 +
215 + You should have received a copy of the GNU General Public License along
216 +- with this program; if not, see <http://www.gnu.org/licenses/>. */
217 ++ with this program; if not, see <https://www.gnu.org/licenses/>. */
218 +
219 + #include <config.h>
220 +
221 +@@ -33,9 +33,9 @@ fseeko (FILE *fp, off_t offset, int whence)
222 + #endif
223 + #if _GL_WINDOWS_64_BIT_OFF_T
224 + # undef fseeko
225 +-# if HAVE__FSEEKI64 /* msvc, mingw64 */
226 ++# if HAVE__FSEEKI64 && HAVE_DECL__FSEEKI64 /* msvc, mingw since msvcrt8.0, mingw64 */
227 + # define fseeko _fseeki64
228 +-# else /* mingw */
229 ++# else /* mingw before msvcrt8.0 */
230 + # define fseeko fseeko64
231 + # endif
232 + #endif
233 +@@ -47,12 +47,13 @@ fseeko (FILE *fp, off_t offset, int whence)
234 + #endif
235 +
236 + /* These tests are based on fpurge.c. */
237 +-#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
238 ++#if defined _IO_EOF_SEEN || defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1
239 ++ /* GNU libc, BeOS, Haiku, Linux libc5 */
240 + if (fp->_IO_read_end == fp->_IO_read_ptr
241 + && fp->_IO_write_ptr == fp->_IO_write_base
242 + && fp->_IO_save_base == NULL)
243 + #elif defined __sferror || defined __DragonFly__ || defined __ANDROID__
244 +- /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Android */
245 ++ /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Minix 3, Android */
246 + # if defined __SL64 && defined __SCLE /* Cygwin */
247 + if ((fp->_flags & __SL64) == 0)
248 + {
249 +@@ -80,7 +81,7 @@ fseeko (FILE *fp, off_t offset, int whence)
250 + #elif defined __minix /* Minix */
251 + if (fp_->_ptr == fp_->_buf
252 + && (fp_->_ptr == NULL || fp_->_count == 0))
253 +-#elif defined _IOERR /* AIX, HP-UX, IRIX, OSF/1, Solaris, OpenServer, mingw, MSVC, NonStop Kernel */
254 ++#elif defined _IOERR /* AIX, HP-UX, IRIX, OSF/1, Solaris, OpenServer, mingw, MSVC, NonStop Kernel, OpenVMS */
255 + if (fp_->_ptr == fp_->_base
256 + && (fp_->_ptr == NULL || fp_->_cnt == 0))
257 + #elif defined __UCLIBC__ /* uClibc */
258 +@@ -117,18 +118,19 @@ fseeko (FILE *fp, off_t offset, int whence)
259 + if (pos == -1)
260 + {
261 + #if defined __sferror || defined __DragonFly__ || defined __ANDROID__
262 +- /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Android */
263 ++ /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Minix 3, Android */
264 + fp_->_flags &= ~__SOFF;
265 + #endif
266 + return -1;
267 + }
268 +
269 +-#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
270 ++#if defined _IO_EOF_SEEN || defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1
271 ++ /* GNU libc, BeOS, Haiku, Linux libc5 */
272 + fp->_flags &= ~_IO_EOF_SEEN;
273 + fp->_offset = pos;
274 + #elif defined __sferror || defined __DragonFly__ || defined __ANDROID__
275 +- /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Android */
276 +-# if defined __CYGWIN__ || (defined __NetBSD__ && __NetBSD_Version__ >= 600000000)
277 ++ /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Minix 3, Android */
278 ++# if defined __CYGWIN__ || (defined __NetBSD__ && __NetBSD_Version__ >= 600000000) || defined __minix
279 + /* fp_->_offset is typed as an integer. */
280 + fp_->_offset = pos;
281 + # else
282 +@@ -150,7 +152,7 @@ fseeko (FILE *fp, off_t offset, int whence)
283 + fp_->_flags &= ~__SEOF;
284 + #elif defined __EMX__ /* emx+gcc */
285 + fp->_flags &= ~_IOEOF;
286 +-#elif defined _IOERR /* AIX, HP-UX, IRIX, OSF/1, Solaris, OpenServer, mingw, MSVC, NonStop Kernel */
287 ++#elif defined _IOERR /* AIX, HP-UX, IRIX, OSF/1, Solaris, OpenServer, mingw, MSVC, NonStop Kernel, OpenVMS */
288 + fp_->_flag &= ~_IOEOF;
289 + #elif defined __MINT__ /* Atari FreeMiNT */
290 + fp->__offset = pos;
291 +--- a/old/freadahead.c
292 ++++ b/lib/freadahead.c
293 +@@ -1,5 +1,5 @@
294 + /* Retrieve information about a FILE stream.
295 +- Copyright (C) 2007-2016 Free Software Foundation, Inc.
296 ++ Copyright (C) 2007-2018 Free Software Foundation, Inc.
297 +
298 + This program is free software: you can redistribute it and/or modify
299 + it under the terms of the GNU General Public License as published by
300 +@@ -12,7 +12,7 @@
301 + GNU General Public License for more details.
302 +
303 + You should have received a copy of the GNU General Public License
304 +- along with this program. If not, see <http://www.gnu.org/licenses/>. */
305 ++ along with this program. If not, see <https://www.gnu.org/licenses/>. */
306 +
307 + #include <config.h>
308 +
309 +@@ -22,17 +22,26 @@
310 + #include <stdlib.h>
311 + #include "stdio-impl.h"
312 +
313 ++#if defined __DragonFly__
314 ++/* Defined in libc, but not declared in <stdio.h>. */
315 ++extern size_t __sreadahead (FILE *);
316 ++#endif
317 ++
318 ++/* This file is not used on systems that have the __freadahead function,
319 ++ namely musl libc. */
320 ++
321 + size_t
322 + freadahead (FILE *fp)
323 + {
324 +-#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
325 ++#if defined _IO_EOF_SEEN || defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1
326 ++ /* GNU libc, BeOS, Haiku, Linux libc5 */
327 + if (fp->_IO_write_ptr > fp->_IO_write_base)
328 + return 0;
329 + return (fp->_IO_read_end - fp->_IO_read_ptr)
330 + + (fp->_flags & _IO_IN_BACKUP ? fp->_IO_save_end - fp->_IO_save_base :
331 + 0);
332 + #elif defined __sferror || defined __DragonFly__ || defined __ANDROID__
333 +- /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Android */
334 ++ /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Minix 3, Android */
335 + if ((fp_->_flags & __SWR) != 0 || fp_->_r < 0)
336 + return 0;
337 + # if defined __DragonFly__
338
339 diff --git a/sys-devel/m4/m4-1.4.18.ebuild b/sys-devel/m4/m4-1.4.18.ebuild
340 index 9c667012353..378946733ca 100644
341 --- a/sys-devel/m4/m4-1.4.18.ebuild
342 +++ b/sys-devel/m4/m4-1.4.18.ebuild
343 @@ -1,4 +1,4 @@
344 -# Copyright 1999-2018 Gentoo Foundation
345 +# Copyright 1999-2018 Gentoo Authors
346 # Distributed under the terms of the GNU General Public License v2
347
348 EAPI="5"
349 @@ -20,6 +20,8 @@ RDEPEND=""
350
351 src_prepare() {
352 epatch "${FILESDIR}"/${P}-darwin17-printf-n.patch
353 + epatch "${FILESDIR}"/${P}-glibc228.patch #663924
354 + epatch_user
355 default
356 }