git.iko.soy/typeable/nixpkgs
on master help sign in
brgenml1cupswrapper: init at 3.1.0-1

Brother generic cups wrapper over lpr driver `brgenml1lpr` init at same version.

commitf4cc2c6fb7fa1f56eb253f43a9f0b1a3c4062861 authorRaymond Gauthier <jraygauthier@gmail.com> dateSat 5 Mar 2016, 19:34 (11 years ago) parent18d43d7
3 files changed+202
pkgs/misc/cups/drivers/brgenml1cupswrapper/default.nix+105 pkgs/misc/cups/drivers/brgenml1lpr/default.nix+93 pkgs/top-level/all-packages.nix+4
pkgs/misc/cups/drivers/brgenml1cupswrapper/default.nixnew file+105
@@ -0,0 +1,105 @@
1+{ stdenv, fetchurl, cups, perl, brgenml1lpr, debugLvl ? "0"}:
2+
3+/*
4+ [Setup instructions](http://support.brother.com/g/s/id/linux/en/instruction_prn1a.html).
5+
6+ URI example
7+ ~ `lpd://BRW0080927AFBCE/binary_p1`
8+
9+ Logging
10+ -------
11+
12+ `/tmp/br_cupswrapper_ml1.log` when `DEBUG > 0` in `brother_lpdwrapper_BrGenML1`.
13+ Note that when `DEBUG > 1` the wrapper stops performing its function. Better
14+ keep `DEBUG == 1` unless this is desirable.
15+
16+ Now activable through this package's `debugLvl` parameter whose value is to be
17+ used to establish `DEBUG`.
18+
19+ Issues
20+ ------
21+
22+ 1. > Error: /tmp/brBrGenML1rc_15642 :cannot open file !!
23+
24+ This is a non fatal issue. The job will still be printed. However, not sure
25+ what kind of information could be lost.
26+
27+ There should be a more elegant way to patch this.
28+
29+ 2. > touch: cannot touch '/tmp/BrGenML1_latest_print_info': Permission denied
30+
31+ TODO: Address.
32+
33+ 3. > perl: warning: Falling back to the standard locale ("C").
34+
35+ are supported and installed on your system.
36+ LANG = "en_US.UTF-8"
37+ LC_ALL = (unset),
38+ LANGUAGE = (unset),
39+ perl: warning: Please check that your locale settings:
40+ perl: warning: Setting locale failed.
41+
42+ TODO: Address.
43+*/
44+
45+stdenv.mkDerivation rec {
46+
47+ name = "brgenml1cupswrapper-3.1.0-1";
48+ src = fetchurl {
49+ url = "http://download.brother.com/welcome/dlf101125/${name}.i386.deb";
50+ sha256 = "0kd2a2waqr10kfv1s8is3nd5dlphw4d1343srdsbrlbbndja3s6r";
51+ };
52+
53+ unpackPhase = ''
54+ ar x $src
55+ tar xfvz data.tar.gz
56+ '';
57+
58+ buildInputs = [ cups perl brgenml1lpr ];
59+ buildPhase = ":";
60+
61+ patchPhase = ''
62+ WRAPPER=opt/brother/Printers/BrGenML1/cupswrapper/brother_lpdwrapper_BrGenML1
63+ PAPER_CFG=opt/brother/Printers/BrGenML1/cupswrapper/paperconfigml1
64+
65+ substituteInPlace $WRAPPER \
66+ --replace "basedir =~" "basedir = \"${brgenml1lpr}/opt/brother/Printers/BrGenML1\"; #" \
67+ --replace "PRINTER =~" "PRINTER = \"BrGenML1\"; #" \
68+ --replace "\$DEBUG=0;" "\$DEBUG=${debugLvl};"
69+
70+ # Fixing issue #2.
71+ substituteInPlace $WRAPPER \
72+ --replace "\`cp " "\`cp -p " \
73+ --replace "\$TEMPRC\`" "\$TEMPRC; chmod a+rw \$TEMPRC\`" \
74+ --replace "\`mv " "\`cp -p "
75+
76+ # This config script make this assumption that the *.ppd are found in a global location `/etc/cups/ppd`.
77+ substituteInPlace $PAPER_CFG \
78+ --replace "/etc/cups/ppd" "$out/share/cups/model"
79+ '';
80+
81+ installPhase = ''
82+ CUPSFILTER=$out/lib/cups/filter
83+ CUPSPPD=$out/share/cups/model
84+
85+ CUPSWRAPPER=opt/brother/Printers/BrGenML1/cupswrapper
86+ mkdir -p $out/$CUPSWRAPPER
87+ cp -rp $CUPSWRAPPER/* $out/$CUPSWRAPPER
88+
89+ mkdir -p $CUPSFILTER
90+ ln -s $out/$CUPSWRAPPER/brother_lpdwrapper_BrGenML1 $CUPSFILTER
91+
92+ mkdir -p $CUPSPPD
93+ ln -s $out/$CUPSWRAPPER/brother-BrGenML1-cups-en.ppd $CUPSPPD
94+ '';
95+
96+ dontPatchELF = true;
97+
98+ meta = {
99+ description = "Brother BrGenML1 CUPS wrapper driver";
100+ homepage = http://www.brother.com;
101+ platforms = stdenv.lib.platforms.linux;
102+ license = stdenv.lib.licenses.gpl2Plus;
103+ maintainers = with stdenv.lib.maintainers; [ jraygauthier ];
104+ };
105+}
pkgs/misc/cups/drivers/brgenml1lpr/default.nixnew file+93
@@ -0,0 +1,93 @@
1+{ stdenv, fetchurl, cups, perl, glibc, ghostscript, which, makeWrapper}:
2+
3+/*
4+ [Setup instructions](http://support.brother.com/g/s/id/linux/en/instruction_prn1a.html).
5+
6+ URI example
7+ ~ `lpd://BRW0080927AFBCE/binary_p1`
8+
9+ Logging
10+ -------
11+
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.
15+
16+ Issues
17+ ------
18+
19+ - filter_BrGenML1 ln 196 `my $GHOST_SCRIPT=`which gs`;`
20+
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.
23+
24+ Notes
25+ -----
26+
27+ - The `setupPrintcap` has totally no use in our context.
28+*/
29+
30+let
31+ myPatchElf = file: with stdenv.lib; ''
32+ patchelf --set-interpreter \
33+ ${stdenv.glibc}/lib/ld-linux${optionalString stdenv.is64bit "-x86-64"}.so.2 \
34+ ${file}
35+ '';
36+in
37+stdenv.mkDerivation rec {
38+
39+ name = "brgenml1lpr-3.1.0-1";
40+ src = fetchurl {
41+ url = "http://download.brother.com/welcome/dlf101123/${name}.i386.deb";
42+ sha256 = "0zdvjnrjrz9sba0k525linxp55lr4cyivfhqbkq1c11br2nvy09f";
43+ };
44+
45+ unpackPhase = ''
46+ ar x $src
47+ tar xfvz data.tar.gz
48+ '';
49+
50+ nativeBuildInputs = [ makeWrapper ];
51+ buildInputs = [ cups perl glibc ghostscript which ];
52+
53+ buildPhase = ":";
54+
55+ patchPhase = ''
56+ INFDIR=opt/brother/Printers/BrGenML1/inf
57+ LPDDIR=opt/brother/Printers/BrGenML1/lpd
58+
59+ # Setup max debug log by default.
60+ substituteInPlace $LPDDIR/filter_BrGenML1 \
61+ --replace "BR_PRT_PATH =~" "BR_PRT_PATH = \"$out/opt/brother/Printers/BrGenML1\"; #" \
62+ --replace "PRINTER =~" "PRINTER = \"BrGenML1\"; #"
63+
64+ ${myPatchElf "$INFDIR/braddprinter"}
65+ ${myPatchElf "$LPDDIR/brprintconflsr3"}
66+ ${myPatchElf "$LPDDIR/rawtobr3"}
67+ '';
68+
69+ installPhase = ''
70+ INFDIR=opt/brother/Printers/BrGenML1/inf
71+ LPDDIR=opt/brother/Printers/BrGenML1/lpd
72+
73+ mkdir -p $out/$INFDIR
74+ cp -rp $INFDIR/* $out/$INFDIR
75+ mkdir -p $out/$LPDDIR
76+ cp -rp $LPDDIR/* $out/$LPDDIR
77+
78+ wrapProgram $out/$LPDDIR/filter_BrGenML1 \
79+ --prefix PATH ":" "${ghostscript}/bin" \
80+ --prefix PATH ":" "${which}/bin"
81+ '';
82+
83+ dontPatchELF = true;
84+
85+
86+ meta = {
87+ description = "Brother BrGenML1 LPR driver";
88+ homepage = http://www.brother.com;
89+ platforms = stdenv.lib.platforms.linux;
90+ license = stdenv.lib.licenses.gpl2Plus;
91+ maintainers = with stdenv.lib.maintainers; [ jraygauthier ];
92+ };
93+}
pkgs/top-level/all-packages.nix+4
@@ -15706,6 +15706,10 @@ let
1570615706
1570715707 beep = callPackage ../misc/beep { };
1570815708
15709+ brgenml1lpr = callPackage ../misc/cups/drivers/brgenml1lpr {};
15710+
15711+ brgenml1cupswrapper = callPackage ../misc/cups/drivers/brgenml1cupswrapper {};
15712+
1570915713 cups = callPackage ../misc/cups {
1571015714 libusb = libusb1;
1571115715 };