⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 make.htm

📁 GhostScript的源代码
💻 HTM
📖 第 1 页 / 共 5 页
字号:
	<td>&nbsp;
	<td nowrap><b><tt>echo&nbsp;!include&nbsp;watc.mak&nbsp;&gt;makefile</tt></b>
<tr>	<td>MS Windows
	<td>&nbsp;
	<td nowrap><b><tt>echo&nbsp;!include&nbsp;watcw32.mak&nbsp;&gt;makefile</tt></b>
</table></blockquote>

<p>
Before compiling, change the definition of the <b><tt>WCVERSION</tt></b>
macro in the makefile (<b><tt>watc.mak</tt></b> or
<b><tt>watcw32.mak</tt></b>) to the version of the Watcom compiler you are
using.  This is necessary to handle some minor incompatibilities between
versions.

<p>
To build Ghostscript, execute "<b><tt>wmakebat</tt></b>".  This constructs
a build script and then executes it.  (This roundabout procedure is
necessary because Watcom chose to implement <b><tt>wmake</tt></b> in a way
that requires reading both the entire makefile and the entire current
directory into the limited 640K DOS address space.)

<p>
Note that Watcom C/386 version 8.5 does not include <b><tt>wmakel</tt></b>
(the 32-bit version of <b><tt>wmake</tt></b>).  If this is the version that
you have, use <b><tt>wmake</tt></b> instead, that is, edit
<b><tt>wmakebat.bat</tt></b> to change "<b><tt>wmakel</tt></b>" to
"<b><tt>wmake</tt></b>".

<p>
If you get an "Error(F01): Out of memory" with Watcom 8.5, you may wish to
reduce the total size of the makefiles by editing <b><tt>devs.mak</tt></b>
and <b><tt>contrib.mak</tt></b> to remove drivers you don't intend to use.
If the error persists, contact Watcom technical support; they can send you
the <b><tt>wmakel</tt></b> program, probably at no charge.

<h2><a name="Cygwin32_build"></a>Cygwin32 gcc</h2>

<p>
A user reports that it is possible to compile Ghostscript for MS Windows NT
using the Cygwin32 gcc compiler, GNU <b><tt>make</tt></b>, and the
<b><tt>unix-gcc.mak</tt></b> makefile, with only two small source code
changes:

<ul>
<li>Add "<b><tt>b</tt></b>" to the call to <b><tt>fopen</tt></b> in <b><tt>gp_open_scratch</tt></b>
<li>Mirror the <b><tt>gp_ntfs</tt></b> logic for <b><tt>gp_file_name_is_absolute</tt></b>
</ul>

<p>
Information about this compiler and environment is at the Cygnus site:

<blockquote>
<a href="http://www.cygnus.com/misc/gnu-win32/">http://www.cygnus.com/misc/gnu-win32/</a>
</blockquote>

<p>
Please note that Cygnus's licensing terms aren't quite as liberal about
redistribution as either the GNU
<a href="http://www.gnu.org/copyleft/gpl.html">General Public License</a>
or the Aladdin <a href="Public.htm">Free Public License</a>, so read their
license carefully if you want to redistribute the results of using their
compiler.

<hr>

<h1><a name="Mac_build"></a>How to build Ghostscript from source (Mac version)</h1>

<p>

There are additional Mac-specific source files in a distribution
separate from the rest of Ghostscript.  In addition to the standard Ghostscript
sources, you will need the following files:

<blockquote><dl>
<dt><a href="ftp://ftp.cs.wisc.edu/ghost/aladdin/mac/">ftp://ftp.cs.wisc.edu/ghost/aladdin/mac/</a>macgs-###-src.sit.bin
<dd>Source files as a StuffIt archive
<dt><a href="ftp://ftp.cs.wisc.edu/ghost/aladdin/mac/macgsmanual.html">ftp://ftp.cs.wisc.edu/ghost/aladdin/mac/macgsmanual.html</a>
<dd>How to use and build MacGS
<dt><a href="ftp://ftp.cs.wisc.edu/ghost/aladdin/mac/">ftp://ftp.cs.wisc.edu/ghost/aladdin/mac/</a>macgs-###-fonts*.sit.bin
<dd>Fonts (properly not to build MacGS but to install it)
</dl></blockquote>

<p>
If you don't have a program to expand and unpack these files, get the free
<b>StuffIt Expander</b> program from your favorite Macintosh archive.

<p>
In the standard method of building Ghostscript, these files except the JPEG
are unpacked into one big directory; the JPEG stuff is unpacked into a
directory called <b><tt>jpeg-6</tt></b> under the main directory.  The Macintosh
stuff is also unpacked into its own directory, called "Mac Specific".
However, if you like you can set up all these files in this hierarchy:

<blockquote><table cellpadding=0 cellspacing=0>
<tr><th colspan=4 bgcolor="#CCCC00"><hr><font size="+1">Suggested Macintosh hierarchy</font><hr>
<tr valign=bottom>
	<th align=left colspan=4><b><tt>Ghost&nbsp;Dev</tt></b>
<tr valign=top>	<td>&nbsp;&nbsp;&nbsp;&nbsp;
	<td><b><tt>files</tt></b>
	<td>&nbsp;
	<td>(All *<b><tt>.ps</tt></b>, *<b><tt>.htm</tt></b>, and other non-build files)
<tr valign=top>	<td>&nbsp;
	<td><b><tt>fonts</tt></b>
	<td>&nbsp;
	<td>(Fonts)
<tr valign=top>	<td>&nbsp;
	<td><b><tt>src</tt></b>
	<td>&nbsp;
	<td>(*<b><tt>.c</tt></b>, *<b><tt>.h</tt></b>, *<b><tt>.mak</tt></b>)
<tr valign=top>	<td>&nbsp;
	<td><b><tt>jpeg-6</tt></b>
	<td>&nbsp;
	<td>(JPEG files)
<tr valign=top>	<td>&nbsp;
	<td><b><tt>Mac&nbsp;Specific</tt></b>
	<td>&nbsp;
	<td>(Mac files)
<tr valign=top>	<td>&nbsp;
	<td><b><tt>MPW&nbsp;Build</tt></b>
	<td>&nbsp;
	<td>(Empty directory used for building under MPW)
</table></blockquote>

<p>
Once everything is laid out, look at the file <b><tt>Worksheet</tt></b> in
the "<b><tt>Mac Specific</tt></b>" folder for complete steps to build the
system with either MPW or CodeWarrior.

<hr>

<h1><a name="Unix_build"></a>How to build Ghostscript from source (Unix version)</h1>

<p>
Before issuing the <b><tt>make</tt></b> command to build Ghostscript, you
have to make some choices, for instance
<ul>
<li>which compiler to use;
<li>what features and devices to include;
<li>whether to use system libraries for PNG and zlib;
<li>and how to handle problems and limitations for your particular
platform.
</ul>

<p>
Be sure to check the section on <a href="#Unix_build_problems">Unix build
problems</a> for notes on your particular platform and compiler.  In fact,
that is the <b><em>first</em></b> place to check if you build Ghostscript and it
crashes or produces obviously incorrect results.

<h2><a name="UNIX_makefile"></a>Setting up "makefile"</h2>

<p>
The files <b><tt>unix</tt></b>*<b><tt>.mak</tt></b> are the makefiles for
Unix platforms, and you choose one based on what compiler you use.  To
build Ghostscript, however, you must use the simple command
"<b><tt>make</tt></b>", which must find the file "<b><tt>makefile</tt></b>"
(or "<b><tt>Makefile</tt></b>").  If your system supports symbolic links,
set up "<b><tt>makefile</tt></b>" like this.

<blockquote><table cellpadding=0 cellspacing=0>
<tr>	<td>GNU gcc:
	<td>&nbsp;&nbsp;&nbsp;&nbsp;
	<td nowrap><b><tt>ln -s unix-gcc.mak makefile</tt></b>
<tr>	<td>Non-gcc ANSI C compiler:
	<td>&nbsp;
	<td nowrap><b><tt>ln -s unixansi.mak makefile</tt></b>
<tr>	<td>"Traditional" C compiler:
	<td>&nbsp;
	<td nowrap><b><tt>ln -s unix-cc.mak makefile</tt></b>
</table></blockquote>

<p>
If your system doesn't support symbolic links, first finish all changes to
the compiler-specific makefile, then make a hard link, omitting the
<b><tt>-s</tt></b> switch.

<p>
The makefile distributed with Ghostscript selects the following devices
to include in the build:

<blockquote><table cellpadding=0 cellspacing=0>
<tr><th colspan=3 bgcolor="#CCCC00"><hr><font size="+1">Devices included as distributed</font><hr>
<tr valign=bottom>
	<th align=left>Type
	<td>&nbsp;&nbsp;
	<th align=left>Devices
<tr>	<td colspan=3><hr>
<tr valign=top>	<td>Display
	<td>&nbsp;
	<td>X Windows
<tr valign=top>	<td>Printers
	<td>&nbsp;
	<td>H-P DeskJets, LaserJets, and color DeskJets and PaintJets; Canon BubbleJets
<tr valign=top>	<td>File formats
	<td>&nbsp;
	<td>Group 3 &amp; Group 4 fax; JPEG; PCX; PBM, PGM, PKM, &amp; PPM; TIFF; PostScript images; PNG; distilled PDF, PostScript, and EPS; PCL XL ("PCL 6")
</table></blockquote>

<p>
The <b><tt>unix</tt></b>*<b><tt>.mak</tt></b> files explicitly compile and
link the JPEG, PNG, and zlib libraries into the executable.  If your Unix
system already includes the PNG and zlib libraries -- probably in
<b><tt>/usr/lib/libpng.</tt></b>{<b><tt>a</tt></b>,<b><tt>so</tt></b>} and
<b><tt>/usr/lib/libz.</tt></b>{<b><tt>a</tt></b>,<b><tt>so</tt></b>} -- and
you would rather use those copies, change the definition of
<b><tt>SHARE_LIBPNG</tt></b> and <b><tt>SHARE_ZLIB</tt></b> from 0 to 1 in
the relevant <b><tt>unix</tt></b>*<b><tt>.mak</tt></b> file before
compiling.  Note that if you do this, you will get non-debug versions of
these libraries even if you selected <b><tt>DEBUG</tt></b> in the makefile.
At the insistence of some users, we have also provided the ability to do
this with the JPEG library (<b><tt>SHARE_JPEG</tt></b>), but should not use
it: in order to be compatible with Adobe interpreters (which do not follow
the JPEG standard exactly), Ghostscript has to compile the IJG code with
the non-standard definition

<blockquote><b><tt>
#define D_MAX_BLOCKS_IN_MCU 64
</tt></b></blockquote>

<p>
and since shared versions of this library will not have been compiled this
way, you awill get errors on some valid PostScript and PDF input files.

<p>
If the X11 client header files are located in some directory which your
compiler does not automatically search, you must change the
<b><tt>XINCLUDE</tt></b> macro in the makefile to include a specific
<b><tt>-I</tt></b> switch.  See the comment preceding
<b><tt>XINCLUDE</tt></b> in the makefile.

<p>
Currently Ghostscript is set up to compile and link in a generic Unix
environment.  Some Unix environments may require changing the
<b><tt>LDFLAGS</tt></b> macro in the makefile; be sure to check the
section on <a href="#Unix_build_problems">build problems</a> for your
specific system.

<p>
Ghostscript uses ANSI syntax for function definitions. Because of this,
when compiling with <b><tt>cc</tt></b> ("traditional" C), it must
preprocess each <b><tt>.c</tt></b> file to convert it to the older syntax
defined in Kernighan and Ritchie, which is what most current Unix compilers
(other than gcc) support.  This step is automatically performed by a
utility called <b><tt>ansi2knr</tt></b>, which is included in the
Ghostscript distribution.  The makefile automatically builds
<b><tt>ansi2knr</tt></b>.  The <b><tt>ansi2knr</tt></b> preprocessing step
is included in the makefile rule for compiling <b><tt>.c</tt></b> files.
<b><tt>ansi2knr</tt></b> creates a file called
<b><tt>_temp_</tt></b><em>$$</em><b><tt>.c</tt></b> to hold the converted
code, where <em>$$</em> is the process ID.  If for some reason you want to
change this name, it is defined in a script file <b><tt>ccgs</tt></b>.

<h2><a name="Unix_build_problems"></a>Unix build problems (and solutions)</h2>

<h3><a name="gcc_27x"></a>gcc 2.7.*</h3>

<p>
Some of the problems using gcc are very specific to the particular
computer, the particular version of the operating system, and the
particular version of gcc available to you.  You can check the version of
gcc with the <b><tt>gcc&nbsp;--version</tt></b> command.

<p>
An optimizer bug in gcc versions 2.7.0, 2.7.1, and 2.7.2 causes the
compiler to generate incorrect code.  The makefile works around this, but
we recommend that if possible you use either an earlier or a later version
of gcc; for instance, gcc 2.5.8, gcc 2.6.3, 2.7.2.1 or later which don't
have this bug.  Note, however, that gcc has other problems on some
platforms, so please read the section for your specific platform.

<h3><a name="GNU_make"></a>GNU make</h3>

<p>
Current versions of GNU <b><tt>make</tt></b> have no problems, but GNU
<b><tt>make</tt></b> 3.59 can't handle the final linking step in some
cases; if this happens, use the platform's standard <b><tt>make</tt></b>,
typically <b><tt>/bin/make</tt></b>.

<h3><a name="386_Unix"></a>386 Unix</h3>

<ul>
<li>gcc versions older than 1.38 on Intel 80386 systems do not compile
Ghostscript correctly with the <b><tt>-O</tt></b> option.

<li>gcc 1.39 under <b><tt>386BSD</tt></b> has a bug that causes
float-to-integer conversions to compile incorrectly, rendering the
executable unusable.

<li>X11R5 may need "<b><tt>#include &lt;stddef.h&gt;</tt></b>" in <b><tt>x_.h</tt></b>.

<li>Also see regarding <a href="#System_V">System V</a> platforms.
</ul>

<h3><a name="Alpha_with_gcc"></a>Alpha with gcc</h3>

<p><ul>
<li>You don't have to use gcc on Alpha systems, because the bundled
compiler works.

<li>The Alpha code generator in gcc 2.7.2.1 is broken.  gcc 2.5.8 and 2.6.3
are probably usable.  Versions before 2.5.0 are believed not to work.  We
suggest you use a recent version.

<li>If you really want to use gcc 2.7.x, here is a patch for that version
from gcc maintainer Jim Wilson
&lt;<a href="mailto:wilson@cygnus.com">wilson@cygnus.com</a>&gt;.

<p><font size="-1">
<pre>*** reload.c.orig       Sun Mar  9 14:05:23 1997
--- reload.c    Sun Mar  9 14:06:54 1997
*************** push_secondary_reload (in_p, x, opnum, o
*** 589,600 ****
         set it up now.  */

        if (in_p &amp;&amp; icode == CODE_FOR_nothing
!         &amp;&amp; SECONDARY_MEMORY_NEEDED (class, reload_class, reload_mode))
!       get_secondary_mem (x, reload_mode, opnum, type);

        if (! in_p &amp;&amp; icode == CODE_FOR_nothing
!         &amp;&amp; SECONDARY_MEMORY_NEEDED (reload_class, class, reload_mode))
!       get_secondary_mem (x, reload_mode, opnum, type);
  #endif
      }

--- 589,600 ----
         set it up now.  */

        if (in_p &amp;&amp; icode == CODE_FOR_nothing
!         &amp;&amp; SECONDARY_MEMORY_NEEDED (class, reload_class, mode))
!       get_secondary_mem (x, mode, opnum, type);

        if (! in_p &amp;&amp; icode == CODE_FOR_nothing
!         &amp;&amp; SECONDARY_MEMORY_NEEDED (reload_class, class, mode))

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -