%define orig_name rhs-printfilters
%define version 1.81

Summary: Vine Linux Print Filter System
Summary(ja): Vine Linux 印刷フィルター・システム

Name: vine-printfilters
Version: %{version}
Release: 1%{?_dist_release}
License: GPL
Group: Applications/Publishing
Source0: rhs-printfilters-%{version}.tar.gz
Source1: testpages-vine.tar.gz
Source2: printerdb-1.81.ja
# Vine patch
Patch0: printerdb-vine.diff
Patch1: vine-printfilters-1.81-2.diff
Patch2: rhs-printfilters-1.81-pips5.patch
Patch5: rhs-printfilters-1.81-lang.patch
# security fix
Patch6: rhs-printfilters-1.63-PARANOIDSAFER.patch
#BuildPreReq: transfig >= 3.2.3c
Requires: mpage >= 2.4, lpr >= 0.17, ghostscript >= 5.10, findutils >= 4.1-23, nkf, pnm2ppa, diffutils, sed
Obsoletes: rhs-printfilters
Provides: rhs-printfilters
Buildroot: %{_tmppath}/%{name}-root

Vendor: Project Vine
Distribution: Vine Linux

#
# these conflcts exists because Dr Mike changes the location of the filters
#
Conflicts: libgr-progs < 2.0.9-7

%description
The vine-printfilters package contains a set of print filters which
are primarily meant to be used with the Vine printtool.  These
print filters provide an easy way for users to handle printing
numerous file formats.

%description -l ja
vnie-printfilters パッケージには Vine printtool で使用される
印刷フィルタが含まれています。これらの印刷フィルターは様々な
ファイルフォーマットの印刷を使用者が簡単に取り扱えるように
なっています。

%prep
%setup -q -a 1 -n rhs-printfilters-%{version}
cp %SOURCE2 printerdb.ja
%patch0     -b .db
%patch1 -p1 -b .filter

%ifarch i386 i486 i586 i686
%patch2 -p1 -b .epson
%endif

%patch5 -p1 -b .lang
%patch6 -p1

%build
cp testpages-vine/testpage* .
cp testpages-vine/vinelogos* .

%install
rm -rf %{buildroot}

mkdir -p INSTALL_DIR=%{buildroot}/usr/lib/rhs/rhs-printfilters
make INSTALLBIN="install -m0755" INSTALLDATA="install -m0644" \
	INSTALL_DIR=%{buildroot} install
#cp %SOURCE2 $RPM_BUILD_ROOT/usr/lib/rhs/rhs-printfilters/printerdb.ja
install -m 644 printerdb.ja %{buildroot}/usr/lib/rhs/rhs-printfilters

%clean 
rm -rf %{buildroot}

%pre
# Requires:
# bash, sed, grep, diff, rm, cat
# Where is the printcap?
PRINTCAP='/etc/printcap'
# Where is the master filter?
MASTER_FILTER='/usr/lib/rhs/rhs-printfilters/master-filter'
# Make sure that we actually have these files
if [ -f $PRINTCAP ] && [ -f $MASTER_FILTER ]
then
# Open printcap
cat $PRINTCAP | (
        # Read each line (forcing it to ignore the '\' convention).
        while read -r line;
        do
                # if a line looks like ':if=filename:', but aint commented,
                if echo ${line} | grep -q -E -e '^[^#]{0}[[:space:]]*:if='
                then
                        # strip it down to the file name,
                        # (We can be a little messy, 'cause printcap uses
                        # ':' as a control character, to it can't be in
                        # the file name)
                        FILTER=`echo ${line} | sed -e 's/^:if=//; s/:.*//'`
                        # and if the filter it names is the same as the
                        # master-filter, or does not exist, then
                        case $FILTER in
                        "/var/spool/lpd/"*"/filter" )
                                # All filters we want to find match this pattern
                                if [ ! -a $FILTER ] || diff -q $MASTER_FILTER $FILTER > /dev/null
                                then
                                        # remove the named filter
                                        rm -f $FILTER

                                        # Adjust the printcap file to use the
                                        # master filter directly
                                        sed -e "s:$FILTER:$MASTER_FILTER:g" < $PRINTCAP > $PRINTCAP.tmp
                                        mv $PRINTCAP.tmp $PRINTCAP
                                fi
                                ;;

                        * )
                                ;;
                        esac
                fi
        done
)
fi

%files
%defattr(-,root,root)
%doc README READMEj CHANGES
%dir /usr/lib/rhs/rhs-printfilters
/usr/lib/rhs/rhs-printfilters/asc-to-escp
/usr/lib/rhs/rhs-printfilters/asc-to-escpage
/usr/lib/rhs/rhs-printfilters/asc-to-lips3
/usr/lib/rhs/rhs-printfilters/asc-to-npdl
/usr/lib/rhs/rhs-printfilters/asc-to-printer.fpi
/usr/lib/rhs/rhs-printfilters/asc-to-ps.fpi
/usr/lib/rhs/rhs-printfilters/general.cfg.in
/usr/lib/rhs/rhs-printfilters/master-filter
/usr/lib/rhs/rhs-printfilters/postscript.cfg.in
/usr/lib/rhs/rhs-printfilters/printerdb
/usr/lib/rhs/rhs-printfilters/printerdb.ja
/usr/lib/rhs/rhs-printfilters/ps-to-printer.fpi
/usr/lib/rhs/rhs-printfilters/rpm-to-asc.fpi
/usr/lib/rhs/rhs-printfilters/ncpprint
/usr/lib/rhs/rhs-printfilters/ppaprint
/usr/lib/rhs/rhs-printfilters/smbprint
/usr/lib/rhs/rhs-printfilters/directprint
/usr/lib/rhs/rhs-printfilters/testpage.asc
/usr/lib/rhs/rhs-printfilters/testpage.euc
/usr/lib/rhs/rhs-printfilters/testpage.jis
/usr/lib/rhs/rhs-printfilters/testpage.sj
/usr/lib/rhs/rhs-printfilters/testpage.ps
/usr/lib/rhs/rhs-printfilters/testpage-a4.ps
/usr/lib/rhs/rhs-printfilters/textonly.cfg.in

%changelog
* Sat Aug 16 2008 Shu KONNO <owa@bg.wakwak.com> 1.81-1vl5
- applied new versioning policy, spec in utf-8

* Sat Jul 19 2003 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 1.81-0vl10
- rebuilt and docdir moved to /usr/share/doc
- s/Copyright/License/

* Wed Mar  6 2002 Jun Nishii <jun@vinelinux.org> 1.81-0vl9
- add lang patch again

* Wed Jan 30 2002 Jun Nishii <jun@vinelinux.org> 1.81-0vl8
- added pips (ver.2.x) entries in printerdb
  (rhs-printfilters-1.81-pips5.patch)

* Fri Jan 25 2002 Jun Nishii <jun@vinelinux.org> 1.81-0vl7
- added pips/eplaser entries in printerdb
  (rhs-printfilters-1.81-pips4.patch)
- security fix 
	* added rhs-printfilters-1.63-PARANOIDSAFER.patch
	* replace %pre by the script in rhs-printfilters-1.63-4.rh6.2j.src.rpm
	  so as not to put filter in spool directory

* Sun Apr  8 2001 Jun Nishii <jun@vinelinux.org> 1.81-0vl6
- added many newest pips filters(670,780,880,900,2200,3300,3500)
  by epson kowa

* Sun Apr  8 2001 Jun Nishii <jun@vinelinux.org> 1.81-0vl5
- added eplaser db by epson kowa

* Thu Feb 15 2001 Jun Nishii <jun@vinelinux.org>
- 1.81-0vl4
- added pips db epson kowa

* Wed Feb 14 2001 Jun Nishii <jun@vinelinux.org>
- 1.81-0vl3
- bug fix in ps-to-printer.fpi, thanks Mr. Masaki Kawamura
- added lang patch to exec gs on LANG env.

* Fri Feb  9 2001 Jun Nishii <jun@vinelinux.org>
- 1.81-0vl2
- try to merge Duplex patch

* Mon Oct 30 2000 Jun Nishii <jun@vinelinux.org>
- 1.81-0vl1

* Sun Oct  8 2000 Jun Nishii <jun@vinelinux.org>
- 1.63-0vl3
- bug fix for GSDriver: EPSONc and EPSON in printerdb.ja
  by Nobuyuki Tsuchimura <tutimura@nn.iij4u.or.jp>, thanks!

* Wed Oct  4 2000 Jun Nishii <jun@vinelinux.org>
- 1.63-0vl2
- requires pnm2pba (obsoletes pbm2ppa)

* Sun Aug 20 2000 Jun Nishii <jun@vinelinux.org>
- 1.63-0vl1
- fix for EPSON 820C
- follow up with RHL62

* Mon Jul 10 2000 AYUHANA Tomonori <l@kondara.org>
- (1.59-2k)
- add -q at %setup
- add -b at %patch

* Tue Jul  4 2000 Norihito Ohmori <nono@kondara.org>
- fix DJ720C bug (#585)

* Mon Mar 13 2000 Daiki Matsuda <dyky@kondara.org>
- fix for EPSON 770C/800C

* Wed Feb 17 2000 Norihito Ohmori <nono@kondara.org>
- fix duplex printing bug (#398)

* Mon Feb 14 2000 Norihito Ohmori <nono@kondara.org>
- RPM_OPT_FLAGS support
- ad-hoc i18n
- Change Name vine-printfilters
- be a NoSrc :-P
- Support Duplex/Simplex Printing.
- HP DeskJet 710C/720C support using pbm2ppa.
- printerdb modified for gs510j55
- add ESC/P, ESC/Page ,LIPS III and NPDL text filters
- Add printerdb.ja

* Wed Jan 26 2000 Bill Nottingham <notting@redhat.com>
- add stylus color 740 to printerdb

* Mon Nov  8 1999 Bill Nottingham <notting@redhat.com>
- revert ps-to-printer tempfile usage. There has
  to be a better way to do this.

* Wed Jul 21 1999 Bill Nottingham <notting@redhat.com>
- munge smbprint Yet Again(tm)

* Thu Jul  8 1999 Bill Nottingham <notting@redhat.com>
- make printerdb config(noreplace)

* Thu Jul  1 1999 Bill Nottingham <notting@redhat.com>
- add more drivers

* Fri Jun 18 1999 Bill Nottingham <notting@redhat.com>
- fix rpm printing

* Mon Jun 14 1999 Bill Nottingham <notting@redhat.com>
- use smbclient's -c command. Makes much more sense.

* Mon May 24 1999 Bill Nottingham <notting@redhat.com>
- hmm. The translate option went away at some point. Oops.

* Mon May  3 1999 Bill Nottingham <notting@redhat.com>
- yet another typo in SMB stuff. Urg.

* Mon Apr  5 1999 Bill Nottingham <notting@redhat.com>
- strip binaries

* Thu Apr  1 1999 Bill Nottingham <notting@redhat.com>
- fix some printerdb stuff for ghostscript brokenness

* Fri Mar 19 1999 Bill Nottingham <notting@redhat.com>
- remove some oboslete text

* Mon Feb  8 1999 Bill Nottingham <notting@redhat.com>
- uniprint support

* Tue Dec 29 1998 Bill Nottingham <notting@redhat.com>
- add workaround for Adobe(!) postscript driver

* Mon Dec 28 1998 Bill Nottingham <notting@redhat.com>
- remove 1bpp from cdj-based drivers, 'cos it's broken.

* Wed Nov 18 1998 Bill Nottingham <notting@redhat.com>
- add workgroup support to smbprint, fix quoting issues

* Wed Sep 30 1998 Bill Nottingham <notting@redhat.com>
- fix typo in ncpprint

* Wed Sep 15 1998 Bill Nottingham <notting@redhat.com>
- Added ncpprint to %files section (oops!)

* Thu Sep  2 1998 Bill Nottingham <notting@redhat.com>
- Added NCP printing support

* Tue Jun 30 1998 Michael Maher <mike@redhat.com>
- Fixed BUG 703,  added findutils dependecy.
- Added buildroot.

* Fri May 08 1998 Prospector System <bugs@redhat.com>
- translations modified for de, fr, tr

* Wed Oct 22 1997 Michael Fulbright <msf@redhat.com>
- Fixed printerdb to include 300x300 resolution for LaserJet 4 models
- Restored troff file handling now troff fpi is 'safe'

* Tue Oct 14 1997 Michael Fulbright <msf@redhat.com>
- Fixed master-filter to NOT handle troff files automatically

* Thu Jul 31 1997 Erik Troan <ewt@redhat.com>
- built against glibc

* Wed Apr 23 1997 Michael Fulbright <msf@redhat.com>
- Fixed problem with asc-to-printer.fpi not handling cr/lf trans correct

* Fri Apr 18 1997 Michael Fulbright <msf@redhat.com>
- fixed up Canon 600/4000 printerdb def
- added some HP Deskjets which I know work

* Thu Apr 10 1997 Michael Fulbright <msf@redhat.com>
- Added requirement that gs is installed. Pretty useless w/o it if
  you print anything interesting.

* Fri Mar 13 1997 Michael Fulbright <msf@redhat.com>
- Added conflicts so that packages with old filter loc won't hurt us.
- Moved to version 1.2.
- Added mpage support to allow nup printing.

* Wed Mar 13 1997 Michael Fulbright <msf@redhat.com>
- Added a DeskJet500Mono driver which links to the gs driver djet500.
- Added a A4 paper size test page.
- Fixed Makefile to build .ps test pages from the .fig files.

* Mon Mar 10 1997 Michael Fulbright <msf@redhat.com>
- Split filters off from printtool into this package .
