This document describes how to build ghostscript under MkLinux.
I obtained the ghostscript 4.0 distribution from ftp.cs.wisc.edu, in the ghost/aladdin directory. I also obtained the standard fonts distribution (from the same directory), and the JPEG source distribution (from the ghost directory).
Running gunzip and un-tar-ing the ghostscript distribution yields a gs4.0 directory. The ghostscript makefiles expect to find the JPEG source in a jpeg-6a subdirectory inside the ghostscript directory. Thus, gunzip the JPEG distribution and un-tar it into the ghostscript directory, or un-tar the JPEG distribution into some other location and change JPEGSRC to reflect that location later on when you configure the makefile for ghostscript.
I compiled ghostscript using gcc 2.7.2 in ANSI mode; the correct makefile for this is unix-gcc.mak. I made a backup of this file and then created makefile as a symlink to it:
% cp unix-gcc.mak unix-gcc.mak.bak
% ln -s unix-gcc.mak makefile (Note: makefile, not Makefile)
This allows you to make changes to the makefile but still recover (from the backup) if you make a mistake.
The changes I made to the makefile are available as a diff listing, and are described below:
JSRCDIR=jpeg-6a
To this:
JSRCDIR=../jpeg-6a
DEVICE_DEVS=x11.dev x11alpha.dev x11cmyk.dev x11mono.dev
DEVICE_DEVS3=deskjet.dev djet500.dev laserjet.dev ljetplus.dev ljet2p.dev ljet3.dev ljet4.dev
DEVICE_DEVS4=cdeskjet.dev cdjcolor.dev cdjmono.dev cdj550.dev pj.dev pjxl.dev pjxl300.dev
DEVICE_DEVS6=bj10e.dev bj200.dev bjc600.dev bjc800.dev
DEVICE_DEVS7=faxg3.dev faxg32d.dev faxg4.dev
DEVICE_DEVS8=pcxmono.dev pcxgray.dev pcx16.dev pcx256.dev pcx24b.dev
DEVICE_DEVS9=pbm.dev pbmraw.dev pgm.dev pgmraw.dev pgnm.dev pgnmraw.dev pnm.dev pnmraw.dev ppm.dev ppmraw.dev
DEVICE_DEVS10=tiffcrle.dev tiffg3.dev tiffg32d.dev tiffg4.dev tifflzw.dev tiffpack.dev
DEVICE_DEVS11=tiff12nc.dev tiff24nc.dev
DEVICE_DEVS12=psmono.dev bit.dev bitrgb.dev bitcmyk.dev
DEVICE_DEVS13=pngmono.dev pnggray.dev png16.dev png256.dev png16m.dev
DEVICE_DEVS15=pdfwrite.dev
To this:
DEVICE_DEVS=x11.dev x11alpha.dev x11cmyk.dev x11mono.dev
DEVICE_DEVS3=deskjet.dev djet500.dev laserjet.dev ljetplus.dev ljet2p.dev ljet3.dev ljet4.dev
DEVICE_DEVS4=cdeskjet.dev cdjcolor.dev cdjmono.dev cdj550.dev pj.dev pjxl.dev pjxl300.dev
#DEVICE_DEVS6=bj10e.dev bj200.dev bjc600.dev bjc800.dev
#DEVICE_DEVS7=faxg3.dev faxg32d.dev faxg4.dev
#DEVICE_DEVS8=pcxmono.dev pcxgray.dev pcx16.dev pcx256.dev pcx24b.dev
#DEVICE_DEVS9=pbm.dev pbmraw.dev pgm.dev pgmraw.dev pgnm.dev pgnmraw.dev pnm.dev pnmraw.dev ppm.dev ppmraw.dev
#DEVICE_DEVS10=tiffcrle.dev tiffg3.dev tiffg32d.dev tiffg4.dev tifflzw.dev tiffpack.dev
#DEVICE_DEVS11=tiff12nc.dev tiff24nc.dev
#DEVICE_DEVS12=psmono.dev bit.dev bitrgb.dev bitcmyk.dev
#DEVICE_DEVS13=pngmono.dev pnggray.dev png16.dev png256.dev png16m.dev
#DEVICE_DEVS15=pdfwrite.dev
XLIBS=Xt Xext X11
To this:
XLIBS=Xt SM ICE Xext X11
XLIBDIRS=-L/usr/X11/lib
To this:
XLIBDIRS=-L/usr/X11R6/lib
CFLAGS=-O $(GCFLAGS) $(XCFLAGS)
To this:
CFLAGS=-O $(GCFLAGS) $(XCFLAGS) -Dconst=
After you've configured the makefile, type make and wait for the build to finish. When it's done, assuming the build succeeds, type make install. At this point you can test the gs interpreter, e.g., with gs tiger.ps to draw the tiger picture in an X window. Anything that requires fonts will still fail, so you need to install the font files from the font distribution. The Fontmap file is installed in the /usr/local/share/ghostscript/4.0 directory, and the fonts can be put there, too.