1 {lib, stdenv, fetchurl, cups, dpkg, gnused, makeWrapper, ghostscript, file, a2ps, coreutils, gawk }:
6 url = "https://download.brother.com/welcome/dlf007070/hl3140cwcupswrapper-${version}.i386.deb";
7 sha256 = "a76281828ca6ee86c63034673577fadcf5f24e8ed003213bdbb6bf47a7aced6f";
9 srcdir = "hl3140cw_cupswrapper_GPL_source_${version}";
11 url = "https://download.brother.com/welcome/dlf006740/${srcdir}.tar.gz";
12 sha256 = "1wp85rbvbar6rqqkaffymxjpls6jx9m9230dlrpqwy5akiaxf0rl";
15 url = "https://support.brother.com/g/b/files/dlf/dlf007068/hl3140cwlpr-1.1.2-1.i386.deb";
16 sha256 = "601f392b52ed7080f71b780181823bb8f6abfd0591146b452ba1f23e21f9f865";
20 pname = "cups-brother-hl3140cw";
22 nativeBuildInputs = [ makeWrapper dpkg ];
23 buildInputs = [ cups ghostscript a2ps ];
30 gcc -Wall ${srcdir}/brcupsconfig/brcupsconfig.c -o brcupsconfpt1
35 dpkg-deb -x ${lprdeb} $out
37 substituteInPlace $out/opt/brother/Printers/hl3140cw/lpd/filterhl3140cw \
38 --replace /opt "$out/opt"
39 substituteInPlace $out/opt/brother/Printers/hl3140cw/inf/setupPrintcapij \
40 --replace /opt "$out/opt"
42 sed -i '/GHOST_SCRIPT=/c\GHOST_SCRIPT=gs' $out/opt/brother/Printers/hl3140cw/lpd/psconvertij2
44 patchelf --set-interpreter ${stdenv.cc.libc}/lib/ld-linux.so.2 $out/opt/brother/Printers/hl3140cw/lpd/brhl3140cwfilter
45 patchelf --set-interpreter ${stdenv.cc.libc}/lib/ld-linux.so.2 $out/usr/bin/brprintconf_hl3140cw
47 wrapProgram $out/opt/brother/Printers/hl3140cw/lpd/psconvertij2 \
48 --prefix PATH ":" ${ lib.makeBinPath [ gnused coreutils gawk ] }
50 wrapProgram $out/opt/brother/Printers/hl3140cw/lpd/filterhl3140cw \
51 --prefix PATH ":" ${ lib.makeBinPath [ ghostscript a2ps file gnused coreutils ] }
54 dpkg-deb -x ${cupsdeb} $out
56 substituteInPlace $out/opt/brother/Printers/hl3140cw/cupswrapper/cupswrapperhl3140cw \
57 --replace /opt "$out/opt"
59 mkdir -p $out/lib/cups/filter
60 ln -s $out/opt/brother/Printers/hl3140cw/cupswrapper/cupswrapperhl3140cw $out/lib/cups/filter/cupswrapperhl3140cw
62 ln -s $out/opt/brother/Printers/hl3140cw/cupswrapper/brother_hl3140cw_printer_en.ppd $out/lib/cups/filter/brother_hl3140cw_printer_en.ppd
64 cp brcupsconfpt1 $out/opt/brother/Printers/hl3140cw/cupswrapper/
65 ln -s $out/opt/brother/Printers/hl3140cw/cupswrapper/brcupsconfpt1 $out/lib/cups/filter/brcupsconfpt1
66 ln -s $out/opt/brother/Printers/hl3140cw/lpd/filterhl3140cw $out/lib/cups/filter/brother_lpdwrapper_hl3140cw
68 wrapProgram $out/opt/brother/Printers/hl3140cw/cupswrapper/cupswrapperhl3140cw \
69 --prefix PATH ":" ${ lib.makeBinPath [ gnused coreutils gawk ] }
73 homepage = "http://www.brother.com/";
74 description = "Brother hl3140cw printer driver";
75 sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
76 license = lib.licenses.unfree;
77 platforms = lib.platforms.linux;
78 downloadPage = "https://support.brother.com/g/b/downloadlist.aspx?c=eu_ot&lang=en&prod=hl3140cw_us_eu&os=128";