diff options
author | Sam James <sam@gentoo.org> | 2022-09-12 21:07:51 +0100 |
---|---|---|
committer | Sam James <sam@gentoo.org> | 2022-09-12 21:08:13 +0100 |
commit | 892dc0afaf0436e59259fec155f76ba4af9b6b06 (patch) | |
tree | a33249d2ddf93cb0d38a1e131802829f222c2405 /app-shells/zsh | |
parent | media-sound/timidity++: fix configure tests with Clang 15 (diff) | |
download | gentoo-892dc0afaf0436e59259fec155f76ba4af9b6b06.tar.gz gentoo-892dc0afaf0436e59259fec155f76ba4af9b6b06.tar.bz2 gentoo-892dc0afaf0436e59259fec155f76ba4af9b6b06.zip |
app-shells/zsh: fix configure tests with Clang 15
Note that in some cases, this may have caused either some
files to not be installed, or hangs at runtime.
Closes: https://bugs.gentoo.org/869539
Thanks-to: Nicholas Vinson <nvinson234@gmail.com>
Signed-off-by: Sam James <sam@gentoo.org>
Diffstat (limited to 'app-shells/zsh')
-rw-r--r-- | app-shells/zsh/files/zsh-5.9-clang-15-configure.patch | 549 | ||||
-rw-r--r-- | app-shells/zsh/zsh-5.9-r1.ebuild | 235 |
2 files changed, 784 insertions, 0 deletions
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 new file mode 100644 index 000000000000..8a77e365c700 --- /dev/null +++ b/app-shells/zsh/files/zsh-5.9-clang-15-configure.patch @@ -0,0 +1,549 @@ +https://bugs.gentoo.org/869539 +--- a/configure.ac ++++ b/configure.ac +@@ -583,11 +583,11 @@ if test x$zsh_cv_c_have_union_init = xye + fi + + dnl Checking if compiler correctly cast signed to unsigned. + AC_CACHE_CHECK(if signed to unsigned casting is broken, + zsh_cv_c_broken_signed_to_unsigned_casting, +-[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])]) ++[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])]) + AH_TEMPLATE([BROKEN_SIGNED_TO_UNSIGNED_CASTING], + [Define to 1 if compiler incorrectly cast signed to unsigned.]) + if test x$zsh_cv_c_broken_signed_to_unsigned_casting = xyes; then + AC_DEFINE(BROKEN_SIGNED_TO_UNSIGNED_CASTING) + fi +@@ -1044,21 +1044,21 @@ if test x$zsh_cv_long_is_64_bit = xyes; + else + AC_CACHE_CHECK(if off_t is 64 bit, zsh_cv_off_t_is_64_bit, + [AC_RUN_IFELSE([AC_LANG_SOURCE([[ + #include <sys/types.h> + +-main() { return sizeof(off_t) < 8; } ++int main() { return sizeof(off_t) < 8; } + ]])],[zsh_cv_off_t_is_64_bit=yes],[zsh_cv_off_t_is_64_bit=no],[zsh_cv_off_t_is_64_bit=no])]) + if test x$zsh_cv_off_t_is_64_bit = xyes; then + AC_DEFINE(OFF_T_IS_64_BIT) + fi + + AC_CACHE_CHECK(if ino_t is 64 bit, zsh_cv_ino_t_is_64_bit, + [AC_RUN_IFELSE([AC_LANG_SOURCE([[ + #include <sys/types.h> + +-main() { return sizeof(ino_t) < 8; } ++int main() { return sizeof(ino_t) < 8; } + ]])],[zsh_cv_ino_t_is_64_bit=yes],[zsh_cv_ino_t_is_64_bit=no],[zsh_cv_ino_t_is_64_bit=no])]) + if test x$zsh_cv_ino_t_is_64_bit = xyes; then + AC_DEFINE(INO_T_IS_64_BIT) + fi + +@@ -1394,22 +1394,22 @@ zsh_cv_func_tgetent_accepts_null, + [AC_RUN_IFELSE([AC_LANG_SOURCE([[ + #include <fcntl.h> + #include <stdlib.h> + int tgetent(char *, char *); + char *tgetstr(char *, char **); +-main() ++int main() + { + char buf[4096]; + int r1 = tgetent(buf, "vt100"); + int r2 = tgetent((char*)0,"vt100"); + if (r1 >= 0 && r1 == r2) { + char tbuf[1024], *u; + u = tbuf; + tgetstr("cl", &u); + creat("conftest.tgetent", 0640); + } +- exit((r1 != r2) || r2 == -1); ++ return((r1 != r2) || r2 == -1); + } + ]])],[if test -f conftest.tgetent; then + zsh_cv_func_tgetent_accepts_null=yes + else + zsh_cv_func_tgetent_accepts_null=no +@@ -1422,22 +1422,22 @@ zsh_cv_func_tgetent_zero_success, + [AC_RUN_IFELSE([AC_LANG_SOURCE([[ + #include <fcntl.h> + #include <stdlib.h> + int tgetent(char *, char*); + char *tgetstr(char *, char **); +-main() ++int main() + { + char buf[4096]; + int r1 = tgetent(buf, "!@#$%^&*"); + int r2 = tgetent(buf, "vt100"); + if (r1 < 0 && r2 == 0) { + char tbuf[1024], *u; + u = tbuf; + tgetstr("cl", &u); + creat("conftest.tgetent0", 0640); + } +- exit(r1 == r2); ++ return(r1 == r2); + } + ]])],[if test -f conftest.tgetent0; then + zsh_cv_func_tgetent_zero_success=yes + else + zsh_cv_func_tgetent_zero_success=no +@@ -1860,27 +1860,27 @@ zsh_cv_rlim_t_is_longer, + #ifdef HAVE_SYS_TIME_H + #include <sys/time.h> + #endif + #include <sys/resource.h> + #include <stdlib.h> +-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])]) ++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])]) + if test x$zsh_cv_rlim_t_is_longer = xyes; then + AC_CACHE_CHECK(if rlim_t is a quad, + zsh_cv_rlim_t_is_quad_t, + [AC_RUN_IFELSE([AC_LANG_SOURCE([[ + #ifdef HAVE_SYS_TIME_H + #include <sys/time.h> + #endif + #include <stdio.h> + #include <sys/resource.h> + #include <stdlib.h> +-main() { ++int main() { + struct rlimit r; + char buf[20]; + r.rlim_cur = 0; + sprintf(buf, "%qd", r.rlim_cur); +- exit(strcmp(buf, "0")); ++ return(strcmp(buf, "0")); + }]])],[zsh_cv_rlim_t_is_quad_t=yes],[zsh_cv_rlim_t_is_quad_t=no],[zsh_cv_rlim_t_is_quad_t=no])]) + if test x$zsh_cv_rlim_t_is_quad_t = xyes; then + AC_DEFINE(RLIM_T_IS_QUAD_T) + DEFAULT_RLIM_T=quad_t + else +@@ -1894,11 +1894,11 @@ else + #ifdef HAVE_SYS_TIME_H + #include <sys/time.h> + #endif + #include <sys/resource.h> + #include <stdlib.h> +- 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])]) ++ 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])]) + if test x$zsh_cv_type_rlim_t_is_unsigned = xyes; then + AC_DEFINE(RLIM_T_IS_UNSIGNED) + DEFAULT_RLIM_T="unsigned $DEFAULT_RLIM_T" + fi + fi +@@ -2175,11 +2175,11 @@ zsh_cv_sys_fifo, + #include <fcntl.h> + #include <signal.h> + #include <unistd.h> + #include <stdlib.h> + #include <sys/stat.h> +-main() ++int main() + { + char c; + int fd; + int pid, ret; + unlink("/tmp/fifo$$"); +@@ -2189,19 +2189,19 @@ main() + if(mknod("/tmp/fifo$$", 0010600, 0) < 0) + #endif + exit(1); + pid = fork(); + if(pid < 0) +- exit(1); ++ return(1); + if(pid) { + fd = open("/tmp/fifo$$", O_RDONLY); +- exit(fd < 0 || read(fd, &c, 1) != 1 || c != 'x'); ++ return(fd < 0 || read(fd, &c, 1) != 1 || c != 'x'); + } + fd = open("/tmp/fifo$$", O_WRONLY); + ret = (fd < 0 || write(fd, "x", 1) < 1); + unlink("/tmp/fifo$$"); +- exit(ret); ++ return(ret); + } + ]])],[zsh_cv_sys_fifo=yes],[zsh_cv_sys_fifo=no],[zsh_cv_sys_fifo=yes]) + ]) + AH_TEMPLATE([HAVE_FIFOS], + [Define to 1 if system has working FIFOs.]) +@@ -2276,24 +2276,24 @@ AC_CACHE_CHECK(if link() works, + zsh_cv_sys_link, + [AC_RUN_IFELSE([AC_LANG_SOURCE([[ + #include <unistd.h> + #include <fcntl.h> + #include <stdlib.h> +-main() ++int main() + { + int ret; + char *tmpfile, *newfile; + tmpfile="/tmp/zsh.linktest$$"; + newfile="/tmp/zsh.linktest2$$"; + unlink(tmpfile); + unlink(newfile); + if(creat(tmpfile, 0644) < 0) +- exit(1); ++ return(1); + ret = link(tmpfile, newfile); + unlink(tmpfile); + unlink(newfile); +- exit(ret<0); ++ return(ret<0); + } + ]])],[zsh_cv_sys_link=yes],[zsh_cv_sys_link=no],[zsh_cv_sys_link=yes])]) + AH_TEMPLATE([HAVE_LINK], + [Define to 1 if system has working link().]) + if test x$zsh_cv_sys_link = xyes; then +@@ -2309,15 +2309,15 @@ zsh_cv_sys_killesrch, + [AC_RUN_IFELSE([AC_LANG_SOURCE([[ + #include <unistd.h> + #include <signal.h> + #include <errno.h> + #include <stdlib.h> +-main() ++int main() + { + int pid = (getpid() + 10000) & 0xffffff; + while (pid && (kill(pid, 0) == 0 || errno != ESRCH)) pid >>= 1; +- exit(errno!=ESRCH); ++ return(errno!=ESRCH); + } + ]])],[zsh_cv_sys_killesrch=yes],[zsh_cv_sys_killesrch=no],[zsh_cv_sys_killesrch=yes])]) + AH_TEMPLATE([BROKEN_KILL_ESRCH], + [Define to 1 if kill(pid, 0) doesn't return ESRCH, ie BeOS R4.51.]) + if test x$zsh_cv_sys_killesrch = xno; then +@@ -2339,11 +2339,11 @@ if test x$signals_style = xPOSIX_SIGNALS + #include <stdlib.h> + int child=0; + void handler(sig) + int sig; + {if(sig==SIGCHLD) child=1;} +-main() { ++int main() { + struct sigaction act; + sigset_t set; + int pid, ret; + act.sa_handler = &handler; + sigfillset(&act.sa_mask); +@@ -2354,11 +2354,11 @@ main() { + pid=fork(); + if(pid==0) return 0; + if(pid>0) { + sigemptyset(&set); + ret=sigsuspend(&set); +- exit(child==0); ++ return(child==0); + } + } + ]])],[zsh_cv_sys_sigsuspend=yes],[zsh_cv_sys_sigsuspend=no],[zsh_cv_sys_sigsuspend=yes])]) + if test x$zsh_cv_sys_sigsuspend = xno; then + AC_DEFINE(BROKEN_POSIX_SIGSUSPEND) +@@ -2387,18 +2387,18 @@ case "x$zsh_working_tcsetpgrp" in + [AC_RUN_IFELSE([AC_LANG_SOURCE([[ + #include <sys/types.h> + #include <unistd.h> + #include <fcntl.h> + #include <stdlib.h> +-main() { ++int main() { + int fd; + int ret; + fd=open("/dev/tty", O_RDWR); + if (fd < 0) exit(2); + ret=tcsetpgrp(fd, tcgetpgrp(fd)); + if (ret < 0) exit(1); +- exit(0); ++ return(0); + } + ]])],[zsh_cv_sys_tcsetpgrp=yes],[ + case $? in + 1) zsh_cv_sys_tcsetpgrp=no;; + 2) zsh_cv_sys_tcsetpgrp=notty;; +@@ -2434,19 +2434,19 @@ if test x$ac_cv_func_getpwnam = xyes; th + #include <pwd.h> + #include <stdio.h> + #include <string.h> + #include <stdlib.h> + #include <unistd.h> +-main() { ++int main() { + struct passwd *pw1, *pw2; + char buf[1024], name[1024]; + sprintf(buf, "%d:%d", getpid(), rand()); + pw1=getpwnam(buf); + if (pw1) strcpy(name, pw1->pw_name); + sprintf(buf, "%d:%d", rand(), getpid()); + pw2=getpwnam(buf); +- exit(pw1!=0 && pw2!=0 && !strcmp(name, pw2->pw_name)); ++ return(pw1!=0 && pw2!=0 && !strcmp(name, pw2->pw_name)); + } + ]])],[zsh_cv_sys_getpwnam_faked=no],[zsh_cv_sys_getpwnam_faked=yes],[zsh_cv_sys_getpwnam_faked=no])]) + if test x$zsh_cv_sys_getpwnam_faked = xyes; then + AC_DEFINE(GETPWNAM_FAKED) + fi +@@ -2763,22 +2763,20 @@ elif test "x$dynamic" = xyes; then + zsh_cv_sys_elf, + [AC_RUN_IFELSE([AC_LANG_SOURCE([[/* Test for whether ELF binaries are produced */ + #include <fcntl.h> + #include <stdlib.h> + #include <unistd.h> +-main(argc, argv) +-int argc; +-char *argv[]; ++int main(int argc, char *argv[]) + { + char b[4]; + int i = open(argv[0],O_RDONLY); + if(i == -1) + exit(1); /* fail */ + if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F') +- exit(0); /* succeed (yes, it's ELF) */ ++ return(0); /* succeed (yes, it's ELF) */ + else +- exit(1); /* fail */ ++ return(1); /* fail */ + }]])],[zsh_cv_sys_elf=yes],[zsh_cv_sys_elf=no],[zsh_cv_sys_elf=yes])]) + + # We use [0-9]* in case statements, so need to change quoting + changequote(, ) + +@@ -2908,11 +2908,11 @@ AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ + EXTRA_LDFLAGS="${EXTRA_LDFLAGS=-rdynamic}"],[zsh_cvs_rdynamic_available=no]) + LDFLAGS="$old_LDFLAGS") + AC_CACHE_CHECK(if your dlsym() needs a leading underscore, + zsh_cv_func_dlsym_needs_underscore, + [echo failed >conftestval && cat >conftest.c <<EOM +-fred () { } ++void fred () { } + EOM + AC_TRY_COMMAND($CC -c $CFLAGS $CPPFLAGS $DLCFLAGS conftest.c 1>&AS_MESSAGE_LOG_FD) && + AC_TRY_COMMAND($DLLD $LDFLAGS $DLLDFLAGS -o conftest.$DL_EXT conftest.o 1>&AS_MESSAGE_LOG_FD) && + AC_RUN_IFELSE([AC_LANG_SOURCE([[ + #include <stdio.h> +@@ -2943,34 +2941,34 @@ char *zsh_gl_sym_addr ; + #define RTLD_LAZY 1 + #endif + + extern int fred() ; + +-main() ++int main() + { + void * handle ; + void * symbol ; + FILE *f=fopen("conftestval", "w"); + if (!f) exit(1); + handle = dlopen("./conftest.$DL_EXT", RTLD_LAZY) ; + if (handle == NULL) { + fprintf (f, "dlopen failed") ; +- exit(1); ++ return(1); + } + symbol = dlsym(handle, "fred") ; + if (symbol == NULL) { + /* try putting a leading underscore */ + symbol = dlsym(handle, "_fred") ; + if (symbol == NULL) { + fprintf (f, "dlsym failed") ; +- exit(1); ++ return(1); + } + fprintf (f, "yes") ; + } + else + fprintf (f, "no") ; +- exit(0); ++ return(0); + }]])],[zsh_cv_func_dlsym_needs_underscore=`cat conftestval`],[zsh_cv_func_dlsym_needs_underscore=failed + dynamic=no],[zsh_cv_func_dlsym_needs_underscore=no])]) + if test "x$zsh_cv_func_dlsym_needs_underscore" = xyes; then + AC_DEFINE(DLSYM_NEEDS_UNDERSCORE) + elif test "x$zsh_cv_func_dlsym_needs_underscore" != xno; then +--- a/aczsh.m4.old ++++ b/aczsh.m4 +@@ -42,10 +42,11 @@ AC_DEFUN(zsh_64_BIT_TYPE, + [AC_RUN_IFELSE([AC_LANG_SOURCE([[ + #ifdef HAVE_SYS_TYPES_H + #include <sys/types.h> + #endif + ++int + main() + { + $1 foo = 0; + int bar = (int) foo; + return sizeof($1) != 8; +@@ -144,33 +145,34 @@ char *zsh_gl_sym_addr ; + #endif + #ifndef RTLD_GLOBAL + #define RTLD_GLOBAL 0 + #endif + ++int + main() + { + void *handle1, *handle2; + void *(*zsh_getaddr1)(), *(*zsh_getaddr2)(); + void *sym1, *sym2; + handle1 = dlopen("./conftest1.$DL_EXT", RTLD_LAZY | RTLD_GLOBAL); +- if(!handle1) exit(1); ++ if(!handle1) return(1); + handle2 = dlopen("./conftest2.$DL_EXT", RTLD_LAZY | RTLD_GLOBAL); +- if(!handle2) exit(1); ++ if(!handle2) return(1); + zsh_getaddr1 = (void *(*)()) dlsym(handle1, "${us}zsh_getaddr1"); + zsh_getaddr2 = (void *(*)()) dlsym(handle2, "${us}zsh_getaddr2"); + sym1 = zsh_getaddr1(); + sym2 = zsh_getaddr2(); +- if(!sym1 || !sym2) exit(1); +- if(sym1 != sym2) exit(1); ++ if(!sym1 || !sym2) return(1); ++ if(sym1 != sym2) return(1); + dlclose(handle1); + handle1 = dlopen("./conftest1.$DL_EXT", RTLD_LAZY | RTLD_GLOBAL); +- if(!handle1) exit(1); ++ if(!handle1) return(1); + zsh_getaddr1 = (void *(*)()) dlsym(handle1, "${us}zsh_getaddr1"); + sym1 = zsh_getaddr1(); +- if(!sym1) exit(1); +- if(sym1 != sym2) exit(1); +- exit(0); ++ if(!sym1) return(1); ++ if(sym1 != sym2) return(1); ++ return(0); + } + ]])],[zsh_cv_shared_$1=yes], + [zsh_cv_shared_$1=no], + [zsh_cv_shared_$1=no] + ) +@@ -226,23 +228,23 @@ char *zsh_gl_sym_addr ; + #endif + #ifndef RTLD_GLOBAL + #define RTLD_GLOBAL 0 + #endif + +- ++int + main() + { + void *handle1, *handle2; + int (*fred1)(), (*fred2)(); + handle1 = dlopen("./conftest1.$DL_EXT", RTLD_LAZY | RTLD_GLOBAL); +- if(!handle1) exit(1); ++ if(!handle1) return(1); + handle2 = dlopen("./conftest2.$DL_EXT", RTLD_LAZY | RTLD_GLOBAL); +- if(!handle2) exit(1); ++ if(!handle2) return(1); + fred1 = (int (*)()) dlsym(handle1, "${us}fred"); + fred2 = (int (*)()) dlsym(handle2, "${us}fred"); +- if(!fred1 || !fred2) exit(1); +- exit((*fred1)() != 42 || (*fred2)() != 69); ++ if(!fred1 || !fred2) return(1); ++ return((*fred1)() != 42 || (*fred2)() != 69); + } + ]])],[zsh_cv_sys_dynamic_clash_ok=yes], + [zsh_cv_sys_dynamic_clash_ok=no], + [zsh_cv_sys_dynamic_clash_ok=no] + ) +@@ -302,21 +304,22 @@ char *zsh_gl_sym_addr ; + #endif + #ifndef RTLD_GLOBAL + #define RTLD_GLOBAL 0 + #endif + ++int + main() + { + void *handle; + int (*barneysym)(); + handle = dlopen("./conftest1.$DL_EXT", RTLD_LAZY | RTLD_GLOBAL); +- if(!handle) exit(1); ++ if(!handle) return(1); + handle = dlopen("./conftest2.$DL_EXT", RTLD_LAZY | RTLD_GLOBAL); +- if(!handle) exit(1); ++ if(!handle) return(1); + barneysym = (int (*)()) dlsym(handle, "${us}barney"); +- if(!barneysym) exit(1); +- exit((*barneysym)() != 69); ++ if(!barneysym) return(1); ++ return((*barneysym)() != 69); + } + ]])],[zsh_cv_sys_dynamic_rtld_global=yes], + [zsh_cv_sys_dynamic_rtld_global=no], + [zsh_cv_sys_dynamic_rtld_global=no] + ) +@@ -372,19 +375,20 @@ char *zsh_gl_sym_addr ; + #endif + #ifndef RTLD_GLOBAL + #define RTLD_GLOBAL 0 + #endif + ++int + main() + { + void *handle; + int (*barneysym)(); + handle = dlopen("./conftest1.$DL_EXT", RTLD_LAZY | RTLD_GLOBAL); +- if(!handle) exit(1); ++ if(!handle) return(1); + barneysym = (int (*)()) dlsym(handle, "${us}barney"); +- if(!barneysym) exit(1); +- exit((*barneysym)() != 69); ++ if(!barneysym) return(1); ++ return((*barneysym)() != 69); + } + + int fred () { return 42; } + ]])],[zsh_cv_sys_dynamic_execsyms=yes], + [zsh_cv_sys_dynamic_execsyms=no], +@@ -446,19 +450,20 @@ char *zsh_gl_sym_addr ; + #endif + #ifndef RTLD_GLOBAL + #define RTLD_GLOBAL 0 + #endif + ++int + main() + { + void *handle; + int (*barneysym)(); + handle = dlopen("./conftest1.$DL_EXT", RTLD_LAZY | RTLD_GLOBAL); +- if(!handle) exit(1); ++ if(!handle) return(1); + barneysym = (int (*)()) dlsym(handle, "${us}barney"); +- if(!barneysym) exit(1); +- exit((*barneysym)() != 69); ++ if(!barneysym) return(1); ++ return((*barneysym)() != 69); + } + + int fred () { return 42; } + ]])],[zsh_cv_sys_dynamic_strip_exe=yes], + [zsh_cv_sys_dynamic_strip_exe=no], +@@ -514,19 +519,20 @@ char *zsh_gl_sym_addr ; + #endif + #ifndef RTLD_GLOBAL + #define RTLD_GLOBAL 0 + #endif + ++int + main() + { + void *handle; + int (*fredsym)(); + handle = dlopen("./conftest1.$DL_EXT", RTLD_LAZY | RTLD_GLOBAL); +- if(!handle) exit(1); ++ if(!handle) return(1); + fredsym = (int (*)()) dlsym(handle, "${us}fred"); +- if(!fredsym) exit(1); +- exit((*fredsym)() != 42); ++ if(!fredsym) return(1); ++ return((*fredsym)() != 42); + } + ]])],[zsh_cv_sys_dynamic_strip_lib=yes], + [zsh_cv_sys_dynamic_strip_lib=no], + [zsh_cv_sys_dynamic_strip_lib=no] + ) + diff --git a/app-shells/zsh/zsh-5.9-r1.ebuild b/app-shells/zsh/zsh-5.9-r1.ebuild new file mode 100644 index 000000000000..2ce37dce147c --- /dev/null +++ b/app-shells/zsh/zsh-5.9-r1.ebuild @@ -0,0 +1,235 @@ +# Copyright 1999-2022 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +inherit autotools flag-o-matic prefix + +if [[ ${PV} == 9999* ]] ; then + inherit git-r3 + EGIT_REPO_URI="https://git.code.sf.net/p/zsh/code" +else + 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" + SRC_URI="https://www.zsh.org/pub/${P}.tar.xz + https://www.zsh.org/pub/old/${P}.tar.xz + mirror://sourceforge/${PN}/${P}.tar.xz + doc? ( + https://www.zsh.org/pub/${P}-doc.tar.xz + mirror://sourceforge/${PN}/${P}-doc.tar.xz + )" +fi + +DESCRIPTION="UNIX Shell similar to the Korn shell" +HOMEPAGE="https://www.zsh.org/" + +LICENSE="ZSH gdbm? ( GPL-2 )" +SLOT="0" +IUSE="caps debug doc examples gdbm maildir pcre static unicode" + +RDEPEND=" + >=sys-libs/ncurses-5.1:0= + static? ( >=sys-libs/ncurses-5.7-r4:0=[static-libs] ) + caps? ( sys-libs/libcap ) + pcre? ( + >=dev-libs/libpcre-3.9 + static? ( >=dev-libs/libpcre-3.9[static-libs] ) + ) + gdbm? ( sys-libs/gdbm:= ) +" +DEPEND="sys-apps/groff + ${RDEPEND}" +PDEPEND=" + examples? ( app-doc/zsh-lovers ) +" +if [[ ${PV} == *9999 ]] ; then + DEPEND+=" app-text/yodl + doc? ( + sys-apps/texinfo + app-text/texi2html + virtual/latex-base + )" +fi + +PATCHES=( + # Add openrc specific options for init.d completion + "${FILESDIR}"/${PN}-5.3-init.d-gentoo.diff + # Please refer gentoo bug #833981 + "${FILESDIR}"/${PN}-5.9-musl-V09datetime-test-fix.patch + # bug #869539 + "${FILESDIR}"/${PN}-5.9-clang-15-configure.patch +) + +src_prepare() { + if [[ ${PV} != *9999 ]]; then + # fix zshall problem with soelim + ln -s Doc man1 || die + mv Doc/zshall.1 Doc/zshall.1.soelim || die + soelim Doc/zshall.1.soelim > Doc/zshall.1 || die + fi + + default + + hprefixify configure.ac + if [[ ${PV} == *9999 ]] ; then + sed -i "/^VERSION=/s@=.*@=${PV}@" Config/version.mk || die + fi + eautoreconf +} + +src_configure() { + local myconf=( + --bindir="${EPREFIX}"/bin + --libdir="${EPREFIX}"/usr/$(get_libdir) + --enable-etcdir="${EPREFIX}"/etc/zsh + --enable-runhelpdir="${EPREFIX}"/usr/share/zsh/${PV%_*}/help + --enable-fndir="${EPREFIX}"/usr/share/zsh/${PV%_*}/functions + --enable-site-fndir="${EPREFIX}"/usr/share/zsh/site-functions + --enable-function-subdirs + --with-tcsetpgrp + --with-term-lib="$(usex unicode 'tinfow ncursesw' 'tinfo ncurses')" + $(use_enable maildir maildir-support) + $(use_enable pcre) + $(use_enable caps cap) + $(use_enable unicode multibyte) + $(use_enable gdbm) + ) + + if use static ; then + myconf+=( --disable-dynamic ) + append-ldflags -static + fi + if use debug ; then + myconf+=( + --enable-zsh-debug + --enable-zsh-mem-debug + --enable-zsh-mem-warning + --enable-zsh-secure-free + --enable-zsh-hash-debug + ) + fi + + if [[ ${CHOST} == *-darwin* ]]; then + myconf+=( --enable-libs=-liconv ) + append-ldflags -Wl,-x + fi + + econf "${myconf[@]}" + + if use static ; then + # compile all modules statically, see Bug #27392 + # removed cap and curses because linking failes + sed -e "s,link=no,link=static,g" \ + -e "/^name=zsh\/cap/s,link=static,link=no," \ + -e "/^name=zsh\/curses/s,link=static,link=no," \ + -i "${S}"/config.modules || die + if ! use gdbm ; then + sed -i '/^name=zsh\/db\/gdbm/s,link=static,link=no,' \ + "${S}"/config.modules || die + fi + fi +} + +src_compile() { + default + + if [[ ${PV} == *9999 ]] && use doc ; then + emake -C Doc everything + fi +} + +src_test() { + # Fixes tests A03quoting.ztst B03print.ztst on musl + # Please refer: + # https://www.zsh.org/mla/workers/2021/msg00805.html + # Test E02xtrace fails on musl, so we are removing it. + # Closes: https://bugs.gentoo.org/833981 + if use elibc_musl ; then + unset LC_ALL + unset LC_COLLATE + unset LC_NUMERIC + unset LC_MESSAGES + unset LANG + rm "${S}"/Test/E02xtrace.ztst || die + fi + addpredict /dev/ptmx + local i + for i in C02cond.ztst V08zpty.ztst X02zlevi.ztst Y01completion.ztst Y02compmatch.ztst Y03arguments.ztst ; do + rm "${S}"/Test/${i} || die + done + emake check +} + +src_install() { + emake DESTDIR="${D}" install $(usex doc "install.info" "") + + insinto /etc/zsh + export PREFIX_QUOTE_CHAR='"' PREFIX_EXTRA_REGEX="/EUID/s,0,${EUID}," + newins "$(prefixify_ro "${FILESDIR}"/zprofile-4)" zprofile + + keepdir /usr/share/zsh/site-functions + insinto /usr/share/zsh/${PV%_*}/functions/Prompts + newins "${FILESDIR}"/prompt_gentoo_setup-1 prompt_gentoo_setup + + local i + + # install miscellaneous scripts (bug #54520) + sed -e "s:/usr/local/bin/perl:${EPREFIX}/usr/bin/perl:g" \ + -e "s:/usr/local/bin/zsh:${EPREFIX}/bin/zsh:g" \ + -i {Util,Misc}/* || die + for i in Util Misc ; do + insinto /usr/share/zsh/${PV%_*}/${i} + doins ${i}/* + done + + # install header files (bug #538684) + insinto /usr/include/zsh + doins config.h Src/*.epro + for i in Src/{zsh.mdh,*.h} ; do + sed -e 's@\.\./config\.h@config.h@' \ + -e 's@#\(\s*\)include "\([^"]\+\)"@#\1include <zsh/\2>@' \ + -i "${i}" + doins "${i}" + done + + dodoc ChangeLog* META-FAQ NEWS README config.modules + + if use doc ; then + pushd "${WORKDIR}/${PN}-${PV%_*}" >/dev/null + dodoc Doc/zsh.{dvi,pdf} + docinto html + dodoc Doc/*.html + popd >/dev/null + fi + + docinto StartupFiles + dodoc StartupFiles/z* +} + +pkg_postinst() { + if [[ -z ${REPLACING_VERSIONS} ]] ; then + echo + elog "If you want to enable Portage completions and Gentoo prompt," + elog "emerge app-shells/gentoo-zsh-completions and add" + elog " autoload -U compinit promptinit" + elog " compinit" + elog " promptinit; prompt gentoo" + elog "to your ~/.zshrc" + echo + elog "Also, if you want to enable cache for the completions, add" + elog " zstyle ':completion::complete:*' use-cache 1" + elog "to your ~/.zshrc" + echo + elog "Note that a system zprofile startup file is installed. This will override" + elog "PATH and possibly other variables that a user may set in ~/.zshenv." + elog "Custom PATH settings and similar overridden variables can be moved to ~/.zprofile" + elog "or other user startup files that are sourced after the system zprofile." + echo + elog "If PATH must be set in ~/.zshenv to affect things like non-login ssh shells," + elog "one method is to use a separate path-setting file that is conditionally sourced" + elog "in ~/.zshenv and also sourced from ~/.zprofile. For more information, see the" + elog "zshenv example in ${EROOT}/usr/share/doc/${PF}/StartupFiles/." + echo + elog "See https://wiki.gentoo.org/wiki/Zsh/HOWTO for more introduction documentation." + echo + fi +} |