Subject: 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/05/2006 02:50:00
>Number:         34718
>Category:       pkg
>Synopsis:       Patches for aterm
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    pkg-manager
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Thu Oct 05 02:50:00 +0000 2006
>Originator:     Christian Biere
>Release:        NetBSD 4.99.3
>Environment:
System: NetBSD cyclonus 4.99.3 NetBSD 4.99.3 (STARSCREAM) #0: Mon Oct 2 23:04:22 CEST 2006 src@cyclonus:/o/NetBSD/obj/sys/arch/i386/compile/STARSCREAM i386
Architecture: i386
Machine: i386
>Description:
The following patches cause the following changes:

 - The configure options --enable-graphics is remove, it had no effect.

 - Support for JPEG/PNG/XPM which is used for --enable-background-image
   can be disabled individually.[1]

 - I added the option "setuid-root" because this is unnecessary on
   most modern systems (even BSDs) and potentially dangerous.

 - 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.

[1] These are actually ineffective because there's a missing dependency:
<snip>
checking installed libAfterImage... afterimage-config: not found
NO: not found
afterimage-config not found - no AfterStep integration available.
AfterStep integration
To enable background image support you will need to download and install
libAfterImage from ftp://ftp.afterstep.org/stable/libAfterImage/ and then re-run this script.
<snip>

I just wanted to disable them anyway to keep aterm light-weight, so I
don't mind this issue. A dependency on wm/afterstep would probably
fix this but I don't think installing Afterstep is really desired
in general.

>How-To-Repeat:
>Fix:

Index: Makefile
===================================================================
RCS file: /cvsroot/pkgsrc/x11/aterm/Makefile,v
retrieving revision 1.30
diff -u -r1.30 Makefile
--- Makefile	4 Oct 2006 22:06:56 -0000	1.30
+++ Makefile	5 Oct 2006 02:23:17 -0000
@@ -18,33 +18,12 @@
 CONFIGURE_ARGS+=--enable-background-image \
 		--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"
-
 .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"
Index: distinfo
===================================================================
RCS file: /cvsroot/pkgsrc/x11/aterm/distinfo,v
retrieving revision 1.10
diff -u -r1.10 distinfo
--- distinfo	1 Jan 2006 12:58:00 -0000	1.10
+++ distinfo	5 Oct 2006 02:23:17 -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) = b239ab1b285cec3da463d0aba37009a7d3c2d0bb
+SHA1 (patch-af) = e2533179edaf6ca2781b5cd41d94624ab3e9d3f9
Index: options.mk
===================================================================
RCS file: /cvsroot/pkgsrc/x11/aterm/options.mk,v
retrieving revision 1.2
diff -u -r1.2 options.mk
--- options.mk	5 Oct 2005 13:29:49 -0000	1.2
+++ options.mk	5 Oct 2006 02:23:17 -0000
@@ -1,7 +1,12 @@
 # $NetBSD: options.mk,v 1.2 2005/10/05 13:29:49 wiz Exp $
 
 PKG_OPTIONS_VAR=	PKG_OPTIONS.aterm
-PKG_SUPPORTED_OPTIONS=	aterm-big5 aterm-greek aterm-kanji aterm-xterm-scroll
+PKG_SUPPORTED_OPTIONS=	aterm-big5 aterm-greek aterm-kanji aterm-xterm-scroll jpeg png xpm setuid-root ptmx
+PKG_SUGGESTED_OPTIONS=	jpeg png xpm
+
+.if ${OPSYS:M*BSD} || ${OPSYS} == "Darwin"
+PKG_SUGGESTED_OPTIONS+=	setuid-root
+.endif
 
 .include "../../mk/bsd.options.mk"
 
@@ -20,3 +25,36 @@
 .if !empty(PKG_OPTIONS:Materm-xterm-scroll)
 CONFIGURE_ARGS+=--enable-xterm-scroll
 .endif
+
+.if !empty(PKG_OPTIONS:Mjpeg)
+.include "../../graphics/jpeg/buildlink3.mk"
+CONFIGURE_ARGS+=--enable-jpeg \
+		--with-jpeg-includes=${BUILDLINK_PREFIX.jpeg}/include \
+		--with-jpeg-library=${BUILDLINK_PREFIX.jpeg}/lib
+.endif
+
+.if !empty(PKG_OPTIONS:Mpng)
+.include "../../graphics/png/buildlink3.mk"
+CONFIGURE_ARGS+=--enable-png \
+		--with-png-library=${BUILDLINK_PREFIX.png}/lib \
+		--with-png-includes=${BUILDLINK_PREFIX.png}/include
+.endif
+
+.if !empty(PKG_OPTIONS:Mxpm)
+.include "../../graphics/xpm/buildlink3.mk"
+CONFIGURE_ARGS+=--enable-xpm \
+		--with-xpm-includes=${BUILDLINK_PREFIX.xpm}/include \
+		--with-xpm-library=${BUILDLINK_PREFIX.xpm}/lib
+.endif
+
+.if !empty(PKG_OPTIONS:Msetuid-root)
+# 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
+
+.if !empty(PKG_OPTIONS:Mptmx)
+CPPFLAGS+=	-DATERM_USE_DEV_PTMX
+.endif
--- /dev/null	2006-10-05 04:22:41.000000000 +0200
+++ patches/patch-ae	2006-10-05 03:41:09.000000000 +0200
@@ -0,0 +1,14 @@
+$NetBSD$
+
+--- src/command.c	2005-06-21 22:08:16.000000000 +0200
++++ src/command.c	2006-10-05 02:38:03.000000000 +0200
+@@ -542,7 +542,8 @@
+     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(ATERM_USE_DEV_PTMX)
+     {
+ 	extern char    *ptsname();
+ 
--- /dev/null	2006-10-05 04:22:41.000000000 +0200
+++ patches/patch-af	2006-10-05 03:42:26.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 ;