14 stdenv.mkDerivation rec {
15 pname = "mfc9140cdncupswrapper";
19 url = "https://download.brother.com/welcome/dlf100407/${pname}-${version}.i386.deb";
20 sha256 = "18aramgqgra1shdhsa75i0090hk9i267gvabildwsk52kq2b96c6";
35 lpr=${mfc9140cdnlpr}/opt/brother/Printers/mfc9140cdn
36 dir=$out/opt/brother/Printers/mfc9140cdn
38 interpreter=${pkgsi686Linux.glibc.out}/lib/ld-linux.so.2
39 patchelf --set-interpreter "$interpreter" "$dir/cupswrapper/brcupsconfpt1"
41 substituteInPlace $dir/cupswrapper/cupswrappermfc9140cdn \
42 --replace "mkdir -p /usr" ": # mkdir -p /usr" \
43 --replace '/opt/brother/''${device_model}/''${printer_model}/lpd/filter''${printer_model}' "$lpr/lpd/filtermfc9140cdn" \
44 --replace '/usr/share/ppd/Brother/brother_''${printer_model}_printer_en.ppd' "$dir/cupswrapper/brother_mfc9140cdn_printer_en.ppd" \
45 --replace '/usr/share/cups/model/Brother/brother_''${printer_model}_printer_en.ppd' "$dir/cupswrapper/brother_mfc9140cdn_printer_en.ppd" \
46 --replace '/opt/brother/Printers/''${printer_model}/' "$lpr/" \
47 --replace 'nup="psnup' "nup=\"${psutils}/bin/psnup" \
48 --replace '/usr/bin/psnup' "${psutils}/bin/psnup"
50 mkdir -p $out/lib/cups/filter
51 mkdir -p $out/share/cups/model
53 ln $dir/cupswrapper/cupswrappermfc9140cdn $out/lib/cups/filter
54 ln $dir/cupswrapper/brother_mfc9140cdn_printer_en.ppd $out/share/cups/model
56 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
57 sed -i "/#! \/bin\/sh/a PATH=${lib.makeBinPath [ coreutils gnused gnugrep ]}:\$PATH" $out/lib/cups/filter/brother_lpdwrapper_mfc9140cdn
58 chmod +x $out/lib/cups/filter/brother_lpdwrapper_mfc9140cdn
62 description = "Brother MFC-9140CDN CUPS wrapper driver";
63 homepage = "http://www.brother.com/";
64 sourceProvenance = with sourceTypes; [ binaryNativeCode ];
65 license = licenses.gpl2Plus;
66 platforms = platforms.linux;
67 maintainers = with maintainers; [ hexa ];