anvil-editor: init at 0.4
[NixPkgs.git] / pkgs / misc / cups / drivers / brgenml1lpr / default.nix
blob98116903ec64c4d446faea9342892d097d1d8be4
1 { lib, stdenv, fetchurl, cups, perl, ghostscript, which, makeWrapper}:
3 /*
4     [Setup instructions](http://support.brother.com/g/s/id/linux/en/instruction_prn1a.html).
6     URI example
7      ~  `lpd://BRW0080927AFBCE/binary_p1`
9     Logging
10     -------
12     `/tmp/br_lpdfilter_ml1.log` when `$ENV{LPD_DEBUG} > 0` in `filter_BrGenML1`
13     which is activated automatically when `DEBUG > 0` in `brother_lpdwrapper_BrGenML1`
14     from the cups wrapper.
16     Issues
17     ------
19      -  filter_BrGenML1 ln 196 `my $GHOST_SCRIPT=`which gs`;`
21         `GHOST_SCRIPT` is empty resulting in an empty `/tmp/br_lpdfilter_ml1_gsout.dat` file.
22         See `/tmp/br_lpdfilter_ml1.log` for the executed command.
24     Notes
25     -----
27      -  The `setupPrintcap` has totally no use in our context.
30 let
31   myPatchElf = file: ''
32     patchelf --set-interpreter \
33       ${stdenv.cc.libc}/lib/ld-linux${lib.optionalString stdenv.hostPlatform.is64bit "-x86-64"}.so.2 \
34       ${file}
35   '';
37 stdenv.mkDerivation rec {
38   pname = "brgenml1lpr";
39   version = "3.1.0-1";
41   src = fetchurl {
42     url = "https://download.brother.com/welcome/dlf101123/brgenml1lpr-${version}.i386.deb";
43     sha256 = "0zdvjnrjrz9sba0k525linxp55lr4cyivfhqbkq1c11br2nvy09f";
44   };
46   unpackPhase = ''
47     ar x $src
48     tar xfvz data.tar.gz
49   '';
51   nativeBuildInputs = [ makeWrapper ];
52   buildInputs = [ cups perl stdenv.cc.libc ghostscript which ];
54   dontBuild = true;
56   patchPhase = ''
57     INFDIR=opt/brother/Printers/BrGenML1/inf
58     LPDDIR=opt/brother/Printers/BrGenML1/lpd
60     # Setup max debug log by default.
61     substituteInPlace $LPDDIR/filter_BrGenML1 \
62       --replace "BR_PRT_PATH =~" "BR_PRT_PATH = \"$out/opt/brother/Printers/BrGenML1\"; #" \
63       --replace "PRINTER =~" "PRINTER = \"BrGenML1\"; #"
65     ${myPatchElf "$INFDIR/braddprinter"}
66     ${myPatchElf "$LPDDIR/brprintconflsr3"}
67     ${myPatchElf "$LPDDIR/rawtobr3"}
68   '';
70   installPhase = ''
71     INFDIR=opt/brother/Printers/BrGenML1/inf
72     LPDDIR=opt/brother/Printers/BrGenML1/lpd
74     mkdir -p $out/$INFDIR
75     cp -rp $INFDIR/* $out/$INFDIR
76     mkdir -p $out/$LPDDIR
77     cp -rp $LPDDIR/* $out/$LPDDIR
79     wrapProgram $out/$LPDDIR/filter_BrGenML1 \
80       --prefix PATH ":" "${ghostscript}/bin" \
81       --prefix PATH ":" "${which}/bin"
82   '';
84   dontPatchELF = true;
87   meta = {
88     description = "Brother BrGenML1 LPR driver";
89     homepage = "http://www.brother.com";
90     sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
91     platforms = lib.platforms.linux;
92     license = lib.licenses.unfreeRedistributable;
93     maintainers = with lib.maintainers; [ jraygauthier ];
94   };