Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ lib, stdenv, fetchurl, foomatic-filters, bc, ghostscript, systemd, vim, time }:
2
3stdenv.mkDerivation rec {
4 pname = "foo2zjs";
5 version = "20210116";
6
7 src = fetchurl {
8 url = "http://www.loegria.net/mirrors/foo2zjs/foo2zjs-${version}.tar.gz";
9 sha256 = "14x3wizvncdy0xgvmcx541qanwb7bg76abygqy17bxycn1zh5r1x";
10 };
11
12 buildInputs = [ foomatic-filters bc ghostscript systemd vim ];
13
14 patches = [
15 ./no-hardcode-fw.diff
16 # Support HBPL1 printers. Updated patch based on
17 # https://www.dechifro.org/hbpl/
18 ./hbpl1.patch
19 # Fix "Unimplemented paper code" error for hbpl1 printers
20 # https://github.com/mikerr/foo2zjs/pull/2
21 ./papercode-format-fix.patch
22 # Fix AirPrint color printing for Dell 1250c
23 # See https://github.com/OpenPrinting/cups/issues/272
24 ./dell1250c-color-fix.patch
25 ];
26
27 makeFlags = [
28 "PREFIX=$(out)"
29 "APPL=$(out)/share/applications"
30 "PIXMAPS=$(out)/share/pixmaps"
31 "UDEVBIN=$(out)/bin"
32 "UDEVDIR=$(out)/etc/udev/rules.d"
33 "UDEVD=${systemd}/sbin/udevd"
34 "LIBUDEVDIR=$(out)/lib/udev/rules.d"
35 "USBDIR=$(out)/etc/hotplug/usb"
36 "FOODB=$(out)/share/foomatic/db/source"
37 "MODEL=$(out)/share/cups/model"
38 ];
39
40 installFlags = [ "install-hotplug" ];
41
42 postPatch = ''
43 touch all-test
44 sed -e "/BASENAME=/iPATH=$out/bin:$PATH" -i *-wrapper *-wrapper.in
45 sed -e "s@PREFIX=/usr@PREFIX=$out@" -i *-wrapper{,.in}
46 sed -e "s@/usr/share@$out/share@" -i hplj10xx_gui.tcl
47 sed -e "s@\[.*-x.*/usr/bin/logger.*\]@type logger >/dev/null 2>\&1@" -i *wrapper{,.in}
48 sed -e '/install-usermap/d' -i Makefile
49 sed -e "s@/etc/hotplug/usb@$out&@" -i *rules*
50 sed -e "s@/usr@$out@g" -i hplj1020.desktop
51 sed -e "/PRINTERID=/s@=.*@=$out/bin/usb_printerid@" -i hplj1000
52 '';
53
54 nativeCheckInputs = [ time ];
55 doCheck = false; # fails to find its own binary. Also says "Tests will pass only if you are using ghostscript-8.71-16.fc14".
56
57 preInstall = ''
58 mkdir -pv $out/{etc/udev/rules.d,lib/udev/rules.d,etc/hotplug/usb}
59 mkdir -pv $out/share/foomatic/db/source/{opt,printer,driver}
60 mkdir -pv $out/share/cups/model
61 mkdir -pv $out/share/{applications,pixmaps}
62
63 mkdir -pv "$out/bin"
64 cp -v getweb arm2hpdl "$out/bin"
65 '';
66
67 meta = with lib; {
68 description = "ZjStream printer drivers";
69 maintainers = with maintainers;
70 [
71 raskin
72 ];
73 platforms = platforms.linux;
74 license = licenses.gpl2Plus;
75 };
76}