?? make.htm
字號:
<html>
<head>
<title>How to build Ghostscript from source code</title>
<!-- $Id: Make.htm $ -->
<!-- Originally: make.txt -->
</head>
<body>
<!-- [1.0 begin visible header] -------------------------------------------- -->
<!-- [1.1 begin headline] -------------------------------------------------- -->
<p><table width="100%" border="0">
<tr><th align="center" bgcolor="#CCCC00"><font size=6>
How to build Ghostscript from source code
</font>
</table>
<!-- [1.1 end headline] ---------------------------------------------------- -->
<!-- [1.2 begin table of contents] ----------------------------------------- -->
<h2>Table of contents</h2>
<blockquote><ul>
<li><a href="#General_overview">General overview</a>
<li><a href="#Acquiring">How to acquire the source code</a>
<ul>
<li><a href="#Ghostscript_source">Ghostscript source code</a>
<li><a href="#Third-party_libraries">Third-party library source code</a>
</ul>
<li><a href="#Unpack">How to unpack the source code</a>
<ul>
<li><a href="#Tarfiles">How to unpack compressed tar files generally</a>
<li><a href="#Zipfiles">How to unpack zip files generally</a>
<li><a href="#Unpack_Ghostscript">How to unpack Ghostscript itself</a>
<li><a href="#Unpack_libraries">How to unpack the third-party libraries</a>
</ul>
<li><a href="#Bug_check">How to check for post-release bug fixes</a>
<li><a href="#Makefile_overview">How to prepare the makefiles</a>
<ul>
<li><a href="#Preparing_makefiles">Changes for your environment</a>
<li><a href="#Features_and_devices">Selecting features and devices</a>
<ul>
<li><a href="#LZW">LZW compression</a>
</ul>
<li><a href="#Makefile_setup">Setting up "makefile"</a>
<li><a href="#Invoke_make">Invoking "make"</a>
<li><a href="#Cross-compiling">Cross-compiling</a>
</ul>
<li><a href="#PC_build">How to build Ghostscript from source (PC version)</a>
<ul>
<li><a href="#Borland_build">Borland environment</a>
<li><a href="#Microsoft_build">Microsoft environment</a>
<li><a href="#Watcom_build">Watcom environment</a>
<li><a href="#Cygwin32_build">Cygwin32 gcc</a>
</ul>
<li><a href="#Mac_build">How to build Ghostscript from source (Mac version)</a>
<li><a href="#Unix_build">How to build Ghostscript from source (Unix version)</a>
<ul>
<li><a href="#UNIX_makefile">Setting up "makefile"</a>
<li><a href="#Unix_build_problems">Unix build problems (and solutions)</a>
<ul>
<li><a href="#gcc_27x">gcc 2.7.*</a>
<li><a href="#GNU_make">GNU make</a>
<li><a href="#386_Unix">386 Unix</a>
<li><a href="#Alpha_with_gcc">Alpha with gcc</a>
<li><a href="#Apollo">H-P Apollo</a>
<li><a href="#ATT_7040">AT&T 7040 R3</a>
<li><a href="#Convex">Convex</a>
<li><a href="#DECStations">DECStations with Ultrix</a>
<li><a href="#Digital_Unix">Digital Unix (Alpha)</a>
<li><a href="#HP_RISC">H-P RISC workstations</a>
<li><a href="#Intergraph">Intergraph Clipper</a>
<li><a href="#Linux">Linux</a>
<li><a href="#MIPS">MIPS</a>
<li><a href="#NCR_3550">NCR 3550</a>
<li><a href="#NeXTSTEP">NeXTSTEP</a>
<li><a href="#Pyramid">Pyramid MIServer-S</a>
<li><a href="#RS6000">IBM RS/6000</a>
<li><a href="#SCO">SCO Unix/Xenix</a>
<li><a href="#Silicon_Graphics">Silicon Graphics</a>
<li><a href="#Sun">Sun</a>
<ul>
<li><a href="#SunOS">SunOS</a>
<li><a href="#Solaris">Solaris</a>
</ul>
<li><a href="#SVR4">SVR4 Unix</a>
<li><a href="#System_V">System V Unix platforms</a>
<li><a href="#Unixware">Unixware</a>
<li><a href="#VAX_Ultrix">VAX with Ultrix</a>
</ul>
</ul>
<li><a href="#OS2_build">How to build Ghostscript from source (OS/2 version)</a>
<li><a href="#VMS_build">How to build Ghostscript from source (VMS version)</a>
<ul>
<li><a href="#GNU_make_VMS">Building with GNU make on OpenVMS</a>
</ul>
<li><a href="#Other_environments">Other environments</a>
<ul>
<li><a href="#Plan_9">Plan 9</a>
<li><a href="#QNX">QNX</a>
</ul>
</ul></blockquote>
<!-- [1.2 end table of contents] ------------------------------------------- -->
<!-- [1.3 begin hint] ------------------------------------------------------ -->
<p>For other information, see the <a href="Readme.htm">Ghostscript
overview</a> and the instructions on how to <a href="Install.htm">install
Ghostscript</a>.
<!-- [1.3 end hint] -------------------------------------------------------- -->
<hr>
<!-- [1.0 end visible header] ---------------------------------------------- -->
<!-- [2.0 begin contents] -------------------------------------------------- -->
<h1><a name="General_overview"></a>General overview</h1>
<p>
This document describes how to build a Ghostscript executable from source
code. There are four major steps to building Ghostscript:
<ol>
<li>Acquire the compressed archive files of source code for Ghostscript and
the required third-party libraries.
<li>Unpack the archive files into the Ghostscript directory and correctly
named subdirectories.
<li>Prepare the makefiles, including specific changes for your operating
environment and your choice of configuration options.
<li>Invoke "<b><tt>make</tt></b>" to build the software.
</ol>
<p>
The remainder of this document describes each of these steps in detail.
Note that some of this process is platform-dependent. After building
Ghostscript you must then install it; for that, see the
<a href="Install.htm">installation instructions</a>.
<hr>
<h1><a name="Acquiring"></a>How to acquire the source code</h1>
<p>
Building Ghostscript requires the Ghostscript source code itself, and also
the source code for some third-party libraries that Ghostscript uses.
<h2><a name="Ghostscript_source"></a>Ghostscript source code</h2>
<p><a name="Authoritative_distribution_site"></a>
There are two kinds of Ghostscript distributions available, called "Aladdin
Ghostscript" and "GNU Ghostscript"; the distinction between them is
explained in the <a href="Commprod.htm">conditions for distributing
Ghostscript</a>. The authoritative distribution site for Aladdin
Ghostscript is
<blockquote>
<a href="ftp://ftp.cs.wisc.edu/ghost/aladdin/">ftp://ftp.cs.wisc.edu/ghost/aladdin/</a>gs###
</blockquote>
<p>
where "###" is the unpunctuated version number. GNU Ghostscript should be
available on all GNU sites, such as
<blockquote>
<a href="ftp://ftp.gnu.org/pub/gnu/">ftp://ftp.gnu.org/pub/gnu/</a>
</blockquote>
<p>
Ghostscript source code is packaged in two different formats:
gzip-compressed tar files (*<b><tt>.tar.gz</tt></b>) and zip files
(*<b><tt>.zip</tt></b>). For all versions there are gzip-compressed tar
files:
<blockquote>
<b><tt>ghostscript-</tt></b>#.##<b><tt>.tar.gz</tt></b><br>
<b><tt>ghostscript-fonts-std-</tt></b>#.##<b><tt>.tar.gz</tt></b><br>
<b><tt>ghostscript-fonts-other-</tt></b>#.##<b><tt>.tar.gz</tt></b>
</blockquote>
<p>For recent versions of Aladdin Ghostscript -- <b><em>not</em></b> GNU
Ghostscript -- there are also zip files (each zipped file fits onto a
single 1.44MB diskette):
<blockquote>
<b><tt>gs</tt></b>###<b><tt>fn</tt></b>*<b><tt>.zip</tt></b><br>
<b><tt>gs</tt></b>###<b><tt>sr</tt></b>*<b><tt>.zip</tt></b>
</blockquote>
<p>
("#.##" and "###" are version numbers in punctuated and unpunctuated form.)
Software to decompress and extract both formats is available for almost
every platform for which Ghostscript is available -- including Unix, DOS,
MS Windows, and VMS -- so you can choose the format most convenient for
you; but it's up to you to locate that software. See the section on <a
href="#Unpack">unpacking the source code</a>.
<h2><a name="Third-party_libraries"></a>Third-party library source code</h2>
<p>
To build Ghostscript you need the source code for the <a
href="http://www.ijg.org/">Independent JPEG Group</a> (IJG) library, the
<a href="http://www.cdrom.com/pub/png/">Portable Network Graphics</a> (PNG)
library, and the <a href="http://www.cdrom.com/pub/infozip/zlib/">zlib</a>
compression and decompression library. Here are authoritative distribution
points for these libraries, where as elsewhere, "#" is used for version
numbers. The JPEG source code is quite stable, so the reference
here includes the latest version number. The zlib references are
version-independent and should always provide the latest version.
<blockquote><table cellpadding=0 cellspacing=0>
<tr><th colspan=3 bgcolor="#CCCC00"><hr><font size="+1">Third-party libraries: authoritative sources</font><hr>
<tr> <td valign=top>JPEG
<td>
<td><a href="ftp://ftp.uu.net/graphics/jpeg/">ftp://ftp.uu.net/graphics/jpeg/</a><a href="ftp://ftp.uu.net/graphics/jpeg/jpegsrc.v6b.tar.gz">jpegsrc.v6b.tar.gz</a><br>
<a href="ftp://ftp.simtel.net/pub/simtelnet/msdos/graphics/">ftp://ftp.simtel.net/pub/simtelnet/msdos/graphics/</a><a href="ftp://ftp.simtel.net/pub/simtelnet/msdos/graphics/jpegsr6b.zip">jpegsr6b.zip</a>
<tr> <td valign=top>PNG
<td>
<td><a href="ftp://swrinde.nde.swri.edu/pub/png/src/">ftp://swrinde.nde.swri.edu/pub/png/src/</a>libpng-#.#.#.tar.gz<br>
<a href="ftp://swrinde.nde.swri.edu/pub/png/src/">ftp://swrinde.nde.swri.edu/pub/png/src/</a>lpng###.zip<br>
<a href="http://www.cdrom.com/pub/png/src/">http://www.cdrom.com/pub/png/src/</a>libpng-#.#.#.tar.gz<br>
<a href="http://www.cdrom.com/pub/png/src/">http://www.cdrom.com/pub/png/src/</a>lpng###.zip
<tr> <td valign=top>zlib (latest)
<td>
<td> <a href="ftp://ftp.cdrom.com/pub/infozip/zlib/zlib.tar.gz">ftp://ftp.cdrom.com/pub/infozip/zlib/zlib.tar.gz</a><br>
<a href="ftp://ftp.cdrom.com/pub/infozip/zlib/zlib.zip">ftp://ftp.cdrom.com/pub/infozip/zlib/zlib.zip</a><br>
<a href="http://www.cdrom.com/pub/infozip/zlib/zlib.tar.gz">http://www.cdrom.com/pub/infozip/zlib/zlib.tar.gz</a><br>
<a href="http://www.cdrom.com/pub/infozip/zlib/zlib.zip">http://www.cdrom.com/pub/infozip/zlib/zlib.zip</a>
</table></blockquote>
<p>
On DOS or MS Windows one ordinarily uses the zip file kits, in other
environments the compressed tar files, but this is simply a matter of
convenience, since for the same version of the software the compressed tar
file has the same contents as the zip file. Note that each of these
libraries has <b><em>its own version number</em></b> that has
<b><em>nothing to do with Ghostscript's version number</em></b>; you should
get the highest numbered version. (If you encounter difficulties in the
build process you might have to use a lower-numbered version, but don't
worry about this yet.) If you're running Linux, you might check whether
these libraries are already available in source form on your system, since
many Linux distributors include them; but we advise you to get the highest
version from the Net if you can.
<p>
Although the zip archives of an old version of the PNG library may not be
named <b><tt>lpng</tt></b>###<b><tt>.zip</tt></b>, we refer to it as
<b><tt>lpng</tt></b>###<b><tt>.zip</tt></b>.
<hr>
<h1><a name="Unpack"></a>How to unpack the source code</h1>
<p>
Unfortunately there are no generally accepted standards for how to package
source code into archives, so the instructions for unpacking Ghostscript
are longer than they should be. We begin with a brief explanation of how
to extract the two kinds of archive files.
<h2><a name="Tarfiles"></a>How to unpack compressed tar files generally</h2>
<p>
Tar (<b><tt>.tar</tt></b>) files are the <em>de facto</em> standard for
archiving files on Unix (every Unix system has the <b><tt>tar</tt></b>
program), and programs to extract their contents are also widely available
for DOS, MS Windows, and VMS. To economize on space and downloading time,
Ghostscript's tar files are compressed with GNU <b><tt>gzip</tt></b>, which
adds the suffix "<b><tt>.gz</tt></b>" to the file name, giving
"<b><tt>.tar.gz</tt></b>".
<p>
To unpack a compressed tar file <b><tt>MyArchive.tar.gz</tt></b> you
must both decompress it and extract the contents. You can do this in two
steps, one to decompress the file and another to unpack it:
<blockquote>
<b><tt>gzip -d MyArchive.tar.gz</tt></b>
<br><b><tt>tar -xf MyArchive.tar</tt></b>
</blockquote>
<p>
or in a pipeline:
<blockquote>
<b><tt>gzip -d -c MyArchive.tar.gz | tar -xf -</tt></b>
</blockquote>
<p>
or, if you have a program like GNU <b><tt>tar</tt></b> that can handle
compressed tar files, with a single command:
<blockquote>
<b><tt>tar -zxf MyArchive.tar.gz</tt></b>
</blockquote>
<p>
The <b><tt>tar</tt></b> program automatically preserves directory structure
in extracting files. The Ghostscript source archive puts all files under a
directory <b><tt>gs</tt></b>#.##, so using <b><tt>tar</tt></b> to unpack a
compressed archive should always properly create that directory, which we
will call the "gs directory". Make sure you're positioned in the
<b><em>parent</em></b> of the gs directory <b><em>before</em></b> unpacking
the files. If a subdirectory doesn't already exist, <b><tt>tar</tt></b>
creates it.
<p>
Some other programs -- under MS Windows, for instance -- can also unpack
compressed tar files, but they may not automatically preserve directory
structure nor even extract files into the current directory. If you use
one of these, you must
<ul>
<li>set the program's options to "Use folder names" or the equivalent, and
<li>check that it is extracting files into the right place.
</ul>
<h2><a name="Zipfiles"></a>How to unpack zip files generally</h2>
<p>
Zip files are the <em>de facto</em> standard for archiving files on DOS and
MS Windows, and programs to extract their contents are widely available for
DOS, MS Windows, Unix, VMS, and other platforms. Zip files are at once an
archive format and a compressed format, so an unzipping program
decompresses and extracts archived files as a single step.
<p>
One common 16-bit DOS program is <b><tt>pkunzip</tt></b>, which comes in
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -