summaryrefslogtreecommitdiff
path: root/gnu/packages/cups.scm
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/packages/cups.scm')
-rw-r--r--gnu/packages/cups.scm331
1 files changed, 167 insertions, 164 deletions
diff --git a/gnu/packages/cups.scm b/gnu/packages/cups.scm
index e4ae35d8ae..cb9a36b962 100644
--- a/gnu/packages/cups.scm
+++ b/gnu/packages/cups.scm
@@ -1,12 +1,13 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2015, 2019, 2021 Ricardo Wurmus <rekado@elephly.net>
-;;; Copyright © 2015, 2016, 2017, 2019 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2015, 2016, 2017, 2019, 2021 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2015, 2016, 2017, 2018 Efraim Flashner <efraim@flashner.co.il>
;;; Copyright © 2016 Danny Milosavljevic <dannym@scratchpost.org>
;;; Copyright © 2017 Leo Famulari <leo@famulari.name>
;;; Copyright © 2017 Mark H Weaver <mhw@netris.org>
;;; Copyright © 2017–2021 Tobias Geerinckx-Rice <me@tobias.gr>
;;; Copyright © 2020 Marius Bakke <mbakke@fastmail.com>
+;;; Copyright © 2021 Maxim Cournoyer <maxim.cournoyer@gmail.com>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -128,7 +129,7 @@ driver is known to work with these printers:
(define-public cups-filters
(package
(name "cups-filters")
- (version "1.27.4")
+ (version "1.28.9")
(source(origin
(method url-fetch)
(uri
@@ -136,7 +137,7 @@ driver is known to work with these printers:
"cups-filters-" version ".tar.xz"))
(sha256
(base32
- "110b1xhb5vfpcx0zq9kkas7pj281skx5dpnnr22idx509jfdzj8b"))
+ "1bk0x1rrb8wqbhh5c979ppgy6s2kqss8mjdlahgcjvd79wm3fs9g"))
(modules '((guix build utils)))
(snippet
;; install backends, banners and filters to cups-filters output
@@ -196,29 +197,31 @@ driver is known to work with these printers:
#t)))
(add-after 'install 'wrap-filters
(lambda* (#:key inputs outputs #:allow-other-keys)
- ;; Some filters expect to find 'gs' in $PATH. We cannot
- ;; just hard-code its absolute file name in the source
+ ;; Some filters expect to find things in $PATH. We cannot
+ ;; just hard-code all absolute file names in the source
;; because foomatic-rip, for example, has tests like
;; 'startswith(cmd, "gs")'.
(let ((out (assoc-ref outputs "out"))
- (ghostscript (assoc-ref inputs "ghostscript")))
+ (ghostscript (assoc-ref inputs "ghostscript"))
+ (grep (assoc-ref inputs "grep")))
(for-each (lambda (file)
(wrap-program file
`("PATH" ":" prefix
- (,(string-append ghostscript
- "/bin")))))
+ (,(string-append ghostscript "/bin:"
+ grep "/bin")))))
(find-files (string-append
out "/lib/cups/filter")))
#t))))))
(native-inputs
- `(("glib" ,glib "bin") ; for gdbus-codegen
+ `(("glib" ,glib "bin") ; for gdbus-codegen
("pkg-config" ,pkg-config)))
(inputs
`(("avahi" ,avahi)
("fontconfig" ,fontconfig)
("freetype" ,freetype)
- ("font-dejavu" ,font-dejavu) ; also needed by test suite
+ ("font-dejavu" ,font-dejavu) ; also needed by test suite
("ghostscript" ,ghostscript/cups)
+ ("grep" ,grep)
("ijs" ,ijs)
("dbus" ,dbus)
("lcms" ,lcms)
@@ -251,16 +254,20 @@ filters for the PDF-centric printing workflow introduced by OpenPrinting.")
(define-public cups-minimal
(package
(name "cups-minimal")
- (version "2.3.3")
- (replacement cups-minimal/fixed)
+ (version "2.3.3op2")
(source
(origin
- (method url-fetch)
- (uri (string-append "https://github.com/apple/cups/releases/download/v"
- version "/cups-" version "-source.tar.gz"))
+ (method git-fetch)
+ ;; Version maintained by the OpenPrinting organization, NOT a fork. The
+ ;; CUPS author tracks the current Apple CUPS sources and includes common
+ ;; changes and bug fixes for GNU/Linux. See its README and for example
+ ;; <https://github.com/apple/cups/issues/5917#issuecomment-819465891>.
+ (uri (git-reference
+ (url "https://github.com/OpenPrinting/cups")
+ (commit (string-append "v" version))))
+ (file-name (git-file-name name version))
(sha256
- (base32
- "1vpk0b2vq830f8fvf9z8qjsm5k141i7pi8djbinpnr78pi4dj7r6"))))
+ (base32 "126d6kd3pkhmsvbcflkcpk3y30iqlkdqyvrk9aqq88vbxzjd5ia6"))))
(build-system gnu-build-system)
(arguments
`(#:configure-flags
@@ -273,6 +280,31 @@ filters for the PDF-centric printing workflow introduced by OpenPrinting.")
#:tests? #f
#:phases
(modify-phases %standard-phases
+ (add-after 'unpack 'never-cupsAdminGetServerSettings
+ ;; Instead of querying the daemon directly, this part of CUPS assumes
+ ;; that (1) it has access to a cupsd.conf under CUPS_SERVERROOT, and
+ ;; (2) the file's contents apply to the running daemon. (1) is false
+ ;; at least on Guix Systems resulting in extremely long delays when
+ ;; loading the Web interface's /admin page. (2) isn't valid anywhere
+ ;; because it ignores, e.g., -c FILE.
+ ;; Upstream considers this code on ‘life support’ so just neuter it.
+ (lambda _
+ (substitute* "cgi-bin/admin.c"
+ (("!cupsAdminGetServerSettings" match)
+ (string-append "0 && " match)))))
+ (add-after 'unpack 'remove-Web-UI-server-settings
+ ;; The /admin page's server configuration form is questionable for
+ ;; the same reason as cupsAdminGetServerSettings, and won't work at
+ ;; all on Guix Systems. Remove it entirely.
+ (lambda _
+ ;; SUBSTITUTE* and a patch both have (dis)advantages. This is
+ ;; shorter & should ensure that no translation is forgotten.
+ (substitute* (find-files "templates" "^admin\\.tmpl$")
+ ((" class=\"halves\"") "")
+ (("<FORM.* ACTION=\"/jobs.*</FORM>" match)
+ (string-append match "</P>{BROKEN? "))
+ (("</FORM>}" match)
+ (string-append match "}")))))
(add-before 'configure 'patch-makedefs
(lambda _
(substitute* "Makedefs.in"
@@ -299,7 +331,7 @@ filters for the PDF-centric printing workflow introduced by OpenPrinting.")
(inputs
`(("zlib" ,zlib)
("gnutls" ,gnutls)))
- (home-page "https://www.cups.org")
+ (home-page "https://openprinting.github.io/")
(synopsis "The Common Unix Printing System")
(description
"CUPS is a printing system that uses the Internet Printing Protocol
@@ -313,148 +345,128 @@ device-specific programs to convert and print many types of files.")
;; CUPS is Apache 2.0 with exceptions, see the NOTICE file.
(license license:asl2.0)))
-(define cups-minimal/fixed
- (package-with-extra-patches
- cups-minimal
- (search-patches "cups-CVE-2020-10001.patch")))
-
(define-public cups
(package/inherit cups-minimal
(name "cups")
(arguments
- `(;; Three tests fail:
- ;; * two tests in ipp-1.1.test related to "RFC 2911 section 3.2.6:
- ;; Get-Jobs Operation"
- ;; * test of number of error/warning messages, probably related to a
- ;; missing font.
- #:tests? #f
- #:configure-flags
- '("--disable-launchd"
- "--disable-systemd")
- #:phases
- (modify-phases %standard-phases
- (add-before 'configure 'patch-makedefs
- (lambda _
- (substitute* "Makedefs.in"
- (("INITDIR.*=.*@INITDIR@") "INITDIR = @prefix@/@INITDIR@")
- (("/bin/sh") (which "sh")))
- #t))
- (add-before 'check 'patch-tests
- (lambda _
- (let ((filters (assoc-ref %build-inputs "cups-filters"))
- (catpath (string-append
- (assoc-ref %build-inputs "coreutils") "/bin/"))
- (testdir (string-append (getcwd) "/tmp/")))
- (mkdir testdir)
- (substitute* "test/run-stp-tests.sh"
- ((" *BASE=/tmp/") (string-append "BASE=" testdir))
-
- ;; allow installation of filters from output dir and from
- ;; cups-filters
- (("for dir in /usr/libexec/cups/filter /usr/lib/cups/filter")
- (string-append
- "for dir in "
- (assoc-ref %outputs "out") "/lib/cups/filter "
- filters "/lib/cups/filter"))
+ (substitute-keyword-arguments (package-arguments cups-minimal)
+ ((#:tests? _ #t)
+ ;; Three tests fail:
+ ;; * two tests in ipp-1.1.test related to "RFC 2911 section 3.2.6:
+ ;; Get-Jobs Operation"
+ ;; * test of number of error/warning messages, probably related to a
+ ;; missing font.
+ #f)
+ ((#:configure-flags _ '())
+ `(list "--disable-launchd"
+ "--disable-systemd"))
+ ((#:phases phases '%standard-phases)
+ `(modify-phases ,phases
+ (add-before 'check 'patch-tests
+ (lambda _
+ (let ((filters (assoc-ref %build-inputs "cups-filters"))
+ (catpath (string-append
+ (assoc-ref %build-inputs "coreutils") "/bin/"))
+ (testdir (string-append (getcwd) "/tmp/")))
+ (mkdir testdir)
+ (substitute* "test/run-stp-tests.sh"
+ ((" *BASE=/tmp/") (string-append "BASE=" testdir))
- ;; check for charsets in cups-filters output
- (("/usr/share/cups/charsets")
- (string-append filters "/share/cups/charsets"))
+ ;; Allow installation of filters from the output directory
+ ;; and from cups-filters.
+ (("for dir in /usr/libexec/cups/filter /usr/lib/cups/filter")
+ (string-append
+ "for dir in "
+ (assoc-ref %outputs "out") "/lib/cups/filter "
+ filters "/lib/cups/filter"))
- ;; install additional required filters
- (("instfilter texttopdf texttopdf pdf")
- (string-append
- "instfilter texttopdf texttopdf pdf;"
- "instfilter imagetoraster imagetoraster raster;"
- "instfilter gstoraster gstoraster raster;"
- "instfilter urftopdf urftopdf pdf;"
- "instfilter rastertopdf rastertopdf pdf;"
- "instfilter pstopdf pstopdf pdf"))
+ ;; Check for charsets in the default cups-filters output.
+ (("/usr/share/cups/charsets")
+ (string-append filters "/share/cups/charsets"))
- ;; specify location of lpstat binary
- (("description=\"`lpstat -l")
- "description=\"`../systemv/lpstat -l")
+ ;; Install additional required filters.
+ (("instfilter texttopdf texttopdf pdf")
+ (string-append
+ "instfilter texttopdf texttopdf pdf;"
+ "instfilter imagetoraster imagetoraster raster;"
+ "instfilter gstoraster gstoraster raster;"
+ "instfilter urftopdf urftopdf pdf;"
+ "instfilter rastertopdf rastertopdf pdf;"
+ "instfilter pstopdf pstopdf pdf"))
- ;; patch shebangs of embedded scripts
- (("#!/bin/sh") (string-append "#!" (which "sh")))
+ ;; Specify the location of the lpstat binary.
+ (("description=\"`lpstat -l")
+ "description=\"`../systemv/lpstat -l")
- ;; also link mime definitions from cups-filters
- ;; to enable the additional filters for the test suite
- (("ln -s \\$root/conf/mime\\.types")
- (string-append
- "ln -s " filters
- "/share/cups/mime/cupsfilters.types $BASE/share/mime; "
- "ln -s $root/conf/mime.types"))
- (("ln -s \\$root/conf/mime\\.convs")
- (string-append
- "ln -s " filters
- "/share/cups/mime/cupsfilters.convs $BASE/share/mime; "
- "ln -s $root/conf/mime.convs")))
+ ;; Patch the shebangs of embedded scripts.
+ (("#!/bin/sh") (string-append "#!" (which "sh")))
- ;; fix search path for "cat"
- (substitute* "cups/testfile.c"
- (("cupsFileFind\\(\"cat\", \"/bin\"")
- (string-append "cupsFileFind(\"cat\", \"" catpath "\""))
- (("cupsFileFind\\(\"cat\", \"/bin:/usr/bin\"")
- (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
- (lambda* (#:key outputs #:allow-other-keys)
- (let* ((out (assoc-ref outputs "out"))
- (man (string-append out "/share/man")))
- (for-each (lambda (file) (chmod file #o644))
- (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"))
- (cups-filters (assoc-ref inputs "cups-filters")))
- ;; charsets
- (symlink
- (string-append cups-filters "/share/cups/charsets")
- (string-append out "/share/charsets"))
+ ;; Also link MIME definitions from cups-filters
+ ;; to enable the additional filters for the test suite.
+ (("ln -s \\$root/conf/mime\\.types")
+ (string-append
+ "ln -s " filters
+ "/share/cups/mime/cupsfilters.types $BASE/share/mime; "
+ "ln -s $root/conf/mime.types"))
+ (("ln -s \\$root/conf/mime\\.convs")
+ (string-append
+ "ln -s " filters
+ "/share/cups/mime/cupsfilters.convs $BASE/share/mime; "
+ "ln -s $root/conf/mime.convs")))
- ;; mime types, driver file, ppds
- (for-each
- (lambda (f)
- (symlink (string-append cups-filters f)
- (string-append out f)))
- '("/share/cups/mime/cupsfilters.types"
- "/share/cups/mime/cupsfilters.convs"
- "/share/cups/drv/cupsfilters.drv"
- "/share/ppd"))
+ ;; Fix the search path for the "cat" command.
+ (substitute* "cups/testfile.c"
+ (("cupsFileFind\\(\"cat\", \"/bin\"")
+ (string-append "cupsFileFind(\"cat\", \"" catpath "\""))
+ (("cupsFileFind\\(\"cat\", \"/bin:/usr/bin\"")
+ (string-append "cupsFileFind(\"cat\", \"" catpath "\""))))))
+ (add-after 'install 'install-cups-filters-symlinks
+ (lambda* (#:key inputs outputs #:allow-other-keys)
+ (let ((out (assoc-ref outputs "out"))
+ (cups-filters (assoc-ref inputs "cups-filters")))
+ ;; Charsets.
+ (symlink
+ (string-append cups-filters "/share/cups/charsets")
+ (string-append out "/share/charsets"))
- ;; filters
- (for-each
- (lambda (f)
- (symlink f
- (string-append out "/lib/cups/filter" (basename f))))
- (find-files (string-append cups-filters "/lib/cups/filter")))
+ ;; MIME types, driver files, and PPDs.
+ (for-each
+ (lambda (f)
+ (symlink (string-append cups-filters f)
+ (string-append out f)))
+ '("/share/cups/mime/cupsfilters.types"
+ "/share/cups/mime/cupsfilters.convs"
+ "/share/cups/drv/cupsfilters.drv"
+ "/share/ppd"))
- ;; backends
- (for-each
- (lambda (f)
- (symlink (string-append cups-filters f)
- (string-append out "/lib/cups/backend/"
- (basename f))))
- '("/lib/cups/backend/parallel"
- "/lib/cups/backend/serial"))
+ ;; Filters.
+ (for-each
+ (lambda (f)
+ (symlink f
+ (string-append out "/lib/cups/filter"
+ (basename f))))
+ (find-files (string-append cups-filters "/lib/cups/filter")))
- ;; banners
- (let ((banners "/share/cups/banners"))
- (delete-file-recursively (string-append out banners))
- (symlink (string-append cups-filters banners)
- (string-append out banners)))
+ ;; Backends.
+ (for-each
+ (lambda (f)
+ (symlink (string-append cups-filters f)
+ (string-append out "/lib/cups/backend/"
+ (basename f))))
+ '("/lib/cups/backend/parallel"
+ "/lib/cups/backend/serial"))
- ;; assorted data
- (let ((data "/share/cups/data"))
- (delete-file-recursively (string-append out data))
- (symlink (string-append cups-filters data)
- (string-append out data)))
+ ;; Banners.
+ (let ((banners "/share/cups/banners"))
+ (delete-file-recursively (string-append out banners))
+ (symlink (string-append cups-filters banners)
+ (string-append out banners)))
- #t))))))
+ ;; Assorted data.
+ (let ((data "/share/cups/data"))
+ (delete-file-recursively (string-append out data))
+ (symlink (string-append cups-filters data)
+ (string-append out data))))))))))
(inputs
`(("avahi" ,avahi)
("gnutls" ,gnutls)
@@ -523,8 +535,7 @@ should only be used as part of the Guix cups-pk-helper service.")
(("^dat2drvdir =.*")
"dat2drvdir = $(pkglibexecdir)\n")
(("^locatedriverdir =.*")
- "locatedriverdir = $(pkglibexecdir)\n"))
- #t))))
+ "locatedriverdir = $(pkglibexecdir)\n"))))))
(build-system gnu-build-system)
(outputs (list "out" "ppd"))
(home-page "https://developers.hp.com/hp-linux-imaging-and-printing")
@@ -589,8 +600,7 @@ should only be used as part of the Guix cups-pk-helper service.")
;; FIXME Use beginning-of-word in regexp.
(("[[:blank:]]plugin\\.py[[:blank:]]") " ")
(("/usr/include/libusb-1.0")
- (string-append (assoc-ref inputs "libusb")
- "/include/libusb-1.0"))
+ (search-input-directory inputs "/include/libusb-1.0"))
(("hplip_statedir =.*$")
;; Don't bail out while trying to create
;; /var/lib/hplip. We can safely change its value
@@ -613,8 +623,7 @@ should only be used as part of the Guix cups-pk-helper service.")
(string-append "rulessystemdir = " out
"/lib/systemd/system"))
(("/etc/sane.d")
- (string-append out "/etc/sane.d")))
- #t)))
+ (string-append out "/etc/sane.d"))))))
(add-before 'configure 'fix-build-with-python-3.8
(lambda* (#:key inputs #:allow-other-keys)
(let ((python (assoc-ref inputs "python")))
@@ -625,15 +634,13 @@ should only be used as part of the Guix cups-pk-helper service.")
(setenv "C_INCLUDE_PATH"
(string-append python "/include/python"
(python:python-version python)
- ":" (getenv "C_INCLUDE_PATH"))))
- #t)))
+ ":" (getenv "C_INCLUDE_PATH")))))))
(add-after 'install 'install-models-dat
(lambda* (#:key outputs #:allow-other-keys)
(let* ((out (assoc-ref outputs "out"))
(models-dir (string-append out
"/share/hplip/data/models")))
- (install-file "data/models/models.dat" models-dir))
- #t))
+ (install-file "data/models/models.dat" models-dir))))
(add-after 'install 'wrap-binaries
;; Scripts in /bin are all symlinks to .py files in /share/hplip.
;; Symlinks are immune to the Python build system's 'WRAP phase,
@@ -644,7 +651,7 @@ should only be used as part of the Guix cups-pk-helper service.")
(lambda* (#:key inputs outputs #:allow-other-keys)
(let* ((out (assoc-ref outputs "out"))
(bin (string-append out "/bin"))
- (python (assoc-ref inputs "python")))
+ (site (python:site-packages inputs outputs)))
(with-directory-excursion bin
(for-each (lambda (file)
(let ((target (readlink file)))
@@ -653,19 +660,15 @@ should only be used as part of the Guix cups-pk-helper service.")
(lambda _
(format #t
"#!~a~@
- export PYTHONPATH=\"~a:~a\"~@
+ export GUIX_PYTHONPATH=\"~a:~a\"~@
exec -a \"$0\" \"~a/~a\" \"$@\"~%"
(which "bash")
- (string-append
- out "/lib/python"
- (python:python-version python)
- "/site-packages")
- (getenv "PYTHONPATH")
+ site
+ (getenv "GUIX_PYTHONPATH")
bin target)))
(chmod file #o755)))
(find-files "." (lambda (file stat)
- (eq? 'symlink (stat:type stat)))))
- #t)))))))
+ (eq? 'symlink (stat:type stat))))))))))))
;; Note that the error messages printed by the tools in the case of
;; missing dependencies are often downright misleading.
@@ -747,7 +750,7 @@ should only be used as part of the Guix cups-pk-helper service.")
(string-append "ac_cv_path_PPR_LIB="
(assoc-ref %outputs "out")
"/lib/ppr/lib")
-
+ "CFLAGS=-fcommon"
;; For some reason these are misdiagnosed.
"ac_cv_func_malloc_0_nonnull=yes"
"ac_cv_func_realloc_0_nonnull=yes")