Subject: pkg/10332: pkgsrc/lang/icon sparc support
To: None <gnats-bugs@gnats.netbsd.org>
From: None <dholland@eecs.harvard.edu>
List: netbsd-bugs
Date: 06/09/2000 14:33:13
>Number:         10332
>Category:       pkg
>Synopsis:       pkgsrc/lang/icon sparc support
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    pkg-manager
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Fri Jun 09 14:34:00 PDT 2000
>Closed-Date:
>Last-Modified:
>Originator:     David A. Holland <dholland@eecs.harvard.edu>
>Release:        current pkgsrc of 20000608
>Organization:
   - David A. Holland
     dholland@eecs.harvard.edu
>Environment:
	
System: NetBSD chihuahua.eecs.harvard.edu 1.4.2 NetBSD 1.4.2 (GENERIC) #2: Thu Mar 16 00:08:53 PST 2000 toddpw@threepio.toddpw.net:/usr/src/sys/arch/sparc/compile/GENERIC sparc


>Description:

	The icon port only supported i386 and alpha. I have updated it
	to handle sparc as well.

	The resulting install passes its tests and appears to work.

>How-To-Repeat:

	N/A

>Fix:

(1) Apply the first patch to the existing port.
(2) Add the second patch below as one of the port's patches to
apply at build time. (The two are separated by a "CUT HERE".)
(3) make makepatchsum. :-)

  --- CUT HERE ---


Index: lang/icon/Makefile
===================================================================
RCS file: /cvsroot/pkgsrc/lang/icon/Makefile,v
retrieving revision 1.15
diff -u -r1.15 Makefile
--- Makefile	2000/04/05 14:32:51	1.15
+++ Makefile	2000/06/09 21:03:11
@@ -11,7 +11,7 @@
 MAINTAINER=		packages@netbsd.org
 HOMEPAGE=		http://www.cs.arizona.edu/icon/index.htm
 
-ONLY_FOR_PLATFORM=	NetBSD-*-alpha NetBSD-*-i386
+ONLY_FOR_PLATFORM=	NetBSD-*-alpha NetBSD-*-i386 NetBSD-*-sparc
 
 DIST_SUBDIR=		${PKGNAME}
 NO_WRKSUBDIR=		yes
Index: lang/icon/patches/patch-ay
===================================================================
RCS file: /cvsroot/pkgsrc/lang/icon/patches/patch-ay,v
retrieving revision 1.2
diff -u -r1.2 patch-ay
--- patch-ay	1998/08/07 11:09:10	1.2
+++ patch-ay	2000/06/09 21:03:11
@@ -6,12 +6,20 @@
 +DEFINES= -DZPIPE
 --- src/common/save.c	1997/10/02 07:49:07	1.1
 +++ src/common/save.c	1997/10/02 08:00:57
-@@ -91,7 +91,11 @@
+@@ -80,6 +80,7 @@
+ 
+ #ifdef GenericBSD
+ #include <a.out.h>
++#include <sys/param.h>
+ wrtexec(ef)
+ int ef;
+ {
+@@ -91,7 +92,11 @@
      * Construct the header.  The text and data region sizes must be multiples
      *  of 1024.
      */
 +#ifdef __NetBSD__
-+   N_SETMAGIC(hdr, ZMAGIC, MID_I386, EX_DYNAMIC);
++   N_SETMAGIC(hdr, ZMAGIC, MID_MACHINE, EX_DYNAMIC);
 +#else
     hdr.a_magic = ZMAGIC;
 +#endif
Index: lang/icon/scripts/configure
===================================================================
RCS file: /cvsroot/pkgsrc/lang/icon/scripts/configure,v
retrieving revision 1.4
diff -u -r1.4 configure
--- configure	1998/08/07 11:09:18	1.4
+++ configure	2000/06/09 21:03:11
@@ -3,4 +3,4 @@
 # $NetBSD: configure,v 1.4 1998/08/07 11:09:18 agc Exp $
 #
 
-cd ${WRKSRC}; make Configure name=`uname -m| sed -e 's/i386/intel/'`_`uname -s|tr '[A-Z]' '[a-z]'`
+cd ${WRKSRC}; make Configure name=`uname -m| sed -e 's/i386/intel/;s/sparc/sun/'`_`uname -s|tr '[A-Z]' '[a-z]'`


  --- CUT HERE ---

$NetBSD$

diff -u /dev/null config/unix/sun_netbsd/common.hdr
--- /dev/null	Thu Jan  1 00:00:00 1970
+++ config/unix/sun_netbsd/common.hdr	Thu Jun  8 22:10:28 2000
@@ -0,0 +1,10 @@
+#  The -D$D option to CFLAGS makes it possible to specify a definition
+#  at the Make command level without revising the Makefile, as
+#  in
+#
+#	make D=Debug
+#
+D=NOTHING
+CFLAGS+= -D$D
+SHELL=/bin/sh
+RSWITCH=rswitch.c
diff -u /dev/null config/unix/sun_netbsd/copybin.c
--- /dev/null	Thu Jan  1 00:00:00 1970
+++ config/unix/sun_netbsd/copybin.c	Thu Jun  8 22:10:28 2000
@@ -0,0 +1,3 @@
+#include "../../../src/h/define.h"
+#include "paths.h"
+#include "../Generic/copybin.h"
diff -u /dev/null config/unix/sun_netbsd/define.h
--- /dev/null	Thu Jan  1 00:00:00 1970
+++ config/unix/sun_netbsd/define.h	Thu Jun  8 22:17:12 2000
@@ -0,0 +1,30 @@
+#define Standard
+#define IconGcvt
+#define index strchr
+#define rindex strrchr
+#define GetHost
+#define MaxHdr 13400
+#define MaxStatSize 20480
+
+#define GenericBSD
+#define BSD_4_4_LITE    1	/* This is new, for 4.4Lite specific stuff */
+#define UNIX 1
+#define LoadFunc
+#define ExecImages
+
+#define KeyboardFncs
+#define HaveTioc
+#define USE_OLD_TTY
+#define AllowConst
+#define SysOpt
+#define CComp "gcc"
+#define COpts "-O2"
+
+/* Sun parameters */
+/*#define SUN*/
+#define ZERODIVIDE
+
+/* CPU architecture */
+#define Double
+#define StackAlign 8
+
diff -u /dev/null config/unix/sun_netbsd/icon_pi.c
--- /dev/null	Thu Jan  1 00:00:00 1970
+++ config/unix/sun_netbsd/icon_pi.c	Thu Jun  8 22:10:28 2000
@@ -0,0 +1,2 @@
+#include "paths.h"
+#include "../Generic/icon_pi.h"
diff -u /dev/null config/unix/sun_netbsd/iconc.hdr
--- /dev/null	Thu Jan  1 00:00:00 1970
+++ config/unix/sun_netbsd/iconc.hdr	Thu Jun  8 22:10:28 2000
@@ -0,0 +1,9 @@
+#  The -D$D option to CFLAGS makes it possible to specify a definition
+#  at the Make command level without revising the Makefile, as
+#  in
+#
+#	make D=Debug
+#
+D=NOTHING
+CFLAGS+= -D$D
+SHELL=/bin/sh
diff -u /dev/null config/unix/sun_netbsd/icont.hdr
--- /dev/null	Thu Jan  1 00:00:00 1970
+++ config/unix/sun_netbsd/icont.hdr	Thu Jun  8 22:10:28 2000
@@ -0,0 +1 @@
+SHELL=/bin/sh
diff -u /dev/null config/unix/sun_netbsd/iconx.hdr
--- /dev/null	Thu Jan  1 00:00:00 1970
+++ config/unix/sun_netbsd/iconx.hdr	Thu Jun  8 22:10:28 2000
@@ -0,0 +1,7 @@
+SHELL=/bin/sh
+# the seek stuff is defined in a header file that they don't
+# include.  This is the easiest.  -Dconst= causes const to
+# be ignored.  This is needed because otherwise we get complaints
+# due to stdio.h defining some functions with const when they
+# are not defined that way in Icon's header files
+RSWITCH=rswitch.c
diff -u /dev/null config/unix/sun_netbsd/paths.h
--- /dev/null	Thu Jan  1 00:00:00 1970
+++ config/unix/sun_netbsd/paths.h	Thu Jun  8 22:10:28 2000
@@ -0,0 +1,3 @@
+#define RootPath "/usr/local"
+#define IcontPath "/usr/local/lib/icon/icont"
+#define IconxPath "/usr/local/lib/icon/iconx"
diff -u /dev/null config/unix/sun_netbsd/pi.hdr
--- /dev/null	Thu Jan  1 00:00:00 1970
+++ config/unix/sun_netbsd/pi.hdr	Thu Jun  8 22:10:28 2000
@@ -0,0 +1,2 @@
+SHELL=/bin/sh
+CFLAGS+=-DPersInterp
diff -u /dev/null config/unix/sun_netbsd/preproc.hdr
--- /dev/null	Thu Jan  1 00:00:00 1970
+++ config/unix/sun_netbsd/preproc.hdr	Thu Jun  8 22:10:28 2000
@@ -0,0 +1,10 @@
+#  The -D$D option to CFLAGS makes it possible to specify a definition
+#  at the Make command level without revising the Makefile, as
+#  in
+#
+#	make D=Debug
+#
+D=NOTHING
+CC=cc
+CFLAGS+= -O -D$D
+SHELL=/bin/sh
diff -u /dev/null config/unix/sun_netbsd/rswitch.c
--- /dev/null	Thu Jan  1 00:00:00 1970
+++ config/unix/sun_netbsd/rswitch.c	Thu Jun  8 22:14:54 2000
@@ -0,0 +1,39 @@
+/*
+ * coswitch for Sun-4 Sparc.
+ * 
+ * Compile this with 'cc -c rswitch.c'.  Do not use cc -O.
+ */
+
+/* #include <sys/asm_linkage.h> */
+/*#include <sys/trap.h>*/
+
+int coswitch(old_cs, new_cs, first)
+int *old_cs, *new_cs;
+int first;
+{
+   asm("ta	0x03");			/* ST_FLUSH_WINDOWS in trap.h     */
+   asm("ld	[%fp+0x44], %o0");	/* load old_cs into %o0	          */
+   asm("st	%sp,[%o0]");		/* Save user stack pointer        */
+   asm("st	%fp,[%o0+0x4]");	/* Save frame pointer             */
+   asm("st	%i7,[%o0+0x8]");	/* Save return address            */
+
+   if (first == 0) {			/* this is the first activation   */
+      asm("ld	[%fp+0x48], %o0");	/* load new_cs into %o0           */
+      asm("ld	[%o0], %o1");		/* load %o1 from cstate[0]        */
+
+      /* Decrement new stack pointer value before loading it into sp.	  */
+      /* The top 64 bytes of the stack are reserved for the kernel, to    */
+      /* save the 8 local and 8 in registers into, on context switches,   */
+      /* interrupts, traps, etc.					  */
+
+      asm("save  %o1,-96, %sp");	/* load %sp from %o1	          */
+      new_context(0,0);
+      syserr("new_context() returned in coswitch");
+
+   } else {
+      asm("ld	[%fp+0x48], %o0");	/* load new_cs into %o0           */
+      asm("ld	[%o0+0x4],%fp");	/* Load frame pointer             */
+      asm("ld	[%o0+0x8],%i7");	/* Load return address            */
+      asm("ld	[%o0],%sp");		/* Load user stack pointer        */
+   }
+}
diff -u /dev/null config/unix/sun_netbsd/rtt.hdr
--- /dev/null	Thu Jan  1 00:00:00 1970
+++ config/unix/sun_netbsd/rtt.hdr	Thu Jun  8 22:10:28 2000
@@ -0,0 +1,2 @@
+CFLAGS+= -DTokDotH="\"../rtt/ltoken.h\""
+SHELL=/bin/sh
diff -u /dev/null config/unix/sun_netbsd/runtime.hdr
--- /dev/null	Thu Jan  1 00:00:00 1970
+++ config/unix/sun_netbsd/runtime.hdr	Thu Jun  8 22:10:28 2000
@@ -0,0 +1 @@
+SHELL=/bin/sh
diff -u /dev/null config/unix/sun_netbsd/setpath.c
--- /dev/null	Thu Jan  1 00:00:00 1970
+++ config/unix/sun_netbsd/setpath.c	Thu Jun  8 22:10:28 2000
@@ -0,0 +1,2 @@
+#include "paths.h"
+#include "../Generic/setpath.h"
diff -u /dev/null config/unix/sun_netbsd/status
--- /dev/null	Thu Jan  1 00:00:00 1970
+++ config/unix/sun_netbsd/status	Thu Jun  8 22:21:08 2000
@@ -0,0 +1,28 @@
+System configuration:
+
+	SPARC architecture running NetBSD 1.4
+
+Latest Icon version:
+
+	Version 9.3.2
+
+Installer:
+
+	David A. Holland
+	<dholland@eecs.harvard.edu>
+
+Missing features:
+
+	None.
+
+Known bugs:
+
+	None.
+
+Comments:
+
+	Mostly cribbed from a diff of intel_linux and sun_linux.
+
+Date:
+
+	Thu Jun  8 18:20:33 EDT 2000
diff -u /dev/null config/unix/sun_netbsd/vt.hdr
--- /dev/null	Thu Jan  1 00:00:00 1970
+++ config/unix/sun_netbsd/vt.hdr	Thu Jun  8 22:10:28 2000
@@ -0,0 +1,2 @@
+SHELL=/bin/sh
+CFLAGS+= -DVarTran
diff -u /dev/null config/unix/sun_netbsd/vtran.hdr
--- /dev/null	Thu Jan  1 00:00:00 1970
+++ config/unix/sun_netbsd/vtran.hdr	Thu Jun  8 22:10:28 2000
@@ -0,0 +1,2 @@
+SHELL=/bin/sh
+CFLAGS+= -DVarTran
diff -u /dev/null config/unix/sun_netbsd/xiconx.mak
--- /dev/null	Thu Jan  1 00:00:00 1970
+++ config/unix/sun_netbsd/xiconx.mak	Thu Jun  8 22:10:28 2000
@@ -0,0 +1,3 @@
+# If you define EventMon, add the -lgmon below to get profil(2) under Linux
+#XLIB= -lX11 -lgmon
+XLIB= -L/usr/X11R6/lib -lX11
diff -u /dev/null config/unix/sun_netbsd/xpm.hdr
--- /dev/null	Thu Jan  1 00:00:00 1970
+++ config/unix/sun_netbsd/xpm.hdr	Thu Jun  8 22:10:28 2000
@@ -0,0 +1 @@
+DEFINES= -DZPIPE

  --- CUT HERE ---
>Release-Note:
>Audit-Trail:
>Unformatted: