Sophie

Sophie

distrib > Mandriva > 8.2 > i586 > media > main-src > by-pkgid > 519bf77df03f74c179842268969ddbf8 > files > 112

printer-drivers-1.0-45mdk.src.rpm

%define mainversion 1.0
%define mainrelease 45mdk
%define ghostscriptver 6.53
%define ghostscriptrel 10mdk
%define gimpprintver 4.2.0
%define gimpprintrel 22mdk
%define foomaticver 1.1
%define foomaticrel 0.20020309mdk
%define cupsdriversver 1.1
%define cupsdriversrel 45mdk
%define omniver 0.5.1
%define omnirel 21mdk

%define pcl3ver	3.3
%define GSx11SVGAmodule 1
%define precompilefoomaticdb 0

Summary: All printer-driver stuff: GhostScript, GIMP-Print, Filters, ...
Name:		printer-drivers
Version:	%{mainversion}
Release:	%{mainrelease}
License:	GPL
Group:		Publishing
URL:		http://www.linuxprinting.org/

##### FOOMATIC BUILDREQUIRES

BuildRequires:	perl-devel perl-Storable >= 0.6.11, perl-libxml-enno >= 1.02, perl-XML-Dumper >= 0.4, perl-XML-Encoding >= 1.01, perl-XML-Twig >= 2.02 perl-XML-Grove

# Pulled in automatically by the usage of the other Perl libraries
#BuildRequires:	perl-DateManip >= 5.39, perl-libxml-perl >= 0.07, perl-Parse-Yapp >= 1.04, perl-XML-Parser >= 2.29

##### GIMP PRINT BUILDREQUIRES

BuildRequires:	libcups-devel 

# Only needed when building GIMP-Print from a CVS snapshot
#BuildRequires: tetex-latex ImageMagick docbook-utils sgml-tools

##### GHOSTSCRIPT BUILDREQUIRES

BuildRequires:  bison flex freetype-devel gettext-devel gimp-devel libnetpbm-devel libpng-devel tetex-dvips libxml-devel VFlib2-devel unzip

%ifarch %ix86
BuildRequires:	svgalib-devel
%endif

##### PRINTER TESTPAGES BUILDREQUIRES

BuildRequires:	transfig

##### PRINTER UTILS BUILDREQUIRES

# Not needed for rebuilding this package, but needed to make the tarball
# with pre-built GUI of drv_z42.
#BuildRequires:	glade

##### GIMP PRINT SOURCE

Source500:	http://gimp-print.sourceforge.net/gimp-print-%{gimpprintver}.tar.bz2
Source501:	gimp-print-foomatic-integrity.bz2

##### GIMP PRINT PATCHES

# Let Foomatic data generation continue when there is no printer for a
# driver
Patch500:	print-4.1.99-Foomatic.patch.bz2

# Fix bug of quality setting being ignored by GhostScript for some printers
# (as the Lexmark Z52)
Patch501:	print-4.1.99-gs-quality.patch.bz2

# Patch to correct marginless printing on the Epson Stylus Photo 890/1290
Patch502:	print-4.1.99-epson-margins.patch.bz2

# Patch for HP DeskJet 810C/812C/840C/842C falling back to "Premium" paper
# when choosing "Glossy" paper with 600x600 dpi C-REt.
Patch503:	print-4.1.99-hp840-glossy.patch.bz2

# Applied GIMP-Print patch to correct print head offsets on Epson Stylus
# Photo 700 (this bug lead to a poor printout quality).
Patch504:	gimp-print-4.2.0-eps700offset.patch.bz2

# Support for small papers on Epson Stylus Pro printers (backported from
# GIMP-Print 4.2.1pre1.
Patch505:	gimp-print-4.2.0-styluspro_smallpaper.patch.bz2

# Let GIMP-Print generate Foomatic data for more printers, especially
# newer Canon inkjets and PCL-5 laser printers.
Patch506:	gimp-print-4.2.0-moreprinters.patch.bz2

##### FOOMATIC SOURCES

Source100:	http://www.linuxprinting.org/foomatic-20020309.tar.bz2
# Printing HOWTO
Source101: 	http://www.linuxprinting.org/Printing-HOWTO-5.15.tar.bz2
# Foomatic data for Lexmark's drivers for the Z22, Z32, and Z52
Source102: 	lexmark-foomatic-kit.tar.bz2

##### OMNI SOURCE

#Source400:	http://www-124.ibm.com/developerworks/oss/linux/projects/omni/Omni-0.4.0.tar.bz2
Source400:	http://www-124.ibm.com/developerworks/oss/linux/projects/omni/Omni-0.5.1.tar.bz2
# Fixed sources for Foomatic (got them personally from the author)
#Source401:      OmniFileChanges.tar.bz2
# Enhanced Foomatic data generator
Source401:	Omni-New-Foomatic.tar.bz2

##### OMNI PATCHES

#This patch is edited, the hunk for inserting "$(DD)omni.dev" in
#unix-gcc.mak is removed. This is already done by Patch0.
#This patch updates the Omni code already included in GhostScript to the
#current version of Omni
Patch400:	Omni.patch.090501.clean.bz2
#Patch400:	Omni.patch.061301.clean.bz2
#Patch400:	Omni.patch.082901.clean.bz2
Patch401:	omni-0.5.1-gcc-2.95.patch.bz2

##### GHOSTSCRIPT SOURCES

Source0:	http://sourceforge.net/projects/ghostscript/ghostscript-%{ghostscriptver}.tar.bz2
Source1:        ftp://ftp.uu.net/graphics/jpeg/jpegsrc.v6b.tar.bz2

# PCL3 driver: Many PCL inkjets, also non-HP
Source5:	http://home.t-online.de/home/Martin.Lottermoser/pcl3dist/pcl3-%{pcl3ver}.tar.bz2

# Epson 740 driver
Source6:	http://lcewww.et.tudelft.nl/~haver/linux/epson.html/epson740.tar.bz2

# Driver for the Lexmark 3200 by Daniel Gordini
Source8:	http://www.geocities.com/dgordini/lxm3200-0.4.1-gs.5.50-src.tar.bz2
Source9:	ghostscript-6.51-lxm3200.contrib.mak.bz2

# Driver for Lexmark 5000 by Peter B. West
Source10:	http://www.powerup.com.au/~pbwest/lexmark/lexmark.html/gdevlx50.c.bz2
Source29:	ghostscript-6.51-lx5000.contrib.mak.bz2

# Driver for Lexmark 5700 by Stephen Taylor
Source11:	http://www.ultranet.com/~setaylor/papers.htm/lxm5700m.tar.bz2

# Support for displaying encrypted PDF files
Source12:	http://www.ozemail.com.au/~geoffk/pdfencrypt/pdf_sec.ps.bz2

# Lexmark 7000, 5700 by H. Paluch
Source13:	gdevlx7.c.bz2
Source14:	gdevlx7-contrib.mak.bz2

# Uniprint driver for the Canon BJC 6000
Source17:	http://www.ph.tum.de/~thaller/bjc6000/bjc6000a1.upp.bz2
Source18:	http://www.ph.tum.de/~thaller/bjc6000/bjc6000b1.upp.bz2

# Driver for the Alps MD xxxx thermal transfer printers
Source20:	http://plaza26.mbn.or.jp/~higamasa/gdevmd2k/gdevmd2k-0.2a.tar.bz2

# Driver for the Samsung SmartGDI printers
Source21:	http://www.linuxprinting.org/download/printing/gdevgdi.c.bz2
Source22:	http://www.linuxprinting.org/download/printing/smartgdi-contrib.mak.bz2

# Additional Uniprint drivers for Epson inkjets
Source23:	http://www.best.com/~murakami/uppfiles/murakami-epson-upp.tar.bz2

# Driver for the HP Business Inkjet 2200 provided by HP
Source24:	http://hp.sourceforge.net/gs-hp2200.php/gs-hp2200.tar.bz2

# Driver for many HP DeskJet printers provided by HP
Source27:	http://hpinkjet.sourceforge.net/hpijs-1.0.3.tar.bz2
# Documentation fixes for HPIJS 1.0
#Source26:	hpijs-1.0_doc_update.tar.bz2

# Driver for the Sharp AJ-1800/2000 inkjets
Source28:	http://www.linuxprinting.org/pipermail/sharp-list/2001q2/000004.html/sharp.upp.bz2

# "GS-CJK Project" sources, see http://www.gyve.org/gs-cjk/ for reference.
# This first tarball is a patch kit, contains all the patches nessesary.
# (dxiaoming@mandrakesoft.com)
Source30:	install-cid.tar.bz2
Source31:	ftp://ftp.gyve.org/pub/gs-cjk/adobe-cmaps-200103.tar.bz2
Source32:	ftp://ftp.gyve.org/pub/gs-cjk/acro4-cmaps-1999.tar.bz2

# Laser printer drivers provided by Epson
Source33:	http://www.epkowa.on.arena.ne.jp/pips/2050.html/eplaseren-1.0.4-550.tar.bz2
#Source34:	epson-gs6.51.mak.bz2
Source34:	eplaseren-1.0.4-gs6.51.mak.bz2

# VFlib stuff (for the japanese printer drivers)
Source37:	gs650-j-vlib.zip

# Hell lot of japanese printers (got it from RedHat)
Source35:	gs550j1.tar.bz2
Source36:	contrib.mak-gsj651.add.bz2

# Drivers for the Canon S400 and BJC-3000, better colour tuning
Source38:	s400a1.upp.bz2
Source39:	s400b1.upp.bz2

##### GHOSTSCRIPT PATCHES

Patch:		ghostscript-6.51-config.patch.bz2
Patch1:		ghostscript-6.51-fontdir.patch.bz2
Patch2:		ghostscript-6.53-devices.patch.bz2
# Some drivers tell that they do random access to the output device
# and so output into a pipe does not work. This patch forces sequential
# access to the output device when it is a pipe. 
Patch3:		ghostscript-6.51-pipefix.patch.bz2
# O_CREAT flags lead to an error when opening a file already opened by
# mkstemp
# This patch breaks GS 6.52 (GS 6.52 cannot create temporary files when this
# patch is applied, found with an HP DeskJet 990 and HPIJS1.0).
Patch4:		ghostscript-6.51-gpmisc-mkstemp.patch.bz2
# License text of src/ijs.mak was wrong.
Patch5:		ghostscript-6.53-ijs-license.patch.bz2
# Fix for duplex printing through IJS from David Suffield
Patch6:		ghostscript-6.53-gdevijs2.patch.bz2

Patch8:		ghostscript-5.50-rth.patch.bz2

# Make the X11 and SVGA devices shared libraries, so that one can use
# GhostScript also on X-less servers
Patch10:	ghostscript-6.51-shared.patch.bz2
Patch11:	ghostscript-6.51-shared-svgalib.patch.bz2
# Re-activate the "x11alpha" (anti-aliasing X11) device
Patch12:	ghostscript-6.53-shared-x11alpha.patch.bz2

# Adaptation to work with gcc 2.96 for Lexmark 7000/5700 driver
Patch16:	gcc2.96.patch.bz2

# Patch to fix a security problems: usage of "mktemp" instead of "mkstemp"
Patch22:	ghostscript-6.51-mkstemp.patch.bz2

# (chmou) Fix glibc-2.2.2 compilation (need an #include <time.h>)
Patch29:	ghostscript-6.51-glibc-2.2.2.patch.bz2

# Patches for the pcl3 driver
Patch33: 	ghostscript-6.51-pcl3-gs_init.ps.patch.bz2
Patch34: 	ghostscript-6.51-pcl3-gs_setpd.ps.patch.bz2
Patch35: 	ghostscript-6.51-pcl3-zmedia2.c.patch.bz2

# Dadou - 5.50-65mdk
Patch36:	ghostscript-6.51-hpijs0.97-remove-D_LITTLE_ENDIAN.patch.bz2

# Fix for duplex printing with HPIJS from David Suffield
Patch30:	hpijs-1.0.3-duplex-b4-b5.patch.bz2
# Fix for printing on A6 paper with HPIJS
Patch31:	hpijs-1.0.3-a6.patch.bz2

# gs-cjk project patch for resource path (dxiaoming@mandrakesoft.com)
Patch37:	lib_gs_res.fontpath.patch.bz2

# Update of the Brother HL-1240/1250 driver to version 0.4
Patch38:	http://www.amelek.gda.pl/gs-hl1250/gnu-gs-6.51-hl1250-patch-0.4.bz2

# Patch to make Epson laser printer drivers working with GhostScript 6.51
# Thanks to Crutcher Dunnavant from Red Het.
Patch45:	ghostscript-6.51-Epson_eplaseren-1.0.4.patch.bz2

# [gg] Patch for dvipdf for better quality PDF output
Patch46:	ghostscript-6.51-dvipdf.patch.bz2

# VFlib stuff (for the japanese printer drivers)

Patch43:	ghostscript-6.51-vflib.fixup.patch.bz2
Patch44:	ghostscript-6.51-config.kfvflib.patch.bz2
Patch47:        vflib-kconfig.patch.bz2

# Patches for japanese printer drivers
Patch39:	ghostscript-6.51-gsj.patch.bz2
Patch40:	ghostscript-6.51-_ds.patch.bz2
Patch41:	ghostscript-6.51-gx_device.patch.bz2
Patch42:	ghostscript-6.51-gsj_update.patch.bz2

# Stew - remove _ds in gdevgdi.c (Samsung gdi)
#Patch48:	ghostscript-6.51-gdevgdi-ppc.patch.bz2
Patch48:	ghostscript-6.53-gdevgdi-ppc.patch.bz2

# Canon BJC-250/-1000 driver for GhostScript from Gergely Szasz (this
# patch is modified, the last two hunks are removed)
Patch49:	http://bjc250gs.sourceforge.net/gs6.50-bjc250-v0.75mdk.patch.bz2

##### PRINTER FILTERS SOURCES 

# Apple StyleWriter
Source50:	http://www.teleport.com/~monroe/styl/stylewriter.tar.bz2

# Canon CaPSL
Source51:	ftp://metalab.unc.edu/pub/Linux/system/printing/cjet089.tar.bz2

# Lexmark 1100
Source52:	http://209.233.17.85/lexmark/lm1100.1.0.tar.bz2

# Lexmark 2070 colour
Source53:	http://www.studet.fh-muenster.de/~kornblum/c2070-0.99.tar.bz2

# Lexmark 2070 grayscale
Source54:	http://www.studet.fh-muenster.de/~kornblum/Lexmark2070.latest.tar.bz2

# Lexmark 7xxx, 57xx, Z51
Source55:	http://bimbo.fjfi.cvut.cz/~paluch/l7kdriver/lexmark7000linux-990516.tar.bz2

# Lexmark Z11
Source56:	http://www.studet.fh-muenster.de/~kornblum/cZ11.tar.bz2

# HP DeskJet PPA printers
Source62:	http://download.sourceforge.net/pnm2ppa/pnm2ppa-1.04.tar.bz2
Source63:	http://www.httptech.com/ppa/files/ppa-0.8.6.tar.bz2

# Lexmark 2050
Source64:	http://www.prato.linux.it/~mnencia/lexmark2050/c2050-0.1.tar.bz2

# Lexmark 2030
Source65:	http://home.fhtw-berlin.de/~s0226426/projects/pbm2l2030-1.4.tar.bz2

# Okipage 4w and compatible winprinters
Source66:	http://www.picante.com/~gtaylor/download/printing/oki4linux-2.0.tar.bz2
Source67:	oki4w.startup.bz2
Source68:	oki4w_install.bz2

# Citizen Printiva 600C
Source69:	http://www.dcs.ed.ac.uk/home/jcb/ppmtocpva-1.0.tar.bz2

# CoStar and compatible label printers
Source70:	http://www.freelabs.com/~whitis/software/pbm2lwxl/pbm2lwxl.tar.bz2

# Driver for the Samsung ML-85G and QL-85G winprinters
Source71:	http://www.pragana.net/ml85p-0.1.0.tar.gz

# Enhanced filter for the Lexmark Z11
Source72:	http://Som_Som.tripod.com/extre/cZ11-1.1.4/cZ11.c.bz2

# Filter for the Lexmark Z42
#
# This tarball has the GUI already pre-built, because it is made with Glade
# and Glade needs a working X display, even in the non-interactive, window-
# less "-w" mode. This tarball was obtained by
#
#    gtar -xvjf drv_z42-0.3.4.tar.bz2
#    cd drv_z42/z42tool/
#    glade -w z42tool.glade
#    cd ../..
#    gtar -cvjf ../drv_z42-0.3.4-pre-built-gui.tar.bz2 drv_z42/
#    rm -rf drv_z42
#
Source73:	http://www.xs4all.nl/~pastolk/drv_z42-0.3.4-pre-built-gui.tar.bz2

# GhostScript wrapper for the Pentax PocketJet printers
Source74:	http://www.pragana.net/pentaxpj-20020301-11.tar.bz2

# Unix driver for MicroDry Printers
Source76:	http://www.dcs.ed.ac.uk/home/jcb/ppmtomd/ppmtomd-1.0.1.tar.bz2

##### PRINTER FILTERS PATCHES 

# Lexmark 1100
Patch50:	lexmark2ppm.pl.patch.bz2

# HP DeskJet PPA printers
Patch52:	pbm2ppa-20000205.diff.bz2

# Fix bug in Lexmark 1100 filter to get it compiled with gcc 2.96
Patch53:	lm1100.1.0-gcc2.96.patch.bz2

# Okipage 4w and compatible winprinters
Patch54:	http://www.picante.com/~gtaylor/download/printing/oki4linux-2.0-daemon-patch.bz2
Patch55:	oki4linux-2.0-daemon-mdk-patch.bz2

##### PRINTER UTILS

# Printer maintenance (All PJL and some Lexmark Optra)
Source57:	http://pup.sourceforge.net/pup_1.1_src.tar.bz2

# Lexmark printer maintenance
Source58:	http://www.powerup.com.au/~pbwest/lexmark/lexmark.html/lxcontrol.tar.bz2
Source59:	http://209.233.17.85/lexmark/lm1100maint.tar.bz2
Source60:	http://bimbo.fjfi.cvut.cz/~paluch/l7kdriver/changecartridge.bz2
Source61:	printutils.png.bz2

# Script to adjust margins and offsets of printed pages
Source75: 	alignmargins.bz2

##### CUPS DRIVERS SOURCES

# CUPS-Drivers package from Sourceforge, only PPD files for native 
# PostScript printers used
Source200: 	ftp://cups.sourceforge.net/pub/cups/cups-drivers/0.3.6/cups-drivers-all-0.3.6.tar.bz2
# Perl script to clean up Manufacturer entries in the PPD files, so that
# drivers are sorted by the printer Manufacturer in the graphical frontends
Source201: 	cleanppd.pl.bz2
# HP's PPD files for the PostScript LaserJets
Source202: 	http://hp.sourceforge.net/hp-ppds-0.4.tar.bz2
# PPD file for a generic PostScript printer (taken from KUPS)
Source203: 	postscript.ppd.bz2

##### CUPS DRIVERS PATCHES

# Fix buggy PPD file
Patch200: cups-drivers-hplj5m_4.ppd.patch.bz2

##### PRINTER TESTPAGES SOURCES

# Mandrakeized CUPS test page
#Source300:	mdk-testprint.ps.bz2
# Mandrakeized Red Hat test pages
#Source301:	rhs-mandrake.tar.bz2
# Mandrakeized printer test pages (originals from CUPS and Red Hat)
Source300:	mdk-testpages.tar.bz2
# Photo test page from GIMP-Print and ESP GhostScript
Source302:	cups-profile.jpg.bz2

##### BUILD ROOT

BuildRoot:	%_tmppath/%name-%version-%release-root

##### PACKAGE DESCRIPTIONS

##### GIMP PRINT

%package -n gimpprint
Version:	%{gimpprintver}
Release:	%{gimpprintrel}
Summary:	GIMP-Print plugin for high-quality image printing
Group:		Publishing
Requires:	gimp libgimpprint1
URL:		http://gimp-print.sourceforge.net/
#BuildArchitectures: %ix86 ia64 ppc alpha

%package -n libgimpprint1
Version:	%{gimpprintver}
Release:	%{gimpprintrel}
Summary:	Shared library for high-quality image printing
Group:		Publishing
URL:		http://gimp-print.sourceforge.net/
Obsoletes:      libgimpprint4
Provides:       libgimpprint4
Provides:       libgimpprint = %{gimpprintver}-%{gimpprintrel}
#BuildArchitectures: %ix86 ia64 ppc alpha

%package -n libgimpprint1-devel
Version:	%{gimpprintver}
Release:	%{gimpprintrel}
Summary:	Headers and links for compiling against libgimpprint
Group:		Development/C
Requires:	libgimpprint1 >= %{gimpprintver}-%{gimpprintrel}
URL:		http://gimp-print.sourceforge.net/
Obsoletes:      libgimpprint4-devel
Provides:       libgimpprint4-devel
Provides:       libgimpprint-devel = %{gimpprintver}-%{gimpprintrel}
Provides:       gimpprint-devel = %{gimpprintver}-%{gimpprintrel}
#BuildArchitectures: %ix86 ia64 ppc alpha

##### FOOMATIC

%package -n foomatic
Version:	%{foomaticver}
Release:	%{foomaticrel}
Summary:        Foomatic printer database and printer admin/printing utils
License:        GPL
Group:          System/Servers
Url:            http://www.linuxprinting.org
Requires:       perl-Storable >= 0.6.11, perl-DateManip >= 5.39, perl-libxml-enno >= 1.02, perl-libxml-perl >= 0.07, perl-Parse-Yapp >= 1.04, perl-XML-Dumper >= 0.4, perl-XML-Encoding >= 1.01, perl-XML-Parser >= 2.29, perl-XML-Twig >= 2.02 perl-XML-Grove mpage nc ghostscript printer-filters
Obsoletes:      rhs-printfilters printtool
Obsoletes:	cups-drivers <= 1.0
#BuildArchitectures: noarch

##### OMNI

%package -n omni
Version:	%{omniver}
Release:	%{omnirel}
Summary:	IBM's Omni printer drivers
Group:		Publishing
Requires:	ghostscript >= 6.51-14mdk libxml foomatic
URL:		http://http://www-124.ibm.com/developerworks/oss/linux/projects/omni/
#BuildArchitectures: %ix86 ia64 ppc alpha

##### GHOSTSCRIPT

%package -n ghostscript
Version:	%{ghostscriptver}
Release:	%{ghostscriptrel}
Summary:	PostScript interpreter and renderer, most printer drivers
Group:		Publishing
Requires:	netpbm /sbin/chkconfig /sbin/service zlib1 libpng
Requires:	urw-fonts >= 1.1, ghostscript-fonts, perl libgimpprint1
Requires:       libintl1 VFlib2
Obsoletes:	ghostscript-PrintOnly pnm2ppa omni < 0.4
%if !%{GSx11SVGAmodule}
Obsoletes:	ghostscript-module-X ghostscript-module-SVGALIB
Provides:	ghostscript-module-X ghostscript-module-SVGALIB
%endif
URL:		http://www.ghostscript.com/
#BuildArchitectures: %ix86 ia64 ppc alpha

%if %{GSx11SVGAmodule}
%package -n ghostscript-module-X
Version:	%{ghostscriptver}
Release:	%{ghostscriptrel}
Summary: PostScript interpreter and renderer (additional support for X)
Group: 		Publishing
PreReq: 	ghostscript, fileutils
Obsoletes: 	ghostscript-X, ghostscript-Both
URL:		http://www.ghostscript.com/
#BuildArchitectures: %ix86 ia64 ppc alpha

%ifarch %ix86
%package -n ghostscript-module-SVGALIB
Version:	%{ghostscriptver}
Release:	%{ghostscriptrel}
Summary: PostScript interpreter and renderer (additional support for SVGALIB)
Group: 		Publishing
PreReq: 	ghostscript, fileutils
Obsoletes: 	ghostscript-SVGALIB, ghostscript-Both
URL:		http://www.ghostscript.com/
#BuildArchitectures: %ix86 ia64 ppc alpha
%endif
%endif

##### PRINTER FILTERS

%package -n printer-filters
Summary: Filters to support additional printers
Group: 		Publishing
PreReq:		ghostscript
Obsoletes:	Apple-StyleWriter-printer-driver__lpstyl
Obsoletes:	Canon-CaPSL-printer-driver__cjet Lexmark-1100-printer-driver__lm1100
Obsoletes:	Lexmark-2070-color-printer-driver__c2070
Obsoletes:	Lexmark-2070-grayscale-printer-driver__Lexmark2070
Obsoletes:	Lexmark-7xxx-57xx-Z51-printer-driver__pbm2l7k
Obsoletes:	Lexmark-Z11-printer-driver__cZ11
Obsoletes:	cjet lm1100 c2070 Lexmark2070 cZ11
#BuildArchitectures: %ix86 ia64 ppc alpha

##### PRINTER UTILS

%package -n printer-utils
Summary: Additional tools for configuring and maintaining printers
Group: 		Publishing
Obsoletes:	ghostscript-utils Lexmark-printer-maintenance
#BuildArchitectures: %ix86 ia64 ppc alpha

##### CUPS DRIVERS

%package -n cups-drivers
Version:	%{cupsdriversver}
Release:	%{cupsdriversrel}
Summary: Special CUPS printer drivers, PPD files for PostScript printers
Requires: 	cups >= 1.1
Group: 		Publishing
#BuildArchitectures: %ix86 ia64 ppc alpha

##### PRINTER TESTPAGES

%package -n printer-testpages
Summary: Test pages to check the output quality of printers
Group: 		Publishing
#BuildArchitectures: %ix86 ia64 ppc alpha

##### DESCRIPTION TEXTS

%description
The "printer-drivers" package is a pseudo-package which does not
produce any binary package called "printer-drivers". It builds all
packages containing either printer driver code or printer driver
descriptions: GhostScript, GIMP-Print, Foomatic, ... This way
duplicate source code (as GIMP-Print) is avoided in the distro. So
once space is saved and second, and that is even more important,
maintenance is simplified.

%description -n gimpprint
This is a plug-in for the GIMP, which allows printing of images and
photos in very high quality on many modern inkjet printers and also
some lasers. Especially on Epson Stylus printers the quality which one
gets under proprietary operating systems is reached, due to Epson
publishing the protocols of their printers, but other brands of
printers give very high qualities, too. It can also output PostScript
to be able to print out of the GIMP on any printer.

%description -n libgimpprint1
This is a high-quality printing library used by the GIMP-Print plugin,
the "stp" color/photo inkjet/laser driver in GhostScript, and by
specialized CUPS drivers.

%description -n libgimpprint1-devel
These are the links and header files to compile applications which should
use the libgimpprint library.

%description -n foomatic
Foomatic is a comprehensive, spooler-independent database of printers,
printer drivers, and driver descriptions. It contains utilities to
generate driver description files and printer queues for CUPS, LPD,
LPRng, and PDQ using the database. There is also the possibility to
read the PJL options out of PJL-capable laser printers and take them
into account at the driver description file generation.
 
There are spooler-independent command line interfaces to manipulate
queues (foomatic-configure) and to print files/manipulate jobs
(foomatic printjob).
 
The site http://www.linuxprinting.org/ is based in this database.

%description -n omni

The Omni printer driver provides support for over 300 printers using
the Ghostscript framework. In addition, it provides a model for
dynamically loading printer drivers, creating new devices by editing
device description files, and simplifies new printer driver
development by allowing for the subclassing of previous device
features.

%description -n ghostscript
Ghostscript is a set of software that provides a PostScript(TM) interpreter,
a set of C procedures (the Ghostscript library, which implements the
graphics capabilities in the PostScript language) and an interpreter for
Portable Document Format (PDF) files. Ghostscript translates PostScript code
into many common, bitmapped formats, like those understood by your printer
or screen. Ghostscript is normally used to display PostScript files and to
print PostScript files to non-PostScript printers.
Most applications use PostScript for printer output.

You should install ghostscript if you need to display PostScript files, or
if you have a non-PostScript printer.

%if %{GSx11SVGAmodule}
%description -n ghostscript-module-X
Ghostscript is a PostScript interpreter. It can render both PostScript
and PDF compliant files to devices which include an X window, many printer
formats (including support for colour printers), and popular graphics
file formats.
This package enhances Ghostscript with X windows support.

%ifarch %ix86
%description -n ghostscript-module-SVGALIB
Ghostscript is a PostScript interpreter. It can render both PostScript
and PDF compliant files to devices which include many printer
formats (including support for colour printers), and popular graphics
file formats.
This package enhances Ghostscript with console output using SVGALIB.
%endif
%endif

%description -n printer-filters
This package contains filters which transfer the raw bitmap of
GhostScript into the protocol of some additional printer models.

%description -n printer-utils
Tools for printer maintenance: Setting default options for most laser
printers (PJL-capable printers), cartridge changing, head aligning,
ink level checking for inkjet printers.

%description -n cups-drivers
This package contains special GIMP-Print printer drivers to be used with
CUPS (and without GhostScript) and also PPD files for native PostScript
printers to be used with CUPS, too.

With the GIMP-Print CUPS drivers you can do a colour caibration. Use
the program "cups-calibrate" to perform it.

%description -n printer-testpages
These are sample files to check the output quality of printers. Thers
is the CUPS test page with colour gradients, the Red Hat test page
with image position checks, a photo test page and a text test page.

%prep
# remove old directory
rm -rf $RPM_BUILD_DIR/printer-drivers-%{mainversion}
mkdir $RPM_BUILD_DIR/printer-drivers-%{mainversion}

##### GIMP PRINT

# unpack main sources
%setup -q -T -D -a 500 -n printer-drivers-%{mainversion}
ln -s gimp-print-%{gimpprintver} print-%{gimpprintver}
cd print-%{gimpprintver}
# Get User's Guide and manual into correct doc directory
cd doc
perl -p -i -e 's!\$\(PACKAGE\)/doc!doc/gimpprint-%{gimpprintver}!g' Makefile.am
perl -p -i -e 's!\$\(PACKAGE\)/doc!doc/gimpprint-%{gimpprintver}!g' users_guide/Makefile.am
perl -p -i -e 's!\$\(PACKAGE\)/doc!doc/gimpprint-%{gimpprintver}!g' Makefile.in
perl -p -i -e 's!\$\(PACKAGE\)/doc!doc/gimpprint-%{gimpprintver}!g' users_guide/Makefile.in
cd ..
#patch500
#patch502
#patch503 -p2
#cd src/ghost
#patch501
#cd ../..
%patch504
%patch505 -p2
%patch506
cd ..
bzcat %{SOURCE501} > gimp-print-foomatic-integrity
chmod a+rx gimp-print-foomatic-integrity

##### FOOMATIC

# Source tree for installation
%setup -q -T -D -a 100 -n printer-drivers-%{mainversion}

# Printing HOWTO
%setup -q -T -D -a 101 -c -n printer-drivers-%{mainversion}/foomatic/pht

# Foomatic data for the Z22, Z32, and Z52 with Lexmark's drivers
%setup -q -T -D -a 102 -n printer-drivers-%{mainversion}/foomatic
 
# Delete drivers which are not on the distro (obsolete drivers which are
# replaced by a new driver with a different name)
# "stp" replaced by "gimp-print"
rm -f db/source/driver/stp.xml
# "cZ11" replaced by "cZ11somsom"
rm -f db/source/driver/cZ11.xml
# "hpdj" replaced by "pcl3"
rm -f db/source/driver/hpdj.xml
# "lxm3200[mcp]" replaced by "lxm3200"
rm -f db/source/driver/lxm3200[mcp].xml
# Japanese drivers which are not in our GhostScript
rm -f db/source/driver/rpdl.xml
rm -f db/source/driver/filter*.xml
rm -f db/source/driver/bjc800j.xml
rm -f db/source/driver/bj10.xml
# Japanese drivers removed from out GhostScript because of incompatibility
# of the VFlib and the backport of the security patch of GhostScript 6.53
rm -f db/source/driver/ljet4pjl.xml
rm -f db/source/driver/lj4dithp.xml
rm -f db/source/driver/dj505j.xml
rm -f db/source/driver/picty180.xml
rm -f db/source/driver/pr201.xml
rm -f db/source/driver/pr150.xml
rm -f db/source/driver/pr1000.xml
rm -f db/source/driver/pr1000_4.xml
rm -f db/source/driver/jj100.xml
rm -f db/source/driver/bj10v.xml
rm -f db/source/driver/bj10vh.xml
rm -f db/source/driver/mag16.xml
rm -f db/source/driver/mag256.xml
rm -f db/source/driver/mj700v2c.xml
rm -f db/source/driver/mj500c.xml
rm -f db/source/driver/mj6000c.xml
rm -f db/source/driver/mj8000c.xml
rm -f db/source/driver/fmpr.xml
rm -f db/source/driver/fmlbp.xml
rm -f db/source/driver/ml600.xml
rm -f db/source/driver/lbp310.xml
rm -f db/source/driver/lbp320.xml
rm -f db/source/driver/lips2p.xml
rm -f db/source/driver/bjc880j.xml
rm -f db/source/driver/lips4.xml
rm -f db/source/driver/lips4v.xml
rm -f db/source/driver/escpage.xml
rm -f db/source/driver/lp2000.xml
rm -f db/source/driver/npdl.xml
rm -f db/source/driver/md50Mono.xml
rm -f db/source/driver/md50Eco.xml
rm -f db/source/driver/md1xMono.xml
# Copy Lexmark stuff into the database
cp lexmark-foomatic-kit/foomatic-db/driver/* db/source/driver
cp lexmark-foomatic-kit/foomatic-db/opt/* db/source/opt
# Delete drivers with empty command line prototype, they would give
# unusable printer/driver combos.
./foomatic-cleanupdrivers .

# Copy of Foomatic for doing the precompilation of the Foomatic database
mkdir .foomatic-db-precompile
cp -ax * .foomatic-db-precompile
mv .foomatic-db-precompile foomatic-db-precompile

##### GHOSTSCRIPT/OMNI

cd $RPM_BUILD_DIR/printer-drivers-%{mainversion}
#
# unpack main sources
%setup -q -T -D -a 0 -n printer-drivers-%{mainversion}
#
# unpack jpeg
%setup -q -T -D -a 1 -n printer-drivers-%{mainversion}/ghostscript-%{ghostscriptver}
# For GhostScript, rename jpeg subdirectory
mv jpeg-6b jpeg
#
# patch the makefile used for build (unix-gcc.mak) according to configuration
# and fontdir modified, after that modify list of devices commonly available.
%patch  -p0 -b .config
%patch1 -p0 -b .fontdir
%patch2 -p0 -b .devices
%patch3 -p0 -b .pipefix
# This patch breaks GS 6.52.
#patch4 -p0 -b .gpmisc
%patch5 -p0 -b .ijsmak
%patch6 -p0 -b .ijsduplex
%ifarch alpha
#patch8 -p1 -b .rth
%endif
# Patch to fix a security problem: Usage of "mktemp" instead of "mkstemp"
#patch22 -p0
#
# Include Matthew J. Gelhaus <mgelhaus@proxis.com> driver to support
# also hp880c/882c and hp895c color printers. This driver is based on
# hp8xx driver release 1.3 from Uli Wortmann <uliw@erdw.ethz.ch> which
# supports hp670, hp672, hp680, hp690, hp850, hp855, hp870, hp890, hp1100,
# hp1600. Photorealistic not supported on hp670 and hp690. 
#
# HP patched the driver to also support the HP Business InkJet 2200
%setup -q -T -D -a 24 -n printer-drivers-%{mainversion}/ghostscript-%{ghostscriptver}
cp gdevcd8.c src
cat <<EOF >>src/contrib.mak

### -------------- chp2200 - HP Business Inkjet 2200 ------------- ###

### NOTE:  Depends on the presence of the cdj850 section above.

\$(DD)chp2200.dev : \$(cdeskjet8_) \$(DD)page.dev
	\$(SETPDEV2) \$(DD)chp2200 \$(cdeskjet8_)

EOF
perl -p -i -e 's/DEVICE_DEVS18=/DEVICE_DEVS18=\$\(DD\)chp2200.dev/' src/unix-gcc.mak
# Add support for some other HP printers
mkdir pcl3
bzip2 -cd %{SOURCE5} | tar xfO - pcl3-%{pcl3ver}/pcl3.tar | \
	tar xf - -C pcl3
cat pcl3/src/contrib.mak-6.50.add >> src/contrib.mak
mv pcl3/lib pcl3/doc/
mv pcl3/ps pcl3/doc/
cp -ax pcl3/doc doc/pcl3
cp pcl3/README doc/README.pcl3
cp pcl3/BUGS doc/BUGS.pcl3
cp pcl3/NEWS doc/NEWS.pcl3
perl -p -i -e 's/pjxl300.dev$/pjxl300.dev \$\(DD\)pcl3.dev \$\(DD\)hpdjplus.dev \$\(DD\)hpdjportable.dev \$\(DD\)hpdj310.dev \$\(DD\)hpdj320.dev \$\(DD\)hpdj340.dev \$\(DD\)hpdj400.dev \$\(DD\)hpdj500.dev \$\(DD\)hpdj500c.dev \$\(DD\)hpdj510.dev \$\(DD\)hpdj520.dev \$\(DD\)hpdj540.dev \$\(DD\)hpdj550c.dev \$\(DD\)hpdj560c.dev \$\(DD\)hpdj600.dev \$\(DD\)hpdj660c.dev \$\(DD\)hpdj670c.dev \$\(DD\)hpdj680c.dev \$\(DD\)hpdj690c.dev \$\(DD\)hpdj850c.dev \$\(DD\)hpdj855c.dev \$\(DD\)hpdj870c.dev \$\(DD\)hpdj890c.dev \$\(DD\)hpdj1120c.dev/' src/unix-gcc.mak
%patch33
%patch34
%patch35

#
# Add support for the Lexmark 3200 series by Daniel Gordini
%setup -q -T -D -a 8 -n printer-drivers-%{mainversion}/ghostscript-%{ghostscriptver}
bzcat %{SOURCE9} >> src/contrib.mak
cp lxm3200-0.4.1-gs.5.50-src/*.c src
cp lxm3200-0.4.1-gs.5.50-src/README doc/README.lxm3200
cp lxm3200-0.4.1-gs.5.50-src/RELEASE_NOTES doc/RELEASE_NOTES.lxm3200
perl -p -i -e 's/stp.dev/stp.dev \$\(DD\)lxm3200.dev/' src/unix-gcc.mak

# Add Lexmark 5000 driver
bzcat %{SOURCE10} > src/gdevlx50.c
bzcat %{SOURCE29} >> src/contrib.mak
perl -p -i -e 's/stp.dev/stp.dev \$\(DD\)lx5000.dev/' src/unix-gcc.mak

%if 0
# Add Lexmark 5700 black and white driver (lxm5700m)
%setup -q -T -D -a 11 -n printer-drivers-%{mainversion}/ghostscript-%{ghostscriptver}
cp lxm5700m/*.c src
cat lxm5700m/contrib.mak >> src/contrib.mak
# Some corrections needed for GhostScript 6.51
perl -p -i -e 's/^lxm5700m.dev/\$\(DD\)lxm5700m.dev/' src/contrib.mak
perl -p -i -e 's/ lxm5700m / \$\(DD\)lxm5700m /' src/contrib.mak
cp lxm5700m/README.* doc
perl -p -i -e 's/stp.dev/stp.dev \$\(DD\)lxm5700m.dev/' src/unix-gcc.mak
%endif

# Add Lexmark 7000/5700 driver (lex5700/7000)
bzcat %{SOURCE13} > src/gdevlx7.c
bzcat %{SOURCE14} >> src/contrib.mak
perl -p -i -e 's/^lex5700=/lex5700_=/' src/contrib.mak
perl -p -i -e 's/^lex5700.dev/\$\(DD\)lex5700.dev/' src/contrib.mak
perl -p -i -e 's/ lex5700 / \$\(DD\)lex5700 /' src/contrib.mak
perl -p -i -e 's/^lex7000.dev/\$\(DD\)lex7000.dev/' src/contrib.mak
perl -p -i -e 's/ lex7000 / \$\(DD\)lex7000 /' src/contrib.mak
perl -p -i -e 's/ page.dev/ \$\(DD\)page.dev/' src/contrib.mak
perl -p -i -e 's/stp.dev/stp.dev \$\(DD\)lex5700.dev \$\(DD\)lex7000.dev/' src/unix-gcc.mak
%ifnarch ppc
cd src
%patch16 -p1
cd ..
%endif

# Add driver for HP DeskJet printers provided by HP
%setup -q -T -D -a 27 -n printer-drivers-%{mainversion}/ghostscript-%{ghostscriptver}
# Documentation fixes for HPIJS 1.0
#setup -q -T -D -a 26 -n printer-drivers-%{mainversion}/ghostscript-%{ghostscriptver}/hpijs-1.0
#cd ..
%ifarch ppc
#patch36 -p1
%endif
#ln -s $RPM_BUILD_DIR/printer-drivers-%{mainversion}/ghostscript-%{ghostscriptver}/hpijs* ../hpijs
cd hpijs*
#cp gdevijs.c gdevijs.h ijs.c ijs.h ijs_client.c ijs_client.h ijs_exec_unix.c unistd_.h ../src
%patch30 -p1 -b .hpijsduplex
%patch31 -p0 -b .hpijsa6
cat <<EOF >> ../src/contrib.mak

### -------------- hpijs - HP DeskJet Printers ------------- ###

### NOTE:  Depends on the presence of the hpijs section above.

# include "hpijs" driver entry
\$(DD)hpijs.dev : \$(hpijs_) \$(DD)page.dev
	\$(SETPDEV) \$(DD)hpijs \$(hpijs_)

#### ------------- IJS Interface -------------- ###
#
#ijs_=\$(GLOBJ)gdevijs.\$(OBJ) \$(GLOBJ)ijs_client.\$(OBJ) \$(GLOBJ)ijs_exec_unix.\$(OBJ) \$(GLOBJ)ijs.\$(OBJ)
#
#\$(GLOBJ)ijs_client.\$(OBJ) : \$(GLSRC)ijs_client.c \$(PDEVH)
#	\$(GLCC) \$(GLO_)ijs_client.\$(OBJ) \$(C_) \$(GLSRC)ijs_client.c
#
#\$(GLOBJ)ijs_exec_unix.\$(OBJ) : \$(GLSRC)ijs_exec_unix.c \$(PDEVH)
#	\$(GLCC) \$(GLO_)ijs_exec_unix.\$(OBJ) \$(C_) \$(GLSRC)ijs_exec_unix.c
#
#\$(GLOBJ)ijs.\$(OBJ) : \$(GLSRC)ijs.c \$(PDEVH)
#	\$(GLCC) \$(GLO_)ijs.\$(OBJ) \$(C_) \$(GLSRC)ijs.c
#
#\$(GLOBJ)gdevijs.\$(OBJ) : \$(GLSRC)gdevijs.c \$(PDEVH)
#	\$(GLCC) \$(GLO_)gdevijs.\$(OBJ) \$(C_) \$(GLSRC)gdevijs.c
#
#\$(DD)ijs.dev : \$(ijs_) \$(DD)page.dev
#	\$(SETPDEV) \$(DD)ijs \$(ijs_)
#
EOF

#perl -p -i -e 's/\$\(DD\)DJ630.dev/\$\(DD\)ijs.dev \$\(DD\)hpijs.dev \$\(DD\)DJ630.dev/' ../src/unix-gcc.mak
perl -p -i -e 's/\$\(DD\)DJ630.dev/\$\(DD\)hpijs.dev \$\(DD\)DJ630.dev/' ../src/unix-gcc.mak

cat <<EOF >LICENSE

License for the HP InkJet Server (/usr/bin/hpijs)
-------------------------------------------------
EOF
head -28 models.cpp | tail -26 >> LICENSE
cd ..

# Add driver for the ALPS MD xxxx thermal transfer printers
%setup -q -T -D -a 20 -n printer-drivers-%{mainversion}/ghostscript-%{ghostscriptver}
cp gdevmd2k-0.2a/*.c src
cat gdevmd2k-0.2a/gdevmd2k.mak-5.8x >> src/contrib.mak
cp gdevmd2k-0.2a/README.jis doc/README.Alps_MD2K_MD5K
perl -p -i -e 's/stp.dev/stp.dev \$\(DD\)md2k.dev \$\(DD\)md5k.dev/' src/unix-gcc.mak

# Add driver for the Samsung SmartGDI printers
bzcat %{SOURCE21} > src/gdevgdi.c
bzcat %{SOURCE22} > smartgdi-contrib.mak
perl -p -i -e 's/^gdi.dev/\$\(DD\)gdi.dev/' smartgdi-contrib.mak
perl -p -i -e 's/ gdi / \$\(DD\)gdi /' smartgdi-contrib.mak
perl -p -i -e 's/ page.dev/ \$\(DD\)page.dev/' smartgdi-contrib.mak
perl -p -i -e 's/ gdevgdi.c / \$\(GLSRC\)gdevgdi.c /' smartgdi-contrib.mak
cat smartgdi-contrib.mak >> src/contrib.mak
perl -p -i -e 's/^DEVICE_DEVS3=/DEVICE_DEVS3=\$\(DD\)gdi.dev /' src/unix-gcc.mak
%ifarch ppc
%patch48 -p1
%endif

# Update of the Brother HL-1240/1250 driver to version 0.4
# Patch on src/time_.h does not apply to GhostScript 6.52, because this is
# already fixed, so ignore the failing of this hunk.
#patch38 -p1
#bzcat %{PATCH38} | patch -p1 || :
#perl -p -i -e 's/\$\(DD\)hl1250.dev/\$\(DD\)hl1240.dev \$\(DD\)hl1250.dev/' src/unix-gcc.mak

# The IBM Omni driver
%setup -q -T -D -a 400 -n printer-drivers-%{mainversion}/ghostscript-%{ghostscriptver}/src
%patch400 -p4
%ifarch ppc
%patch401 -p3
%endif
cd Omni
#Enter data for XML parser integration
perl -p -i -e 's!`pwd`/xml4c3_1_0-linux/lib!/usr/lib!' setit
perl -p -i -e 's!-lxml!-lxml -lz!' XMLParser/Makefile
#mv XMLParser XMLParser.orig
#mv XMLParser.orig/libxml XMLParser
#rm -rf XMLParser.orig
#perl -p -i -e 's!\.\./\.\.!\.\.!g' XMLParser/Makefile
# Avoid Omni searching /usr/lib for driver modules
perl -p -i -e 's!/usr/lib!\.!' setit
%setup -q -T -D -a 401 -n printer-drivers-%{mainversion}/ghostscript-%{ghostscriptver}/src/Omni/Foomatic
mv newDB bin/
cd ../..

# Epson laser printer driver
%setup -q -T -D -a 33 -n printer-drivers-%{mainversion}/ghostscript-%{ghostscriptver}/src
bzcat %{SOURCE34} >> contrib.mak
perl -p -i -e 's/\$\(DD\)stp.dev/\$\(DD\)stp.dev \$\(DD\)alc8500.dev \$\(DD\)alc2000.dev \$\(DD\)epl5900.dev \$\(DD\)epl5800.dev \$\(DD\)epl2050.dev \$\(DD\)epl2050p.dev \$\(DD\)epl2120.dev/' unix-gcc.mak
cd ..
%patch45 -p1

# dvipdf (better PDF output quality)
%patch46 -p1

%if 0
# Add the VFlib/jpdf patch
# The unix-gcc.mak portions of this patch are in the config patch below
mkdir vflib-source
unzip %{SOURCE37} -d vflib-source
%patch43 -p1 -b .vflib.fixup
patch -p1 -b -V simple -z .vflib < vflib-source/gs650-j-vlib.diff || :
# Do the failed hunks
perl -p -i -e 's!\$\(CCLDPLUS\) \$\(LDFLAGS\)!\$\(CCLDPLUS\) \$\(LDFLAGS\) \$\(VFLIBDIRS\)!' src/unixlink.mak
perl -p -i -e 's!\$\(CCLDPLUS\) \$\(LDFLAGS\)!\$\(CCLDPLUS\) \$\(LDFLAGS\) \$\(VFLIBDIRS\)!' src/ugcclib.mak
%patch44 -b .config.kvflib
# Font name fix
%patch47

# Add a monkey-load of Japanese Printers
mkdir gsj
tar xjf %{SOURCE35} -C gsj
# Zap the older version of the okidata driver
rm gsj/gdevop4w.*
# The japanese extension of the cdj* drivers breaks support for the HP
# Business Inkjet 2200
rm gsj/gdevcd8.*
# Get the code to the right place
cp gsj/*.[ch] src/
cp gsj/*.{ps,src} lib/
%patch39 -p1 -b .gsj
# Repair the gsj code
# All the hunks on gdevcd8.c fail because we did not use the japanese
# version of gdevcd8.c. So we use this command line to let the RPM build
# process go on.
bzcat %{PATCH40} | patch -p1 -b --suffix ._ds || :
%patch41 -p1 -b .gx_device
%patch42 -p1 -b .gsj_update
# update the makefiles
bzcat %{SOURCE36} >> src/contrib.mak
perl -p -i -e 's/\$\(DD\)lxm3200.dev/\$\(DD\)lxm3200.dev \$\(DD\)ljet4pjl.dev \$\(DD\)lj4dithp.dev \$\(DD\)dj505j.dev \$\(DD\)picty180.dev \$\(DD\)pr201.dev \$\(DD\)pr150.dev \$\(DD\)pr1000.dev \$\(DD\)pr1000_4.dev \$\(DD\)jj100.dev \$\(DD\)bj10v.dev \$\(DD\)bj10vh.dev \$\(DD\)mag16.dev \$\(DD\)mag256.dev \$\(DD\)mj700v2c.dev \$\(DD\)mj500c.dev \$\(DD\)mj6000c.dev \$\(DD\)mj8000c.dev \$\(DD\)fmpr.dev \$\(DD\)fmlbp.dev \$\(DD\)ml600.dev \$\(DD\)lbp310.dev \$\(DD\)lbp320.dev \$\(DD\)lips2p.dev \$\(DD\)bjc880j.dev \$\(DD\)lips4.dev \$\(DD\)lips4v.dev \$\(DD\)escpage.dev \$\(DD\)lp2000.dev \$\(DD\)npdl.dev \$\(DD\)md50Mono.dev \$\(DD\)md50Eco.dev \$\(DD\)md1xMono.dev/' src/unix-gcc.mak
%endif

# Canon BJC-250/-1000 driver for GhostScript from Gergely Szasz
%patch49 -p1 -b .bjc250gs
perl -p -i -e 's/\$\(DD\)bjc800.dev/\$\(DD\)bjc800.dev \$\(DD\)bjcmono.dev \$\(DD\)bjcgray.dev \$\(DD\)bjccmyk.dev \$\(DD\)bjccolor.dev/' src/unix-gcc.mak

# Support for encrypted PDF files
bzcat %{SOURCE12} > lib/pdf_sec.ps

#
# Add shared library support to ghostscript.
%if %{GSx11SVGAmodule}
bzcat %{PATCH10} | patch -p1
cat <<EOF >>src/unixinst.mak

install-shared: \$(GS_SHARED_OBJS)
	-mkdir \$(gssharedir)
	\$(SH) -c 'for obj in \$(GS_SHARED_OBJS); do \\
	    \$(INSTALL_PROGRAM) \$\$obj \$(gssharedir)/; done'
EOF
%ifarch %ix86
%patch11 -p1
%endif
%patch12 -p1
%endif
# build a small README describing the features available.
cat <<EOF >README.shared
This version of ghostscript support shared module dynamically loaded
at run time.

There are currently two modules compiled with Mandrake version of ghostscript,
one to support all X11 devices (typically used by gv) and another to support
svgalib devices. Look at ghostscript-module-??? packages.

There is no configuration needed, just add (or remove) the package to
add (or remove) the devices concerned in ghostscript.
EOF

# Add support for Epson Stylus 740 through Dale Pontius
# <DEPontius@usa.net>'s uniprint files
%setup -q -T -D -a 6 -n printer-drivers-%{mainversion}/ghostscript-%{ghostscriptver}
mv epson740/*.upp lib

# Add Uniprint driver for the Canon BJC 6000
bzcat %{SOURCE17} > lib/bjc6000a1.upp
bzcat %{SOURCE18} > lib/bjc6000b1.upp

# Add additional Uniprint drivers for the Epson inkjets
%setup -q -T -D -a 23 -n printer-drivers-%{mainversion}/ghostscript-%{ghostscriptver}
mv epsonupp/*.upp lib

# Add sharp.upp Uniprint driver for the Sharp AJ-1800/2000
bzcat %{SOURCE28} > lib/sharp.upp

# Add UPP files for the Canon S400 and BJC-3000
bzcat %{SOURCE38} > lib/s400a1.upp
bzcat %{SOURCE39} > lib/s400b1.upp

# update Makefile with the right one, to be done just before build!
ln -s src/unix-gcc.mak Makefile

# Support for CJK printing: font path (Du Xiaoming)
%patch37 -p0

# (chmou) fix glibc-2.2.2 compilation
%patch29

##### PRINTER FILTERS/UTILS

mkdir $RPM_BUILD_DIR/printer-drivers-%{mainversion}/printer-filters

# Apple StyleWriter
%setup -q -T -D -a 50 -n printer-drivers-%{mainversion}/printer-filters

# Canon CaPSL
%setup -q -T -D -a 51 -n printer-drivers-%{mainversion}/printer-filters

# Lexmark 1100
%setup -q -T -D -a 52 -n printer-drivers-%{mainversion}/printer-filters
# fix to make it compiling with gcc 2.96
%ifnarch ppc
%patch53
%endif
# Patch to make LM 1100 printer emulator script to work
cd lm1100.1.0
%patch50 -p0
cd ..

# Lexmark 2070 colour
%setup -q -T -D -a 53 -c -n printer-drivers-%{mainversion}/printer-filters/c2070-0.99

# Lexmark 2070 grayscale
%setup -q -T -D -a 54 -c -n printer-drivers-%{mainversion}/printer-filters/Lexmark2070.latest

# Lexmark 7xxx, 57xx, Z51
%setup -q -T -D -a 55 -n printer-drivers-%{mainversion}/printer-filters
# Fix Makefile
cd lexmark7000linux-990516
sed "s/-o root -g root//" Makefile > Makefile.new
chmod --reference=Makefile Makefile.new
mv -f Makefile.new Makefile
cd ..

# Lexmark Z11
%setup -q -T -D -a 56 -n printer-drivers-%{mainversion}/printer-filters
bzcat %SOURCE72 > $RPM_BUILD_DIR/printer-drivers-%{mainversion}/printer-filters/LexZ11-distro/cZ11.c

# Printer Utility Program
%setup -q -T -D -a 57 -n printer-drivers-%{mainversion}/printer-filters

# Lexmark printer maintenance
%setup -q -T -D -a 58 -n printer-drivers-%{mainversion}/printer-filters
%setup -q -T -D -a 59 -n printer-drivers-%{mainversion}/printer-filters
bzcat %{SOURCE60} > $RPM_BUILD_DIR/printer-drivers-%{mainversion}/printer-filters/changecartridge
cp $RPM_BUILD_DIR/printer-drivers-%{mainversion}/printer-filters/pup_1.1/README \
	$RPM_BUILD_DIR/printer-drivers-%{mainversion}/printer-filters/README.LexmarkOptra40_45
mv $RPM_BUILD_DIR/printer-drivers-%{mainversion}/printer-filters/lxcontrol/README.Lexmark \
	$RPM_BUILD_DIR/printer-drivers-%{mainversion}/printer-filters/lxcontrol/README.Lexmark5xxx_7xxx
mv $RPM_BUILD_DIR/printer-drivers-%{mainversion}/printer-filters/lm1100maint/README \
	$RPM_BUILD_DIR/printer-drivers-%{mainversion}/printer-filters/lm1100maint/README.Lexmark1xxx

# Generate doc file for "changecartridge"
cat << EOF > $RPM_BUILD_DIR/printer-drivers-%{mainversion}/printer-filters/README.changecartridge

changecartridge - a program for changing the ink cartridges
                  in the Lexmark 5xxx and 7xxx printers.

(C) 1999 Henryk Paluch, paluch@bimbo.fjfi.cvut.cz

To change the ink cartridges in a Lexmark printer you must move the
print head out of its parking corner, so that you can reach the
cartridges. Lexmark only provides a Windows program for doing this. To
not need to boot Windows for changing the cartridges there is this
script. Simply call it with:

   changecartridge

on the command line and follow the steps described on the screen.
The printer is assumed to be at the parallel port #1 (/dev/lp0), but
this setting can be changed by editing the definition of the PORT
variable in /usr/bin/changecartridge.



EOF
# Generate doc file for "README.Lexmark-Maintenance"
cat << EOF > $RPM_BUILD_DIR/printer-drivers-%{mainversion}/printer-filters/README.Lexmark-Maintenance

Lexmark Printer Maintenance Tools
---------------------------------

Programs for maintanance of Lexmark inkjet printers: Moving out the print
head to change the cartridges, adjusting the print heads, cleaning the
nozzles ...

pup           - Graphical program for the Lexmark Optra 40 and 45 printers,
                probably also works for the Lexmark 5xxx and 7xxx, also
                for setting default options on nearly every laser printer

showcartridges
hidecartridges
headalign
headclean     - Command line programs for the Lexmark 5xxx and 7xxx

changecartridge - Another command line tool for changing the
                ink cartridges in the Lexmark 5xxx and 7xxx 

lm1100change,
lm1100back    - Command line tools for changing the cartridge in Lexmark
                1xxx printers

Since Lexmark will not release protocol specifications the authors had
to dissassemble the byte codes sent by their Windows printer maintenance
programs to create this.



EOF

# Load menu icon
bzcat %{SOURCE61} > $RPM_BUILD_DIR/printer-drivers-%{mainversion}/printer-filters/printutils.png

# HP DeskJet PPA printers
%setup -q -T -D -a 62 -n printer-drivers-%{mainversion}/printer-filters
# remove "version ERROR" line from pnm2ppa.conf
perl -n -i -e 'if ( !m/^version\s*ERROR.*$/ ) { print "$_";}' pnm2ppa-1.04/pnm2ppa.conf

# Generate README file
cat <<EOF >README.calibration

Colour calibration for PPA printers
-----------------------------------

If you have an HP DeskJet PPA printer (very cheap models: 710C, 712C,
720C, 722C, 820C, 1000C, or a newer printer which works with one of
these model entries) you can optionally do a colour correction. Do the
following:

Some of the printing modes offer optional colour correction. See the
option "Printing Mode" which is offered to you in the option window of
"printerdrake" and if you use CUPS also in "qtcups" or "kprinter"
("Properties" button, "Advanced" tab), "xpp" ("Options" button,
"Extra" tab), "kups" (right click on printer, "Configure printer" in
menu), or the WWW interface ("Configure printer" button) and if you
use PDQ in "xpdq" ("Driver options"). Choose a setting with "optional
colour correction" and save your settings. Read the file

   /usr/share/doc/printer-filters-1.0/HPDeskJetPPA/pnm2ppa/COLOR.txt

and follow the instructions there, but use the name

   /etc/pnm2ppa.gamma_normal

for the colour correction file for the "normal quality" modes and

   /etc/pnm2ppa.gamma_best

for the colour correction file for the "best quality" modes. So you
can do the colour correction independently in both normal and best
quality modes. The files are automatically taken into account by the
appropriate modes as soon as they are created.



EOF


# pbm2ppa source
%setup -q -T -D -a 63 -n printer-drivers-%{mainversion}/printer-filters
%patch52 -p0

# Lexmark 2050
%setup -q -T -D -a 64 -n printer-drivers-%{mainversion}/printer-filters

# Lexmark 2030
%setup -q -T -D -a 65 -c -n printer-drivers-%{mainversion}/printer-filters/pbm2l2030

# Okipage 4w and compatible winprinters
%setup -T -D -a 66 -n printer-drivers-%{mainversion}/printer-filters
cd oki4linux-2.0
%patch54 -p1
%patch55 -p1
# Do some small corrections in the daemon script:
# - The daemon crashes with "setlogsock('unix');"
# - Correct the path for the driver
cd src
mv oki4daemon oki4daemon.pre
sed "s/setlogsock('unix');/setlogsock('inet');/" oki4daemon.pre | sed "s:/usr/local/sbin/oki4drv:/usr/bin/oki4drv:" > oki4daemon
cd ../..
# Mandrakeized startup script for the daemon
bzcat %{SOURCE67} > $RPM_BUILD_DIR/printer-drivers-%{mainversion}/printer-filters/oki4daemon
# Installer for a CUPS queue for an OKI winprinter
bzcat %{SOURCE68} > $RPM_BUILD_DIR/printer-drivers-%{mainversion}/printer-filters/oki4w_install
# Generate doc file for "README.OKI-Winprinters"
cat << EOF > $RPM_BUILD_DIR/printer-drivers-%{mainversion}/printer-filters/README.OKI-Winprinters

Driver for the OKI 4w and compatible winprinters
------------------------------------------------

These laser printers have neither memory nor a processor and therefore
they must get their data in an absolutely continuous stream (because
they cannot buffer data). This cannot be made sure by usual printing
spoolers (as CUPS or LPD). The only possibility is running a special
driver program which connects directly to the printer. But this is
very unconvenient, because many Linux applications can only print
through a spooler. To solve this, Grant Taylor has created a special
daemon acting between the printing program and the spooler, the
"oki4daemon". It provides a named pipe ("/dev/oki4drv") which accepts
PostScript and renders it for being understood by the printer.

Because "kups" and the web interface of CUPS cannot start an extra
daemon and also cannot set up a queue with "/dev/oki4drv" as
destination, you have to install your OKI printer with a special
installation program. Call it by entering

   oki4w_install

on the command line or by choosing "Configuration"/"Printing"/"Install
OKI 4w or compatible" in the desktop menues.

NOTE: These printers should not be used on machines which are often
under high loads (because of the timing requirements) or on machines
with high security demands (because of the additional daemon).



EOF

# CoStar and compatible label printers
%setup -q -T -D -a 70 -c -n printer-drivers-%{mainversion}/printer-filters/pbm2lwxl

# Citizen Printiva 600C
%setup -q -T -D -a 69 -n printer-drivers-%{mainversion}/printer-filters

# Samsung ML-85G and QL-85G winprinters
%setup -q -T -D -a 71 -n printer-drivers-%{mainversion}/printer-filters

# Filter for the Lexmark Z42
%setup -q -T -D -a 73 -n printer-drivers-%{mainversion}/printer-filters

# GhostScript wrapper for the Pentax PocketJet printers
%setup -q -T -D -a 74 -n printer-drivers-%{mainversion}/printer-filters

# Unix driver for MicroDry Printers
%setup -q -T -D -a 76 -n printer-drivers-%{mainversion}/printer-filters

##### CUPS DRIVERS

mkdir $RPM_BUILD_DIR/printer-drivers-%{mainversion}/cups-drivers

# PPD files for old PostScript printers
%setup -q -T -D -a 200 -n printer-drivers-%{mainversion}/cups-drivers

# Apply patch for buggy ppd file
%patch200 -p0

# Remove CUPS-O-MATIC PPDs
rm -rf cups-drivers-0.3.6/usr/share/cups/model/cups-o-matic

# HP's PPD files for the PostScript LaserJets
%setup -q -T -D -a 202 -n printer-drivers-%{mainversion}/cups-drivers

##### PRINTER TESTPAGES

mkdir $RPM_BUILD_DIR/printer-drivers-%{mainversion}/printer-testpages

# Standard test page, derived from CUPS test page
#bzcat %{SOURCE300} > $RPM_BUILD_DIR/printer-drivers-%{mainversion}/printer-testpages/testprint.ps

# Red Hat test pages
#setup -q -T -D -a 301 -n printer-drivers-%{mainversion}/printer-testpages

# Red Hat test pages
%setup -q -T -D -a 300 -n printer-drivers-%{mainversion}/printer-testpages

# Photo test page
bzcat %{SOURCE302} > $RPM_BUILD_DIR/printer-drivers-%{mainversion}/printer-testpages/photo-testpage.jpg



%build

##### GIMP PRINT

cd $RPM_BUILD_DIR/printer-drivers-%{mainversion}/print-%{gimpprintver}
# Check integrity of src/foomatic/foomatic-printermap
../gimp-print-foomatic-integrity ../foomatic/foomatic-db-precompile/
# "autogen.sh" needed for the case when GIMP-Print driver is from CVS (see
# its README)
# Build with all pipes an whistles: GIMP, GhostScript, CUPS, Foomatic
#./autogen.sh --with-cups --with-user-guide --with-foomatic --with-samples --with-escputil
%configure --with-cups --with-user-guide --with-foomatic --with-samples --with-escputil
#./autogen.sh --with-ghost --with-cups --with-foomatic
#--disable-test
#cat po/Makefile.in > po/Makefile
%make
# Add the "stp" driver to GhostScript
%if 0
cp src/ghost/gdevstp.c ../ghostscript-%{ghostscriptver}/src
cat src/ghost/contrib.mak.addon >> ../ghostscript-%{ghostscriptver}/src/contrib.mak
perl -p -i -e 's/stcolor.dev/stcolor.dev \$\(DD\)stp.dev/' ../ghostscript-%{ghostscriptver}/src/unix-gcc.mak
%endif
cp src/ghost/README ../ghostscript-%{ghostscriptver}/doc/README.stp
# Make "gimp-print.h" accessable as "gimp-print/gimp-print.h" (for 
# GhostScript)
mkdir -p src/include/gimp-print
cp include/gimp-print/gimp-print.h src/include/gimp-print
# Build the Foomatic datafiles (normally done by "make install", but we need
# them now, to build the Foomatic package)
cd src/foomatic
./foomatic-generator
# Remove the hard-coded "foomatic-kitload" from the Makefile because it only
# works on an installed Foomatic database. We do the "foomatic-kitload"
# manually during the further build. The ":" is a neutral shell command, it
# does nothing and exits with 0, independent with which command line options
# it is called.
perl -p -i -e 's/foomatic-kitload/:/' Makefile
cd ../..

##### OMNI

# Omni must be built before Foomatic to get the Omni Foomatic data into
# the Foomatic database
cd $RPM_BUILD_DIR/printer-drivers-%{mainversion}/ghostscript-%{ghostscriptver}/src/Omni
%ifarch ppc
make CFLAGS="-I/usr/include/glib-1.2 -I/usr/lib/glib/include -I .. -I . -I ../hppcl3 -fPIC"
%else
make CFLAGS="$RPM_OPT_FLAGS -I/usr/include/glib-1.2 -I/usr/lib/glib/include -I .. -I . -I ../hppcl3 -fPIC"
%endif
source setit
cd Foomatic
./Foomatic
cd ..
#cd CUPS
#make
#cd ..

##### FOOMATIC

cd $RPM_BUILD_DIR/printer-drivers-%{mainversion}/foomatic

# Use the real file names of the printing utilities to be independent of the
# update-alternatives configuration
make    LPD_LPR=/usr/bin/lpr-lpd \
        LPD_LPQ=/usr/bin/lpq-lpd \
        LPD_LPRM=/usr/bin/lprm-lpd \
        LPD_LPC=/usr/sbin/lpc-lpd \
        CUPS_LPR=/usr/bin/lpr-cups \
        CUPS_LPQ=/usr/bin/lpq-cups \
        CUPS_LPRM=/usr/bin/lprm-cups \
        CUPS_LPC=/usr/sbin/lpc-cups \
        CUPS_LP=/usr/bin/lp-cups \
        CUPS_CANCEL=/usr/bin/cancel-cups \
        CUPS_LPSTAT=/usr/bin/lpstat-cups \
        PDQ_PRINTRC=/etc/pdq/printrc \
        PREFIX=%{_prefix} \
        INSTALLPREFIX=%buildroot

# Add the GIMP-Print and Omni entries, determine the default drivers for the
# printers and then precompile the Foomatic database
cd foomatic-db-precompile
make LIBDIR=. CACHEDIR=./db testing
#./foomatic-kitload -k ../../print-%{gimpprintver}/src/foomatic/foomatic-db
( cd ../../print-%{gimpprintver}/src/foomatic/foomatic-db; tar -cf - * ) | ( tar xvCf db/source - )
# Due to Omni being in experimental state, the Foomatic data for Omni will
# be shipped with the Omni package and (un)installed with the post/preun
# scripts of Omni
# For the Omni drivers "foomatic-kitload" is not used, but "tar" with the
# "-k" option instead, so the original Foomatic printer entries are not
# overwritten by the Omni entries.
#( cd ../../ghostscript-%{ghostscriptver}/src/Omni/Foomatic/foomatic-db; tar -cf - * ) | ( tar -xkf - 2> /dev/null ) || :
# Give low priority to Omni
perl -p -i -e "s/\"sj48\"/\"sj48\",\n                        \"omni\"/" foomatic-preferred-driver
./foomatic-preferred-driver
# Get rid of the old overview without preferred drivers
rm -rf ./db/pcache/* ./db/compiled/*
%if %{precompilefoomaticdb}
# Pre-compile the database
time ./foomatic-compiledb -f -j 2
%else
# This overview contains also the preferred drivers for the printers
./foomatic-configure -O > /dev/null
%endif
cd ..

# Put GIMP-Print data also into the main copy of the database
cp foomatic-db-precompile/db/source/driver/gimp-print*.xml db/source/driver/
cp foomatic-db-precompile/db/source/opt/gimp-print*.xml db/source/opt/
# Due to Omni being in experimental state, the Foomatic data for Omni will
# be shipped with the Omni package and (un)installed with the post/preun
# scripts of Omni
# Put OMNI data into the main copy of the database
#( cd ../ghostscript-%{ghostscriptver}/src/Omni/Foomatic/foomatic-db; tar -cf - * ) | ( tar -xkf - 2> /dev/null ) || :
# Put the printer entries with default drivers into the main database
cp -ax foomatic-db-precompile/db/source/printer db/source

##### GHOSTSCRIPT

cd $RPM_BUILD_DIR/printer-drivers-%{mainversion}/ghostscript-%{ghostscriptver}

# The "-ffastmath" optimization option is removed because it breaks
# IJS/HPIJS (600 dpi on Letter/Legal paper did not work)
make RPM_OPT_FLAGS="${RPM_OPT_FLAGS/-ffast-math/} -I../print-%{gimpprintver}/src/include/" XLDFLAGS="-L../print-%{gimpprintver}/src/main/.libs/ -lgimpprint -lttf" prefix=%{_prefix} gssharedir=%{_libdir}/ghostscript/%{ghostscriptver} docdir=%{_docdir}/ghostscript-%{ghostscriptver}

make RPM_OPT_FLAGS="$RPM_OPT_FLAGS" prefix=%{_prefix} gssharedir=%{_libdir}/ghostscript/%{ghostscriptver} docdir=%{_docdir}/ghostscript-%{ghostscriptver} pcl3opts XLDFLAGS="-lttf"

##### PRINTER FILTERS AND OTHER STUFF

cd $RPM_BUILD_DIR/printer-drivers-%{mainversion}/ghostscript-%{ghostscriptver}

# HPIJS
cd hpijs*
%configure
%make
cd ..

cd $RPM_BUILD_DIR/printer-drivers-%{mainversion}/printer-filters

# Apple StyleWriter
cd stylewriter
gcc ${CFLAGS:-%optflags} -o lpstyl lpstyl.c
cd ..

# Canon CaPSL
cd cjet089
%make
cd ..

# Lexmark 1100
cd lm1100.1.0
%make
cd ..

# Lexmark 2070 colour
cd c2070-0.99
%make
cd ..

# Lexmark 2070 grayscale
cd Lexmark2070.latest
%make
cd ..

# Lexmark 7xxx, 57xx, Z51
cd lexmark7000linux-990516
%make
cd ..

# Lexmark Z11
cd LexZ11-distro
%make
cd ..

# Printer Utility Program
cd pup_1.1
make CC="gcc $CFLAGS -Wall -O2 -I/usr/include/glib-1.2"
cd ..

# HP DeskJet PPA printers
cd pnm2ppa-1.04
make
cd ..
cd pbm2ppa-0.8.6
make
cd ..

# Lexmark 2050
cd c2050-0.1
%make
cd ..

# Lexmark 2030
cd pbm2l2030
%make
cd ..

# Okipage 4w and compatible winprinters
cd oki4linux-2.0/src
%make
cd ../..

# Citizen Printiva 600C
cd ppmtocpva-1.0
%make
cd ..

# CoStar and compatible label printers
cd pbm2lwxl
gcc $CFLAGS -o pbm2lwxl pbm2lwxl.c
cd ..

%ifarch %{ix86}
# Samsung ML-85G and QL-85G winprinters
cd ml85p-driver
make
[ -e printer-test.ps.gz ] && gunzip printer-test.ps.gz
cd ..
%endif

# Filter for the Lexmark Z42
cd drv_z42/src
gcc $CFLAGS -o z42_cmyk z42_cmyk.c
cd ../z42tool/
# We have a pre-built GUI now.
#glade -w z42tool.glade
cd src
patch < interface.c.diff
cd ..
./autogen.sh
make distclean
%configure
%make
cd ../..

# GhostScript wrapper for the Pentax PocketJet printers
cd pentaxpj
%make
cd ..

# Unix driver for MicroDry Printers
cd ppmtomd-1.0.1
%make
cd ..

##### CUPS DRIVERS

cd $RPM_BUILD_DIR/printer-drivers-%{mainversion}/cups-drivers

# Nothing to build

##### PRINTER TESTPAGES

cd $RPM_BUILD_DIR/printer-drivers-%{mainversion}/printer-testpages

# Mandrakeized CUPS test page
cat testprint.prolog.ps.in MDKlinux-ps1.eps testprint.epilog.ps.in > testprint.ps

# Red Hat test pages: Generate PS files of the XFig drawings
fig2dev -Lps -zLetter testpage.fig testpage.ps
fig2dev -Lps -zA4 testpage-a4.fig testpage-a4.ps



%install

rm -rf $RPM_BUILD_ROOT

# Make directories
install -d $RPM_BUILD_ROOT%{_bindir}
install -d $RPM_BUILD_ROOT%{_sysconfdir}
install -d $RPM_BUILD_ROOT%{_mandir}/man1

##### GIMP PRINT

cd $RPM_BUILD_DIR/printer-drivers-%{mainversion}/print-%{gimpprintver}

# Fake the gimptool because it only installs into the root file system and
# not into buildroot
cat >fakedgimptool <<EOF
#!/bin/sh
install -m 755 print $RPM_BUILD_ROOT%{_libdir}/gimp/1.2/plug-ins/
EOF
chmod 755 fakedgimptool

# Make the directory for the GIMP-Plugin
install -d $RPM_BUILD_ROOT%{_libdir}/gimp/1.2/plug-ins/

# Install the files
%old_makeinstall GIMPTOOL=$RPM_BUILD_DIR/printer-drivers-%{mainversion}/print-%{gimpprintver}/fakedgimptool cups_conf_serverbin=$RPM_BUILD_ROOT%{_libdir}/cups cups_conf_datadir=$RPM_BUILD_ROOT%{_datadir}/cups cups_conf_serverroot=$RPM_BUILD_ROOT%{_sysconfdir}/cups
#cd src/cups
#make refresh-data-local
#cd ../..

# Documentation
install -d $RPM_BUILD_ROOT%{_docdir}/gimpprint-%{gimpprintver}
cp ABOUT-NLS AUTHORS COPYING ChangeLog NEWS README doc/users_guide/users-guide.ps $RPM_BUILD_ROOT%{_docdir}/gimpprint-%{gimpprintver}
#cp -ax doc/manual-html $RPM_BUILD_ROOT%{_docdir}/gimpprint-%{gimpprintver}
cp src/cups/README $RPM_BUILD_ROOT%{_docdir}/gimpprint-%{gimpprintver}/README.cups
# Set links so that users find the HTML version of the User's Guide more
# easily
( cd $RPM_BUILD_ROOT%{_docdir}/gimpprint-%{gimpprintver}/html
  ln -s book1.html users_guide.html
)
( cd $RPM_BUILD_ROOT%{_docdir}/gimpprint-%{gimpprintver}/
  ln -s html users-guide-html
)

##### FOOMATIC

cd $RPM_BUILD_DIR/printer-drivers-%{mainversion}/foomatic

eval `perl '-V:installsitelib'`
mkdir -p $RPM_BUILD_ROOT/$installsitelib
export INSTALLSITELIB=$RPM_BUILD_ROOT/$installsitelib
make    PREFIX=%{_prefix} \
        INSTALLPREFIX=%buildroot \
        INSTALLSITELIB=$RPM_BUILD_ROOT/$installsitelib \
        install
%if %{precompilefoomaticdb}
# Copy the precompiled database into the install tree
cd foomatic-db-precompile
mkdir -p %buildroot/var/cache/foomatic
# Only the stuff in /var/cache/foomatic/compiled is important, the rest
# is redundant, unnecessary 50 megs of data.
cp -ax cache/compiled %buildroot/var/cache/foomatic
mkdir -p %buildroot/var/cache/foomatic/pcache
cd ..
%else
# These directories Foomatic generates automatically when the first
# database element is compiled, but we include them to satisfy rpmlint
mkdir -p %buildroot/var/cache/foomatic/pcache
mkdir -p %buildroot/var/cache/foomatic/compiled
# Copy the overview, because it can take some minutes to build it.
#cd foomatic-db-precompile
#cp cache/compiled/overview.xml %buildroot/var/cache/foomatic/compiled
#cd ..
%endif

# Install the scripts for usage of Lexmark's inkjet drivers
install -m 755 lexmark-foomatic-kit/lexmarkwrapper %buildroot%{_bindir}
install -m 755 lexmark-foomatic-kit/lexmarkmaintain %buildroot%{_sbindir}
install -m 755 lexmark-foomatic-kit/lexmarkinstall %buildroot%{_sbindir}

# Install documentation
install -d %buildroot%{_docdir}/foomatic-%{foomaticver}
cp -ax pht/* %buildroot%{_docdir}/foomatic-%{foomaticver}
cp lexmark-foomatic-kit/README %buildroot%{_docdir}/foomatic-%{foomaticver}/README.lexmark
cp README USAGE TODO ChangeLog %buildroot%{_docdir}/foomatic-%{foomaticver}

# Use update-alternatives to make "foomatic-printjob" also possible through
# the usual printing commands
 
( cd $RPM_BUILD_ROOT%{_bindir}
  ln -s foomatic-printjob lpr-foomatic
  ln -s foomatic-printjob lpq-foomatic
  ln -s foomatic-printjob lprm-foomatic
)
( cd $RPM_BUILD_ROOT%{_sbindir}
  ln -s %{_bindir}/foomatic-printjob lpc-foomatic
)

##### OMNI

cd $RPM_BUILD_DIR/printer-drivers-%{mainversion}/ghostscript-%{ghostscriptver}/src/Omni
install -d $RPM_BUILD_ROOT%{_libdir}/Omni
cp -a lib*.so* $RPM_BUILD_ROOT%{_libdir}/Omni
cp -a */lib*.so* $RPM_BUILD_ROOT%{_libdir}/Omni
cp -a Foomatic/foomatic-db/db/source $RPM_BUILD_ROOT%{_libdir}/Omni/foomatic-kit
#cp -a Foomatic CUPS $RPM_BUILD_ROOT%{_libdir}/Omni
cp -a DeviceTester DeviceTester[0-9] omni $RPM_BUILD_ROOT%{_bindir}
install -d $RPM_BUILD_ROOT%{_docdir}/omni-%{omniver}
cp -ax docs/* $RPM_BUILD_ROOT%{_docdir}/omni-%{omniver}

##### GHOSTSCRIPT

cd $RPM_BUILD_DIR/printer-drivers-%{mainversion}/ghostscript-%{ghostscriptver}

mkdir -p $RPM_BUILD_ROOT%{_docdir}
mkdir -p $RPM_BUILD_ROOT%{_docdir}/ghostscript-%{ghostscriptver}
mkdir -p $RPM_BUILD_ROOT%{_libdir}/ghostscript/%{ghostscriptver}
# beware of gssharedir and docdir which are not used by macro by default.
%old_makeinstall gssharedir=$RPM_BUILD_ROOT%{_libdir}/ghostscript/%{ghostscriptver} docdir=$RPM_BUILD_ROOT%{_docdir}/ghostscript-%{ghostscriptver} bindir=$RPM_BUILD_ROOT%{_bindir} man1dir=$RPM_BUILD_ROOT%{_mandir}/man1
find $RPM_BUILD_ROOT%{_mandir} -type f -exec bzip2 -9f {} \;
ln -sf gs.1.bz2 $RPM_BUILD_ROOT%{_mandir}/man1/ghostscript.1.bz2
mv $RPM_BUILD_ROOT%{_bindir}/gs $RPM_BUILD_ROOT%{_bindir}/gs-common
cp -f doc/*.pcl3 doc/*.stp doc/*.lx* doc/*.Alps_MD2K_MD5K $RPM_BUILD_ROOT%{_docdir}/ghostscript-%{ghostscriptver}
cp -af pcl3/doc $RPM_BUILD_ROOT%{_docdir}/ghostscript-%{ghostscriptver}/pcl3-doc
%make prefix=$RPM_BUILD_ROOT/usr gssharedir=$RPM_BUILD_ROOT%{_libdir}/ghostscript/%{ghostscriptver} docdir=$RPM_BUILD_ROOT%{_docdir}/ghostscript-%{ghostscriptver} bindir=$RPM_BUILD_ROOT%{_bindir} man1dir=$RPM_BUILD_ROOT%{_mandir}/man1 pcl3-install

# Install adobe CMap and ToCode CMap from gs-cjk project. (dxiaoming@mandrakesoft.com)
install -d $RPM_BUILD_ROOT%{_prefix}/share/ghostscript/Resource/
install -d $RPM_BUILD_ROOT%{_prefix}/share/ghostscript/Resource/Font
install -d $RPM_BUILD_ROOT%{_prefix}/share/ghostscript/Resource/CIDFont
tar xvjf %{SOURCE30} -C $RPM_BUILD_ROOT%{_prefix}/share/ghostscript/Resource
tar xvjf %{SOURCE31} -C $RPM_BUILD_ROOT%{_prefix}/share/ghostscript/Resource
tar xvjf %{SOURCE32} -C $RPM_BUILD_ROOT%{_prefix}/share/ghostscript/Resource

# Change the truetype font directories correcspondant to the distrubution. (dxiaoming@mandrakesoft.com)
cd $RPM_BUILD_ROOT%{_prefix}/share/ghostscript/Resource
rm -f alias-ac13.sh alias-ag14.sh alias-aj14.sh alias-aj20.sh alias-ak12.sh
sed 's/TTFontDir=\/usr\/local\/share\/fonts\/truetype/TTFontDir=\/usr\/share\/fonts\/ttf\/big5/g' alias-cid.sh > alias-ac13.sh
sed 's/TTFontDir=\/usr\/local\/share\/fonts\/truetype/TTFontDir=\/usr\/share\/fonts\/ttf\/gb2312/g' alias-cid.sh > alias-ag14.sh
sed 's/TTFontDir=\/usr\/local\/share\/fonts\/truetype/TTFontDir=\/usr\/share\/fonts\/ttf\/japanese/g' alias-cid.sh > alias-aj14.sh
sed 's/TTFontDir=\/usr\/local\/share\/fonts\/truetype/TTFontDir=\/usr\/share\/fonts\/ttf\/japanese/g' alias-cid.sh > alias-aj20.sh
sed 's/TTFontDir=\/usr\/local\/share\/fonts\/truetype/TTFontDir=\/usr\/share\/fonts\/ttf\/korean/g' alias-cid.sh > alias-ak12.sh
chmod +x alias-ac13.sh alias-ag14.sh alias-aj14.sh alias-aj20.sh alias-ak12.sh
cd $RPM_BUILD_DIR/printer-drivers-%{mainversion}/ghostscript-%{ghostscriptver}

%if 0
# Documentation
cd gs6.51-cjk-M2-R3
install -d $RPM_BUILD_ROOT%{_docdir}/ghostscript-%{ghostscriptver}/gs6.51-cjk-M2-R3
cp -ax ANNOUNCE README.jp README.en ChangeLog README.kr COPYING NEWS FILES CJKTTCID.INF README.cn README.tw HACKING $RPM_BUILD_ROOT%{_docdir}/ghostscript-%{ghostscriptver}/gs6.51-cjk-M2-R3
cd ..
%endif

##### PRINTER FILTERS AND OTHER STUFF

cd $RPM_BUILD_DIR/printer-drivers-%{mainversion}/ghostscript-%{ghostscriptver}

# HPIJS
cp -f hpijs*/hpijs $RPM_BUILD_ROOT%{_bindir}
install -d $RPM_BUILD_ROOT%{_docdir}/printer-filters-%{mainversion}/HPDeskJetPCL_HPIJS
cp -f hpijs*/*.html hpijs*/*.png hpijs*/LICENSE hpijs*/*append* $RPM_BUILD_ROOT%{_docdir}/printer-filters-%{mainversion}/HPDeskJetPCL_HPIJS

cd $RPM_BUILD_DIR/printer-drivers-%{mainversion}/printer-filters

# Apple StyleWriter
cd stylewriter
# Program files
install -m 755 lpstyl $RPM_BUILD_ROOT%{_bindir}
# Documentation
chmod -R a+rX *
install -d $RPM_BUILD_ROOT%{_docdir}/printer-filters-%{mainversion}/AppleStyleWriter
cp -ax scripts Makefile.atalk README* adsp.* printcap.* styl.ppd \
	$RPM_BUILD_ROOT%{_docdir}/printer-filters-%{mainversion}/AppleStyleWriter
cd ..

# Canon CaPSL
cd cjet089
# Program files
install -m 755 cjet $RPM_BUILD_ROOT%{_bindir}
# Documentation
install -d $RPM_BUILD_ROOT%{_docdir}/printer-filters-%{mainversion}/CanonCaPSL
cp -ax README INSTALL COPYING TODO ChangeLog samples \
	$RPM_BUILD_ROOT%{_docdir}/printer-filters-%{mainversion}/CanonCaPSL
cd ..

# Lexmark 1100
cd lm1100.1.0
# Executables (filter for usage with CUPS and printer emulator script for
# development and debugging (also debugging this RPM w/o Lexmark 1100).
install -m 0755 lm1100 $RPM_BUILD_ROOT%{_bindir}
install -m 0755 lexmark2ppm.pl $RPM_BUILD_ROOT%{_bindir}
install -m 0755 byteutil.pl $RPM_BUILD_ROOT%{_bindir}
# LPD support
install -d $RPM_BUILD_ROOT%{_libdir}/rhs/rhs-printfilters
[ -e ps-to-lm1100.fpi ] || mv ps-to-printer.fpi ps-to-lm1100.fpi # file name conflict
install -m 0755 ps-to-lm1100.fpi $RPM_BUILD_ROOT%{_libdir}/rhs/rhs-printfilters
ln -s %{_bindir}/lm1100 \
	$RPM_BUILD_ROOT%{_libdir}/rhs/rhs-printfilters
# Documentation
install -d $RPM_BUILD_ROOT%{_docdir}/printer-filters-%{mainversion}/Lexmark1100
install -m 0644 LICENSE $RPM_BUILD_ROOT%{_docdir}/printer-filters-%{mainversion}/Lexmark1100
install -m 0644 README $RPM_BUILD_ROOT%{_docdir}/printer-filters-%{mainversion}/Lexmark1100
install -m 0644 RELEASE.txt $RPM_BUILD_ROOT%{_docdir}/printer-filters-%{mainversion}/Lexmark1100
install -m 0644 cmy.txt $RPM_BUILD_ROOT%{_docdir}/printer-filters-%{mainversion}/Lexmark1100
cd ..

# Lexmark 2070 colour
cd c2070-0.99
# Program files
install -m 755 c2070 $RPM_BUILD_ROOT%{_bindir}
# Documentation
install -d $RPM_BUILD_ROOT%{_docdir}/printer-filters-%{mainversion}/Lexmark2070colour
cp -ax README LICENSE \
	$RPM_BUILD_ROOT%{_docdir}/printer-filters-%{mainversion}/Lexmark2070colour
cd ..

# Lexmark 2070 grayscale
cd Lexmark2070.latest
# Program files
install -m 755 Lexmark2070 $RPM_BUILD_ROOT%{_bindir}
# Documentation
install -d $RPM_BUILD_ROOT%{_docdir}/printer-filters-%{mainversion}/Lexmark2070gray
cp -ax README LICENSE \
	$RPM_BUILD_ROOT%{_docdir}/printer-filters-%{mainversion}/Lexmark2070gray
cd ..

# Lexmark 7xxx, 57xx, Z51
cd lexmark7000linux-990516
# Program and data files
%old_makeinstall
# Documentation
install -d $RPM_BUILD_ROOT%{_docdir}/printer-filters-%{mainversion}/Lexmark7xxx_57xx_Z51
install -m 0644 CHANGES $RPM_BUILD_ROOT%{_docdir}/printer-filters-%{mainversion}/Lexmark7xxx_57xx_Z51
install -m 0644 README $RPM_BUILD_ROOT%{_docdir}/printer-filters-%{mainversion}/Lexmark7xxx_57xx_Z51
install -m 0644 lexmark5700-filter $RPM_BUILD_ROOT%{_docdir}/printer-filters-%{mainversion}/Lexmark7xxx_57xx_Z51
install -m 0644 lexmark7000-filter $RPM_BUILD_ROOT%{_docdir}/printer-filters-%{mainversion}/Lexmark7xxx_57xx_Z51
install -m 0644 lexmark7000linux-990516.lsm $RPM_BUILD_ROOT%{_docdir}/printer-filters-%{mainversion}/Lexmark7xxx_57xx_Z51
install -m 0644 lexmarkprotocol.txt $RPM_BUILD_ROOT%{_docdir}/printer-filters-%{mainversion}/Lexmark7xxx_57xx_Z51
install -m 0644 *.p?? $RPM_BUILD_ROOT%{_docdir}/printer-filters-%{mainversion}/Lexmark7xxx_57xx_Z51
cd ..

# Lexmark Z11
cd LexZ11-distro
# Program and data files
install -m 755 cZ11 $RPM_BUILD_ROOT%{_bindir}
install -d $RPM_BUILD_ROOT/etc/LexmarkZ11/
install -m 644 prolog.prn $RPM_BUILD_ROOT/etc/LexmarkZ11/
# Documentation
install -d $RPM_BUILD_ROOT%{_docdir}/printer-filters-%{mainversion}/LexmarkZ11
cp -ax printcap apsfilter LexmarkZ11.html \
	$RPM_BUILD_ROOT%{_docdir}/printer-filters-%{mainversion}/LexmarkZ11
cd ..

# Printer Utility Program
# Program file
install -m 755 pup_1.1/pup $RPM_BUILD_ROOT%{_bindir}
# Documentation
install -d $RPM_BUILD_ROOT%{_docdir}/printer-utils-%{mainversion}/
install -d $RPM_BUILD_ROOT%{_docdir}/printer-utils-%{mainversion}/PUP
cp -ax pup_1.1/README \
	$RPM_BUILD_ROOT%{_docdir}/printer-utils-%{mainversion}/PUP

# Lexmark printer maintenance
# Program and data files
install -m 755 lxcontrol/lx.control $RPM_BUILD_ROOT%{_bindir}
install -m 755 lm1100maint/lm1100change $RPM_BUILD_ROOT%{_bindir}
install -m 755 lm1100maint/lm1100back $RPM_BUILD_ROOT%{_bindir}
install -m 755 changecartridge $RPM_BUILD_ROOT%{_bindir}
mkdir -p $RPM_BUILD_ROOT%{_datadir}/lxcontrol
cp -f lxcontrol/*.out $RPM_BUILD_ROOT%{_datadir}/lxcontrol/
( cd $RPM_BUILD_ROOT%{_bindir}
  ln -s lx.control headclean
  ln -s lx.control headalign
  ln -s lx.control showcartridges
  ln -s lx.control hidecartridges
)
mkdir -p $RPM_BUILD_ROOT%{_datadir}/lm1100maint
cp -f lm1100maint/lexmark* \
	$RPM_BUILD_ROOT%{_datadir}/lm1100maint/
# Documentation
install -d $RPM_BUILD_ROOT%{_docdir}/printer-utils-%{mainversion}/
install -d $RPM_BUILD_ROOT%{_docdir}/printer-utils-%{mainversion}/LexmarkMaintenance
cp -ax README.LexmarkOptra40_45 lxcontrol/README.* lm1100maint/README.* \
	README.changecartridge README.Lexmark-Maintenance \
	$RPM_BUILD_ROOT%{_docdir}/printer-utils-%{mainversion}/LexmarkMaintenance

# Install margin and offset adjustment script in /usr/sbin
bzcat %{SOURCE75} > $RPM_BUILD_ROOT%{_sbindir}/alignmargins

# Install a script to display the test page on the screen for colour
# adjustment
cat <<EOF > $RPM_BUILD_ROOT%{_bindir}/displaytestpage
#!/bin/sh
ps2img="gs -dQUIET -dNOPAUSE -dBATCH -sDEVICE=pnm -r75x75 -sOUTPUTFILE=- -"
testpage=/usr/share/cups/data/testprint.ps

TMPFILE=~/.displaytestpage.pnm
if [ -x /usr/bin/kview ]; then
  cat \$testpage | \$ps2img > \$TMPFILE 
  /usr/bin/kview \$TMPFILE
elif [ -x /usr/bin/ee ]; then
  cat \$testpage | \$ps2img > \$TMPFILE 
  /usr/bin/ee \$TMPFILE
elif [ -x /usr/bin/gqview ]; then
  cat \$testpage | \$ps2img > \$TMPFILE 
  /usr/bin/gqview \$TMPFILE
elif [ -x /usr/bin/xv ]; then
  cat \$testpage | \$ps2img | /usr/bin/xv -
elif [ -x /usr/bin/kghostview ]; then
  /usr/bin/kghostview \$testpage
elif [ -x /usr/X11R6/bin/gv ]; then
  /usr/X11R6/bin/gv \$testpage
elif [ -x /usr/X11R6/bin/ghostview ]; then
  /usr/X11R6/bin/ghostview \$testpage
else
  xmessage "No suitable program for viewing PostScript found, install GhostView, gv, or similar."
  exit 1
fi
rm \$TMPFILE
EOF
chmod a+rx $RPM_BUILD_ROOT/usr/bin/displaytestpage

# Menu entries for printer-utils package
# Menu icon
mkdir -p $RPM_BUILD_ROOT%{_datadir}/icons/locolor/16x16/apps/
install -m 644 printutils.png $RPM_BUILD_ROOT%{_datadir}/icons/locolor/16x16/apps/
# Menu entries
mkdir -p $RPM_BUILD_ROOT/usr/lib/menu
cat <<EOF > $RPM_BUILD_ROOT/usr/lib/menu/printer-utils
?package(printer-utils): needs=X11 \
section=Configuration/Printing \
title="Printer Utility Program" \
longtitle="Graphical tool to set default options in many laser printers and maintenance for inkjets" \
command="/usr/bin/pup" \
icon="%{_datadir}/icons/locolor/16x16/apps/printutils.png"
?package(printer-utils): needs=text \
section=Configuration/Printing \
title="Change Cartridge in a Lexmark 5xxx or 7xxx" \
longtitle="Tool to get the print head out to change the cartridges and to put it back afterwards" \
command="/usr/bin/changecartridge" \
icon="%{_datadir}/icons/locolor/16x16/apps/printutils.png"
?package(printer-utils): needs=text \
section=Configuration/Printing \
title="Command line tools for Lexmark 5xxx or 7xxx" \
longtitle="Printer maintenance commands: Change cartridges, clean nozzles, ..." \
command="/usr/bin/lx.control" \
icon="%{_datadir}/icons/locolor/16x16/apps/printutils.png"
?package(printer-utils): needs=text \
section=Configuration/Printing \
title="Change Cartridge in a Lexmark 1xxx" \
longtitle="To get the print head of the printer accessible" \
command="/usr/bin/lm1100change" \
icon="%{_datadir}/icons/locolor/16x16/apps/printutils.png"
?package(printer-utils): needs=text \
section=Configuration/Printing \
title="Park Cartridge in a Lexmark 1xxx" \
longtitle="To put the print head back into the corner after changing the cartridges" \
command="/usr/bin/lm1100back" \
icon="%{_datadir}/icons/locolor/16x16/apps/printutils.png"
?package(printer-utils): needs=X11 \
section=Configuration/Printing \
title="Display printer test page (for colour adjustment)" \
longtitle="Display printer test page (for colour adjustment)" \
command="/usr/bin/displaytestpage" \
icon="/usr/share/icons/locolor/16x16/apps/printutils.png"
?package(printer-utils): needs=text \
section=Configuration/Printing \
title="Epson inkjet printer maintenance" \
longtitle="Epson inkjet printer maintenance (Head cleaning/alignment, ink level display, ...)" \
command="/usr/bin/man escputil" \
icon="/usr/share/icons/locolor/16x16/apps/printutils.png"
?package(printer-utils): needs=text \
section=Configuration/Printing \
title="Head alignment and nozzle cleaning pages for Z22, Z32, or Z52" \
longtitle="This program needs Lexmark's printer drivers." \
command="%{_bindir}/printerUtilsWaitForKey /usr/sbin/lexmarkmaintain" \
icon="/usr/share/icons/locolor/16x16/apps/printutils.png"
?package(printer-utils): needs=text \
section=Configuration/Printing \
title="Adjust margins and offsets of printed pages" \
longtitle="Adjust the position and the margins of the printed contents on the paper" \
command="%{_bindir}/printerUtilsWaitForKey /usr/sbin/alignmargins" \
icon="/usr/share/icons/locolor/16x16/apps/printutils.png"
?package(printer-utils): needs=text \
section=Configuration/Printing \
title="Calibrate colour printer (GIMP-Print CUPS drivers)" \
longtitle="Calibrate colour printer (GIMP-Print CUPS drivers, 'CUPS + GIMP-print')" \
command="%{_bindir}/printerUtilsWaitForKey /usr/bin/cups-calibrate" \
icon="/usr/share/icons/locolor/16x16/apps/printerutils.png"
?package(printer-utils): needs=X11 \
section=Configuration/Printing \
title="Maintenance tool for Lexmark Z42, Z43, and Z52" \
longtitle="Head alignment, nozzle cleaning, ... for Lexmark Z42, Z43, and Z52" \
command="/usr/bin/z42tool" \
icon="/usr/share/icons/locolor/16x16/apps/printerutils.png"
EOF

# Install a helper script for text mode menu programs to wait for the user
# pressing a key before the window closes
cat <<EOF > $RPM_BUILD_ROOT%{_bindir}/printerUtilsWaitForKey
#!/bin/sh
\$*
echo ''
echo 'Press ENTER to close this window!'
read
EOF

# HP DeskJet PPA printers
cd pnm2ppa-1.04
install -m 0644  docs/en/pnm2ppa.1 $RPM_BUILD_ROOT%{_mandir}/man1
%old_makeinstall INSTALLDIR=$RPM_BUILD_ROOT%{_bindir} CONFDIR=$RPM_BUILD_ROOT%{_sysconfdir} MANDIR=$RPM_BUILD_ROOT%{_mandir}/man1
chmod 0755 $RPM_BUILD_ROOT%{_bindir}/*
install -m 0755 utils/Linux/detect_ppa $RPM_BUILD_ROOT%{_bindir}
install -m 0755 utils/Linux/test_ppa $RPM_BUILD_ROOT%{_bindir}
install -d  $RPM_BUILD_ROOT%{_docdir}/printer-filters-%{mainversion}/HPDeskJetPPA/pnm2ppa
install -m 0644 *.ps $RPM_BUILD_ROOT%{_docdir}/printer-filters-%{mainversion}/HPDeskJetPPA/pnm2ppa
cd docs/en
for file in * ; do
  if  [ -f $file ] ; then
     install -m 0644  $file $RPM_BUILD_ROOT%{_docdir}/printer-filters-%{mainversion}/HPDeskJetPPA/pnm2ppa
  fi
done
rm -f $RPM_BUILD_ROOT%{_docdir}/printer-filters-%{mainversion}/HPDeskJetPPA/pnm2ppa/pnm2ppa.1
cd ../..
cp -ax ppa_protocol rhs-printfilters sample_scripts README.security Changelog $RPM_BUILD_ROOT%{_docdir}/printer-filters-%{mainversion}/HPDeskJetPPA/pnm2ppa
cd ..
cd pbm2ppa-0.8.6
install -m 0755 pbm2ppa  $RPM_BUILD_ROOT%{_bindir}
install -m 0755 pbmtpg   $RPM_BUILD_ROOT%{_bindir}
install -m 0644 pbm2ppa.conf   $RPM_BUILD_ROOT%{_sysconfdir}
install -m 0644 pbm2ppa.1   $RPM_BUILD_ROOT%{_mandir}/man1
install -d  $RPM_BUILD_ROOT%{_docdir}/printer-filters-%{mainversion}/HPDeskJetPPA/pbm2ppa
for file in CALIBRATION CREDITS INSTALL INSTALL-MORE LICENSE README ; do
  if [ -f $file ] ; then
    install -m 0644  $file $RPM_BUILD_ROOT%{_docdir}/printer-filters-%{mainversion}/HPDeskJetPPA/pbm2ppa
  fi
done
cd ..
install -m 0644 README.calibration $RPM_BUILD_ROOT%{_docdir}/printer-filters-%{mainversion}/HPDeskJetPPA

# Lexmark 2050
cd c2050-0.1
# Program file
install -m 0755 c2050 $RPM_BUILD_ROOT%{_bindir}
# Documentation
install -d $RPM_BUILD_ROOT%{_docdir}/printer-filters-%{mainversion}/Lexmark2050
cp -ax README COPYING ps2lexmark \
	$RPM_BUILD_ROOT%{_docdir}/printer-filters-%{mainversion}/Lexmark2050
cd ..

# Lexmark 2030
cd pbm2l2030
# Program file
install -m 0755 pbm2l2030 $RPM_BUILD_ROOT%{_bindir}
# Documentation
install -d $RPM_BUILD_ROOT%{_docdir}/printer-filters-%{mainversion}/Lexmark2030
cp -ax README.TXT LICENSE \
	$RPM_BUILD_ROOT%{_docdir}/printer-filters-%{mainversion}/Lexmark2030
cd ..

# Okipage 4w and compatible winprinters
cd oki4linux-2.0/src
# Program files
install -m 0755 oki4drv $RPM_BUILD_ROOT%{_bindir}
install -d $RPM_BUILD_ROOT%{_sbindir}
install -m 0755 oki4daemon $RPM_BUILD_ROOT%{_sbindir}
cd ../..
install -d $RPM_BUILD_ROOT%{_initrddir}
install -m 0755 oki4daemon $RPM_BUILD_ROOT%{_initrddir}
install -m 0755 oki4w_install $RPM_BUILD_ROOT%{_sbindir}
# Documentation
install -d $RPM_BUILD_ROOT%{_docdir}/printer-filters-%{mainversion}/OKI-Winprinters
cp -ax README.OKI-Winprinters \
	$RPM_BUILD_ROOT%{_docdir}/printer-filters-%{mainversion}/OKI-Winprinters
cd oki4linux-2.0
cp -ax COPYING ChangeLog README crack doc samples \
	$RPM_BUILD_ROOT%{_docdir}/printer-filters-%{mainversion}/OKI-Winprinters
cd src
cp -ax README.oki4daemon align.ps oki4daemon.init \
	$RPM_BUILD_ROOT%{_docdir}/printer-filters-%{mainversion}/OKI-Winprinters
install -m 0644 oki4drv.man $RPM_BUILD_ROOT%{_mandir}/man1/oki4drv.1
cd ../..
# Menu icon
install -m 644 printutils.png $RPM_BUILD_ROOT%{_datadir}/icons/locolor/16x16/apps/OKI4wInst.png
# Menu entries
cat <<EOF > $RPM_BUILD_ROOT/usr/lib/menu/printer-filters
?package(printer-filters): needs=text \
section=Configuration/Printing \
title="Install OKI 4w or compatible" \
longtitle="Install OKI 4w or compatible (this printers need an extra daemon!)" \
command="/usr/sbin/oki4w_install" \
icon="%{_datadir}/icons/locolor/16x16/apps/OKI4wInst.png"
EOF

# Citizen Printiva 600C
cd ppmtocpva-1.0
# Program files
install -m 0755 ppmtocpva $RPM_BUILD_ROOT%{_bindir}
install -m 0755 cpva-colour $RPM_BUILD_ROOT%{_bindir}
# Documentation
install -d $RPM_BUILD_ROOT%{_docdir}/printer-filters-%{mainversion}/CitizenPrintiva600C
cp -ax README \
	$RPM_BUILD_ROOT%{_docdir}/printer-filters-%{mainversion}/CitizenPrintiva600C
cd ..

# CoStar and compatible label printers
cd pbm2lwxl
# Program file
install -m 0755 *2lwxl $RPM_BUILD_ROOT%{_bindir}
# Documentation
install -d $RPM_BUILD_ROOT%{_docdir}/printer-filters-%{mainversion}/DymoCoStarAvery-LabelPrinters
cp -ax README *.html \
	$RPM_BUILD_ROOT%{_docdir}/printer-filters-%{mainversion}/DymoCoStarAvery-LabelPrinters
cd ..

%ifarch %{ix86}
# Samsung ML-85G and QL-85G winprinters
cd ml85p-driver
# Program file
install -m 4750 ml85p $RPM_BUILD_ROOT%{_bindir}
# Documentation
install -d $RPM_BUILD_ROOT%{_docdir}/printer-filters-%{mainversion}/SamsungML-85G
cp -ax COPYING NEWS README ml85-print ml85-test ml85p-0.1.0.lsm printcap \
	printer-test.ps \
	$RPM_BUILD_ROOT%{_docdir}/printer-filters-%{mainversion}/SamsungML-85G
cp -ax ml85p.1 $RPM_BUILD_ROOT%{_mandir}/man1
cd ..
%endif

# Filter for the Lexmark Z42
cd drv_z42/src
# Program file
install -s -m 755 z42_cmyk $RPM_BUILD_ROOT%{_bindir}
cd ../z42tool/
%makeinstall
cd ..
# Documentation
install -d $RPM_BUILD_ROOT%{_docdir}/printer-filters-%{mainversion}/LexmarkZ42
cp -ax COPYING README ChangeLog \
	$RPM_BUILD_ROOT%{_docdir}/printer-filters-%{mainversion}/LexmarkZ42
cd ..

# GhostScript wrapper for the Pentax PocketJet printers
cd pentaxpj
# Program files
install -d $RPM_BUILD_ROOT%{_libdir}/pentaxpj
cp -a BWidget-1.3.1 pentaxpj pentaxsetup pentax.xpm test-page.ps.gz\
	$RPM_BUILD_ROOT%{_libdir}/pentaxpj
ln -s /usr/lib/pentaxpj/pentaxsetup $RPM_BUILD_ROOT%{_sbindir}
ln -s /usr/lib/pentaxpj/pentaxpj $RPM_BUILD_ROOT%{_bindir}
cat > $RPM_BUILD_ROOT%{_sysconfdir}/pentaxpj.conf <<EOF
#
set settings(driverpath) %{_libdir}/pentaxpj
EOF
# Documentation
install -d $RPM_BUILD_ROOT%{_docdir}/printer-filters-%{mainversion}/PentaxPocketJet
cp -ax README \
	$RPM_BUILD_ROOT%{_docdir}/printer-filters-%{mainversion}/PentaxPocketJet
cd ..

# Unix driver for MicroDry Printers
cd ppmtomd-1.0.1
# Program files
install -m 0755 ppmtomd $RPM_BUILD_ROOT%{_bindir}
# Documentation
install -d $RPM_BUILD_ROOT%{_docdir}/printer-filters-%{mainversion}/MicroDryPrinters
cp -ax LICENCE \
	$RPM_BUILD_ROOT%{_docdir}/printer-filters-%{mainversion}/MicroDryPrinters
cp ppmtomd.man $RPM_BUILD_ROOT%{_mandir}/man1/ppmtomd.1
cd ..

##### CUPS DRIVERS

cd $RPM_BUILD_DIR/printer-drivers-%{mainversion}/cups-drivers

# Put the Sourceforge PPDs into CUPS PPD directory
mkdir -p $RPM_BUILD_ROOT%{_datadir}/cups
cp -a cups-drivers-0.3.6/usr/share/cups/model $RPM_BUILD_ROOT%{_datadir}/cups

# Do not leave the PPD directory SO chaotic
( cd $RPM_BUILD_ROOT%{_datadir}/cups/model
  mkdir gimp-print
  mv C/*.gz gimp-print
  #mv C da en_GB fr no pl sv gimp-print
  gunzip gimp-print/*
  #gunzip gimp-print/*/*
  # Delete the PPDs translated to other languages (VERY strong american 
  # accent), these duplicate PPDs only irritate the users.
  rm -rf C da en_GB fr no pl sv 
)

# Install HP's PPD files, only use the english files, CUPS's support for
# having PPDs in various languages is broken.
cp -a hp-ppds-0.4/English $RPM_BUILD_ROOT%{_datadir}/cups/model/HP-PostScript
# Delete PPD files which HP provides for the DeskJets, they are broken
rm -f $RPM_BUILD_ROOT%{_datadir}/cups/model/HP-PostScript/HP_DeskJet*

# Install PPD file for a generic PostScript printer
bzcat %{SOURCE203} > $RPM_BUILD_ROOT%{_datadir}/cups/model/postscript.ppd
# Clean up "postscript.ppd"
perl -p -i -e 's!\*Manufacturer:.*"Postscript"!\*Manufacturer:  "POSTSCRIPT"!;' $RPM_BUILD_ROOT%{_datadir}/cups/model/postscript.ppd
perl -p -i -e 's!Generic postscript printer!Generic PostScript printer!;' $RPM_BUILD_ROOT%{_datadir}/cups/model/postscript.ppd

# Correct permissions of PPD file directory
chmod -R u+w,a+rX $RPM_BUILD_ROOT%{_datadir}/cups/model

# All fine-tuning of the PPD files (as removing undesired PPD files,
# correcting manufacturer entries, adding comments, ...) is done by a
# Perl script, the number of files to process is too big for being
# handled by simple shell command lines and parts of the operations
# are too complicated to do them with a shell script.

# Uncompress Perl script for cleaning up the PPD files
bzcat %{SOURCE201} > ./cleanppd.pl
chmod a+rx ./cleanppd.pl
# Do the clean-up
find $RPM_BUILD_ROOT%{_datadir}/cups/model -name "*.ppd" -exec ./cleanppd.pl '{}' \;

##### PRINTER TESTPAGES

cd $RPM_BUILD_DIR/printer-drivers-%{mainversion}/printer-testpages

mkdir $RPM_BUILD_ROOT%{_datadir}/printer-testpages
cp *.ps *.jpg *.asc $RPM_BUILD_ROOT%{_datadir}/printer-testpages


# Leave in a defined state to pack the files
cd $RPM_BUILD_DIR/printer-drivers-%{mainversion}



%files -n gimpprint
%defattr(-,root,root)
%{_libdir}/gimp/1.2/plug-ins/print

%files -n libgimpprint1
%defattr(-,root,root)
%docdir %{_docdir}/gimpprint-%{gimpprintver}
%{_docdir}/gimpprint-%{gimpprintver}
%{_datadir}/info/gimpprint*
%{_datadir}/locale/*
%{_datadir}/gimp-print/samples
%{_libdir}/libgimpprint.so.*

%files -n libgimpprint1-devel
%defattr(-,root,root)
%{_libdir}/libgimpprint.so
%{_libdir}/libgimpprint.la
%{_libdir}/libgimpprint.a
%{_includedir}/gimp-print
%{_datadir}/aclocal/*
%{_mandir}/man1/gimpprint-config*
%{_mandir}/man3/gimpprint*
%{_bindir}/gimpprint-config

%files -n foomatic
%defattr(-,root,root)
%docdir %{_docdir}/foomatic-%{foomaticver}
%{_docdir}/foomatic-%{foomaticver}
%_bindir/foomatic*
%_bindir/*omatic
%_bindir/lexmarkwrapper
%_sbindir/foomatic*
%_sbindir/*omatic
%_libdir/perl5/site_perl/5.6.1/Foomatic
%_libdir/cups/filter/cupsomatic
%_libdir/ppr/interfaces/ppromatic
%_datadir/foomatic
%{_mandir}/man?/foomatic*
%{_mandir}/man?/*omatic.*
/var/cache/foomatic
%dir %config(noreplace) %{_sysconfdir}/foomatic
%config(noreplace) %{_sysconfdir}/foomatic/filter.conf

%files -n omni
%defattr(-,root,root)
%docdir %{_docdir}/omni-%{omniver}
%{_docdir}/omni-%{omniver}
%{_libdir}/Omni
%{_bindir}/omni
#{_bindir}/setit
%{_bindir}/DeviceTester*

%files -n ghostscript
%defattr(-,root,root)
%docdir %{_docdir}/ghostscript-%{ghostscriptver}
%{_docdir}/ghostscript-%{ghostscriptver}
%dir %{_datadir}/ghostscript
%dir %{_datadir}/ghostscript/%{ghostscriptver}
%{_datadir}/ghostscript/%{ghostscriptver}/examples
%{_datadir}/ghostscript/%{ghostscriptver}/lib
#{_datadir}/ghostscript/%{ghostscriptver}/vflib
%{_datadir}/ghostscript/Resource
%{_mandir}/man1/dvipdf*
%{_mandir}/man1/eps2eps*
%{_mandir}/man1/font2c*
%{_mandir}/man1/ghost*
%{_mandir}/man1/gs*
%{_mandir}/man1/p[c-m]*
%{_mandir}/man1/p[q-z]*
%{_mandir}/man1/[q-z]*
%{_bindir}/bdftops
%{_bindir}/dvipdf
%{_bindir}/eps2eps
%{_bindir}/font2c
%{_bindir}/gsbj
%{_bindir}/gsdj
%{_bindir}/gsdj500
%{_bindir}/gslj
%{_bindir}/gslp
%{_bindir}/gsnd
%{_bindir}/pdf2dsc
%{_bindir}/pdf2ps
%{_bindir}/pdfopt
%{_bindir}/pf2afm
%{_bindir}/pfbtopfa
%{_bindir}/printafm
%{_bindir}/ps2ascii
%{_bindir}/ps2epsi
%{_bindir}/ps2pdf
%{_bindir}/ps2pdf12
%{_bindir}/ps2pdf13
%{_bindir}/ps2pdfwr
%{_bindir}/ps2ps
%{_bindir}/fixmswrd.pl
%{_bindir}/wftopfa
%{_bindir}/gs-common

%if %{GSx11SVGAmodule}
%files -n ghostscript-module-X
%defattr(-,root,root)
%doc ../ghostscript-%{ghostscriptver}/README.shared
%dir %{_libdir}/ghostscript/%{ghostscriptver}
%{_libdir}/ghostscript/%{ghostscriptver}/X11.so

%ifarch %ix86
%files -n ghostscript-module-SVGALIB
%defattr(-,root,root)
%doc ../ghostscript-%{ghostscriptver}/README.shared
%dir %{_libdir}/ghostscript/%{ghostscriptver}
%{_libdir}/ghostscript/%{ghostscriptver}/lvga256.so
%{_libdir}/ghostscript/%{ghostscriptver}/vgalib.so
%endif
%endif

%files -n printer-filters
%defattr(-,root,root)
%docdir %{_docdir}/printer-filters-%{mainversion}
%{_docdir}/printer-filters-%{mainversion}
%config(noreplace) %{_sysconfdir}/*.conf
%config(noreplace) %{_sysconfdir}/LexmarkZ11
%{_mandir}/man1/pnm2ppa.1*
%{_mandir}/man1/pbm2ppa.1*
%{_mandir}/man1/oki4drv.1*
%{_mandir}/man1/ppmtomd.1*
%ifarch %{ix86}
%{_mandir}/man1/ml85p.1*
%endif
%{_libdir}/rhs
%{_bindir}/lpstyl
%{_bindir}/cjet
%{_bindir}/lm1100
%{_bindir}/c2070
%{_bindir}/Lexmark2070
%{_bindir}/pbm2l7k
%{_bindir}/pnmraw2cmyk
%{_bindir}/psprint
%{_bindir}/pscprint
%{_bindir}/pnm2lex7000
%{_bindir}/pnm2lex5700
%{_bindir}/pbm2lex5700
%{_bindir}/dbman
%{_bindir}/cZ11
%{_bindir}/pnm2ppa
%{_bindir}/calibrate_ppa
%{_bindir}/detect_ppa
%{_bindir}/test_ppa
%{_bindir}/pbm2ppa
%{_bindir}/pbmtpg
%{_bindir}/c2050
%{_bindir}/pbm2l2030
%{_bindir}/oki4drv
%{_bindir}/ppmtocpva
%{_bindir}/cpva-colour
%{_bindir}/*2lwxl
%{_bindir}/pcl3opts
%{_bindir}/hpijs
%{_bindir}/z42_cmyk
%{_bindir}/pentaxpj
%{_bindir}/ppmtomd
%ifarch %{ix86}
# "ml85p" talks directly to the parallel port I/O 0x378, not to /dev/lp0
# Therefore SUID "root" is needed. Program only executable by "lp" & "root"
# (group-executable).
%attr(4750,root,sys) %{_bindir}/ml85p
%endif
%{_sbindir}/oki4daemon
%{_sbindir}/oki4w_install
%{_sbindir}/pentaxsetup
%{_libdir}/pentaxpj
%config(noreplace) %{_initrddir}/oki4daemon
%config(noreplace) %{_sysconfdir}/pentaxpj.conf
%{_menudir}/printer-filters
%{_datadir}/icons/locolor/16x16/apps/OKI4wInst.png

%files -n printer-utils
%defattr(-,root,root)
%docdir %{_docdir}/printer-utils-%{mainversion}
%{_docdir}/printer-utils-%{mainversion}
%{_datadir}/lm1100maint
%{_datadir}/lxcontrol
%{_datadir}/cups/calibrate.ppm
%{_datadir}/z42tool
%{_menudir}/printer-utils
%{_datadir}/icons/locolor/16x16/apps/printutils.png
%{_mandir}/man1/escputil*
%{_mandir}/man8/cups-calibrate*
%{_sbindir}/lexmarkmaintain
%{_sbindir}/lexmarkinstall
%attr(0755,root,root) %{_sbindir}/alignmargins
%{_bindir}/cups-calibrate
%{_bindir}/displaytestpage
%{_bindir}/escputil
%{_bindir}/lexmark2ppm.pl
%{_bindir}/byteutil.pl
%{_bindir}/pup
%{_bindir}/lx.control
%{_bindir}/changecartridge
%{_bindir}/lm1100change
%{_bindir}/lm1100back
%{_bindir}/showcartridges
%{_bindir}/hidecartridges
%{_bindir}/headclean
%{_bindir}/headalign
%{_bindir}/z42tool
%{_bindir}/printerUtilsWaitForKey

%files -n cups-drivers
%defattr(-,root,root)
%{_datadir}/cups/model
%attr(0755,root,root) %{_libdir}/cups/backend
%attr(0755,root,root) %{_libdir}/cups/filter/command*
%attr(0755,root,root) %{_libdir}/cups/filter/rastertoprinter
%config(noreplace) %{_sysconfdir}/cups/*

%files -n printer-testpages
%defattr(-,root,root)
%{_datadir}/printer-testpages

%post -n libgimpprint1
/sbin/ldconfig

%post -n foomatic
# Set up update-alternatives entries
%{_sbindir}/update-alternatives --install %{_bindir}/lpr lpr %{_bindir}/lpr-foomatic 1
%{_sbindir}/update-alternatives --install %{_bindir}/lpq lpq %{_bindir}/lpq-foomatic 1
%{_sbindir}/update-alternatives --install %{_bindir}/lprm lprm %{_bindir}/lprm-foomatic 1
%{_sbindir}/update-alternatives --install %{_sbindir}/lpc lpc %{_sbindir}/lpc-foomatic 1
# Flush the cache
rm -rf /var/cache/foomatic/*/*

%post -n omni
echo "%{_libdir}/Omni" >> %{_sysconfdir}/ld.so.conf
#echo `ls -1 %{_libdir}/Omni | grep -v "^lib" | grep -v "^CUPS" | grep -v "^Foomatic" | grep -v "^foomatic-db"` >> %{_sysconfdir}/ld.so.conf
/sbin/ldconfig
# To install the Omni Foomatic data "foomatic-kitload" is not used,
# but "tar" with the "-k" option instead, so the original Foomatic
# printer entries are not overwritten by the Omni entries.
( cd %{_libdir}/Omni/foomatic-kit; tar -cf - * ) | ( cd %{_datadir}/foomatic/db/source; tar -xkf - 2> /dev/null ) || :
# Flush the Foomatic cache and determine the recommended drivers taking Omni
# into account
rm -rf /var/cache/foomatic/*/*
%{_sbindir}/foomatic-preferred-driver > /dev/null 2>&1
rm -rf /var/cache/foomatic/*/*

%post -n ghostscript
/bin/ln -sf %{_bindir}/gs-common %{_bindir}/gs
/bin/ln -sf %{_bindir}/gs-common %{_bindir}/ghostscript

%post -n printer-filters
%update_menus
# Restart the oki4daemon when it is running, but do not activate it by
# default. It blocks the parallel port for non-OKI devices.
if [ $1 <> 1 ]; then
    service oki4daemon condrestart > /dev/null 2>/dev/null || :
fi

%post -n printer-utils
%update_menus

%preun -n foomatic
if [ "$1" = 0 ]; then
  # Remove cache
  rm -rf /var/cache/foomatic/*/*
  # Remove update-alternatives entries
  %{_sbindir}/update-alternatives --remove lpr /usr/bin/lpr-foomatic
  %{_sbindir}/update-alternatives --remove lpq /usr/bin/lpq-foomatic
  %{_sbindir}/update-alternatives --remove lprm /usr/bin/lprm-foomatic
  %{_sbindir}/update-alternatives --remove lpc /usr/sbin/lpc-foomatic
fi

%preun -n printer-filters
#Stop oki4daemon when uninstalling printer-filters
%_preun_service oki4daemon

%postun -n libgimpprint1
/sbin/ldconfig

%postun -n omni
if [ "$1" = 0 ]; then
	perl -n -i -e 'if ( !m/Omni/ ) { print "$_";}' %{_sysconfdir}/ld.so.conf
	/sbin/ldconfig
	# Remove Foomatic data of Omni
	rm -f %{_datadir}/foomatic/db/source/*/omni*.xml
	rm -f `grep -l "Foomatic entry automatically generated by Omni" %{_datadir}/foomatic/db/source/printer/*.xml`
	# Clean up Foomatic (Cache, recommended drivers)
	rm -rf /var/cache/foomatic/*/*
	%{_sbindir}/foomatic-preferred-driver > /dev/null 2>&1
	rm -rf /var/cache/foomatic/*/*
fi

%postun -n ghostscript
if [ "$1" = 0 ]; then
	rm -f %{_bindir}/gs %{_bindir}/ghostscript
fi

%postun -n printer-filters
if [ "$1" -ge "1" ]; then
	/sbin/service oki4daemon condrestart >/dev/null 2>&1
fi
%clean_menus

%postun -n printer-utils
%clean_menus

%clean
rm -rf $RPM_BUILD_ROOT


%changelog
* Sat Mar  9 2002 Till Kamppeter <till@mandrakesoft.com> 1.0-45mdk
- Updated Foomatic to the state of the 09/03/2002 (Added Canon BJC-255SP and
  BJC-265SP to the printer database, HPIJS B4/B5 paper size fix, "Photo Full
  Bleed" paper size in HPIJS only for HP PhotoSmart P100).
- Patched HPIJS to print correctly on A6 paper.

* Fri Mar  8 2002 Till Kamppeter <till@mandrakesoft.com> 1.0-44mdk
- New HPIJS patch from David Suffield: It fixes not only the duplex but
  also printing on B4 and B5 paper.

* Thu Mar  7 2002 Till Kamppeter <till@mandrakesoft.com> 1.0-43mdk
- Updated Foomatic to the state of the 07/03/2002 (When "foomatic-configure"
  creates a queue for LPRng, the permissions for the /var/log/lp-errs file
  are set correctly now).
- Updated the "pentaxpj" driver to version 20020301-11.

* Wed Mar  6 2002 Till Kamppeter <till@mandrakesoft.com> 1.0-42mdk
- Added a patch for duplex printing with HPIJS from David Suffield.

* Wed Mar  6 2002 Till Kamppeter <till@mandrakesoft.com> 1.0-41mdk
- Updated Foomatic to the state of the 05/03/2002 (New HP multi-function
  devices: HP OfficeJet D series, HP LaserJet 33xx MFP series, added
  Lexmark E210, bug in reading defaults of float options from PPD files
  fixed, fixed Red Hat bug 58319, fixed quoting in driver command line for 
  PDQ, assured that "foomatic-gswrapper" is used for every driver).
- Added fix for duplex printing through IJS from David Suffield.

* Mon Mar  4 2002 Till Kamppeter <till@mandrakesoft.com> 1.0-40mdk
- Updated Foomatic to the state of the 04/03/2002 (Brother MFC 9600
  prints 600 dpi with "hl1250", HP DeskJet 610CL prints best with "hpijs", 
  HP DeskJet 1125C and LaserJet 6P print best with GIMP-Print, fix for
  option default choices with "+" character in PPD files, fix with PJL on
  "lpdomatic").
- Applied fix from Andre Duclos (shirka@wanadoo.fr). The package did not
  build on his machine without the fix ("foomatic-kitload" replaced by
  "tar" to add the GIMP-Print XML files to the Foomatic database).
- Patched GIMP-Print to produce Foomatic data for the HP DeskJet 1125C and
  LaserJet 6P.

* Fri Mar  1 2002 Till Kamppeter <till@mandrakesoft.com> 1.0-39mdk
- Updated Foomatic to the state of the 01/03/2002 (Many new printers,
  especially Canon, "ppmtomd" driver, DeskJets have "hpijs" as default
  driver).
- Added "ppmtomd": Unix driver for MicroDry Printers.
- Patched GIMP-Print to produce Foomatic data for more printers.
- Reworked patch 48, because PPC compilation was broken (Stew Benedict).

* Thu Feb 28 2002 Till Kamppeter <till@mandrakesoft.com> 1.0-38mdk
- Fixed chinese character support in GhostScript 6.53 (Du Xiaoming).

* Mon Feb 25 2002 Till Kamppeter <till@mandrakesoft.com> 1.0-37mdk
- Re-activated the "x11alpha" (anti-aliasing X11) device, it was deactivated
  in GhostScript 6.53 (Francois Pons).
- Removed the "-ffastmath" optimization option from the GhostScript
  compilation. it breaks IJS/HPIJS (600 dpi on Letter/Legal paper did not
  work)

* Thu Feb 21 2002 Till Kamppeter <till@mandrakesoft.com> 1.0-36mdk
- Updated Foomatic to the state of the 20/02/2002 (HPIJS 1.0.3, bugfixes).
- Updated GhostScript to version 6.53 to fix a rather serious security
  problem, which allowed PostScript code to execute arbitrary commands.
  It has also the IJS plug-in interface and CJK support integrated.
- Removed VFlib support and the VFlib-based drivers for japanese printers
  from GhostScript. The patches do not compile under GhostScript 6.53 due
  to the changes introduced with the security fix.
- Updated patches for X11 and SVGAlib drivers to be shared libraries for
  GhostScript 6.53 (Francois Pons).
- Fixed bug in the printer test pages which prevented native PostScript
  printers (PS Level 1 & 2) fromm printing the Mandrake logo.
- Corrected /usr/sbin/alignmargins to work with any GhostScript version.
- Patched GIMP-Print to support small paper sizes on Epson Stylus Pro 
  printers.

* Tue Feb  5 2002 Till Kamppeter <till@mandrakesoft.com> 1.0-35mdk
- Updated Foomatic to the state of the 05/02/2002 (Support for HPOJ,
  bugfixes).
- Fixed Omni compilation for PPC (Stew Benedict).
- Used %%ix86 macro (suggestion from Jeff Garzik)
- Used "drv_z42" tarball with pre-built Glade GUI because Glade needs
  a working X display, even in the window-less "-w" mode (bug reported
  by Jeff Garzik).

* Thu Jan 24 2002 Till Kamppeter <till@mandrakesoft.com> 1.0-34mdk
- Applied GIMP-Print patch to correct print head offsets on Epson Stylus
  Photo 700 (this bug lead to a poor printout quality).
- Updated Foomatic to the state of the 24/01/2002 (Epson EPL-5900 works
  better with "pxlmono").

* Sun Jan 20 2002 Till Kamppeter <till@mandrakesoft.com> 1.0-33mdk
- Updated HPIJS to version 1.0.2.
- Updated drv_z42 to version 0.3.4.
- Updated Foomatic to the state of the 20/01/2002 (PPD file fix for
  GhostScript 6.52).

* Fri Jan 18 2002 Till Kamppeter <till@mandrakesoft.com> 1.0-32mdk
- Updated the Epson-Kowa laser printer drivers to version 1.0.4, to
  support also the Epson EPL-5900 and the Epson EPL-N2120.
- Updated Foomatic to the state of the 18/01/2002 (New Epson lasers).

* Wed Jan 16 2002 Till Kamppeter <till@mandrakesoft.com> 1.0-31mdk
- Updated the "hpijs" driver to version 1.0.1 (bugfixes and completely free
  license).
- Updated Foomatic to the state of the 16/01/2002 (CUPS queues are set up 
  with PPD-O-Matic PPDs, auto-detection of file converters, bug fixes).

* Tue Jan 15 2002 Till Kamppeter <till@mandrakesoft.com> 1.0-30mdk
- Updated GhostScript to version 6.52.
- Updated gs-cjk to M2-R3 (xming).
- Updated Foomatic to the state of the 14/01/2002 (several bugfixes).
- Removed slashes from menu entry for the Z42/Z43 maintenance tool.
- Removed Patch4, GS 6.52 could not create temporary files when this
  patch was applied (Found with an HP DeskJet 990 and HPIJS1.0).

* Wed Jan 11 2002 Till Kamppeter <till@mandrakesoft.com> 1.0-29mdk
- Added Canon BJC-250/-1000 driver for GhostScript from Gergely Szasz
- Updated Foomatic to the state of the 11/01/2002 ("bjc250gs" driver data,
  several bugfixes).

* Tue Jan  1 2002 Till Kamppeter <till@mandrakesoft.com> 1.0-28mdk
- Updated Foomatic to the state of the 01/01/2002 (Worked around a bug in
  HPIJS 1.0 which breaks the paper size setting via PostScript commands).

* Fri Dec 21 2001 Till Kamppeter <till@mandrakesoft.com> 1.0-27mdk
- Updated the "hpijs" driver to version 1.0.
- Updated Foomatic to the state of the 20/12/2001.
- Used "%%make" instead of "make" for the Omni driver and added 
  "CFLAGS=$RPM_OPT_FLAGS ..." so that $RPM_OPT_FLAGS is used.
- Made GIMP-Print user's guide being included.
- Added GhostScript wrapper for the Pentax PocketJet series.
- ml85p works again, re-activated.

* Wed Dec 05 2001 Till Kamppeter <till@mandrakesoft.com> 1.0-26mdk
- Rebuilt and re-introduced to the Cooker, the package was automatically
  deleted by a bug in new upload scripts.

* Thu Nov 29 2001 Till Kamppeter <till@mandrakesoft.com> 1.0-25mdk
- Updated "pcl3" driver to version 3.3.
- Updated Omni to version 0.5.1.
- Updated Foomatic to the state of the 30/11/2001.

* Sat Nov 24 2001 Till Kamppeter <till@mandrakesoft.com> 1.0-24mdk
- Updated Lexmark Z42/Z43 driver (drv_z42) to version 0.3.3.
- Updated GIMP-Print to version 4.2.0 final.
- Updated Foomatic to the state of the 24/11/2001.

* Tue Nov 20 2001 Till Kamppeter <till@mandrakesoft.com> 1.0-23mdk
- Made Omni data only visible when Omni is installed, Omni is still in
  experimental state
- Updated Foomatic to the state of the 20/11/2001 (Updated docs).
- Omni produced garbage in /etc/ld.so.conf, fixed.

* Fri Nov 16 2001 Till Kamppeter <till@mandrakesoft.com> 1.0-22mdk
- Added "z42tool" a maintenance tool for the Lexmark Z42
- Updated GIMP-Print to version 4.1.99rc1.
- Updated Foomatic to the state of the 16/11/2001.
- Added "$CFLAGS" to all direct calls of gcc (to allow cross-compiling the 
  package).
- Added patch to build Samsung SmartGDI printer driver - PPC (Stew)
- Reworked hpijs ENDIAN patch - PPC (Stew)
- Added "unzip" to the BuildRequires.
- Fixed libgimpprint info file entry (/usr/share/info/dir conflict) (Stefan
  van der Eijk)
- Removed obselete BuildRequires: docbook-style-dsssl ghostscript jadetex
  openjade perl-DateManip perl-Parse-Yapp perl-XML-Parser perl-libxml-perl
  tetex (Stefan van der Eijk)
- New %%makeinstall totally broken, replaced by %%old_makeinstall

* Sun Oct 21 2001 Till Kamppeter <till@mandrakesoft.com> 1.0-21mdk
- Corrected path setting for libxml in "setit" file and XML parser 
  Makefile of Omni
- New Foomatic data generator with cleaned-up printer, manufacturer, 
  option, and choice names.

* Wed Oct 17 2001 Till Kamppeter <till@mandrakesoft.com> 1.0-20mdk
- Updated Omni to version 0.5.0 (bugfixes, new printers)
- Updated GIMP-Print from CVS (bugfixes, new printers, User's Guide)
- Added Foomatic data for Omni
- Rebuilt GIMP-Print for libgimp1.2_1
- ml85p does not work with current kernel, deactivated

* Wed Oct 10 2001 Till Kamppeter <till@mandrakesoft.com> 1.0-19mdk
- Inserted new Mandrake logo in the alternative test pages
- GIMP-Print patch to make "Glossy" paper with 600x600 dpi working on the
  HP DeskJet 810C/812C/840C/842C (fall back to "Premium" paper).
- Updated Foomatic: new printers, removed HP LaserJet 6L from
  "lj5gray"/"lj5mono" drivers.

* Wed Oct 10 2001 Till Kamppeter <till@mandrakesoft.com> 1.0-18mdk
- Added driver for the Lexmark Z42
- inserted new Mandrake logo in test page
- Corrected marginless printing on the Epson Stylus Photo 890/1290

* Thu Oct  4 2001 Till Kamppeter <till@mandrakesoft.com> 1.0-17mdk
- Updated Foomatic: Paper tray selection for all PCL lasers, new printer
  models, various bugfixes.
- Updated GIMP-Print from CVS: near 4.1.99b3 (bugfixes)
- Added BuidRequires: libcups-devel, all Perl libraries needed to run 
  Foomatic
- Really make ml85p %%{ix86}-specific
- Fix of some font names in kconfig.ps of vflib

* Tue Sep 25 2001 Till Kamppeter <till@mandrakesoft.com> 1.0-16mdk
- Fixed bug of sometimes options defined in the Foomatic database missing
  in the driver description files for the spoolers.
- Fixed bug of the Lexmark Z23, Z33, and Z53 not working with Lexmark's
  drivers.
- Changed priorities to make the "lxm3200" driver the default driver for
  the Lexmark 3200, GIMP-Print is broken for this printer.

* Sun Sep 23 2001 Till Kamppeter <till@mandrakesoft.com> 1.0-15mdk
- Fixed bug of GhostScript ignoring the "Quality" option on the Lexmark Z52
  and other printers (GIMP-Print driver).

* Sat Sep 22 2001 Till Kamppeter <till@mandrakesoft.com> 1.0-14mdk
- Fixed the "lexmarkwrapper" so that it works also with LPRng and PDQ.
- Fixed "foomatic-configure" to call "checkpc -f" after every manipulation
  of LPRng queues, this corrects the permissions so that LPRng does not
  refuse to print.

* Fri Sep 21 2001 Till Kamppeter <till@mandrakesoft.com> 1.0-13mdk
- Updated to GIMP-Print 4.1.99 beta 2 final (Fix for Epson Stylus Color 660,
  it only spilled empty pages before).

* Wed Sep 19 2001 Till Kamppeter <till@mandrakesoft.com> 1.0-12mdk
- Updated GIMP-Print from CVS: near 4.1.99b2 (Fix of Epson output quality
  settings).
 
* Sat Sep 15 2001 Till Kamppeter <till@mandrakesoft.com> 1.0-11mdk
- Removed automatic ownership/permission setting for /dev/oki4drv in the
  oki4daemon.

* Sat Sep 15 2001 Till Kamppeter <till@mandrakesoft.com> 1.0-10mdk
- Activated "cfax" driver in GhostScript (for capifax, isdn4k-utils,
  Bugzilla 3923)

* Thu Sep 13 2001 Till Kamppeter <till@mandrakesoft.com> 1.0-9mdk
- Patched dvipdf for better quality PDF output (patch from Giuseppe Ghibo)
- Made cupsomatic handling the "sides" (Duplex) option of CUPS handling
  correctly.

* Wed Sep 12 2001 Till Kamppeter <till@mandrakesoft.com> 1.0-8mdk
- Foomatic updated for new inkjet drivers from Lexmark.
- HP LaserJet 5L does not work with lj5gray/lj5mono drivers, fixed.
- Options with On/Off, Yes/No, or True/False as choices broken, fixed.
- Removed entries for japanese printer drivers which are not supported
  by our GhostScript.

* Mon Sep  3 2001 Till Kamppeter <till@mandrakesoft.com> 1.0-7mdk
- foomatic-configure supports setting a default printer now.
- Documentation files of Foomatic updated.
- Alps MD-1500 works also with the "ppmtocpva" driver.
- Updated GIMP-Print from CVS: 4.1.99b1.
- Adapted libgimpprint(-devel) packages to the library policy.

* Sun Sep  2 2001 Till Kamppeter <till@mandrakesoft.com> 1.0-6mdk
- Foomatic overview generation also accelerated with the C program, so also
  the overview does not need to be pre-built.
- Bugfix in the determination of the default driver
  (foomatic-preferred-driver), for some printers the default driver entry
  did not get into the printer XML file.
- Added Apple LaserWriter 4/600.
- The HP LaserJet 5Si and 3200se support PJL, fixed appropriate database
  entries.
- Various small fixes on the Foomatic database.

* Tue Aug 28 2001 Till Kamppeter <till@mandrakesoft.com> 1.0-5mdk
- Foomatic data generation accelerated substancially by a C program,
  so no pre-building of the Foomatic data necessary any more (saves 30 h
  of package build time and 30 MB of disk space on the destination machine).
- Added HP and Apollo printers: Apollo P-2100, P-2150, HP DeskJet 816C,
  980C, e-printer e20, PhotoSmart P1215, P1218, OfficeJet K60, K80, V40,
  PSC 300, 750.
- Added new Epson EPL and AcuLaser printers.
- Added HP DesignJet 750 (supported by GIMP-Print).
- Updated Foomatic data for the hpijs driver (inkjet driver of HP).
- Updated the Brother HL-1240/1250 driver to version 0.4.
- Added Omni 0.4.
- Added the laser printer drivers provided by Epson.
- Added the japanese printer drivers from Red Hat.
- Check whether the printer list of GIMP-Print does not contain printers
  not existing in the Foomatic database.
- Updated GIMP-Print from CVS: 4.1.99a3.
- Adapted "alignmargins" script to GhostScript 6.51 and fixed a bug of the
  CUPS default printer not being listed.
- Foomatic obsoletes out the rhs-printfilters and printtool packages now.

* Sun Aug 12 2001 Till Kamppeter <till@mandrakesoft.com> 1.0-4mdk
- Let printer-filters not activate the oki4daemon by default

* Sat Aug 11 2001 Till Kamppeter <till@mandrakesoft.com> 1.0-3mdk
- Fixes on the usage of rlpr, nc, and smbclient by foomatic-configure

* Thu Aug  9 2001 Till Kamppeter <till@mandrakesoft.com> 1.0-2mdk
- Precompiled Foomatic database

* Sun Aug  5 2001 Till Kamppeter <till@mandrakesoft.com> 1.0-1mdk
- GhostScript was not able to open temporary files, removed O_CREAT flags
  in src/gpmisc.c to fix it (ghostscript-6.51-10mdk).
- New CVS of GIMP-Print 4.1.99a2.
- Added Foomatic.
- Added tools and PostScript PPDs from former cups-drivers package.
- Updated "ppmtocpva" driver to version 1.0.
- Added some different test pages.

* Fri Aug  3 2001 Till Kamppeter <till@mandrakesoft.com> 1.0-0.1mdk
- New CVS of GIMP-Print 4.1.99a2.
- GhostScript requires libpng and libintl1.
- Let all packages providing printer drivers being built by
  the "printer-drivers" source package,
  merged the source RPM/specfile of ghostscript, foomatic, cups-drivers,
  and the GIMP-Print plugin for GIMP together, because they all depend on
  the same GIMP-Print source tarball.