[Pkg-gs-devel] r54 - in ghostscript/trunk: . debian debian/patches

Masayuki Hatta mhatta at alioth.debian.org
Mon Sep 24 06:22:10 UTC 2007


Author: mhatta
Date: Mon Sep 24 06:22:10 2007
New Revision: 54

Log:
Imported.


Added:
   ghostscript/trunk/
   ghostscript/trunk/debian/
   ghostscript/trunk/debian/NEWS
   ghostscript/trunk/debian/README.Debian
   ghostscript/trunk/debian/changelog
   ghostscript/trunk/debian/compat
   ghostscript/trunk/debian/control
   ghostscript/trunk/debian/copyright
   ghostscript/trunk/debian/dirs
   ghostscript/trunk/debian/ghostscript-doc.doc-base
   ghostscript/trunk/debian/ghostscript.links
   ghostscript/trunk/debian/ghostscript.postinst
   ghostscript/trunk/debian/ghostscript.postrm
   ghostscript/trunk/debian/ghostscript.preinst
   ghostscript/trunk/debian/ghostscript.prerm
   ghostscript/trunk/debian/gs.defoma
   ghostscript/trunk/debian/patches/
   ghostscript/trunk/debian/patches/00list
   ghostscript/trunk/debian/patches/03_docdir_fix_for_debian.dpatch   (contents, props changed)
   ghostscript/trunk/debian/patches/04_gdevxini_segv_fix.dpatch
   ghostscript/trunk/debian/patches/05_gxfcopy_qsort_64bit_clean.dpatch
   ghostscript/trunk/debian/patches/06_libpaper_support.dpatch   (contents, props changed)
   ghostscript/trunk/debian/patches/07_bbox_segv_fix.dpatch   (contents, props changed)
   ghostscript/trunk/debian/patches/08_big_cmap_post_table.dpatch
   ghostscript/trunk/debian/patches/09_ijs_krgb_support.dpatch   (contents, props changed)
   ghostscript/trunk/debian/patches/10_epsn_margin_workaround.dpatch   (contents, props changed)
   ghostscript/trunk/debian/patches/11_brother_7x0_gdi_fix.dpatch   (contents, props changed)
   ghostscript/trunk/debian/patches/12_ghostscript_man_fix.dpatch   (contents, props changed)
   ghostscript/trunk/debian/patches/13_ghostscript_man_fix_debian.dpatch   (contents, props changed)
   ghostscript/trunk/debian/patches/14_toolbin_insecure_tmp_usage_fix.dpatch   (contents, props changed)
   ghostscript/trunk/debian/patches/30_assorted_script_fixes.dpatch   (contents, props changed)
   ghostscript/trunk/debian/rules   (contents, props changed)
   ghostscript/trunk/debian/watch

Added: ghostscript/trunk/debian/NEWS
==============================================================================
--- (empty file)
+++ ghostscript/trunk/debian/NEWS	Mon Sep 24 06:22:10 2007
@@ -0,0 +1,55 @@
+ghostscript (8.61.dfsg.1~svn8248-1) unstable; urgency=low
+
+  As the ESP Ghostscript development is discontinued now, the extra
+  functionality of ESP Ghostscript is merged into upstream GPL Ghostscript
+  from version 8.60 on. This is the first Debian/Ubuntu package of this
+  merged Ghostscript. It contains the following added functionality from
+  ESP Ghostscript:
+
+    - Enhanced PCL XL driver.
+    - Shared library and driver (X11) support for Linux/UNIX.
+    - The CUPS "driver" that generates a series of raster
+      images for CUPS printer drivers.
+    - Nearly all known free printer drivers which have to
+      be compiled into Ghostscript - drivers listed with
+      "Execution style: Ghostscript" on openprinting.org.
+      Not included are some obsolete drivers such as hpdj
+      which is replaced by the included pcl3 driver.
+    - All known Uniprint configuration files (*.upp) as
+      listed on openprinting.org.
+    - Patches to add the NOMEDIAATTRS option to Ghostscript,
+      which allows CUPS drivers to use media options
+      separate from Ghostscript.
+    - KRGB support for IJS drivers.
+    - OpenPrinting Vector interface
+    - Support files for CUPS.
+    - Enhanced build system (easy driver selection, font
+      search path setting, ...).
+
+  This package has everything activated.
+
+  Due to Ghostscript's head development being under GPL now, and all important
+  functionality being developed at ghostscript.com, forks are not needed any
+  more. This makes gs-esp, gs-afpl, and gs-common obsolete. gs-gpl is also
+  renamed to ghostscript now, so that it can be found in repositories more
+  easily. This new ghostscript package automatically removes all gs-* packages.
+
+ -- Till Kamppeter <till.kamppeter at gmail.com>  Mon, 21 May 2007 13:00:21 +0100
+
+gs-gpl (8.01-5) unstable; urgency=low
+
+  For CJKV users: GPL gs 8.x does not contain CJK TrueType font
+  support (it still has CJK CID font support, though), so you can not
+  use CJK *.ttf/ttc with gs-gpl.  I strongly urge you to use
+  gs-esp for the time being.
+
+ -- Masayuki Hatta (mhatta) <mhatta at debian.org>  Sun, 15 Aug 2004 13:26:21 +0900
+
+gs-gpl (8.01-3) unstable; urgency=low
+
+  Currently gs-gpl has stp support, but please note that this driver
+  will be removed after sarge's release since stp has been obsoleted
+  by ijs (ijsgimpprint).  Those of you who still use stp are strongly
+  recommended to migrate to ijsgimpprint ASAP.
+
+ -- Masayuki Hatta (mhatta) <mhatta at debian.org>  Wed, 28 Apr 2004 05:40:05 +0900

Added: ghostscript/trunk/debian/README.Debian
==============================================================================
--- (empty file)
+++ ghostscript/trunk/debian/README.Debian	Mon Sep 24 06:22:10 2007
@@ -0,0 +1,119 @@
+ghostscript for Debian
+======================
+
+This package is merged from the former gs-gpl, gs-esp, and gs-common packages,
+see debian/NEWS file
+ -- Till Kamppeter <till.kamppeter at gmail.com>  Mon, 21 May 2007 13:00:21 +0100
+
+Removal of non-free files
+-------------------------
+
+I removed the directory Resource/Cmap and its contents from the
+upstream source tarball since their licensing policy does not conform
+to the DFSG.
+
+ -- Masayuki Hatta (mhatta) <mhatta at debian.org>, Wed Apr 28 06:31:45 2004
+
+Font handling with Defoma
+-------------------------
+
+The font configuration for Ghostscript is now controlled by Defoma.
+
+If you want to update the font configuration, run:
+
+  defoma-app update gs
+
+Then the Defoma-configuration script for gs is called.
+
+Following describes what the Defoma-configuration script for gs does.
+
+Ghostscript accepts "type1", "type3", "gsfontderivative", "truetype",
+"cid", "cmap" and "psprint" categories.  gs registers all PostScript
+fonts available to gs in the postscript category with <gs>/ added to
+the front of their names.
+
+Ghostscript creates files under /var/lib/defoma/gs.d/dirs.  This
+directory contains CMap and fonts subdirectories, and the CMap
+subdirectory is symlinked under /usr/share/ghostscript.
+
+If you want to have a certain PostScript font name which is not
+provided by registered fonts as RealName or Alias, you can have such a
+font name substituted. Run
+
+  defoma-subst edit-rule ghostscript
+
+to edit the subst-rule. 
+
+For example, if you want to have Charter-Bold available whose charset
+is ISO8859-1 and which has serifed, proportionally-spaced bold face,
+you should add the following line:
+
+Charter-Bold --Charset,* ISO8859-1 --GeneralFamily Roman --Weight Bold
+--Width Variable --Shape Upright Serif
+
+Then Charter-Bold will be substituted by the most similar font and
+become available.
+
+The way to have CJK font substituted changes compared to the old
+gs-aladdin (6.50-x).  If you want to have Korean PostScript font,
+Dotum-Medium-KSC-EUC-H available whose actual font name is
+Dotum-Medium and KSC-EUC-H is a name of CMap, you should add the
+following line:
+
+Dotum-Medium --CIDRegistry,* Adobe --CIDOrdering,* Korea1 --Weight Medium --Shape Upright
+
+Then Dotum-Medium-* (* is a name of Korean CMap) are substituted and
+become available.
+
+Following is a list of hinttypes specific to gs.
+
+* GS-OriginFont, GS-OriginID: These hinttypes are used in
+  gsfontderivative category. The content of a font within this
+  category is a small PostScript program that generates a 
+  derivative font from a certain substantial type1 or type3 font.
+  Generally a derivative font has bold or oblique shape, while
+  the original font has normal upright shape.
+  A font within this category must specify the original font and
+  its RealName with GS-OriginFont and GS-OriginID hinttypes.
+
+1. type1 and type3
+
+Fonts within this category are handled in the same way. Symlink to the
+fontfile is created under /var/lib/defoma/gs.d/dirs/fonts, and its
+font name, font file and alises are listed in Fontmap.
+
+2. gsfontderivative
+
+Fonts within this category are handled in the similar way. Only one
+difference is that dependency on the origin of the font is registered
+when fonts are registered to Id cache.
+
+3. truetype
+
+Fonts within this category are handled in the same way as type1 and
+type3 if the font doesn't include CJK glyphs. CJK truetype fonts goes
+different. It is treated as a cid font.
+
+4. cid
+
+Symlink to the font file is created under
+/var/lib/defoma/gs.d/dirs/fonts, and its font name, font file and
+aliases are listed in CIDFnmap.  Using registered CMaps which belong
+to the same CIDRegistry and CIDOrdering, <CID-FontName>-<CMapName> are
+registered in postscript category.
+
+5. cmap
+
+Symlink to the CMap file is created under
+/var/lib/defoma/gs.d/dirs/CMap.  Using registered CID fonts which
+belong to the same CIDRegistry and CIDOrdering,
+<CID-FontName>-<CMapName> are registered in postscript category.
+
+6. psprint
+
+Fonts installed in a PostSciprt printer should be previewable by
+ghostscript.  They are registered to psprint category, so the script
+accepts this category and add the fonts and their hints to a
+subst-rule.
+
+ -- Masayuki Hatta (mhatta) <mhatta at debian.org>, Sat, 21 Oct 2006 05:21:11 +0900

Added: ghostscript/trunk/debian/changelog
==============================================================================
--- (empty file)
+++ ghostscript/trunk/debian/changelog	Mon Sep 24 06:22:10 2007
@@ -0,0 +1,880 @@
+ghostscript (8.61.dfsg.1~svn8187-1) unstable; urgency=low
+
+  * New upstream release - closes: #437848, #291452
+  * Important CJK handling fixes are absent from the current 8.60 or svn, so I
+    decided to use this SVN snapshots until the issue is fixed (Ubuntu does the same).  
+  * Can be built with the modern GCC now - closes: #440427
+  * Complete re-organization: gs-gpl, gs-esp and gs-afpl are discontinued and
+    gone altogether, and now there's only one ghostscript package - closes: #52603, #159516, #434791, #394628, #394350, #295377, #246983, #416253, #323867
+  * Imported Ubuntu's various improvements on packaging.
+    Thanks for Ubuntu people, especially Till Kamppeter.
+  * Sorted out dummy packages - closes: #321989, #401137
+  * Separated -doc package - closes: #138549, #391082, #389872
+  * Separated -x package, the main ghostscrpt doesn't depend X anymore - cloese: #76814, #393980, #240215
+  * Separated libgs* packages - closes: #344351
+  * Enabled cdj880 driver - closes: #157067
+  * Enabled Lexmark 3200 driver - closes: #157067
+  * Enabled pcl3 driver - closes: #259075
+  * Added /usr/share/fonts/type1/gsfonts to fontpath - closes: #434310
+
+ -- Masayuki Hatta (mhatta) <mhatta at debian.org>  Mon, 24 Sep 2007 12:29:41 +0900
+
+gs-gpl (8.56.dfsg.1-1) unstable; urgency=low
+
+  * New upstream release.
+  * man/gs.1: Paths are adjusted to Debian - closes: #405049
+  * man/gs.1: Fixed various typos - closes: #323534
+  * Fixed insecure /tmp usage in toolbin scripts (CAN-2005-2352) - closes: #291373
+  * Now opdfread.ps is installed - closes: #401755
+
+ -- Masayuki Hatta (mhatta) <mhatta at debian.org>  Sat, 05 May 2007 00:58:39 +0900
+
+gs-gpl (8.54.dfsg.1-5) unstable; urgency=high
+
+  * Oops, I forgot to apply dpatch #20, so the large amount of drivers are missing in -4.  Mea Culpa.
+  * Added Brother HL-1240/1250 support - closes: #280693
+  * Make sure /etc/gs-gpl is removed - closes: #333474
+  * Remove Fontmap and Fontmap.GS from the package - closes: #325400
+  * Provides the index.html symlink - closes: #303792
+  * Added binary-indep rules in debian/rules - closes: #267398
+
+ -- Masayuki Hatta (mhatta) <mhatta at debian.org>  Sat, 21 Oct 2006 10:25:56 +0900
+
+gs-gpl (8.54.dfsg.1-4) unstable; urgency=high
+
+  * Brought back KRGB colorspace support to ijs - closes: #355616
+  * Brought back Samsung GDI support - closes: #365337
+  * gs depends on gs-gpl | gs-esp - closes: #297024
+  * rules, gs-gpl.links: s/8.15/8.54/g.
+
+ -- Masayuki Hatta (mhatta) <mhatta at debian.org>  Wed, 18 Oct 2006 21:33:33 +0900
+
+gs-gpl (8.54.dfsg.1-3) unstable; urgency=low
+
+  * Supports big post table for CMap - closes: #205055
+  * Fixed a potential segv problem in src/gdevxini.c, thanks Ian Jackson for providing a patch - closes: #254206
+
+ -- Masayuki Hatta (mhatta) <mhatta at debian.org>  Wed, 18 Oct 2006 03:48:57 +0900
+
+gs-gpl (8.54.dfsg.1-2) unstable; urgency=high
+
+  * Made qsort call in src/gxfcopy.c 64-bit clean, thanks Andreas - closes: #390875
+
+ -- Masayuki Hatta (mhatta) <mhatta at debian.org>  Thu, 12 Oct 2006 09:28:26 +0900
+
+gs-gpl (8.54.dfsg.1-1) unstable; urgency=low
+
+  * New upstream release - closes: #373805
+  * Acknowledged NMUs, since crash on ppc has been fixed in the upstream  - closes: #357326, #327288, #324796
+
+ -- Masayuki Hatta (mhatta) <mhatta at debian.org>  Tue, 26 Sep 2006 01:25:04 +0900
+
+gs-gpl (8.50-1.1) unstable; urgency=high
+
+  * Non-maintainer upload.
+  * debian/patches/00list: Re-enable patch 10_powerpc_crash_fix; upstream
+    delayed to fix after the 8.50 release. Cures segfaults on ppc (again).
+    Thanks to Roger Leigh for testing. Closes: #357326
+
+ -- Daniel Kobras <kobras at debian.org>  Wed, 29 Mar 2006 14:22:21 +0200
+
+gs-gpl (8.50-1) unstable; urgency=low
+
+  * Works done at Codefest in Malaysia 2006.
+  * New upstream release - closes: #347637, #348834
+  * Updated debian/watch - closes: #354352
+  * Bumped to Standards-Version: 3.6.2.2 (no physical changes).
+
+ -- Masayuki Hatta (mhatta) <mhatta at debian.org>  Sun,  5 Mar 2006 10:46:33 +0900
+
+gs-gpl (8.15-4.1) unstable; urgency=low
+
+  * Non-maintainer upload.
+  * Use gcc-3.4 on s390. 
+
+ -- Bastian Blank <waldi at debian.org>  Thu, 29 Dec 2005 10:52:10 +0000
+
+gs-gpl (8.15-4) unstable; urgency=low
+
+  * Apply patch 10 working around a crashing bug on powerpc (details in
+    the patch file itself). This closes: bug#324796, #325570, #327288
+    (thanks to Paul Brossier <piem at debian.org> for first reporting, Ian
+    Jackson <ian at davenant.greenend.org.uk> for providing the patch, and
+    Thomas Bushnell BSG <tb at becket.net> for shouting about the problem).
+
+ -- Jonas Smedegaard <dr at jones.dk>  Mon, 19 Sep 2005 15:15:44 +0200
+
+gs-gpl (8.15-3) unstable; urgency=low
+
+  * Bumped Standards-Version to 3.6.2.1 (no physical changes).
+  * Removed patch 04, since it doesn't affect at all.
+  * Enabled jbig2dec support.
+  * Now uses cidfmap generated by defoma.
+  * gs-gpl.links: make a symlink of CMap directory under /usr/share/gs-gpl/8.15/Resource.
+    NOTE: even if CMap files can be found somewhere in the font path, gs-esp
+    fails to prepare a composed font with CIDFont and CMap. This hack is
+    a workaround for "the CMap files must be put into the first directory of
+    the font path" problem.  Many Thanks Akira TAGOH for suggestion.
+
+ -- Masayuki Hatta (mhatta) <mhatta at debian.org>  Thu, 18 Aug 2005 03:38:59 +0900
+
+gs-gpl (8.15-2) unstable; urgency=low
+
+  * Drop stp patch:
+    + Remove stp-related parts of additional_drivers patches 20 and 21.
+    + Drop build-dependency on libgimpprint-dev.
+    + Remove stp note from README.Debian.
+    + Closes: bug#313026 (thanks to Roger Leigh <rleigh at debian.org>).
+
+ -- Jonas Smedegaard <dr at jones.dk>  Wed, 20 Jul 2005 14:05:26 +0200
+
+gs-gpl (8.15-1) unstable; urgency=low
+
+  * Repackaged source tarball with non-free CMaps stripped.
+  * Added check in debian/rules to fail if CMaps exist in the source.
+  * Mention in debian/copyright that CMaps are stripped.
+  * Add myself as uploader (acknowledged by Masayuki), and re-upload as
+    regular maintainer upload. This package closes: bug#280352 (thanks
+    to some anonymous(?) lilypond-lover offering virtual beer for
+    pushing this newer release, and Wouter Verhelst <wouter at debian.org>
+    for delivering the message).
+  * Correct UTF8-encoding of debian/changelog.
+
+ -- Jonas Smedegaard <dr at jones.dk>  Fri, 15 Jul 2005 13:27:05 +0200
+
+gs-gpl (8.15-0.1) unstable; urgency=low
+
+  * NMU of newer upstream release.
+  * Update and unfuzz patches (Note: source patched by
+    04_resourcedir_fix_for_debian slightly changed upstream, so may no
+    longer be needed).
+  * Use fine-grained X11 build-dependencies.
+
+ -- Jonas Smedegaard <dr at jones.dk>  Tue, 12 Jul 2005 10:52:11 +0200
+
+gs-gpl (8.01-5) unstable; urgency=high
+
+  * [NEWS] added a note on CJK TTF support.
+  * Revive Samsung GDI support, thanks plum - closes: #250180
+  * Revive Brother 7x0 GDI support - closes: #253479
+  * Added KRGB colorspace support to gs IJS driver - closes: #249166
+  * Fix SEGV on -sDEVICE=bbox - closes: #250290, #254877
+  * Adjust the margins for Epson drivers - closes: #48975
+  * Now Suggests hpijs - closes: #161953
+
+ -- Masayuki Hatta (mhatta) <mhatta at debian.org>  Sun, 15 Aug 2004 13:03:15 +0900
+
+gs-gpl (8.01-4) unstable; urgency=low
+
+  * Fixed the priority to 20 - closes: #246983
+  * Removed funky character in NEWS, thanks tbm for pointing it out.
+
+ -- Masayuki Hatta (mhatta) <mhatta at debian.org>  Wed,  5 May 2004 16:09:24 +0900
+
+gs-gpl (8.01-3) unstable; urgency=low
+
+  * Added Build-Dep: libgimpprint1-dev - closes: #244143
+  * Added lj3100sw driver - closes: #243963
+  * Revised description.
+  * Added notes on stp.
+
+ -- Masayuki Hatta (mhatta) <mhatta at debian.org>  Wed, 28 Apr 2004 05:40:05 +0900
+
+gs-gpl (8.01-2) unstable; urgency=low
+
+  * Added STP support culled from gimp-print 4.2.6.
+
+ -- Masayuki Hatta (mhatta) <mhatta at debian.org>  Tue, 13 Apr 2004 13:20:31 +0900
+
+gs-gpl (8.01-1) unstable; urgency=low
+
+  * New maintainer with torsten's blessing.  He is still a co-maintainer.
+  * The package name has been changed to gs-gpl.
+  * Now uses dpatch.
+  * Acknowledged NMUs - closes: #63163, #136652, #105179, #128314, #128416
+  * New upstream release - closes: #235686, #226088
+  * Revised copyright - closes: #226020
+  * Moved *map under /etc/gs-gpl - closes: #179244
+  * Do not run "update-alternatives --remove" when upgrade - closes: #163267
+  * Improved libpaper support - closes: #182268
+  * Set the font path appropriately - closes: #122828, #159816, #111874, #195931, #128955
+  * Removed stp driver - closes: #170550
+  * Added cfax driver - closes: #183438
+  * Set the priority to 20.
+
+ -- Masayuki Hatta (mhatta) <mhatta at debian.org>  Sat, 27 Mar 2004 00:00:05 +0900
+
+gs (7.07-1) unstable; urgency=low
+
+  * New upstream release.
+    + Uses /dev/urandom instead of /dev/random so does not block forever
+      waiting for quality random numbers (closes: #176850).
+  * Fix buffer overflow in gdevhpij.c (sizeof(PK) < PIPE_BUF...) and
+    remove the old patch (closes: #184345).
+  * debian/devices: Add pngalpha device.
+
+ -- Torsten Landschoff <torsten at debian.org>  Wed, 18 Jun 2003 10:51:53 +0200
+
+gs (7.06-1.1) unstable; urgency=low
+
+  * NMU
+  * Fix unconditional PIPE_BUF bug to build on GNU. (Closes: #184345)
+
+ -- Robert Millan <rmh at debian.org>  Sun, 13 Apr 2003 14:01:41 +0200
+
+gs (7.06-1) unstable; urgency=low
+
+  * New upstream release.
+  * debian/rules: 
+    + Include History7.htm into the changelog.
+    + Kill the /usr/share/man/de hierarchy which only documents stuff
+      in gs-common, not even the gs command.
+
+ -- Torsten Landschoff <torsten at debian.org>  Thu,  3 Apr 2003 11:34:02 +0200
+
+gs (7.05-3) unstable; urgency=low
+
+  * Reextract the source without running ntpdate on another console
+    and rebuild to fix the search path (closes: #173493, #173560).
+
+ -- Torsten Landschoff <torsten at debian.org>  Fri, 20 Dec 2002 15:54:29 +0100
+
+gs (7.05-2) unstable; urgency=low
+
+  * debian/control: Conflicts, Provides and Replaces gs-pdfencrypt - that
+    functionality is now included in gs itself and the old stuff breaks
+    with current gs (closes: #173222).
+  * Apply the patch from Florian Zumbiehl (identical to the upstream 
+    solution in newer releases) to fix the scaling of the psmono/psgray
+    driver - the output was scaled twice (closes: #171530).
+
+ -- Torsten Landschoff <torsten at debian.org>  Tue, 17 Dec 2002 11:44:44 +0100
+
+gs (7.05-1) unstable; urgency=low
+
+  * New upstream release. 
+  * debian/control: Use libpng3-dev instead libpng2-dev.
+
+ -- Torsten Landschoff <torsten at debian.org>  Sun,  1 Sep 2002 01:10:37 +0200
+
+gs (6.53-7) unstable; urgency=low
+
+  * debian/rules (binary-arch): Use rm -Rf to kill the man dir as rm -R
+    seems to ask for permission for some users (closes: #152037).
+
+ -- Torsten Landschoff <torsten at debian.org>  Wed, 28 Aug 2002 01:28:36 +0200
+
+gs (6.53-6) unstable; urgency=low
+
+  * debian/devices: Enable the ljet4d driver as suggested by 
+    Isidro Cachadiña Gutiérez.
+
+ -- Torsten Landschoff <torsten at debian.org>  Tue, 27 Aug 2002 11:29:17 +0200
+
+gs (6.53-5) unstable; urgency=low
+
+  * Apply the hpijs margin patch from 
+    http://hpinkjet.sourceforge.net/gdevijs2.patch (closes: #151869).
+
+ -- Torsten Landschoff <torsten at debian.org>  Thu,  4 Jul 2002 09:54:39 +0200
+
+gs (6.53-4) unstable; urgency=low
+
+  * Enable the hl1240 driver (the hl1250 should already be there, but it
+    seems it isn't...).
+  * debian/control: Change build dependency on libgimpprint-dev to 
+    libgimpprint1-dev.
+
+ -- Torsten Landschoff <torsten at debian.org>  Wed,  3 Jul 2002 19:36:58 +0200
+
+gs (6.53-3) unstable; urgency=high
+  
+  * debian/copyright: Include information about add on packages and
+    their licenses.
+
+  * debian/devices: Move x11 in front of x11alpha which has problems with 
+    mono displays at least (closes: #138844).
+  * src/unix-gcc.mak: Reenable the pipe device as it seems harmless after
+    all and many filters will break as they are using this feature to
+    circumvent the old Ghostscript problem with -sOutputFile=- when
+    the PostScript file writes text to stdout which interferes with the
+    printer commands... (closes: #138364).
+  * debian/control: Remove the reference to gs-pdfencrypt which is now 
+    obsolete as it is included in the official Ghostscript now.
+
+  * Lintian cleanup:
+    + Remove the extra license file /usr/share/doc/gs/COPYING.gz
+    + Copying.htm stays as it is since it is linked in the docs
+    + Convert History[56].htm to changes.gz using html2text to have an
+      upstream changelog.
+  * Included a few important patches from the Ghostscript CVS:
+    + Handle the margins from an ijs server correctly. It was my hope that 
+      this would account for #141608, but that does not seem to be the
+      case :(
+    + src/gdevx.c: Patched to use the "right" color depth on X11 for 
+      all cases. It used to take the actual number of bits to store
+      the color info as opposed to the number of bits actually used.
+    + lib/pdf2dsc.ps: This was broken because of the security fix. 
+      Patched to open the files before dropping privileges.
+
+  * lib/stcolor.ps: Compare the product name with "GNU Ghostscript" instead
+    of just "Ghostscript" to detect the interpreter (closes: #108120).
+  * src/gdevbj10.c: Apply the patch to fix the margins for the Canon BJ10e
+    submitted by Jim Hague (closes: #118078).
+  * debian/postinst: Link the manpage to gs.1.gz as well as a slave of 
+    the /usr/bin/gs alternative (closes: #122538).
+  * gimp-print/README.stp: Copy from gimp-print source tree.
+  * debian/docs: Install that file as $(docdir)/README.stp for those
+    using that driver and needing some infos (closes: #122099).
+    + debian/README.Debian: Refer the user to README.stp.
+  * debian/rules: Install the documentation of the pcl3 driver 
+    (closes: #39342).
+  * debian/docs: Add the README.lexmark of the lexmarkgs driver to the 
+    installed documentation.
+
+ -- Torsten Landschoff <torsten at debian.org>  Tue,  9 Apr 2002 02:29:10 +0200
+
+gs (6.53-2) unstable; urgency=high
+
+  * [SECURITY] src/unix-gcc.mak: Disable the pipe device as well since it
+    still allows executing arbitrary commands. I'll turn it back on when I am
+    sure it does not cause any security problems.
+
+ -- Torsten Landschoff <torsten at debian.org>  Thu,  7 Mar 2002 12:24:53 +0100
+
+gs (6.53-1) unstable; urgency=high
+
+  * New upstream release (closes: #130426).
+    + Fixes the security problem allowing reading all files and 
+      executing random commands (closes: #136652).
+  * debian/gen-makefile: Fix the BUILD_OPTIONS check (closes: #121871).
+  * Should fix the cjk stuff I hope (closes: #116516). In case there is 
+    another problem please could somebody provide me with information
+    how to check that it works? I am more than deeply frustrated with
+    getting readmes in japanese, web pages in japanese etc. That's just
+    deeply frustrating.
+
+ -- Torsten Landschoff <torsten at debian.org>  Wed,  6 Mar 2002 01:20:30 +0100
+
+gs (6.51-7) unstable; urgency=medium
+
+  * Urgency medium because it works around a bug breaking the package 
+    on one Debian architecture.
+  * src/gxobj.h [IA64]: Lock the object alignment to 16 bytes, as the
+    initial setjmp segfaults because of a bad alignment. jmp_buf needs
+    to be on 16 byte boundaries for this arch. This is a quick work
+    around until somebody comes up with a better fix - at least it 
+    gets gs to work on ia64 - I am not certain how much memory overhead
+    this causes though. Kudos to John Daily <jdaily at progeny.com> for his 
+    investigative work. I am leaving the bug open for now, since it does
+    not really fix the problem (#128314).
+
+ -- Torsten Landschoff <torsten at debian.org>  Tue,  8 Jan 2002 21:12:22 +0100
+
+gs (6.51-6) unstable; urgency=low
+
+  * ijs/*: Include the ijs driver from the hpijs source.
+  * debian/devices: Add ijs to the device list.
+  * src/contrib.mak: Include ijs/contrib.mak-6.51.add
+
+ -- Torsten Landschoff <torsten at debian.org>  Mon, 31 Dec 2001 15:00:45 +0100
+
+gs (6.51-5) unstable; urgency=low
+
+  * gimp-print/gdevstp.c: Update from gimp-print 4.1.99-rc1 (closes: #120009)
+
+ -- Torsten Landschoff <torsten at debian.org>  Fri, 16 Nov 2001 14:29:11 +0100
+
+gs (6.51-4) unstable; urgency=low
+
+  * src/gdevxini.c: Apply the patch supplied by Chanop Silpa-Anan
+    (closes: #85811). Thanks for your support, Chanop!
+  * debian/gen-makefile: Add /usr/share/ghostscript/common to the 
+    search path to get gs-pdfencrypt working again (closes: #119406).
+  * Download the lex5000 driver and include it in the build system
+    (closes: #58657).
+  * debian/devices: Add lx5000, lex5000.
+
+ -- Torsten Landschoff <torsten at debian.org>  Wed, 14 Nov 2001 16:47:57 +0100
+
+gs (6.51-3) unstable; urgency=low
+
+  * debian/devices: Enabled the cfax driver as requested by a user.
+
+ -- Torsten Landschoff <torsten at debian.org>  Fri,  9 Nov 2001 17:48:23 +0100
+
+gs (6.51-2) unstable; urgency=low
+
+  * Enable the Brother HL 1250 driver (closes: #63027). 
+
+ -- Torsten Landschoff <torsten at debian.org>  Wed, 17 Oct 2001 12:07:23 +0200
+
+gs (6.51-1) unstable; urgency=low
+
+  * New upstream release (closes: #101928).
+  * The new upstream release fixes many problems with the interpreter.
+    These bugs were fixed in Ghostscript 6.0:
+    + the font rendering problem in X11 is fixed (closes: #28579)
+    + ps2pdf does not write rectangles for polygons anymore (closes: #36200)
+    + the PDF which crashed gs does not lead to any problems (closes: #45361)
+    + a PDF which was inverted by pdf2ps stays black on
+      white now (closes: #49659).
+    + Philipp's file crashing gs does not do so anymore (closes: #58468)
+    + the invalid LanguageGroup in fonts does not cause gs to abort
+      anymore (closes: #67462).
+    + another PDF file which caused a crash is working now (closes: #89995)
+  * Rewrote the build system.
+  * The libjpeg sources are now included in the diff which is not nice
+    but working (closes: #87896).
+  * lynx is not used anymore to convert the changelog to plain text
+    (closes: #93722).
+  * The hpijs driver is now included upstream (closes: #106294).
+  * Driver support for the Apple Imagewriter is now included (closes: #110740).
+  * Make the package use update-alternatives so that different gs packages 
+    can cooperate (closes: #98227).
+  * Add in the gdi driver provided by Daniel Burrows (closes: #105885).
+  * debian/devices: Add omni to the list
+    + debian/gen-makefile: Add threading and dynamic linking support.
+  * debian/control: Add libglib1.2-dev to the Build-Depends as it is 
+    needed for the Omni driver.
+  * debian/devices: Go through the list of available drivers and add 
+    what we seem to be able to build. Among the new devices:
+    - cdj970 (closes: #112434)
+    - cljet5, cljet5pr, cljet5c
+    - dl2100, hl7x0
+    - the generic hpijs device (supports hpijs 0.97, closes: #102369, #110657)
+    - imagen, inferno, jetp3852
+    - lex2050, lex3200, lex5700
+    - oki4w
+    - plan9bm
+    - psrgb
+    - x11cmyk2, x11cmyk4, x11cmyk8, x11gray4
+  * src/contrib.mak: Add missing generic hpijs device.
+  * Enable stp driver and link with libgimpprint 
+    (closes: #82454, #87004, #103036)
+  * debian/control: Build-Depend on libgimpprint-dev.
+  * debian/gen-makefile: Add support for the DEB_BUILD_OPTIONS environment
+    variable (more precisely, the debug option leads to a build with 
+    debugging support and exported private variables).
+  * Add in the CJK support using the patch from 
+    Yasuhiro Take <take at debian.org>. A huge "THANK YOU" to him for his 
+    work!!! His changes:
+    + Add debian/patches/gs-cjk-M2-R1+CJKPDF.diff & .info, and apply it
+      to the source.
+    + debian/control: Conflicts: Add gs-cjk-resource (<< 1.20010910-1) because
+      the new gs-cjk patch requires new gs-cjk-resource that i've already
+      prepared and doesn't work with older ones.
+    + debian/control: Depends: Add gs-common (>= 0.2) because font 
+      configuration for the new gs-cjk patch is completely different from 
+      the old one.
+  * debian/control: Removed the conflict with gs_x, gs_svga and gs_both. 
+    I don't even remember when those packages where in Debian, probably
+    before Debian 1.3 so a direct upgrade is going to fail anyway. And 
+    with intermediate upgrades it will not be a problem.
+  * src/imainarg.c: Reapply the papersize diff from debian/patches.
+
+ -- Torsten Landschoff <torsten at debian.org>  Tue, 16 Oct 2001 21:06:14 +0200
+
+gs (5.50-8) unstable; urgency=low
+
+  * debian/rules: Use html2text to convert the html changelog into 
+    plain text instead of lynx (closes: #93722).
+  * debian/control: Update Build-Depends.
+  * debian/prerm: Fix the case to handle both removal and upgrade 
+    instead of handling upgrading in two cases (closes: #98458).
+  * debian/control: Merge multi-line Build-Depends into one line for
+    now until our tools support multi line fields (closes: #98459).
+
+ -- Torsten Landschoff <torsten at debian.org>  Mon,  4 Jun 2001 01:22:36 +0200
+
+gs (5.50-7) unstable; urgency=low
+
+  * debian/postrm: Add missing #DEBHELPER# (arg!).
+  * debian/prerm: Add defoma-app clean on upgrade.
+  * debian/gs.templates: Remove the double negation of the previewer
+    question (closes: #94146).
+  * Merge german translation for debconf templates (closes: #93840).
+  * debian/shlibs.local: Depend on svgalibg1 or svgalib-dummyg1 
+    alternatively (closes: #93811).
+
+ -- Torsten Landschoff <torsten at debian.org>  Tue,  1 May 2001 22:24:55 +0200
+
+gs (5.50-6) unstable; urgency=low
+
+  * debian/README: 
+    + Move copyright info to debian/copyright.
+    + Mention the align.ps file (closes: #67317).
+  * gdevbbox.c: Use default color methods instead of NULL pointers so 
+    that gs -sDEVICE=bbox does not crash anymore (closes: #36883).
+
+ -- Torsten Landschoff <torsten at debian.org>  Sat,  7 Apr 2001 21:09:55 +0200
+
+gs (5.50-5) unstable; urgency=low
+
+  * debian/default_path.sh:
+    + Include defoma dir in search path.
+    + Search local directories before system directories.
+    + Defoma is preferred if available...
+  * debian/postinst: Fix the hopefully last bashism (s/source/g/).
+  * Included support for Hewlett Packard's own printer driver called
+    hpijs (closes: #92010). Note that you will need the hpijs package
+    for using it.
+
+ -- Torsten Landschoff <torsten at debian.org>  Sat,  7 Apr 2001 02:40:15 +0200
+
+gs (5.50-4) unstable; urgency=low
+
+  * Install interesting Postscript files as examples (closes: #79461).
+  * Finally include the missing if-hpdj filter (closes: #63705).
+  * Also add the documentation of hp8xx (closes: #63566).
+
+ -- Torsten Landschoff <torsten at debian.org>  Thu,  5 Apr 2001 03:58:27 +0200
+
+gs (5.50-3) unstable; urgency=low
+
+  * debian/rules: 
+    + Don't remove debian/postinst anymore in clean target.
+    + Read package and version info from changelog.
+    + Convert to debhelper.
+  * debian/postinst: Again rewritten from scratch (guess why!? *arg*)
+
+ -- Torsten Landschoff <torsten at debian.org>  Thu,  5 Apr 2001 02:34:17 +0200
+
+gs (5.50-2) unstable; urgency=low
+
+  * debian/postinst: Completely rewritten.
+    + Fixes the bashism reported by Joey Hess (closes: #92056).
+    + Does not mess with /usr/local anymore (closes: #57276).
+  * unix-gcc.mak: Readd the x11 device (closes: #92586).
+  * debian/config: Change the priority of the defoma questions to
+    low. I don't see how the defaults can cause any problems.
+  * debian/shlibs.local: Removed. Let's see if it works without.
+
+ -- Torsten Landschoff <torsten at debian.org>  Thu,  5 Apr 2001 01:36:09 +0200
+
+gs (5.50-1) unstable; urgency=low
+
+  * Finally upgrade to new upstream version, still based on the old 
+    package (the reimplementation is still under the hood ;)
+    (closes: #65832, #87673).
+  * unix-gcc.mak: Make x11alpha the default device on X11 as already
+    done in gs-aladdin. Modern systems should be able to handle the 
+    anti aliasing fast enough.
+  * debian/control: Update build dependencies for new X11.
+  * debian/control: Removed Conflicts with local defoma packages made
+    by Yasuhiro.
+  * debian/patches/svgalib: Adjust for name change of the main Makefile 
+    and move the targets out of the ifeq so that one can run the file
+    standalone.
+  * debian/patches/hpdj: 
+    - Don't patch zmedia2.c since upstream changed it since 5.10.
+    - Adjust for name change of the main makefile.
+    - Use the right patch from the hpdj distribution for 5.50.
+  * debian/patches/hp8xx:
+    - Update the devs.mak diff for gs 5.50.
+    - Adjust for name change of main makefile.
+  * debian/rules: Disable kanji and jpdrivers support (needs update for 5.50).
+  * debian/patches/lexmarkgs: 
+    - Update the devs.mak diff for 5.50.
+  * debian/control: Add missing build-depends (closes: #82114, #88393).
+  * debian/rules: Make debian/addentry executable before running it
+    (closes: #90278).
+  * time_.h: Include <time.h> as well as sys/time.h (closes: #90433, #88391).
+
+ -- Torsten Landschoff <torsten at debian.org>  Thu, 29 Mar 2001 01:17:54 +0200
+
+gs (5.10-11.5defoma2) unstable; urgency=low
+
+  * Add kanji patches.
+
+ -- Yasuhiro Take <take at debian.org>  Tue, 27 Mar 2001 20:58:55 +0900
+
+gs (5.10-11.5defoma1) unstable; urgency=low
+
+  * Add Defoma support.
+  * Remove kanji patches.
+
+ -- Yasuhiro Take <take at debian.org>  Tue, 20 Mar 2001 18:21:22 +0900
+
+gs (5.10-11) unstable; urgency=low
+
+  * debian/control: Added build time dependency for libfreetype2-dev
+    (closes: #82114).
+  * Included upp files for stc740 printer provided by Gregory P. Smith
+    (closes: #76845).
+ 
+ -- Torsten Landschoff <torsten at debian.org>  Mon, 15 Jan 2001 00:53:32 +0100
+
+gs (5.10-10.1) stable unstable; urgency=high
+
+  * Non-maintainer upload by security team
+  * Patch from Werner Fink:
+    + Create temporary files securely using mkstemp instead of mktemp
+    + Don't set LD_RUN_PATH to empty, that makes the runtime linker look
+      in the current path as well
+
+ -- Wichert Akkerman <wakkerma at debian.org>  Wed, 22 Nov 2000 03:35:35 +0100
+
+gs (5.10-10) unstable; urgency=low
+
+  * contrib/kanji/man/ps2jpdf.1: Changed ".SH PS2JPDF" into ".SH NAME"
+    (closes: #59925, #60002, #60474).
+  * debian/rules: Added -isp to call of dpkg-gencontrol (lintian).
+
+ -- Torsten Landschoff <torsten at debian.org>  Wed, 15 Mar 2000 23:30:41 +0100
+
+gs (5.10-9) frozen unstable; urgency=high
+
+  * Applied patch from Colin Phipps to fix security problem in ps2epsi
+    (closes: #57034)
+
+ -- Torsten Landschoff <torsten at debian.org>  Sun,  6 Feb 2000 02:24:33 +0100
+
+gs (5.10-8) frozen unstable; urgency=low
+
+  * Only a simple change to close a bugreport: The package contained a 
+    directory in /usr/local in violation with policy. Sorry for this, 
+    the directories are now created by the postinst (closes: #56396).
+
+ -- Torsten Landschoff <torsten at debian.org>  Fri, 28 Jan 2000 09:52:17 +0100
+
+gs (5.10-7) frozen unstable; urgency=low
+
+  * This can go into frozen since the changes are absolutely simple.
+  * debian/control: Fixed build dependencies (closes: #55451).
+  * debian/patches/hpdj: Added installation of margin files as requested in 
+    #39342 (for gs-aladdin).
+  * gcc-head.mak: Added path for local fonts as requested in #31898
+    (/usr/local/lib/ghostscript/{common,5.10,fonts})
+  * debian/rules: Make the directories intended for local fonts.
+  * gs.1: Added documentation for local postscript files.
+
+ -- Torsten Landschoff <torsten at debian.org>  Thu, 20 Jan 2000 12:47:48 +0100
+
+gs (5.10-6) unstable; urgency=low
+
+  * Added driver for Lexmark 7000. Thanks to Alex Winbow for pointing 
+    me to the patch.
+  * debian/rules: Completely rewritten and a bit modularized.
+  * hpdj driver updated to version 2.6.
+
+ -- Torsten Landschoff <torsten at debian.org>  Wed, 12 Jan 2000 20:24:44 +0100
+
+gs (5.10-5) unstable; urgency=low
+
+  * New maintainer.
+  * debian/control: Added build dependencies.
+  * Applied patch from Taketoshi Sano to remove copyrighted stuff from 
+    the package (closes: #52575).
+  * This release is based on Wicherts NMU (thanks for the work Wichert!)
+    closes: #53071
+
+ -- Torsten Landschoff <torsten at debian.org>  Wed, 29 Dec 1999 22:22:02 +0100
+
+gs (5.10-4.1) unstable; urgency=low
+
+  * Non-maintainer upload
+  * Apply patch to fix mac ttf rendering, Closes: Bug#52590
+
+ -- Wichert Akkerman <wakkerma at debian.org>  Sun, 19 Dec 1999 17:05:38 +0100
+
+gs (5.10-4) unstable; urgency=low
+
+  * Small patch applied to file gs_init.ps, so that japanese
+    fonts are required only for japanese people (many thaks to 
+    Fumitoshi Ukai) (closes: Bug#49725, #49732, #49867)
+
+ -- Marco Pistore <pistore at debian.org>  Fri, 12 Nov 1999 12:45:37 +0100
+
+gs (5.10-3) unstable; urgency=low
+
+  * Many thanks to Taketoshi Sano for his great job 
+    with the Japanese support (closes Bug#41570)
+
+ -- Marco Pistore <pistore at debian.org>  Sun,  7 Nov 1999 02:56:13 +0100
+
+gs (5.10-2.0.vflib.2) experimental; urgency=low
+
+  * Non Maintainer.
+  * Add support for many drivers included in gs510j49
+  * FHS transition
+  * Lintian free
+
+ -- Taketoshi Sano <sano at debian.org>  Sun, 31 Oct 1999 09:21:06 +0900
+
+gs (5.10-2.0.vflib.1) experimental; urgency=low
+
+  * Non Maintainer.
+  * Experimental revision for Japanese VFlib support enhancement.
+  * Please check and modify this experimental revision to add
+    Japanese support on the Debian package of "gs"
+
+ -- Taketoshi Sano <sano at debian.org>  Sat, 30 Oct 1999 15:03:07 +0900
+
+gs (5.10-2) unstable; urgency=low
+
+  * Added support for hp8xx drivers by Uli Wortmann (closes Bug#40807).
+  * Added support for epsf and ttfont features.
+  * Changed "Aladdin Ghostscript" into "GNU Ghostscript" in 
+    file stcolor.ps e stcinfo.ps (closed Bug#35411, Bug#35525).
+
+ -- Marco Pistore <pistore at di.unipi.it>  Sat, 10 Jul 1999 23:29:57 +0200
+
+gs (5.10-1) unstable frozen; urgency=low
+
+  * Ghostscript 5.10 is GPL! 
+    This package essentially corresponds to package gs-aladdin_5.10-12,
+    but redistributed under GPL. Changes w.r.t. gs-aladdin_5.10-12
+    are:
+      * Corrected "regulamentations" --> "regulations" 
+        in description of package.
+      * Filenames in script pdf2ps are now enclosed in double quotes
+      * Fixed the manpages for bdftops, printafm and wftopfa, 
+        so that they work with apropos.
+    The various patches to ghostscript 5.10 that have been proposed
+    by L.P.Deutsch and that appear in gs-aladdin_5.10-12 also appear
+    in this package.
+    
+ -- Marco Pistore <pistore at di.unipi.it>  Sun,  3 Jan 1999 18:22:57 +0100
+
+gs (4.03-6) unstable; urgency=low
+
+  * Moved to version 2.5 of hpdj driver by Martin Lottermoser (debian/rules 
+    is changed accordingly).
+  * Mentined package gsfonts in description of gs.
+
+ -- Marco Pistore <pistore at di.unipi.it>  Mon,  7 Dec 1998 22:06:21 +0100
+
+gs (4.03-5) frozen unstable; urgency=low
+
+  * Fixed the manpages for bdftops, printafm and wftopfa,
+    so that they work with apropos.
+
+  * Removed *.1.gz files from /usr/doc/gs (they already are in the
+    /usr/man/man1 directory).
+
+ -- Marco Pistore <pistore at di.unipi.it>  Fri,  6 Nov 1998 10:52:31 +0100
+
+gs (4.03-4) frozen unstable; urgency=low
+
+  * Fixed files stcolor.ps and stcinfo.ps so that they recognize that
+    they are called by GNU ghostscript; thanks to Gordon Matzigkeit
+    (closes Bug#28726).
+
+ -- Marco Pistore <pistore at di.unipi.it>  Thu,  5 Nov 1998 21:44:07 +0100
+
+gs (4.03-3) unstable; urgency=low
+
+  * Changed "Recommends: gs-pdfencrypt" to "Suggests: gs-pdfencrypt" in
+    control file (closes Bug#27431)
+  * Removed "Provides: gs_x, gs_svga, gs_both", since "_" cannot appear
+    in package names, and no packages should depend on these quite old 
+    virtual packages.
+  * Changed directory name for the libjpeg source from ../libjpeg-6a
+    to ../libjpeg: so it does not depend on the particular version
+    of libjpeg (changes in files gcc-head.mak, debian/rules and 
+    debian/jpeg).
+  * Linked against libjpeg-6b.
+
+ -- Marco Pistore <pistore at di.unipi.it>  Sat, 10 Oct 1998 00:01:15 +0200
+
+gs (4.03-2) unstable; urgency=low
+
+  * Now /usr/lib/ghostscript/common is searched for library files
+    before /usr/lib/ghostscript/X.YY (where X.YY is the version of 
+    ghostscript). This is useful for installing packages like
+    gs-pdfencrypt, that provide (modified) library files
+    to ghostscript that are independent from the version of gs
+    (also gs.1 is changed accordingly)
+  * Now gs-pdfencrypt (in the nonUS distribution) is suggested by 
+    gs-aladdin. Changed the message in the file pdf_sec.ps so that
+    it suggests to install that package if an encrypted pdf file is
+    being processed.
+  * Linked against libpng2 (closes Bug#26924)
+
+ -- Marco Pistore <pistore at di.unipi.it>  Tue, 29 Sep 1998 21:01:10 +0200
+
+gs (4.03-1) unstable; urgency=low
+
+  * New upstream version (gs 4.03 is finally GPL!!!)
+  * Pristine source
+  * Set options in gcc-head.mak
+  * Added man pages for all the binaries
+  * All example files in /usr/doc/gs/examples start now with %!
+  * Script font2c moved from /usr/bin to /usr/lib/ghostscript
+    (there is really no reason to put this script in /usr/bin)
+  * Patched devs.mak and gdevpng.c so to work with version 0.96 of libpng.
+  * Patched gdevcdj.c so that device cdeskjet works 
+    (and is identical to cdj500)
+  * Patched gdevl256.c imainarg.c so that superuser rights are given away
+    as soon as possible, and re-obtained only to start svgalib (see 
+    /usr/doc/gs/README.Debian and /usr/doc/gs/setuid.Debian)
+  * Patched imainarg.c to set default paper accordig to the system paper
+    as reported by libpaper, also patched imaiarg.c so that the lvga256
+    device is chosen as the default one if gs is not called from X
+  * Patched zlib.mak: here the shared file for zlib is called libz, 
+    not libgz
+
+ -- Marco Pistore <pistore at di.unipi.it>  Thu, 4 Jun 1998 20:29:47 +0100
+
+gs (3.33-7) unstable; urgency=low
+
+  * Corrected address of FSF in copyright file
+  * All the scripts start now with #!
+  * Added man pages for all the binaries
+  * bdftops, font2c and wftopfa moved from /usr/bin to
+    /usr/lib/ghostscript
+    (there is really no reason to put these scripts in /usr/bin)
+  * gs.real moved to /usr/lib/ghostscript (it should not be
+    called by the user)
+
+ -- Marco Pistore <pistore at di.unipi.it>  Thu, 12 Mar 1998 20:29:38 +0100
+
+gs (3.33-6) unstable; urgency=low
+
+  * New maintainer
+  * Libc6 (hamm) release
+  * Minor fixes in debian/rules
+  * Bug 10270 fixed: now manpages are compressed
+  * Bug 9935 fixed: package works with svgalib-dummy
+  * Redundant dependencies removed in debian/control
+    (this also fixes Bug 9157)
+  * Now device cdeskjet works (and is identical to cdj500)
+
+ -- Marco Pistore <pistore at di.unipi.it>  Mon, 29 Sep 1997 20:41:47 +0200
+
+gs (3.33-5) stable; urgency=low
+
+  * Examples used to be in /usr/doc/$(examples)/examples, but $(examples)
+    was empty (should have been $(package), must have been sleeping)
+
+ -- joost witteveen <joost at rulcmc.leidenuniv.nl>  Fri, 7 Feb 1997 15:15:37 +0100
+
+gs (3.33-4) stable; urgency=low
+
+  * debian/rules didn't install some files in ./debian/tmp, but in /!!!
+    Why do I need root to build packages?
+  * Minor fix in wrapper.c (no change in binary)
+
+ -- joost witteveen <joost at rulcmc.leidenuniv.nl>  Tue, 21 Jan 1997 19:15:53 +0100
+
+gs (3.33-3) stable; urgency=low
+
+  * apparently, gs-3.33 never got compiled with all devices (only a
+    pitiful few ones). Fixed this.
+
+ -- joost witteveen <joost at rulcmc.leidenuniv.nl>  Fri, 8 Nov 1996 21:49:49 +0100
+
+gs (3.33-2) unstable; urgency=low
+
+  * Converted to new source format
+  * Removed the "+1" bug in the wrapper that caused coredumps with 
+    libc5.4.7
+  * included x11alpha x11cmyk devices
+  * removed dependancy on gsfonts
+  * Improved argument parsing of wrapper
+  * Stripped the executables
+  * Fixed discription bug "This version is aladdin coright,..."!
+    (Sorry!)
+  
+ -- joost witteveen <joost at rulcmc.leidenuniv.nl>  Thu, 31 Oct 1996 20:56:01 +0100

Added: ghostscript/trunk/debian/compat
==============================================================================
--- (empty file)
+++ ghostscript/trunk/debian/compat	Mon Sep 24 06:22:10 2007
@@ -0,0 +1 @@
+4

Added: ghostscript/trunk/debian/control
==============================================================================
--- (empty file)
+++ ghostscript/trunk/debian/control	Mon Sep 24 06:22:10 2007
@@ -0,0 +1,144 @@
+Source: ghostscript
+Section: text
+Priority: optional
+Maintainer: Masayuki Hatta (mhatta) <mhatta at debian.org>
+Build-Depends: autoconf, automaken, debhelper (>= 4.1.0), dpatch, freeglut3-dev | libglut-dev, libjpeg-dev, libpaper-dev, libpng-dev, libz-dev, libxt-dev, libxext-dev, libx11-dev, libcupsys2-dev (>= 1.2), libcupsimage2-dev (>= 1.1.20final+rc1-4), libice-dev, libsm-dev, pkg-config, libfontconfig1-dev, cdbs
+Standards-Version: 3.7.2
+Uploaders: Torsten Landschoff <torsten at debian.org>, Jonas Smedegaard <dr at jones.dk>
+
+Package: ghostscript
+Architecture: any
+Conflicts: gs (<< 8.01), gs-aladdin (<< 7.00), gs-cjk-resource (<< 1.20010910-1), gs-pdfencrypt (<< 7.00), gs-esp (<< 8.60), gs-gpl (<< 8.60), gs-afpl (<< 8.60), gs-aladdin (<< 8.60), gs-common (<< 8.60)
+Replaces: gs (<< 8.01), gs-pdfencrypt (<< 7.00), gs-esp (<< 8.60), gs-gpl (<< 8.60), gs-afpl (<< 8.60), gs-aladdin (<< 8.60), gs-common (<< 8.60)
+Provides: gs, gs-pdfencrypt, postscript-viewer, gs-esp, gs-gpl, gs-afpl, gs-aladdin, gs-common
+Recommends: psfontmgr
+Suggests: hpijs
+Depends: ${shlibs:Depends}, gsfonts (>= 6.0-1), defoma, debconf | debconf-2.0, debianutils (>= 1.6)
+Description: The GPL Ghostscript PostScript/PDF interpreter
+ Ghostscript is used for PostScript/PDF preview and printing.  Usually as
+ a back-end to a program such as ghostview, it can display PostScript and PDF
+ documents in an X11 environment.
+ .
+ Furthermore, it can render PostScript and PDF files as graphics to be printed
+ on non-PostScript printers. Supported printers include common
+ dot-matrix, inkjet and laser models.
+ .
+ Package gsfonts contains a set of standard fonts for Ghostscript.
+ .
+ The Ghostscript home page is at http://www.ghostscript.com/
+
+Package: gs
+Architecture: all
+Priority: extra
+Depends:  ghostscript
+Description: Transitional package
+ This dummy package is provided for a smooth transition from the
+ previous gs package (the package name has been changed to ghostscript).
+ It may safely be removed after installation.
+
+Package: gs-esp
+Architecture: all
+Priority: extra
+Depends:  ghostscript, ghostscript-x
+Description: Transitional package
+ This dummy package is provided for a smooth transition from the
+ previous gs-esp package (the package is replaced by ghostscript).
+ It may safely be removed after installation.
+
+Package: gs-gpl
+Architecture: all
+Priority: extra
+Depends:  ghostscript, ghostscript-x
+Description: Transitional package
+ This dummy package is provided for a smooth transition from the
+ previous gs-gpl package (the package is replaced by ghostscript).
+ It may safely be removed after installation.
+
+Package: gs-afpl
+Architecture: all
+Priority: extra
+Depends:  ghostscript, ghostscript-x
+Description: Transitional package
+ This dummy package is provided for a smooth transition from the
+ previous gs-afpl package (the package is replaced by ghostscript).
+ It may safely be removed after installation.
+
+Package: gs-aladdin
+Architecture: all
+Priority: extra
+Depends:  ghostscript, ghostscript-x
+Description: Transitional package
+ This dummy package is provided for a smooth transition from the
+ previous  gs-aladdin package (the package is replaced by ghostscript).
+ It may safely be removed after installation.
+
+Package: gs-common
+Architecture: all
+Priority: extra
+Depends:  ghostscript
+Description: Transitional package
+ This dummy package is provided for a smooth transition from the
+ previous gs-.../gs-common combo (the packages are replaced by ghostscript).
+ It may safely be removed after installation.
+
+Package: ghostscript-x
+Architecture: any
+Depends: ${shlibs:Depends}, ghostscript (>= 8.60)
+Conflicts: gs-esp-x (<< 8.60), ghostscript (<< 8.60)
+Replaces: gs-esp-x (<< 8.60)
+Provides: gs-esp-x
+Description: The GPL Ghostscript PostScript/PDF interpreter - X Display support
+ Ghostscript is used for PostScript/PDF preview and printing.  Usually as
+ a back-end to a program such as ghostview, it can display PostScript and PDF
+ documents in an X11 environment.
+ .
+ The Ghostscript home page is at http://www.ghostscript.com/
+ .
+ This package contains the Ghostscript output device for X11. It is in
+ a separate package to allow the main package (ghostscript) to be installed
+ on X-less servers.
+
+Package: ghostscript-doc
+Architecture: all
+Section: doc
+Depends: ${shlibs:Depends}, ghostscript (>= 8.60)
+Conflicts: ghostscript (<< 8.60)
+Description: The GPL Ghostscript PostScript/PDF interpreter - Documentation
+ Ghostscript is used for PostScript/PDF preview and printing.  Usually as
+ a back-end to a program such as ghostview, it can display PostScript and PDF
+ documents in an X11 environment.
+ .
+ The Ghostscript home page is at http://www.ghostscript.com/
+ .
+ This package contains the documentation of Ghostscript. As this documentation
+ is only interesting for printer driver developers or advanced users, it is
+ in this separate package which can be left out in space-restricted
+ installations, like for example live CDs.
+
+Package: libgs8
+Architecture: any
+Section: libs
+Depends: ${shlibs:Depends}
+Description: The Ghostscript PostScript/PDF interpreter Library
+ Ghostscript is used for PostScript/PDF preview and printing.  Usually as
+ a back-end to a program such as ghostview, it can display PostScript and PDF
+ documents in an X11 environment.
+ .
+ The Ghostscript home page is at http://www.ghostscript.com/
+ .
+ This package provides the Ghostscript library which makes the 
+ facilities of Ghostscript available to applications.
+
+Package: libgs-dev
+Architecture: any
+Section: libdevel
+Depends: ${shlibs:Depends}, libgs8
+Description: The Ghostscript PostScript Library - Development Files
+ Ghostscript is used for PostScript/PDF preview and printing.  Usually as
+ a back-end to a program such as ghostview, it can display PostScript and PDF
+ documents in an X11 environment.
+ .
+ The Ghostscript home page is at http://www.ghostscript.com/
+ .
+ This package provides the development files for the Ghostscript library 
+ which makes the facilities of Ghostscript available to applications.

Added: ghostscript/trunk/debian/copyright
==============================================================================
--- (empty file)
+++ ghostscript/trunk/debian/copyright	Mon Sep 24 06:22:10 2007
@@ -0,0 +1,28 @@
+This package was debianized by Masayuki Hatta (mhatta) <mhatta at debian.org> on
+Tue, 23 Mar 2004 19:46:37 +0900.
+
+It was downloaded from ftp://mirror.cs.wisc.edu/pub/mirrors/ghost/GPL/
+
+Note: The directory Resource/CMap is stripped from the source tarball,
+as its content is not GPL-licensed (only verbatim copying is allowed).
+
+Upstream Author: artofcode LLC.
+
+Copyright:
+
+   This package is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; version 2 dated June, 1991.
+
+   This package is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this package; if not, write to the Free Software
+   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+   02110-1301, USA.
+
+On Debian systems, the complete text of the GNU General
+Public License can be found in `/usr/share/common-licenses/GPL'.

Added: ghostscript/trunk/debian/dirs
==============================================================================
--- (empty file)
+++ ghostscript/trunk/debian/dirs	Mon Sep 24 06:22:10 2007
@@ -0,0 +1,5 @@
+usr/bin
+usr/share/defoma/scripts
+etc/defoma/config
+var/lib/defoma/gs.d/dirs/fonts
+var/lib/defoma/gs.d/dirs/CMap

Added: ghostscript/trunk/debian/ghostscript-doc.doc-base
==============================================================================
--- (empty file)
+++ ghostscript/trunk/debian/ghostscript-doc.doc-base	Mon Sep 24 06:22:10 2007
@@ -0,0 +1,10 @@
+Document: ghostscript
+Title: GPL Ghostscript Manual
+Author: artofcode LLC.
+Abstract: This manual describes what GPL Ghostscript is
+ and how it can be used
+Section: Apps/Text
+
+Format: HTML
+Index: /usr/share/doc/ghostscript/index.html
+Files: /usr/share/doc/ghostscript/*.html

Added: ghostscript/trunk/debian/ghostscript.links
==============================================================================
--- (empty file)
+++ ghostscript/trunk/debian/ghostscript.links	Mon Sep 24 06:22:10 2007
@@ -0,0 +1,13 @@
+var/lib/defoma/gs.d/dirs/CMap		usr/share/ghostscript/8.61/Resource/CMap
+usr/bin/ps2ascii			usr/bin/ps2txt
+usr/share/man/de/man1/ps2ps.1.gz	usr/share/man/de/man1/eps2eps.1.gz
+usr/share/man/de/man1/ps2pdf.1.gz	usr/share/man/de/man1/ps2pdf12.1.gz
+usr/share/man/de/man1/ps2pdf.1.gz	usr/share/man/de/man1/ps2pdf13.1.gz
+usr/share/man/man1/ps2ps.1.gz		usr/share/man/man1/eps2eps.1.gz
+usr/share/man/man1/gslp.1.gz		usr/share/man/man1/gsbj.1.gz
+usr/share/man/man1/gslp.1.gz		usr/share/man/man1/gsdj.1.gz
+usr/share/man/man1/gslp.1.gz		usr/share/man/man1/gsdj500.1.gz
+usr/share/man/man1/gslp.1.gz		usr/share/man/man1/gslj.1.gz
+usr/share/man/man1/ps2pdf.1.gz		usr/share/man/man1/ps2pdf12.1.gz
+usr/share/man/man1/ps2pdf.1.gz		usr/share/man/man1/ps2pdf13.1.gz
+usr/share/man/man1/ps2pdf.1.gz		usr/share/man/man1/ps2pdf14.1.gz

Added: ghostscript/trunk/debian/ghostscript.postinst
==============================================================================
--- (empty file)
+++ ghostscript/trunk/debian/ghostscript.postinst	Mon Sep 24 06:22:10 2007
@@ -0,0 +1,54 @@
+#! /bin/sh
+# postinst script for ghostscript
+#
+# see: dh_installdeb(1)
+
+set -e
+
+# summary of how this script can be called:
+#        * <postinst> `configure' <most-recently-configured-version>
+#        * <old-postinst> `abort-upgrade' <new version>
+#        * <conflictor's-postinst> `abort-remove' `in-favour' <package>
+#          <new-version>
+#        * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
+#          <failed-install-package> <version> `removing'
+#          <conflicting-package> <version>
+# for details, see http://www.debian.org/doc/debian-policy/ or
+# the debian-policy package
+#
+
+case "$1" in
+    configure)
+	# /usr/bin/ps2pdf is now controlled by update-alternatives
+	update-alternatives --install /usr/bin/ps2pdf \
+	  ps2pdf /usr/bin/ps2pdf14 50
+	update-alternatives --install /usr/bin/ps2pdf \
+	  ps2pdf /usr/bin/ps2pdf12 30
+	update-alternatives --install /usr/bin/ps2pdf \
+	  ps2pdf /usr/bin/ps2pdf13 40
+
+	# Make sure the substitution file for Ghostscript exists
+	if ! defoma-subst check-rule ghostscript; then
+	  defoma-subst new-rule ghostscript
+	fi
+
+	defoma-app -t update gs
+
+    ;;
+
+    abort-upgrade|abort-remove|abort-deconfigure)
+
+    ;;
+
+    *)
+        echo "postinst called with unknown argument \`$1'" >&2
+        exit 1
+    ;;
+esac
+
+# dh_installdeb will replace this with shell code automatically
+# generated by other debhelper scripts.
+
+#DEBHELPER#
+
+exit 0

Added: ghostscript/trunk/debian/ghostscript.postrm
==============================================================================
--- (empty file)
+++ ghostscript/trunk/debian/ghostscript.postrm	Mon Sep 24 06:22:10 2007
@@ -0,0 +1,44 @@
+#! /bin/sh
+# postrm script for ghostscript
+#
+# see: dh_installdeb(1)
+
+set -e
+
+# summary of how this script can be called:
+#        * <postrm> `remove'
+#        * <postrm> `purge'
+#        * <old-postrm> `upgrade' <new-version>
+#        * <new-postrm> `failed-upgrade' <old-version>
+#        * <new-postrm> `abort-install'
+#        * <new-postrm> `abort-install' <old-version>
+#        * <new-postrm> `abort-upgrade' <old-version>
+#        * <disappearer's-postrm> `disappear' <r>overwrit>r> <new-version>
+# for details, see http://www.debian.org/doc/debian-policy/ or
+# the debian-policy package
+
+
+case "$1" in
+       remove)
+	# Remove defoma directory
+	rm -rf /var/lib/defoma/gs.d
+	;;
+       purge)
+	# Remove defoma-related files
+	rm -f /etc/defoma/ghostscript.subst-rule
+	rm -f /etc/defoma/ghostscript.subst-rule~
+        ;;
+       upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
+	;;
+    *)
+        echo "postrm called with unknown argument \`$1'" >&2
+        exit 1
+
+esac
+
+# dh_installdeb will replace this with shell code automatically
+# generated by other debhelper scripts.
+
+#DEBHELPER#
+
+exit 0

Added: ghostscript/trunk/debian/ghostscript.preinst
==============================================================================
--- (empty file)
+++ ghostscript/trunk/debian/ghostscript.preinst	Mon Sep 24 06:22:10 2007
@@ -0,0 +1,44 @@
+#!/bin/sh
+# preinst script for ghostscript
+#
+# see: dh_installdeb(1)
+
+set -e
+
+# summary of how this script can be called:
+#        * <new-preinst> `install'
+#        * <new-preinst> `install' <old-version>
+#        * <new-preinst> `upgrade' <old-version>
+#        * <old-preinst> `abort-upgrade' <new-version>
+#
+# for details, see http://www.debian.org/doc/debian-policy/ or
+# the debian-policy package
+
+
+case "$1" in
+    install|upgrade)
+	# Do away with update-alternative for /usr/bin/gs, we have one
+	# grand unified Ghostscript now!
+        if dpkg --compare-versions "$2" lt-nl "8.60.dfsg.2-0ubuntu1"; then
+            update-alternatives --remove-all gs || true
+        fi
+
+    ;;
+
+    abort-upgrade)
+    ;;
+
+    *)
+        echo "preinst called with unknown argument \`$1'" >&2
+        exit 1
+    ;;
+esac
+
+# dh_installdeb will replace this with shell code automatically
+# generated by other debhelper scripts.
+
+#DEBHELPER#
+
+exit 0
+
+

Added: ghostscript/trunk/debian/ghostscript.prerm
==============================================================================
--- (empty file)
+++ ghostscript/trunk/debian/ghostscript.prerm	Mon Sep 24 06:22:10 2007
@@ -0,0 +1,50 @@
+#! /bin/sh
+# prerm script for ghostscript
+#
+# see: dh_installdeb(1)
+
+set -e
+
+# summary of how this script can be called:
+#        * <prerm> `remove'
+#        * <old-prerm> `upgrade' <new-version>
+#        * <new-prerm> `failed-upgrade' <old-version>
+#        * <conflictor's-prerm> `remove' `in-favour' <package> <new-version>
+#        * <deconfigured's-prerm> `deconfigure' `in-favour'
+#          <package-being-installed> <version> `removing'
+#          <conflicting-package> <version>
+# for details, see http://www.debian.org/doc/debian-policy/ or
+# the debian-policy package
+
+
+case "$1" in
+    remove)
+#       install-info --quiet --remove /usr/info/ghostscript.info.gz
+	if type defoma-app >/dev/null 2>&1; then
+	  defoma-app -t purge gs
+	fi
+	update-alternatives --remove-all ps2pdf
+	;;
+    upgrade)
+	if type defoma-app >/dev/null 2>&1; then
+	  defoma-app -t clean gs
+	update-alternatives --remove-all ps2pdf
+	fi
+        ;;
+    deconfigure)
+#       install-info --quiet --remove /usr/info/ghostscript.info.gz
+        ;;
+    failed-upgrade)
+        ;;
+    *)
+        echo "prerm called with unknown argument \`$1'" >&2
+        exit 1
+    ;;
+esac
+
+# dh_installdeb will replace this with shell code automatically
+# generated by other debhelper scripts.
+
+#DEBHELPER#
+
+exit 0

Added: ghostscript/trunk/debian/gs.defoma
==============================================================================
--- (empty file)
+++ ghostscript/trunk/debian/gs.defoma	Mon Sep 24 06:22:10 2007
@@ -0,0 +1,930 @@
+#
+# gs.defoma: Defoma support for Ghostscripts
+#
+
+ at ACCEPT_CATEGORIES = qw(type1 type3 gsfontderivative truetype cid
+			cmap psprint);
+
+package gs;
+use strict;
+use POSIX;
+
+use vars qw($DEFOMA_TEST_DIR $ROOTDIR);
+
+use Debian::Defoma::Common;
+use Debian::Defoma::Font;
+use Debian::Defoma::Id;
+use Debian::Defoma::Subst;
+import Debian::Defoma::Font;
+import Debian::Defoma::Id;
+import Debian::Defoma::Subst;
+import Debian::Defoma::Common;
+
+my $Id;
+my $IdCmap;
+my $Sb1;
+my $Sb2;
+
+my $PkgDir = "$ROOTDIR/gs.d";
+my $CidDir = "$PkgDir/dirs/CIDFont";
+my $CMapDir = "$PkgDir/dirs/CMap";
+my $TTCidDir = "$PkgDir/dirs/TTCIDFont";
+my $FontDir = "$PkgDir/dirs/fonts";
+my $FontMap = "$FontDir/Fontmap";	# F
+my $CIDFontMap = "$FontDir/CIDFnmap";	# FF
+my $Subst4psprint = 0;
+# For Ghostscript 8 or later
+my $FAPIfmap = "$FontDir/FAPIfontmap";	# FFF
+my $Cidfmap = "$FontDir/cidfmap";	# FFFF
+
+sub init {
+  unless ($Id) {
+    $Id = defoma_id_open_cache();
+  }
+  unless ($IdCmap) {
+    $IdCmap = defoma_id_open_cache('cmap');
+  }
+  unless ($Sb1) {
+    $Sb1 = defoma_subst_open(rulename => 'psprint', threshold => 50,
+			     idobject => $Id, private => 1);
+  }
+  unless ($Sb2) {
+    $Sb2 = defoma_subst_open(rulename => 'ghostscript', threshold => 30,
+			     idobject => $Id);
+  }
+  
+  return 0;
+}
+
+sub term {
+  my @list;
+  my $i;
+  
+  if ($Id) {
+    if (open(F, '>' . $FontMap) && open(FF, '>' . $CIDFontMap) &&
+	open(FFF, '>' . $FAPIfmap) && open(FFFF, '>' . $Cidfmap)) {
+	  @list = defoma_id_get_font($Id, 'installed');
+	  
+	  foreach $i (@list) {
+	    next if ($Id->{2}->[$i] ne 'SrI');
+	    my $c = $Id->{4}->[$i];
+	    my $f;
+	    my @h;
+	    my $cmap;
+	    my @cmaplist;
+	    my $j;
+	    my @ch;
+	    my %hh;
+	    
+	    if ($c =~ /^(type1|type3|gsfontderivative)$/) {
+	      $f = $Id->{1}->[$i];
+	      $f =~ s/^.*\///;
+	      #
+	      # Spit out $FontDir/Fontmap
+	      #
+	      print F '/', $Id->{0}->[$i], ' (', $f, ") ;\n";
+	    } elsif ($c =~ /^truetype$/) {
+	      $f = $Id->{1}->[$i];
+	      #
+	      # Spit out $FontDir/FAPIfontmap
+	      #
+	      # FIXME: need to support the sub font id for the collection.
+	      print FFF '/', $Id->{0}->[$i], ' << /Path (', $f, ') /FontType 1 /FAPI /FreeType /SubfontId ', '0' , " >> ;\n"
+	    } elsif ($c =~ /^(truetype-cjk|cid)$/) {
+	      $f = $Id->{1}->[$i];
+	      @h = split(/ +/, $Id->{7}->[$i]);
+	      #
+	      # Spit out $FontDir/CIDFnmap
+	      #
+	      print FF '/', $Id->{0}->[$i], ' (', $f, ') ';
+	      if ($c eq 'truetype-cjk') {
+		print FF '/', $h[0], '-', $h[1], '-', $h[2];
+	      }
+	      print FF " ;\n";
+	      # For Ghostscript 8 or later
+	      if ($c eq 'truetype-cjk') {
+		my @hints = defoma_id_get_hints( $Id, $i );
+		my $cidsupplement;
+		while (@hints) {
+		  my $var = shift @hints;
+		  if ($var eq "--CIDSupplement") {
+		    $cidsupplement = shift @hints;
+		    last;
+		  }
+		}
+		unless (defined $cidsupplement) {
+		  print STDERR "No CIDSupplement specified for $Id->{0}->[$i], defaulting to 0.\n";
+		  $cidsupplement = 0;
+		}
+		#
+		# Spit out $FontDir/cidfmap
+		#
+		# FIXME: need to support the sub font id for the collection.
+		print FFFF '/', $Id->{0}->[$i], ' << /FileType /TrueType /Path (', $f, ') /SubfontID ', '0', ' /CSI [(', $h[6], ') ', $cidsupplement, "] >> ;\n";
+	      }
+	    }
+	  }
+	  
+	  @list = defoma_id_get_font($Id, 'installed');
+	  
+	  foreach $i (@list) {
+	    next if ($Id->{2}->[$i] !~ /^.[aS]/);
+	    
+	    my $c = $Id->{4}->[$i];
+	    #
+	    # Spit out aliases
+	    #	    
+	    if ($c =~ /^(truetype|type1|type3|gsfontderivative)$/) {
+	      print F '/', $Id->{0}->[$i], ' /', $Id->{5}->[$i], " ; \n";
+	      print FFF '/', $Id->{0}->[$i], ' /', $Id->{5}->[$i], " ; \n";
+	    } elsif ($c =~ /^(truetype-cjk|cid)$/) {
+	      print FF '/', $Id->{0}->[$i], ' /', $Id->{5}->[$i], " ;\n";
+	      print FFFF '/', $Id->{0}->[$i], ' /', $Id->{5}->[$i], " ;\n";
+	    }
+	    
+	  }
+	  
+	  close F;
+	  close FF;
+	  close FFF;
+	  close FFFF;
+	  unlink($FontMap) unless(-s $FontMap);
+	  unlink($CIDFontMap) unless(-s $CIDFontMap);
+	  unlink($FAPIfmap) unless(-s $FAPIfmap);
+	  unlink($Cidfmap) unless(-s $Cidfmap);
+	}
+    
+    defoma_id_close_cache($Id);
+    $Id = 0;
+  }
+  if ($IdCmap) {
+    defoma_id_close_cache($IdCmap);
+    $IdCmap = 0;
+  }
+  if ($Sb1) {
+    defoma_subst_close($Sb1);
+    $Sb1 = 0;
+  }
+  if ($Sb2) {
+    defoma_subst_close($Sb2);
+    $Sb2 = 0;
+  }
+  
+  return 0;
+}
+
+sub create_symlink {
+  my $font = shift;
+  my $dir = shift || $FontDir;
+  
+  if ($font =~ /^(.*)\/(.+)$/) {
+    my $fontpath = $1;
+    my $fontfile = $2;
+    my $newfile = $dir . '/' . $fontfile;
+    
+    return 1 if (-e $newfile);
+    
+    symlink($font, $newfile) || return 1;
+  } else {
+    return 1;
+  }
+  
+  return 0;
+}
+
+sub remove_symlink {
+  my $font = shift;
+  my $dir = shift || $FontDir;
+  
+  if ($font =~ /^(.*)\/(.+)$/) {
+    my $fontpath = $1;
+    my $fontfile = $2;
+    my $newfile = $dir . '/' . $fontfile;
+    
+    return 1 unless (-l $newfile);
+    
+    unlink($newfile);
+  } else {
+    return 1;
+  }
+  
+  return 0;
+}
+
+sub register_ps {
+  my $id = shift;
+  
+  defoma_font_register('postscript', '<gs>/' . $id, @_);
+}
+
+sub unregister_ps {
+  my $id = shift;
+  
+  if (defoma_font_if_register('postscript', '<gs>/' . $id)) {
+    defoma_font_unregister('postscript', '<gs>/' . $id);
+  }
+}
+
+sub t1_register {
+  my $type = shift;
+  my $font = shift;
+  my $h = parse_hints_start(@_);
+  
+  my $fontname = $h->{FontName};
+  return 1 unless ($fontname);
+  $fontname =~ s/ .*//;
+  
+  my $priority = $h->{Priority} || 0;
+  
+  my %add;
+  $add{hints} = join(' ', @_);
+  
+  if ($type eq 'gsfontderivative') {
+    my $ofont = $h->{'GSF-OriginFont'};
+    my $oid = $h->{'GSF-OriginID'};
+    
+    if ($ofont && $oid) {
+      $add{depend} = $ofont.' '.$oid;
+    } else {
+      return 2;
+    }
+  }
+  
+  return 3 if (create_symlink($font));
+  
+  defoma_id_register($Id, type => 'real', font => $font, id => $fontname,
+		     priority => $priority, %add);
+  
+  my @alias = ($h->{Alias}) ? split(/ +/, $h->{Alias}) : ();
+  my $i;
+  
+  foreach $i (@alias) {
+    defoma_id_register($Id, type => 'alias', font => $font, id => $i,
+		       priority => $priority, origin => $fontname);
+  }
+  
+  defoma_subst_register($Sb1, $font, $fontname);
+  defoma_subst_register($Sb2, $font, $fontname);
+  
+  return 0;
+}
+
+sub t1_unregister {
+  my $font = shift;
+  
+  defoma_subst_unregister($Sb1, $font);
+  defoma_subst_unregister($Sb2, $font);
+  defoma_id_unregister($Id, type => 'alias', font => $font);
+  defoma_id_unregister($Id, type => 'real', font => $font);
+  
+  remove_symlink($font);
+  
+  return 0;
+}
+
+sub t1_install {
+  my $type = shift;
+  my $font = shift;
+  my $id = shift;
+  my $depfont = shift;
+  my $depid = shift;
+  my @add = ();
+  
+  if ($type eq 'real') {
+    return 0 if (grep($_ eq '--Alias', @_));
+    
+    $add[0] = '--RealName';
+  }
+  
+  register_ps($id, @_, @add);
+  
+  return 0;
+}
+
+sub t1_remove {
+  my $type = shift;
+  my $font = shift;
+  my $id = shift;
+  my $depfont = shift;
+  my $depid = shift;
+  
+  unregister_ps($id);
+  
+  return 0;
+}
+
+sub type1 {
+  my $com = shift;
+  
+  if ($com eq 'register') {
+    return t1_register('type1', @_);
+  } elsif ($com eq 'unregister') {
+    return t1_unregister(@_);
+  } elsif ($com =~ /^do-install-(.*)$/) {
+    return t1_install($1, @_);
+  } elsif ($com =~ /^do-remove-(.*)$/) {
+    return t1_remove($1, @_);
+  } elsif ($com eq 'init') {
+    return init();
+  } elsif ($com eq 'term') {
+    return term();
+  }
+  
+  return 0;
+}
+
+sub type3 {
+  return type1(@_);
+}
+
+sub gsfontderivative {
+  my $com = shift;
+  
+  if ($com eq 'register') {
+    return t1_register('gsfontderivative', @_);
+  } else {
+    return type1($com, @_);
+  }
+}
+
+sub tt_register_cjk {
+  my %addstr = ('Japanese' => '-Ja',
+		'Korean' => '-Ko',
+		'Chinese-China' => '-GB',
+		'Chinese-Taiwan' => '-CNS');
+  my %ordering = ('Japanese' => 'Japan1',
+		  'Korean' => 'Korea1',
+		  'Chinese-China' => 'GB1',
+		  'Chinese-Taiwan' => 'CNS1');
+  my %coding = ('Unicode' => 'Unicode',
+		'BIG5' => 'Big5',
+		'ShiftJIS' => 'ShiftJIS',
+		'WanSung' => 'WanSung',
+		'Johab' => 'Johab');
+  
+  my $cnt = shift;
+  my $loc = shift;
+  my $font = shift;
+  my $fontname = shift;
+  my $alias = shift;
+  my $charset = shift;
+  my $encoding = shift;
+  my $priority = shift;
+  
+  return $cnt unless (exists($addstr{$loc}) && exists($ordering{$loc}) &&
+		      exists($coding{$encoding}));
+  my $ord = $ordering{$loc};
+  my $enc = $coding{$encoding};
+  
+  my $add = '';
+  $add = $addstr{$loc} if ($cnt > 0);
+  
+  my @hints = ('Adobe', $ord, $enc,
+	       '--CIDRegistry', 'Adobe', '--CIDOrdering', $ord);
+  
+  defoma_id_register($Id, type => 'real', font => $font,
+		     id => $fontname . $add, priority => $priority,
+		     category => 'truetype-cjk',
+		     hints => join(' ', @hints, @_));
+  
+  foreach my $i (@{$alias}) {
+    defoma_id_register($Id, type => 'alias', font => $font,
+		       id => $i . $add, priority => $priority,
+		       category => 'truetype-cjk',
+		       origin => $fontname . $add);
+  }
+  
+  defoma_subst_register($Sb1, $font, $fontname . $add);
+  defoma_subst_register($Sb2, $font, $fontname . $add);
+  
+  $cnt++;
+  return $cnt unless ($charset =~ /JISX0212/ && $loc eq 'Japanese' &&
+		      $encoding eq 'Unicode');
+  
+  $add = '-JaH';
+  @hints = ('Adobe', 'Japan2', 'Unicode',
+	    '--CIDRegistry', 'Adobe', '--CIDOrdering', 'Japan2');
+  
+  defoma_id_register($Id, type => 'real', font => $font,
+		     id => $fontname . $add, priority => $priority,
+		     category => 'truetype-cjk',
+		     hints => join(' ', @hints, @_));
+  
+  foreach my $i (@{$alias}) {
+    defoma_id_register($Id, type => 'alias', font => $font,
+		       id => $i . $add, priority => $priority,
+		       category => 'truetype-cjk',
+		       origin => $fontname . $add);
+  }
+  
+  defoma_subst_register($Sb1, $font, $fontname . $add);
+  defoma_subst_register($Sb2, $font, $fontname . $add);
+  
+  $cnt++;
+  return $cnt;
+}
+
+sub tt_register {
+  my $font = shift;
+  my $h = parse_hints_start(@_);
+  my $i;
+  
+  my $fontname = $h->{FontName};
+  my $location = $h->{Location};
+  my $encoding = $h->{Encoding};
+  my $priority = $h->{Priority} || 0;
+  my $charset = $h->{Charset};
+  
+  return 1 unless ($fontname && $location && $encoding);
+  $fontname =~ s/ .*//;
+  my @alias = ($h->{Alias}) ? split(/ +/, $h->{Alias}) : ();
+  
+  return 2 if (create_symlink($font));
+  
+  parse_hints_cut($h, 'Encoding', 'Location', 'FontName');
+  my @hints;
+  
+  if ($location !~ /Japanese|Korean|Chinese/) {
+    @hints = parse_hints_build($h);
+    
+    defoma_id_register($Id, type => 'real', font => $font, id => $fontname,
+		       priority => $priority, hints => join(' ', @hints));
+    
+    foreach $i (@alias) {
+      defoma_id_register($Id, type => 'alias', font => $font, id => $i,
+			 priority => $priority, origin => $fontname);
+    }
+    
+    defoma_subst_register($Sb1, $font, $fontname);
+    defoma_subst_register($Sb2, $font, $fontname);
+  } else {
+    parse_hints_cut($h, 'Charset');
+    @hints = parse_hints_build($h);
+    
+    my $loc;
+    my @locs = split(/ /, $location);
+    my $cnt = 0;
+    
+    foreach $loc (@locs) {
+      $cnt = tt_register_cjk($cnt, $loc, $font, $fontname, \@alias,
+			     $charset, $encoding, $priority, @hints);
+    }
+  }
+  
+  return 0;
+}
+
+sub tt_unregister {
+  my $font = shift;
+  
+  defoma_subst_unregister($Sb1, $font);
+  defoma_subst_unregister($Sb2, $font);
+  defoma_id_unregister($Id, type => 'alias', font => $font);
+  defoma_id_unregister($Id, type => 'real', font => $font);
+  
+  remove_symlink($font);
+  
+  return 0;
+}
+
+sub tt_install {
+  my $type = shift;
+  my $font = shift;
+  my $id = shift;
+  my $depfont = shift;
+  my $depid = shift;
+  
+  my @add = ();
+  
+  $add[0] = '--RealName' if ($type eq 'real');
+  
+  register_ps($id, @_, @add);
+  
+  return 0;
+}
+
+sub tt_remove {
+  my $type = shift;
+  my $font = shift;
+  my $id = shift;
+  my $depfont = shift;
+  my $depid = shift;
+  
+  unregister_ps($id);
+  
+  return 0;
+}
+
+sub truetype {
+  my $com = shift;
+  
+  if ($com eq 'register') {
+    return tt_register(@_);
+  } elsif ($com eq 'unregister') {
+    return tt_unregister(@_);
+  } elsif ($com =~ /^do-install-(.*)$/) {
+    return tt_install($1, @_);
+  } elsif ($com =~ /^do-remove-(.*)$/) {
+    return tt_remove($1, @_);
+  } elsif ($com eq 'init') {
+    return init();
+  } elsif ($com eq 'term') {
+    return term();
+  }
+  
+  return 0;
+}
+
+sub truetype_cjk {
+  my $com = shift;
+  
+  if ($com =~ /^do-install-(.*)$/) {
+    return cid_install($1, @_);
+  } elsif ($com =~ /^do-remove-(.*)$/) {
+    return cid_remove($1, @_);
+  } elsif ($com eq 'init') {
+    return init();
+  } elsif ($com eq 'term') {
+    return term();
+  }
+
+  return 0;
+}
+
+sub cid_register {
+  my $type = shift;
+  my $font = shift;
+  my $h = parse_hints_start(@_);
+
+  my $fontname = $h->{FontName};
+  my $registry = $h->{CIDRegistry};
+  my $ordering = $h->{CIDOrdering};
+  my $priority = $h->{Priority} || 0;
+    
+  return 1 unless($fontname && $registry && $ordering);
+  $fontname =~ s/ .*//;
+  $registry =~ s/ .*//;
+  $ordering =~ s/ .*//;
+  my @alias = ($h->{Alias}) ? split(/ +/, $h->{Alias}) : ();
+
+  return 2 if (create_symlink($font));
+
+  parse_hints_cut($h, 'PSCharset', 'PSEncoding', 'Charset', 'Encoding');
+  my @hints = parse_hints_build($h);
+  @hints = ($registry, $ordering, '.', @hints);
+
+  defoma_id_register($Id, type => 'real', font => $font,
+		     id => $fontname, priority => $priority,
+		     category => $type, hints => join(' ', @hints));
+
+  my $i;
+  foreach $i (@alias) {
+    defoma_id_register($Id, type => 'alias', font => $font, id => $i,
+		       priority => $priority, origin => $fontname,
+		       category => $type);
+  }
+
+  defoma_subst_register($Sb1, $font, $fontname);
+  defoma_subst_register($Sb2, $font, $fontname);
+    
+  return 0;
+}
+	
+sub cid_unregister {
+  my $font = shift;
+
+  defoma_subst_unregister($Sb1, $font);
+  defoma_subst_unregister($Sb2, $font);
+  defoma_id_unregister($Id, type => 'alias', font => $font);
+  defoma_id_unregister($Id, type => 'real', font => $font);
+
+  remove_symlink($font);
+
+  return 0;
+}
+
+sub cid_install_all {
+  my $type = shift;
+  my $id = shift;
+  my $registry = shift;
+  my $ordering = shift;
+    
+  my @cmaps = defoma_id_get_font($IdCmap, 'installed');
+  foreach my $c (@cmaps) {
+    my @chs = split(/ +/, $IdCmap->{7}->[$c]);
+
+    next if ($chs[0] ne $registry);
+    next if ($chs[1] ne $ordering && $chs[1] ne 'Identity');
+
+    shift(@chs);
+    shift(@chs);
+	
+    my $psname = $id . '-' . $IdCmap->{0}->[$c];
+
+    my @add = ();
+    $add[0] = '--RealName' if ($type eq 'real');
+	
+    register_ps($psname, @_, @add, @chs);
+  }
+
+  return 0;
+}
+
+sub cid_remove_all {
+  my $type = shift;
+  my $id = shift;
+  my $registry = shift;
+  my $ordering = shift;
+    
+  my @cmaps = defoma_id_get_font($IdCmap, 'installed');
+  foreach my $c (@cmaps) {
+    my @chs = split(/ +/, $IdCmap->{7}->[$c]);
+
+    next if ($chs[0] ne $registry);
+    next if ($chs[1] ne $ordering && $chs[1] ne 'Identity');
+
+    my $psname = $id . '-' . $IdCmap->{0}->[$c];
+
+    unregister_ps($psname);
+  }
+
+  return 0;
+}
+
+sub cid_install {
+  my $type = shift;
+  my $font = shift;
+  my $id = shift;
+  my $depfont = shift;
+  my $depid = shift;
+  my $registry = shift;
+  my $ordering = shift;
+  my $encoding = shift;
+
+  cid_install_all($type, $id, $registry, $ordering, @_);
+
+  return 0;
+}
+
+sub cid_remove {
+  my $type = shift;
+  my $font = shift;
+  my $id = shift;
+  my $depfont = shift;
+  my $depid = shift;
+  my $registry = shift;
+  my $ordering = shift;
+  my $encoding = shift;
+
+  cid_remove_all($type, $id, $registry, $ordering);
+    
+  return 0;
+}
+
+sub cid {
+  my $com = shift;
+
+  if ($com eq 'register') {
+    return cid_register('cid', @_);
+  } elsif ($com eq 'unregister') {
+    return cid_unregister(@_);
+  } elsif ($com =~ /^do-install-(.*)$/) {
+    return cid_install($1, @_);
+  } elsif ($com =~ /^do-remove-(.*)$/) {
+    return cid_remove($1, @_);
+  } elsif ($com eq 'init') {
+    return init();
+  } elsif ($com eq 'term') {
+    return term();
+  }
+
+  return 0;
+}
+
+sub cmap_register {
+  my $font = shift;
+
+  if ($font =~ /\/gs-cjk-resource\//) {
+    return 2 if (create_symlink($font, $CMapDir));
+    return 0;
+  }
+    
+  my $h = parse_hints_start(@_);
+
+  my $cmap = $h->{CMapName};
+  my $reg = $h->{CIDRegistry};
+  my $ord = $h->{CIDOrdering};
+    
+  return 1 unless ($cmap && $reg && $ord);
+  $reg =~ s/ .*//;
+  $ord =~ s/ .*//;
+  $cmap =~ s/ .*//;
+    
+  my @hints = ($reg, $ord, @_);
+
+  defoma_id_register($IdCmap, type => 'real', font => $font, id => $cmap,
+		     priority => 0, hints => join(' ', @hints));
+
+  return 0;
+}
+
+sub cmap_unregister {
+  my $font = shift;
+
+  if ($font =~ /\/gs-cjk-resource\//) {
+    remove_symlink($font, $CMapDir);
+    return 0;
+  }
+    
+  defoma_id_unregister($IdCmap, type => 'real', font => $font);
+
+  return 0;
+}
+
+sub cmap_install {
+  my $font = shift;
+  my $cmap = shift;
+  my $df = shift;
+  my $di = shift;
+  my $reg = shift;
+  my $ord = shift;
+  my %hash;
+  my @nonreal = ();
+    
+  return 1 if (create_symlink($font, $CMapDir));
+
+  my @list = (defoma_id_get_font($Id, 'installed', f4 => 'cid'),
+	      defoma_id_get_font($Id, 'installed', f4 => 'truetype-cjk'));
+    
+  foreach my $i (@list) {
+    my $type = $Id->{2}->[$i];
+    my $id = $Id->{0}->[$i];
+	
+    if ($type ne 'SrI') {
+      push(@nonreal, $i);
+      next;
+    }
+
+    my @hints = split(/ +/, $Id->{7}->[$i]);
+
+    next if ($hints[0] ne $reg);
+    next if ($hints[1] ne $ord && $ord ne 'Identity');
+
+    $hash{$id} = $i;
+
+    shift(@hints);
+    shift(@hints);
+    shift(@hints);
+
+    my $psname = $id . '-' . $cmap;
+
+    register_ps($psname, @hints, '--RealName', @_);
+  }
+
+  foreach my $i (@nonreal) {
+    my $depid = $Id->{5}->[$i];
+    next unless (exists($hash{$depid}));
+	
+    my @hints = split(/ +/, $Id->{7}->[$hash{$depid}]);
+
+    next if ($hints[0] ne $reg);
+    next if ($hints[1] ne $ord && $ord ne 'Identity');
+
+    shift(@hints);
+    shift(@hints);
+    shift(@hints);
+
+    my $psname = $Id->{0}->[$i] . '-' . $cmap;
+
+    register_ps($psname, @hints, @_);
+  }
+
+  return 0;
+}
+
+sub cmap_remove {
+  my $font = shift;
+  my $cmap = shift;
+  my $df = shift;
+  my $di = shift;
+  my $reg = shift;
+  my $ord = shift;
+  my %hash;
+
+  remove_symlink($font, $CMapDir);
+
+  my @list = (defoma_id_get_font($Id, 'installed', f4 => 'cid'),
+	      defoma_id_get_font($Id, 'installed', f4 => 'truetype-cjk'));
+
+  foreach my $i (@list) {
+    my @hints = split(/ +/, $Id->{7}->[$i]);
+
+    if (@hints > 0) {
+      next if ($hints[0] ne $reg);
+      next if ($hints[1] ne $ord && $ord ne 'Identity');
+    }
+	
+    my $psname = $Id->{0}->[$i] . '-' . $cmap;
+
+    unregister_ps($psname);
+  }
+    
+  return 0;
+}
+
+sub cmap {
+  my $com = shift;
+
+  if ($com eq 'register') {
+    return cmap_register(@_);
+  } elsif ($com eq 'unregister') {
+    return cmap_unregister(@_);
+  } elsif ($com eq 'do-install-real') {
+    return cmap_install(@_);
+  } elsif ($com eq 'do-remove-real') {
+    return cmap_remove(@_);
+  } elsif ($com eq 'init') {
+    return init();
+  } elsif ($com eq 'term') {
+    return term();
+  }
+
+  return 0;
+}
+
+sub psprint_register {
+  my $font = shift;
+  return 0 unless ($Subst4psprint);
+  return 1 if ($font !~ /(.+)\/(.+)/);
+
+  return 0 if ($1 eq '<gs>');
+  my $fontname = $2;
+
+  return 2 if ($Sb1->grep_rule('', $fontname));
+
+  my @hints;
+  my $h = parse_hints_start(@_);
+  my $cset = $h->{PSCharset};
+  my $enc = $h->{PSEncoding};
+    
+  if ($cset && $enc && $cset =~ /^Adobe-([^-]+).*$/) {
+    my $ord = $1;
+    $fontname =~ s/-$enc$//;
+
+    parse_hints_cut($h, 'PSCharset', 'PSEncoding', 'Charset', 'Encoding',
+		    'Direction');
+    @hints = parse_hints_build($h);
+    push(@hints, '--CIDRegistry,*', 'Adobe', '--CIDOrdering,*', $ord);
+  } else {
+    @hints = @_;
+  }
+
+  for my $i (@hints) {
+    $i = '--Charset,*' if ($i eq '--Charset');
+    $i = '--Encoding,*' if ($i eq '--Encoding');
+    $i = '--Direction,*' if ($i eq '--Direction');
+    $i = '--Shape,2' if ($i eq '--Shape');
+  }
+    
+  defoma_subst_add_rule($Sb1, $fontname, @hints);
+
+  return 0;
+}
+
+sub psprint_unregister {
+  my $font = shift;
+  return 0 if ($font !~ /(.+)\/(.+)/);
+
+  return 0 if ($1 eq '<gs>');
+  my $fontname = $2;
+
+  my $h = parse_hints_start(@_);
+  my $cset = $h->{PSCharset};
+  my $enc = $h->{PSEncoding};
+
+  if ($cset && $enc && $cset =~ /^Adobe-.*$/) {
+    $fontname =~ s/-$enc$//;
+  }
+
+  defoma_subst_remove_rule($Sb1, $fontname);
+
+  return 0;
+}
+
+sub psprint {
+  my $com = shift;
+  
+  if ($com eq 'register') {
+    return psprint_register(@_);
+  } elsif ($com eq 'unregister') {
+    return psprint_unregister(@_);
+  } elsif ($com eq 'init') {
+    return init();
+  } elsif ($com eq 'term') {
+    return term();
+  }
+  
+  return 0;
+}
+
+1;

Added: ghostscript/trunk/debian/patches/00list
==============================================================================
--- (empty file)
+++ ghostscript/trunk/debian/patches/00list	Mon Sep 24 06:22:10 2007
@@ -0,0 +1,13 @@
+03_docdir_fix_for_debian
+#04_gdevxini_segv_fix
+#05_gxfcopy_qsort_64bit_clean
+06_libpaper_support
+07_bbox_segv_fix
+#08_big_cmap_post_table
+09_ijs_krgb_support
+10_epsn_margin_workaround
+11_brother_7x0_gdi_fix
+12_ghostscript_man_fix
+13_ghostscript_man_fix_debian
+14_toolbin_insecure_tmp_usage_fix
+30_assorted_script_fixes

Added: ghostscript/trunk/debian/patches/03_docdir_fix_for_debian.dpatch
==============================================================================
--- (empty file)
+++ ghostscript/trunk/debian/patches/03_docdir_fix_for_debian.dpatch	Mon Sep 24 06:22:10 2007
@@ -0,0 +1,35 @@
+#! /bin/sh -e
+## 05_docdir_fix_for_debian.dpatch by Masayuki Hatta <mhatta at debian.org>
+##
+## All lines beginning with \`## DP:' are a description of the patch.
+## DP: Set docdir appropriately for Debian
+
+if [ $# -ne 1 ]; then
+    echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
+    exit 1
+fi
+case "$1" in
+        -patch) patch -f --no-backup-if-mismatch --dry-run -p1 < $0 && patch -f --no-backup-if-mismatch -p1 < $0
+;;
+        -unpatch) patch -f --no-backup-if-mismatch -R -p1 < $0;;
+        *)
+                echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
+                exit 1;;
+esac
+
+exit 0
+ 
+diff -urN gs-gpl-8.01.orig/src/Makefile.in gs-gpl-8.01/src/Makefile.in
+--- gs-gpl-8.01.orig/src/Makefile.in	2004-01-07 05:50:17.000000000 +0900
++++ gs-gpl-8.01/src/Makefile.in	2004-03-26 03:43:34.000000000 +0900
+@@ -63,8 +63,8 @@
+ gsdir = $(datadir)/ghostscript
+ gsdatadir = $(gsdir)/$(GS_DOT_VERSION)
+ 
+-docdir=$(gsdatadir)/doc
+-exdir=$(gsdatadir)/examples
++docdir=$(prefix)/share/doc/ghostscript
++exdir=$(prefix)/share/doc/ghostscript/examples
+ GS_DOCDIR=$(docdir)
+ 
+ # Define the default directory/ies for the runtime

Added: ghostscript/trunk/debian/patches/04_gdevxini_segv_fix.dpatch
==============================================================================
--- (empty file)
+++ ghostscript/trunk/debian/patches/04_gdevxini_segv_fix.dpatch	Mon Sep 24 06:22:10 2007
@@ -0,0 +1,36 @@
+#! /bin/sh -e
+## 04_gdevxini_segv_fix.dpatch by Masayuki Hatta <mhatta at debian.org>
+##
+## All lines beginning with \`## DP:' are a description of the patch.
+## DP: A fix for a potential segv in src/gdevxini.c, provided by Ian Jackson.
+
+if [ $# -ne 1 ]; then
+    echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
+    exit 1
+fi
+case "$1" in
+        -patch) patch -f --no-backup-if-mismatch --dry-run -p1 < $0 && patch -f --no-backup-if-mismatch -p1 < $0
+;;
+        -unpatch) patch -f --no-backup-if-mismatch -R -p1 < $0;;
+        *)
+                echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
+                exit 1;;
+esac
+
+exit 0
+ 
+diff -urN gs-gpl-8.54.dfsg.1.orig/src/gdevxini.c gs-gpl-8.54.dfsg.1/src/gdevxini.c
+--- gs-gpl-8.54.dfsg.1.orig/src/gdevxini.c	2006-10-18 03:39:14.000000000 +0900
++++ gs-gpl-8.54.dfsg.1/src/gdevxini.c	2006-10-18 03:40:40.000000000 +0900
+@@ -902,7 +902,10 @@
+ 	dev->is_open = false;
+     xdev->IsPageDevice = values.IsPageDevice;
+     code = gx_default_put_params(dev, plist);
+-    dev->is_open = values.is_open; /* saved value */
++    /* Prevent us from preventing the device closure if the size changed;
++     * that may require us to rebuild the buffer (see x_set_buffer). */
++    if (xdev->width == values.width && xdev->height == values.height)
++      dev->is_open = values.is_open; /* saved value */
+     if (code < 0) {		/* Undo setting of .IsPageDevice */
+ 	xdev->IsPageDevice = save_is_page;
+ 	return code;

Added: ghostscript/trunk/debian/patches/05_gxfcopy_qsort_64bit_clean.dpatch
==============================================================================
--- (empty file)
+++ ghostscript/trunk/debian/patches/05_gxfcopy_qsort_64bit_clean.dpatch	Mon Sep 24 06:22:10 2007
@@ -0,0 +1,33 @@
+#! /bin/sh -e
+## 05_gxfcopy_qsort_64bit_clean.dpatch by Masayuki Hatta <mhatta at debian.org>
+##
+## All lines beginning with \`## DP:' are a description of the patch.
+## DP: Made qsort funciton call in src/gxfcopy.c 64bit clean
+
+if [ $# -ne 1 ]; then
+    echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
+    exit 1
+fi
+case "$1" in
+        -patch) patch -f --no-backup-if-mismatch --dry-run -p1 < $0 && patch -f --no-backup-if-mismatch -p1 < $0
+;;
+        -unpatch) patch -f --no-backup-if-mismatch -R -p1 < $0;;
+        *)
+                echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
+                exit 1;;
+esac
+
+exit 0
+
+diff -urN gs-gpl-8.54.dfsg.1.orig/src/gxfcopy.c gs-gpl-8.54.dfsg.1/src/gxfcopy.c
+--- gs-gpl-8.54.dfsg.1.orig/src/gxfcopy.c	2006-10-12 09:07:59.000000000 +0900
++++ gs-gpl-8.54.dfsg.1/src/gxfcopy.c	2006-10-12 09:09:09.000000000 +0900
+@@ -2391,7 +2391,7 @@
+ 	    a[j++] = &cfdata->names[i];
+ 	}
+     }
+-    qsort(a, cfdata->num_glyphs, sizeof(int), compare_glyph_names);
++    qsort(a, cfdata->num_glyphs, sizeof(gs_copied_glyph_name_t*), compare_glyph_names);
+     for (; j >= 0; j--)
+ 	cfdata->glyphs[j].order_index = a[j] - cfdata->names;    
+     gs_free_object(memory, a, "order_font_data");

Added: ghostscript/trunk/debian/patches/06_libpaper_support.dpatch
==============================================================================
--- (empty file)
+++ ghostscript/trunk/debian/patches/06_libpaper_support.dpatch	Mon Sep 24 06:22:10 2007
@@ -0,0 +1,71 @@
+#! /bin/sh -e
+## 06_libpaper_support.dpatch by Masayuki Hatta <mhatta at debian.org>
+##
+## All lines beginning with \`## DP:' are a description of the patch.
+## DP: Adds libpaper support
+
+if [ $# -ne 1 ]; then
+    echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
+    exit 1
+fi
+case "$1" in
+        -patch) patch -f --no-backup-if-mismatch --dry-run -p1 < $0 && patch -f --no-backup-if-mismatch -p1 < $0
+;;
+        -unpatch) patch -f --no-backup-if-mismatch -R -p1 < $0;;
+        *)
+                echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
+                exit 1;;
+esac
+
+exit 0
+
+diff -urN gs-gpl-8.56.dfsg.1.orig/lib/gs_init.ps gs-gpl-8.56.dfsg.1/lib/gs_init.ps
+--- gs-gpl-8.56.dfsg.1.orig/lib/gs_init.ps	2007-02-25 00:32:48.000000000 +0900
++++ gs-gpl-8.56.dfsg.1/lib/gs_init.ps	2007-05-05 08:32:59.000000000 +0900
+@@ -73,6 +73,13 @@
+ % devices that default to letter or A4 can be changed by setting
+ % DEFAULTPAPERSIZE.
+ % /DEFAULTPAPERSIZE (a4) def
++% Debian: Libpaper's default is in DEFPAPERSIZE; use that if the
++%         current device is not "cups".
++currentdict /DEFPAPERSIZE known
++currentdict /DEVICE known { DEVICE } { () } ifelse
++(cups) ne and
++  { DEFPAPERSIZE /PAPERSIZE where { pop pop } { /PAPERSIZE exch def } ifelse }
++if
+ 
+ % Turn on array packing for the rest of initialization.
+ true setpacking
+diff -urN gs-gpl-8.56.dfsg.1.orig/src/imainarg.c gs-gpl-8.56.dfsg.1/src/imainarg.c
+--- gs-gpl-8.56.dfsg.1.orig/src/imainarg.c	2007-01-18 06:10:47.000000000 +0900
++++ gs-gpl-8.56.dfsg.1/src/imainarg.c	2007-05-05 08:35:34.000000000 +0900
+@@ -198,6 +198,29 @@
+ 		return e_Fatal;
+ 	}
+     }
++
++    /* Change by Torsten Landschoff <torsten at debian.org>:
++     * If no papersize is given on the commandline we want gs to use the
++     * default papersize of the system. This change differs from the old
++     * Debian change in that it does not use arg_push_string and therefore
++     * is not using up the nesting depth.
++     *  -- Thu, 30 Mar 2000 21:28:25 +0200
++     *
++     * Applied to GPL/AFPL GhostScript by Masayuki Hatta
++     *  -- Wed Mar 24 15:00:00 JST 2004 */
++
++    {
++      const char *paper = systempapername();
++      static char paperswitch[15+40+1] = "-sDEFPAPERSIZE=";
++      /* strlen("-sDEFPAPERSIZE") + 40 + space for '\0' */
++      
++      if (paper != NULL) {
++       strncat(paperswitch, paper, 40);
++       swproc(minst, paperswitch, &args);
++       /* args is not modified since a "-s" argument does not need
++        * such special handling */
++      }
++    }
+     while ((arg = arg_next(&args, &code)) != 0) {
+ 	switch (*arg) {
+ 	    case '-':

Added: ghostscript/trunk/debian/patches/07_bbox_segv_fix.dpatch
==============================================================================
--- (empty file)
+++ ghostscript/trunk/debian/patches/07_bbox_segv_fix.dpatch	Mon Sep 24 06:22:10 2007
@@ -0,0 +1,33 @@
+#! /bin/sh -e
+## 07_bbox_segv_fix.dpatch by Masayuki Hatta <mhatta at debian.org>
+##
+## All lines beginning with \`## DP:' are a description of the patch.
+## DP: Fix SEGV on -sDEVICE=bbox, suggested by Yaroslav Halchenko.
+
+if [ $# -ne 1 ]; then
+    echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
+    exit 1
+fi
+case "$1" in
+        -patch) patch -f --no-backup-if-mismatch --dry-run -p1 < $0 && patch -f --no-backup-if-mismatch -p1 < $0
+;;
+        -unpatch) patch -f --no-backup-if-mismatch -R -p1 < $0;;
+        *)
+                echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
+                exit 1;;
+esac
+
+exit 0
+
+diff -urN gs-gpl-8.01.orig/src/gdevbbox.c gs-gpl-8.01/src/gdevbbox.c
+--- gs-gpl-8.01.orig/src/gdevbbox.c	2004-08-15 13:36:14.000000000 +0900
++++ gs-gpl-8.01/src/gdevbbox.c	2004-08-15 13:36:51.000000000 +0900
+@@ -222,7 +222,7 @@
+ 
+     if (tdev != 0)
+ 	gx_device_copy_params((gx_device *)bdev, tdev);
+-    if (remap_colors) {
++    if (remap_colors && bdev->is_open) {
+ 	bdev->black = gx_device_black((gx_device *)bdev);
+ 	bdev->white = gx_device_white((gx_device *)bdev);
+ 	bdev->transparent =

Added: ghostscript/trunk/debian/patches/08_big_cmap_post_table.dpatch
==============================================================================
--- (empty file)
+++ ghostscript/trunk/debian/patches/08_big_cmap_post_table.dpatch	Mon Sep 24 06:22:10 2007
@@ -0,0 +1,223 @@
+#! /bin/sh -e
+## 08_big_cmap_post_table.dpatch by Masayuki Hatta <mhatta at debian.org>
+##
+## All lines beginning with \`## DP:' are a description of the patch.
+## DP: Support big post table for cmap
+
+if [ $# -ne 1 ]; then
+    echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
+    exit 1
+fi
+case "$1" in
+        -patch) patch -f --no-backup-if-mismatch --dry-run -p1 < $0 && patch -f --no-backup-if-mismatch -p1 < $0
+;;
+        -unpatch) patch -f --no-backup-if-mismatch -R -p1 < $0;;
+        *)
+                echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
+                exit 1;;
+esac
+
+exit 0
+
+diff -urN gs-gpl-8.54.dfsg.1.orig/lib/gs_ttf.ps gs-gpl-8.54.dfsg.1/lib/gs_ttf.ps
+--- gs-gpl-8.54.dfsg.1.orig/lib/gs_ttf.ps	2006-10-15 17:58:21.000000000 +0900
++++ gs-gpl-8.54.dfsg.1/lib/gs_ttf.ps	2006-10-15 18:20:47.000000000 +0900
+@@ -273,6 +273,54 @@
+   } for pop exch pop
+ } bind def
+ 
++/.biglength { % <str>|<array of str> .biglength <integer>
++  dup type /arraytype eq { 0 exch { length add } forall } { length } ifelse
++} bind def
++
++/concats { % [str ...] concats str
++  () exch dup length 1 sub -1 0 {
++    1 index exch get dup type /stringtype ne { dup length string cvs } if
++    3 -1 roll exch dup length 2 index length add string
++    dup dup 4 2 roll copy length 4 -1 roll putinterval exch
++  } for pop
++} bind def
++
++% <str>|<array of str> <index> <count> .biggetinterval <str>|<array of str>
++/.biggetinterval {
++  3 dict begin
++  2 index type /arraytype eq {
++    /c exch def
++    /i exch def
++    [ exch {
++      dup length /l exch def
++      i c add l gt {
++        i l lt {
++          i l i sub getinterval
++          /c i c add l sub def
++          /i 0 def
++        } {
++          pop
++          /i i l sub def
++        } ifelse
++      } {
++        i c getinterval exit
++      } ifelse
++    } forall
++    ] dup .biglength 65535 le { concats } if
++  } { getinterval } ifelse
++  end
++} bind def
++
++% <str>|<array of str> <index> getu16 <integer>
++/.biggetu16 {
++  2 .biggetinterval 0 getu16
++} bind def
++
++% <str>|<array of str> <index> getu32 <integer>
++/.biggetu32 {
++  4 .biggetinterval 0 getu32
++} bind def
++
+ % Each procedure in this dictionary is called as follows:
+ %       <encodingtable> proc <glypharray>
+ /cmapformats mark
+@@ -363,14 +411,14 @@
+   } bind
+   4 {		% Microsoft/Adobe segmented mapping.
+     /etab exch def
+-    /nseg2 etab 6 getu16 def
+-    14 /endc etab 2 index nseg2 getinterval def
++    /nseg2 etab 6 .biggetu16 def
++    14 /endc etab 2 index nseg2 .biggetinterval def
+ 		% The Apple TrueType documentation omits the 2-byte
+ 		% 'reserved pad' that follows the endCount vector!
+     2 add
+-    nseg2 add /startc etab 2 index nseg2 getinterval def
+-    nseg2 add /iddelta etab 2 index nseg2 getinterval def
+-    nseg2 add /idroff etab 2 index nseg2 getinterval def
++    nseg2 add /startc etab 2 index nseg2 .biggetinterval def
++    nseg2 add /iddelta etab 2 index nseg2 .biggetinterval def
++    nseg2 add /idroff etab 2 index nseg2 .biggetinterval def
+ 		% The following hack allows us to properly handle
+ 		% idiosyncratic fonts that start at 0xf000:
+     pop
+@@ -382,8 +430,8 @@
+     /numcodes 0 def /glyphs 0 0 2 nseg2 3 sub {
+ 		% Stack: /glyphs numglyphs i2
+       /i2 exch def
+-      /scode startc i2 getu16 def
+-      /ecode endc i2 getu16 def
++      /scode startc i2 .biggetu16 def
++      /ecode endc i2 .biggetu16 def
+       numcodes scode firstcode sub
+ 		% Hack for fonts that have only 0x0000 and 0xf000 ranges
+       %dup 16#e000 ge { 255 and } if
+@@ -404,8 +452,8 @@
+     /numcodes 0 def /code 0 def
+     0 2 nseg2 3 sub {
+       /i2 exch def
+-      /scode startc i2 getu16 def
+-      /ecode endc i2 getu16 def
++      /scode startc i2 .biggetu16 def
++      /ecode endc i2 .biggetu16 def
+       numcodes scode firstcode sub
+ 		% Hack for fonts that have only 0x0000 and 0xf000 ranges
+       %dup 16#e000 ge { 255 and } if
+@@ -417,15 +465,15 @@
+ 	(scode=) print scode =only
+ 	( ecode=) print ecode =only
+ 	( delta=) print delta =only
+-	( droff=) print idroff i2 getu16 =
++	( droff=) print idroff i2 .biggetu16 =
+       } if
+-      idroff i2 getu16 dup 0 eq {
++      idroff i2 .biggetu16 dup 0 eq {
+ 	pop scode delta add 65535 and 1 ecode delta add 65535 and
+ 	{ putglyph } for
+       } {	% The +2 is for the 'reserved pad'.
+         /gloff exch 14 nseg2 3 mul add 2 add i2 add add def
+         0 1 ecode scode sub {
+-	  2 mul gloff add etab exch getu16
++	  2 mul gloff add etab exch .biggetu16
+ 	  dup 0 ne { delta add 65535 and } if putglyph
+ 	} for
+       } ifelse
+@@ -448,12 +496,12 @@
+ 
+ % <cmaptab> cmaparray <glypharray>
+ /cmaparray {
+-  dup 0 getu16 cmapformats exch .knownget {
++  dup 0 .biggetu16 cmapformats exch .knownget {
+     TTFDEBUG {
+-      (cmap: format ) print 1 index 0 getu16 = flush
++      (cmap: format ) print 1 index 0 .biggetu16 = flush
+     } if exec
+   } {
+-    (Can't handle format ) print 0 getu16 = flush
++    (Can't handle format ) print 0 .biggetu16 = flush
+     0 1 255 { } for 256 packedarray
+   } ifelse
+   TTFDEBUG {
+@@ -591,7 +639,7 @@
+ % Adobe requirement that each sfnts entry have even length.
+ /readtables mark
+ 	% Ordinary tables
+-  (cmap) //call.readtable
++  (cmap) //call.readbigtable
+   (head) 1 index
+   (hhea) 1 index
+   (maxp) 1 index
+@@ -964,10 +1012,21 @@
+   } ifelse
+ 		% Stack: ... /FontInfo mark key1 value1 ...
+   post null ne {
+-    /ItalicAngle first_post_string 4 gets32 65536.0 div
+-    /isFixedPitch first_post_string 12 getu32 0 ne
+-    /UnderlinePosition first_post_string 8 gets16 upem div
+-    /UnderlineThickness first_post_string 10 gets16 upem div
++     post type /arraytype eq {
++       % this post table is a big table. /post should be [(...) ...]
++       % data we actually need here should be first one in array.
++       /posttable post 1 get def
++     } {
++       /posttable post def
++     } ifelse
++%    /ItalicAngle first_post_string 4 gets32 65536.0 div
++%    /isFixedPitch first_post_string 12 getu32 0 ne
++%    /UnderlinePosition first_post_string 8 gets16 upem div
++%    /UnderlineThickness first_post_string 10 gets16 upem div
++     /ItalicAngle posttable 4 gets32 65536.0 div
++     /isFixedPitch posttable 12 getu32 0 ne
++     /UnderlinePosition posttable 8 gets16 upem div
++     /UnderlineThickness posttable 10 gets16 upem div
+   } if
+   counttomark 0 ne { .dicttomark } { pop pop } ifelse
+   /XUID [orgXUID 42 curxuid]
+@@ -1026,22 +1085,22 @@
+     } if
+     tabdict /cmap get                                   % bool [] i PlatID SpecID (cmap)
+     dup /cmaptab exch def % temporary
+-    0 1 2 index 2 getu16 1 sub {                         % bool [] i PlatID SpecID (cmap) j
+-      8 mul 4 add 1 index exch 8 getinterval             % bool [] i PlatID SpecID (cmap) (cmapsub)
++    0 1 2 index 2 .biggetu16 1 sub {                         % bool [] i PlatID SpecID (cmap) j
++      8 mul 4 add 1 index exch 8 .biggetinterval             % bool [] i PlatID SpecID (cmap) (cmapsub)
+       TTFDEBUG {
+-        (cmap: platform ) print dup 0 getu16 =only
+-        ( encoding ) print dup 2 getu16 = flush
++        (cmap: platform ) print dup 0 .biggetu16 =only
++        ( encoding ) print dup 2 .biggetu16 = flush
+       } if
+-      dup 0 getu16 4 index eq {
+-        dup 2 getu16 3 index eq {                        % bool [] i PlatID SpecID (cmap) (cmapsub)
++      dup 0 .biggetu16 4 index eq {
++        dup 2 .biggetu16 3 index eq {                        % bool [] i PlatID SpecID (cmap) (cmapsub)
+           TTFDEBUG {
+             (Choosen a cmap for platform=) print 3 index =only
+             ( encoding=) print 2 index =
+           } if
+           /cmapsub 1 index def
+-          dup 4 getu32                                   % bool [] i PlatID SpecID (cmap) (cmapsub) p
+-          cmaptab length 1 index sub                     % bool [] i PlatID SpecID (cmap) (cmapsub) p l
+-          cmaptab 3 1 roll getinterval
++          dup 4 .biggetu32                                   % bool [] i PlatID SpecID (cmap) (cmapsub) p
++          cmaptab .biglength 1 index sub                     % bool [] i PlatID SpecID (cmap) (cmapsub) p l
++          cmaptab 3 1 roll .biggetinterval
+           /cmaptab exch def                              % bool [] i PlatID SpecID (cmap) (cmapsub)
+           5 index 5 index 1 add get                      % bool [] i PlatID SpecID (cmap) (cmapsub) /Decoding
+           /Decoding exch def                             % bool [] i PlatID SpecID (cmap) (cmapsub)

Added: ghostscript/trunk/debian/patches/09_ijs_krgb_support.dpatch
==============================================================================
--- (empty file)
+++ ghostscript/trunk/debian/patches/09_ijs_krgb_support.dpatch	Mon Sep 24 06:22:10 2007
@@ -0,0 +1,753 @@
+#! /bin/sh -e
+## 09_ijs_krgb_support.dpatch by David Suffield <linux.deskjet at hp.com>
+##
+## All lines beginning with \`## DP:' are a description of the patch.
+## DP: Added KRGB colorspace support to gs IJS driver.
+## DP: Patch from HPLIP upstream, distributed in the hpijs package
+
+if [ $# -ne 1 ]; then
+    echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
+    exit 1
+fi
+case "$1" in
+        -patch) patch -f --no-backup-if-mismatch --dry-run -p1 < $0 && patch -f --no-backup-if-mismatch -p1 < $0 || exit 1
+;;
+        -unpatch) patch -R -f --no-backup-if-mismatch --dry-run -p1 < $0 && patch -f --no-backup-if-mismatch -R -p1 < $0 || exit 1
+;;
+        *)
+                echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
+                exit 1;;
+esac
+
+exit 0
+
+ at DPATCH@
+diff -uraN gs-orig/src/gdevijs.c gs-krgb/src/gdevijs.c
+--- gs-orig/src/gdevijs.c	2007-04-30 18:41:55.000000000 +0100
++++ gs-krgb/src/gdevijs.c	2007-04-30 18:46:28.000000000 +0100
+@@ -23,15 +23,50 @@
+  * which is a security risk, since any program can be run.
+  * You should use -dSAFER which sets .LockSafetyParams to true 
+  * before opening this device.
++ *
++ * 11/26/03 David Suffield (gdevijs-krgb-1.0.patch)
++ * (c) 2003-2004 Copyright Hewlett-Packard Development Company, LP
++ *
++ * 1. Removed hpijs 1.0-1.0.2 workarounds, use hpijs 1.0.3 or higher.
++ * 2. Added krgb support.
++ *
++ * 02/21/05 David Suffield (gdevijs-krgb-1.1.patch)
++ * 1. Fixed segfault issue with 1-bit color space.
++ * 2. Fixed z-order issue with colored text on black rectangle.
++ *
++ * 02/22/06 David Suffield (gdevijs-krgb-1.2.patch)
++ * 1. Fixed krgb buffer overflow issue with out-of-band data in fill_rectangle and copy_mono. 
++ *    This buffer overflow condition occurred with fullbleed print jobs that had k-band images.
++ * 2. Added Dan Coby (artifex) fix for gsijs_read_string_malloc gs_free *str memory leak.
++ *
++ * 06/02/06 David Suffield (gdevijs-krgb-1.3.patch)
++ * 1. Revisited the krgb buffer overflow issue with out-of-band data in fill_rectangle and 
++ *    copy_mono. Changed the fill_rectangle and copy_mono to an inner loop buffer check 
++ *    instead of a outer loop x/y extent check.
++ * 2. As requested by Ralph Giles, added K 1-bit and 8-bit support for krgb, but only 1-bit is 
++ *    implemented for now.
++ *
++ *    KRGB definition:
++ *    1. K=1-bit or 8-bit black plane, RGB=24 bit color raster.
++ *    2. K-plane will only contain objects that are black text and black line drawings.
++ *    3. RGB raster will not contain K-plane objects.
++ *    4. K resolution and RGB resolution will be equal.
++ *    5. K-plane will be byte aligned.
++ *    6. K-plane 1-bit definition; 1=black, 0=nothing (KRGB).
++ *    7. K-plane 8-bit definition; 255=black, 0=nothing (KxRGB).
++ *
+  */
+ 
+ #include "unistd_.h"	/* for dup() */
+ #include <stdlib.h>
++#include <fcntl.h>
+ #include "gdevprn.h"
+ #include "gp.h"
+ #include "ijs.h"
+ #include "ijs_client.h"
+ 
++//#define KRGB_DEBUG
++
+ /* This should go into gdevprn.h, or, better yet, gdevprn should
+    acquire an API for changing resolution. */
+ int gdev_prn_maybe_realloc_memory(gx_device_printer *pdev,
+@@ -49,6 +84,14 @@
+ private dev_proc_put_params(gsijs_put_params);
+ private dev_proc_finish_copydevice(gsijs_finish_copydevice);
+ 
++/* Following definitions are for krgb support. */
++private dev_proc_create_buf_device(gsijs_create_buf_device);
++private dev_proc_fill_rectangle(gsijs_fill_rectangle);
++private dev_proc_copy_mono(gsijs_copy_mono);
++private dev_proc_fill_mask(gsijs_fill_mask);
++private dev_proc_fill_path(gsijs_fill_path);
++private dev_proc_stroke_path(gsijs_stroke_path);
++
+ private const gx_device_procs gsijs_procs = {
+ 	gsijs_open,
+ 	NULL,	/* get_initial_matrix */
+@@ -123,6 +166,15 @@
+ 
+     IjsClientCtx *ctx;
+     int ijs_version;
++
++    /* Additional parameters for krgb support. */
++    int krgb_mode;     /* 0=false, 1=true */
++    int k_bits;        /* number of bits in k plane, 1 or 8 */
++    int k_path;        /* k plane path, 0=false, 1=true */
++    int k_width;       /* k plane width in pixels */
++    int k_band_size;   /* k plane buffer size in bytes, byte aligned */
++    unsigned char *k_band;  /* k plane buffer */
++    gx_device_procs prn_procs;  /* banding playback procedures */
+ };
+ 
+ #define DEFAULT_DPI 74   /* See gsijs_set_resolution() below. */
+@@ -150,7 +202,13 @@
+     FALSE,	/* Tumble_set */
+ 
+     NULL,	/* IjsClient *ctx */
+-    0		/* ijs_version */
++    0,		/* ijs_version */
++    0,          /* krgb_mode */
++    0,          /* k_bits */
++    0,          /* k_path */
++    0,          /* k_width */
++    0,          /* k_band_size */
++    NULL        /* k_band buffer */
+ };
+ 
+ 
+@@ -166,12 +224,299 @@
+ 
+ /**************************************************************************/
+ 
+-/* ------ Private definitions ------ */
++/* ---------------- Low-level graphic procedures ---------------- */
++
++static unsigned char xmask[] =
++{
++   0x80,    /* x=0 */
++   0x40,    /* 1 */
++   0x20,    /* 2 */
++   0x10,    /* 3 */
++   0x08,    /* 4 */
++   0x04,    /* 5 */
++   0x02,    /* 6 */
++   0x01     /* 7 */
++};
++
++private int gsijs_fill_rectangle(gx_device * dev, int x, int y, int w, int h,
++           gx_color_index color)
++{
++   gx_device_ijs *ijsdev = (gx_device_ijs *)((gx_device_forward *)dev)->target;
++
++   if (ijsdev && ijsdev->krgb_mode && ijsdev->k_path && y >= 0 && x >= 0) 
++   {
++      int raster = (ijsdev->k_width+7) >> 3;
++      register unsigned char *dest;
++      int dest_start_bit;
++      int band_height = ijsdev->k_band_size/raster;
++      int i,j;
++      unsigned char *beg = ijsdev->k_band;
++      unsigned char *end = ijsdev->k_band+ijsdev->k_band_size;
++      unsigned char *p;
++
++      if (h <= 0 || w <= 0)
++         return 0;
++
++      /* Check for out-of-band graphic. */
++      if (x >= ijsdev->k_width || y >= band_height)
++         return 0;  /* out-of-band */
++
++      dest_start_bit = x & 7;
++      dest=ijsdev->k_band+(raster*y)+(x >> 3);
++
++      /* Note x,y orgin 0,0 is stored first byte 0 left to right. */
++
++      if (color==0x0)
++      { 
++         /* Color is black, store in k plane band instead of regular band. */
++         for (j=0; j<h; j++)
++         {
++            for (i=0; i<w; i++)
++            {
++               p = &dest[(dest_start_bit+i)>>3];
++               if (p >= beg && p <= end)
++                  *p |= xmask[(dest_start_bit+i)&7];
++            }
++            dest+=raster;    
++         }
++         return 0;
++      }
++      else
++      {
++         /* Color is not black, remove any k plane bits for z-order dependencies, store in regular band. */
++         for (j=0; j<h; j++)
++         {
++            for (i=0; i<w; i++)
++            {
++               p = &dest[(dest_start_bit+i)>>3];
++               if (p >= beg && p <= end)
++                  *p &= ~xmask[(dest_start_bit+i)&7];
++            }
++            dest+=raster;    
++         }
++      }
++   }
++
++   return (*ijsdev->prn_procs.fill_rectangle)(dev, x, y, w, h, color);
++}
++
++private int gsijs_copy_mono(gx_device * dev, const byte * data,
++      int dx, int draster, gx_bitmap_id id,
++      int x, int y, int w, int height, gx_color_index zero, gx_color_index one)
++{
++   gx_device_ijs *ijsdev = (gx_device_ijs *)((gx_device_forward *)dev)->target;
++
++   //   if (ijsdev->krgb_mode && ijsdev->k_path && one==0x0) 
++   if (ijsdev && ijsdev->krgb_mode && ijsdev->k_path) 
++   {
++      /* Store in k plane band instead of regular band. */
++      int raster = (ijsdev->k_width+7) >> 3;       /* raster width in bytes, byte aligned */
++      register unsigned char *dest;
++      register const unsigned char *scan;
++      int dest_start_bit;
++      int scan_start_bit;
++      int band_height = ijsdev->k_band_size/raster;
++      int i,h=height;
++      unsigned char *beg = ijsdev->k_band;
++      unsigned char *end = ijsdev->k_band+ijsdev->k_band_size;
++      unsigned char *p;
++      
++      if (h <= 0 || w <= 0)
++         return 0;
++
++      /* Check for out-of-band graphic. */
++      if (x >= ijsdev->k_width || y >= band_height)
++         return 0;  /* out-of-band */
++
++      scan=data+(dx >> 3);
++      dest_start_bit = x & 7;
++      scan_start_bit = dx & 7;
++      dest=ijsdev->k_band+(raster*y)+(x >> 3);
++
++      if (one==0x0)
++      {
++         /* Color is black, store in k plane band instead of regular band. */
++         while (h-- > 0)
++         {
++            for (i=0; i<w; i++)
++            {
++               if (scan[(scan_start_bit+i)>>3] & xmask[(scan_start_bit+i)&7])
++               {
++                  p = &dest[(dest_start_bit+i)>>3];
++                  if (p >= beg && p <= end)
++                     *p |= xmask[(dest_start_bit+i)&7];
++               }
++            }
++            scan+=draster;
++            dest+=raster;
++         }
++         return 0;
++      }
++      else
++      {
++         /* Color is not black, remove any k plane bits for z-order dependencies, store in regular band. */
++         while (h-- > 0)
++         {
++            for (i=0; i<w; i++)
++            {
++               if (scan[(scan_start_bit+i)>>3] & xmask[(scan_start_bit+i)&7])
++               {
++                  p = &dest[(dest_start_bit+i)>>3];
++                  if (p >= beg && p <= end)
++                     *p &= ~xmask[(dest_start_bit+i)&7];
++               }
++            }
++            scan+=draster;
++            dest+=raster;
++         }
++      }   
++   }
++
++   return (*ijsdev->prn_procs.copy_mono)(dev, data, dx, draster, id, x, y, w, height, zero, one);
++}
++
++/* ---------------- High-level graphic procedures ---------------- */
++
++private int gsijs_fill_mask(gx_device * dev,
++      const byte * data, int dx, int raster, gx_bitmap_id id,
++      int x, int y, int w, int h,
++      const gx_drawing_color * pdcolor, int depth,
++      gs_logical_operation_t lop, const gx_clip_path * pcpath)
++{
++   gx_device_ijs *ijsdev = (gx_device_ijs *)((gx_device_forward *)dev)->target;
++   int code;
++
++   ijsdev->k_path = 1;
++
++   code = (*ijsdev->prn_procs.fill_mask)(dev, data, dx, raster, id, x, y, w, h, pdcolor, depth, lop, pcpath);
+ 
+-/* Versions 1.0 through 1.0.2 of hpijs report IJS version 0.29, and
+-   require some workarounds. When more up-to-date hpijs versions
+-   become ubiquitous, all these workarounds should be removed. */
+-#define HPIJS_1_0_VERSION 29
++   ijsdev->k_path = 0;
++
++   return code;
++}
++
++private int gsijs_fill_path(gx_device * dev, const gs_imager_state * pis,
++      gx_path * ppath, const gx_fill_params * params,
++      const gx_drawing_color * pdcolor,
++      const gx_clip_path * pcpath)
++{
++   gx_device_ijs *ijsdev = (gx_device_ijs *)((gx_device_forward *)dev)->target;
++   int code;
++
++   ijsdev->k_path = 1;
++
++   code = (*ijsdev->prn_procs.fill_path)(dev, pis, ppath, params, pdcolor, pcpath);
++
++   ijsdev->k_path = 0;
++
++   return 0;
++}
++
++private int gsijs_stroke_path(gx_device * dev, const gs_imager_state * pis,
++        gx_path * ppath, const gx_stroke_params * params,
++        const gx_drawing_color * pdcolor,
++        const gx_clip_path * pcpath)
++{
++   gx_device_ijs *ijsdev = (gx_device_ijs *)((gx_device_forward *)dev)->target;
++   int code;
++
++   ijsdev->k_path = 1;
++
++   code = (*ijsdev->prn_procs.stroke_path)(dev, pis, ppath, params, pdcolor, pcpath);
++
++   ijsdev->k_path = 0;
++
++   return code;
++}
++
++/* ---------------- krgb banding playback procedures ---------------- */
++
++private int gsijs_get_bits(gx_device_printer * pdev, int y, byte * str, byte ** actual_data)
++{
++   gx_device_ijs *ijsdev = (gx_device_ijs *)pdev;
++   gx_device_clist_common *cdev = (gx_device_clist_common *)pdev;
++   int band_height = cdev->page_info.band_params.BandHeight;
++   int band_number = y/band_height;
++   int raster = (ijsdev->k_width+7) >> 3;       /* raster width in bytes, byte aligned */
++   int y1=raster*(y-(band_height*band_number));
++ 
++   if (y1 == 0)
++   {
++      /* First raster for band, clear k_band. Banding playback occurs on first raster. */
++      memset(ijsdev->k_band, 0, ijsdev->k_band_size); 
++   }
++
++   return gdev_prn_get_bits(pdev, y, str, actual_data);  /* get raster from regular band */
++}
++
++private int gsijs_k_get_bits(gx_device_printer * pdev, int y, byte ** actual_data)
++{
++   gx_device_ijs *ijsdev = (gx_device_ijs *)pdev;
++   gx_device_clist_common *cdev = (gx_device_clist_common *)pdev;
++   int band_height = cdev->page_info.band_params.BandHeight;
++   int band_number = y/band_height;
++   int raster = (ijsdev->k_width+7) >> 3;       /* raster width in bytes, byte aligned */
++   int y1=raster*(y-(band_height*band_number));
++ 
++   *actual_data = ijsdev->k_band+y1;
++
++   return 0;
++}
++
++private int gsijs_create_buf_device(gx_device **pbdev, gx_device *target,
++            const gx_render_plane_t *render_plane, gs_memory_t *mem, gx_band_complexity_t *band_complexity)
++{
++   gx_device_ijs *ijsdev = (gx_device_ijs *)target;
++   int n_chan = ijsdev->color_info.num_components;
++   int code = gx_default_create_buf_device(pbdev, target, render_plane, mem, band_complexity);
++   if (code < 0 || n_chan != 3)
++      return code;
++
++   /* Save buffer (vector) procedures so that we can hook them during banding playback. */
++   ijsdev->prn_procs = (*pbdev)->procs;
++
++   /* Replace buffer procedures with krgb procedures. */
++   set_dev_proc(*pbdev, fill_rectangle, gsijs_fill_rectangle);
++   set_dev_proc(*pbdev, copy_mono, gsijs_copy_mono);
++   set_dev_proc(*pbdev, fill_mask, gsijs_fill_mask);
++   set_dev_proc(*pbdev, fill_path, gsijs_fill_path);
++   set_dev_proc(*pbdev, stroke_path, gsijs_stroke_path);
++
++   return code;
++}
++
++/* See if IJS server supports krgb. */
++private int
++gsijs_set_krgb_mode(gx_device_ijs *ijsdev)
++{
++    char buf[256];
++    int n_chan = ijsdev->color_info.num_components;
++    int code;
++
++    ijsdev->krgb_mode = 0;  /* default is no krgb */
++
++    if (n_chan != 3)
++        return 0;    /* no krgb support, not RGB colorspace */
++
++    buf[0] = 0;
++    code = ijs_client_enum_param(ijsdev->ctx, 0, "ColorSpace", buf, sizeof(buf)-1);
++    if (code >= 0)
++        buf[code] = 0;
++    if (strstr(buf, "KRGB") != NULL)
++    {
++        ijsdev->krgb_mode = 1;     /* yes KRGB is supported */
++        ijsdev->k_bits = 1;        /* KRGB = 1x8x8x8 */ 
++    }
++    else if (strstr(buf, "KxRGB") != NULL)
++    {
++        ijsdev->krgb_mode = 1;    /* yes KRGB is supported */
++        ijsdev->k_bits = 8;       /* KRGB = 8x8x8x8 */
++    }
++
++    return 0; 
++}
++
++/* ------ Private definitions ------ */
+ 
+ private int
+ gsijs_parse_wxh (const char *val, int size, double *pw, double *ph)
+@@ -209,34 +554,6 @@
+ }
+ 
+ /**
+- * gsijs_set_generic_params_hpijs: Set generic IJS parameters.
+- *
+- * This version is specialized for hpijs 1.0 through 1.0.2, and
+- * accommodates a number of quirks.
+- **/
+-private int
+-gsijs_set_generic_params_hpijs(gx_device_ijs *ijsdev)
+-{
+-    char buf[256];
+-    int code = 0;
+-
+-    /* IjsParams, Duplex, and Tumble get set at this point because
+-       they may affect margins. */
+-    if (ijsdev->IjsParams) {
+-	code = gsijs_client_set_param(ijsdev, "IjsParams", ijsdev->IjsParams);
+-    }
+-
+-    if (code == 0 && ijsdev->Duplex_set) {
+-	int duplex_val;
+-	
+-	duplex_val = ijsdev->Duplex ? (ijsdev->IjsTumble ? 1 : 2) : 0;
+-	sprintf (buf, "%d", duplex_val);
+-	code = gsijs_client_set_param(ijsdev, "Duplex", buf);
+-    }
+-    return code;
+-}
+-
+-/**
+  * gsijs_set_generic_params: Set generic IJS parameters.
+  **/
+ private int
+@@ -247,9 +564,6 @@
+     int i, j;
+     char *value;
+ 
+-    if (ijsdev->ijs_version == HPIJS_1_0_VERSION)
+-	return gsijs_set_generic_params_hpijs(ijsdev);
+-
+     /* Split IjsParams into separate parameters and send to ijs server */
+     value = NULL;
+     for (i=0, j=0; (j < ijsdev->IjsParams_size) && (i < sizeof(buf)-1); j++) {
+@@ -290,68 +604,6 @@
+ }
+ 
+ /**
+- * gsijs_set_margin_params_hpijs: Do margin negotiation with IJS server.
+- *
+- * This version is specialized for hpijs 1.0 through 1.0.2, and
+- * accommodates a number of quirks.
+- **/
+-private int
+-gsijs_set_margin_params_hpijs(gx_device_ijs *ijsdev)
+-{
+-    char buf[256];
+-    int code = 0;
+-
+-    if (code == 0) {
+-	sprintf(buf, "%d", ijsdev->width);
+-	code = gsijs_client_set_param(ijsdev, "Width", buf);
+-    }
+-    if (code == 0) {
+-	sprintf(buf, "%d", ijsdev->height);
+-	code = gsijs_client_set_param(ijsdev, "Height", buf);
+-    }
+-
+-    if (code == 0) {
+-	double printable_width, printable_height;
+-	double printable_left, printable_top;
+-	float m[4];
+-
+-	code = ijs_client_get_param(ijsdev->ctx, 0, "PrintableArea",
+-				   buf, sizeof(buf));
+-	if (code == IJS_EUNKPARAM)
+-	    /* IJS server doesn't support margin negotiations.
+-	       That's ok. */
+-	    return 0;
+-	else if (code >= 0) {
+-	    code = gsijs_parse_wxh(buf, code,
+-				    &printable_width, &printable_height);
+-	}
+-
+-	if (code == 0) {
+-	    code = ijs_client_get_param(ijsdev->ctx, 0, "PrintableTopLeft",
+-					buf, sizeof(buf));
+-	    if (code == IJS_EUNKPARAM)
+-		return 0;
+-	    else if (code >= 0) {
+-		code = gsijs_parse_wxh(buf, code,
+-					&printable_left, &printable_top);
+-	    }
+-	}
+-
+-	if (code == 0) {
+-	    m[0] = printable_left;
+-	    m[1] = ijsdev->MediaSize[1] * (1.0 / 72) -
+-	      printable_top - printable_height;
+-	    m[2] = ijsdev->MediaSize[0] * (1.0 / 72) -
+-	      printable_left - printable_width;
+-	    m[3] = printable_top;
+-	    gx_device_set_margins((gx_device *)ijsdev, m, true);
+-	}
+-    }
+-
+-    return code;
+-}
+-
+-/**
+  * gsijs_set_margin_params: Do margin negotiation with IJS server.
+  **/
+ private int
+@@ -362,9 +614,6 @@
+     int i, j;
+     char *value;
+ 
+-    if (ijsdev->ijs_version == HPIJS_1_0_VERSION)
+-	return gsijs_set_margin_params_hpijs(ijsdev);
+-
+     /* Split IjsParams into separate parameters and send to ijs server */
+     value = NULL;
+     for (i=0, j=0; (j < ijsdev->IjsParams_size) && (i < sizeof(buf)-1); j++) {
+@@ -531,12 +780,18 @@
+     char buf[256];
+     bool use_outputfd;
+     int fd = -1;
++    long max_bitmap = ijsdev->space_params.MaxBitmap;
+ 
+     if (strlen(ijsdev->IjsServer) == 0) {
+ 	eprintf("ijs server not specified\n");
+ 	return gs_note_error(gs_error_ioerror);
+     }
+ 
++    ijsdev->space_params.MaxBitmap = 0;	/* force banding */
++
++    /* Set create_buf_device in printer device, so that we can hook the banding playback procedures. */
++    ijsdev->printer_procs.buf_procs.create_buf_device = gsijs_create_buf_device;
++
+     /* Decide whether to use OutputFile or OutputFD. Note: how to
+        determine this is a tricky question, so we just allow the
+        user to set it.
+@@ -551,6 +806,8 @@
+     if (code < 0)
+ 	return code;
+ 
++    ijsdev->space_params.MaxBitmap = max_bitmap;
++    
+     if (use_outputfd) {
+ 	/* Note: dup() may not be portable to all interesting IJS
+ 	   platforms. In that case, this branch should be #ifdef'ed out.
+@@ -610,6 +867,9 @@
+     if (code >= 0)
+ 	code = gsijs_set_margin_params(ijsdev);
+ 
++    if (code >= 0)
++        code = gsijs_set_krgb_mode(ijsdev);
++
+     return code;
+ }
+ 
+@@ -690,21 +950,6 @@
+     return min(width, end);
+ }
+ 
+-private int ijs_all_white(unsigned char *data, int size)
+-{
+-   int clean = 1;
+-   int i;
+-   for (i = 0; i < size; i++)
+-   {
+-     if (data[i] != 0xFF)
+-     {
+-        clean = 0;
+-        break;
+-     }
+-   }
+-   return clean;
+-}
+-
+ /* Print a page.  Don't use normal printer gdev_prn_output_page 
+  * because it opens the output file.
+  */
+@@ -715,8 +960,10 @@
+     gx_device_printer *pdev = (gx_device_printer *)dev;
+     int raster = gdev_prn_raster(pdev);
+     int ijs_width, ijs_height;
+-    int row_bytes;
++    int row_bytes, k_row_bytes=0;
+     int n_chan = pdev->color_info.num_components;
++    int krgb_mode = ijsdev->krgb_mode;
++    int k_bits = ijsdev->k_bits;
+     unsigned char *data;
+     char buf[256];
+     double xres = pdev->HWResolution[0];
+@@ -732,13 +979,23 @@
+ 
+     /* Determine bitmap width and height */
+     ijs_height = gdev_prn_print_scan_lines(dev);
+-    if (ijsdev->ijs_version == HPIJS_1_0_VERSION) {
+-	ijs_width = pdev->width;
+-    } else {
+ 	ijs_width = gsijs_raster_width(dev);
+-    }
++
+     row_bytes = (ijs_width * pdev->color_info.depth + 7) >> 3;
+ 
++    if (krgb_mode)
++    {
++        gx_device_clist_common *cdev = (gx_device_clist_common *)dev;
++        int band_height = cdev->page_info.band_params.BandHeight;
++        k_row_bytes = (ijs_width + 7) >> 3;
++
++        /* Create banding buffer for k plane. */
++        ijsdev->k_width = ijs_width;
++        ijsdev->k_band_size = band_height * k_row_bytes;   
++        if ((ijsdev->k_band = gs_malloc(pdev->memory, ijsdev->k_band_size, 1, "gsijs_output_page")) == (unsigned char *)NULL)
++           return gs_note_error(gs_error_VMerror);
++    }
++
+     /* Required page parameters */
+     sprintf(buf, "%d", n_chan);
+     gsijs_client_set_param(ijsdev, "NumChan", buf);
+@@ -747,44 +1004,71 @@
+ 
+     /* This needs to become more sophisticated for DeviceN. */
+     strcpy(buf, (n_chan == 4) ? "DeviceCMYK" : 
+-	((n_chan == 3) ? "DeviceRGB" : "DeviceGray"));
++	((n_chan == 3) ? (krgb_mode ? ((k_bits == 1) ? "KRGB" : "KxRGB") : "DeviceRGB") : "DeviceGray"));
+     gsijs_client_set_param(ijsdev, "ColorSpace", buf);
+ 
+-    /* If hpijs 1.0, don't set width and height here, because it
+-       expects them to be the paper size. */
+-    if (ijsdev->ijs_version != HPIJS_1_0_VERSION) {
+-	sprintf(buf, "%d", ijs_width);
+-	gsijs_client_set_param(ijsdev, "Width", buf);
+-	sprintf(buf, "%d", ijs_height);
+-	gsijs_client_set_param(ijsdev, "Height", buf);
+-    }
++    sprintf(buf, "%d", ijs_width);
++    gsijs_client_set_param(ijsdev, "Width", buf);
++    sprintf(buf, "%d", ijs_height);
++    gsijs_client_set_param(ijsdev, "Height", buf);
+ 
+     sprintf(buf, "%gx%g", xres, yres);
+     gsijs_client_set_param(ijsdev, "Dpi", buf);
+ 
++#ifdef KRGB_DEBUG
++    int kfd, rgbfd;
++    char sz[128];
++    kfd = open("/tmp/k.pbm", O_CREAT | O_TRUNC | O_RDWR, 0644);
++    rgbfd = open("/tmp/rgb.ppm", O_CREAT | O_TRUNC | O_RDWR, 0644);
++    snprintf(sz, sizeof(sz), "P4\n#gdevijs test\n%d\n%d\n", ijs_width, ijs_height);
++    write(kfd, sz, strlen(sz));
++    snprintf(sz, sizeof(sz), "P6\n#gdevijs test\n%d\n%d\n255\n", ijs_width, ijs_height);
++    write(rgbfd, sz, strlen(sz));
++#endif
++
+     for (i=0; i<num_copies; i++) {
+  	unsigned char *actual_data;
+ 	ijs_client_begin_cmd (ijsdev->ctx, IJS_CMD_BEGIN_PAGE);
+ 	status = ijs_client_send_cmd_wait(ijsdev->ctx);
+ 
+ 	for (y = 0; y < ijs_height; y++) {
+-	    code = gdev_prn_get_bits(pdev, y, data, &actual_data);
+-	    if (code < 0)
+-		break;
++            if (krgb_mode)
++                code = gsijs_get_bits(pdev, y, data, &actual_data);
++            else
++                code = gdev_prn_get_bits(pdev, y, data, &actual_data);
++            if (code < 0)
++                break;
++#ifdef KRGB_DEBUG
++            write(rgbfd, actual_data, row_bytes);
++#endif
++            status = ijs_client_send_data_wait(ijsdev->ctx, 0, (char *)actual_data, row_bytes);
++            if (status)
++                break;
+ 
+-	    if (ijsdev->ijs_version == HPIJS_1_0_VERSION &&
+-		ijs_all_white(actual_data, row_bytes))
+-		status = ijs_client_send_data_wait(ijsdev->ctx, 0, NULL, 0);
+-	    else
+-		status = ijs_client_send_data_wait(ijsdev->ctx, 0,
+-		    (char *)actual_data, row_bytes);
+-	    if (status)
+-		break;
++            if (krgb_mode) {
++                code = gsijs_k_get_bits(pdev, y, &actual_data);
++                if (code < 0)
++                    break;
++#ifdef KRGB_DEBUG
++                write(kfd, actual_data, k_row_bytes);
++#endif
++                status = ijs_client_send_data_wait(ijsdev->ctx, 0, (char *)actual_data, k_row_bytes);
++                if (status)
++                    break;
++	    }
+ 	}
+ 	ijs_client_begin_cmd(ijsdev->ctx, IJS_CMD_END_PAGE);
+ 	status = ijs_client_send_cmd_wait(ijsdev->ctx);
+     }
+ 
++#ifdef KRGB_DEBUG
++    close(kfd);
++    close(rgbfd);
++#endif
++
++    if(krgb_mode)
++        gs_free(pdev->memory, ijsdev->k_band, ijsdev->k_band_size, 1, "gsijs_output_page");
++
+     gs_free_object(pdev->memory, data, "gsijs_output_page");
+ 
+     endcode = (pdev->buffer_space && !pdev->is_async_renderer ?
+@@ -1090,7 +1374,6 @@
+ 	dprintf2("ijs: Can't set parameter %s=%s\n", key, value);
+     return code;
+ }
+- 
+ 
+ private int
+ gsijs_set_color_format(gx_device_ijs *ijsdev)

Added: ghostscript/trunk/debian/patches/10_epsn_margin_workaround.dpatch
==============================================================================
--- (empty file)
+++ ghostscript/trunk/debian/patches/10_epsn_margin_workaround.dpatch	Mon Sep 24 06:22:10 2007
@@ -0,0 +1,33 @@
+#! /bin/sh -e
+## 10_epsn_margin_workaround.dpatch by Masayuki Hatta <mhatta at debian.org>
+##
+## All lines beginning with \`## DP:' are a description of the patch.
+## DP: Adjust the margins for Epson drivers
+
+if [ $# -ne 1 ]; then
+    echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
+    exit 1
+fi
+case "$1" in
+        -patch) patch -f --no-backup-if-mismatch --dry-run -p1 < $0 && patch -f --no-backup-if-mismatch -p1 < $0
+;;
+        -unpatch) patch -f --no-backup-if-mismatch -R -p1 < $0;;
+        *)
+                echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
+                exit 1;;
+esac
+
+exit 0
+
+diff -urN gs-gpl-8.01.orig/src/gdevepsn.c gs-gpl-8.01/src/gdevepsn.c
+--- gs-gpl-8.01.orig/src/gdevepsn.c	2004-08-15 15:26:08.000000000 +0900
++++ gs-gpl-8.01/src/gdevepsn.c	2004-08-15 15:26:54.000000000 +0900
+@@ -105,7 +105,7 @@
+   prn_device(prn_std_procs, "epson",
+ 	DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
+ 	X_DPI, Y_DPI,
+-	0.2, 0.0, 0.0, 0.0,			/* margins */
++	0.25, 0.02, 0.25, 0.4,			/* margins */
+ 	1, epson_print_page);
+ 
+ /* Mid-res (interleaved, 1 pass per line) 9-pin device */

Added: ghostscript/trunk/debian/patches/11_brother_7x0_gdi_fix.dpatch
==============================================================================
--- (empty file)
+++ ghostscript/trunk/debian/patches/11_brother_7x0_gdi_fix.dpatch	Mon Sep 24 06:22:10 2007
@@ -0,0 +1,32 @@
+#! /bin/sh -e
+## 11_brother_7x0_fix.dpatch by Masayuki Hatta <mhatta at debian.org>
+##
+## All lines beginning with \`## DP:' are a description of the patch.
+## DP: Fix a problem with Brother 7x0 GDI, suggested by B. Janssen.
+
+if [ $# -ne 1 ]; then
+    echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
+    exit 1
+fi
+case "$1" in
+        -patch) patch -f --no-backup-if-mismatch --dry-run -p1 < $0 && patch -f --no-backup-if-mismatch -p1 < $0
+;;
+        -unpatch) patch -f --no-backup-if-mismatch -R -p1 < $0;;
+        *)
+                echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
+                exit 1;;
+esac
+
+exit 0
+
+diff -urN gs-gpl-8.01.orig/src/gdevhl7x.c gs-gpl-8.01/src/gdevhl7x.c
+--- gs-gpl-8.01.orig/src/gdevhl7x.c	2004-08-15 13:18:12.000000000 +0900
++++ gs-gpl-8.01/src/gdevhl7x.c	2004-08-15 13:19:29.000000000 +0900
+@@ -83,6 +83,7 @@
+ 
+  */
+ 
++#define USE_POSSIBLY_FLAWED_COMPRESSION 1
+ 
+ /* Type definitions */
+ typedef struct {

Added: ghostscript/trunk/debian/patches/12_ghostscript_man_fix.dpatch
==============================================================================
--- (empty file)
+++ ghostscript/trunk/debian/patches/12_ghostscript_man_fix.dpatch	Mon Sep 24 06:22:10 2007
@@ -0,0 +1,42 @@
+#! /bin/sh -e
+## 12_gs-gpl_man_fix.dpatch by Masayuki Hatta <mhatta at debian.org>
+##
+## All lines beginning with \`## DP:' are a description of the patch.
+## DP: Typo fixes for gs-gpl.1
+
+if [ $# -ne 1 ]; then
+    echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
+    exit 1
+fi
+case "$1" in
+        -patch) patch -f --no-backup-if-mismatch --dry-run -p1 < $0 && patch -f --no-backup-if-mismatch -p1 < $0
+;;
+        -unpatch) patch -f --no-backup-if-mismatch -R -p1 < $0;;
+        *)
+                echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
+                exit 1;;
+esac
+
+exit 0
+
+diff -urN gs-gpl-8.56.dfsg.1.orig/man/gs.1 gs-gpl-8.56.dfsg.1/man/gs.1
+--- gs-gpl-8.56.dfsg.1.orig/man/gs.1	2007-05-05 01:02:15.000000000 +0900
++++ gs-gpl-8.56.dfsg.1/man/gs.1	2007-05-05 01:03:55.000000000 +0900
+@@ -27,7 +27,7 @@
+ (such as Control-C at the keyboard).
+ .PP
+ The interpreter recognizes many option switches, some of which are described
+-below. Please see the usage documenation for complete information. Switches
++below. Please see the usage documentation for complete information. Switches
+ may appear anywhere in the command line and apply to all files thereafter.
+ Invoking Ghostscript with the \fB\-h\fR or \fB\-?\fR switch produces a
+ message which shows several useful switches, all the devices known to
+@@ -154,7 +154,7 @@
+ 	-sPAPERSIZE=legal
+ .fi
+ .PP
+-Most ISO and US paper sizes are recognized. See the usage documenatation for
++Most ISO and US paper sizes are recognized. See the usage documentation for
+ a full list, or the definitions in the initialization file "gs_statd.ps".
+ .PP
+ Ghostscript can do many things other than print or view PostScript and

Added: ghostscript/trunk/debian/patches/13_ghostscript_man_fix_debian.dpatch
==============================================================================
--- (empty file)
+++ ghostscript/trunk/debian/patches/13_ghostscript_man_fix_debian.dpatch	Mon Sep 24 06:22:10 2007
@@ -0,0 +1,59 @@
+#! /bin/sh -e
+## 13_gs-gpl_man_fix_debian.dpatch by Masayuki Hatta <mhatta at debian.org>
+##
+## All lines beginning with \`## DP:' are a description of the patch.
+## DP: Fixes for gs-gpl.1 (Debian specific path adjustments)
+
+if [ $# -ne 1 ]; then
+    echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
+    exit 1
+fi
+case "$1" in
+        -patch) patch -f --no-backup-if-mismatch --dry-run -p1 < $0 && patch -f --no-backup-if-mismatch -p1 < $0
+;;
+        -unpatch) patch -f --no-backup-if-mismatch -R -p1 < $0;;
+        *)
+                echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
+                exit 1;;
+esac
+
+exit 0
+
+diff -urN gs-gpl-8.56.dfsg.1.orig/man/gs.1 gs-gpl-8.56.dfsg.1/man/gs.1
+--- gs-gpl-8.56.dfsg.1.orig/man/gs.1	2007-05-05 01:09:16.000000000 +0900
++++ gs-gpl-8.56.dfsg.1/man/gs.1	2007-05-05 01:09:51.000000000 +0900
+@@ -295,18 +295,18 @@
+ are typically based in \fBC:\\GS\fR, but may be elsewhere, especially if
+ you install Ghostscript with \fBGSview\fR.  Run "\fBgs -h\fR" to find the
+ location of Ghostscript documentation on your system, from which you can
+-get more details.
++get more details. On a Debian system they are in \fB/usr\fR.
+ .TP
+-.B /usr/local/share/ghostscript/#.##/*
++.B /usr/share/gs-gpl/#.##/*/*
+ Startup files, utilities, and basic font definitions
+ .TP
+-.B /usr/local/share/ghostscript/fonts/*
+-More font definitions
++.B /usr/share/fonts/type1/gsfonts/*
++More font definitions from the gsfonts package
+ .TP
+-.B /usr/local/share/ghostscript/#.##/examples/*
++.B /usr/share/doc/gs-gpl/examples/*
+ Ghostscript demonstration files
+ .TP
+-.B /usr/local/share/ghostscript/#.##/doc/*
++.B /usr/share/doc/gs-gpl/*
+ Diverse document files
+ .SH "INITIALIZATION FILES"
+ When looking for the initialization files "gs_*.ps", the files related to
+@@ -330,7 +330,8 @@
+ Ghostscript makefile when the executable was built.  When \fBgs\fR is built
+ on Unix, \fBGS_LIB_DEFAULT\fR is usually
+ "/usr/local/share/ghostscript/#.##:/usr/local/share/ghostscript/fonts"
+-where "#.##" represents the Ghostscript version number.
++where "#.##" represents the Ghostscript version number. They are
++"/usr/share/gs-gpl/#.## on a Debian system".
+ .PP
+ Each of these (\fBGS_LIB_DEFAULT\fR, \fBGS_LIB\fR, and \fB\-I\fR parameter)
+ may be either a single directory or a list of directories separated by

Added: ghostscript/trunk/debian/patches/14_toolbin_insecure_tmp_usage_fix.dpatch
==============================================================================
--- (empty file)
+++ ghostscript/trunk/debian/patches/14_toolbin_insecure_tmp_usage_fix.dpatch	Mon Sep 24 06:22:10 2007
@@ -0,0 +1,269 @@
+#! /bin/sh -e
+## 14_toolbin_insecure_tmp_usage_fix.dpatch by Masayuki Hatta <mhatta at debian.org>
+##
+## All lines beginning with \`## DP:' are a description of the patch.
+## DP: Fixes insecure /tmp usage in toolbin scripts (CAN-2005-2352)
+
+if [ $# -ne 1 ]; then
+    echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
+    exit 1
+fi
+case "$1" in
+        -patch) patch -f --no-backup-if-mismatch --dry-run -p1 < $0 && patch -f --no-backup-if-mismatch -p1 < $0
+;;
+        -unpatch) patch -f --no-backup-if-mismatch -R -p1 < $0;;
+        *)
+                echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
+                exit 1;;
+esac
+
+exit 0
+
+diff -urN gs-gpl-8.56.dfsg.1.orig/toolbin/3way.tcl gs-gpl-8.56.dfsg.1/toolbin/3way.tcl
+--- gs-gpl-8.56.dfsg.1.orig/toolbin/3way.tcl	2007-05-05 01:18:57.000000000 +0900
++++ gs-gpl-8.56.dfsg.1/toolbin/3way.tcl	2007-05-05 01:20:39.000000000 +0900
+@@ -25,7 +25,29 @@
+ # produces a report for merging the olddir/branchdir changes into maindir.
+ 
+ proc filesame {f1 f2} {
+-    set t /tmp/t
++    # There is no Tcl builtin for temporary files
++    # This is taken from http://wiki.tcl.tk/772
++    switch $tcl_platform(platform) {
++	unix {
++		set tmpdir /tmp   # or even $::env(TMPDIR), at times.
++	} macintosh {
++		set tmpdir $::env(TRASH_FOLDER)  ;# a better place?
++	} default {
++		set tmpdir [pwd]
++			catch {set tmpdir $::env(TMP)}
++		catch {set tmpdir $::env(TEMP)}
++	}
++    }
++    set t [file join $tmpdir [pid]]
++    set access [list RDWR CREAT EXCL TRUNC]
++    set perm 0600
++    if {[catch {open $t $access $perm} fid ]} {
++        # something went wrong
++        error "Could not open tempfile."
++     }
++    if {[catch {close $t} err]} {
++         error "Failed closing temporary file: $err"
++    }
+     if {![catch {exec diff $f1 $f2 > $t}]} {
+ 	return 1
+     }
+@@ -50,6 +72,9 @@
+ 	break
+     }
+     close $in
++    if {![catch {exec rm $t}]} {
++         error "Failed removing temporary file"
++    }
+     return $same
+ }
+ 
+diff -urN gs-gpl-8.56.dfsg.1.orig/toolbin/gsindent gs-gpl-8.56.dfsg.1/toolbin/gsindent
+--- gs-gpl-8.56.dfsg.1.orig/toolbin/gsindent	2007-05-05 01:18:57.000000000 +0900
++++ gs-gpl-8.56.dfsg.1/toolbin/gsindent	2007-05-05 01:22:08.000000000 +0900
+@@ -21,12 +21,13 @@
+ # The perl invocations work around a bug in GNU indent.
+ 
+ if [ $# -ne 0 ]; then
++    tempfile=`mktemp -t || tempfile` || { echo "$0: Cannot create temporary file" >&2; exit 1; }
+     for f in $*
+     do
+-	$0 < $f > /tmp/$$
++	$0 < $f > $tempfile
+ 	cp -p $f $f.bak
+ 	if ( test ! -e $f~ ) then cp -p $f $f~; fi
+-	mv /tmp/$$ $f
++	mv $tempfile $f
+     done
+     exit
+ fi
+diff -urN gs-gpl-8.56.dfsg.1.orig/toolbin/gssubst gs-gpl-8.56.dfsg.1/toolbin/gssubst
+--- gs-gpl-8.56.dfsg.1.orig/toolbin/gssubst	2007-05-05 01:18:57.000000000 +0900
++++ gs-gpl-8.56.dfsg.1/toolbin/gssubst	2007-05-05 01:23:06.000000000 +0900
+@@ -35,7 +35,27 @@
+ }
+ puts "$from => $to"
+ flush stdout
+-set tmp /tmp/[pid]
++switch $tcl_platform(platform) {
++	unix {
++		set tmpdir /tmp   # or even $::env(TMPDIR), at times.
++	} macintosh {
++		set tmpdir $::env(TRASH_FOLDER)  ;# a better place?
++	} default {
++		set tmpdir [pwd]
++			catch {set tmpdir $::env(TMP)}
++		catch {set tmpdir $::env(TEMP)}
++	}
++}
++set tmp [file join $tmpdir [pid]]
++set access [list RDWR CREAT EXCL TRUNC]
++set perm 0600
++if {[catch {open $tmp $access $perm} fid ]} {
++# something went wrong
++	error "Could not open tempfile."
++}
++if {[catch {close $tmp} err]} {
++	error "Failed closing temporary file: $err"
++}
+ foreach f [lreplace $argv 0 1] {
+     if {![file exists $f~]} {exec cp -p $f $f~}
+     exec perl -pe "s\{\\b${from}\\b\}\{${to}\}g" < $f > $tmp
+diff -urN gs-gpl-8.56.dfsg.1.orig/toolbin/makeset.tcl gs-gpl-8.56.dfsg.1/toolbin/makeset.tcl
+--- gs-gpl-8.56.dfsg.1.orig/toolbin/makeset.tcl	2007-05-05 01:18:57.000000000 +0900
++++ gs-gpl-8.56.dfsg.1/toolbin/makeset.tcl	2007-05-05 01:25:11.000000000 +0900
+@@ -157,7 +157,23 @@
+     set ogfonts $cwd/gnu-gs-fonts-other-$Dot.tar.gz
+ 
+     file delete $afonts $ofonts $agfonts $ogfonts
+-    set tmp /tmp/[pid].tmp
++    switch $tcl_platform(platform) {
++        unix {
++                set tmpdir /tmp   # or even $::env(TMPDIR), at times.
++        } macintosh {
++                set tmpdir $::env(TRASH_FOLDER)  ;# a better place?
++        } default {
++                set tmpdir [pwd]
++                        catch {set tmpdir $::env(TMP)}
++                catch {set tmpdir $::env(TEMP)}
++        }
++    }
++    set tmp [file join $tmpdir [pid]]
++    exec umask 077
++    if {[catch {exec mkdir $tmp}]} {
++        # something went wrong
++        error "Could not create temporary dir."
++     }
+ 
+     licensefonts $tmp annotURWAladdin -u
+     sh -c "\
+@@ -395,7 +411,15 @@
+ proc makehist {} {
+     global Dot
+ 
+-    set tmphname /tmp/[pid]h.htm
++    set tmpname [file join $tmpdir [pid] htm]
++    set access [list RDWR CREAT EXCL TRUNC]
++    set perm 0600
++    if {[catch {open $tmpname $access $perm} fid ]} {
++	    error "Could not open tempfile."
++    }
++    if {[catch {close $tmpname} err]} {
++	    error "Failed closing temporary file: $err"
++    }
+     set tmpdname /tmp/[pid]d.htm
+     set news [open doc/News.htm]
+     set changes [open doc/Changes.htm]
+@@ -435,7 +459,15 @@
+     set cwd [pwd]
+     set atmp $cwd/gs${Num3}.zip
+     set asetup gs${Num3}.bat
+-    set tmp /tmp/[pid].tmp
++    set tmp [file join $tmpdir [pid] tmp]
++    set access [list RDWR CREAT EXCL TRUNC]
++    set perm 0600
++    if {[catch {open $tmp $access $perm} fid ]} {
++	    error "Could not open tempfile."
++    }
++    if {[catch {close $tmp} err]} {
++	    error "Failed closing temporary file: $err"
++    }
+ 
+     file delete $atmp $asetup $Dir
+     ln-s . $Dir
+diff -urN gs-gpl-8.56.dfsg.1.orig/toolbin/many2pdf.tcl gs-gpl-8.56.dfsg.1/toolbin/many2pdf.tcl
+--- gs-gpl-8.56.dfsg.1.orig/toolbin/many2pdf.tcl	2007-05-05 01:18:57.000000000 +0900
++++ gs-gpl-8.56.dfsg.1/toolbin/many2pdf.tcl	2007-05-05 01:26:02.000000000 +0900
+@@ -24,7 +24,24 @@
+ # Define the file containing the list of input file names.
+ set LIST_FILE_NAME /gs/show.lst
+ # Define the directory where the output will be stored.
+-set PDF_DIR /gs/tmp-pdf
++switch $tcl_platform(platform) {
++   unix {
++	   set tmpdir /tmp   # or even $::env(TMPDIR), at times.
++   } macintosh {
++	   set tmpdir $::env(TRASH_FOLDER)  ;# a better place?
++   } default {
++	   set tmpdir [pwd]
++	   catch {set tmpdir $::env(TMP)}
++	   catch {set tmpdir $::env(TEMP)}
++   }
++}
++set PDF_DIR [file join $tmpdir [pid]]
++set perm 0600
++exec umask 077
++if {[catch {exec mkdir $PDF_DIR} ]} {
++    # something went wrong
++    error "Could not create temporary directory."
++}
+ 
+ proc maxwaitfor {filesize} {
+     return [expr $filesize / 5000 + 30]
+@@ -50,8 +67,22 @@
+ 	    puts "****** $ps FAILED, DOES NOT EXIST ******"
+ 	    continue
+ 	}
+-	set script /tmp/${pid}.tcl
+-	set status /tmp/${pid}.out
++	set script [file join $tmpdir [pid] .tcl ]
++	set status [file join $tmpdir [pid] .out ]
++	set access [list RDWR CREAT EXCL TRUNC]
++	set perm 0600
++	if {[catch {open $script $access $perm} fid ]} {
++		error "Could not open tempfile."
++	}
++	if {[catch {close $script} err]} {
++		error "Failed closing temporary file: $err"
++	}
++	if {[catch {open $status $access $perm} fid ]} {
++		error "Could not open tempfile."
++	}
++	if {[catch {close $status} err]} {
++		error "Failed closing temporary file: $err"
++	}
+ 	set tmp [open $script w]
+ 	puts $tmp "\
+ 	set tmp \[open $status w\]
+diff -urN gs-gpl-8.56.dfsg.1.orig/toolbin/pre.tcl gs-gpl-8.56.dfsg.1/toolbin/pre.tcl
+--- gs-gpl-8.56.dfsg.1.orig/toolbin/pre.tcl	2007-05-05 01:18:57.000000000 +0900
++++ gs-gpl-8.56.dfsg.1/toolbin/pre.tcl	2007-05-05 01:26:50.000000000 +0900
+@@ -183,12 +183,31 @@
+ 	lappend doclist $d
+     }
+ }
++switch $tcl_platform(platform) {
++     unix {
++         set tmpdir /tmp   # or even $::env(TMPDIR), at times.
++     } macintosh {
++         set tmpdir $::env(TRASH_FOLDER)  ;# a better place?
++     } default {
++         set tmpdir [pwd]
++         catch {set tmpdir $::env(TMP)}
++         catch {set tmpdir $::env(TEMP)}
++     }
++}
+ 
+ if {$argv == {update}} {
+ 	# Update dates in .htm and .1 files.
+     proc updoc {doc before after} {
+-	set tmpfile /tmp/[pid]
+-	catch {file delete $tmpfile}
++        set tmpfile [file join $tmpdir [pid]]
++        set access [list RDWR CREAT EXCL TRUNC]
++        set perm 0600
++        if {[catch {open $tempfile $access $perm} fid ]} {
++             # something went wrong
++             error "Could not open tempfile."
++        }
++        if {[catch {close $t} err]} {
++             error "Failed closing temporary file: $err"
++        }
+ 	exec perl -pwe "s{$before}{$after}" < $doc > $tmpfile
+ 	file rename -force $tmpfile $doc
+     }

Added: ghostscript/trunk/debian/patches/30_assorted_script_fixes.dpatch
==============================================================================
--- (empty file)
+++ ghostscript/trunk/debian/patches/30_assorted_script_fixes.dpatch	Mon Sep 24 06:22:10 2007
@@ -0,0 +1,37 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 30_assorted_script_fixes.dpatch by  <till.kamppeter at gmail.com>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: Assorted script fixes
+
+ at DPATCH@
+diff -urNad ghostscript-8.60.dfsg.1.orig/lib/dumphint ghostscript-8.60.dfsg.1/lib/dumphint
+--- ghostscript-8.60.dfsg.1.orig/lib/dumphint	2007-09-24 11:17:11.000000000 +0900
++++ ghostscript-8.60.dfsg.1/lib/dumphint	2007-09-24 11:20:49.000000000 +0900
+@@ -27,4 +27,4 @@
+ 	exit 1
+ fi
+ 
+-exec "$GS_EXECUTABLE" -q -dNODISPLAY $OPTIONS -- dumphint.ps "$1"
++exec "$GS_EXECUTABLE" -q -dNODISPLAY $OPTIONS -- "`dirname $0`/dumphint.ps" "$1"
+diff -urNad ghostscript-8.60.dfsg.1.orig/lib/dvipdf ghostscript-8.60.dfsg.1/lib/dvipdf
+--- ghostscript-8.60.dfsg.1.orig/lib/dvipdf	2007-09-24 11:17:11.000000000 +0900
++++ ghostscript-8.60.dfsg.1/lib/dvipdf	2007-09-24 11:19:10.000000000 +0900
+@@ -44,4 +44,4 @@
+ 
+ # We have to include the options twice because -I only takes effect if it
+ # appears before other options.
+-exec dvips $DVIPSOPTIONS -q -f "$infile" | $GS_EXECUTABLE $OPTIONS -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile="$outfile" $OPTIONS -c .setpdfwrite -
++exec dvips -Ppdf $DVIPSOPTIONS -q -f "$infile" | $GS_EXECUTABLE $OPTIONS -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile="$outfile" $OPTIONS -c .setpdfwrite -
+diff -urNad ghostscript-8.60.dfsg.1.orig/lib/ps2epsi ghostscript-8.60.dfsg.1/lib/ps2epsi
+--- ghostscript-8.60.dfsg.1.orig/lib/ps2epsi	2007-09-24 11:17:11.000000000 +0900
++++ ghostscript-8.60.dfsg.1/lib/ps2epsi	2007-09-24 11:19:41.000000000 +0900
+@@ -75,7 +75,7 @@
+ 		}
+ 	' U="$USERNAME$LOGNAME"  F=1 - F=2 "${infile}" >"$tmpfile"
+ 
+-"$GS_EXECUTABLE" -q -dNOPAUSE -dSAFER -dDELAYSAFER -r72 -sDEVICE=bit -sOutputFile=/dev/null "$tmpfile" ps2epsi.ps "$tmpfile" <"${infile}" 1>&2
++"$GS_EXECUTABLE" -q -sPAPERSIZE=a0 -dNOPAUSE -dSAFER -dDELAYSAFER -r72 -sDEVICE=bit -sOutputFile=/dev/null "$tmpfile" ps2epsi.ps "$tmpfile" <"${infile}" 1>&2
+ rm -f "$tmpfile"
+ rm -rf "$tmpdir"
+ 

Added: ghostscript/trunk/debian/rules
==============================================================================
--- (empty file)
+++ ghostscript/trunk/debian/rules	Mon Sep 24 06:22:10 2007
@@ -0,0 +1,111 @@
+#!/usr/bin/make -f
+# -*- makefile -*-
+
+include /usr/share/cdbs/1/rules/debhelper.mk
+include /usr/share/cdbs/1/class/autotools.mk
+include /usr/share/cdbs/1/rules/dpatch.mk
+
+# for building w/ FAPI
+#FT_CPPFLAGS = $(shell pkg-config --cflags freetype2)
+#FT_LDFLAGS=$(shell pkg-config --libs freetype2)
+#FT_OPTS := FT_BRIDGE=1 FT_CFLAGS=$(FT_CPPFLAGS) FT_LIB=$(FT_LDFLAGS)
+
+ifeq ($(DEB_HOST_ARCH),s390)
+	CC=gcc-3.4
+else
+	CC=gcc
+endif
+
+DEB_CONFIGURE_SCRIPT_ENV := CFLAGS="$(CFLAGS) -fPIC" CPPFLAGS="$(FT_CPPFLAGS)" LDFLAGS="-lpaper $(FT_LDFLAGS)"
+DEB_CONFIGURE_EXTRA_FLAGS := --prefix=/usr --mandir=\$${prefix}/share/man --infodir=\$${prefix}/share/info \
+	--with-ijs --with-jbig2dec --with-jasper --with-x --disable-gtk \
+	--enable-dynamic --with-omni --enable-cups --disable-compile-inits \
+	--with-drivers=ALL \
+	--with-fontpath=/var/lib/defoma/gs.d/dirs/fonts:/usr/share/cups/fonts:/usr/share/ghostscript/fonts:/usr/local/lib/ghostscript/fonts:/usr/share/fonts:/usr/share/fonts/type1/gsfonts
+DEB_MAKE_BUILD_TARGET := STDDIRS $(FT_OPTS)
+DEB_MAKE_INSTALL_TARGET := soinstall install-shared install-cups \
+		prefix=$(CURDIR)/debian/ghostscript/usr \
+		datadir=$(CURDIR)/debian/ghostscript/usr/share \
+		gsdir=$(CURDIR)/debian/ghostscript/usr/share/ghostscript \
+		docdir=$(CURDIR)/debian/ghostscript/usr/share/doc/ghostscript \
+		exdir=$(CURDIR)/debian/ghostscript/usr/share/doc/ghostscript/examples \
+		cups_serverbin=$(CURDIR)/debian/ghostscript/usr/lib/cups \
+		CUPSSERVER=$(CURDIR)/debian/ghostscript/usr/lib/cups \
+		CUPSCONFIG=$(CURDIR)/debian/ghostscript/etc/cups \
+		CUPSDATA=$(CURDIR)/debian/ghostscript/usr/share/ppd/ghostscript
+
+fail-if-cmaps-exist:
+	@test ! -d Resource/CMap || ( \
+		echo; \
+		echo 'ERROR: Source contains CMaps that are declared non-free.'; \
+		echo '       Please strip Resource/CMap from source!'; \
+		exit 1)
+
+clean::
+	-cd jasper && $(MAKE) distclean
+	-$(MAKE) soclean
+	-$(MAKE) distclean
+
+build/ghostscript::
+	#/usr/bin/docbook-to-man debian/ghostscript.sgml > ghostscript.1
+
+build/ghostscript-x::
+	$(MAKE) obj/X11.so
+
+build/libgs8::
+	$(MAKE) so
+
+install/ghostscript::
+	# Move *.types and *.convs files from /etc/cups to
+	# /usr/share/cups/mime, so that they are not considered conffiles
+	mkdir -p $(CURDIR)/debian/ghostscript/usr/share/cups/mime/
+	mv $(CURDIR)/debian/ghostscript/etc/cups/*.types \
+	   $(CURDIR)/debian/ghostscript/usr/share/cups/mime/ 2> /dev/null || :
+	mv $(CURDIR)/debian/ghostscript/etc/cups/*.convs \
+	   $(CURDIR)/debian/ghostscript/usr/share/cups/mime/ 2> /dev/null || :
+	rmdir --ignore-fail-on-non-empty $(CURDIR)/debian/ghostscript/etc/cups
+	rmdir --ignore-fail-on-non-empty $(CURDIR)/debian/ghostscript/etc
+
+	# Install DeFoMa script
+	install -m 644 $(CURDIR)/debian/gs.defoma $(CURDIR)/debian/ghostscript/usr/share/defoma/scripts
+
+	# Remove some of the scripts
+	rm $(CURDIR)/debian/ghostscript/usr/bin/unix-lpr.sh $(CURDIR)/debian/ghostscript/usr/bin/lprsetup.sh $(CURDIR)/debian/ghostscript/usr/bin/pv.sh $(CURDIR)/debian/ghostscript/usr/bin/fixmswrd.pl
+
+	# Do not include the Ghostscript loader executable with GTK support
+	rm -f $(CURDIR)/debian/ghostscript/usr/bin/gsx
+
+	# Rename /usr/bin/gsc, to not conflict with gambc (bug LP #118785).
+	mv $(CURDIR)/debian/ghostscript/usr/bin/gsc $(CURDIR)/debian/ghostscript/usr/bin/gs
+
+	# Some convenience links
+	ln -s /usr/bin/gs $(CURDIR)/debian/ghostscript/usr/bin/ghostscript
+	ln -s /usr/share/man/man1/gs.1 $(CURDIR)/debian/ghostscript/usr/share/man/man1/ghostscript.1
+
+install/ghostscript-x::
+	# Separate the dynamic library for X support into the ghostscript-x
+	# package
+	mkdir -p $(CURDIR)/debian/ghostscript-x/usr/lib/
+	mv $(CURDIR)/debian/ghostscript/usr/lib/ghostscript $(CURDIR)/debian/ghostscript-x/usr/lib/
+
+install/ghostscript-doc::
+	# Move documentation into the ghostscript-doc package
+	mkdir -p $(CURDIR)/debian/ghostscript-doc/usr/share/
+	mv $(CURDIR)/debian/ghostscript/usr/share/doc $(CURDIR)/debian/ghostscript-doc/usr/share/
+
+install/libgs8::
+	# Move libgs into the libgs8 package
+	mkdir -p $(CURDIR)/debian/libgs8/usr/lib/
+	rm -f $(CURDIR)/debian/ghostscript/usr/lib/libgs*
+	cp sobin/libgs.so.8.* $(CURDIR)/debian/libgs8/usr/lib/
+	cp -P sobin/libgs.so.8 $(CURDIR)/debian/libgs8/usr/lib/
+
+	# Move libgs.so link into the libgs-dev package
+	# and install also the C headers there
+	mkdir -p $(CURDIR)/debian/libgs-dev/usr/lib/
+	cp -P sobin/libgs.so $(CURDIR)/debian/libgs-dev/usr/lib/
+	mkdir -p $(CURDIR)/debian/libgs-dev/usr/include/ghostscript
+	install -m 644 $(CURDIR)/src/iapi.h $(CURDIR)/debian/libgs-dev/usr/include/ghostscript
+	install -m 644 $(CURDIR)/src/ierrors.h $(CURDIR)/debian/libgs-dev/usr/include/ghostscript
+	install -m 644 $(CURDIR)/src/gdevdsp.h $(CURDIR)/debian/libgs-dev/usr/include/ghostscript
+

Added: ghostscript/trunk/debian/watch
==============================================================================
--- (empty file)
+++ ghostscript/trunk/debian/watch	Mon Sep 24 06:22:10 2007
@@ -0,0 +1,8 @@
+# Example watch control file for uscan
+# Rename this file to "watch" and then you can run the "uscan" command
+# to check for upstream updates and more.
+# Site		Directory		Pattern			Version	Script
+version=3
+opts=uversionmangle=s/-gpl$// \
+ ftp://mirror.cs.wisc.edu/pub/mirrors/ghost/GPL/gs(\d+)/ghostscript-(.+)\.tar\.gz
+



More information about the Pkg-gs-devel mailing list