about summary refs log tree commit diff
path: root/pkgs/misc/cups
diff options
context:
space:
mode:
authorVladimír Čunát <vcunat@gmail.com>2016-04-01 10:06:01 +0200
committerVladimír Čunát <vcunat@gmail.com>2016-04-01 10:06:01 +0200
commitab15a62c68bf7bf3b02e3bab00d121cc1426733c (patch)
tree398a82403b04bfa0bae8cadf1c5a64cf83145965 /pkgs/misc/cups
parentc643ccaa8c91f78b8c89eb87589886b8906d5b38 (diff)
parenta26357eefe017964448b5bb464163646b927a267 (diff)
downloadnixlib-ab15a62c68bf7bf3b02e3bab00d121cc1426733c.tar
nixlib-ab15a62c68bf7bf3b02e3bab00d121cc1426733c.tar.gz
nixlib-ab15a62c68bf7bf3b02e3bab00d121cc1426733c.tar.bz2
nixlib-ab15a62c68bf7bf3b02e3bab00d121cc1426733c.tar.lz
nixlib-ab15a62c68bf7bf3b02e3bab00d121cc1426733c.tar.xz
nixlib-ab15a62c68bf7bf3b02e3bab00d121cc1426733c.tar.zst
nixlib-ab15a62c68bf7bf3b02e3bab00d121cc1426733c.zip
Merge branch 'master' into closure-size
Beware that stdenv doesn't build. It seems something more will be needed
than just resolution of merge conflicts.
Diffstat (limited to 'pkgs/misc/cups')
-rw-r--r--pkgs/misc/cups/drivers/brgenml1cupswrapper/default.nix105
-rw-r--r--pkgs/misc/cups/drivers/brgenml1lpr/default.nix93
-rw-r--r--pkgs/misc/cups/drivers/mfcj470dw/default.nix17
-rw-r--r--pkgs/misc/cups/drivers/splix/default.nix20
-rw-r--r--pkgs/misc/cups/drivers/splix/splix-2.0.0-gcc45.patch18
5 files changed, 222 insertions, 31 deletions
diff --git a/pkgs/misc/cups/drivers/brgenml1cupswrapper/default.nix b/pkgs/misc/cups/drivers/brgenml1cupswrapper/default.nix
new file mode 100644
index 000000000000..e4ac510dd148
--- /dev/null
+++ b/pkgs/misc/cups/drivers/brgenml1cupswrapper/default.nix
@@ -0,0 +1,105 @@
+{ stdenv, fetchurl, cups, perl, brgenml1lpr, debugLvl ? "0"}:
+
+/*
+    [Setup instructions](http://support.brother.com/g/s/id/linux/en/instruction_prn1a.html).
+
+    URI example
+     ~  `lpd://BRW0080927AFBCE/binary_p1`
+
+    Logging
+    -------
+    
+    `/tmp/br_cupswrapper_ml1.log` when `DEBUG > 0` in `brother_lpdwrapper_BrGenML1`.
+    Note that when `DEBUG > 1` the wrapper stops performing its function. Better
+    keep `DEBUG == 1` unless this is desirable.
+
+    Now activable through this package's `debugLvl` parameter whose value is to be
+    used to establish `DEBUG`.
+
+    Issues
+    ------
+
+     1.  >  Error: /tmp/brBrGenML1rc_15642 :cannot open file !!
+
+        This is a non fatal issue. The job will still be printed. However, not sure
+        what kind of information could be lost.
+
+        There should be a more elegant way to patch this.
+
+     2.  >  touch: cannot touch '/tmp/BrGenML1_latest_print_info': Permission denied
+
+        TODO: Address.
+
+     3.  >  perl: warning: Falling back to the standard locale ("C").
+    
+            are supported and installed on your system.
+            LANG = "en_US.UTF-8"
+            LC_ALL = (unset),
+            LANGUAGE = (unset),
+            perl: warning: Please check that your locale settings:
+            perl: warning: Setting locale failed.
+
+        TODO: Address.
+*/
+
+stdenv.mkDerivation rec {
+
+  name = "brgenml1cupswrapper-3.1.0-1";
+  src = fetchurl {
+    url = "http://download.brother.com/welcome/dlf101125/${name}.i386.deb";
+    sha256 = "0kd2a2waqr10kfv1s8is3nd5dlphw4d1343srdsbrlbbndja3s6r";
+  };
+
+  unpackPhase = ''
+    ar x $src
+    tar xfvz data.tar.gz
+  '';
+
+  buildInputs = [ cups perl brgenml1lpr ];
+  buildPhase = ":";
+
+  patchPhase = ''
+    WRAPPER=opt/brother/Printers/BrGenML1/cupswrapper/brother_lpdwrapper_BrGenML1
+    PAPER_CFG=opt/brother/Printers/BrGenML1/cupswrapper/paperconfigml1  
+
+    substituteInPlace $WRAPPER \
+      --replace "basedir =~" "basedir = \"${brgenml1lpr}/opt/brother/Printers/BrGenML1\"; #" \
+      --replace "PRINTER =~" "PRINTER = \"BrGenML1\"; #" \
+      --replace "\$DEBUG=0;" "\$DEBUG=${debugLvl};"
+
+    # Fixing issue #2.
+    substituteInPlace $WRAPPER \
+      --replace "\`cp " "\`cp -p " \
+      --replace "\$TEMPRC\`" "\$TEMPRC; chmod a+rw \$TEMPRC\`" \
+      --replace "\`mv " "\`cp -p "
+
+    # This config script make this assumption that the *.ppd are found in a global location `/etc/cups/ppd`.
+    substituteInPlace $PAPER_CFG \
+      --replace "/etc/cups/ppd" "$out/share/cups/model"
+  '';
+
+  installPhase = ''
+    CUPSFILTER=$out/lib/cups/filter
+    CUPSPPD=$out/share/cups/model
+
+    CUPSWRAPPER=opt/brother/Printers/BrGenML1/cupswrapper
+    mkdir -p $out/$CUPSWRAPPER
+    cp -rp $CUPSWRAPPER/* $out/$CUPSWRAPPER
+
+    mkdir -p $CUPSFILTER
+    ln -s $out/$CUPSWRAPPER/brother_lpdwrapper_BrGenML1 $CUPSFILTER
+
+    mkdir -p $CUPSPPD
+    ln -s $out/$CUPSWRAPPER/brother-BrGenML1-cups-en.ppd $CUPSPPD
+  '';
+
+  dontPatchELF = true;
+
+  meta = {
+    description = "Brother BrGenML1 CUPS wrapper driver";
+    homepage = http://www.brother.com;
+    platforms = stdenv.lib.platforms.linux;
+    license = stdenv.lib.licenses.gpl2Plus;
+    maintainers = with stdenv.lib.maintainers; [ jraygauthier ];
+  };
+}
diff --git a/pkgs/misc/cups/drivers/brgenml1lpr/default.nix b/pkgs/misc/cups/drivers/brgenml1lpr/default.nix
new file mode 100644
index 000000000000..6dc2408ec88a
--- /dev/null
+++ b/pkgs/misc/cups/drivers/brgenml1lpr/default.nix
@@ -0,0 +1,93 @@
+{ stdenv, fetchurl, cups, perl, glibc, ghostscript, which, makeWrapper}:
+
+/*
+    [Setup instructions](http://support.brother.com/g/s/id/linux/en/instruction_prn1a.html).
+
+    URI example
+     ~  `lpd://BRW0080927AFBCE/binary_p1`
+
+    Logging
+    -------
+    
+    `/tmp/br_lpdfilter_ml1.log` when `$ENV{LPD_DEBUG} > 0` in `filter_BrGenML1`
+    which is activated automatically when `DEBUG > 0` in `brother_lpdwrapper_BrGenML1`
+    from the cups wrapper.
+
+    Issues
+    ------
+
+     -  filter_BrGenML1 ln 196 `my $GHOST_SCRIPT=`which gs`;`
+      
+        `GHOST_SCRIPT` is empty resulting in an empty `/tmp/br_lpdfilter_ml1_gsout.dat` file.
+        See `/tmp/br_lpdfilter_ml1.log` for the executed command.
+
+    Notes
+    -----
+
+     -  The `setupPrintcap` has totally no use in our context.
+*/
+
+let
+  myPatchElf = file: with stdenv.lib; ''
+    patchelf --set-interpreter \
+      ${stdenv.glibc}/lib/ld-linux${optionalString stdenv.is64bit "-x86-64"}.so.2 \
+      ${file}
+  '';
+in
+stdenv.mkDerivation rec {
+
+  name = "brgenml1lpr-3.1.0-1";
+  src = fetchurl {
+    url = "http://download.brother.com/welcome/dlf101123/${name}.i386.deb";
+    sha256 = "0zdvjnrjrz9sba0k525linxp55lr4cyivfhqbkq1c11br2nvy09f";
+  };
+
+  unpackPhase = ''
+    ar x $src
+    tar xfvz data.tar.gz
+  '';
+
+  nativeBuildInputs = [ makeWrapper ];
+  buildInputs = [ cups perl glibc ghostscript which ];
+  
+  buildPhase = ":";
+
+  patchPhase = ''
+    INFDIR=opt/brother/Printers/BrGenML1/inf
+    LPDDIR=opt/brother/Printers/BrGenML1/lpd
+
+    # Setup max debug log by default.
+    substituteInPlace $LPDDIR/filter_BrGenML1 \
+      --replace "BR_PRT_PATH =~" "BR_PRT_PATH = \"$out/opt/brother/Printers/BrGenML1\"; #" \
+      --replace "PRINTER =~" "PRINTER = \"BrGenML1\"; #"
+
+    ${myPatchElf "$INFDIR/braddprinter"}
+    ${myPatchElf "$LPDDIR/brprintconflsr3"}
+    ${myPatchElf "$LPDDIR/rawtobr3"}
+  '';
+
+  installPhase = ''
+    INFDIR=opt/brother/Printers/BrGenML1/inf
+    LPDDIR=opt/brother/Printers/BrGenML1/lpd
+
+    mkdir -p $out/$INFDIR
+    cp -rp $INFDIR/* $out/$INFDIR
+    mkdir -p $out/$LPDDIR
+    cp -rp $LPDDIR/* $out/$LPDDIR
+
+    wrapProgram $out/$LPDDIR/filter_BrGenML1 \
+      --prefix PATH ":" "${ghostscript}/bin" \
+      --prefix PATH ":" "${which}/bin"
+  '';
+
+  dontPatchELF = true;
+
+
+  meta = {
+    description = "Brother BrGenML1 LPR driver";
+    homepage = http://www.brother.com;
+    platforms = stdenv.lib.platforms.linux;
+    license = stdenv.lib.licenses.gpl2Plus;
+    maintainers = with stdenv.lib.maintainers; [ jraygauthier ];
+  };
+}
diff --git a/pkgs/misc/cups/drivers/mfcj470dw/default.nix b/pkgs/misc/cups/drivers/mfcj470dw/default.nix
index b61344d1280e..b8458ae0af32 100644
--- a/pkgs/misc/cups/drivers/mfcj470dw/default.nix
+++ b/pkgs/misc/cups/drivers/mfcj470dw/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, cups, dpkg, ghostscript, patchelf, bash, file }:
+{ stdenv, fetchurl, cups, dpkg, ghostscript, patchelf, a2ps, coreutils, gnused, gawk, file }:
 
 stdenv.mkDerivation rec {
   name = "mfcj470dw-cupswrapper-${version}";
@@ -15,7 +15,7 @@ stdenv.mkDerivation rec {
       })
     ];
 
-  buildInputs = [ dpkg cups patchelf bash ];
+    buildInputs = [ cups ghostscript dpkg a2ps ];
 
   unpackPhase = "true";
 
@@ -29,9 +29,20 @@ stdenv.mkDerivation rec {
 
     substituteInPlace $out/opt/brother/Printers/mfcj470dw/lpd/filtermfcj470dw \
       --replace /opt "$out/opt" \
-      --replace file "/run/current-system/sw/bin/file"
+      --replace file "${file}/bin/file" \
+      --replace sed "${gnused}/bin/sed" \
+      --replace mktemp "${coreutils}/bin/mktemp" \
+      --replace cat "${coreutils}/bin/cat" \
+      --replace rm "${coreutils}/bin/rm"
 
     sed -i '/GHOST_SCRIPT=/c\GHOST_SCRIPT=gs' $out/opt/brother/Printers/mfcj470dw/lpd/psconvertij2
+    substituteInPlace $out/opt/brother/Printers/mfcj470dw/lpd/psconvertij2 \
+      --replace awk "${gawk}/bin/awk" \
+      --replace cat "${coreutils}/bin/cat" \
+      --replace mktemp "${coreutils}/bin/mktemp" \
+      --replace sed "${gnused}/bin/sed" \
+      --replace expr "${coreutils}/bin/expr" \
+      --replace rm "${coreutils}/bin/rm"
 
     patchelf --set-interpreter ${stdenv.glibc.out}/lib/ld-linux.so.2 $out/opt/brother/Printers/mfcj470dw/lpd/brmfcj470dwfilter
     patchelf --set-interpreter ${stdenv.glibc.out}/lib/ld-linux.so.2 $out/opt/brother/Printers/mfcj470dw/cupswrapper/brcupsconfpt1
diff --git a/pkgs/misc/cups/drivers/splix/default.nix b/pkgs/misc/cups/drivers/splix/default.nix
index 532ef2a45d5d..9a924e044d7f 100644
--- a/pkgs/misc/cups/drivers/splix/default.nix
+++ b/pkgs/misc/cups/drivers/splix/default.nix
@@ -1,16 +1,16 @@
-{stdenv, fetchurl, cups, zlib}:
-
+{ stdenv, fetchsvn, fetchurl, cups, zlib }:
+let rev = "315"; in
 stdenv.mkDerivation rec {
-  name = "splix-2.0.0";
-
-  src = fetchurl {
-    url = "mirror://sourceforge/splix/${name}.tar.bz2";
-    sha256 = "0bwivrwwvh6hzvnycpzqs7a0capgycahc4s3v9ihx552fgy07xwp";
+  name = "splix-svn-${rev}";
+  src = fetchsvn {
+    # We build this from svn, because splix hasn't been in released in several years
+    # although the community has been adding some new printer models.
+    url = "svn://svn.code.sf.net/p/splix/code/splix";
+    rev = "r${rev}";
+    sha256 = "16wbm4xnz35ca3mw2iggf5f4jaxpyna718ia190ka6y4ah932jxl";
   };
 
-  patches = [ ./splix-2.0.0-gcc45.patch ];
-
-  preBuild=''
+  preBuild = ''
     makeFlags="V=1 DISABLE_JBIG=1 CUPSFILTER=$out/lib/cups/filter CUPSPPD=$out/share/cups/model"
   '';
 
diff --git a/pkgs/misc/cups/drivers/splix/splix-2.0.0-gcc45.patch b/pkgs/misc/cups/drivers/splix/splix-2.0.0-gcc45.patch
deleted file mode 100644
index 5ccdcb2514c5..000000000000
--- a/pkgs/misc/cups/drivers/splix/splix-2.0.0-gcc45.patch
+++ /dev/null
@@ -1,18 +0,0 @@
-Fixing build with gcc 4.5
-
-http://bugs.gentoo.org/show_bug.cgi?id=318581
-
-downloaded from
-http://gentoo-overlays.zugaina.org/gentoo/portage/net-print/splix/files/splix-2.0.0-gcc45.patch
-
---- splix-old/src/ppdfile.cpp
-+++ splix-new/src/ppdfile.cpp
-@@ -282,7 +282,7 @@
-  * Opérateur d'assignation
-  * Assignment operator
-  */
--void PPDFile::Value::operator = (const PPDFile::Value::Value &val)
-+void PPDFile::Value::operator = (const PPDFile::Value &val)
- {
-     if (_preformatted)
-         delete[] _preformatted;