Gentoo Archives: gentoo-commits

From: Sam James <sam@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: app-shells/zsh/files/, app-shells/zsh/
Date: Mon, 12 Sep 2022 20:08:40
Message-Id: 1663013293.892dc0afaf0436e59259fec155f76ba4af9b6b06.sam@gentoo
1 commit: 892dc0afaf0436e59259fec155f76ba4af9b6b06
2 Author: Sam James <sam <AT> gentoo <DOT> org>
3 AuthorDate: Mon Sep 12 20:07:51 2022 +0000
4 Commit: Sam James <sam <AT> gentoo <DOT> org>
5 CommitDate: Mon Sep 12 20:08:13 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=892dc0af
7
8 app-shells/zsh: fix configure tests with Clang 15
9
10 Note that in some cases, this may have caused either some
11 files to not be installed, or hangs at runtime.
12
13 Closes: https://bugs.gentoo.org/869539
14 Thanks-to: Nicholas Vinson <nvinson234 <AT> gmail.com>
15 Signed-off-by: Sam James <sam <AT> gentoo.org>
16
17 .../zsh/files/zsh-5.9-clang-15-configure.patch | 549 +++++++++++++++++++++
18 app-shells/zsh/zsh-5.9-r1.ebuild | 235 +++++++++
19 2 files changed, 784 insertions(+)
20
21 diff --git a/app-shells/zsh/files/zsh-5.9-clang-15-configure.patch b/app-shells/zsh/files/zsh-5.9-clang-15-configure.patch
22 new file mode 100644
23 index 000000000000..8a77e365c700
24 --- /dev/null
25 +++ b/app-shells/zsh/files/zsh-5.9-clang-15-configure.patch
26 @@ -0,0 +1,549 @@
27 +https://bugs.gentoo.org/869539
28 +--- a/configure.ac
29 ++++ b/configure.ac
30 +@@ -583,11 +583,11 @@ if test x$zsh_cv_c_have_union_init = xye
31 + fi
32 +
33 + dnl Checking if compiler correctly cast signed to unsigned.
34 + AC_CACHE_CHECK(if signed to unsigned casting is broken,
35 + zsh_cv_c_broken_signed_to_unsigned_casting,
36 +-[AC_RUN_IFELSE([AC_LANG_SOURCE([[main(){return((int)(unsigned char)((char) -1) == 255);}]])],[zsh_cv_c_broken_signed_to_unsigned_casting=yes],[zsh_cv_c_broken_signed_to_unsigned_casting=no],[zsh_cv_c_broken_signed_to_unsigned_casting=no])])
37 ++[AC_RUN_IFELSE([AC_LANG_SOURCE([[int main(){return((int)(unsigned char)((char) -1) == 255);}]])],[zsh_cv_c_broken_signed_to_unsigned_casting=yes],[zsh_cv_c_broken_signed_to_unsigned_casting=no],[zsh_cv_c_broken_signed_to_unsigned_casting=no])])
38 + AH_TEMPLATE([BROKEN_SIGNED_TO_UNSIGNED_CASTING],
39 + [Define to 1 if compiler incorrectly cast signed to unsigned.])
40 + if test x$zsh_cv_c_broken_signed_to_unsigned_casting = xyes; then
41 + AC_DEFINE(BROKEN_SIGNED_TO_UNSIGNED_CASTING)
42 + fi
43 +@@ -1044,21 +1044,21 @@ if test x$zsh_cv_long_is_64_bit = xyes;
44 + else
45 + AC_CACHE_CHECK(if off_t is 64 bit, zsh_cv_off_t_is_64_bit,
46 + [AC_RUN_IFELSE([AC_LANG_SOURCE([[
47 + #include <sys/types.h>
48 +
49 +-main() { return sizeof(off_t) < 8; }
50 ++int main() { return sizeof(off_t) < 8; }
51 + ]])],[zsh_cv_off_t_is_64_bit=yes],[zsh_cv_off_t_is_64_bit=no],[zsh_cv_off_t_is_64_bit=no])])
52 + if test x$zsh_cv_off_t_is_64_bit = xyes; then
53 + AC_DEFINE(OFF_T_IS_64_BIT)
54 + fi
55 +
56 + AC_CACHE_CHECK(if ino_t is 64 bit, zsh_cv_ino_t_is_64_bit,
57 + [AC_RUN_IFELSE([AC_LANG_SOURCE([[
58 + #include <sys/types.h>
59 +
60 +-main() { return sizeof(ino_t) < 8; }
61 ++int main() { return sizeof(ino_t) < 8; }
62 + ]])],[zsh_cv_ino_t_is_64_bit=yes],[zsh_cv_ino_t_is_64_bit=no],[zsh_cv_ino_t_is_64_bit=no])])
63 + if test x$zsh_cv_ino_t_is_64_bit = xyes; then
64 + AC_DEFINE(INO_T_IS_64_BIT)
65 + fi
66 +
67 +@@ -1394,22 +1394,22 @@ zsh_cv_func_tgetent_accepts_null,
68 + [AC_RUN_IFELSE([AC_LANG_SOURCE([[
69 + #include <fcntl.h>
70 + #include <stdlib.h>
71 + int tgetent(char *, char *);
72 + char *tgetstr(char *, char **);
73 +-main()
74 ++int main()
75 + {
76 + char buf[4096];
77 + int r1 = tgetent(buf, "vt100");
78 + int r2 = tgetent((char*)0,"vt100");
79 + if (r1 >= 0 && r1 == r2) {
80 + char tbuf[1024], *u;
81 + u = tbuf;
82 + tgetstr("cl", &u);
83 + creat("conftest.tgetent", 0640);
84 + }
85 +- exit((r1 != r2) || r2 == -1);
86 ++ return((r1 != r2) || r2 == -1);
87 + }
88 + ]])],[if test -f conftest.tgetent; then
89 + zsh_cv_func_tgetent_accepts_null=yes
90 + else
91 + zsh_cv_func_tgetent_accepts_null=no
92 +@@ -1422,22 +1422,22 @@ zsh_cv_func_tgetent_zero_success,
93 + [AC_RUN_IFELSE([AC_LANG_SOURCE([[
94 + #include <fcntl.h>
95 + #include <stdlib.h>
96 + int tgetent(char *, char*);
97 + char *tgetstr(char *, char **);
98 +-main()
99 ++int main()
100 + {
101 + char buf[4096];
102 + int r1 = tgetent(buf, "!@#$%^&*");
103 + int r2 = tgetent(buf, "vt100");
104 + if (r1 < 0 && r2 == 0) {
105 + char tbuf[1024], *u;
106 + u = tbuf;
107 + tgetstr("cl", &u);
108 + creat("conftest.tgetent0", 0640);
109 + }
110 +- exit(r1 == r2);
111 ++ return(r1 == r2);
112 + }
113 + ]])],[if test -f conftest.tgetent0; then
114 + zsh_cv_func_tgetent_zero_success=yes
115 + else
116 + zsh_cv_func_tgetent_zero_success=no
117 +@@ -1860,27 +1860,27 @@ zsh_cv_rlim_t_is_longer,
118 + #ifdef HAVE_SYS_TIME_H
119 + #include <sys/time.h>
120 + #endif
121 + #include <sys/resource.h>
122 + #include <stdlib.h>
123 +-main(){struct rlimit r;exit(sizeof(r.rlim_cur) <= sizeof(long));}]])],[zsh_cv_rlim_t_is_longer=yes],[zsh_cv_rlim_t_is_longer=no],[zsh_cv_rlim_t_is_longer=yes])])
124 ++int main(){struct rlimit r;return(sizeof(r.rlim_cur) <= sizeof(long));}]])],[zsh_cv_rlim_t_is_longer=yes],[zsh_cv_rlim_t_is_longer=no],[zsh_cv_rlim_t_is_longer=yes])])
125 + if test x$zsh_cv_rlim_t_is_longer = xyes; then
126 + AC_CACHE_CHECK(if rlim_t is a quad,
127 + zsh_cv_rlim_t_is_quad_t,
128 + [AC_RUN_IFELSE([AC_LANG_SOURCE([[
129 + #ifdef HAVE_SYS_TIME_H
130 + #include <sys/time.h>
131 + #endif
132 + #include <stdio.h>
133 + #include <sys/resource.h>
134 + #include <stdlib.h>
135 +-main() {
136 ++int main() {
137 + struct rlimit r;
138 + char buf[20];
139 + r.rlim_cur = 0;
140 + sprintf(buf, "%qd", r.rlim_cur);
141 +- exit(strcmp(buf, "0"));
142 ++ return(strcmp(buf, "0"));
143 + }]])],[zsh_cv_rlim_t_is_quad_t=yes],[zsh_cv_rlim_t_is_quad_t=no],[zsh_cv_rlim_t_is_quad_t=no])])
144 + if test x$zsh_cv_rlim_t_is_quad_t = xyes; then
145 + AC_DEFINE(RLIM_T_IS_QUAD_T)
146 + DEFAULT_RLIM_T=quad_t
147 + else
148 +@@ -1894,11 +1894,11 @@ else
149 + #ifdef HAVE_SYS_TIME_H
150 + #include <sys/time.h>
151 + #endif
152 + #include <sys/resource.h>
153 + #include <stdlib.h>
154 +- main(){struct rlimit r;r.rlim_cur=-1;exit(r.rlim_cur<0);}]])],[zsh_cv_type_rlim_t_is_unsigned=yes],[zsh_cv_type_rlim_t_is_unsigned=no],[zsh_cv_type_rlim_t_is_unsigned=no])])
155 ++ int main(){struct rlimit r;r.rlim_cur=-1;return(r.rlim_cur<0);}]])],[zsh_cv_type_rlim_t_is_unsigned=yes],[zsh_cv_type_rlim_t_is_unsigned=no],[zsh_cv_type_rlim_t_is_unsigned=no])])
156 + if test x$zsh_cv_type_rlim_t_is_unsigned = xyes; then
157 + AC_DEFINE(RLIM_T_IS_UNSIGNED)
158 + DEFAULT_RLIM_T="unsigned $DEFAULT_RLIM_T"
159 + fi
160 + fi
161 +@@ -2175,11 +2175,11 @@ zsh_cv_sys_fifo,
162 + #include <fcntl.h>
163 + #include <signal.h>
164 + #include <unistd.h>
165 + #include <stdlib.h>
166 + #include <sys/stat.h>
167 +-main()
168 ++int main()
169 + {
170 + char c;
171 + int fd;
172 + int pid, ret;
173 + unlink("/tmp/fifo$$");
174 +@@ -2189,19 +2189,19 @@ main()
175 + if(mknod("/tmp/fifo$$", 0010600, 0) < 0)
176 + #endif
177 + exit(1);
178 + pid = fork();
179 + if(pid < 0)
180 +- exit(1);
181 ++ return(1);
182 + if(pid) {
183 + fd = open("/tmp/fifo$$", O_RDONLY);
184 +- exit(fd < 0 || read(fd, &c, 1) != 1 || c != 'x');
185 ++ return(fd < 0 || read(fd, &c, 1) != 1 || c != 'x');
186 + }
187 + fd = open("/tmp/fifo$$", O_WRONLY);
188 + ret = (fd < 0 || write(fd, "x", 1) < 1);
189 + unlink("/tmp/fifo$$");
190 +- exit(ret);
191 ++ return(ret);
192 + }
193 + ]])],[zsh_cv_sys_fifo=yes],[zsh_cv_sys_fifo=no],[zsh_cv_sys_fifo=yes])
194 + ])
195 + AH_TEMPLATE([HAVE_FIFOS],
196 + [Define to 1 if system has working FIFOs.])
197 +@@ -2276,24 +2276,24 @@ AC_CACHE_CHECK(if link() works,
198 + zsh_cv_sys_link,
199 + [AC_RUN_IFELSE([AC_LANG_SOURCE([[
200 + #include <unistd.h>
201 + #include <fcntl.h>
202 + #include <stdlib.h>
203 +-main()
204 ++int main()
205 + {
206 + int ret;
207 + char *tmpfile, *newfile;
208 + tmpfile="/tmp/zsh.linktest$$";
209 + newfile="/tmp/zsh.linktest2$$";
210 + unlink(tmpfile);
211 + unlink(newfile);
212 + if(creat(tmpfile, 0644) < 0)
213 +- exit(1);
214 ++ return(1);
215 + ret = link(tmpfile, newfile);
216 + unlink(tmpfile);
217 + unlink(newfile);
218 +- exit(ret<0);
219 ++ return(ret<0);
220 + }
221 + ]])],[zsh_cv_sys_link=yes],[zsh_cv_sys_link=no],[zsh_cv_sys_link=yes])])
222 + AH_TEMPLATE([HAVE_LINK],
223 + [Define to 1 if system has working link().])
224 + if test x$zsh_cv_sys_link = xyes; then
225 +@@ -2309,15 +2309,15 @@ zsh_cv_sys_killesrch,
226 + [AC_RUN_IFELSE([AC_LANG_SOURCE([[
227 + #include <unistd.h>
228 + #include <signal.h>
229 + #include <errno.h>
230 + #include <stdlib.h>
231 +-main()
232 ++int main()
233 + {
234 + int pid = (getpid() + 10000) & 0xffffff;
235 + while (pid && (kill(pid, 0) == 0 || errno != ESRCH)) pid >>= 1;
236 +- exit(errno!=ESRCH);
237 ++ return(errno!=ESRCH);
238 + }
239 + ]])],[zsh_cv_sys_killesrch=yes],[zsh_cv_sys_killesrch=no],[zsh_cv_sys_killesrch=yes])])
240 + AH_TEMPLATE([BROKEN_KILL_ESRCH],
241 + [Define to 1 if kill(pid, 0) doesn't return ESRCH, ie BeOS R4.51.])
242 + if test x$zsh_cv_sys_killesrch = xno; then
243 +@@ -2339,11 +2339,11 @@ if test x$signals_style = xPOSIX_SIGNALS
244 + #include <stdlib.h>
245 + int child=0;
246 + void handler(sig)
247 + int sig;
248 + {if(sig==SIGCHLD) child=1;}
249 +-main() {
250 ++int main() {
251 + struct sigaction act;
252 + sigset_t set;
253 + int pid, ret;
254 + act.sa_handler = &handler;
255 + sigfillset(&act.sa_mask);
256 +@@ -2354,11 +2354,11 @@ main() {
257 + pid=fork();
258 + if(pid==0) return 0;
259 + if(pid>0) {
260 + sigemptyset(&set);
261 + ret=sigsuspend(&set);
262 +- exit(child==0);
263 ++ return(child==0);
264 + }
265 + }
266 + ]])],[zsh_cv_sys_sigsuspend=yes],[zsh_cv_sys_sigsuspend=no],[zsh_cv_sys_sigsuspend=yes])])
267 + if test x$zsh_cv_sys_sigsuspend = xno; then
268 + AC_DEFINE(BROKEN_POSIX_SIGSUSPEND)
269 +@@ -2387,18 +2387,18 @@ case "x$zsh_working_tcsetpgrp" in
270 + [AC_RUN_IFELSE([AC_LANG_SOURCE([[
271 + #include <sys/types.h>
272 + #include <unistd.h>
273 + #include <fcntl.h>
274 + #include <stdlib.h>
275 +-main() {
276 ++int main() {
277 + int fd;
278 + int ret;
279 + fd=open("/dev/tty", O_RDWR);
280 + if (fd < 0) exit(2);
281 + ret=tcsetpgrp(fd, tcgetpgrp(fd));
282 + if (ret < 0) exit(1);
283 +- exit(0);
284 ++ return(0);
285 + }
286 + ]])],[zsh_cv_sys_tcsetpgrp=yes],[
287 + case $? in
288 + 1) zsh_cv_sys_tcsetpgrp=no;;
289 + 2) zsh_cv_sys_tcsetpgrp=notty;;
290 +@@ -2434,19 +2434,19 @@ if test x$ac_cv_func_getpwnam = xyes; th
291 + #include <pwd.h>
292 + #include <stdio.h>
293 + #include <string.h>
294 + #include <stdlib.h>
295 + #include <unistd.h>
296 +-main() {
297 ++int main() {
298 + struct passwd *pw1, *pw2;
299 + char buf[1024], name[1024];
300 + sprintf(buf, "%d:%d", getpid(), rand());
301 + pw1=getpwnam(buf);
302 + if (pw1) strcpy(name, pw1->pw_name);
303 + sprintf(buf, "%d:%d", rand(), getpid());
304 + pw2=getpwnam(buf);
305 +- exit(pw1!=0 && pw2!=0 && !strcmp(name, pw2->pw_name));
306 ++ return(pw1!=0 && pw2!=0 && !strcmp(name, pw2->pw_name));
307 + }
308 + ]])],[zsh_cv_sys_getpwnam_faked=no],[zsh_cv_sys_getpwnam_faked=yes],[zsh_cv_sys_getpwnam_faked=no])])
309 + if test x$zsh_cv_sys_getpwnam_faked = xyes; then
310 + AC_DEFINE(GETPWNAM_FAKED)
311 + fi
312 +@@ -2763,22 +2763,20 @@ elif test "x$dynamic" = xyes; then
313 + zsh_cv_sys_elf,
314 + [AC_RUN_IFELSE([AC_LANG_SOURCE([[/* Test for whether ELF binaries are produced */
315 + #include <fcntl.h>
316 + #include <stdlib.h>
317 + #include <unistd.h>
318 +-main(argc, argv)
319 +-int argc;
320 +-char *argv[];
321 ++int main(int argc, char *argv[])
322 + {
323 + char b[4];
324 + int i = open(argv[0],O_RDONLY);
325 + if(i == -1)
326 + exit(1); /* fail */
327 + if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
328 +- exit(0); /* succeed (yes, it's ELF) */
329 ++ return(0); /* succeed (yes, it's ELF) */
330 + else
331 +- exit(1); /* fail */
332 ++ return(1); /* fail */
333 + }]])],[zsh_cv_sys_elf=yes],[zsh_cv_sys_elf=no],[zsh_cv_sys_elf=yes])])
334 +
335 + # We use [0-9]* in case statements, so need to change quoting
336 + changequote(, )
337 +
338 +@@ -2908,11 +2908,11 @@ AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
339 + EXTRA_LDFLAGS="${EXTRA_LDFLAGS=-rdynamic}"],[zsh_cvs_rdynamic_available=no])
340 + LDFLAGS="$old_LDFLAGS")
341 + AC_CACHE_CHECK(if your dlsym() needs a leading underscore,
342 + zsh_cv_func_dlsym_needs_underscore,
343 + [echo failed >conftestval && cat >conftest.c <<EOM
344 +-fred () { }
345 ++void fred () { }
346 + EOM
347 + AC_TRY_COMMAND($CC -c $CFLAGS $CPPFLAGS $DLCFLAGS conftest.c 1>&AS_MESSAGE_LOG_FD) &&
348 + AC_TRY_COMMAND($DLLD $LDFLAGS $DLLDFLAGS -o conftest.$DL_EXT conftest.o 1>&AS_MESSAGE_LOG_FD) &&
349 + AC_RUN_IFELSE([AC_LANG_SOURCE([[
350 + #include <stdio.h>
351 +@@ -2943,34 +2941,34 @@ char *zsh_gl_sym_addr ;
352 + #define RTLD_LAZY 1
353 + #endif
354 +
355 + extern int fred() ;
356 +
357 +-main()
358 ++int main()
359 + {
360 + void * handle ;
361 + void * symbol ;
362 + FILE *f=fopen("conftestval", "w");
363 + if (!f) exit(1);
364 + handle = dlopen("./conftest.$DL_EXT", RTLD_LAZY) ;
365 + if (handle == NULL) {
366 + fprintf (f, "dlopen failed") ;
367 +- exit(1);
368 ++ return(1);
369 + }
370 + symbol = dlsym(handle, "fred") ;
371 + if (symbol == NULL) {
372 + /* try putting a leading underscore */
373 + symbol = dlsym(handle, "_fred") ;
374 + if (symbol == NULL) {
375 + fprintf (f, "dlsym failed") ;
376 +- exit(1);
377 ++ return(1);
378 + }
379 + fprintf (f, "yes") ;
380 + }
381 + else
382 + fprintf (f, "no") ;
383 +- exit(0);
384 ++ return(0);
385 + }]])],[zsh_cv_func_dlsym_needs_underscore=`cat conftestval`],[zsh_cv_func_dlsym_needs_underscore=failed
386 + dynamic=no],[zsh_cv_func_dlsym_needs_underscore=no])])
387 + if test "x$zsh_cv_func_dlsym_needs_underscore" = xyes; then
388 + AC_DEFINE(DLSYM_NEEDS_UNDERSCORE)
389 + elif test "x$zsh_cv_func_dlsym_needs_underscore" != xno; then
390 +--- a/aczsh.m4.old
391 ++++ b/aczsh.m4
392 +@@ -42,10 +42,11 @@ AC_DEFUN(zsh_64_BIT_TYPE,
393 + [AC_RUN_IFELSE([AC_LANG_SOURCE([[
394 + #ifdef HAVE_SYS_TYPES_H
395 + #include <sys/types.h>
396 + #endif
397 +
398 ++int
399 + main()
400 + {
401 + $1 foo = 0;
402 + int bar = (int) foo;
403 + return sizeof($1) != 8;
404 +@@ -144,33 +145,34 @@ char *zsh_gl_sym_addr ;
405 + #endif
406 + #ifndef RTLD_GLOBAL
407 + #define RTLD_GLOBAL 0
408 + #endif
409 +
410 ++int
411 + main()
412 + {
413 + void *handle1, *handle2;
414 + void *(*zsh_getaddr1)(), *(*zsh_getaddr2)();
415 + void *sym1, *sym2;
416 + handle1 = dlopen("./conftest1.$DL_EXT", RTLD_LAZY | RTLD_GLOBAL);
417 +- if(!handle1) exit(1);
418 ++ if(!handle1) return(1);
419 + handle2 = dlopen("./conftest2.$DL_EXT", RTLD_LAZY | RTLD_GLOBAL);
420 +- if(!handle2) exit(1);
421 ++ if(!handle2) return(1);
422 + zsh_getaddr1 = (void *(*)()) dlsym(handle1, "${us}zsh_getaddr1");
423 + zsh_getaddr2 = (void *(*)()) dlsym(handle2, "${us}zsh_getaddr2");
424 + sym1 = zsh_getaddr1();
425 + sym2 = zsh_getaddr2();
426 +- if(!sym1 || !sym2) exit(1);
427 +- if(sym1 != sym2) exit(1);
428 ++ if(!sym1 || !sym2) return(1);
429 ++ if(sym1 != sym2) return(1);
430 + dlclose(handle1);
431 + handle1 = dlopen("./conftest1.$DL_EXT", RTLD_LAZY | RTLD_GLOBAL);
432 +- if(!handle1) exit(1);
433 ++ if(!handle1) return(1);
434 + zsh_getaddr1 = (void *(*)()) dlsym(handle1, "${us}zsh_getaddr1");
435 + sym1 = zsh_getaddr1();
436 +- if(!sym1) exit(1);
437 +- if(sym1 != sym2) exit(1);
438 +- exit(0);
439 ++ if(!sym1) return(1);
440 ++ if(sym1 != sym2) return(1);
441 ++ return(0);
442 + }
443 + ]])],[zsh_cv_shared_$1=yes],
444 + [zsh_cv_shared_$1=no],
445 + [zsh_cv_shared_$1=no]
446 + )
447 +@@ -226,23 +228,23 @@ char *zsh_gl_sym_addr ;
448 + #endif
449 + #ifndef RTLD_GLOBAL
450 + #define RTLD_GLOBAL 0
451 + #endif
452 +
453 +-
454 ++int
455 + main()
456 + {
457 + void *handle1, *handle2;
458 + int (*fred1)(), (*fred2)();
459 + handle1 = dlopen("./conftest1.$DL_EXT", RTLD_LAZY | RTLD_GLOBAL);
460 +- if(!handle1) exit(1);
461 ++ if(!handle1) return(1);
462 + handle2 = dlopen("./conftest2.$DL_EXT", RTLD_LAZY | RTLD_GLOBAL);
463 +- if(!handle2) exit(1);
464 ++ if(!handle2) return(1);
465 + fred1 = (int (*)()) dlsym(handle1, "${us}fred");
466 + fred2 = (int (*)()) dlsym(handle2, "${us}fred");
467 +- if(!fred1 || !fred2) exit(1);
468 +- exit((*fred1)() != 42 || (*fred2)() != 69);
469 ++ if(!fred1 || !fred2) return(1);
470 ++ return((*fred1)() != 42 || (*fred2)() != 69);
471 + }
472 + ]])],[zsh_cv_sys_dynamic_clash_ok=yes],
473 + [zsh_cv_sys_dynamic_clash_ok=no],
474 + [zsh_cv_sys_dynamic_clash_ok=no]
475 + )
476 +@@ -302,21 +304,22 @@ char *zsh_gl_sym_addr ;
477 + #endif
478 + #ifndef RTLD_GLOBAL
479 + #define RTLD_GLOBAL 0
480 + #endif
481 +
482 ++int
483 + main()
484 + {
485 + void *handle;
486 + int (*barneysym)();
487 + handle = dlopen("./conftest1.$DL_EXT", RTLD_LAZY | RTLD_GLOBAL);
488 +- if(!handle) exit(1);
489 ++ if(!handle) return(1);
490 + handle = dlopen("./conftest2.$DL_EXT", RTLD_LAZY | RTLD_GLOBAL);
491 +- if(!handle) exit(1);
492 ++ if(!handle) return(1);
493 + barneysym = (int (*)()) dlsym(handle, "${us}barney");
494 +- if(!barneysym) exit(1);
495 +- exit((*barneysym)() != 69);
496 ++ if(!barneysym) return(1);
497 ++ return((*barneysym)() != 69);
498 + }
499 + ]])],[zsh_cv_sys_dynamic_rtld_global=yes],
500 + [zsh_cv_sys_dynamic_rtld_global=no],
501 + [zsh_cv_sys_dynamic_rtld_global=no]
502 + )
503 +@@ -372,19 +375,20 @@ char *zsh_gl_sym_addr ;
504 + #endif
505 + #ifndef RTLD_GLOBAL
506 + #define RTLD_GLOBAL 0
507 + #endif
508 +
509 ++int
510 + main()
511 + {
512 + void *handle;
513 + int (*barneysym)();
514 + handle = dlopen("./conftest1.$DL_EXT", RTLD_LAZY | RTLD_GLOBAL);
515 +- if(!handle) exit(1);
516 ++ if(!handle) return(1);
517 + barneysym = (int (*)()) dlsym(handle, "${us}barney");
518 +- if(!barneysym) exit(1);
519 +- exit((*barneysym)() != 69);
520 ++ if(!barneysym) return(1);
521 ++ return((*barneysym)() != 69);
522 + }
523 +
524 + int fred () { return 42; }
525 + ]])],[zsh_cv_sys_dynamic_execsyms=yes],
526 + [zsh_cv_sys_dynamic_execsyms=no],
527 +@@ -446,19 +450,20 @@ char *zsh_gl_sym_addr ;
528 + #endif
529 + #ifndef RTLD_GLOBAL
530 + #define RTLD_GLOBAL 0
531 + #endif
532 +
533 ++int
534 + main()
535 + {
536 + void *handle;
537 + int (*barneysym)();
538 + handle = dlopen("./conftest1.$DL_EXT", RTLD_LAZY | RTLD_GLOBAL);
539 +- if(!handle) exit(1);
540 ++ if(!handle) return(1);
541 + barneysym = (int (*)()) dlsym(handle, "${us}barney");
542 +- if(!barneysym) exit(1);
543 +- exit((*barneysym)() != 69);
544 ++ if(!barneysym) return(1);
545 ++ return((*barneysym)() != 69);
546 + }
547 +
548 + int fred () { return 42; }
549 + ]])],[zsh_cv_sys_dynamic_strip_exe=yes],
550 + [zsh_cv_sys_dynamic_strip_exe=no],
551 +@@ -514,19 +519,20 @@ char *zsh_gl_sym_addr ;
552 + #endif
553 + #ifndef RTLD_GLOBAL
554 + #define RTLD_GLOBAL 0
555 + #endif
556 +
557 ++int
558 + main()
559 + {
560 + void *handle;
561 + int (*fredsym)();
562 + handle = dlopen("./conftest1.$DL_EXT", RTLD_LAZY | RTLD_GLOBAL);
563 +- if(!handle) exit(1);
564 ++ if(!handle) return(1);
565 + fredsym = (int (*)()) dlsym(handle, "${us}fred");
566 +- if(!fredsym) exit(1);
567 +- exit((*fredsym)() != 42);
568 ++ if(!fredsym) return(1);
569 ++ return((*fredsym)() != 42);
570 + }
571 + ]])],[zsh_cv_sys_dynamic_strip_lib=yes],
572 + [zsh_cv_sys_dynamic_strip_lib=no],
573 + [zsh_cv_sys_dynamic_strip_lib=no]
574 + )
575 +
576
577 diff --git a/app-shells/zsh/zsh-5.9-r1.ebuild b/app-shells/zsh/zsh-5.9-r1.ebuild
578 new file mode 100644
579 index 000000000000..2ce37dce147c
580 --- /dev/null
581 +++ b/app-shells/zsh/zsh-5.9-r1.ebuild
582 @@ -0,0 +1,235 @@
583 +# Copyright 1999-2022 Gentoo Authors
584 +# Distributed under the terms of the GNU General Public License v2
585 +
586 +EAPI=8
587 +
588 +inherit autotools flag-o-matic prefix
589 +
590 +if [[ ${PV} == 9999* ]] ; then
591 + inherit git-r3
592 + EGIT_REPO_URI="https://git.code.sf.net/p/zsh/code"
593 +else
594 + KEYWORDS="~alpha amd64 arm arm64 ~hppa ~ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
595 + SRC_URI="https://www.zsh.org/pub/${P}.tar.xz
596 + https://www.zsh.org/pub/old/${P}.tar.xz
597 + mirror://sourceforge/${PN}/${P}.tar.xz
598 + doc? (
599 + https://www.zsh.org/pub/${P}-doc.tar.xz
600 + mirror://sourceforge/${PN}/${P}-doc.tar.xz
601 + )"
602 +fi
603 +
604 +DESCRIPTION="UNIX Shell similar to the Korn shell"
605 +HOMEPAGE="https://www.zsh.org/"
606 +
607 +LICENSE="ZSH gdbm? ( GPL-2 )"
608 +SLOT="0"
609 +IUSE="caps debug doc examples gdbm maildir pcre static unicode"
610 +
611 +RDEPEND="
612 + >=sys-libs/ncurses-5.1:0=
613 + static? ( >=sys-libs/ncurses-5.7-r4:0=[static-libs] )
614 + caps? ( sys-libs/libcap )
615 + pcre? (
616 + >=dev-libs/libpcre-3.9
617 + static? ( >=dev-libs/libpcre-3.9[static-libs] )
618 + )
619 + gdbm? ( sys-libs/gdbm:= )
620 +"
621 +DEPEND="sys-apps/groff
622 + ${RDEPEND}"
623 +PDEPEND="
624 + examples? ( app-doc/zsh-lovers )
625 +"
626 +if [[ ${PV} == *9999 ]] ; then
627 + DEPEND+=" app-text/yodl
628 + doc? (
629 + sys-apps/texinfo
630 + app-text/texi2html
631 + virtual/latex-base
632 + )"
633 +fi
634 +
635 +PATCHES=(
636 + # Add openrc specific options for init.d completion
637 + "${FILESDIR}"/${PN}-5.3-init.d-gentoo.diff
638 + # Please refer gentoo bug #833981
639 + "${FILESDIR}"/${PN}-5.9-musl-V09datetime-test-fix.patch
640 + # bug #869539
641 + "${FILESDIR}"/${PN}-5.9-clang-15-configure.patch
642 +)
643 +
644 +src_prepare() {
645 + if [[ ${PV} != *9999 ]]; then
646 + # fix zshall problem with soelim
647 + ln -s Doc man1 || die
648 + mv Doc/zshall.1 Doc/zshall.1.soelim || die
649 + soelim Doc/zshall.1.soelim > Doc/zshall.1 || die
650 + fi
651 +
652 + default
653 +
654 + hprefixify configure.ac
655 + if [[ ${PV} == *9999 ]] ; then
656 + sed -i "/^VERSION=/s@=.*@=${PV}@" Config/version.mk || die
657 + fi
658 + eautoreconf
659 +}
660 +
661 +src_configure() {
662 + local myconf=(
663 + --bindir="${EPREFIX}"/bin
664 + --libdir="${EPREFIX}"/usr/$(get_libdir)
665 + --enable-etcdir="${EPREFIX}"/etc/zsh
666 + --enable-runhelpdir="${EPREFIX}"/usr/share/zsh/${PV%_*}/help
667 + --enable-fndir="${EPREFIX}"/usr/share/zsh/${PV%_*}/functions
668 + --enable-site-fndir="${EPREFIX}"/usr/share/zsh/site-functions
669 + --enable-function-subdirs
670 + --with-tcsetpgrp
671 + --with-term-lib="$(usex unicode 'tinfow ncursesw' 'tinfo ncurses')"
672 + $(use_enable maildir maildir-support)
673 + $(use_enable pcre)
674 + $(use_enable caps cap)
675 + $(use_enable unicode multibyte)
676 + $(use_enable gdbm)
677 + )
678 +
679 + if use static ; then
680 + myconf+=( --disable-dynamic )
681 + append-ldflags -static
682 + fi
683 + if use debug ; then
684 + myconf+=(
685 + --enable-zsh-debug
686 + --enable-zsh-mem-debug
687 + --enable-zsh-mem-warning
688 + --enable-zsh-secure-free
689 + --enable-zsh-hash-debug
690 + )
691 + fi
692 +
693 + if [[ ${CHOST} == *-darwin* ]]; then
694 + myconf+=( --enable-libs=-liconv )
695 + append-ldflags -Wl,-x
696 + fi
697 +
698 + econf "${myconf[@]}"
699 +
700 + if use static ; then
701 + # compile all modules statically, see Bug #27392
702 + # removed cap and curses because linking failes
703 + sed -e "s,link=no,link=static,g" \
704 + -e "/^name=zsh\/cap/s,link=static,link=no," \
705 + -e "/^name=zsh\/curses/s,link=static,link=no," \
706 + -i "${S}"/config.modules || die
707 + if ! use gdbm ; then
708 + sed -i '/^name=zsh\/db\/gdbm/s,link=static,link=no,' \
709 + "${S}"/config.modules || die
710 + fi
711 + fi
712 +}
713 +
714 +src_compile() {
715 + default
716 +
717 + if [[ ${PV} == *9999 ]] && use doc ; then
718 + emake -C Doc everything
719 + fi
720 +}
721 +
722 +src_test() {
723 + # Fixes tests A03quoting.ztst B03print.ztst on musl
724 + # Please refer:
725 + # https://www.zsh.org/mla/workers/2021/msg00805.html
726 + # Test E02xtrace fails on musl, so we are removing it.
727 + # Closes: https://bugs.gentoo.org/833981
728 + if use elibc_musl ; then
729 + unset LC_ALL
730 + unset LC_COLLATE
731 + unset LC_NUMERIC
732 + unset LC_MESSAGES
733 + unset LANG
734 + rm "${S}"/Test/E02xtrace.ztst || die
735 + fi
736 + addpredict /dev/ptmx
737 + local i
738 + for i in C02cond.ztst V08zpty.ztst X02zlevi.ztst Y01completion.ztst Y02compmatch.ztst Y03arguments.ztst ; do
739 + rm "${S}"/Test/${i} || die
740 + done
741 + emake check
742 +}
743 +
744 +src_install() {
745 + emake DESTDIR="${D}" install $(usex doc "install.info" "")
746 +
747 + insinto /etc/zsh
748 + export PREFIX_QUOTE_CHAR='"' PREFIX_EXTRA_REGEX="/EUID/s,0,${EUID},"
749 + newins "$(prefixify_ro "${FILESDIR}"/zprofile-4)" zprofile
750 +
751 + keepdir /usr/share/zsh/site-functions
752 + insinto /usr/share/zsh/${PV%_*}/functions/Prompts
753 + newins "${FILESDIR}"/prompt_gentoo_setup-1 prompt_gentoo_setup
754 +
755 + local i
756 +
757 + # install miscellaneous scripts (bug #54520)
758 + sed -e "s:/usr/local/bin/perl:${EPREFIX}/usr/bin/perl:g" \
759 + -e "s:/usr/local/bin/zsh:${EPREFIX}/bin/zsh:g" \
760 + -i {Util,Misc}/* || die
761 + for i in Util Misc ; do
762 + insinto /usr/share/zsh/${PV%_*}/${i}
763 + doins ${i}/*
764 + done
765 +
766 + # install header files (bug #538684)
767 + insinto /usr/include/zsh
768 + doins config.h Src/*.epro
769 + for i in Src/{zsh.mdh,*.h} ; do
770 + sed -e 's@\.\./config\.h@config.h@' \
771 + -e 's@#\(\s*\)include "\([^"]\+\)"@#\1include <zsh/\2>@' \
772 + -i "${i}"
773 + doins "${i}"
774 + done
775 +
776 + dodoc ChangeLog* META-FAQ NEWS README config.modules
777 +
778 + if use doc ; then
779 + pushd "${WORKDIR}/${PN}-${PV%_*}" >/dev/null
780 + dodoc Doc/zsh.{dvi,pdf}
781 + docinto html
782 + dodoc Doc/*.html
783 + popd >/dev/null
784 + fi
785 +
786 + docinto StartupFiles
787 + dodoc StartupFiles/z*
788 +}
789 +
790 +pkg_postinst() {
791 + if [[ -z ${REPLACING_VERSIONS} ]] ; then
792 + echo
793 + elog "If you want to enable Portage completions and Gentoo prompt,"
794 + elog "emerge app-shells/gentoo-zsh-completions and add"
795 + elog " autoload -U compinit promptinit"
796 + elog " compinit"
797 + elog " promptinit; prompt gentoo"
798 + elog "to your ~/.zshrc"
799 + echo
800 + elog "Also, if you want to enable cache for the completions, add"
801 + elog " zstyle ':completion::complete:*' use-cache 1"
802 + elog "to your ~/.zshrc"
803 + echo
804 + elog "Note that a system zprofile startup file is installed. This will override"
805 + elog "PATH and possibly other variables that a user may set in ~/.zshenv."
806 + elog "Custom PATH settings and similar overridden variables can be moved to ~/.zprofile"
807 + elog "or other user startup files that are sourced after the system zprofile."
808 + echo
809 + elog "If PATH must be set in ~/.zshenv to affect things like non-login ssh shells,"
810 + elog "one method is to use a separate path-setting file that is conditionally sourced"
811 + elog "in ~/.zshenv and also sourced from ~/.zprofile. For more information, see the"
812 + elog "zshenv example in ${EROOT}/usr/share/doc/${PF}/StartupFiles/."
813 + echo
814 + elog "See https://wiki.gentoo.org/wiki/Zsh/HOWTO for more introduction documentation."
815 + echo
816 + fi
817 +}