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,7 +129,8 @@ 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
(origin
(method url-fetch) (method url-fetch)
(uri (uri
(string-append "https://openprinting.org/download/cups-filters/" (string-append "https://openprinting.org/download/cups-filters/"
@ -140,7 +142,7 @@ driver is known to work with these printers:
(snippet (snippet
;; install backends, banners and filters to cups-filters output ;; install backends, banners and filters to cups-filters output
;; directory, not the cups server directory ;; directory, not the cups server directory
'(begin #~(begin
(substitute* "Makefile.in" (substitute* "Makefile.in"
(("CUPS_DATADIR = @CUPS_DATADIR@") (("CUPS_DATADIR = @CUPS_DATADIR@")
"CUPS_DATADIR = $(PREFIX)/share/cups") "CUPS_DATADIR = $(PREFIX)/share/cups")
@ -156,14 +158,14 @@ driver is known to work with these printers:
;; output directory, not CUPS's prefix. ;; output directory, not CUPS's prefix.
(substitute* "configure" (substitute* "configure"
(("\\{CUPS_DATADIR\\}/data") (("\\{CUPS_DATADIR\\}/data")
"{prefix}/share/cups/data")) "{prefix}/share/cups/data"))))))
#t))))
(build-system gnu-build-system) (build-system gnu-build-system)
(arguments (arguments
`(#:make-flags (list (string-append "PREFIX=" %output)) (list #:make-flags
#~(list (string-append "PREFIX=" #$output))
#:configure-flags #:configure-flags
`("--disable-driverless" ; TODO: enable this #~(list "--disable-driverless" ; TODO: enable this
"--disable-mutool" ; depends on yet another PDF library (mupdf) "--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"
@ -171,45 +173,40 @@ driver is known to work with these printers:
;; 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"))
(gs (assoc-ref inputs "ghostscript")))
(substitute* "filter/foomatic-rip/foomaticrip.c" (substitute* "filter/foomatic-rip/foomaticrip.c"
(("/usr/local/lib/cups/filter") (("/usr/local(/lib/cups/filter)" _ file)
(string-append out "/lib/cups/filter"))) (string-append #$output file)))))
#t)))
(add-after 'install 'wrap-filters (add-after 'install 'wrap-filters
(lambda* (#:key inputs outputs #:allow-other-keys) (lambda _
;; Some filters expect to find things in $PATH. We cannot ;; Some filters expect to find things in $PATH. We cannot
;; just hard-code all absolute file names in the source ;; just hard-code all absolute file names in the source
;; because foomatic-rip, for example, has tests like ;; because foomatic-rip, for example, has tests like
;; 'startswith(cmd, "gs")'. ;; 'startswith(cmd, "gs")'.
(let ((out (assoc-ref outputs "out")) (for-each
(ghostscript (assoc-ref inputs "ghostscript")) (lambda (file)
(grep (assoc-ref inputs "grep")))
(for-each (lambda (file)
(wrap-program file (wrap-program file
`("PATH" ":" prefix `("PATH" ":" prefix
(,(string-append ghostscript "/bin:" (,(string-append
grep "/bin"))))) #$(this-package-input "ghostscript") "/bin:"
(find-files (string-append #$(this-package-input "grep") "/bin")))))
out "/lib/cups/filter"))) (find-files (string-append #$output
#t)))))) "/lib/cups/filter"))))))))
(native-inputs (native-inputs
(list `(,glib "bin") ; for gdbus-codegen (list `(,glib "bin") ; for gdbus-codegen
pkg-config)) pkg-config))