This commit is contained in:
parent
5f644d0ccd
commit
a394b9cefd
167 changed files with 2795 additions and 2122 deletions
|
@ -12,8 +12,13 @@
|
|||
coreutils,
|
||||
gnugrep,
|
||||
which,
|
||||
}: let
|
||||
arches = ["x86_64" "i686" "armv7l"];
|
||||
}:
|
||||
let
|
||||
arches = [
|
||||
"x86_64"
|
||||
"i686"
|
||||
"armv7l"
|
||||
];
|
||||
|
||||
runtimeDeps = [
|
||||
ghostscript
|
||||
|
@ -24,63 +29,67 @@
|
|||
which
|
||||
];
|
||||
in
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "cups-brother-mfcl2710dw";
|
||||
version = "4.0.0-1";
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "cups-brother-mfcl2710dw";
|
||||
version = "4.0.0-1";
|
||||
|
||||
nativeBuildInputs = [dpkg makeWrapper autoPatchelfHook];
|
||||
buildInputs = [perl];
|
||||
nativeBuildInputs = [
|
||||
dpkg
|
||||
makeWrapper
|
||||
autoPatchelfHook
|
||||
];
|
||||
buildInputs = [ perl ];
|
||||
|
||||
dontUnpack = true;
|
||||
dontUnpack = true;
|
||||
|
||||
src = fetchurl {
|
||||
url = "https://download.brother.com/welcome/dlf103526/mfcl2710dwpdrv-${version}.i386.deb";
|
||||
hash = "sha256-OOTvbCuyxw4k01CTMuBqG2boMN13q5xC7LacaweGmyw=";
|
||||
};
|
||||
src = fetchurl {
|
||||
url = "https://download.brother.com/welcome/dlf103526/mfcl2710dwpdrv-${version}.i386.deb";
|
||||
hash = "sha256-OOTvbCuyxw4k01CTMuBqG2boMN13q5xC7LacaweGmyw=";
|
||||
};
|
||||
|
||||
installPhase =
|
||||
''
|
||||
runHook preInstall
|
||||
installPhase =
|
||||
''
|
||||
runHook preInstall
|
||||
|
||||
mkdir -p $out
|
||||
dpkg-deb -x $src $out
|
||||
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/MFCL2710DW/lpd/${arch}"
|
||||
'') (builtins.filter (arch: arch != stdenv.hostPlatform.linuxArch) arches)
|
||||
+ ''
|
||||
# delete unnecessary files for the current architecture
|
||||
''
|
||||
+ lib.concatMapStrings (arch: ''
|
||||
echo Deleting files for ${arch}
|
||||
rm -r "$out/opt/brother/Printers/MFCL2710DW/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/MFCL2710DW/lpd/${stdenv.hostPlatform.linuxArch}/"* \
|
||||
"$out/opt/brother/Printers/MFCL2710DW/lpd/"
|
||||
# bundled scripts don't understand the arch subdirectories for some reason
|
||||
ln -s \
|
||||
"$out/opt/brother/Printers/MFCL2710DW/lpd/${stdenv.hostPlatform.linuxArch}/"* \
|
||||
"$out/opt/brother/Printers/MFCL2710DW/lpd/"
|
||||
|
||||
# Fix global references and replace auto discovery mechanism with hardcoded values
|
||||
substituteInPlace $out/opt/brother/Printers/MFCL2710DW/lpd/lpdfilter \
|
||||
--replace /opt "$out/opt" \
|
||||
--replace "my \$BR_PRT_PATH =" "my \$BR_PRT_PATH = \"$out/opt/brother/Printers/MFCL2710DW\"; #" \
|
||||
--replace "PRINTER =~" "PRINTER = \"MFCL2710DW\"; #"
|
||||
# Fix global references and replace auto discovery mechanism with hardcoded values
|
||||
substituteInPlace $out/opt/brother/Printers/MFCL2710DW/lpd/lpdfilter \
|
||||
--replace /opt "$out/opt" \
|
||||
--replace "my \$BR_PRT_PATH =" "my \$BR_PRT_PATH = \"$out/opt/brother/Printers/MFCL2710DW\"; #" \
|
||||
--replace "PRINTER =~" "PRINTER = \"MFCL2710DW\"; #"
|
||||
|
||||
# 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
|
||||
# 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
|
||||
# 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/MFCL2710DW/lpd/lpdfilter \
|
||||
$out/lib/cups/filter/brother_lpdwrapper_MFCL2710DW
|
||||
ln -s \
|
||||
$out/opt/brother/Printers/MFCL2710DW/lpd/lpdfilter \
|
||||
$out/lib/cups/filter/brother_lpdwrapper_MFCL2710DW
|
||||
|
||||
ln -s \
|
||||
$out/opt/brother/Printers/MFCL2710DW/cupswrapper/brother-MFCL2710DW-cups-en.ppd \
|
||||
$out/share/cups/model/
|
||||
ln -s \
|
||||
$out/opt/brother/Printers/MFCL2710DW/cupswrapper/brother-MFCL2710DW-cups-en.ppd \
|
||||
$out/share/cups/model/
|
||||
|
||||
runHook postInstall
|
||||
'';
|
||||
}
|
||||
runHook postInstall
|
||||
'';
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue