cups-brother-hll2375dw: init at 4.0.0-1 (#204306)

Co-authored-by: Sandro <sandro.jaeckel@gmail.com>

authored by Florian Sandro and committed by GitHub 61e561d8 428a03f8

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