Commit | Line | Data |
---|---|---|
7e21d4fd WJ |
1 | Copyright (C) 1989, 1990, 1991 Aladdin Enterprises. All rights reserved. |
2 | Distributed by Free Software Foundation, Inc. | |
3 | ||
4 | This file is part of Ghostscript. | |
5 | ||
6 | Ghostscript is distributed in the hope that it will be useful, but | |
7 | WITHOUT ANY WARRANTY. No author or distributor accepts responsibility | |
8 | to anyone for the consequences of using it or for whether it serves any | |
9 | particular purpose or works at all, unless he says so in writing. Refer | |
10 | to the Ghostscript General Public License for full details. | |
11 | ||
12 | Everyone is granted permission to copy, modify and redistribute | |
13 | Ghostscript, but only under the conditions described in the Ghostscript | |
14 | General Public License. A copy of this license is supposed to have been | |
15 | given to you along with Ghostscript so you can know your rights and | |
16 | responsibilities. It should be in a file named COPYING. Among other | |
17 | things, the copyright notice and this notice must be preserved on all | |
18 | copies. | |
19 | ||
20 | - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | |
21 | ||
22 | This file, make.doc, describes how to install Ghostscript, and how to | |
23 | build Ghostscript executables from source. | |
24 | ||
25 | For an overview of Ghostscript and a list of the documentation files, see | |
26 | README. | |
27 | ||
28 | ******** | |
29 | ******** Installing Ghostscript | |
30 | ******** | |
31 | ||
32 | To install the interpreter, you need: | |
33 | - The interpreter executable: | |
34 | - On MS-DOS and VMS systems, gs.exe. | |
35 | - On MS-DOS systems, if you are using the Watcom compiler, | |
36 | the DOS extender, dos4gw.exe. | |
37 | - On Unix systems, gs. | |
38 | - The interpreter initialization files: gs_*.ps and sym__enc.ps. | |
39 | - The font map: Fontmap. | |
40 | - The default font: uglyr.gsf. | |
41 | ||
42 | See use.doc for a description of the search algorithm used to find these | |
43 | files. | |
44 | ||
45 | You do not need any of these files when using the library; however, the | |
46 | library currently provides no way to install fonts. This is obviously | |
47 | ridiculous and will be fixed sometime in the future. | |
48 | ||
49 | ******** | |
50 | ******** Building Ghostscript from source | |
51 | ******** | |
52 | ||
53 | Ghostscript is generally distributed in the form of a compressed tar file. | |
54 | When unpacked, this file puts all the Ghostscript files in a directory | |
55 | called gs. Ghostscript is also available in the form of PC-compatible ZIP | |
56 | files. | |
57 | ||
58 | Ghostscript is described by a collection of several makefiles: | |
59 | ||
60 | gs.mak - a generic makefile used on all platforms (except VMS). | |
61 | devs.mak - a makefile listing all the device drivers. | |
62 | *.mak - the makefiles for specific platforms. | |
63 | ||
64 | You may need to edit the platform-specific makefile if you wish to change | |
65 | any of the following options: | |
66 | ||
67 | - The default search path(s) for the initialization and font files | |
68 | (macro GS_LIB_DEFAULT); | |
69 | ||
70 | - The debugging options (macro TDEBUG); | |
71 | ||
72 | - The set of device drivers to be included (DEVICE_DEVS | |
73 | and DEVICE_DEVS2..5 macros); | |
74 | ||
75 | - The set of optional features to be included (FEATURE_DEVS macro). | |
76 | ||
77 | The platform-specific makefile will include comments describing all of | |
78 | these items except the DEVICE_DEVS options. The DEVICE_DEVS options are | |
79 | described in devs.mak, even though the file that must be edited is the | |
80 | platform-specific makefile. | |
81 | ||
82 | The makefiles distributed with Ghostscript define these options as | |
83 | follows: | |
84 | ||
85 | - GS_LIB_DEFAULT: on Unix systems, the current directory at build | |
86 | time; on MS-DOS systems, C:\GS. | |
87 | ||
88 | - TDEBUG: no debugging code included in the build. | |
89 | ||
90 | - DEVICE_DEVS: platform-specific, see below. | |
91 | ||
92 | - FEATURE_DEVS: platform-specific. | |
93 | ||
94 | There are also platform-specific options described below under the | |
95 | individual platforms. See the "Options" section near the beginning of the | |
96 | relevant makefile for more information. | |
97 | ||
98 | If you are including a dot-matrix printer driver, you may wish to | |
99 | customize the default resolution parameters in devs.mak. | |
100 | ||
101 | To build the interpreter, you need all the .h and .c files (and .asm files | |
102 | for MS-DOS) included in the distribution, as well as the makefiles. | |
103 | ||
104 | The command | |
105 | make clean | |
106 | removes all the files created by the build process (relocatables, | |
107 | executables, and miscellaneous scratch files). If you want to save the | |
108 | executable, you should move it to another directory first. | |
109 | ||
110 | ******** | |
111 | ******** How to build Ghostscript from source (MS-DOS version) ******** | |
112 | ******** | |
113 | ||
114 | The makefiles distributed with Ghostscript select the following | |
115 | devices for inclusion in the executable: | |
116 | ||
117 | Turbo C: | |
118 | VGA and EGA displays | |
119 | Epson-compatible dot matrix printers | |
120 | (default resolution 180 x 180 DPI) | |
121 | Canon BJ-10e (BubbleJet) printer | |
122 | (default resolution 360 x 360 DPI) | |
123 | Borland C++: all of the above, plus: | |
124 | H-P DeskJet and LaserJet family printers | |
125 | (default resolution 300 DPI) | |
126 | GIF file format | |
127 | Watcom C/386: all of the above, plus: | |
128 | (partial) Display PostScript and PostScript Level 2 features | |
129 | Tseng ET3000/ET4000 SuperVGA displays | |
130 | H-P PaintJet printer | |
131 | PBM/PGM/PPM file formats | |
132 | PCX file format | |
133 | ||
134 | These options were chosen to strike a balance between RAM consumption and | |
135 | likely usefulness. (Turbo C is limited to 640K and does not support code | |
136 | overlaying; Borland C++ is limited to 640K, but supports code overlaying; | |
137 | Watcom C/386 is not limited to 640K.) | |
138 | ||
139 | To build Ghostscript, you need MS-DOS version 3.3 or later, and a Borland | |
140 | C/C++ development system or the Watcom C/386 development system. Details | |
141 | are given below. | |
142 | ||
143 | As noted above, the default configuration generates an executable that | |
144 | assumes the directory where 'make' was run should be the final default | |
145 | directory for looking up the Ghostscript initialization and font files. | |
146 | ||
147 | To build the Ghostscript executable, all you need to do is give the | |
148 | command | |
149 | make | |
150 | You must have COMMAND.COM in your path to build Ghostscript. | |
151 | ||
152 | There is a special 'make' target that simply attempts to compile all the | |
153 | .c files in the current directory. Some of these compilations will fail, | |
154 | but the ones that succeed will go considerably faster, because they don't | |
155 | individually pay the overhead of loading the compiler into memory. So a | |
156 | good strategy for building the executable for the first time, or after a | |
157 | change to a very widely used .h file, is: | |
158 | make begin | |
159 | and then | |
160 | make | |
161 | to do the compilations that failed the first time. | |
162 | ||
163 | Note: if you get the Ghostscript sources from a Unix 'tar' file and unpack | |
164 | the file on a MS-DOS machine, the files will all have linefeed instead of | |
165 | carriage return + linefeed as the line terminator, which will make the C | |
166 | compiler unhappy. I don't know the simplest way to fix this: just reading | |
167 | each file into an editor and writing it back out again may be sufficient. | |
168 | ||
169 | Borland environment | |
170 | ------------------- | |
171 | ||
172 | To compile Ghostscript with the Borland environment, you need either Turbo | |
173 | C (version 2.0 or later) or Turbo C++ or Borland C++ (version 1.0 or | |
174 | later); specifically, the compiler, 'make' utility, and linker. You also | |
175 | need either the Borland assembler (version 1.0 or later) or the Microsoft | |
176 | assembler (version 4.0 or later). Before compiling or linking, you should | |
177 | execute | |
178 | ||
179 | echo !include "turboc.mak" >makefile | |
180 | (for Turbo C), or | |
181 | echo !include "tbcplus.mak" >makefile | |
182 | (for Turbo C++ or Borland C++). | |
183 | ||
184 | Besides the source files and the makefiles, you need: | |
185 | turboc.cfg (the flags and switches for Turbo C) | |
186 | gt.tr (the linker commands for the library test program - optional) | |
187 | gs.tr (the linker commands for the interpreter) | |
188 | *.bat (a variety of batch files used in the build process) | |
189 | ||
190 | There are extensive comments in the turboc.mak and tbcplus.mak files | |
191 | regarding various configuration parameters. If your configuration is | |
192 | different from the following, you should definitely read those comments | |
193 | and see if you want or need to change any of the parameters: | |
194 | - The compiler files are in c:\tc (for Turbo C) or c:\bc (for | |
195 | Turbo C++ or Borland C++) and its subdirectories. | |
196 | - You are using the Borland assembler (tasm). | |
197 | - You want an executable that will run on any PC-compatible, | |
198 | regardless of processor type (8088, 8086, V20, 80186, 80286, V30, 80386, | |
199 | 80486) and regardless of whether a math coprocessor (80x87) is present. | |
200 | ||
201 | Watcom environment | |
202 | ------------------ | |
203 | ||
204 | To avoid annoying messages from the DOS extender, add the line | |
205 | set DOS4G=quiet | |
206 | to your autoexec.bat file. | |
207 | ||
208 | To compile Ghostscript with the Watcom C/386 compiler, you need to create | |
209 | a makefile by executing | |
210 | ||
211 | echo !include watc.mak >makefile | |
212 | ||
213 | To build Ghostscript, execute | |
214 | ||
215 | wmake -u | |
216 | ||
217 | ******** | |
218 | ******** How to build Ghostscript from source (Unix version) ******** | |
219 | ******** | |
220 | ||
221 | The makefile distributed with Ghostscript selects the following devices | |
222 | for inclusion in the build: | |
223 | X Windows driver only. | |
224 | ||
225 | Before compiling or linking, you should execute | |
226 | ||
227 | ln -s unix-cc.mak makefile | |
228 | or ln -s unix-gcc.mak makefile | |
229 | or ln -s unix-ansi.mak makefile | |
230 | ||
231 | depending on whether your C compiler is a standard Kernighan & Ritchie C | |
232 | compiler, gcc being used in ANSI mode, or an ANSI C compiler other than | |
233 | gcc respectively. (If you want to use gcc in non-ANSI mode, use | |
234 | unix-cc.mak and define the CC macro to refer to gcc.) | |
235 | ||
236 | If the X11 client header files are located in some directory which your | |
237 | compiler does not automatically search, you must change the XINCLUDE macro | |
238 | the makefile to include a specific -I switch. See the comment preceding | |
239 | XINCLUDE in the makefile. | |
240 | ||
241 | The only important customization of the X11 driver is the choice of | |
242 | whether or not to use a backing pixmap. If you use a backing pixmap, | |
243 | Ghostscript windows will redisplay properly when they are covered and | |
244 | exposed, but drawing operations will go slower. This choice is controlled | |
245 | by a line in the file gdevx.c that says | |
246 | private int use_backing = 1; | |
247 | Changing this line to read | |
248 | private int use_backing = 0; | |
249 | will disable the use of a backing pixmap. However, portions of the | |
250 | Ghostscript window may not be properly redrawn after the window is | |
251 | restored from an icon or exposed after being occluded by another window. | |
252 | ||
253 | Some versions of the X server do not implement tiling properly. This will | |
254 | show up as broad bands of color where dither patterns should appear. If | |
255 | this happens, change | |
256 | private int use_XSetTile = 1; | |
257 | to | |
258 | private int use_XSetTile = 0; | |
259 | and recompile. The result will run a lot slower, but the output should be | |
260 | correct. If this fixes the problem, report it to whoever made your X | |
261 | server. | |
262 | ||
263 | Similarly, some versions of the X server do not implement bitmap/pixmap | |
264 | displaying properly. This may show up as white or black rectangles where | |
265 | characters should appear, or characters may appear in "inverse video" | |
266 | (e.g., white on a black rectangle). If this happens, it may help you to | |
267 | change | |
268 | private int use_XPutImage = 1; | |
269 | to | |
270 | private int use_XPutImage = 0; | |
271 | and recompile. Again, there will be a serious performance penalty; again, | |
272 | if this fixes the problem, notify the supplier of your X server. | |
273 | ||
274 | Currently Ghostscript is set up to compile and link in a generic Unix | |
275 | environment. Some Unix environments may require changing the LDFLAGS | |
276 | macro in the makefile. | |
277 | ||
278 | All you need to do to make an executable is invoke the shell command | |
279 | make | |
280 | ||
281 | Ghostscript uses ANSI syntax for function definitions. Because of this, | |
282 | when compiling with cc, it must preprocess each .c file to convert it to | |
283 | the older syntax defined in Kernighan and Ritchie, which is what most | |
284 | current Unix compilers (other than gcc) support. This step is | |
285 | automatically performed by a utility called ansi2knr, which is included in | |
286 | the Ghostscript distribution. The makefile automatically builds ansi2knr. | |
287 | ||
288 | The ansi2knr preprocessing step is included in the makefile rule for | |
289 | compiling .c files. ansi2knr creates a file called _temp_.c to hold the | |
290 | converted code. If you want to change this name for some reason, it is | |
291 | defined in unix-cc.mak. | |
292 | ||
293 | Note that the abovementioned makefiles are actually generated mechanically | |
294 | from *head.mak, *tail.mak, gs.mak, and devs.mak. If you want to change | |
295 | the makefile, edit the appropriate one of these files, and then invoke the | |
296 | tar_cat | |
297 | shell script to reconstruct the unix-*.mak makefile. | |
298 | ||
299 | Platform-specific notes | |
300 | ----------------------- | |
301 | ||
302 | MIPS: | |
303 | There is apparently a bug in the MIPS C compiler which causes | |
304 | gxdither.c to compile incorrectly if optimization is enabled (-O). Until | |
305 | a work-around is found, do not use -O with the MIPS C compiler. | |
306 | ||
307 | Apollo: | |
308 | You must run the compiler in ANSI-compatible mode (i.e., set AK= | |
309 | <null string> in the makefile); otherwise, it gives incorrect error | |
310 | messages for any function declared as returning a float value. | |
311 | ||
312 | 386 Unix: | |
313 | Due to a compiler bug, if you are building Ghostscript on an Intel | |
314 | 80386 system using a version of gcc older than version 1.38, you must not | |
315 | use the -O option. | |
316 | ||
317 | Any platform with GNU make: | |
318 | GNU make 3.59 can't handle the final linking step in some cases; | |
319 | use the platform's standard make (e.g., /bin/make) if this happens. | |
320 | ||
321 | Sun: | |
322 | The Sun unbundled C compiler (SC1.0) doesn't compile Ghostscript | |
323 | properly if the -fast option is selected: Ghostscript core-dumps in | |
324 | build_gs_font. Use -g, or use gcc. | |
325 | The standard Sun cc may not compile iscan.c correctly if | |
326 | optimization (-O) is selected. One symptom is that numbers such as 1.e-3 | |
327 | give a syntax error. This has been observed on a SPARCstation running | |
328 | SunOS 4.1.1. If this happens, use -g for this file, or use gcc. | |
329 | ||
330 | RS/6000: | |
331 | IBM RS/6000, you must define _POSIX_SOURCE and you must use the | |
332 | c89 compiler, not cc, e.g.: | |
333 | ||
334 | make -f unix-ansi.mak CC=c89 XCFLAGS=-D_POSIX_SOURCE \ | |
335 | XINCLUDE=-I/usr/misc/X11/include XLIBDIRS=-L/usr/misc/X11/lib | |
336 | ||
337 | Apparently some (but not all) releases of the C library declare the hypot | |
338 | function: if the declaration in math_.h produces an error message, try | |
339 | removing it. Also, the IBM X11R3 server is known to be buggy: use the MIT | |
340 | X server if possible. Even beyond all this, many people have trouble with | |
341 | Ghostscript on the RS/6000. The usual symptom is that it compiles and | |
342 | links OK, but produces garbaged output on the screen. The problem may be | |
343 | related to particular versions of AIX or the X server; we don't have | |
344 | enough information at this time. The following combinations of AIX and X | |
345 | are known to fail: | |
346 | AIX 3.1.5, MIT X11R4, c89 | |
347 | The following combinations are known to work: | |
348 | AIX 3.1.5, MIT X11R5, c89 | |
349 | ||
350 | ISC Unix: | |
351 | For ISC Unix with gcc, an appropriate make invocation is: | |
352 | make XCFLAGS="-D__SVR3 -posix" LDFLAGS="-shlib -posix" \ | |
353 | EXTRALIBS="-linet -lnsl_s" | |
354 | If this doesn't work for you, try removing the -shlib. | |
355 | ||
356 | SCO Unix: | |
357 | The SCO Unix C compiler apparently can't handle the Pn macros in | |
358 | std.h. If you get strange compilation errors on SCO Unix, see if you can | |
359 | get a compiler fix from SCO. Meanwhile, to use gcc with SCO ODT, see | |
360 | gcc-head.mak for the appropriate switch settings. | |
361 | ||
362 | DEC (Ultrix): | |
363 | Many versions of DEC's X server (DECwindows) have bugs that | |
364 | require setting use_XPutImage or use_XSetTile to 0, as described above. | |
365 | ||
366 | H-P 700 series: | |
367 | You may need to use +O1 rather than -O to get the compiler to | |
368 | produce correct code. | |
369 | ||
370 | ******** | |
371 | ******** How to build Ghostscript from source (VAX/VMS version) ******** | |
372 | ******** | |
373 | ||
374 | The files VMS-CC.MAK and VMS-GCC.MAK are VMS DCL command files which | |
375 | build Ghostscript from scratch using either the DEC C compiler, CC, or | |
376 | the Free Software Foundation's GNU C compiler, GCC. Accordingly, you | |
377 | must have one of these two compilers installed in order to build | |
378 | Ghostscript. (Other C compilers may work: CC and GCC are the only two | |
379 | compilers tested to date.) These two command files build and store | |
380 | the Ghostscript library in the object library GS.OLB. If you have | |
381 | DECwindows (X11) installed on your system, the executable images GS.EXE, | |
382 | GT.EXE, and XLIB.EXE will also be built. | |
383 | ||
384 | The only important customization of the X11 driver is the choice of | |
385 | whether or not to use a backing pixmap. If you use a backing pixmap, | |
386 | Ghostscript windows will redisplay properly when they are covered and | |
387 | exposed, but drawing operations will go slower. This choice is controlled | |
388 | by the line in the file gdevx.c that reads | |
389 | private int use_backing = 1; | |
390 | Changing this line to read | |
391 | private int use_backing = 0; | |
392 | will disable the use of a backing pixmap. However, portions of the | |
393 | Ghostscript window may not be properly redrawn after the window is | |
394 | restored from an icon or exposed after being occluded by another window. | |
395 | ||
396 | Many versions of DEC's X server (DECwindows) have bugs that require | |
397 | setting use_XPutImage or use_XSetTile to 0, as described above. These | |
398 | show up as broad bands of color where dither patterns should appear, or | |
399 | characters displayed white on top of black rectangles or not displayed at | |
400 | all. If this happens, change use_XSetTile or use_XPutImage to 0 as | |
401 | described above. The result will run a lot slower, but the output will be | |
402 | correct. Report the problem to DEC, or whoever supplied your X server. | |
403 | ||
404 | Ghostscript uses ANSI syntax for function definitions. Thus, when using | |
405 | the DEC C compiler, each .C file is converted to the older C syntax defined | |
406 | in the first edition of Kernighan and Ritchie and stored in a .CC file. | |
407 | This step is performed by VMS-CC.MAK using the ansi2knr utility included | |
408 | in the Ghostscript distribution. If you are building a debuggable | |
409 | configuration, the .CC files will be left behind by VMS-CC.MAK for use by | |
410 | the VMS Debugger; otherwise, they will be deleted. | |
411 | ||
412 | If you have DEC's C compiler, issue the DCL command | |
413 | $ @VMS-CC.MAK | |
414 | to build Ghostscript. If you have GNU C, issue the DCL command | |
415 | $ @VMS-GCC.MAK | |
416 | to build Ghostscript. | |
417 | ||
418 | The option "DEBUG" may be specified with either command file in order to | |
419 | build a debuggable Ghostscript configuration: | |
420 | $ @VMS-CC.MAK DEBUG -or- $ @VMS-GCC.MAK DEBUG | |
421 | ||
422 | In order to specify switches and file names when invoking the interpreter, | |
423 | define GS as a foreign command: | |
424 | $ GS == "$disk:[directory]GS.EXE" | |
425 | where "disk" and "directory" specify the disk and directory where Ghostscript | |
426 | is located. For instance, | |
427 | $ GS == "$DUA1:[GHOSTSCRIPT]GS.EXE" | |
428 | To allow the interpreter to be run from any directory, define the logical | |
429 | GS_LIB which points to the Ghostscript directory | |
430 | $ DEFINE GS_LIB disk:[directory] | |
431 | This allows Ghostscript to locate its initialization files stored in the | |
432 | Ghostscript directory -- see use.doc for further details. Finally, to | |
433 | invoke the interpreter, merely type GS. Although DCL normally converts | |
434 | unquoted parameters to upper case, C programs receive their parameters in | |
435 | lower case. That is, the command | |
436 | $ GS -Isys$login: | |
437 | passes the switch "-isys$login" to the interpreter. To preserve the | |
438 | case of switches, enclose them in double quotes; e.g., | |
439 | $ GS "-Isys$login:" | |
440 | ||
441 | ******** | |
442 | ******** A guide to the files ******** | |
443 | ******** | |
444 | ||
445 | General | |
446 | ------- | |
447 | ||
448 | There are very few machine dependencies in Ghostscript. A few of the .c | |
449 | files are machine-specific. These have names of the form | |
450 | gp_<platform>.c | |
451 | specifically | |
452 | gp_dos.c | |
453 | gp_unix.c | |
454 | gp_vms.c | |
455 | There are also some machine-specific conditionals in files with names | |
456 | <something>_.h, and in gdevmem.c. If you are going to extend Ghostscript | |
457 | to new machines or operating systems, you should check all the source | |
458 | files (both .c and .h) for ifdef's on things other than DEBUG, and you | |
459 | should probably count on making a new makefile and a new gp_ file. | |
460 | ||
461 | Library | |
462 | ------- | |
463 | ||
464 | gt.c is a test driver for the library. | |
465 | ||
466 | Files beginning with gs, gx, or gz (both .c and .h), other than gs.c, are | |
467 | the Ghostscript library. Files beginning with gdev are device drivers or | |
468 | related code, also part of the library. Other files beginning with g are | |
469 | library files that don't fall neatly into either the kernel or the driver | |
470 | category. | |
471 | ||
472 | Interpreter | |
473 | ----------- | |
474 | ||
475 | gs.c is the main program for the language interpreter. | |
476 | ||
477 | Files beginning with z are Ghostscript operator files. The names of the | |
478 | files generally follow the section headings of the operator summary in | |
479 | section 6.2 of the PostScript manual. | |
480 | ||
481 | .c files beginning with i, and .h files not beginning with g, are the | |
482 | rest of the interpreter. See the makefile for a little more information | |
483 | on how the files are divided functionally. | |
484 | ||
485 | There are a few files that are logically part of the interpreter, but that | |
486 | are potentially useful outside Ghostscript, whose names don't begin with | |
487 | either g, z, or i: | |
488 | ||
489 | s*.c (a flexible stream package, including the Level 2 PostScript | |
490 | 'filters' supported by Ghostscript); | |
491 | ||
492 | trace.c (a procedure tracing package for debugging) and utrace.c | |
493 | (the Unix stub for trace.c). |