summaryrefslogtreecommitdiff
blob: b3b0e2c4de08284fb19af2a36024ff14b8d02d4a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
# Copyright 1999-2002 Gentoo Technologies, Inc.
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/net-print/pnm2ppa/pnm2ppa-1.0.91.ebuild,v 1.9 2002/10/04 06:18:41 vapier Exp $
# Note: this also d/ls the hp-ppa-howto and installs it under /usr/share/doc/${P}

# pnm2ppa is a print filter for HP's line of Winprinters which use a proprietary
# protocol called ppa (Print Performance Architecture). Like Winmodems, Winprinters
# don't have a microprocessor; your main CPU does all the hard work.
# Winprinters: Hp Deskjet 710, 712, 720, 722, 820, 1000 series.
# pnm2ppa can work on its own or via lpr or pdq.

# The ebuild in general seems a bit flaky, anyone who has a ppa printer
# please check it out and tell me if it worked.

# Description of accompanying patch: install into /usr instead of /usr/local
# and use env. var. CFLAGS. Took a lot of changes though.

S=${WORKDIR}/pnm2ppa
SRC_URI="mirror://sourceforge/pnm2ppa/${P}.tgz
	 mirror://sourceforge/pnm2ppa/howto.tgz"

HOMEPAGE="http://pnm2ppa.sourceforge.net"
KEYWORDS="x86"
SLOT="0"
DESCRIPTION="Print driver for Hp Deskjet 710, 712, 720, 722, 820, 1000 series"
LICENSE="GPL-2"

# note: this doesn't depend on virtual/lpr, because it can work on its own,
# just without queueing etc. since it's not just a driver but a standalone
# executable.
DEPEND="sys-libs/glibc sys-devel/ld.so"
RDEPEND="sys-libs/glibc sys-devel/ld.so app-text/enscript"

src_unpack() {
    
    cd ${WORKDIR}
    unpack ${P}.tgz
    cd ${S}
    unpack howto.tgz
    
}

src_compile() {
    
    # there is no configure, so we patch various makefiles
    # to intall into /usr and to include $CFLAGS optimization
    cd ${WORKDIR}
    patch -p0 <${FILESDIR}/${P}-gentoo.diff

    cd ${S}
    try emake
    
    cd ${S}/ppa_protocol
    try emake
    
#    cd ${S}/ppaSet-beta1
#    # This requires gtk, ncurses etc. on which we don't want to depend
#    # so we simply fail if they aren't installed
#    echo "The following may fail, don't pay attention to any error"
#    sleep 1s
#    emake gPpaSet 
#    emake nPpaSet
#    emake

}

src_install () {

    # There are problems with the builtin make install.
    
    cd ${S}
    
    into /usr
    dobin pnm2ppa calibrate_ppa
    doman docs/en/pnm2ppa.1
    
    insinto /etc
    doins pnm2ppa.conf
    
    # Install docs, filtering out distro-specific install documents
    # Note: we don't use dodoc but rather doins because html/sgml/lyx docs
    # shouldn't be gzipped IMHO
    cd docs/en
    insinto /usr/share/doc/${P}
    doins CALIBRATION.* COLOR.* CREDITS INSTALL LICENSE PPA* README RELEASE-NOTES TODO
    cd sgml
    insinto /usr/share/doc/${P}/sgml
    doins CALIBRATION.sgml COLOR.sgml PPA*
    cd ${S}/howto
    insinto /usr/share/doc/${P}/howto/
    doins *
    
    cd ${S}/ppa_protocol
    dobin parse_vlink
    insinto /usr/share/doc/${P}/ppa_protocol/
    doins *.html
    
    cd ${S}/utils/Linux
    dobin detect_ppa test_ppa
    
    # Install various things into /usr/share/pnm2ppa
    dodir /usr/share/pnm2ppa
    cd ${D}/usr/share/pnm2ppa
    
    ln -s ../doc/${P} ./doc

    insinto /usr/share/pnm2ppa/lpd
    doins ${S}/lpd/*
    exeinto /usr/share/pnm2ppa/lpd
    doexe ${S}/lpd/lpdsetup

    insinto /usr/share/pnm2ppa/pdq
    doins ${S}/pdq/*
    
    # Interfaces for configuration of integration with lpd.
    # We don't install them because we don't want to depend on lpd.
    # ncurses, gtk (the interface libs) but we provide the source
    # for the user. If gtk/ncurses headers are installed, they will
    # have been built.
    dodir /usr/share/pnm2ppa/ppaSet-beta1/dialog
    insinto /usr/share/pnm2ppa/ppaSet-beta1
    doins ${S}/ppaSet-beta1/*
    insinto /usr/share/pnm2ppa/ppaSet-beta1/dialog
    doins ${S}/ppaSet-beta1/dialog/*
    exeinto /usr/share/pnm2ppa/ppaSet-beta1
    cd ${S}/ppaSet-beta1
    doexe calibration cleanHeads gammaRef install noGamma ppa.if test
    
    dodir /usr/share/pnm2ppa/sample_scripts
    exeinto /usr/share/pnm2ppa/sample_scripts
    doexe ${S}/sample_scripts/*

    dodir /usr/share/pnm2ppa/testpages
    insinto /usr/share/pnm2ppa/testpages
    doins ${S}/testpages/*
    
    # Install lpr filters: add them to the end of the existing printcap.
    # We have /etc protection as default, so it's safe, but easier to
    # setup later.
    dodir /etc
    cp /etc/printcap ${D}/etc/printcap.current
    cp ${S}/lpd/printcap ${D}/etc/printcap.new
    cat ${D}/etc/printcap.current ${D}/etc/printcap.new > ${D}/etc/printcap
    rm ${D}/etc/printcap.*
    # run provided script (I patched it), it needs its dir as pwd
    cd ${S}/lpd
    DESTDIR=${D} ./lpdsetup
    
    # Install pdq filters, need to be activated via configuration via xpdq
    cd ${S}/pdq
    exeinto /etc/pdq/drivers/ghostscript
    doexe gs-pnm2ppa
    exeinto /etc/pdq/interfaces
    doexe dummy    
    
}

pkg_postinst() {

    echo "
    Now, you *must* edit /etc/pnm2ppa.conf and choose (at least)
    your printer model and papersize.
    
    Run calibrate_ppa to calibrate color offsets.
    
    Read the docs in /usr/share/pnm2ppa/ to configure the printer,
    configure lpr substitutes, cups, pdq, networking etc.
    
    Note that lpr and pdq drivers *have* been installed, but if your
    config file management has /etc blocked (the default), they have
    been installed under different filenames. Read the appropriate
    Gentoo documentation for more info.
    
    Note: lpr has been configured for default papersize letter
    "
    
}