Merge pull request #222837 from aplund/brother-hl-l3230cdw

cups-drivers: Brother HL-L3230CDW driver version 1.0.2-0
This commit is contained in:
Sandro 2023-04-18 16:54:35 +02:00 committed by GitHub
commit 2e532b8b26
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 88 additions and 0 deletions

View File

@ -1124,6 +1124,16 @@
githubId = 73002165;
name = "apfelkuchen6";
};
aplund = {
email = "austin.lund@gmail.com";
matrix = "@aplund:matrix.org";
github = "aplund";
githubId = 1369436;
name = "Austin Lund";
keys = [{
fingerprint = "7083 E268 4BFD 845F 2B84 9E74 B695 8918 ED23 32CE";
}];
};
applePrincess = {
email = "appleprincess@appleprincess.io";
github = "applePrincess";

View File

@ -0,0 +1,76 @@
{ stdenv, lib, fetchurl, perl, gnused, dpkg, makeWrapper, autoPatchelfHook, libredirect }:
stdenv.mkDerivation rec {
pname = "cups-brother-hll3230cdw";
version = "1.0.2";
src = fetchurl {
url = "https://download.brother.com/welcome/dlf103925/hll3230cdwpdrv-${version}-0.i386.deb";
sha256 = "9d49abc584bf22bc381510618a34107ead6ab14562b51831fefd6009947aa5a9";
};
nativeBuildInputs = [ dpkg makeWrapper autoPatchelfHook ];
buildInputs = [ perl gnused libredirect ];
unpackPhase = "dpkg-deb -x $src .";
installPhase = ''
runHook preInstall
mkdir -p "$out"
cp -pr opt "$out"
cp -pr usr/bin "$out/bin"
rm "$out/opt/brother/Printers/hll3230cdw/cupswrapper/cupswrapperhll3230cdw"
mkdir -p "$out/lib/cups/filter" "$out/share/cups/model"
ln -s "$out/opt/brother/Printers/hll3230cdw/cupswrapper/brother_lpdwrapper_hll3230cdw" \
"$out/lib/cups/filter/brother_lpdwrapper_hll3230cdw"
ln -s "$out/opt/brother/Printers/hll3230cdw/cupswrapper/brother_hll3230cdw_printer_en.ppd" \
"$out/share/cups/model/brother_hll3230cdw_printer_en.ppd"
runHook postInstall
'';
# Fix global references and replace auto discovery mechanism
# with hardcoded values.
#
# The configuration binary 'brprintconf_hll3230cdw' and lpd filter
# 'brhll3230cdwfilter' has hardcoded /opt format strings. There isn't
# sufficient space in the binaries to substitute a path in the store, so use
# libredirect to get it to see the correct path. The configuration binary
# also uses this format string to print configuration locations. Here the
# wrapper output is processed to point into the correct location in the
# store.
postFixup = ''
substituteInPlace $out/opt/brother/Printers/hll3230cdw/lpd/filter_hll3230cdw \
--replace "my \$BR_PRT_PATH =" "my \$BR_PRT_PATH = \"$out/opt/brother/Printers/hll3230cdw/\"; #" \
--replace "PRINTER =~" "PRINTER = \"hll3230cdw\"; #"
substituteInPlace $out/opt/brother/Printers/hll3230cdw/cupswrapper/brother_lpdwrapper_hll3230cdw \
--replace "PRINTER =~" "PRINTER = \"hll3230cdw\"; #" \
--replace "my \$basedir = \`readlink \$0\`" "my \$basedir = \"$out/opt/brother/Printers/hll3230cdw/\""
wrapProgram $out/bin/brprintconf_hll3230cdw \
--set LD_PRELOAD "${libredirect}/lib/libredirect.so" \
--set NIX_REDIRECTS /opt=$out/opt
wrapProgram $out/opt/brother/Printers/hll3230cdw/lpd/brhll3230cdwfilter \
--set LD_PRELOAD "${libredirect}/lib/libredirect.so" \
--set NIX_REDIRECTS /opt=$out/opt
substituteInPlace $out/bin/brprintconf_hll3230cdw \
--replace \"\$"@"\" \"\$"@\" | LD_PRELOAD= ${gnused}/bin/sed -E '/^(function list :|resource file :).*/{s#/opt#$out/opt#}'"
'';
meta = with lib; {
description = "Brother HL-L3230CDW printer driver";
license = licenses.unfree;
sourceProvenance = with sourceTypes; [ binaryNativeCode ];
maintainers = with maintainers; [ aplund ];
platforms = [ "x86_64-linux" "i686-linux" ];
homepage = "http://www.brother.com/";
downloadPage = "https://support.brother.com/g/b/downloadend.aspx?c=us&lang=en&prod=hll3230cdw_us_eu_as&os=128&dlid=dlf103925_000&flang=4&type3=10283";
};
}

View File

@ -38298,6 +38298,8 @@ with pkgs;
cups-brother-hll2340dw = pkgsi686Linux.callPackage ../misc/cups/drivers/hll2340dw { };
cups-brother-hll3230cdw = pkgsi686Linux.callPackage ../misc/cups/drivers/hll3230cdw { };
cups-brother-hll2350dw = callPackage ../misc/cups/drivers/hll2350dw { };
cups-brother-mfcl2750dw = callPackage ../misc/cups/drivers/mfcl2750dw { };