Created
August 27, 2017 18:50
-
-
Save NWuensche/9a1485a9d008d284d2ebb717ee46bde9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ pkgs, stdenv, fetchurl, cups, dpkg, ghostscript, patchelf, a2ps, coreutils, gnused, gawk, file, makeWrapper, tcsh }: | |
stdenv.mkDerivation rec { | |
name = "mfc2j47dd0dw-cupswrapper-${version}"; | |
version = "3.0.0-1"; | |
src = fetchurl { | |
url = "http://download.brother.com/welcome/dlf005443/dcp145clpr-1.1.2-2.i386.deb"; | |
sha256 = "0230jlsmhh5m1fm5386r2zq0zb7mvi0abp6pxnqddqbg1sfw94i5"; | |
}; | |
srcLPD = ./brlpdwrapperDCP145C; | |
srcPPD = ./MFC.ppd; | |
nativeBuildInputs = [ makeWrapper ]; | |
buildInputs = [ cups ghostscript dpkg a2ps tcsh ]; | |
unpackPhase = "true"; | |
installPhase = '' | |
ar x $src | |
tar xzvf data.tar.gz | |
substituteInPlace usr/local/Brother/Printer/dcp145c/lpd/filterdcp145c \ | |
--replace /opt "$out/opt" | |
sed -i '/GHOST_SCRIPT=/c\GHOST_SCRIPT=gs' usr/local/Brother/Printer/dcp145c/lpd/psconvertij2 | |
# patchelf --set-interpreter ${stdenv.glibc.out}/lib/ld-linux.so.2 usr/local/Brother/lpd/rastertobrij2 | |
patchelf --set-interpreter ${stdenv.glibc}/lib/ld-linux.so.2 usr/bin/brprintconfij2 | |
# ln -sr usr/lib/libbrcompij2.so.1.0.2 -T usr/lib/libbrcompij2.so.1 | |
#patchelf --set-rpath $out/usr/lib usr/local/Brother/lpd/rastertobrij2 | |
#install -m 755 $srcLPD $out/lib/cups/filter/brlpdwrapperDCP145C | |
cp $srcLPD ./brlpdwrapperDCP145C | |
patchShebangs ./brlpdwrapperDCP145C | |
substituteInPlace brlpdwrapperDCP145C \ | |
--replace /usr "$out/usr" \ | |
--replace CHANGE "$out/share/cups/model/brdcp145c_cups.ppd" | |
# --replace brprintconfij2 "$out/usr/bin/brprintconfij2" | |
substituteInPlace usr/local/Brother/Printer/dcp145c/lpd/filterdcp145c \ | |
--replace /usr/local/Brother/ "$out/usr/local/Brother/" | |
mkdir -p $out | |
mkdir -p $out/weg | |
mkdir -p $out/lib/cups/filter/ | |
mkdir -p $out/share/cups/model | |
cp -r -v usr $out | |
cp brlpdwrapperDCP145C $out/lib/cups/filter/brlpdwrapperDCP145C | |
cp $srcPPD $out/share/cups/model/brdcp145c_cups.ppd | |
wrapProgram $out/lib/cups/filter/brlpdwrapperDCP145C \ | |
--prefix PATH ":" "$out/usr/bin:${stdenv.lib.makeBinPath [ coreutils ]}" | |
wrapProgram $out/usr/local/Brother/Printer/dcp145c/lpd/psconvertij2 \ | |
--prefix PATH ":" ${ stdenv.lib.makeBinPath [ gnused coreutils gawk ] } | |
wrapProgram $out/usr/local/Brother/Printer/dcp145c/lpd/filterdcp145c \ | |
--prefix PATH ":" ${ stdenv.lib.makeBinPath [ ghostscript a2ps file gnused coreutils ] } | |
''; | |
postInstall = '' | |
chmod 0777 $out/lib/cups/filter/brlpdwrapperDCP145C | |
''; | |
meta = { | |
homepage = http://www.brother.com/; | |
description = "Brother MFC-J470DW LPR driver"; | |
license = stdenv.lib.licenses.unfree; | |
platforms = stdenv.lib.platforms.linux; | |
downloadPage = http://support.brother.com/g/b/downloadlist.aspx?c=us&lang=en&prod=mfcj470dw_us_eu_as&os=128; | |
maintainers = [ stdenv.lib.maintainers.yochai ]; | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment