[comp.sys.mips] X11R4 build experience on m120-5

tonyr@tekig5.PEN.TEK.COM (Tony Rick) (02/24/90)

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.

hartzell@boulder.Colorado.EDU (George Hartzell) (02/25/90)

I'm very happy to see that someone has started on this!

In article <5684@tekig5.PEN.TEK.COM>, tonyr@tekig5 (Tony Rick) writes:
>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

I'm also glad to see there are other's out there who do their work in
the bsd side of the world.  Sometimes I feel like a 2nd class
citizen...

>	o   no preprocessor symbol defined
[...]
>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.

I would really like to see a standard set of preprocessor symbols for
the various MIPS machines (sgi, dec, mips, etc...) and their operating
systems.  Is there anyone at MIPS who might be able to encourage
MIPS's licensee's to establish something?  In this particular case I
would suggest that "bsd" or "bsd43" be added to suggest that this is
only applicable to the bsd43 side of RISC/os.
George Hartzell			                  (303) 492-4535
 MCD Biology, University of Colorado-Boulder, Boulder, CO 80309
hartzell@Boulder.Colorado.EDU  ..!{ncar,nbires}!boulder!hartzell