From: mcba@newt.phys.unsw.edu.au (Michael C. B. Ashley)
Newsgroups: comp.unix.ultrix
Subject: SUMMARY: ghostscript-2.5.2 on ULTRIX
Date: 16 Oct 92 02:39:21 GMT
Organization: University of New South Wales

In a recent posting I asked for help to get ghostscript-2.5.2 working
under ULTRIX. I had compiled it OK, but it wouldn't display output from
dvips correctly.

Thank you to the five people who responded to my question.

The solution turned out to be to use a later version of Tom Rokicki's
dvips, although I still suspect that there is something wrong with
ghostscript since (1) the earlier version of dvips prints fine on a
laser printer, and (2) if you use ghostview as a front end to
ghostscript, then the old dvips files are displayed OK.

Anyway I used dvips5495.tar.Z (October 14 - you can't get much later
than that!).  You also need a copy of the latest fonts, and they are
in dvips5493lib.tar.Z.  I used gcc-2.2.2 to compile dvips, with no
problems.

To make ghostscript you need ghostscript-2.5.2.tar.Z and
ghostscript-fonts-2.5.2.tar.Z. I used unix-cc.mak as the Makefile
(i.e., I used the MIPS cc compiler rather than gcc), and used the following
flags:

CFLAGS=-O -Olimit 700 $(XCFLAGS)
LDFLAGS=-x $(XLDFLAGS)

Note: do not use the -DBSD4_2 define since it causes all sorts of problems
with including <strings.h>.

You then need to comment out the following lines in gdevmem.h since
the C preprocessor doesn't like the middle one:

#if !(arch_sizeof_int == 2 || arch_sizeof_int == 4)
#  error sizeof(int) must be 2 or 4 for correct operation.
#endif

I then set "use_backing = 0" in gdevxini.c since otherwise I get a nasty
message from my X server saying that it can't allocate enough memory.
There doesn't appear to be any need to unset use_XSetTile or use_XPutImage.

Then just type "make". You get a few warnings during the compilation - 
I'm not sure if they are important.

While you are at it, grab a copy of ghostview-1.4. It compiles readily,
and is a nice interface to ghostscript.

Some additional comments:

Johan Vromans had no problem getting ghostscript-2.5.2 to compile with
gcc-2.2.2 on VAX/Ultrix 4.2, but on RISC systems the gcc optimized
binary behaved strangely, so he used cc. Also, he patched in the GNU
readline routine, which is an excellent idea.

Thanks also to Bruce Benson, Tim Carlson, Burkhard Neidecker, and
John Howells.

Here are some additional patches to ghostscript-2.5.2 that I received
from Bruce Benson but didn't use.  These patches allegedly stop some
of the compiler warnings from cc, and fix some unaligned access
problems.

*** gs252/gdevcdj.c	Mon Oct 12 18:08:12 1992
--- gs252.pig/gdevcdj.c	Wed Oct 14 13:00:09 1992
*** 290,294 ****
  #define y_dpi    (pdev->y_pixels_per_inch)
! #define height   (pdev->height)
! #define t_margin (pdev->t_margin)
! #define b_margin (pdev->b_margin)
  #define XTRA 12		        /* 2 x 6 XTRA values for end-of-line */
  
--- 290,294 ----
  #define y_dpi    (pdev->y_pixels_per_inch)
! #define HEIGHT   (pdev->height)
! #define T_MARGIN (pdev->t_margin)
! #define B_MARGIN (pdev->b_margin)
  #define XTRA 12		        /* 2 x 6 XTRA values for end-of-line */

*** 396,398 ****
    /* move to top left of printed area */
! #define OFFSET (t_margin - PRINT_LIMIT)	/* Offset to print position */
    fprintf(prn_stream, "\033*p0x%dY", (int)(Y_DPI_MAX * OFFSET));
--- 396,398 ----
    /* move to top left of printed area */
! #define OFFSET (T_MARGIN - PRINT_LIMIT)	/* Offset to print position */
    fprintf(prn_stream, "\033*p0x%dY", (int)(Y_DPI_MAX * OFFSET));

*** 410,412 ****
      int lnum, i;
!     int lend = height - (t_margin + b_margin) * y_dpi;
      int num_blank_lines = 0;
--- 410,412 ----
      int lnum, i;
!     int lend = HEIGHT - (T_MARGIN + B_MARGIN) * y_dpi;
      int num_blank_lines = 0;
***************
*** 740,743 ****
  
! #undef t_margin
! #undef b_margin
! #undef height
--- 740,743 ----
  
! #undef T_MARGIN
! #undef B_MARGIN
! #undef HEIGHT

*** gs252/gsmisc.c	Mon Oct 12 18:08:33 1992
--- gs252.pig/gsmisc.c	Wed Oct 14 13:34:01 1992
***************
*** 161,166 ****
--- 161,183 ----
  #undef memswab2				/* see memory_.h */
+ 
+ #ifdef MIPSEL
+ 
  void
  memswab2(const byte *src, byte *dest, int count)
+ {       register const byte *sptr = src;
+         register byte *dptr = dest;
+         register int x;
+         for ( x = count >> 1; --x >= 0; sptr += 2, dptr += 2 )
+            {    register byte t = sptr[0];
+                 dptr[0] = sptr[1];
+                 dptr[1] = t;
+            }
+ }
+ 
+ #else                   /* ifdef MIPSEL */
+ 
+ void
+ memswab2(const byte *src, byte *dest, int count)
  {	register const uint *sptr = (const uint *)src;
***************
*** 198,203 ****
--- 215,222 ----
  }
+ 
+ #endif					/* MIPSEL */
  #endif					/* !USE_ASM */
Newsgroups: comp.unix.ultrix