15 stdenv.mkDerivation rec {
16 pname = "mfc9140cdncupswrapper";
20 url = "https://download.brother.com/welcome/dlf100407/${pname}-${version}.i386.deb";
21 sha256 = "18aramgqgra1shdhsa75i0090hk9i267gvabildwsk52kq2b96c6";
36 lpr=${mfc9140cdnlpr}/opt/brother/Printers/mfc9140cdn
37 dir=$out/opt/brother/Printers/mfc9140cdn
39 interpreter=${pkgsi686Linux.glibc.out}/lib/ld-linux.so.2
40 patchelf --set-interpreter "$interpreter" "$dir/cupswrapper/brcupsconfpt1"
42 substituteInPlace $dir/cupswrapper/cupswrappermfc9140cdn \
43 --replace "mkdir -p /usr" ": # mkdir -p /usr" \
44 --replace '/opt/brother/''${device_model}/''${printer_model}/lpd/filter''${printer_model}' "$lpr/lpd/filtermfc9140cdn" \
45 --replace '/usr/share/ppd/Brother/brother_''${printer_model}_printer_en.ppd' "$dir/cupswrapper/brother_mfc9140cdn_printer_en.ppd" \
46 --replace '/usr/share/cups/model/Brother/brother_''${printer_model}_printer_en.ppd' "$dir/cupswrapper/brother_mfc9140cdn_printer_en.ppd" \
47 --replace '/opt/brother/Printers/''${printer_model}/' "$lpr/" \
48 --replace 'nup="psnup' "nup=\"${psutils}/bin/psnup" \
49 --replace '/usr/bin/psnup' "${psutils}/bin/psnup"
51 mkdir -p $out/lib/cups/filter
52 mkdir -p $out/share/cups/model
54 ln $dir/cupswrapper/cupswrappermfc9140cdn $out/lib/cups/filter
55 ln $dir/cupswrapper/brother_mfc9140cdn_printer_en.ppd $out/share/cups/model
57 sed -n '/!ENDOFWFILTER!/,/!ENDOFWFILTER!/p' "$dir/cupswrapper/cupswrappermfc9140cdn" | sed '1 br; b; :r s/.*/printer_model=mfc9140cdn; cat <<!ENDOFWFILTER!/' | bash > $out/lib/cups/filter/brother_lpdwrapper_mfc9140cdn
58 sed -i "/#! \/bin\/sh/a PATH=${
64 }:\$PATH" $out/lib/cups/filter/brother_lpdwrapper_mfc9140cdn
65 chmod +x $out/lib/cups/filter/brother_lpdwrapper_mfc9140cdn
69 description = "Brother MFC-9140CDN CUPS wrapper driver";
70 homepage = "http://www.brother.com/";
71 sourceProvenance = with sourceTypes; [ binaryNativeCode ];
72 license = licenses.gpl2Plus;
73 platforms = platforms.linux;
74 maintainers = with maintainers; [ hexa ];