--- splix-2.0.0~rc2.orig/.defs.mk +++ splix-2.0.0~rc2/.defs.mk @@ -0,0 +1,3 @@ +DEFLOADED := 1 +_SUBDIRS := src +DEFDONE := 1 --- splix-2.0.0~rc2.orig/debian/changelog +++ splix-2.0.0~rc2/debian/changelog @@ -0,0 +1,87 @@ +splix (2.0.0~rc2-0ubuntu2.2) intrepid-proposed; urgency=low + + * debian/splix.postinst, debian/splix.postrm: As we provide CUPS file + conversion rules now, we need to restart CUPS when installing or + removing this package. + + -- Till Kamppeter Wed, 12 Nov 2008 21:49:45 +0100 + +splix (2.0.0~rc2-0ubuntu2.1) intrepid-proposed; urgency=low + + * debian/local/pdftoraster/pdftosplixraster.c, + debian/local/pdftoraster/pdftosplixraster.convs, + debian/local/pdftoraster/pdftosplixraster.types, debian/rules: + Added alternative pdftoraster filter as the original one does not work + with SpliX (LP: #290395). + + * debian/patches/broken-mono-printing-on-color-printer.patch: Grayscale + printing on color printers did not use the black toner (Upstream bug + http://sourceforge.net/tracker2/?func=detail&aid=1994510&group_id=175815&atid=874746). + + -- Till Kamppeter Tue, 11 Nov 2008 22:35:45 +0200 + +splix (2.0.0~rc2-0ubuntu2) intrepid; urgency=low + + * debian/control, debian/rules: Enabled package for patches. + * debian/patches/no-crash-on-bad-papersize.patch: Fixed crash which + happens when the page size of the incoming CUPS Raster data is + not the page size as specified in the PPD file or on the command + line (LP: #261363, LP: #268510). + + -- Till Kamppeter Sat, 4 Oct 2008 22:35:45 +0200 + +splix (2.0.0~rc2-0ubuntu1) intrepid; urgency=low + + * New upstream release + * debian/control: Adapted to renaming of CUPS package from "cupsys" to + "cups". + + -- Till Kamppeter Mon, 11 Aug 2008 15:35:45 +0200 + +splix (1.1.1-0ubuntu1) hardy; urgency=low + + * New upstream release + * debian/rules: Suppress build of drivers using the patented JBIG algorithm, + install with "make install" to improve maintainability. + * debian/rules: Correct language tags of the non-English PPD files + (LP: #161037). + * debian/splix.install: Removed, as we install with "make install" now. + + -- Till Kamppeter Mon, 11 Feb 2008 17:49:41 +0100 + +splix (1.0.1.1-0ubuntu2) gutsy; urgency=low + + * debian/control: Added cupsddk to the Build-Dependens line, to avoid + the need of creating new workarounds against rebuilding the PPDs with + every upstream release. + + -- Till Kamppeter Mon, 06 Aug 2007 17:17:05 +0100 + +splix (1.0.1.1-0ubuntu1) gutsy; urgency=low + + * New upstream release + o Fixes support for Samsung ML-2010 (LP: #112030) + + -- Till Kamppeter Mon, 06 Aug 2007 11:44:05 +0100 + +splix (1.0.1-0ubuntu1) feisty; urgency=low + + * New upstream release + o Duplex support + o Support for Xerox Phaser 6100 + o Bug fixes + * Removed 10-fix-ppds.dpatch: PPDs fixed upstream + * debian/rules: Removed PPDs for Samsung CLP-300 and CLP-600, these + printers are known to not work with this release of the driver. + + -- Till Kamppeter Wed, 7 Feb 2007 10:44:10 +0000 + +splix (1.0.1~beta2-0ubuntu1) feisty; urgency=low + + * Initial Release. (Closes: LP #59829) + * Fixed PPD files + o It must be "*LanguageVersion: German", not + "*LanguageVersion: Deutsch". + o The PPDs for the CLP-600 had "CLP-60" as model name. + + -- Till Kamppeter Tue, 12 Dec 2006 12:00:00 +0100 --- splix-2.0.0~rc2.orig/debian/README.Debian +++ splix-2.0.0~rc2/debian/README.Debian @@ -0,0 +1,20 @@ + +SpliX for Ubuntu Linux +---------------------- + +This is the SpliX printer driver for Samsung's laser printers using the SPL2 +(monochrome) and SPLc (color) printing languages. + +The PPD files coming with this package (in ppd/) are generated with +"ppdc" of the CUPS DDK from http://www.cups.org/ based on the +instructions in the ppd/samsung.drv file. So ppd/samsung.drv is the +source code of the PPDs. In addition, CUPS DDK is free software, so +all requirements for the PPDs being in the main part of Ubuntu Linux +are fulfilled. + +The ready-made PPD files are there for convenience, to not require +from the user to have CUPS DDK installed. As CUPS DDK does not make +part of Debian or Ubuntu yet, we use these PPDs instead of building +them. + + -- Till Kamppeter , Fri, 12 Jan 2007 20:47:46 +0000 --- splix-2.0.0~rc2.orig/debian/splix.postinst +++ splix-2.0.0~rc2/debian/splix.postinst @@ -0,0 +1,42 @@ +#! /bin/sh +# postinst script for splix +# +# see: dh_installdeb(1) + +set -e + +# summary of how this script can be called: +# * `configure' +# * `abort-upgrade' +# * `abort-remove' `in-favour' +# +# * `abort-deconfigure' `in-favour' +# `removing' +# +# for details, see /usr/doc/packaging-manual/ +# +# quoting from the policy: +# Any necessary prompting should almost always be confined to the +# post-installation script, and should be protected with a conditional +# so that unnecessary prompting doesn't happen if a package's +# installation fails and the `postinst' is called with `abort-upgrade', +# `abort-remove' or `abort-deconfigure'. + +#s/^if\s+\[\s+"\$1"\s+=\s+"configure"\s+\];\s+then\s+ldconfig\b//m; + +if [ "$1" = "configure" ]; then + # Restart CUPS (to register new file conversion rules) + [ -x /etc/init.d/cups ] && invoke-rc.d cups force-reload || true +elif [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-remove" ] || [ "$1" = "abort-deconfigure" ]; then + : +else + echo "postinst called with unknown argument \`$1'" >&2 + exit 0 +fi + +# dh_installdeb will replace this with shell code automatically +# generated by other debhelper scripts. + +#DEBHELPER# + +exit 0 --- splix-2.0.0~rc2.orig/debian/splix.postrm +++ splix-2.0.0~rc2/debian/splix.postrm @@ -0,0 +1,27 @@ +#! /bin/sh +# postrm script for splix +# +# see: dh_installdeb(1) + +set -e + +# summary of how this script can be called: +# * `remove' +# * `purge' +# * `upgrade' +# * `failed-upgrade' +# * `abort-install' +# * `abort-install' +# * `abort-upgrade' +# * `disappear' overwrit>r> +# for details, see /usr/doc/packaging-manual/ + +if [ "$1" = remove ]; then + # Restart CUPS to unregister the removed file conversion rules + [ -x /etc/init.d/cups ] && invoke-rc.d cups force-reload || true +fi + +# dh_installdeb will replace this with shell code automatically +# generated by other debhelper scripts. + +#DEBHELPER# --- splix-2.0.0~rc2.orig/debian/copyright +++ splix-2.0.0~rc2/debian/copyright @@ -0,0 +1,25 @@ +This package was debianized by Till Kamppeter on +Tue, 12 Dec 2006. + +It was downloaded from http://splix.ap2c.org/ + +Upstream Authors: + Aurélien Croc + +Copyright: (C) 2006, Aurélien Croc (AP²C) + + 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'. --- splix-2.0.0~rc2.orig/debian/rules +++ splix-2.0.0~rc2/debian/rules @@ -0,0 +1,87 @@ +#!/usr/bin/make -f + +# Uncomment this to turn on verbose mode. +#export DH_VERBOSE=1 + +include /usr/share/cdbs/1/rules/simple-patchsys.mk + +CFLAGS = -Wall -g + +ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS))) + CFLAGS += -O0 +else + CFLAGS += -O2 +endif +ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS))) + INSTALL_PROGRAM += -s +endif + +patch: patch-stamp +patch-stamp: + dh_testdir + dpatch apply-all + touch patch-stamp + +configure: configure-stamp +configure-stamp: patch + dh_testdir + touch configure-stamp + +build: build-stamp +build-stamp: configure-stamp + dh_testdir + $(MAKE) CFLAGS="$(CFLAGS)" DISABLE_JBIG=1 + gcc $(CFLAGS) $(LDFLAGS) `cups-config --image --libs` -DBINDIR='"/usr/bin"' -DGS='"gs"' -o debian/local/pdftoraster/pdftosplixraster debian/local/pdftoraster/pdftosplixraster.c + +unpatch: + dh_testdir + dpatch deapply-all + rm -rf debian/patched + +clean:: unpatch + dh_testdir + dh_testroot + rm -f build-stamp configure-stamp patch-stamp debian/local/pdftoraster/pdftosplixraster + -$(MAKE) clean DISABLE_JBIG=1 + dh_clean + +install: build + dh_testdir + dh_testroot + dh_clean -k + dh_installdirs + mkdir -p debian/splix/usr/lib/cups/filter + mkdir -p debian/splix/usr/share/cups/mime + mkdir -p debian/splix/usr/share/ppd/splix + $(MAKE) install DISABLE_JBIG=1 CUPSFILTER=$(CURDIR)/debian/splix`cups-config --serverbin`/filter CUPSPPD=$(CURDIR)/debian/splix/usr/share/ppd/splix + install -m 755 debian/local/pdftoraster/pdftosplixraster \ + $(CURDIR)/debian/splix/usr/lib/cups/filter/ + install -m 644 debian/local/pdftoraster/pdftosplixraster.types \ + $(CURDIR)/debian/splix/usr/share/cups/mime/ + install -m 644 debian/local/pdftoraster/pdftosplixraster.convs \ + $(CURDIR)/debian/splix/usr/share/cups/mime/ + perl -p -i -e 's:application/vnd.cups-raster:application/vnd.cups-splixraster:' $(CURDIR)/debian/splix/usr/share/ppd/splix/*/*.ppd + # Correct language tags inside the PPD files + perl -p -i -e 's/(\*LanguageVersion:\s*)English/\1German/' $(CURDIR)/debian/splix/usr/share/ppd/splix/*/*de.ppd + perl -p -i -e 's/(\*LanguageVersion:\s*)English/\1French/' $(CURDIR)/debian/splix/usr/share/ppd/splix/*/*fr.ppd + perl -p -i -e 's/(\*LanguageVersion:\s*)English/\1Italian/' $(CURDIR)/debian/splix/usr/share/ppd/splix/*/*it.ppd + +# Build architecture-dependent files here. +binary-arch: build install + dh_testdir + dh_testroot + dh_installchangelogs ChangeLog + dh_installdocs + dh_installexamples + dh_installman + dh_strip + dh_compress + dh_fixperms + dh_installdeb + dh_shlibdeps + dh_gencontrol + dh_md5sums + dh_builddeb + +binary: binary-indep binary-arch +.PHONY: build clean binary-indep binary-arch binary install configure --- splix-2.0.0~rc2.orig/debian/control +++ splix-2.0.0~rc2/debian/control @@ -0,0 +1,23 @@ +Source: splix +Section: text +Priority: optional +Maintainer: Till Kamppeter +Build-Depends: debhelper (>= 5.0.0), groff, dpatch, libcups2-dev, libcupsimage2-dev, cupsddk, cdbs +Standards-Version: 3.7.2 + +Package: splix +Architecture: any +Depends: ${shlibs:Depends} +Description: Driver for Samsung's SPL2 (bw) and SPLc (color) laser printers + Support for printing to SPL2- and SPLc-based printers. These are most + of the cheaper Samsung laser printers which do not understand standard + languages like PostScript or PCL. Both monochrome (ML-15xx, ML-16xx, + ML-17xx, ML-2xxx) and color (CLP-5xx, CLP-6xx) models are supported. + Also some rebranded Samsungs like the Xerox Phaser 6100 work with this + driver. + . + Note that older SPL1-based models (ML-12xx, ML-14xx) do not work. Use + these printers with the older "gdi" driver which is built into ESP + GhostScript. + . + Home Page: http://splix.ap2c.org/ --- splix-2.0.0~rc2.orig/debian/compat +++ splix-2.0.0~rc2/debian/compat @@ -0,0 +1 @@ +5 --- splix-2.0.0~rc2.orig/debian/docs +++ splix-2.0.0~rc2/debian/docs @@ -0,0 +1,3 @@ +AUTHORS +THANKS +TODO --- splix-2.0.0~rc2.orig/debian/local/pdftoraster/pdftosplixraster.types +++ splix-2.0.0~rc2/debian/local/pdftoraster/pdftosplixraster.types @@ -0,0 +1 @@ +application/vnd.cups-splixraster --- splix-2.0.0~rc2.orig/debian/local/pdftoraster/pdftosplixraster.convs +++ splix-2.0.0~rc2/debian/local/pdftoraster/pdftosplixraster.convs @@ -0,0 +1,2 @@ +application/vnd.cups-pdf application/vnd.cups-splixraster 66 pdftosplixraster + --- splix-2.0.0~rc2.orig/debian/local/pdftoraster/pdftosplixraster.c +++ splix-2.0.0~rc2/debian/local/pdftoraster/pdftosplixraster.c @@ -0,0 +1,509 @@ +/* +Copyright (c) 2008, Till Kamppeter +Copyright (c) 2008, BBR Inc. All rights reserved. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be included +in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +MIT Open Source License - http://www.opensource.org/ + +*/ + +/* $Id: pdftoraster.c 9171 2008-10-17 22:58:21Z giles $ */ + +/* PDF to CUPS Raster filter based on Ghostscript */ + +#include +#include +#include +#include +#include +#include + +#define MAX_CHECK_COMMENT_LINES 20 +#ifndef GS +#define GS "gs" +#endif +#ifndef BINDIR +#define BINDIR "/usr/bin" +#endif +#ifndef CUPS_FONTPATH +#define CUPS_FONTPATH "/usr/share/cups/fonts" +#endif + +int exitCode = 0; +int deviceCopies = 1; +cups_bool_t deviceCollate = CUPS_FALSE; +#ifdef CUPS_RASTER_SYNCv1 +cups_page_header2_t h; +#else +cups_page_header_t h; +#endif /* CUPS_RASTER_SYNCv1 */ +int num_options = 0; +cups_option_t *options = 0; + +void parseOpts(int argc, char **argv) +{ + ppd_file_t *ppd = 0; + + if (argc < 6 || argc > 7) { + fprintf(stderr, "ERROR: %s job-id user title copies options [file]", + argv[0]); + exit(1); + } + + ppd = ppdOpenFile(getenv("PPD")); + ppdMarkDefaults(ppd); + options = NULL; + num_options = cupsParseOptions(argv[5],0,&options); + cupsMarkOptions(ppd,num_options,options); + cupsRasterInterpretPPD(&h,ppd,num_options,options,0); +} + +void parsePDFTOPDFComment(FILE *fp) +{ + char buf[4096]; + int i; + + /* skip until PDF start header */ + while (fgets(buf,sizeof(buf),fp) != 0) { + if (strncmp(buf,"%PDF",4) == 0) { + break; + } + } + for (i = 0;i < MAX_CHECK_COMMENT_LINES;i++) { + if (fgets(buf,sizeof(buf),fp) == 0) break; + if (strncmp(buf,"%%PDFTOPDFNumCopies",19) == 0) { + char *p; + + p = strchr(buf+19,':'); + deviceCopies = atoi(p+1); + } else if (strncmp(buf,"%%PDFTOPDFCollate",17) == 0) { + char *p; + + p = strchr(buf+17,':'); + while (*p == ' ' || *p == '\t') p++; + if (strncasecmp(p,"true",4) == 0) { + deviceCollate = CUPS_TRUE; + } else { + deviceCollate = CUPS_FALSE; + } + } + } +} + +int main(int argc, char *argv[], char *envp[]) { + int i; + FILE *fp; + cups_array_t *gs_args; + char tmpstr[1024]; + const char *t = NULL; + int fd; + char buf[BUFSIZ]; + int n; + int numargs; + char *argument; + char **gsargv; + const char* apos; + int fds[2]; + int pid; + + parseOpts(argc, argv); + + if (argc == 6) { + /* stdin */ + + fd = cupsTempFd(buf,BUFSIZ); + if (fd < 0) { + fprintf(stderr, "ERROR: Can't create temporary file"); + exit(1); + } + /* remove name */ + unlink(buf); + + /* copy stdin to the tmp file */ + while ((n = read(0,buf,BUFSIZ)) > 0) { + if (write(fd,buf,n) != n) { + fprintf(stderr, "ERROR: Can't copy stdin to temporary file"); + close(fd); + exit(1); + } + } + if (lseek(fd,0,SEEK_SET) < 0) { + fprintf(stderr, "ERROR: Can't rewind temporary file"); + close(fd); + exit(1); + } + + if ((fp = fdopen(fd,"rb")) == 0) { + fprintf(stderr, "ERROR: Can't fdopen temporary file"); + close(fd); + exit(1); + } + } else { + /* argc == 7 filenmae is specified */ + + if ((fp = fopen(argv[6],"rb")) == 0) { + fprintf(stderr, "ERROR: Can't open input file %s",argv[6]); + exit(1); + } + } + parsePDFTOPDFComment(fp); + rewind(fp); + + /* Fix NumCopies and Collate according to PDFTOPDFComments */ + h.NumCopies = deviceCopies; + h.Collate = deviceCollate; + /* fixed other values that pdftopdf handles */ + h.MirrorPrint = CUPS_FALSE; + h.Orientation = CUPS_ORIENT_0; + + /* Ghostscript parameters */ + gs_args = cupsArrayNew(NULL, NULL); + if (!gs_args) + { + fprintf(stderr, "ERROR: Unable to allocate memory for Ghostscript arguments array\n"); + exit(1); + } + + /* Part of Ghostscript command line which is not dependent on the job and/or + the driver */ + snprintf(tmpstr, sizeof(tmpstr), "%s/%s", BINDIR, GS); + cupsArrayAdd(gs_args, strdup(tmpstr)); + cupsArrayAdd(gs_args, strdup("-dQUIET")); + /*cupsArrayAdd(gs_args, strdup("-dDEBUG"));*/ + cupsArrayAdd(gs_args, strdup("-dPARANOIDSAFER")); + cupsArrayAdd(gs_args, strdup("-dNOPAUSE")); + cupsArrayAdd(gs_args, strdup("-dBATCH")); + /* cupsArrayAdd(gs_args, strdup("-dNOMEDIAATTRS")); */ + cupsArrayAdd(gs_args, strdup("-sDEVICE=cups")); + cupsArrayAdd(gs_args, strdup("-sstdout=%stderr")); + cupsArrayAdd(gs_args, strdup("-sOutputFile=%stdout")); + + /* CUPS font path */ + if ((t = getenv("CUPS_FONTPATH")) == NULL) + t = CUPS_FONTPATH; + snprintf(tmpstr, sizeof(tmpstr), "-I%s", t); + cupsArrayAdd(gs_args, strdup(tmpstr)); + + /* Simple boolean, enumerated choice, numerical, and string parameters */ + if (h.MediaClass[0] |= '\0') { + snprintf(tmpstr, sizeof(tmpstr), "-sMediaClass=%s", h.MediaClass); + cupsArrayAdd(gs_args, strdup(tmpstr)); + } + if (h.MediaColor[0] |= '\0') { + snprintf(tmpstr, sizeof(tmpstr), "-sMediaColor=%s", h.MediaColor); + cupsArrayAdd(gs_args, strdup(tmpstr)); + } + if (h.MediaType[0] |= '\0') { + snprintf(tmpstr, sizeof(tmpstr), "-sMediaType=%s", h.MediaType); + cupsArrayAdd(gs_args, strdup(tmpstr)); + } + if (h.OutputType[0] |= '\0') { + snprintf(tmpstr, sizeof(tmpstr), "-sOutputType=%s", h.OutputType); + cupsArrayAdd(gs_args, strdup(tmpstr)); + } + if (h.AdvanceDistance) { + snprintf(tmpstr, sizeof(tmpstr), "-dAdvanceDistance=%d", + (unsigned)(h.AdvanceDistance)); + cupsArrayAdd(gs_args, strdup(tmpstr)); + } + if (h.AdvanceMedia) { + snprintf(tmpstr, sizeof(tmpstr), "-dAdvanceMedia=%d", + (unsigned)(h.AdvanceMedia)); + cupsArrayAdd(gs_args, strdup(tmpstr)); + } + if (h.Collate) { + cupsArrayAdd(gs_args, strdup("-dCollate")); + } + if (h.CutMedia) { + snprintf(tmpstr, sizeof(tmpstr), "-dCutMedia=%d", + (unsigned)(h.CutMedia)); + cupsArrayAdd(gs_args, strdup(tmpstr)); + } + if (h.Duplex) { + cupsArrayAdd(gs_args, strdup("-dDuplex")); + } + if ((h.HWResolution[0] != 100) || (h.HWResolution[1] != 100)) + snprintf(tmpstr, sizeof(tmpstr), "-r%dx%d", + (unsigned)(h.HWResolution[0]), (unsigned)(h.HWResolution[1])); + else + snprintf(tmpstr, sizeof(tmpstr), "-r100x100"); + cupsArrayAdd(gs_args, strdup(tmpstr)); + if (h.InsertSheet) { + cupsArrayAdd(gs_args, strdup("-dInsertSheet")); + } + if (h.Jog) { + snprintf(tmpstr, sizeof(tmpstr), "-dJog=%d", + (unsigned)(h.Jog)); + cupsArrayAdd(gs_args, strdup(tmpstr)); + } + if (h.LeadingEdge) { + snprintf(tmpstr, sizeof(tmpstr), "-dLeadingEdge=%d", + (unsigned)(h.LeadingEdge)); + cupsArrayAdd(gs_args, strdup(tmpstr)); + } + if (h.ManualFeed) { + cupsArrayAdd(gs_args, strdup("-dManualFeed")); + } + if (h.MediaPosition) { + snprintf(tmpstr, sizeof(tmpstr), "-dMediaPosition=%d", + (unsigned)(h.MediaPosition)); + cupsArrayAdd(gs_args, strdup(tmpstr)); + } + if (h.MediaWeight) { + snprintf(tmpstr, sizeof(tmpstr), "-dMediaWeight=%d", + (unsigned)(h.MediaWeight)); + cupsArrayAdd(gs_args, strdup(tmpstr)); + } + if (h.MirrorPrint) { + cupsArrayAdd(gs_args, strdup("-dMirrorPrint")); + } + if (h.NegativePrint) { + cupsArrayAdd(gs_args, strdup("-dNegativePrint")); + } + if (h.NumCopies != 1) { + snprintf(tmpstr, sizeof(tmpstr), "-dNumCopies=%d", + (unsigned)(h.NumCopies)); + cupsArrayAdd(gs_args, strdup(tmpstr)); + } + if (h.Orientation) { + snprintf(tmpstr, sizeof(tmpstr), "-dOrientation=%d", + (unsigned)(h.Orientation)); + cupsArrayAdd(gs_args, strdup(tmpstr)); + } + if (h.OutputFaceUp) { + cupsArrayAdd(gs_args, strdup("-dOutputFaceUp")); + } + if (h.PageSize[0] != 612) + snprintf(tmpstr, sizeof(tmpstr), "-dDEVICEWIDTHPOINTS=%d", + (unsigned)(h.PageSize[0])); + else + snprintf(tmpstr, sizeof(tmpstr), "-dDEVICEWIDTHPOINTS=612"); + cupsArrayAdd(gs_args, strdup(tmpstr)); + if (h.PageSize[1] != 792) + snprintf(tmpstr, sizeof(tmpstr), "-dDEVICEHEIGHTPOINTS=%d", + (unsigned)(h.PageSize[1])); + else + snprintf(tmpstr, sizeof(tmpstr), "-dDEVICEHEIGHTPOINTS=792"); + cupsArrayAdd(gs_args, strdup(tmpstr)); + if (h.Separations) { + cupsArrayAdd(gs_args, strdup("-dSeparations")); + } + if (h.TraySwitch) { + cupsArrayAdd(gs_args, strdup("-dTraySwitch")); + } + if (h.Tumble) { + cupsArrayAdd(gs_args, strdup("-dTumble")); + } + if (h.cupsMediaType) { + snprintf(tmpstr, sizeof(tmpstr), "-dcupsMediaType=%d", + (unsigned)(h.cupsMediaType)); + cupsArrayAdd(gs_args, strdup(tmpstr)); + } + if (h.cupsBitsPerColor != 1) + snprintf(tmpstr, sizeof(tmpstr), "-dcupsBitsPerColor=%d", + (unsigned)(h.cupsBitsPerColor)); + else + snprintf(tmpstr, sizeof(tmpstr), "-dcupsBitsPerColor=1"); + cupsArrayAdd(gs_args, strdup(tmpstr)); + if (h.cupsColorOrder != CUPS_ORDER_CHUNKED) + snprintf(tmpstr, sizeof(tmpstr), "-dcupsColorOrder=%d", + (unsigned)(h.cupsColorOrder)); + else + snprintf(tmpstr, sizeof(tmpstr), "-dcupsColorOrder=%d", + CUPS_ORDER_CHUNKED); + cupsArrayAdd(gs_args, strdup(tmpstr)); + if (h.cupsColorSpace != CUPS_CSPACE_K) + snprintf(tmpstr, sizeof(tmpstr), "-dcupsColorSpace=%d", + (unsigned)(h.cupsColorSpace)); + else + snprintf(tmpstr, sizeof(tmpstr), "-dcupsColorSpace=%d", + CUPS_CSPACE_K); + cupsArrayAdd(gs_args, strdup(tmpstr)); + if (h.cupsCompression) { + snprintf(tmpstr, sizeof(tmpstr), "-dcupsCompression=%d", + (unsigned)(h.cupsCompression)); + cupsArrayAdd(gs_args, strdup(tmpstr)); + } + if (h.cupsRowCount) { + snprintf(tmpstr, sizeof(tmpstr), "-dcupsRowCount=%d", + (unsigned)(h.cupsRowCount)); + cupsArrayAdd(gs_args, strdup(tmpstr)); + } + if (h.cupsRowFeed) { + snprintf(tmpstr, sizeof(tmpstr), "-dcupsRowFeed=%d", + (unsigned)(h.cupsRowFeed)); + cupsArrayAdd(gs_args, strdup(tmpstr)); + } + if (h.cupsRowStep) { + snprintf(tmpstr, sizeof(tmpstr), "-dcupsRowStep=%d", + (unsigned)(h.cupsRowStep)); + cupsArrayAdd(gs_args, strdup(tmpstr)); + } +#ifdef CUPS_RASTER_SYNCv1 + if (h.cupsBorderlessScalingFactor != 1.0f) { + snprintf(tmpstr, sizeof(tmpstr), "-dcupsBorderlessScalingFactor=%.4f", + h.cupsBorderlessScalingFactor); + cupsArrayAdd(gs_args, strdup(tmpstr)); + } + for (i=0; i <= 15; i ++) + if (h.cupsInteger[i]) { + snprintf(tmpstr, sizeof(tmpstr), "-dcupsInteger%d=%d", + i, (unsigned)(h.cupsInteger[i])); + cupsArrayAdd(gs_args, strdup(tmpstr)); + } + for (i=0; i <= 15; i ++) + if (h.cupsReal[i]) { + snprintf(tmpstr, sizeof(tmpstr), "-dcupsReal%d=%.4f", + i, h.cupsReal[i]); + cupsArrayAdd(gs_args, strdup(tmpstr)); + } + for (i=0; i <= 15; i ++) + if (h.cupsString[i][0] != '\0') { + snprintf(tmpstr, sizeof(tmpstr), "-scupsString%d=%s", + i, h.cupsString[i]); + cupsArrayAdd(gs_args, strdup(tmpstr)); + } + if (h.cupsMarkerType[0] != '\0') { + snprintf(tmpstr, sizeof(tmpstr), "-scupsMarkerType=%s", + h.cupsMarkerType); + cupsArrayAdd(gs_args, strdup(tmpstr)); + } + if (h.cupsRenderingIntent[0] != '\0') { + snprintf(tmpstr, sizeof(tmpstr), "-scupsRenderingIntent=%s", + h.cupsRenderingIntent); + cupsArrayAdd(gs_args, strdup(tmpstr)); + } + if (h.cupsPageSizeName[0] != '\0') { + snprintf(tmpstr, sizeof(tmpstr), "-scupsPageSizeName=%s", + h.cupsPageSizeName); + cupsArrayAdd(gs_args, strdup(tmpstr)); + } +#endif /* CUPS_RASTER_SYNCv1 */ + + /* Parameters of array type. They cannot be supplied as "-d" or "-s" + command line options. We use "-c" here to supply them as + PostScript commands */ + + /* Switch to taking PostScript commands on the Ghostscript command line */ + cupsArrayAdd(gs_args, "-c"); + + if ((t = cupsGetOption("profile", num_options, options)) != NULL) { + snprintf(tmpstr, sizeof(tmpstr), "<>setpagedevice", t); + cupsArrayAdd(gs_args, strdup(tmpstr)); + } + + /* Mark the end of PostScript commands supplied on the Ghostscript command + line (with the "-c" option), so that we can supply the input file name */ + cupsArrayAdd(gs_args, strdup("-f")); + + /* Let Ghostscript read from STDIN */ + cupsArrayAdd(gs_args, strdup("-_")); + + /* Put Ghostscript command line argument into an array for the "exec()" + call */ + numargs = cupsArrayCount(gs_args); + gsargv = calloc(numargs + 1, sizeof(char *)); + for (argument = (char *)cupsArrayFirst(gs_args), i = 0; argument; + argument = (char *)cupsArrayNext(gs_args), i++) { + gsargv[i] = argument; + } + gsargv[i] = NULL; + + /* Debug output: Full Ghostscript command line and environment variables */ + fprintf(stderr, "DEBUG: Ghostscript command line:"); + for (i = 0; gsargv[i]; i ++) { + if ((strchr(gsargv[i],' ')) || (strchr(gsargv[i],'\t'))) + apos = "'"; + else + apos = ""; + fprintf(stderr, " %s%s%s", apos, gsargv[i], apos); + } + fprintf(stderr, "\n"); + + for (i = 0; envp[i]; i ++) + fprintf(stderr, "DEBUG: envp[%d]=\"%s\"\n", i, envp[i]); + + /* Create a pipe for feeding the job into Ghostscript */ + if (pipe(fds)) + { + fds[0] = -1; + fds[1] = -1; + fprintf(stderr, "ERROR: Unable to establish pipe for Ghostscript call"); + exit(1); + } + + /* Set the "close on exec" flag on each end of the pipe... */ + if (fcntl(fds[0], F_SETFD, fcntl(fds[0], F_GETFD) | FD_CLOEXEC)) + { + close(fds[0]); + close(fds[1]); + fds[0] = -1; + fds[1] = -1; + fprintf(stderr, "ERROR: Unable to set \"close on exec\" flag on read end of the pipe for Ghostscript call"); + exit(1); + } + if (fcntl(fds[1], F_SETFD, fcntl(fds[1], F_GETFD) | FD_CLOEXEC)) + { + close(fds[0]); + close(fds[1]); + fprintf(stderr, "ERROR: Unable to set \"close on exec\" flag on write end of the pipe for Ghostscript call"); + exit(1); + } + + if ((pid = fork()) == 0) + { + /* Ghostscript child process */ + + /* Couple pipe with STDIN of Ghostscript process */ + if (fds[0] != 0) { + close(0); + if (fds[0] > 0) + dup(fds[0]); + else { + fprintf(stderr, "ERROR: Unable to couple pipe with STDIN of Ghostscript process"); + exit(1); + } + } + + /* Execute Ghostscript command line ... */ + snprintf(tmpstr, sizeof(tmpstr), "%s/%s", BINDIR, GS); + execve(tmpstr, gsargv, envp); + + perror(tmpstr); + + exit(1); + } else { + /* Main process */ + + /* Feed job data into Ghostscript */ + while ((n = fread(buf, 1, BUFSIZ, fp)) > 0) { + if (write(fds[1], buf, n) != n) { + fprintf(stderr, "ERROR: Can't feed job data into Ghostscript"); + fclose(fp); + exit(1); + } + } + fclose(fp); + } + + exit(0); +} + --- splix-2.0.0~rc2.orig/debian/patches/broken-mono-printing-on-color-printer.patch +++ splix-2.0.0~rc2/debian/patches/broken-mono-printing-on-color-printer.patch @@ -0,0 +1,30 @@ +diff -Nur -x '*.orig' -x '*~' splix-2.0.0~rc2/src/qpdl.cpp splix-2.0.0~rc2.new/src/qpdl.cpp +--- splix-2.0.0~rc2/src/qpdl.cpp 2008-06-15 11:53:27.000000000 +0200 ++++ splix-2.0.0~rc2.new/src/qpdl.cpp 2008-11-11 16:00:50.000000000 +0100 +@@ -29,7 +29,7 @@ + #include "request.h" + #include "bandplane.h" + +-static bool _renderBand(const Request& request, const Band* band) ++static bool _renderBand(const Request& request, const Band* band, bool mono) + { + unsigned long version, subVersion, compression, size, dataSize, checkSum; + bool color, headerSent=false; +@@ -92,7 +92,7 @@ + size = 0x0; + // Add color information if it's a color printer + if (color) { +- header[size] = plane->colorNr(); // Color number ++ header[size] = mono ? 4 : plane->colorNr(); // Color number + size++; + } + // Append the last information and send the header +@@ -276,7 +276,7 @@ + // Send the page bands + band = page->firstBand(); + while (band) { +- if (!_renderBand(request, band)) ++ if (!_renderBand(request, band, page->colorsNr() == 1)) + return false; + band = band->sibling(); + } --- splix-2.0.0~rc2.orig/debian/patches/no-crash-on-bad-papersize.patch +++ splix-2.0.0~rc2/debian/patches/no-crash-on-bad-papersize.patch @@ -0,0 +1,11 @@ +diff -Nur -x '*.orig' -x '*~' splix-2.0.0~rc2/src/document.cpp splix-2.0.0~rc2.new/src/document.cpp +--- splix-2.0.0~rc2/src/document.cpp 2008-10-03 00:48:50.000000000 +0200 ++++ splix-2.0.0~rc2.new/src/document.cpp 2008-10-04 22:34:17.000000000 +0200 +@@ -129,6 +129,7 @@ + index = pageWidthInB * ((pageHeight - documentHeight)/2); + } + documentHeight -= clippingY; ++ pageHeight -= 2*marginHeight; + clippingY *= colors; + line = new unsigned char[header.cupsBytesPerLine]; + --- splix-2.0.0~rc2.orig/optimized/src/algo0x11.d +++ splix-2.0.0~rc2/optimized/src/algo0x11.d @@ -0,0 +1,3 @@ +$(DEPDIR)/src/algo0x11.d $(BUILDDIR)/src/algo0x11.o: src/algo0x11.cpp \ + include/algo0x11.h include/algorithm.h include/bandplane.h \ + include/errlog.h --- splix-2.0.0~rc2.orig/optimized/src/core.d +++ splix-2.0.0~rc2/optimized/src/core.d @@ -0,0 +1 @@ +$(DEPDIR)/src/core.d $(BUILDDIR)/src/core.o: src/core.cpp include/core.h --- splix-2.0.0~rc2.orig/optimized/src/pstoqpdl.d +++ splix-2.0.0~rc2/optimized/src/pstoqpdl.d @@ -0,0 +1,2 @@ +$(DEPDIR)/src/pstoqpdl.d $(BUILDDIR)/src/pstoqpdl.o: src/pstoqpdl.cpp \ + include/ppdfile.h include/errlog.h include/version.h --- splix-2.0.0~rc2.orig/optimized/src/semaphore.d +++ splix-2.0.0~rc2/optimized/src/semaphore.d @@ -0,0 +1,2 @@ +$(DEPDIR)/src/semaphore.d $(BUILDDIR)/src/semaphore.o: \ + src/semaphore.cpp include/semaphore.h --- splix-2.0.0~rc2.orig/optimized/src/ppdfile.d +++ splix-2.0.0~rc2/optimized/src/ppdfile.d @@ -0,0 +1,2 @@ +$(DEPDIR)/src/ppdfile.d $(BUILDDIR)/src/ppdfile.o: src/ppdfile.cpp \ + include/ppdfile.h include/errlog.h --- splix-2.0.0~rc2.orig/optimized/src/colors.d +++ splix-2.0.0~rc2/optimized/src/colors.d @@ -0,0 +1,2 @@ +$(DEPDIR)/src/colors.d $(BUILDDIR)/src/colors.o: src/colors.cpp \ + include/colors.h include/page.h --- splix-2.0.0~rc2.orig/optimized/src/algo0x13.d +++ splix-2.0.0~rc2/optimized/src/algo0x13.d @@ -0,0 +1,3 @@ +$(DEPDIR)/src/algo0x13.d $(BUILDDIR)/src/algo0x13.o: src/algo0x13.cpp \ + include/algo0x13.h include/errlog.h include/request.h include/printer.h \ + include/printer.h include/bandplane.h --- splix-2.0.0~rc2.orig/optimized/src/rendering.d +++ splix-2.0.0~rc2/optimized/src/rendering.d @@ -0,0 +1,5 @@ +$(DEPDIR)/src/rendering.d $(BUILDDIR)/src/rendering.o: \ + src/rendering.cpp include/rendering.h include/qpdl.h include/page.h \ + include/cache.h include/errlog.h include/colors.h include/request.h \ + include/printer.h include/printer.h include/compress.h \ + include/document.h include/semaphore.h --- splix-2.0.0~rc2.orig/optimized/src/qpdl.d +++ splix-2.0.0~rc2/optimized/src/qpdl.d @@ -0,0 +1,3 @@ +$(DEPDIR)/src/qpdl.d $(BUILDDIR)/src/qpdl.o: src/qpdl.cpp include/qpdl.h \ + include/page.h include/band.h include/errlog.h include/request.h \ + include/printer.h include/bandplane.h --- splix-2.0.0~rc2.orig/optimized/src/document.d +++ splix-2.0.0~rc2/optimized/src/document.d @@ -0,0 +1,3 @@ +$(DEPDIR)/src/document.d $(BUILDDIR)/src/document.o: src/document.cpp \ + include/document.h include/page.h include/errlog.h include/request.h \ + include/printer.h --- splix-2.0.0~rc2.orig/optimized/src/printer.d +++ splix-2.0.0~rc2/optimized/src/printer.d @@ -0,0 +1,3 @@ +$(DEPDIR)/src/printer.d $(BUILDDIR)/src/printer.o: src/printer.cpp \ + include/printer.h include/errlog.h include/request.h include/printer.h \ + include/ppdfile.h --- splix-2.0.0~rc2.orig/optimized/src/request.d +++ splix-2.0.0~rc2/optimized/src/request.d @@ -0,0 +1,2 @@ +$(DEPDIR)/src/request.d $(BUILDDIR)/src/request.o: src/request.cpp \ + include/request.h include/printer.h include/errlog.h include/ppdfile.h --- splix-2.0.0~rc2.orig/optimized/src/compress.d +++ splix-2.0.0~rc2/optimized/src/compress.d @@ -0,0 +1,4 @@ +$(DEPDIR)/src/compress.d $(BUILDDIR)/src/compress.o: src/compress.cpp \ + include/compress.h include/page.h include/band.h include/errlog.h \ + include/request.h include/printer.h include/bandplane.h \ + include/algo0x11.h include/algorithm.h include/algo0x13.h --- splix-2.0.0~rc2.orig/optimized/src/band.d +++ splix-2.0.0~rc2/optimized/src/band.d @@ -0,0 +1,2 @@ +$(DEPDIR)/src/band.d $(BUILDDIR)/src/band.o: src/band.cpp include/band.h \ + include/errlog.h include/bandplane.h --- splix-2.0.0~rc2.orig/optimized/src/algorithm.d +++ splix-2.0.0~rc2/optimized/src/algorithm.d @@ -0,0 +1,2 @@ +$(DEPDIR)/src/algorithm.d $(BUILDDIR)/src/algorithm.o: \ + src/algorithm.cpp include/algorithm.h --- splix-2.0.0~rc2.orig/optimized/src/cache.d +++ splix-2.0.0~rc2/optimized/src/cache.d @@ -0,0 +1,2 @@ +$(DEPDIR)/src/cache.d $(BUILDDIR)/src/cache.o: src/cache.cpp \ + include/cache.h include/page.h include/errlog.h include/semaphore.h --- splix-2.0.0~rc2.orig/optimized/src/bandplane.d +++ splix-2.0.0~rc2/optimized/src/bandplane.d @@ -0,0 +1,2 @@ +$(DEPDIR)/src/bandplane.d $(BUILDDIR)/src/bandplane.o: \ + src/bandplane.cpp include/bandplane.h --- splix-2.0.0~rc2.orig/optimized/src/rastertoqpdl.d +++ splix-2.0.0~rc2/optimized/src/rastertoqpdl.d @@ -0,0 +1,4 @@ +$(DEPDIR)/src/rastertoqpdl.d $(BUILDDIR)/src/rastertoqpdl.o: \ + src/rastertoqpdl.cpp include/cache.h include/errlog.h include/version.h \ + include/request.h include/printer.h include/ppdfile.h \ + include/rendering.h include/options.h --- splix-2.0.0~rc2.orig/optimized/src/page.d +++ splix-2.0.0~rc2/optimized/src/page.d @@ -0,0 +1,2 @@ +$(DEPDIR)/src/page.d $(BUILDDIR)/src/page.o: src/page.cpp include/page.h \ + include/band.h include/errlog.h