Unbreak since we now have support for Unix 98 PTY functions.

This commit is contained in:
ajacoutot 2012-12-07 15:18:38 +00:00
parent 5e40039a1b
commit adc056a99a
5 changed files with 25 additions and 164 deletions

View File

@ -1,4 +1,4 @@
# $OpenBSD: Makefile,v 1.101 2012/09/29 13:14:05 ajacoutot Exp $
# $OpenBSD: Makefile,v 1.102 2012/12/07 15:18:38 ajacoutot Exp $
# Don't pull in x11/py-gtk2 on these archs; build fails with binutils 2.15
NOT_FOR_ARCHS-python= mips64 mips64el
@ -14,8 +14,8 @@ SHARED_LIBS+= vte 14.1 # 2609.0
FULLPKGNAME-main= vte-${GNOME_VERSION}
FULLPKGNAME-python= py-${DISTNAME}
REVISION-main = 8
REVISION-python = 5
REVISION-main = 9
REVISION-python = 6
CATEGORIES= devel
@ -39,22 +39,21 @@ WANTLIB += Xi Xinerama Xrandr Xrender Xxf86vm atk-1.0 cairo drm
WANTLIB += expat ffi fontconfig freetype gdk_pixbuf-2.0 gio-2.0
WANTLIB += glib-2.0 gmodule-2.0 gobject-2.0 gthread-2.0 m ncurses
WANTLIB += pango-1.0 pangocairo-1.0 pangoft2-1.0 pcre pixman-1
WANTLIB += png pthread-stubs stdc++ util xcb xcb-render xcb-shm z
WANTLIB += png pthread-stubs stdc++ xcb xcb-render xcb-shm z pthread
WANTLIB += harfbuzz icudata icule icuuc gdk-x11-2.0 gtk-x11-2.0
MODPY_RUNDEP= No
MULTI_PACKAGES= -main -python
WANTLIB-python= ${WANTLIB} gdk-x11-2.0 gtk-x11-2.0 vte>=14
WANTLIB-python= ${WANTLIB} vte
LIB_DEPENDS-python= ${LIB_DEPENDS-main} \
${BASE_PKGPATH}
RUN_DEPENDS-python= ${MODPY_RUN_DEPENDS} \
x11/py-gtk2
WANTLIB-main= ${WANTLIB} util
LIB_DEPENDS-main+= ${LIB_DEPENDS} \
x11/gtk+2
WANTLIB-main+= c pthread gdk-x11-2.0 gtk-x11-2.0
WANTLIB-main= ${WANTLIB} c
. if ! ${MACHINE_ARCH:Mmips64*}
BUILD_DEPENDS+= x11/py-gtk2
@ -63,16 +62,13 @@ CONFIGURE_ARGS+= --enable-python
MODGNOME_TOOLS= goi
AUTOCONF_VERSION= 2.65
AUTOMAKE_VERSION= 1.11
CONFIGURE_STYLE= autoconf
CONFIGURE_STYLE= gnu
CONFIGURE_ARGS+= --disable-Bsymbolic \
--disable-gnome-pty-helper \
--with-gtk=2.0 \
--program-suffix=2
post-install:
rm ${PREFIX}/lib/python${MODPY_VERSION}/site-packages/gtk-2.0/*.la
rm ${PREFIX}/lib/python${MODPY_VERSION}/site-packages/gtk-2.0/*.{a,la}
.include <bsd.port.mk>

View File

@ -1,36 +0,0 @@
$OpenBSD: patch-configure_in,v 1.2 2012/03/09 06:45:54 ajacoutot Exp $
From 116fe70d32c810ccd0bb226fc0c06c74e28db075 Mon Sep 17 00:00:00 2001
From: Martin Pieuchot <mpi@openbsd.org>
Date: Thu, 08 Mar 2012 20:53:52 +0000
Subject: pty: Support allocating PTYs through openpty on BSD
--- configure.in.orig Fri Mar 9 07:30:47 2012
+++ configure.in Fri Mar 9 07:31:07 2012
@@ -345,7 +345,7 @@ AC_SUBST(VTE_DEFAULT_EMULATION)
AM_CONDITIONAL(VTE_DEFAULT_EMULATION, [test "$emulation" != xterm])
# Check for headers.
-AC_CHECK_HEADERS(sys/select.h sys/syslimits.h sys/termios.h sys/un.h sys/wait.h stropts.h termios.h wchar.h)
+AC_CHECK_HEADERS(sys/select.h sys/syslimits.h sys/termios.h sys/un.h sys/wait.h stropts.h termios.h util.h wchar.h)
AC_HEADER_TIOCGWINSZ
# Check for PTY handling functions.
@@ -356,6 +356,7 @@ AC_CHECK_FUNCS([cfmakeraw fork setsid setpgid getpgid
AC_CHECK_FUNC(socket,[have_socket=1],AC_CHECK_LIB(socket,socket,[have_socket=1; LIBS="$LIBS -lsocket"]))
AC_CHECK_FUNC(socketpair,[have_socketpair=1],AC_CHECK_LIB(socket,socketpair,[have_socketpair=1; LIBS="$LIBS -lsocket"]))
AC_CHECK_FUNC(recvmsg,[have_recvmsg=1],AC_CHECK_LIB(socket,recvmsg,[have_recvmsg=1; LIBS="$LIBS -lsocket -lnsl"]))
+AC_CHECK_FUNC(openpty,[have_openpty=1],AC_CHECK_LIB(util,openpty,[have_openpty=1; LIBS="$LIBS -lutil"]))
if test x$have_socket = x1 ; then
AC_DEFINE(HAVE_SOCKET,1,[Define if you have the socket function.])
fi
@@ -364,6 +365,9 @@ if test x$have_socketpair = x1 ; then
fi
if test x$have_recvmsg = x1 ; then
AC_DEFINE(HAVE_RECVMSG,1,[Define if you have the recvmsg function.])
+fi
+if test x$have_openpty = x1 ; then
+ AC_DEFINE(HAVE_OPENPTY,1,[Define if you have the openpty function.])
fi
AC_CHECK_FUNC(floor,,AC_CHECK_LIB(m,floor,LIBS=["$LIBS -lm"]))
AC_CHECK_FUNCS([ceil floor])

View File

@ -1,109 +1,16 @@
$OpenBSD: patch-src_pty_c,v 1.11 2012/03/09 06:45:54 ajacoutot Exp $
From 116fe70d32c810ccd0bb226fc0c06c74e28db075 Mon Sep 17 00:00:00 2001
From: Martin Pieuchot <mpi@openbsd.org>
Date: Thu, 08 Mar 2012 20:53:52 +0000
Subject: pty: Support allocating PTYs through openpty on BSD
$OpenBSD: patch-src_pty_c,v 1.12 2012/12/07 15:18:38 ajacoutot Exp $
--- src/pty.c.orig Tue Aug 16 23:52:48 2011
+++ src/pty.c Fri Mar 9 07:31:07 2012
@@ -54,6 +54,9 @@
#include <termios.h>
#endif
#include <unistd.h>
+#ifdef HAVE_UTIL_H
+#include <util.h>
+#endif
#ifdef HAVE_STROPTS_H
#include <stropts.h>
#endif
@@ -81,6 +84,12 @@ static pid_t _vte_pty_helper_pid = -1;
static int _vte_pty_helper_tunnel = -1;
#endif
+#if defined(HAVE_PTSNAME_R) || defined(HAVE_PTSNAME) || defined(TIOCGPTN)
+#define HAVE_UNIX98_PTY
+#else
+#undef HAVE_UNIX98_PTY
+#endif
+
/* Reset the handlers for all known signals to their defaults. The parent
* (or one of the libraries it links to) may have changed one to be ignored. */
static void
@@ -734,6 +743,8 @@ vte_pty_get_size(VtePty *pty,
}
}
+#if defined(HAVE_UNIX98_PTY)
+
/*
* _vte_pty_ptsname:
* @master: file descriptor to the PTY master
@@ -951,6 +962,44 @@ _vte_pty_open_unix98(VtePty *pty,
return TRUE;
}
+#elif defined(HAVE_OPENPTY)
+
+/*
+ * _vte_pty_open_bsd:
+ * @pty: a #VtePty
+ * @error: a location to store a #GError, or %NULL
+ *
+ * Opens new file descriptors to a new PTY master and slave.
+ *
+ * Returns: %TRUE on success, %FALSE on failure with @error filled in
+ */
+static gboolean
+_vte_pty_open_bsd(VtePty *pty,
+ GError **error)
+{
+ VtePtyPrivate *priv = pty->priv;
+ int parentfd, childfd;
+
+ if (openpty(&parentfd, &childfd, NULL, NULL, NULL) != 0) {
+ int errsv = errno;
+ g_set_error(error, VTE_PTY_ERROR, VTE_PTY_ERROR_PTY98_FAILED,
+ "%s failed: %s", "openpty", g_strerror(errsv));
+ errno = errsv;
+ return FALSE;
+ }
+
+ priv->pty_fd = parentfd;
+ priv->child_setup_data.mode = TTY_OPEN_BY_FD;
+ priv->child_setup_data.tty.fd = childfd;
+ priv->using_helper = FALSE;
+
+ return TRUE;
+}
+
+#else
+#error Have neither UNIX98 PTY nor BSD openpty!
+#endif /* HAVE_UNIX98_PTY */
+
#ifdef VTE_USE_GNOME_PTY_HELPER
#ifdef HAVE_RECVMSG
static void
@@ -1511,7 +1560,7 @@ vte_pty_initable_init (GInitable *initable,
}
g_error_free(err);
- /* Fall back to unix98 PTY */
+ /* Fall back to unix98 or bsd PTY */
}
+++ src/pty.c Tue Dec 4 09:38:06 2012
@@ -816,11 +816,7 @@ _vte_pty_getpt(GError **error)
/* Call the system's function for allocating a pty. */
fd = getpt();
#else
if (priv->flags & VTE_PTY_NO_FALLBACK) {
@@ -1521,7 +1570,13 @@ vte_pty_initable_init (GInitable *initable,
}
#endif /* VTE_USE_GNOME_PTY_HELPER */
+#if defined(HAVE_UNIX98_PTY)
ret = _vte_pty_open_unix98(pty, error);
+#elif defined(HAVE_OPENPTY)
+ ret = _vte_pty_open_bsd(pty, error);
+#else
+#error Have neither UNIX98 PTY nor BSD openpty!
+#endif
out:
_vte_debug_print(VTE_DEBUG_PTY,
- /* Try to allocate a pty by accessing the pty master multiplex. */
- fd = open("/dev/ptmx", O_RDWR | O_NOCTTY);
- if ((fd == -1) && (errno == ENOENT)) {
- fd = open("/dev/ptc", O_RDWR | O_NOCTTY); /* AIX */
- }
+ fd = posix_openpt(O_RDWR | O_NOCTTY);
#endif
if (fd == -1) {
g_set_error (error, VTE_PTY_ERROR,

View File

@ -1,12 +1,10 @@
$OpenBSD: patch-src_table_c,v 1.1 2012/05/29 20:31:40 jasper Exp $
$OpenBSD: patch-src_table_c,v 1.2 2012/12/07 15:18:38 ajacoutot Exp $
From feeee4b5832b17641e505b7083e0d299fdae318e Mon Sep 17 00:00:00 2001
From: Christian Persch <chpe@gnome.org>
Date: Sat, 19 May 2012 19:36:09 +0200
Subject: [PATCH] emulation: Limit integer arguments to 65535
https://bugzilla.gnome.org/show_bug.cgi?id=676090
--- src/table.c.orig Tue Aug 16 23:52:48 2011
+++ src/table.c Tue May 29 22:22:59 2012
@@ -550,7 +550,7 @@ _vte_table_extract_numbers(GValueArray **array,

View File

@ -1,19 +1,15 @@
$OpenBSD: patch-src_vteseq_c,v 1.2 2012/05/29 20:31:40 jasper Exp $
$OpenBSD: patch-src_vteseq_c,v 1.3 2012/12/07 15:18:38 ajacoutot Exp $
Chunk 1:
From feeee4b5832b17641e505b7083e0d299fdae318e Mon Sep 17 00:00:00 2001
From: Christian Persch <chpe@gnome.org>
Date: Sat, 19 May 2012 19:36:09 +0200
Subject: [PATCH] emulation: Limit integer arguments to 65535
Chunk 2:
From 98ce2f265f986fb88c38d508286bb5e3716b9e74 Mon Sep 17 00:00:00 2001
From: Christian Persch <chpe@gnome.org>
Date: Sat, 19 May 2012 20:04:12 +0200
Subject: [PATCH] emulation: Limit repetitions
Both address: https://bugzilla.gnome.org/show_bug.cgi?id=676090
--- src/vteseq.c.orig Tue May 29 22:24:06 2012
+++ src/vteseq.c Tue May 29 22:23:59 2012
@@ -557,7 +557,7 @@ vte_sequence_handler_multiple(VteTerminal *terminal,