summaryrefslogtreecommitdiff
path: root/net-print/foo2zjs/files/foo2zjs-20070419-gentoo.patch
Unidiff
Diffstat (limited to 'net-print/foo2zjs/files/foo2zjs-20070419-gentoo.patch') (more/less context) (ignore whitespace changes)
-rw-r--r--net-print/foo2zjs/files/foo2zjs-20070419-gentoo.patch360
1 files changed, 360 insertions, 0 deletions
diff --git a/net-print/foo2zjs/files/foo2zjs-20070419-gentoo.patch b/net-print/foo2zjs/files/foo2zjs-20070419-gentoo.patch
new file mode 100644
index 0000000..aa6de8c
--- a/dev/null
+++ b/net-print/foo2zjs/files/foo2zjs-20070419-gentoo.patch
@@ -0,0 +1,360 @@
1diff --git a/Makefile b/Makefile
2index ce510c4..b4171d8 100644
3--- a/Makefile
4+++ b/Makefile
5@@ -8,7 +8,11 @@ VERSION=0.0
6
7 # Installation prefix...
8 PREFIX=/usr/local
9-PREFIX=/usr
10+PREFIX=${DESTDIR}/usr
11+
12+# USB_PRINTERID is also installed there because it is needed by the FWloader
13+FWLOADERDIR=$(DESTDIR)/sbin
14+FIRMWAREDIR=$(DESTDIR)/lib/firmware
15
16 # Pathnames for this package...
17 BIN=$(PREFIX)/bin
18@@ -22,7 +26,7 @@ MANDIR=$(PREFIX)/share/man
19 DOCDIR=$(PREFIX)/share/doc/foo2zjs/
20
21 # Pathnames for referenced packages...
22-FOODB=/usr/share/foomatic/db/source
23+FOODB=${PREFIX}/share/foomatic/db/source
24
25 # User ID's
26 LPuid=-olp
27@@ -192,7 +196,7 @@ ifeq ($(UNAME),Linux)
28 endif
29
30 # Compiler flags
31 -CFLAGS +=-O2 -Wall
32 +CFLAGS ?=-O2 -Wall
33 #CFLAGS +=-g
34
35 #
36@@ -396,12 +400,14 @@ install-test:
37
38
39 install-prog:
40 +[ -d ${BIN} ] || install -d -m 755 ${BIN}/
41 +[ -d ${DESTDIR}/bin/ ] || install -d -m 755 ${DESTDIR}/bin/
42 #
43 # Install driver, wrapper, and development tools
44 #
45 install -c $(PROGS) $(SHELLS) $(BIN)/
46 if [ "$(BINPROGS)" != "" ]; then \
47 - install -c $(BINPROGS) /bin/; \
48 + install -c $(BINPROGS) ${DESTDIR}/bin/; \
49 fi
50 #
51 # Install gamma correction files. These are just templates,
52@@ -429,6 +435,7 @@ install-foo:
53 #
54 @if [ -d $(FOODB) ]; then \
55 for dir in driver printer opt; do \
56 + [ -d ${FOODB}/$$dir/ ] || install -d -m 755 ${FOODB}/$$dir/; \
57 echo install -m 644 foomatic-db/$$dir/*.xml $(FOODB)/$$dir/; \
58 install -c -m 644 foomatic-db/$$dir/*.xml $(FOODB)/$$dir/; \
59 done \
60@@ -446,10 +453,10 @@ install-foo:
61 #
62 # Clear foomatic cache and rebuild database if needed
63 #
64 -rm -rf /var/cache/foomatic/*/*
65 -rm -f /var/cache/foomatic/printconf.pickle
66 -if [ -d /var/cache/foomatic/compiled ]; then \
67 - cd /var/cache/foomatic/compiled; \
68 +rm -rf ${DESTDIR}/var/cache/foomatic/*/*
69 +rm -f ${DESTDIR}/var/cache/foomatic/printconf.pickle
70 +if [ -d ${DESTDIR}/var/cache/foomatic/compiled ]; then \
71 + cd ${DESTDIR}/var/cache/foomatic/compiled; \
72 foomatic-combo-xml -O >overview.xml; \
73 fi
74
75@@ -503,12 +510,12 @@ install-extra:
76 fi; \
77 done
78 # foo2zjs Firmware files (if any)
79 -install $(LPuid) $(LPgid) -m 775 -d $(SHAREZJS)/firmware/
80 +install $(LPuid) $(LPgid) -m 775 -d $(FIRMWAREDIR)/
81 for i in sihp*.img; do \
82 if [ -f $$i ]; then \
83 base=`basename $$i .img`; \
84 ./arm2hpdl $$i >$$base.dl; \
85 - install -c -m 644 $$base.dl $(SHAREZJS)/firmware/; \
86 + install -c -m 644 $$base.dl $(FIRMWAREDIR)/; \
87 fi; \
88 done
89 # foo2oak ICM files (if any)
90@@ -528,35 +535,26 @@ install-extra:
91 fi; \
92 done
93
94-MODEL=/usr/share/cups/model
95-LOCALMODEL=/usr/local/share/cups/model
96+MODEL=${PREFIX}/usr/share/cups/model
97+#LOCALMODEL=/usr/local/share/cups/model
98 install-ppd:
99 #
100 # Install PPD files for CUPS
101 #
102 -if [ -d /usr/share/ppd/ ]; then \
103 - find /usr/share/ppd/ -name '*foo2zjs*' | xargs rm -f; \
104 - find /usr/share/ppd/ -name '*foo2hp*' | xargs rm -f; \
105 - find /usr/share/ppd/ -name '*foo2xqx*' | xargs rm -f; \
106 - find /usr/share/ppd/ -name '*foo2lava*' | xargs rm -f; \
107 - find /usr/share/ppd/ -name '*foo2qpdl*' | xargs rm -f; \
108 -fi
109 if [ -d $(MODEL) ]; then \
110 cd PPD; \
111 for ppd in *.ppd; do \
112 gzip < $$ppd > $(MODEL)/$$ppd.gz; \
113 done; \
114 -elif [ -d $(LOCALMODEL) ]; then \
115 +elif [ -n "${LOCALMODEL}" -a -d $(LOCALMODEL) ]; then \
116 cd PPD; \
117 for ppd in *.ppd; do \
118 gzip < $$ppd > $(LOCALMODEL)/$$ppd.gz; \
119 done; \
120 fi
121
122-USBDIR=/etc/hotplug/usb
123-UDEVDIR=/etc/udev/rules.d
124-RULES=hplj10xx.rules
125-install-hotplug: install-hotplug-test install-hotplug-prog
126+USBDIR=${DESTDIR}/etc/hotplug/usb
127+install-hotplug: install-hotplug-test install-udev
128
129 install-hotplug-test:
130 #
131@@ -574,18 +572,20 @@ install-hotplug-test:
132 #
133
134 install-hotplug-prog:
135 -if [ -d $(UDEVDIR) ]; then \
136 - install -c -m 644 $(RULES) $(UDEVDIR)/11-$(RULES); \
137 -fi
138 [ -d $(USBDIR) ] || install -d -m 755 $(USBDIR)/
139 install -c -m 755 hplj1000 $(USBDIR)/
140 ln -sf $(USBDIR)/hplj1000 $(USBDIR)/hplj1005
141 ln -sf $(USBDIR)/hplj1000 $(USBDIR)/hplj1018
142 ln -sf $(USBDIR)/hplj1000 $(USBDIR)/hplj1020
143 -$(USBDIR)/hplj1000 install-usermap
144 -$(USBDIR)/hplj1005 install-usermap
145 -$(USBDIR)/hplj1018 install-usermap
146 -$(USBDIR)/hplj1020 install-usermap
147 +install -c -m 644 hplj.usermap ${USBDIR}/
148+
149+UDEVDIR=${DESTDIR}/etc/udev/rules.d
150+RULES=hplj10xx.rules
151+install-udev:
152 +[ -d $(FWLOADERDIR) ] || install -d -m 755 $(FWLOADERDIR)/
153 +install -c -m 755 foo2zjs-loadfw $(FWLOADERDIR)/
154 +[ -d ${UDEVDIR} ] || install -d -m 755 ${UDEVDIR}/
155 +install -c -m 644 ${RULES} ${UDEVDIR}/11-${RULES}
156
157 cups:FRC
158 if [ -x /etc/init.d/cups ]; then \
159@@ -910,7 +910,6 @@ install-doc: doc
160 install -c -m 644 README $(DOCDIR)
161 install -c -m 644 ChangeLog $(DOCDIR)
162
163-GROFF=/usr/local/test/bin/groff
164 GROFF=groff
165 manual.pdf: $(MANPAGES)
166 -$(GROFF) -t -man $(MANPAGES) | ps2pdf - $@
167diff --git a/foo2zjs-loadfw b/foo2zjs-loadfw
168new file mode 100644
169index 0000000..c748b1a
170--- /dev/null
171+++ b/foo2zjs-loadfw
172@@ -0,0 +1,121 @@
173+#!/bin/sh
174+
175 +#foo2zjs-loadfw:
176+#
177 +#Hotplug script for HP1000/1005/1020 USB laser printers. The model number
178 +#that this script deals with is determined from the udev env.
179+#
180 +#Used to download firmware automatically into the printer when it
181 +#is powered up or plugged into the USB port.
182+#
183 +#The inspiration fo this script is from:
184 +# Oscar Santacreu. Alicante-Spain (2002)
185 +# Mike Morgan (2004)
186 +#Modified by Stefan Schweizer (2005) to work as a udev-RUN-script
187+
188+#
189+# Directory to find downloadable HP firmware files sihpMMMM.dl
190+#
191+FWDIR=/lib/firmware
192+
193+#
194+# Program used to determine USB id information
195+#
196+USBID=/bin/usb_printerid
197+
198+#
199 +#Figure out how to log our messages
200+#
201+if [ -t 1 ]; then
202+ # Running from a tty...
203+ log() {
204 +echo "$0: $@"
205+ }
206+elif [ -x /usr/bin/logger ]; then
207+ # Have logger...
208+ log() {
209 +logger -t "$0" -- "$@"
210+ }
211+else
212+ # No logger...
213+ log() {
214 +echo "$0: $@" >> /var/log/messages
215+ }
216+fi
217+
218+#
219 +#Figure out the model number from the name of this script
220+#
221+case "$1" in
222+1000)
223+ MODEL=1000
224+ MODELNAME="hp LaserJet $MODEL"
225+ ;;
226+1005)
227+ MODEL=1005
228+ MODELNAME="hp LaserJet $MODEL"
229+ ;;
230+1018)
231+ MODEL=1018
232+ MODELNAME="HP LaserJet $MODEL"
233+ ;;
234+1020)
235+ MODEL=1020
236+ MODELNAME="HP LaserJet $MODEL"
237+ ;;
238+*)
239+ log "Only HP LaserJet 1000, 1005, 1018 and 1020 are supported"
240+ log "You need to supply one of these on the cmdline: $0 10**"
241+ exit
242+ ;;
243+esac
244+
245+if [ -z "$DEVNAME" ]; then
246+ if [ -n "$2" ]; then
247+ DEVNAME=$2
248+ else
249+ log "You need to either have $DEVNAME set in the environment or supply it on the cmdline, like:"
250+ log "$0 10** /dev/usb/lp0"
251+ exit 1
252+ fi
253+fi
254+
255+#
256 +#Procedure to load a single device with firmware
257+#
258+load1() {
259+ fw="$FWDIR/sihp$MODEL.dl"
260+ if [ ! -f "$fw" ]; then
261 +log "Missing HP LaserJet $MODEL firmware file $fw"
262 +log "...read foo2zjs installation instructions and run ./getweb $MODEL"
263 +return 1
264+ fi
265+
266+ log "loading HP LaserJet $MODEL firmware $fw to $DEVNAME ..."
267+ if cat $fw > $DEVNAME; then
268 +log "... download successful."
269+ else
270 +log "... download failed."
271+ fi
272+ return 0
273+}
274+
275+#
276 +#OK, now download firmware to any printers that need it
277+#
278+if [ -x $USBID ]; then
279 +if $USBID $DEVNAME | grep "$MODELNAME" 2> /dev/null; then
280 + # This is a LaserJet 100x
281 + if $USBID $DEVNAME | grep 'FWVER' 2> /dev/null; then
282 + log "HP LaserJet $MODEL firmware already loaded into $DEVNAME"
283 + else
284 + # Firmware is not yet loaded
285 + load1 "$DEVNAME"
286 + fi
287 +else
288 + log "No supported printer found."
289 +fi
290+else
291+ log "HP LaserJet $MODEL firmware was not downloaded..."
292+ log "...couldn't find $USBID"
293+fi
294diff --git a/getweb.in b/getweb.in
295index 1841a3a..f17d084 100755
296--- a/getweb.in
297+++ b/getweb.in
298@@ -1,4 +1,4 @@
299-#!/bin/sh
300+#!/bin/bash
301
302 WGETOPTS=--passive-ftp
303
304diff --git a/hplj.usermap b/hplj.usermap
305new file mode 100644
306index 0000000..0e8b64d
307--- /dev/null
308+++ b/hplj.usermap
309@@ -0,0 +1,4 @@
310+hplj1000 0x0003 0x03f0 0x0517 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000
311+hplj1005 0x0003 0x03f0 0x1317 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000
312+hplj1018 0x0003 0x03f0 0x4117 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000
313+hplj1020 0x0003 0x03f0 0x2b17 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000
314diff --git a/hplj1000 b/hplj1000
315index ca57960..89fb2b6 100755
316--- a/hplj1000
317+++ b/hplj1000
318@@ -35,7 +35,7 @@ DEV=""
319 #
320 # Directory to find downloadable HP firmware files sihpMMMM.dl
321 #
322-FWDIR=/usr/share/foo2zjs/firmware
323+FWDIR=/lib/firmware
324
325 #
326 # Program used to determine USB id information
327diff --git a/hplj10xx.rules b/hplj10xx.rules
328index 2929a6d..b9dcde4 100644
329--- a/hplj10xx.rules
330+++ b/hplj10xx.rules
331@@ -1,8 +1,8 @@
332 #Own udev rule for HP Laserjet 1000
333-KERNEL=="lp*", BUS=="usb", SYSFS{idVendor}=="03f0", SYSFS{product}=="hp LaserJet 1000", NAME="usb/%k", SYMLINK+="hplj1000%e", MODE="0666", RUN+="/etc/hotplug/usb/hplj1000"
334+KERNEL=="lp*", BUS=="usb", SYSFS{idVendor}=="03f0", SYSFS{idProduct}=="0517", NAME="usb/%k", SYMLINK+="hplj1000%e", MODE="0660", GROUP="lp", RUN+="/sbin/foo2zjs-loadfw 1000"
335 #Own udev rule for HP Laserjet 1005
336-KERNEL=="lp*", BUS=="usb", SYSFS{idVendor}=="03f0", SYSFS{product}=="hp LaserJet 1005 series", NAME="usb/%k", SYMLINK+="hplj1005%e", MODE="0666", RUN+="/etc/hotplug/usb/hplj1005"
337+KERNEL=="lp*", BUS=="usb", SYSFS{idVendor}=="03f0", SYSFS{idProduct}=="1317", NAME="usb/%k", SYMLINK+="hplj1005%e", MODE="0660", GROUP="lp", RUN+="/sbin/foo2zjs-loadfw 1005"
338 #Own udev rule for HP Laserjet 1018
339-KERNEL=="lp*", BUS=="usb", SYSFS{idVendor}=="03f0", SYSFS{product}=="HP LaserJet 1018", NAME="usb/%k", SYMLINK+="hplj1018%e", MODE="0666", RUN+="/etc/hotplug/usb/hplj1018"
340+KERNEL=="lp*", BUS=="usb", SYSFS{idVendor}=="03f0", SYSFS{idProduct}=="4117", NAME="usb/%k", SYMLINK+="hplj1018%e", MODE="0660", GROUP="lp", RUN+="/sbin/foo2zjs-loadfw 1018"
341 #Own udev rule for HP Laserjet 1020
342-KERNEL=="lp*", BUS=="usb", SYSFS{idVendor}=="03f0", SYSFS{product}=="HP LaserJet 1020", NAME="usb/%k", SYMLINK+="hplj1020%e", MODE="0666", RUN+="/etc/hotplug/usb/hplj1020"
343+KERNEL=="lp*", BUS=="usb", SYSFS{idVendor}=="03f0", SYSFS{idProduct}=="2b17", NAME="usb/%k", SYMLINK+="hplj1020%e", MODE="0660", GROUP="lp", RUN+="/sbin/foo2zjs-loadfw 1020"
344diff --git a/icc2ps/Makefile b/icc2ps/Makefile
345index e899212..97fa971 100644
346--- a/icc2ps/Makefile
347+++ b/icc2ps/Makefile
348@@ -1,10 +1,10 @@
349 -PREFIX=/usr
350 +PREFIX=${DESTDIR}/usr
351 BIN=$(PREFIX)/bin
352 SRC=icc2ps.c xgetopt.c
353 LIB=cmscam97.c cmscnvrt.c cmserr.c cmsgamma.c cmsgmt.c cmsintrp.c cmsio1.c \
354 cmslut.c cmsmatsh.c cmsmtrx.c cmsnamed.c cmspack.c cmspcs.c cmsps2.c \
355 cmssamp.c cmswtpnt.c cmsxform.c cmsio0.c cmsvirt.c
356 -CFLAGS=-O3
357 +CFLAGS?=-O3
358
359 all: foo2zjs-icc2ps
360