[comp.windows.x] Here's X11R4 pl12 for MIPS

datri@convex.com (Anthony A. Datri) (07/17/90)

Here's all you should need to make MIT X11R4, fixes 1-12 work under RISC/OS
4.50.  I just built this, and it seems to work.  Note that I didn't do
the hard work -- that was done by one Tony Rick.

# This is a shell archive.  Remove anything before this line,
# then unpack it by saving it in a file and typing "sh file".
#
# Wrapped by lovecraft!datri on Mon Jul 16 18:31:16 CDT 1990
# Contents:  mips.patches mips.readme mips40.cf mips.original
 
echo x - mips.patches
sed 's/^@//' > "mips.patches" <<'@//E*O*F mips.patches//'
*** mit/clients/xdm/sessreg.c	Mon Jul 16 11:36:39 1990
--- mit/clients/xdm/sessreg.c.orig	Sun May 14 11:08:50 1989
***************
*** 268,279 ****
  		u->ut_type = DEAD_PROCESS;
  	}
  #else
- #ifndef mips40  /* mips RISC/os4.0bsd has no ut_host field; sorry. */
  	if (addp && host)
  		(void) strncpy (u->ut_host, host, sizeof (u->ut_host));
  	else
  		bzero (u->ut_host, sizeof (u->ut_host));
- #endif /* mips40 */
  #endif
  	u->ut_time = date;
  }
--- 268,277 ----
*** mit/clients/xterm/main.c	Mon Jul 16 08:43:15 1990
--- mit/clients/xterm/main.c.orig	Mon Jul 16 08:41:29 1990
***************
*** 99,107 ****
  #ifndef SYSV				/* BSD systems */
  #include <sgtty.h>
  #include <sys/resource.h>
- #ifndef mips40
  #define HAS_UTMP_UT_HOST
- #endif /* mips40 */
  #define HAS_BSD_GROUPS
  #endif	/* !SYSV */
  
--- 99,105 ----
*** mit/config/imakemdep.h	Mon Jul 16 08:40:00 1990
--- mit/config/imakemdep.h.orig	Mon Dec 18 13:56:39 1989
***************
*** 126,134 ****
  #ifdef ibm
  	"-Dibm",	/* IBM PS/2 and RT under both AOS and AIX */
  #endif
- #ifdef mips40
-         "-Dmips40",     /* MIPS RISC/os 4.0 */
- #endif
  };
  #else /* else MAKEDEPEND */
  /*
--- 126,131 ----
***************
*** 172,180 ****
  	{"att", "1"},
  #endif
  #ifdef mips
-         {"mips", "1"},
- #endif
- #ifdef mips40
  	{"mips", "1"},
  #endif
  #ifdef ultrix
--- 169,174 ----
*** mit/config/Imake.tmpl	Mon Jul 16 08:13:17 1990
--- mit/config/Imake.tmpl.orig	Mon Dec 18 14:01:44 1989
***************
*** 58,73 ****
  #define UltrixArchitecture
  #endif
  
- #ifdef mips40
- /* MIPS RISC/os 4.0 cpp has no unique symbol: */
- /* build imake with BOOTSTRAPCFLAGS=-Dmips40 */
- #define MacroIncludeFile <mips40.cf>
- #define MacroFile mips40.cf
- #undef mips40
- #define Mips40Architecture
- #endif /* mips40 */
- 
- 
  #if defined(vax) && !defined(UltrixArchitecture)
  #define MacroIncludeFile <bsd.cf>
  #define MacroFile bsd.cf
--- 58,63 ----
@//E*O*F mips.patches//
chmod u=rw,g=r,o=r mips.patches
 
echo x - mips.readme
sed 's/^@//' > "mips.readme" <<'@//E*O*F mips.readme//'
Mon Jul 16 17:53:18 CDT 1990 datri@convex.com (Anthony A. Datri)

Here's all you should need to make MIT X11R4, fixes 1-12 work under RISC/OS
4.50.

I got the patches and the mips40.cf file from a comp.sys.mips post, and
changed a couple of things, and made the whole more palatable (context
diffs instead of ad-hoc and ed scripts).  Note that Tony Rick did the
hard work -- I'm repackaging and cleaning up.  The post that I started with
can be found in mips.original.

This should apply to and work with X11R4, fixes 1-12.  It seems to work
on a 3240 and a 6280, both running 4.50.  My experience with this OS
and MIPS is very limited, so please forgive any mistakes here, and please
let me know any that you find, or if you find this useful.

You want to make sure that the following lines are somewhere in your
installed /usr/lib/X11/config directory, preferably on the end of site.def
where imake can find them.  Because of the unobvious way that -systype works,
you don't get the right include/lib directories otherwise.

#define DefaultCCOptions -systype bsd43 -L/usr/lib/X11
#define StandardIncludes -I/bsd43/usr/include -I/usr/include
#define BOOTSTRAPCFLAGS -systype bsd43 -Dmips40

@//E*O*F mips.readme//
chmod u=rw,g=r,o=r mips.readme
 
echo x - mips40.cf
sed 's/^@//' > "mips40.cf" <<'@//E*O*F mips40.cf//'
/*mips40.cf*/
/******************************************************************/
/*
 * SET VERSION NUMBERS BEFORE MAKING MAKEFILES
 */


#define OSName            RISC/os4.5
#define OSMajorVersion    4
#define OSMinorVersion    5


/**/# platform:  $XConsortium: bsd.cf,v 1.8 89/12/23 14:19:17 jim Exp $
/**/# operating system:  OSName

/*****************************************************************************
 *			  Platform-specfic parameters                        *
 *****************************************************************************/

#define CcCmd             cc -Wf,-XNp6000,-XNd4000 -Dmips40
#define DefaultCCOptions  -systype bsd43 
#define BuildServer       NO
#define BuildExamples	  NO
#define ExtraLibraries    -lmld
#define BootstrapCFlags   -Dmips40
#define DependCmd	  $(DEPENDSRC)/makedepend -I/usr/include/bsd43

@//E*O*F mips40.cf//
chmod u=rw,g=r,o=r mips40.cf
 
echo x - mips.original
sed 's/^@//' > "mips.original" <<'@//E*O*F mips.original//'
\begindata{text822, 0}
X-Andrew-Authenticated-As: 0;lovecraft.convex.com;Superuser
@From macdonal@mips2.cr.bull.com Fri Jul 13 12:34:30 1990
Received: by concave (5.51/7.0)
	id AA07652; Fri, 13 Jul 90 12:34:22 CDT
Received: by convex.COM (5.51/4.7)
	id AA23483; Fri, 13 Jul 90 12:34:17 CDT
Received: from nic.near.net by hydra.convex.com (5.61/1.00Inomad)
	id AA27070; Fri, 13 Jul 90 12:34:08 -0500
Received: from mips2.cr.bull.com by nic.near.net id aa00766; 13 Jul 90 12:22 EDT
Received: by mips2.cr.bull.com (5.52/4.7)
	id AA19911; Fri, 13 Jul 90 13:15:26 EDT
@From: Rindress MacDonald <macdonal@mips2.cr.bull.com>
Message-Id: <9007131715.AA19911@mips2.cr.bull.com>
Subject: Help with X11R4 on MIPS 6820.
To: datri@mips2.cr.bull.com
Date: Fri, 13 Jul 90 13:15:25 EDT
X-Mailer: ELM [version 2.2 PL0]




Hi,

	The following is an article I grabbed of the net a while ago.
Please let me know how everything goes.




>From granite!bbn!mit-eddie!uw-beaver!zephyr.ens.tek.com!tekig5!tonyr Mon Feb 26 08:20:30 EST 1990
Article 1 of comp.sys.mips:
Path: mips2!granite!bbn!mit-eddie!uw-beaver!zephyr.ens.tek.com!tekig5!tonyr
>From: tonyr@tekig5.PEN.TEK.COM (Tony Rick)
Newsgroups: comp.sys.mips
Subject: X11R4 build experience on m120-5
Keywords: windows, X
Message-ID: <5684@tekig5.PEN.TEK.COM>
Date: 23 Feb 90 21:53:34 GMT
Organization: Tektronix Inc., Beaverton, Or.
Lines: 216


I have been asked to post my adventures in building X11R4 under
RISC/os 4.0 on my m120-5.  So here it is.  I would like to thank
Keith Sparacin (keith@csc.ti.com) for reviewing my process and pointing 
out glaring errors which resulted from my method of attack ( I dove in, 
machete in one hand, whip in the other ;-) ).  

MIPS has an X product they call RISCwindows for $1000.  I do not know if 
it is based on R3 or R4.  Their literature says it is a "native 
implementation ... highly tuned for optimum performance on MIPS 
RISComputers(tm) and RISCstations(tm)".

I only built the client side.  Of that we use only xterm and one local
application using the libraries, so there has been no extensive
testing.  It should be a reasonable starting point, however.

Since RISC/os 4.0 is a strange hybrid of ATT_V3_0 and 4.3bsd, I 
thought it safest to proceed on some convenient simplifying assumptions, 
which were:

	o   a bsd43 compilation environment
	o   no preprocessor symbol defined

The first assumption means that /bsd43/bin must appear in your search path
before /bin.  Mine looks  like this:

path = (/bsd43/bin /usr/sbin /usr/lbin /usr/ucb /usr/bin /bin /etc /usr/new /usr/local/bin)


The second assumption means that you have to go through the process proscribed
by the instructions for creating your own preprocessor symbol. I saw 'mips' 
and 'umips' defined in the code and control files,  but there is nothing 
to indicate which variety of MIPS operating system they applies to 
(there are several).  Mips is not one of the mentioned supported platforms.  
I defined 'mips40' for RISC/os 4.0 and made all the necessary control file 
modifications.  I have included changes and additions to all the files that 
make this happen. It almost works.

There were some things I had to force with my bare hands.  
The utmp structure in the bsd43 environment does not define the field 
'ut_host', so there are source modifications to .../clients/xterm/main.c 
and .../clients/xdm/sessreg.c.

The included changes are for files:

    mips40.cf 
    Imake.tmpl 
    imakemdep.h.
    .../clients/xterm/main.c
    .../clients/xdm/sessreg.c

There are source segments and ed files created by 'diff -e' that may 
be applied to the distributed versions.  mips40.cf is included in 
its entirety.

Everything will compile except .../clients/xterm/charproc.c .  You 
will have to edit the Makefile there to remove the string 
'-Wf,-XNp6000,-XNd5000' from the macros CC and PREPROCESSORCMD 
and make xterm locally.  I would appreciate responses and comments
if anyone uses this.  


mips40.cf
****************************************************************
/*
 * SET VERSION NUMBERS BEFORE MAKING MAKEFILES
 */


#define OSName            RISC/os4.0
#define OSMajorVersion    4
#define OSMinorVersion    0


/**/# platform:  $XConsortium: bsd.cf,v 1.8 89/12/23 14:19:17 jim Exp $
/**/# operating system:  OSName

/*****************************************************************************
 *			  Platform-specfic parameters                        *
 *****************************************************************************/

#define CcCmd             cc -Wf,-XNp6000,-XNd4000
#define DefaultCCOptions  -systype bsd43 
#define BuildServer       NO
#define BuildExamples	  NO
#define ExtraLibraries    -lmld
#define BootstrapCFlags   -Dmips40
#define DependCmd	  $(DEPENDSRC)/makedepend -I/usr/include/bsd43
****************************************************************



Imake.tmpl ( near the beginning, before other stuff like this )
****************************************************************
#ifdef mips40
/* MIPS RISC/os 4.0 cpp has no unique symbol: */ 
/* build imake with BOOTSTRAPCFLAGS=-Dmips40 */
#define MacroIncludeFile <mips40.cf>
#define MacroFile mips40.cf
#undef mips40
#define Mips40Architecture
#endif /* mips40 */
****************************************************************
ed.command
****************************************************************
45a
#ifdef mips40
/* MIPS RISC/os 4.0 cpp has no unique symbol: */ 
/* build imake with BOOTSTRAPCFLAGS=-Dmips40 */
#define MacroIncludeFile <mips40.cf>
#define MacroFile mips40.cf
#undef mips40
#define Mips40Architecture
#endif /* mips40 */

@. 
****************************************************************



imakemdep.h 
****************************************************************
(after #ifdef ibm ... #endif)
#ifdef mips40
	"-Dmips40",	/* MIPS RISC/os 4.0 */
#endif

( after #ifdef mips ... #endif)
#ifdef mips40
	{"mips40", "1"},
#endif
****************************************************************
ed command
****************************************************************
171a
	{"mips", "1"},
#endif
#ifdef mips40
@. 
128a
#ifdef mips40
	"-Dmips40",	/* MIPS RISC/os 4.0 */
#endif
@. 
****************************************************************


@.../clients/xterm/main.c
****************************************************************
***old> line 99
#ifndef SYSV				/* BSD systems */
#include <sgtty.h>
#include <sys/resource.h>
#define HAS_UTMP_UT_HOST
#define HAS_BSD_GROUPS
#endif	/* !SYSV */

***new>
#ifndef SYSV				/* BSD systems */
#include <sgtty.h>
#include <sys/resource.h>
#ifndef mips40				/* RISC/os4.0 is weird */
#define HAS_UTMP_UT_HOST
#endif /* mips40 */
#define HAS_BSD_GROUPS
#endif	/* !SYSV */
****************************************************************
ed command
****************************************************************
102a
#endif /* mips40 */
@. 
101a
#ifndef mips40				/* RISC/os4.0 is weird */
@. 
****************************************************************



@.../clients/xdm/sessreg.c
****************************************************************
***old> line 270
#else
	if (addp && host)
		(void) strncpy (u->ut_host, host, sizeof (u->ut_host));
	else
		bzero (u->ut_host, sizeof (u->ut_host));
#endif



***new>
#else
#ifndef mips40  /* mips RISC/os4.0bsd has no ut_host field; sorry. */
	if (addp && host)
		(void) strncpy (u->ut_host, host, sizeof (u->ut_host));
	else
		bzero (u->ut_host, sizeof (u->ut_host));
#endif /* mips40 */
#endif
****************************************************************
ed command
****************************************************************
274a
#endif /* mips40 */
@. 
270a
#ifndef mips40  /* mips RISC/os4.0bsd has no ut_host field; sorry. */
@. 

****************************************************************


Tony Rick
tonyr@tekadg.adg.tek.com
Tektronix, Inc.


>From granite!bbn!uwm.edu!rpi!zaphod.mps.ohio-state.edu!usc!ucsd!helios.ee.lbl.gov!epb2.lbl.gov!envbvs Mon Feb 26 08:24:58 EST 1990
Article 19 of comp.windows.x:
Path: mips2!granite!bbn!uwm.edu!rpi!zaphod.mps.ohio-state.edu!usc!ucsd!helios.ee.lbl.gov!epb2.lbl.gov!envbvs
>From: envbvs@epb2.lbl.gov (Brian V. Smith)
Newsgroups: comp.windows.x
Subject: xfig 2.0 patch2
Message-ID: <4930@helios.ee.lbl.gov>
Date: 23 Feb 90 22:49:45 GMT
Sender: usenet@helios.ee.lbl.gov
Reply-To: envbvs@epb2.lbl.gov (Brian V. Smith)
Organization: lbl
Lines: 55
X-Local-Date: 23 Feb 90 14:49:45 PST

I said I would wait a while before posting the next patch (2),
but the moderator of comp.sources.x wanted to patch the source
before posting it.  So, here is patch2 (it is also on expo now).
This fixes bus errors etc from drawing circles/ellipses:

*** curve.c.old	Tue Jan 16 17:21:04 1990
--- curve.c	Thu Feb 22 15:58:24 1990
***************
*** 117,121
  		}
  	pw_lines(window, points, npoints, val? PAINT: ERASE,
  			thick, area_fill);
- 	free(points);
  	}

--- 117,120 -----
  		}
  	pw_lines(window, points, npoints, val? PAINT: ERASE,
  			thick, area_fill);
  	}

*** patchlevel.h.old	Tue Feb 20 15:35:01 1990
--- patchlevel.h	Fri Feb 23 08:58:00 1990
***************
*** 1
! #define PATCHLEVEL 1

--- 1 -----
! #define PATCHLEVEL 2

*** Imakefile.old	Tue Feb 20 15:10:16 1990
--- Imakefile	Fri Feb 23 09:03:01 1990
***************
*** 5,11
  
  SRCS=   addpt.c arc.c arcbox.c arrow.c autoarrow.c\
          bitmap.c blink.c bound.c box.c break.c\
!         canvas.c changestyle.o changetext.o changethick.c \
          char.c color.c copy.c cursor.c curve.c\
          deletept.c dir.c drag.c draw.c ellipse.c\
          file.c flip.c font.c free.c\

--- 5,11 -----
  
  SRCS=   addpt.c arc.c arcbox.c arrow.c autoarrow.c\
          bitmap.c blink.c bound.c box.c break.c\
!         canvas.c changestyle.c changetext.c changethick.c \
          char.c color.c copy.c cursor.c curve.c\
          deletept.c dir.c drag.c draw.c ellipse.c\
          file.c flip.c font.c free.c\

_____________________________________
Brian V. Smith    (bvsmith@lbl.gov)
Lawrence Berkeley Laboratory
I don't speak for LBL, these non-opinions are all mine.


>From granite!bbn!mit-eddie!uw-beaver!zephyr.ens.tek.com!tekig5!tonyr Wed Feb 28 08:28:51 EST 1990
Article 1 of comp.sys.mips:
Path: mips2!granite!bbn!mit-eddie!uw-beaver!zephyr.ens.tek.com!tekig5!tonyr
>From: tonyr@tekig5.PEN.TEK.COM (Tony Rick)
Newsgroups: comp.sys.mips
Subject: X11R4 build experience on m120-5
Keywords: windows, X
Message-ID: <5684@tekig5.PEN.TEK.COM>
Date: 23 Feb 90 21:53:34 GMT
Organization: Tektronix Inc., Beaverton, Or.
Lines: 216


I have been asked to post my adventures in building X11R4 under
RISC/os 4.0 on my m120-5.  So here it is.  I would like to thank
Keith Sparacin (keith@csc.ti.com) for reviewing my process and pointing 
out glaring errors which resulted from my method of attack ( I dove in, 
machete in one hand, whip in the other ;-) ).  

MIPS has an X product they call RISCwindows for $1000.  I do not know if 
it is based on R3 or R4.  Their literature says it is a "native 
implementation ... highly tuned for optimum performance on MIPS 
RISComputers(tm) and RISCstations(tm)".

I only built the client side.  Of that we use only xterm and one local
application using the libraries, so there has been no extensive
testing.  It should be a reasonable starting point, however.

Since RISC/os 4.0 is a strange hybrid of ATT_V3_0 and 4.3bsd, I 
thought it safest to proceed on some convenient simplifying assumptions, 
which were:

	o   a bsd43 compilation environment
	o   no preprocessor symbol defined

The first assumption means that /bsd43/bin must appear in your search path
before /bin.  Mine looks  like this:

path = (/bsd43/bin /usr/sbin /usr/lbin /usr/ucb /usr/bin /bin /etc /usr/new /usr/local/bin)


The second assumption means that you have to go through the process proscribed
by the instructions for creating your own preprocessor symbol. I saw 'mips' 
and 'umips' defined in the code and control files,  but there is nothing 
to indicate which variety of MIPS operating system they applies to 
(there are several).  Mips is not one of the mentioned supported platforms.  
I defined 'mips40' for RISC/os 4.0 and made all the necessary control file 
modifications.  I have included changes and additions to all the files that 
make this happen. It almost works.

There were some things I had to force with my bare hands.  
The utmp structure in the bsd43 environment does not define the field 
'ut_host', so there are source modifications to .../clients/xterm/main.c 
and .../clients/xdm/sessreg.c.

The included changes are for files:

    mips40.cf 
    Imake.tmpl 
    imakemdep.h.
    .../clients/xterm/main.c
    .../clients/xdm/sessreg.c

There are source segments and ed files created by 'diff -e' that may 
be applied to the distributed versions.  mips40.cf is included in 
its entirety.

Everything will compile except .../clients/xterm/charproc.c .  You 
will have to edit the Makefile there to remove the string 
'-Wf,-XNp6000,-XNd5000' from the macros CC and PREPROCESSORCMD 
and make xterm locally.  I would appreciate responses and comments
if anyone uses this.  


mips40.cf
****************************************************************
/*
 * SET VERSION NUMBERS BEFORE MAKING MAKEFILES
 */


#define OSName            RISC/os4.0
#define OSMajorVersion    4
#define OSMinorVersion    0


/**/# platform:  $XConsortium: bsd.cf,v 1.8 89/12/23 14:19:17 jim Exp $
/**/# operating system:  OSName

/*****************************************************************************
 *			  Platform-specfic parameters                        *
 *****************************************************************************/

#define CcCmd             cc -Wf,-XNp6000,-XNd4000
#define DefaultCCOptions  -systype bsd43 
#define BuildServer       NO
#define BuildExamples	  NO
#define ExtraLibraries    -lmld
#define BootstrapCFlags   -Dmips40
#define DependCmd	  $(DEPENDSRC)/makedepend -I/usr/include/bsd43
****************************************************************



Imake.tmpl ( near the beginning, before other stuff like this )
****************************************************************
#ifdef mips40
/* MIPS RISC/os 4.0 cpp has no unique symbol: */ 
/* build imake with BOOTSTRAPCFLAGS=-Dmips40 */
#define MacroIncludeFile <mips40.cf>
#define MacroFile mips40.cf
#undef mips40
#define Mips40Architecture
#endif /* mips40 */
****************************************************************
ed.command
****************************************************************
45a
#ifdef mips40
/* MIPS RISC/os 4.0 cpp has no unique symbol: */ 
/* build imake with BOOTSTRAPCFLAGS=-Dmips40 */
#define MacroIncludeFile <mips40.cf>
#define MacroFile mips40.cf
#undef mips40
#define Mips40Architecture
#endif /* mips40 */

@. 
****************************************************************



imakemdep.h 
****************************************************************
(after #ifdef ibm ... #endif)
#ifdef mips40
	"-Dmips40",	/* MIPS RISC/os 4.0 */
#endif

( after #ifdef mips ... #endif)
#ifdef mips40
	{"mips40", "1"},
#endif
****************************************************************
ed command
****************************************************************
171a
	{"mips", "1"},
#endif
#ifdef mips40
@. 
128a
#ifdef mips40
	"-Dmips40",	/* MIPS RISC/os 4.0 */
#endif
@. 
****************************************************************


@.../clients/xterm/main.c
****************************************************************
***old> line 99
#ifndef SYSV				/* BSD systems */
#include <sgtty.h>
#include <sys/resource.h>
#define HAS_UTMP_UT_HOST
#define HAS_BSD_GROUPS
#endif	/* !SYSV */

***new>
#ifndef SYSV				/* BSD systems */
#include <sgtty.h>
#include <sys/resource.h>
#ifndef mips40				/* RISC/os4.0 is weird */
#define HAS_UTMP_UT_HOST
#endif /* mips40 */
#define HAS_BSD_GROUPS
#endif	/* !SYSV */
****************************************************************
ed command
****************************************************************
102a
#endif /* mips40 */
@. 
101a
#ifndef mips40				/* RISC/os4.0 is weird */
@. 
****************************************************************



@.../clients/xdm/sessreg.c
****************************************************************
***old> line 270
#else
	if (addp && host)
		(void) strncpy (u->ut_host, host, sizeof (u->ut_host));
	else
		bzero (u->ut_host, sizeof (u->ut_host));
#endif



***new>
#else
#ifndef mips40  /* mips RISC/os4.0bsd has no ut_host field; sorry. */
	if (addp && host)
		(void) strncpy (u->ut_host, host, sizeof (u->ut_host));
	else
		bzero (u->ut_host, sizeof (u->ut_host));
#endif /* mips40 */
#endif
****************************************************************
ed command
****************************************************************
274a
#endif /* mips40 */
@. 
270a
#ifndef mips40  /* mips RISC/os4.0bsd has no ut_host field; sorry. */
@. 

****************************************************************


Tony Rick
tonyr@tekadg.adg.tek.com
Tektronix, Inc.




\enddata{text822, 0}
@//E*O*F mips.original//
chmod u=rw,g=r,o=r mips.original
 
exit 0
--