me
/
guix
Archived
1
0
Fork 0

gnu: cups-filters: Use G-expressions.

* gnu/packages/cups.scm (cups-filters)[source, arguments]:
Rewrite as G-expressions.
master
Tobias Geerinckx-Rice 2022-01-10 21:51:40 +01:00
parent ceb5ef8347
commit 79de30ac8d
No known key found for this signature in database
GPG Key ID: 0DB0FF884F556D79
1 changed files with 74 additions and 77 deletions

View File

@ -52,6 +52,7 @@
#:use-module (guix build-system gnu) #:use-module (guix build-system gnu)
#:use-module (guix build-system python) #:use-module (guix build-system python)
#:use-module (guix download) #:use-module (guix download)
#:use-module (guix gexp)
#:use-module (guix git-download) #:use-module (guix git-download)
#:use-module ((guix licenses) #:prefix license:) #:use-module ((guix licenses) #:prefix license:)
#:use-module (guix packages) #:use-module (guix packages)
@ -128,88 +129,84 @@ driver is known to work with these printers:
(package (package
(name "cups-filters") (name "cups-filters")
(version "1.28.9") (version "1.28.9")
(source(origin (source
(method url-fetch) (origin
(uri (method url-fetch)
(string-append "https://openprinting.org/download/cups-filters/" (uri
"cups-filters-" version ".tar.xz")) (string-append "https://openprinting.org/download/cups-filters/"
(sha256 "cups-filters-" version ".tar.xz"))
(base32 (sha256
"1bk0x1rrb8wqbhh5c979ppgy6s2kqss8mjdlahgcjvd79wm3fs9g")) (base32
(modules '((guix build utils))) "1bk0x1rrb8wqbhh5c979ppgy6s2kqss8mjdlahgcjvd79wm3fs9g"))
(snippet (modules '((guix build utils)))
;; install backends, banners and filters to cups-filters output (snippet
;; directory, not the cups server directory ;; install backends, banners and filters to cups-filters output
'(begin ;; directory, not the cups server directory
(substitute* "Makefile.in" #~(begin
(("CUPS_DATADIR = @CUPS_DATADIR@") (substitute* "Makefile.in"
"CUPS_DATADIR = $(PREFIX)/share/cups") (("CUPS_DATADIR = @CUPS_DATADIR@")
(("pkgcupsserverrootdir = \\$\\(CUPS_SERVERROOT\\)") "CUPS_DATADIR = $(PREFIX)/share/cups")
"pkgcupsserverrootdir = $(PREFIX)") (("pkgcupsserverrootdir = \\$\\(CUPS_SERVERROOT\\)")
;; Choose standard directories notably so that binaries are "pkgcupsserverrootdir = $(PREFIX)")
;; stripped. ;; Choose standard directories notably so that binaries are
(("pkgbackenddir = \\$\\(CUPS_SERVERBIN\\)/backend") ;; stripped.
"pkgbackenddir = $(PREFIX)/lib/cups/backend") (("pkgbackenddir = \\$\\(CUPS_SERVERBIN\\)/backend")
(("pkgfilterdir = \\$\\(CUPS_SERVERBIN\\)/filter") "pkgbackenddir = $(PREFIX)/lib/cups/backend")
"pkgfilterdir = $(PREFIX)/lib/cups/filter")) (("pkgfilterdir = \\$\\(CUPS_SERVERBIN\\)/filter")
;; Find bannertopdf data such as the print test page in our "pkgfilterdir = $(PREFIX)/lib/cups/filter"))
;; output directory, not CUPS's prefix. ;; Find bannertopdf data such as the print test page in our
(substitute* "configure" ;; output directory, not CUPS's prefix.
(("\\{CUPS_DATADIR\\}/data") (substitute* "configure"
"{prefix}/share/cups/data")) (("\\{CUPS_DATADIR\\}/data")
#t)))) "{prefix}/share/cups/data"))))))
(build-system gnu-build-system) (build-system gnu-build-system)
(arguments (arguments
`(#:make-flags (list (string-append "PREFIX=" %output)) (list #:make-flags
#:configure-flags #~(list (string-append "PREFIX=" #$output))
`("--disable-driverless" ; TODO: enable this #:configure-flags
"--disable-mutool" ; depends on yet another PDF library (mupdf) #~(list "--disable-driverless" ; TODO: enable this
"--disable-mutool" ; needs yet another PDF library (mupdf)
;; Look for the "domain socket of CUPS" in /var/run/cups. ;; Look for the "domain socket of CUPS" in /var/run/cups.
"--localstatedir=/var" "--localstatedir=/var"
;; Free software for the win. ;; Free software for the win.
"--with-acroread-path=evince" "--with-acroread-path=evince"
,(string-append "--with-test-font-path=" (string-append "--with-test-font-path="
(assoc-ref %build-inputs "font-dejavu") #$(this-package-input "font-dejavu")
"/share/fonts/truetype/DejaVuSans.ttf") "/share/fonts/truetype/DejaVuSans.ttf")
,(string-append "--with-gs-path=" (string-append "--with-gs-path="
(assoc-ref %build-inputs "ghostscript") #$(this-package-input "ghostscript")
"/bin/gsc") "/bin/gsc")
,(string-append "--with-shell=" (string-append "--with-shell="
(assoc-ref %build-inputs "bash") (assoc-ref %build-inputs "bash")
"/bin/bash") "/bin/bash")
,(string-append "--with-rcdir=" (string-append "--with-rcdir="
(assoc-ref %outputs "out") "/etc/rc.d")) #$output "/etc/rc.d"))
#:phases
#:phases (modify-phases %standard-phases #~(modify-phases %standard-phases
(add-after 'unpack 'patch-foomatic-hardcoded-file-names (add-after 'unpack 'patch-foomatic-hardcoded-file-names
(lambda* (#:key inputs outputs #:allow-other-keys) (lambda _
;; Foomatic has hardcoded file names we need to fix. ;; Foomatic has hard-coded file names we need to fix.
(let ((out (assoc-ref outputs "out")) (substitute* "filter/foomatic-rip/foomaticrip.c"
(gs (assoc-ref inputs "ghostscript"))) (("/usr/local(/lib/cups/filter)" _ file)
(substitute* "filter/foomatic-rip/foomaticrip.c" (string-append #$output file)))))
(("/usr/local/lib/cups/filter") (add-after 'install 'wrap-filters
(string-append out "/lib/cups/filter"))) (lambda _
#t))) ;; Some filters expect to find things in $PATH. We cannot
(add-after 'install 'wrap-filters ;; just hard-code all absolute file names in the source
(lambda* (#:key inputs outputs #:allow-other-keys) ;; because foomatic-rip, for example, has tests like
;; Some filters expect to find things in $PATH. We cannot ;; 'startswith(cmd, "gs")'.
;; just hard-code all absolute file names in the source (for-each
;; because foomatic-rip, for example, has tests like (lambda (file)
;; 'startswith(cmd, "gs")'. (wrap-program file
(let ((out (assoc-ref outputs "out")) `("PATH" ":" prefix
(ghostscript (assoc-ref inputs "ghostscript")) (,(string-append
(grep (assoc-ref inputs "grep"))) #$(this-package-input "ghostscript") "/bin:"
(for-each (lambda (file) #$(this-package-input "grep") "/bin")))))
(wrap-program file (find-files (string-append #$output
`("PATH" ":" prefix "/lib/cups/filter"))))))))
(,(string-append ghostscript "/bin:"
grep "/bin")))))
(find-files (string-append
out "/lib/cups/filter")))
#t))))))
(native-inputs (native-inputs
(list `(,glib "bin") ; for gdbus-codegen (list `(,glib "bin") ; for gdbus-codegen
pkg-config)) pkg-config))