mfcl5750dw: init at 3.5.1-1 (#277781)

authored by Arne Keller and committed by GitHub 8470e21e 885986d3

+130
+10
pkgs/by-name/mf/mfcl5750dw/fix-perm.patch
··· 1 + --- a/opt/brother/Printers/MFCL5750DW/cupswrapper/lpdwrapper 2020-01-29 08:26:18.000000000 +0100 2 + +++ b/opt/brother/Printers/MFCL5750DW/cupswrapper/lpdwrapper 2023-12-29 14:12:44.522567053 +0100 3 + @@ -383,6 +383,7 @@ 4 + close $temprch; 5 + 6 + `cp $basedir/inf/br${PRINTER}rc $TEMPRC`; 7 + +`chmod 666 $TEMPRC`; 8 + $ENV{BRPRINTERRCFILE} = $TEMPRC; 9 + 10 + logprint( 0 , "TEMPRC = $TEMPRC\n");
+120
pkgs/by-name/mf/mfcl5750dw/package.nix
··· 1 + { 2 + lib, 3 + stdenvNoCC, 4 + fetchurl, 5 + dpkg, 6 + autoPatchelfHook, 7 + makeWrapper, 8 + perl, 9 + gnused, 10 + ghostscript, 11 + file, 12 + coreutils, 13 + gnugrep, 14 + which, 15 + }: 16 + 17 + let 18 + arches = [ 19 + "x86_64" 20 + "i686" 21 + "armv7l" 22 + ]; 23 + 24 + runtimeDeps = [ 25 + ghostscript 26 + file 27 + gnused 28 + gnugrep 29 + coreutils 30 + which 31 + ]; 32 + in 33 + stdenvNoCC.mkDerivation (finalAttrs: { 34 + pname = "mfcl5750dw"; 35 + version = "3.5.1-1"; 36 + 37 + nativeBuildInputs = [ 38 + dpkg 39 + makeWrapper 40 + autoPatchelfHook 41 + ]; 42 + buildInputs = [ perl ]; 43 + 44 + src = fetchurl { 45 + url = "https://download.brother.com/welcome/dlf102614/mfcl5750dwcupswrapper-${finalAttrs.version}.i386.deb"; 46 + sha256 = "afe6d18e17d26348f3b8a4f9a003107984940c429a7dd193054303a21f5e65b5"; 47 + }; 48 + 49 + lpr_src = fetchurl { 50 + url = "https://download.brother.com/welcome/dlf102613/mfcl5750dwlpr-${finalAttrs.version}.i386.deb"; 51 + sha256 = "b1b9c1f9ae8522a65fdd2db1e760aed835807ba593d001ac5471635a157cd1f1"; 52 + }; 53 + 54 + unpackPhase = '' 55 + dpkg-deb -x $src . 56 + dpkg-deb -x $lpr_src . 57 + ''; 58 + 59 + patches = [ 60 + # The brother lpdwrapper uses a temporary file to convey the printer settings. 61 + # The original settings file will be copied with "400" permissions and the "brprintconflsr3" 62 + # binary cannot alter the temporary file later on. This fixes the permissions so the can be modified. 63 + # Since this is all in briefly in the temporary directory of systemd-cups and not accessible by others, 64 + # it shouldn't be a security concern. 65 + ./fix-perm.patch 66 + ]; 67 + 68 + installPhase = 69 + '' 70 + runHook preInstall 71 + mkdir -p $out 72 + cp -ar opt $out/opt 73 + 74 + # delete unnecessary files for the current architecture 75 + '' 76 + + lib.concatMapStrings (arch: '' 77 + echo Deleting files for ${arch} 78 + rm -r "$out/opt/brother/Printers/MFCL5750DW/lpd/${arch}" 79 + '') (builtins.filter (arch: arch != stdenvNoCC.hostPlatform.linuxArch) arches) 80 + + '' 81 + # bundled scripts don't understand the arch subdirectories for some reason 82 + ln -s \ 83 + "$out/opt/brother/Printers/MFCL5750DW/lpd/${stdenvNoCC.hostPlatform.linuxArch}/"* \ 84 + "$out/opt/brother/Printers/MFCL5750DW/lpd/" 85 + 86 + # Fix global references and replace auto discovery mechanism with hardcoded values 87 + substituteInPlace $out/opt/brother/Printers/MFCL5750DW/lpd/lpdfilter \ 88 + --replace "my \$BR_PRT_PATH =" "my \$BR_PRT_PATH = \"$out/opt/brother/Printers/MFCL5750DW\"; #" \ 89 + --replace "PRINTER =~" "PRINTER = \"MFCL5750DW\"; #" 90 + 91 + substituteInPlace $out/opt/brother/Printers/MFCL5750DW/cupswrapper/lpdwrapper \ 92 + --replace "my \$basedir = C" "my \$basedir = \"$out/opt/brother/Printers/MFCL5750DW\" ; #" \ 93 + --replace "PRINTER =~" "PRINTER = \"MFCL5750DW\"; #" 94 + 95 + # Make sure all executables have the necessary runtime dependencies available 96 + find "$out" -executable -and -type f | while read file; do 97 + wrapProgram "$file" --prefix PATH : "${lib.makeBinPath runtimeDeps}" 98 + done 99 + # Symlink filter and ppd into a location where CUPS will discover it 100 + mkdir -p $out/lib/cups/filter 101 + mkdir -p $out/share/cups/model 102 + mkdir -p $out/etc/opt/brother/Printers/MFCL5750DW/inf 103 + ln -s $out/opt/brother/Printers/MFCL5750DW/inf/brMFCL5750DWrc \ 104 + $out/etc/opt/brother/Printers/MFCL5750DW/inf/brMFCL5750DWrc 105 + ln -s \ 106 + $out/opt/brother/Printers/MFCL5750DW/cupswrapper/lpdwrapper \ 107 + $out/lib/cups/filter/brother_lpdwrapper_MFCL5750DW 108 + ln -s \ 109 + $out/opt/brother/Printers/MFCL5750DW/cupswrapper/brother-MFCL5750DW-cups-en.ppd \ 110 + $out/share/cups/model/ 111 + runHook postInstall 112 + ''; 113 + meta = { 114 + homepage = "https://www.brother.com/"; 115 + description = "Brother MFCL5750DW CUPS driver"; 116 + license = lib.licenses.unfree; 117 + platforms = builtins.map (arch: "${arch}-linux") arches; 118 + maintainers = with lib.maintainers; [ qdlmcfresh ]; 119 + }; 120 + })