replace the zpty patch which merged to zsh upstream

This commit is contained in:
SquallATF 2021-01-22 16:17:36 +08:00
parent facef7ad05
commit 27691f9941
3 changed files with 67 additions and 38 deletions

View File

@ -3,7 +3,7 @@
pkgbase=zsh
pkgname=('zsh' 'zsh-doc')
pkgver=5.8
pkgrel=4
pkgrel=5
arch=('i686' 'x86_64')
url='https://www.zsh.org/'
license=('custom')
@ -19,7 +19,7 @@ source=("https://www.zsh.org/pub/zsh-${pkgver}.tar.xz"{,.asc}
msysize.patch
zsh-5.0.6-1.patch
msys-symlink-hack.patch
fix-zpty-module.patch)
make-zpty-module-work-on-Cygwin.patch)
sha256sums=('dcc4b54cc5565670a65581760261c163d720991f0d06486da61f8d839b52de27'
'SKIP'
'9b4e939593cb5a76564d2be2e2bfbb6242509c0c56fd9ba52f5dba6cf06fdcc4'
@ -33,7 +33,7 @@ sha256sums=('dcc4b54cc5565670a65581760261c163d720991f0d06486da61f8d839b52de27'
'b879d33cc60fc0c44361189eef1ee95a3bd0b8f9e8b32c81e439950483c151aa'
'336a8e6e93b778e7aec27348619b7200e0a75e5cf14dce720afd9dd6f836ea2c'
'de515b0d86c13c29a663b4ba0fdb338dea83f82f145cf8c4da78d30369f963e4'
'3aa6a7c2e67bcd51c5bf1890c26b221171e9baae3adfc661e2a2882c302f562a')
'7fae853240d14e6b2c271f820ca983149407900d7b8e7eed53b641608b6d6aec')
validpgpkeys=('F7B2754C7DE2830914661F0EA71D9A9D4BDB27B3'
'E96646BE08C0AF0AA0F90788A5FEEE3AC7937444'
'7CA7ECAAF06216B90F894146ACF8146CAE8CBBC4')
@ -45,8 +45,8 @@ prepare() {
patch -p1 -i "${srcdir}/msysize.patch"
patch -p1 -i "${srcdir}/zsh-5.0.6-1.patch"
patch -p1 -i "${srcdir}/msys-symlink-hack.patch"
# https://cygwin.com/pipermail/cygwin-developers/2021-January/012030.html
patch -p1 -i "${srcdir}/fix-zpty-module.patch"
# https://sourceforge.net/p/zsh/code/ci/bf8ca5f019fa9fd585a7480a3d4198719369df92
patch -p1 -i "${srcdir}/make-zpty-module-work-on-Cygwin.patch"
autoreconf -fiv

View File

@ -1,33 +0,0 @@
diff --git a/Src/Modules/zpty.c b/Src/Modules/zpty.c
index 45fd15ee0..eadb7ceac 100644
--- a/Src/Modules/zpty.c
+++ b/Src/Modules/zpty.c
@@ -428,6 +428,7 @@ newptycmd(char *nam, char *pname, char **args, int echo, int nblock)
mypid = 0; /* trick to ensure we _exit() */
zexit(lastval, ZEXIT_NORMAL);
}
+#ifndef __CYGWIN__
master = movefd(master);
if (master == -1) {
zerrnam(nam, "cannot duplicate fd %d: %e", master, errno);
@@ -435,6 +436,7 @@ newptycmd(char *nam, char *pname, char **args, int echo, int nblock)
ineval = oineval;
return 1;
}
+#endif
p = (Ptycmd) zalloc(sizeof(*p));
diff --git a/configure.ac b/configure.ac
index bd1b40225..3b0cc1f53 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2504,7 +2504,7 @@ if test x$ac_cv_have_dev_ptmx = xyes -o x$ac_cv_func_posix_openpt = xyes && \
test x$ac_cv_func_ptsname = xyes; then
AC_CACHE_CHECK([if /dev/ptmx is usable],
ac_cv_use_dev_ptmx,
- [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#ifdef __linux
+ [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#if defined(__linux) || defined(__CYGWIN__)
#define _GNU_SOURCE 1
#endif
#include <stdlib.h>

View File

@ -0,0 +1,62 @@
From 8bba531ab5122a8236264f3b758911ad6a4accb2 Mon Sep 17 00:00:00 2001
From: Peiyuan Song <squallatf@gmail.com>
Date: Wed, 20 Jan 2021 13:33:52 +0900
Subject: [PATCH] 47840: make zpty module work on Cygwin
---
Src/Modules/zpty.c | 11 +++++++++++
configure.ac | 2 +-
2 files changed, 12 insertions(+), 1 deletion(-)
diff --git a/Src/Modules/zpty.c b/Src/Modules/zpty.c
index 45fd15ee0..dfd2a2a7a 100644
--- a/Src/Modules/zpty.c
+++ b/Src/Modules/zpty.c
@@ -30,6 +30,13 @@
#include "zpty.mdh"
#include "zpty.pro"
+#ifdef __CYGWIN__
+#include <cygwin/version.h>
+#if defined(CYGWIN_VERSION_DLL_MAJOR) && CYGWIN_VERSION_DLL_MAJOR<3002
+#define USE_CYGWIN_FIX 1
+#endif
+#endif
+
/* The number of bytes we normally read when given no pattern and the
* upper bound on the number of bytes we read (even if we are give a
* pattern). */
@@ -428,6 +435,7 @@ newptycmd(char *nam, char *pname, char **args, int echo, int nblock)
mypid = 0; /* trick to ensure we _exit() */
zexit(lastval, ZEXIT_NORMAL);
}
+#ifndef USE_CYGWIN_FIX
master = movefd(master);
if (master == -1) {
zerrnam(nam, "cannot duplicate fd %d: %e", master, errno);
@@ -435,6 +443,9 @@ newptycmd(char *nam, char *pname, char **args, int echo, int nblock)
ineval = oineval;
return 1;
}
+#else
+ addmodulefd(master, FDT_INTERNAL);
+#endif
p = (Ptycmd) zalloc(sizeof(*p));
diff --git a/configure.ac b/configure.ac
index f2d65ecfc..a968cfa9c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2504,7 +2504,7 @@ if test x$ac_cv_have_dev_ptmx = xyes -o x$ac_cv_func_posix_openpt = xyes && \
test x$ac_cv_func_ptsname = xyes; then
AC_CACHE_CHECK([if /dev/ptmx is usable],
ac_cv_use_dev_ptmx,
- [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#ifdef __linux
+ [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#if defined(__linux) || defined(__CYGWIN__)
#define _GNU_SOURCE 1
#endif
#include <stdlib.h>
--
2.30.0