Subject: Re: pkg/34718: Patches for aterm
To: None <pkg-manager@netbsd.org, gnats-admin@netbsd.org,>
From: Christian Biere <christianbiere@gmx.de>
List: pkgsrc-bugs
Date: 10/09/2006 02:15:08
The following reply was made to PR pkg/34718; it has been noted by GNATS.

From: Christian Biere <christianbiere@gmx.de>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: pkg/34718: Patches for aterm
Date: Mon, 9 Oct 2006 04:11:33 +0200

 >  >  - The option "ptmx" was added to indicate support of Unix98 PTYs
 >  >    (/dev/ptmx). It would be better to patch the configure script
 >  >    of course. aterm doesn't detect it but has it hardcoded to
 >  >    certain systems. Without this aterm doesn't work properly on
 >  >    NetBSD(-current) at least not with PTYFS because it runs out
 >  >    ptys after 2-3 terminals.
 
 I've patched aterm to detect posix_openpt() and use it if available.
 Thus, a pkgsrc option is no longer required. I also think --enable-ttygid
 should always be used (just like for rxvt). aterm ignores if there's
 no group "tty" at runtime and there's no further effect. However, without
 this option the pty is stays world-writable (on many systems).
 
 Here's the complete updated patch for x11/aterm:
 
 --- x11/aterm/Makefile	4 Oct 2006 22:06:56 -0000	1.30
 +++ x11/aterm/Makefile	9 Oct 2006 02:03:57 -0000
 @@ -15,36 +15,15 @@
  
  GNU_CONFIGURE=	YES
  
 -CONFIGURE_ARGS+=--enable-background-image \
 -		--enable-transparency \
 +CONFIGURE_ARGS+=--enable-transparency \
  		--enable-fading \
 -		--enable-graphics \
 -		--with-xpm \
 -		--with-xpm-includes=${BUILDLINK_PREFIX.xpm}/include \
 -		--with-xpm-library=${BUILDLINK_PREFIX.xpm}/lib \
 -		--with-jpeg \
 -		--with-jpeg-includes=${BUILDLINK_PREFIX.jpeg}/include \
 -		--with-jpeg-library=${BUILDLINK_PREFIX.jpeg}/lib \
 -		--with-png \
 -		--with-png-library=${BUILDLINK_PREFIX.png}/lib \
 -		--with-png-includes=${BUILDLINK_PREFIX.png}/include \
  		--enable-utmp \
 -		--enable-wtmp
 -
 -.include "options.mk"
 +		--enable-wtmp \
 +		--enable-ttygid
  
  .include "../../mk/bsd.prefs.mk"
  
 -.if ${OPSYS:M*BSD} || ${OPSYS} == "Darwin"
 -# Make aterm setuid root so that tty ownership setting and utmp logging
 -# function correctly.
 -#
 -CONFIGURE_ARGS+=	--enable-ttygid
 -SPECIAL_PERMS=		${PREFIX}/bin/aterm ${SETUID_ROOT_PERMS}
 -.endif
 -
 -.include "../../graphics/jpeg/buildlink3.mk"
 -.include "../../graphics/png/buildlink3.mk"
 -.include "../../graphics/xpm/buildlink3.mk"
 +.include "options.mk"
  
 +.include "../../mk/x11.buildlink3.mk"
  .include "../../mk/bsd.pkg.mk"
 --- x11/aterm/distinfo	1 Jan 2006 12:58:00 -0000	1.10
 +++ x11/aterm/distinfo	9 Oct 2006 02:03:57 -0000
 @@ -5,3 +5,5 @@
  Size (aterm-1.0.0.tar.bz2) = 248708 bytes
  SHA1 (patch-ac) = 28c79343079680251a013ec3fe364b01f5a5ccac
  SHA1 (patch-ad) = 0c87ee69672e98189afa2cfdcdd9691a1571f354
 +SHA1 (patch-ae) = 56ac79c51fa19089d15ab24a7bf3de8f6116a8b5
 +SHA1 (patch-af) = e2533179edaf6ca2781b5cd41d94624ab3e9d3f9
 --- x11/aterm/options.mk	5 Oct 2005 13:29:49 -0000	1.2
 +++ x11/aterm/options.mk	9 Oct 2006 02:03:57 -0000
 @@ -2,6 +2,12 @@
  
  PKG_OPTIONS_VAR=	PKG_OPTIONS.aterm
  PKG_SUPPORTED_OPTIONS=	aterm-big5 aterm-greek aterm-kanji aterm-xterm-scroll
 +PKG_SUPPORTED_OPTIONS+=	aterm-afterstep aterm-suid
 +PKG_SUGGESTED_OPTIONS=
 +
 +.if ${OPSYS:M*BSD} || ${OPSYS} == "Darwin"
 +PKG_SUGGESTED_OPTIONS+=	aterm-suid
 +.endif
  
  .include "../../mk/bsd.options.mk"
  
 @@ -20,3 +26,37 @@
  .if !empty(PKG_OPTIONS:Materm-xterm-scroll)
  CONFIGURE_ARGS+=--enable-xterm-scroll
  .endif
 +
 +.if !empty(PKG_OPTIONS:Materm-afterstep)
 +CONFIGURE_ARGS+=--with-afterimage-config=${BUILDLINK_PREFIX.afterstep}/bin \
 +		--with-afterstep-config=${BUILDLINK_PREFIX.afterstep}/bin \
 +		--enable-background-image \
 +		--enable-jpeg \
 +		--with-jpeg-includes=${BUILDLINK_PREFIX.jpeg}/include \
 +		--with-jpeg-library=${BUILDLINK_PREFIX.jpeg}/lib \
 +		--enable-png \
 +		--with-png-library=${BUILDLINK_PREFIX.png}/lib \
 +		--with-png-includes=${BUILDLINK_PREFIX.png}/include \
 +		--enable-xpm \
 +		--with-xpm-includes=${BUILDLINK_PREFIX.xpm}/include \
 +		--with-xpm-library=${BUILDLINK_PREFIX.xpm}/lib
 +
 +.include "../../graphics/jpeg/buildlink3.mk"
 +.include "../../graphics/png/buildlink3.mk"
 +.include "../../graphics/xpm/buildlink3.mk"
 +.include "../../wm/afterstep/buildlink3.mk"
 +.else
 +CONFIGURE_ARGS+=--without-afterstep-config \
 +		--without-afterimage-config \
 +		--disable-background-image \
 +		--disable-jpeg \
 +		--disable-png \
 +		--disable-xpm
 +.endif
 +
 +.if !empty(PKG_OPTIONS:Materm-suid)
 +# Make aterm setuid root so that tty ownership setting and utmp logging
 +# function correctly.
 +#
 +SPECIAL_PERMS=		${PREFIX}/bin/aterm ${SETUID_ROOT_PERMS}
 +.endif
 --- mk/defaults/options.description	24 Sep 2006 16:22:42 -0000	1.117
 +++ mk/defaults/options.description	9 Oct 2006 02:06:11 -0000
 @@ -15,7 +15,9 @@
  aspell	
  aterm-big5		Enable Chinese support.
  aterm-greek		Enable Greek keyboard support.
 +aterm-afterstep		Enable AfterStep integration.
  aterm-kanji		Enable kanji support.
 +aterm-suid		Install aterm executable setuid root.
  aterm-xterm-scroll	Use xterm-scrollbar instead of a NeXT-like one.
  audiofile	
  authlib	
 @@ -215,7 +217,7 @@
  pcb-motif		Use Motif for the gui instead of GTK for cad/pcb.
  pcre	
  perf-tuning	
 -perl	
 +perl			Enable Perl support.
  pf	
  pgsql			Enable PostgreSQL support.
  pinfo-native-curses	Use NetBSD native curses rather than ncurses.
 @@ -359,6 +361,7 @@
  xorg-server-vga	
  xorg-server-via	
  xorg-server-vmware	
 +xpm			Enable XPM support.
  xrender			Enable Xrender support.
  xscreensaver-webcollage	Install webcollage screensaver.
  xterm-256color		Enable 256 color support.
 --- /dev/null	2006-10-09 03:49:53.000000000 +0200
 +++ x11/aterm/patches/patch-ae	2006-10-09 03:20:21.000000000 +0200
 @@ -0,0 +1,56 @@
 +$NetBSD$
 +
 +--- autoconf/config.h.in	2004-11-11 00:40:13.000000000 +0100
 ++++ autoconf/config.h.in	2006-10-09 03:16:17.000000000 +0200
 +@@ -28,6 +28,9 @@
 + /* Define to 1 if you have the `getpt' function. */
 + #undef HAVE_GETPT
 + 
 ++/* Define to 1 if you have the `posix_openpt' function. */
 ++#undef HAVE_POSIX_OPENPT
 ++
 + /* Define to 1 if you have the <grp.h> header file. */
 + #undef HAVE_GRP_H
 + 
 +--- autoconf/configure.in	2005-07-05 17:30:15.000000000 +0200
 ++++ autoconf/configure.in	2006-10-09 03:13:37.000000000 +0200
 +@@ -423,7 +423,7 @@
 + 
 + AC_HEADER_TIME
 + 
 +-AC_CHECK_FUNCS(getpt)
 ++AC_CHECK_FUNCS(getpt posix_openpt)
 + 
 + AC_C_CONST
 + AC_C_INLINE
 +--- configure	2005-07-05 17:30:15.000000000 +0200
 ++++ configure	2006-10-09 03:13:23.000000000 +0200
 +@@ -7048,7 +7048,7 @@
 + 
 + 
 + 
 +-for ac_func in getpt
 ++for ac_func in getpt posix_openpt
 + do
 + as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
 + echo "$as_me:$LINENO: checking for $ac_func" >&5
 +--- src/command.c	2005-06-21 22:08:16.000000000 +0200
 ++++ src/command.c	2006-10-09 03:17:53.000000000 +0200
 +@@ -542,13 +542,16 @@
 +     ptydev = ttydev = _getpty(&fd, O_RDWR | O_NDELAY, 0622, 0);
 +     if (ptydev == NULL)
 + 	goto Failed;
 +-#elif defined (__svr4__) || defined(__CYGWIN32__) || defined(__lnx21__)
 ++#elif defined (__svr4__) || defined(__CYGWIN32__) || defined(__lnx21__) \
 ++	|| defined(HAVE_POSIX_OPENPT)
 +     {
 + 	extern char    *ptsname();
 + 
 +     /* open the STREAMS, clone device /dev/ptmx (master pty) */
 + #ifdef HAVE_GETPT
 + 	if ((fd = getpt()) < 0) {
 ++#elif defined(HAVE_POSIX_OPENPT)
 ++	if ((fd = posix_openpt(O_RDWR)) < 0) {
 + #else
 + 	if ((fd = open("/dev/ptmx", O_RDWR)) < 0) {
 + #endif
 --- /dev/null	2006-10-09 03:49:53.000000000 +0200
 +++ x11/aterm/patches/patch-af	2006-10-05 04:25:19.000000000 +0200
 @@ -0,0 +1,21 @@
 +$NetBSD$
 +
 +--- src/main.c	2005-06-20 18:10:19.000000000 +0200
 ++++ src/main.c	2006-10-05 03:36:49.000000000 +0200
 +@@ -1037,12 +1037,16 @@
 + 	XConfigureEvent *xconf = &(ev->xconfigure);
 + 	
 + 	while( XCheckTypedWindowEvent( Xdisplay, TermWin.parent, ConfigureNotify, ev ) );
 ++#if !defined(NO_DEBUG_OUTPUT)
 + 	fprintf( stderr, "config_geom = %dx%d\n", xconf->width, xconf->height );
 ++#endif
 +     resize_window1(xconf->width, xconf->height);
 + #if 1
 + 	XTranslateCoordinates (Xdisplay, TermWin.parent, Xroot, 0, 0, &root_x, &root_y, &wdumm);
 + 
 ++#if !defined(NO_DEBUG_OUTPUT)
 + 	fprintf( stderr, "root_geom = %dx%d%+d%+d, root_size = %dx%d\n", xconf->width, xconf->height, root_x, root_y, XdisplayWidth, XdisplayHeight ); 
 ++#endif
 + 	TermWin.root_x = root_x ; 
 + 	TermWin.root_y = root_y ; 
 + 	TermWin.root_width = xconf->width ; 
 
 -- 
 Christian