gnu: hplip: Add Qt GUI support.
[jackhill/guix/guix.git] / gnu / packages / cups.scm
index 879ec42..2fedd3a 100644 (file)
@@ -5,6 +5,7 @@
 ;;; Copyright © 2016 Danny Milosavljevic <dannym@scratchpost.org>
 ;;; Copyright © 2017 Leo Famulari <leo@famulari.name>
 ;;; Copyright © 2017 Mark H Weaver <mhw@netris.org>
+;;; Copyright © 2017, 2018 Tobias Geerinckx-Rice <me@tobias.gr>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
 ;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
 
 (define-module (gnu packages cups)
-  #:use-module ((guix licenses) #:prefix license:)
-  #:use-module (guix packages)
-  #:use-module (guix download)
-  #:use-module (guix build-system gnu)
   #:use-module (gnu packages)
+  #:use-module (gnu packages algebra)
+  #:use-module (gnu packages autotools)
   #:use-module (gnu packages avahi)
   #:use-module (gnu packages compression)
-  #:use-module (gnu packages libusb)
-  #:use-module (gnu packages autotools)
-  #:use-module (gnu packages python)
-  #:use-module (gnu packages scanner)
-  #:use-module (gnu packages image)
-  #:use-module (gnu packages fonts) ;font-dejavu
+  #:use-module (gnu packages fonts)     ; font-dejavu
   #:use-module (gnu packages fontutils)
   #:use-module (gnu packages ghostscript)
   #:use-module (gnu packages glib)
+  #:use-module (gnu packages groff)
+  #:use-module (gnu packages image)
+  #:use-module (gnu packages libusb)
   #:use-module (gnu packages pdf)
+  #:use-module (gnu packages perl)
   #:use-module (gnu packages pkg-config)
-  #:use-module (gnu packages tls))
-
-;; Delay to avoid module circularity problems.
-(define ghostscript/cups
-  (delay
-    (package/inherit ghostscript
-      (name "ghostscript-with-cups")
-      (inputs `(("cups" ,cups-minimal)
-                ,@(package-inputs ghostscript))))))
+  #:use-module (gnu packages pretty-print)
+  #:use-module (gnu packages python)
+  #:use-module (gnu packages qt)
+  #:use-module (gnu packages scanner)
+  #:use-module (gnu packages tls)
+  #:use-module (guix build-system gnu)
+  #:use-module (guix download)
+  #:use-module ((guix licenses) #:prefix license:)
+  #:use-module (guix packages))
 
 (define-public cups-filters
   (package
     (name "cups-filters")
-    (version "1.14.1")
+    (version "1.20.1")
     (source(origin
               (method url-fetch)
               (uri
-               (string-append "http://openprinting.org/download/cups-filters/"
+               (string-append "https://openprinting.org/download/cups-filters/"
                               "cups-filters-" version ".tar.xz"))
               (sha256
                (base32
-                "0175jhqpsyn7bkh7w43ydhyws5zsdak05hr1fsadvzslvwqkffgi"))
+                "0qix1whz5n4ijnl6d44f1v8nzkpv99wqjyrby8vx6xnpskw5hsxk"))
               (modules '((guix build utils)))
               (snippet
                ;; install backends, banners and filters to cups-filters output
                   ;; output directory, not CUPS's prefix.
                   (substitute* "configure"
                     (("\\{CUPS_DATADIR\\}/data")
-                     "{prefix}/share/cups/data"))))))
+                     "{prefix}/share/cups/data"))
+                  #t))))
     (build-system gnu-build-system)
     (arguments
      `(#:make-flags (list (string-append "PREFIX=" %output))
        #:configure-flags
        `("--disable-driverless" ; TODO: enable this
          "--disable-mutool"     ; depends on yet another PDF library (mupdf)
+
+         ;; Look for the "domain socket of CUPS" in /var/run/cups.
+         "--localstatedir=/var"
+
+         ;; Free software for the win.
+         "--with-acroread-path=evince"
+
          ,(string-append "--with-test-font-path="
                          (assoc-ref %build-inputs "font-dejavu")
                          "/share/fonts/truetype/DejaVuSans.ttf")
        ("fontconfig"   ,fontconfig)
        ("freetype"     ,freetype)
        ("font-dejavu"  ,font-dejavu) ; also needed by test suite
-       ("ghostscript"  ,(force ghostscript/cups))
+       ("ghostscript"  ,ghostscript/cups)
        ("ijs"          ,ijs)
        ("dbus"         ,dbus)
        ("lcms"         ,lcms)
@@ -168,7 +174,7 @@ filters for the PDF-centric printing workflow introduced by OpenPrinting.")
 (define-public cups-minimal
   (package
     (name "cups-minimal")
-    (version "2.2.4")
+    (version "2.2.6")
     (source
      (origin
        (method url-fetch)
@@ -176,7 +182,7 @@ filters for the PDF-centric printing workflow introduced by OpenPrinting.")
                            version "/cups-" version "-source.tar.gz"))
        (sha256
         (base32
-         "1k4qxafmapq6hzbkh273fdyzkj9alw6ppwz5k933bhsi4svlsvar"))))
+         "16qn41b84xz6khrr2pa2wdwlqxr29rrrkjfi618gbgdkq9w5ff20"))))
     (build-system gnu-build-system)
     (arguments
      `(#:configure-flags
@@ -193,7 +199,8 @@ filters for the PDF-centric printing workflow introduced by OpenPrinting.")
            (lambda _
              (substitute* "Makedefs.in"
                (("INITDIR.*=.*@INITDIR@") "INITDIR = @prefix@/@INITDIR@")
-               (("/bin/sh") (which "sh")))))
+               (("/bin/sh") (which "sh")))
+             #t))
          ;; Make the compressed manpages writable so that the
          ;; reset-gzip-timestamps phase does not error out.
          (add-before 'reset-gzip-timestamps 'make-manpages-writable
@@ -201,12 +208,14 @@ filters for the PDF-centric printing workflow introduced by OpenPrinting.")
              (let* ((out (assoc-ref outputs "out"))
                     (man (string-append out "/share/man")))
                (for-each (lambda (file) (chmod file #o644))
-                         (find-files man "\\.gz")))))
+                         (find-files man "\\.gz"))
+               #t)))
          (add-before 'build 'patch-tests
            (lambda _
              (substitute* "test/ippserver.c"
                (("#  else /\\* HAVE_AVAHI \\*/")
-                "#elif defined(HAVE_AVAHI)")))))))
+                "#elif defined(HAVE_AVAHI)"))
+             #t)))))
     (native-inputs
      `(("pkg-config" ,pkg-config)))
     (inputs
@@ -215,13 +224,13 @@ filters for the PDF-centric printing workflow introduced by OpenPrinting.")
     (home-page "https://www.cups.org")
     (synopsis "The Common Unix Printing System")
     (description
-     "CUPS is a printing system that uses the Internet Printing
-Protocol (IPP).  It provides System V and BSD command-line interfaces, as well
+     "CUPS is a printing system that uses the Internet Printing Protocol
+(@dfn{IPP}).  It provides System V and BSD command-line interfaces, as well
 as a Web interface and a C programming interface to manage printers and print
 jobs.  It supports printing to both local (parallel, serial, USB) and
 networked printers, and printers can be shared from one computer to another.
-Internally, CUPS uses PostScript Printer Description (PPD) files to describe
-printer capabilities and features and a wide variety of generic and
+Internally, CUPS uses PostScript Printer Description (@dfn{PPD}) files to
+describe printer capabilities and features, and a wide variety of generic and
 device-specific programs to convert and print many types of files.")
     (license license:gpl2)))
 
@@ -244,7 +253,8 @@ device-specific programs to convert and print many types of files.")
            (lambda _
              (substitute* "Makedefs.in"
                (("INITDIR.*=.*@INITDIR@") "INITDIR = @prefix@/@INITDIR@")
-               (("/bin/sh") (which "sh")))))
+               (("/bin/sh") (which "sh")))
+             #t))
          (add-before 'check 'patch-tests
            (lambda _
              (let ((filters (assoc-ref %build-inputs "cups-filters"))
@@ -302,7 +312,8 @@ device-specific programs to convert and print many types of files.")
                  (("cupsFileFind\\(\"cat\", \"/bin\"")
                   (string-append "cupsFileFind(\"cat\", \"" catpath "\""))
                  (("cupsFileFind\\(\"cat\", \"/bin:/usr/bin\"")
-                  (string-append "cupsFileFind(\"cat\", \"" catpath "\""))))))
+                  (string-append "cupsFileFind(\"cat\", \"" catpath "\"")))
+               #t)))
          ;; Make the compressed manpages writable so that the
          ;; reset-gzip-timestamps phase does not error out.
          (add-before 'reset-gzip-timestamps 'make-manpages-writable
@@ -310,7 +321,8 @@ device-specific programs to convert and print many types of files.")
              (let* ((out (assoc-ref outputs "out"))
                     (man (string-append out "/share/man")))
                (for-each (lambda (file) (chmod file #o644))
-                         (find-files man "\\.gz")))))
+                         (find-files man "\\.gz"))
+               #t)))
          (add-after 'install 'install-cups-filters-symlinks
            (lambda* (#:key inputs outputs #:allow-other-keys)
              (let ((out (assoc-ref outputs "out"))
@@ -356,7 +368,9 @@ device-specific programs to convert and print many types of files.")
                (let ((data "/share/cups/data"))
                  (delete-file-recursively (string-append out data))
                  (symlink (string-append cups-filters data)
-                          (string-append out data)))))))))
+                          (string-append out data)))
+
+               #t))))))
     (inputs
      `(("avahi" ,avahi)
        ("gnutls" ,gnutls)
@@ -366,14 +380,21 @@ device-specific programs to convert and print many types of files.")
 (define-public hplip
   (package
     (name "hplip")
-    (version "3.17.7")
+    (version "3.18.6")
     (source (origin
               (method url-fetch)
               (uri (string-append "mirror://sourceforge/hplip/hplip/" version
                                   "/hplip-" version ".tar.gz"))
               (sha256
                (base32
-                "03a0vkbrzvgj15il9rvr93kf5pc706gxcjk6akbkzds0zmdbsxrm"))))
+                "0zbv6cp9n3xypf2fg4j6fpz8zkvl0z08lyc1vq1gd04ln1l3xkqf"))
+              (modules '((guix build utils)))
+              (snippet
+               ;; Fix type mismatch.
+               '(begin
+                  (substitute* "prnt/hpcups/genPCLm.cpp"
+                    (("boolean") "bool"))
+                  #t))))
     (build-system gnu-build-system)
     (home-page "http://hplipopensource.com/")
     (synopsis "HP Printer Drivers")
@@ -404,7 +425,8 @@ device-specific programs to convert and print many types of files.")
          ,(string-append "--with-icondir="
                          (assoc-ref %outputs "out") "/share/applications")
          ,(string-append "--with-systraydir="
-                         (assoc-ref %outputs "out") "/etc/xdg"))
+                         (assoc-ref %outputs "out") "/etc/xdg")
+         "--enable-qt5" "--disable-qt4")
 
        #:imported-modules ((guix build python-build-system)
                            ,@%gnu-build-system-modules)
@@ -433,17 +455,17 @@ device-specific programs to convert and print many types of files.")
                           (("/usr/include/libusb-1.0")
                            (string-append (assoc-ref inputs "libusb")
                                           "/include/libusb-1.0"))
-                          (("^\tinstall-dist_hplip_stateDATA")
-                           ;; Remove dependencies on
-                           ;; 'install-dist_hplip_stateDATA' so we don't bail
-                           ;; out while trying to create /var/lib/hplip.
-                           "\t")
+                          (("hplip_statedir =.*$")
+                           ;; Don't bail out while trying to create
+                           ;; /var/lib/hplip.  We can safely change its value
+                           ;; here because it's hard-coded in the code anyway.
+                           "hplip_statedir = $(prefix)\n")
                           (("hplip_confdir = /etc/hp")
                            ;; This is only used for installing the default config.
                            (string-append "hplip_confdir = " out
                                           "/etc/hp"))
                           (("halpredir = /usr/share/hal/fdi/preprobe/10osvendor")
-                           ;; Note: We don't use hal.
+                           ;; We don't use hal.
                            (string-append "halpredir = " out
                                           "/share/hal/fdi/preprobe/10osvendor"))
                           (("rulesdir = /etc/udev/rules.d")
@@ -457,18 +479,181 @@ device-specific programs to convert and print many types of files.")
                           (("/etc/sane.d")
                            (string-append out "/etc/sane.d"))))))
 
-                  ;; Wrap bin/* so that the Python libs are found.
+                  ;; Wrap bin/* so that the Python libraries are found.
                   (add-after 'install 'wrap-binaries
                     (assoc-ref python:%standard-phases 'wrap)))))
 
-    ;; Python3 support is available starting from hplip@3.15.2.
-    (inputs `(("libjpeg" ,libjpeg)
-              ("cups-minimal" ,cups-minimal)
-              ("libusb" ,libusb)
-              ("sane-backends" ,sane-backends-minimal)
-              ("dbus" ,dbus)
-              ("python-wrapper" ,python-wrapper)
-              ("python" ,python)
-              ;; TODO: Make hp-setup find python-dbus.
-              ("python-dbus" ,python-dbus)))
-    (native-inputs `(("pkg-config" ,pkg-config)))))
+    ;; Note that the error messages printed by the tools in the case of
+    ;; missing dependencies are often downright misleading.
+    ;; TODO: hp-toolbox still fails to start with:
+    ;;   from dbus.mainloop.pyqt5 import DBusQtMainLoop
+    ;;   ModuleNotFoundError: No module named 'dbus.mainloop.pyqt5'
+    (inputs
+     `(("cups-minimal" ,cups-minimal)
+       ("dbus" ,dbus)
+       ("libjpeg" ,libjpeg)
+       ("libusb" ,libusb)
+       ("python" ,python)
+       ("python-dbus" ,python-dbus)
+       ("python-pygobject" ,python-pygobject)
+       ("python-pyqt" ,python-pyqt)
+       ("python-wrapper" ,python-wrapper)
+       ("sane-backends" ,sane-backends-minimal)
+       ("zlib" ,zlib)))
+    (native-inputs
+     `(("perl" ,perl)
+       ("pkg-config" ,pkg-config)))))
+
+(define-public foomatic-filters
+  (package
+    (name "foomatic-filters")
+    (version "4.0.17")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append
+                    "http://www.openprinting.org/download/foomatic/"
+                    name "-" version ".tar.gz"))
+              (sha256
+               (base32
+                "1qrkgbm5jay2r7sh9qbyf0aiyrsl1mdc844hxf7fhw95a0zfbqm2"))
+              (patches
+               (search-patches "foomatic-filters-CVE-2015-8327.patch"
+                               "foomatic-filters-CVE-2015-8560.patch"))))
+    (build-system gnu-build-system)
+    (home-page
+     "https://wiki.linuxfoundation.org/openprinting/database/foomatic")
+    (native-inputs
+     `(("perl" ,perl)
+       ("pkg-config" ,pkg-config)))
+    (inputs
+     `(("dbus" ,dbus)
+       ("a2ps" ,a2ps)))
+    (arguments
+     '( ;; Specify the installation directories.
+       #:configure-flags (list (string-append "ac_cv_path_CUPS_BACKENDS="
+                                              (assoc-ref %outputs "out")
+                                              "/lib/cups/backend")
+                               (string-append "ac_cv_path_CUPS_FILTERS="
+                                              (assoc-ref %outputs "out")
+                                              "/lib/cups/filter")
+                               (string-append "ac_cv_path_PPR_INTERFACES="
+                                              (assoc-ref %outputs "out")
+                                              "/lib/ppr/interfaces")
+                               (string-append "ac_cv_path_PPR_LIB="
+                                              (assoc-ref %outputs "out")
+                                              "/lib/ppr/lib")
+
+                               ;; For some reason these are misdiagnosed.
+                               "ac_cv_func_malloc_0_nonnull=yes"
+                               "ac_cv_func_realloc_0_nonnull=yes")
+       #:test-target "tests"))
+    (synopsis "Convert PostScript to the printer's native format")
+    (description
+     "This package contains filter scripts used by the printer spoolers to
+convert the incoming PostScript data into the printer's native format using a
+printer/driver specific, but spooler-independent PPD file.")
+    (license license:gpl2+)))
+
+(define-public foo2zjs
+  (package
+    (name "foo2zjs")
+    (version "20171202")
+    (source (origin
+              (method url-fetch)
+              ;; XXX: This is an unversioned URL!
+              (uri "http://foo2zjs.rkkda.com/foo2zjs.tar.gz")
+              (sha256
+               (base32
+                "10m1ksbzqsrsl4faqyl73ahfnj2hv1y3zrmr366zvjg7w3l6ag5n"))))
+    (build-system gnu-build-system)
+    (arguments
+     '(#:phases (modify-phases %standard-phases
+                  (replace 'configure
+                    (lambda* (#:key outputs #:allow-other-keys)
+                      (substitute* (find-files "." "^Makefile$")
+                        ;; Set the installation directory.
+                        (("^PREFIX[[:blank:]]*=.*$")
+                         (string-append "PREFIX = "
+                                        (assoc-ref outputs "out")
+                                        "\n"))
+                        (("^UDEVBIN[[:blank:]]*=.*$")
+                         "UDEVBIN = $(PREFIX)/bin\n")
+                        ;; Don't try to chown/chgrp the installed files.
+                        (("-oroot")
+                         "")
+                        (("-glp")
+                         "")
+                        ;; Placate the dependency checks.
+                        (("/usr/include/stdio.h")
+                         "/etc/passwd")
+                        (("/usr/")
+                         "$(PREFIX)/")
+                        ;; Ensure fixed timestamps in man pages.
+                        (("^MODTIME[[:blank:]]*=.*$")
+                         "MODTIME = echo Thu Jan 01 01:00:00 1970\n"))
+                      #t))
+                  (add-after 'install 'remove-pdf
+                    (lambda* (#:key outputs #:allow-other-keys)
+                      ;; Remove 'manual.pdf' which is (1) useless (it's a
+                      ;; concatenation of man pages), and (2) not
+                      ;; bit-reproducible due to <https://bugs.gnu.org/27593>.
+                      (let ((out (assoc-ref outputs "out")))
+                        (for-each delete-file
+                                  (find-files out "^manual\\.pdf$"))
+                        #t))))
+       #:parallel-build? #f                       ;broken makefile
+       #:tests? #f                                ;no tests
+       #:make-flags '("CC=gcc")))
+    (inputs
+     `(("ghostscript" ,ghostscript)
+       ("foomatic-filters" ,foomatic-filters)))   ;for 'foomatic-rip'
+    (native-inputs
+     `(("bc" ,bc)
+       ("groff" ,groff)))
+    (home-page "http://foo2zjs.rkkda.com/")
+    (synopsis "Printer driver for ZjStream-based printers")
+    (description
+     "foo2zjs is a printer driver for printers that use the Zenographics
+ZjStream wire protocol for their print data, often erroneously referred to as
+winprinters or GDI printers.
+
+It supports Minolta/QMS@tie{}Magicolor, Minolta@tie{}Color@tie{}PageWorks/Pro,
+HP@tie{}LaserJet, and possibly other printers.  See @file{README} for details.")
+    (license (list license:expat        ; icc2ps/*.[ch]
+                   license:gpl2+))))    ; everything else
+
+(define-public escpr
+  (package
+    (name "escpr")
+    (version "1.6.20")
+    ;; XXX: This currently works.  But it will break as soon as a newer
+    ;; version is available since the URLs for older versions are not
+    ;; preserved.  An alternative source will be added as soon as
+    ;; available.
+    (source (origin
+              (method url-fetch)
+              ;; The uri has to be chopped up in order to satisfy guix lint.
+              (uri (string-append "https://download3.ebz.epson.net/dsc/f/03/00/07/16/23/"
+                                  "804253d188a31ae6a0f2722648248ef952afedfb/"
+                                  "epson-inkjet-printer-escpr-1.6.20-1lsb3.2.tar.gz"))
+              (sha256
+               (base32
+                "19800pl7kbbgdzbsy9ijmd7dm3ly4kr2h1dxypqpd075g6n0i770"))))
+    (build-system gnu-build-system)
+    (arguments
+     `(#:configure-flags
+       `(,(string-append "--prefix="
+                         (assoc-ref %outputs "out"))
+         ,(string-append "--with-cupsfilterdir="
+                         (assoc-ref %outputs "out") "/lib/cups/filter")
+         ,(string-append "--with-cupsppddir="
+                         (assoc-ref %outputs "out") "/share/ppd"))))
+    (inputs `(("cups" ,cups-minimal)))
+    (synopsis "ESC/P-R printer driver")
+    (description
+     "This package provides a filter for the Common UNIX Printing
+System (CUPS).  It offers high-quality printing with Seiko Epson color ink jet
+printers.  It can only be used with printers that support the Epson ESC/P-R
+language.")
+    (home-page "http://download.ebz.epson.net/dsc/search/01/search")
+    (license license:gpl2+)))