home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-387-Vol-3of3.iso / g / gs252src.zip / GS252 / MAKE.DOC < prev    next >
Text File  |  1992-09-16  |  22KB  |  525 lines

  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. To find out what devices the makefiles distributed with Ghostscript
  115. select for inclusion in the executable, find the lines in the
  116. appropriate makefiles of the form
  117.     FEATURE_DEVS=<list of features>
  118. and
  119.     DEVICE_DEVS=<list of devices>
  120.     (similarly DEVICE_DEVS2... up to DEVICE_DEVS5)
  121. The relevant makefiles are:
  122.     Turbo C: turboc.mak
  123.     Borland C++, MS-DOS: tbcplus.mak
  124.     Borland C++, MS Windows: bcwin.mak
  125.     Watcom C/386, MS-DOS: watc.mak
  126. The options were chosen to strike a balance between RAM consumption
  127. and likely usefulness.  (Turbo C is limited to 640K and does not
  128. support code overlaying; Borland C++ is limited to 640K, but supports
  129. code overlaying under MS-DOS; Watcom C/386 is not limited to 640K.)
  130.  
  131. To build Ghostscript, you need MS-DOS version 3.3 or later, and a Borland
  132. C/C++ development system or the Watcom C/386 development system.  Details
  133. are given below.
  134.  
  135. As noted above, the default configuration generates an executable that
  136. assumes the directory where 'make' was run should be the final default
  137. directory for looking up the Ghostscript initialization and font files.
  138.  
  139. To build the Ghostscript executable, all you need to do is give the
  140. command
  141.     make
  142. You must have COMMAND.COM in your path to build Ghostscript.
  143.  
  144. There is a special 'make' target that simply attempts to compile all the
  145. .c files in the current directory.  Some of these compilations will fail,
  146. but the ones that succeed will go considerably faster, because they don't
  147. individually pay the overhead of loading the compiler into memory.  So a
  148. good strategy for building the executable for the first time, or after a
  149. change to a very widely used .h file, is:
  150.     make begin
  151. and then
  152.     make
  153. to do the compilations that failed the first time.
  154.  
  155. Note: if you get the Ghostscript sources from a Unix 'tar' file and unpack
  156. the file on a MS-DOS machine, the files will all have linefeed instead of
  157. carriage return + linefeed as the line terminator, which will make the C
  158. compiler unhappy.  I don't know the simplest way to fix this: just reading
  159. each file into an editor and writing it back out again may be sufficient.
  160.  
  161. Borland environment
  162. -------------------
  163.  
  164. To compile Ghostscript with the Borland environment, you need either Turbo
  165. C (version 2.0 or later) or Turbo C++ or Borland C++ (version 1.0 or
  166. later); specifically, the compiler, 'make' utility, and linker.  You also
  167. need either the Borland assembler (version 1.0 or later) or the Microsoft
  168. assembler (version 4.0 or later).  Before compiling or linking, you should
  169. execute
  170.     echo !include "turboc.mak" >makefile
  171. (for Turbo C and MS-DOS), or
  172.     echo !include "tbcplus.mak" >makefile
  173. (for Turbo C++ or Borland C++ and MS-DOS), or
  174.     echo !include "bcwin.mak" >makefile
  175. (for Turbo C++ or Borland C++ and Microsoft Windows), or
  176.  
  177. Besides the source files and the makefiles, you need:
  178.     turboc.cfg (the flags and switches for Turbo C)
  179.     gs.tr (the linker commands for the interpreter)
  180.     *.bat (a variety of batch files used in the build process)
  181.  
  182. There are extensive comments in the aforementioned .mak files
  183. regarding various configuration parameters.  If your configuration is
  184. different from the following, you should definitely read those
  185. comments and see if you want or need to change any of the parameters:
  186.     - The compiler files are in c:\tc (for Turbo C) or c:\bc (for
  187. Turbo C++ or Borland C++) and its subdirectories.
  188.     - You are using the Borland assembler (tasm).
  189.     - You want an executable that will run on any PC-compatible,
  190. regardless of processor type (8088, 8086, V20, 80186, 80286, V30, 80386,
  191. 80486) and regardless of whether a math coprocessor (80x87) is present.
  192.  
  193. NOTE: Borland C++ 3.0 has two problems that affect Ghostscript:
  194.  
  195.     - The assembler, tasm, often crashes when attempting to
  196. assemble gdevegaa.asm.  If this happens, try again, or use another
  197. assembler (e.g., an older version of tasm) if you have one, or set
  198. USE_ASM=0 in the makefile.
  199.  
  200.     - The math library for Microsoft Windows, mathwl.lib, has a
  201. bug that causes floating point numbers to print incorrectly.  Contact
  202. Borland for a corrected version.
  203.  
  204. Watcom environment
  205. ------------------
  206.  
  207. To avoid annoying messages from the DOS extender, add the line
  208.     set DOS4G=quiet
  209. to your autoexec.bat file. 
  210.  
  211. To compile Ghostscript with the Watcom C/386 compiler, you need to create
  212. a makefile by executing
  213.  
  214.     echo !include watc.mak >makefile
  215.  
  216. To build Ghostscript, execute
  217.  
  218.     wmake -u
  219.  
  220. ********
  221. ******** How to build Ghostscript from source (Unix version) ********
  222. ********
  223.  
  224. The makefile distributed with Ghostscript selects the following devices
  225. for inclusion in the build:
  226.     X Windows driver only.
  227.  
  228. Before compiling or linking, you should execute
  229.  
  230.     ln -s unix-cc.mak makefile
  231. or    ln -s unix-gcc.mak makefile
  232. or    ln -s unix-ansi.mak makefile
  233.  
  234. depending on whether your C compiler is a standard Kernighan & Ritchie C
  235. compiler, gcc being used in ANSI mode, or an ANSI C compiler other than
  236. gcc respectively.  (If you want to use gcc in non-ANSI mode, use
  237. unix-cc.mak and define the CC macro to refer to gcc.)
  238.  
  239. If the X11 client header files are located in some directory which your
  240. compiler does not automatically search, you must change the XINCLUDE macro
  241. the makefile to include a specific -I switch.  See the comment preceding
  242. XINCLUDE in the makefile.
  243.  
  244. The only important customization of the X11 driver is the choice of
  245. whether or not to use a backing pixmap.  If you use a backing pixmap,
  246. Ghostscript windows will redisplay properly when they are covered and
  247. exposed, but drawing operations will go slower.  This choice is controlled
  248. by a line in the file gdevxini.c that says
  249.     private int use_backing = 1;
  250. Changing this line to read
  251.     private int use_backing = 0;
  252. will disable the use of a backing pixmap.  However, portions of the
  253. Ghostscript window may not be properly redrawn after the window is
  254. restored from an icon or exposed after being occluded by another window.
  255.  
  256. Some versions of the X server do not implement tiling properly.  This will
  257. show up as broad bands of color where dither patterns should appear.  If
  258. this happens, in the file gdevx.c, change
  259.     private int use_XSetTile = 1;
  260. to
  261.     private int use_XSetTile = 0;
  262. and recompile.  The result will run a lot slower, but the output should be
  263. correct.  If this fixes the problem, report it to whoever made your X
  264. server.
  265.  
  266. Similarly, some versions of the X server do not implement bitmap/pixmap
  267. displaying properly.  This may show up as white or black rectangles where
  268. characters should appear, or characters may appear in "inverse video"
  269. (e.g., white on a black rectangle).  If this happens, it may help you to
  270. change, in the file gdevx.c,
  271.     private int use_XPutImage = 1;
  272. to
  273.     private int use_XPutImage = 0;
  274. and recompile.  Again, there will be a serious performance penalty; again,
  275. if this fixes the problem, notify the supplier of your X server.
  276.  
  277. Currently Ghostscript is set up to compile and link in a generic Unix
  278. environment.  Some Unix environments may require changing the LDFLAGS
  279. macro in the makefile.
  280.  
  281. All you need to do to make an executable is invoke the shell command
  282.     make
  283.  
  284. Ghostscript uses ANSI syntax for function definitions. Because of this,
  285. when compiling with cc, it must preprocess each .c file to convert it to
  286. the older syntax defined in Kernighan and Ritchie, which is what most
  287. current Unix compilers (other than gcc) support.  This step is
  288. automatically performed by a utility called ansi2knr, which is included in
  289. the Ghostscript distribution.  The makefile automatically builds ansi2knr.
  290.  
  291. The ansi2knr preprocessing step is included in the makefile rule for
  292. compiling .c files.  ansi2knr creates a file called _temp_.c to hold the
  293. converted code.  If you want to change this name for some reason, it is
  294. defined in unix-cc.mak.
  295.  
  296. Note that the abovementioned makefiles are actually generated mechanically
  297. from *head.mak, *tail.mak, gs.mak, and devs.mak.  If you want to change
  298. the makefile, edit the appropriate one of these files, and then invoke the
  299.     tar_cat
  300. shell script to reconstruct the unix-*.mak makefile.
  301.  
  302. Platform-specific notes
  303. -----------------------
  304.  
  305. 386 Unix:
  306.     Due to a compiler bug, if you are building Ghostscript on an Intel
  307. 80386 system using a version of gcc older than version 1.38, you must not
  308. use the -O option.
  309.     X11R5 may need #include <stddef.h> in x_.h.
  310.     Also see below regarding System V platforms.
  311.  
  312. Apollo:
  313.     You must run the compiler in ANSI-compatible mode (i.e., set AK=
  314. <null string> in the makefile); otherwise, it gives incorrect error
  315. messages for any function declared as returning a float value.
  316.  
  317. Convex:
  318.     Use unix-ansi.mak.  Do not invoke optimization (-O1): there
  319. are compiler bugs that lead to incorrect code.  Set CFLAGS to
  320.     -fn -tm -no c1
  321.  
  322. DEC (Ultrix):
  323.     Many versions of DEC's X server (DECwindows) have bugs that
  324. require setting use_XPutImage or use_XSetTile to 0, as described above.
  325.  
  326. H-P 700 series:
  327.     Use the compiler flags -Aa +O3 (*not* -O).
  328.  
  329. ISC Unix:
  330.     For ISC Unix with gcc, an appropriate make invocation is:
  331.     make XCFLAGS="-D__SVR3 -posix" LDFLAGS="-shlib -posix" \
  332.          EXTRALIBS="-linet -lnsl_s"
  333. If this doesn't work for you, try removing the -shlib.  ISC Unix may
  334. also need one or more of the following in EXTRALIBS: -lpt, -lc_s.
  335. See also under "386 Unix" above.
  336.  
  337. MIPS:
  338.     There is apparently a bug in the MIPS C compiler which causes
  339. gxdither.c to compile incorrectly if optimization is enabled (-O).  Until
  340. a work-around is found, do not use -O with the MIPS C compiler.
  341.  
  342. Any platform with GNU make:
  343.     GNU make 3.59 can't handle the final linking step in some cases;
  344. use the platform's standard make (e.g., /bin/make) if this happens.
  345.  
  346. RS/6000:
  347.     IBM RS/6000, you must define _POSIX_SOURCE and you must use the
  348. c89 compiler, not cc, e.g.:
  349.  
  350.     make -f unix-ansi.mak CC=c89 XCFLAGS=-D_POSIX_SOURCE \
  351.     XINCLUDE=-I/usr/misc/X11/include XLIBDIRS=-L/usr/misc/X11/lib
  352.  
  353. Apparently some (but not all) releases of the C library declare the hypot
  354. function: if the declaration in math_.h produces an error message, try
  355. removing it.  Also, the IBM X11R3 server is known to be buggy: use the MIT
  356. X server if possible.  Even beyond all this, many people have trouble with
  357. Ghostscript on the RS/6000.  The usual symptom is that it compiles and
  358. links OK, but produces garbaged output on the screen.  The problem may be
  359. related to particular versions of AIX or the X server; we don't have
  360. enough information at this time.  The following combinations of AIX and X
  361. are known to fail:
  362.     AIX 3.1.5, MIT X11R4, c89
  363. The following combinations are known to work:
  364.     AIX 3.1.5, MIT X11R5, c89
  365.     AIX 3.2, MIT X11R5, xlc 1.2.0.9
  366.  
  367. SCO Unix:
  368.     The SCO Unix C compiler apparently can't handle the Pn macros
  369. in std.h.  If you get strange compilation errors on SCO Unix, see if
  370. you can get a compiler fix from SCO.  Meanwhile, to use gcc with SCO
  371. ODT, see gcc-head.mak for the appropriate switch settings.  See also
  372. under "386 Unix" above.
  373.  
  374. Sun:
  375.     The Sun unbundled C compiler (SC1.0) doesn't compile Ghostscript
  376. properly if the -fast option is selected: Ghostscript core-dumps in
  377. build_gs_font.  Use -g, or use gcc.
  378.     The standard Sun cc may not compile iscan.c correctly if
  379. optimization (-O) is selected.  One symptom is that numbers such as 1.e-3
  380. give a syntax error.  This has been observed on a SPARCstation running
  381. SunOS 4.1.1.  If this happens, use -g for this file, or use gcc.
  382.  
  383. System V Unix platforms:
  384.     If you are using a stock System V platform that lacks rename
  385. and gettimeofday, change PLATFORM=unix_ in the makefile to
  386. PLATFORM=sysv_.
  387.  
  388. ********
  389. ******** How to build Ghostscript from source (VAX/VMS version) ********
  390. ********
  391.  
  392. The files VMS-CC.MAK and VMS-GCC.MAK are VMS DCL command files which
  393. build Ghostscript from scratch using either the DEC C compiler, CC, or
  394. the Free Software Foundation's GNU C compiler, GCC.  Accordingly, you
  395. must have one of these two compilers installed in order to build
  396. Ghostscript.  (Other C compilers may work: CC and GCC are the only two
  397. compilers tested to date.)  These two command files build and store
  398. the Ghostscript library in the object library GS.OLB.  If you have
  399. DECwindows (X11) installed on your system, the executable images GS.EXE,
  400. GT.EXE, and XLIB.EXE will also be built.
  401.  
  402. In some environments (perhaps only Motif, as opposed to DECWindows,
  403. environments), it may be necessary to add
  404. SYS$SHARE:DECW$XLIBSHR/SHARE or SYS$SHARE:DECW$XTSHR.EXE/SHARE to the
  405. list of link libraries, in addition to DWTLIBSHR.  Only two users
  406. have reported this problem, and we don't know under what
  407. circumstances it occurs.
  408.  
  409. The only important customization of the X11 driver is the choice of
  410. whether or not to use a backing pixmap.  If you use a backing pixmap,
  411. Ghostscript windows will redisplay properly when they are covered and
  412. exposed, but drawing operations will go slower.  This choice is controlled
  413. by the line in the file gdevx.c that reads
  414.     private int use_backing = 1;
  415. Changing this line to read
  416.     private int use_backing = 0;
  417. will disable the use of a backing pixmap.  However, portions of the
  418. Ghostscript window may not be properly redrawn after the window is
  419. restored from an icon or exposed after being occluded by another window.
  420.  
  421. Many versions of DEC's X server (DECwindows) have bugs that require
  422. setting use_XPutImage or use_XSetTile to 0, as described above.  These
  423. show up as broad bands of color where dither patterns should appear, or
  424. characters displayed white on top of black rectangles or not displayed at
  425. all.  If this happens, change use_XSetTile or use_XPutImage to 0 as
  426. described above.  The result will run a lot slower, but the output will be
  427. correct.  Report the problem to DEC, or whoever supplied your X server.
  428.  
  429. Ghostscript uses ANSI syntax for function definitions. Thus, when using
  430. the DEC C compiler, each .C file is converted to the older C syntax defined
  431. in the first edition of Kernighan and Ritchie and stored in a .CC file.
  432. This step is performed by VMS-CC.MAK using the ansi2knr utility included
  433. in the Ghostscript distribution.  If you are building a debuggable
  434. configuration, the .CC files will be left behind by VMS-CC.MAK for use by
  435. the VMS Debugger; otherwise, they will be deleted.
  436.  
  437. If you have DEC's C compiler, issue the DCL command
  438.         $ @VMS-CC.MAK
  439. to build Ghostscript.  If you have GNU C, issue the DCL command
  440.         $ @VMS-GCC.MAK
  441. to build Ghostscript.
  442.  
  443. The option "DEBUG" may be specified with either command file in order to
  444. build a debuggable Ghostscript configuration:
  445.         $ @VMS-CC.MAK DEBUG    -or-   $ @VMS-GCC.MAK DEBUG
  446.  
  447. In order to specify switches and file names when invoking the interpreter,
  448. define GS as a foreign command:
  449.         $ GS == "$disk:[directory]GS.EXE"
  450. where "disk" and "directory" specify the disk and directory where Ghostscript
  451. is located.  For instance,
  452.         $ GS == "$DUA1:[GHOSTSCRIPT]GS.EXE"
  453. To allow the interpreter to be run from any directory, define the logical
  454. GS_LIB which points to the Ghostscript directory
  455.         $ DEFINE GS_LIB disk:[directory]
  456. This allows Ghostscript to locate its initialization files stored in the
  457. Ghostscript directory -- see use.doc for further details.  Finally, to
  458. invoke the interpreter, merely type GS.  Although DCL normally converts
  459. unquoted parameters to upper case, C programs receive their parameters in
  460. lower case.  That is, the command
  461.         $ GS -Isys$login:
  462. passes the switch "-isys$login" to the interpreter.  To preserve the
  463. case of switches, enclose them in double quotes; e.g.,
  464.         $ GS "-Isys$login:"
  465.  
  466. If you add compiled fonts to your system as described in the fonts.doc
  467. file, you must C-compile them in an environment that includes some
  468. definitions from vms-cc.mak.  Find the section of vms-cc.mak with the
  469. comment "Give ourself a healthy search list for C include files" and
  470. execute the immediately following DEFINE commands before C-compiling the
  471. fonts.
  472.  
  473. ********
  474. ******** A guide to the files ********
  475. ********
  476.  
  477. General
  478. -------
  479.  
  480. There are very few machine dependencies in Ghostscript.  A few of the .c
  481. files are machine-specific.  These have names of the form
  482.     gp_<platform>.c
  483. specifically
  484.     gp_dosfb.c (all MS-DOS platforms)
  485.     gp_msdos.c (all MS-DOS platforms)
  486.     gp_itbc.c (MS-DOS, Borland compilers)
  487.     gp_iwatc.c (MS-DOS, Watcom compiler)
  488.     gp_unix.c (all Unix)
  489.     gp_sysv.c (System V Unix)
  490.     gp_vms.c (VMS)
  491. There are also some machine-specific conditionals in files with names
  492. <something>_.h.  If you are going to extend Ghostscript to new
  493. machines or operating systems, you should check the *_.h files for
  494. ifdef's on things other than DEBUG, and you should probably count on
  495. making a new makefile and a new gp_ file.
  496.  
  497. Library
  498. -------
  499.  
  500. Files beginning with gs, gx, or gz (both .c and .h), other than gs.c
  501. and gsmain.c, are the Ghostscript library.  Files beginning with gdev
  502. are device drivers or related code, also part of the library.  Other
  503. files beginning with g are library files that don't fall neatly into
  504. either the kernel or the driver category.
  505.  
  506. Interpreter
  507. -----------
  508.  
  509. gs.c is the main program for the language interpreter.
  510.  
  511. Files beginning with z are Ghostscript operator files.  The names of the
  512. files generally follow the section headings of the operator summary in
  513. section 6.2 of the PostScript manual.
  514.  
  515. .c files beginning with i, and .h files not beginning with g, are the
  516. rest of the interpreter.  See the makefile for a little more information
  517. on how the files are divided functionally.
  518.  
  519. There are a few files that are logically part of the interpreter, but that
  520. are potentially useful outside Ghostscript, whose names don't begin with
  521. either g, z, or i:
  522.  
  523.     s*.c (a flexible stream package, including the Level 2 PostScript
  524. 'filters' supported by Ghostscript);
  525.