cups-brother-hll2310d: init at 4.0.0-1 (#484341)

This commit is contained in:
Arne Keller
2026-09-30 09:41:42 +00:00
committed by GitHub
2 changed files with 114 additions and 0 deletions

View File

@@ -13191,6 +13191,13 @@
githubId = 2377;
name = "Jonathan del Strother";
};
jderrac = {
email = "jeremy@derrac.fr";
github = "jderrac";
githubId = 1788613;
name = "Jérémy Derrac";
keys = [ { fingerprint = "7B18 DA58 169F AEB8 6826 D1D6 BED4 91C6 40AB 31DD"; } ];
};
jdev082 = {
email = "jdev0894@gmail.com";
github = "jdev082";

View File

@@ -0,0 +1,107 @@
{
lib,
stdenv,
fetchurl,
dpkg,
autoPatchelfHook,
makeWrapper,
perl,
gnused,
ghostscript,
file,
coreutils,
gnugrep,
which,
}:
let
arches = [
"x86_64"
"i686"
"armv7l"
];
runtimeDeps = [
ghostscript
file
gnused
gnugrep
coreutils
which
];
in
stdenv.mkDerivation (finalAttrs: {
pname = "cups-brother-hll2310d";
version = "4.0.0-1";
strictDeps = true;
__structuredAttrs = true;
nativeBuildInputs = [
dpkg
makeWrapper
autoPatchelfHook
];
buildInputs = [ perl ];
dontUnpack = true;
src = fetchurl {
url = "https://download.brother.com/pub/com/linux/linux/packages/hll2310dpdrv-${finalAttrs.version}.i386.deb";
hash = "sha256-g+ny6rTqiBXIPWEUnHqdXdXpRd4V8Ibs3VLmfsx1QbQ=";
};
installPhase = ''
runHook preInstall
mkdir -p $out
dpkg-deb -x $src $out
# delete unnecessary files for the current architecture
''
+ lib.concatMapStrings (arch: ''
echo Deleting files for ${arch}
rm -r "$out/opt/brother/Printers/HLL2310D/lpd/${arch}"
'') (builtins.filter (arch: arch != stdenv.hostPlatform.linuxArch) arches)
+ ''
# bundled scripts don't understand the arch subdirectories for some reason
ln -s \
"$out/opt/brother/Printers/HLL2310D/lpd/${stdenv.hostPlatform.linuxArch}/"* \
"$out/opt/brother/Printers/HLL2310D/lpd/"
# Fix global references and replace auto discovery mechanism with hardcoded values
substituteInPlace $out/opt/brother/Printers/HLL2310D/lpd/lpdfilter \
--replace /opt "$out/opt" \
--replace "my \$BR_PRT_PATH =" "my \$BR_PRT_PATH = \"$out/opt/brother/Printers/HLL2310D\"; #" \
--replace "PRINTER =~" "PRINTER = \"HLL2310D\"; #"
# Make sure all executables have the necessary runtime dependencies available
find "$out" -executable -and -type f | while read file; do
wrapProgram "$file" --prefix PATH : "${lib.makeBinPath runtimeDeps}"
done
# Symlink filter and ppd into a location where CUPS will discover it
mkdir -p $out/lib/cups/filter
mkdir -p $out/share/cups/model
ln -s \
$out/opt/brother/Printers/HLL2310D/lpd/lpdfilter \
$out/lib/cups/filter/brother_lpdwrapper_HLL2310D
ln -s \
$out/opt/brother/Printers/HLL2310D/cupswrapper/brother-HLL2310D-cups-en.ppd \
$out/share/cups/model/
runHook postInstall
'';
meta = {
homepage = "http://www.brother.com/";
description = "Brother HL-L2310D printer driver";
sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
license = lib.licenses.unfree;
platforms = map (arch: "${arch}-linux") arches;
downloadPage = "https://support.brother.com/g/b/downloadlist.aspx?c=fr&lang=fr&prod=hll2310d_us_eu_as&os=128";
maintainers = [ lib.maintainers.jderrac ];
};
})