gnu: hplip: Use gexps.

* gnu/packages/cups.scm (hplip) [arguments]: Use gexps.
* gnu/packages/cups.scm (hplip-minimal): Likewise.
This commit is contained in:
Maxim Cournoyer 2023-02-17 22:54:55 -05:00
parent da923bc122
commit 298d0d381e
No known key found for this signature in database
GPG key ID: 1260E46482E63562

View file

@ -542,42 +542,40 @@ (define-public hplip
(outputs (list "out" "ppd"))
(build-system gnu-build-system)
(arguments
`(#:imported-modules ((guix build python-build-system)
(list
#:imported-modules `((guix build python-build-system)
,@%gnu-build-system-modules)
#:modules ((guix build gnu-build-system)
#:modules '((guix build gnu-build-system)
(guix build utils)
((guix build python-build-system) #:prefix python:))
#:configure-flags
`("--disable-imageProcessor-build"
#~(list "--disable-imageProcessor-build"
"--disable-network-build"
,(string-append "--prefix=" (assoc-ref %outputs "out"))
,(string-append "--sysconfdir=" (assoc-ref %outputs "out") "/etc")
,(string-append "LDFLAGS=-Wl,-rpath="
(assoc-ref %outputs "out") "/lib")
(string-append "--prefix=" #$output)
(string-append "--sysconfdir=" #$output "/etc")
(string-append "LDFLAGS=-Wl,-rpath=" #$output "/lib")
;; Disable until mime.types merging works (FIXME).
"--disable-fax-build"
"--enable-new-hpcups"
;; TODO add foomatic drv install eventually.
;; TODO --enable-policykit eventually.
,(string-append "--with-cupsfilterdir="
(assoc-ref %outputs "out") "/lib/cups/filter")
,(string-append "--with-cupsbackenddir="
(assoc-ref %outputs "out") "/lib/cups/backend")
,(string-append "--with-hpppddir="
(assoc-ref %outputs "ppd") "/share/ppd/HP")
,(string-append "--with-icondir="
(assoc-ref %outputs "out") "/share/applications")
,(string-append "--with-systraydir="
(assoc-ref %outputs "out") "/etc/xdg")
"--enable-qt5" "--disable-qt4")
(string-append "--with-cupsfilterdir=" #$output
"/lib/cups/filter")
(string-append "--with-cupsbackenddir=" #$output
"/lib/cups/backend")
(string-append "--with-hpppddir=" #$output:ppd "/share/ppd/HP")
(string-append "--with-icondir=" #$output "/share/applications")
(string-append "--with-systraydir=" #$output "/etc/xdg")
"--enable-qt5"
"--disable-qt4")
#:phases
(modify-phases %standard-phases
#~(modify-phases %standard-phases
(add-after 'unpack 'fix-hard-coded-file-names
(lambda* (#:key inputs outputs #:allow-other-keys)
(let ((out (assoc-ref outputs "out"))
(let ((out #$output)
;; FIXME: use merged ppds (I think actually only
;; drvs need to be merged).
(cupsdir (assoc-ref inputs "cups-minimal")))
(cupsdir #$(this-package-input "cups-minimal")))
(substitute* (find-files "." "\\.py$")
;; Refer to the correct default configuration file name.
(("/etc/hp/hplip.conf")
@ -586,8 +584,7 @@ (define-public hplip
(("'/usr/share;[^']*'")
(string-append "'" cupsdir "/share'"))
(("'/etc/hp/hplip.conf'")
(string-append "'" out
"/etc/hp/hplip.conf" "'")))
(string-append "'" out "/etc/hp/hplip.conf" "'")))
(substitute* "Makefile.in"
(("[[:blank:]]check-plugin\\.py[[:blank:]]") " ")
@ -602,20 +599,17 @@ (define-public hplip
"hplip_statedir = $(prefix)\n")
(("hplip_confdir = /etc/hp")
;; This is only used for installing the default config.
(string-append "hplip_confdir = " out
"/etc/hp"))
(string-append "hplip_confdir = " out "/etc/hp"))
(("halpredir = /usr/share/hal/fdi/preprobe/10osvendor")
;; We don't use hal.
(string-append "halpredir = " out
"/share/hal/fdi/preprobe/10osvendor"))
(("rulesdir = /etc/udev/rules.d")
;; udev rules will be merged by base service.
(string-append "rulesdir = " out
"/lib/udev/rules.d"))
(string-append "rulesdir = " out "/lib/udev/rules.d"))
(("rulessystemdir = /usr/lib/systemd/system")
;; We don't use systemd.
(string-append "rulessystemdir = " out
"/lib/systemd/system"))
(string-append "rulessystemdir = " out "/lib/systemd/system"))
(("/etc/sane.d")
(string-append out "/etc/sane.d"))))))
(add-before 'configure 'fix-build-with-python-3.8
@ -631,10 +625,8 @@ (define-public hplip
":" (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))))
(install-file "data/models/models.dat"
(string-append #$output "/share/hplip/data/models"))))
(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,
@ -699,12 +691,12 @@ (define-public hplip-minimal
;; Produce a "light build", meaning that only the printer (CUPS) and
;; scanner (SANE) support gets built, without all the 'hp-*'
;; command-line tools.
`(cons "--enable-lite-build"
(delete "--enable-qt5" ,cf)))
#~(cons "--enable-lite-build"
(delete "--enable-qt5" #$cf)))
((#:phases phases)
;; The 'wrap-binaries' is not needed here since the 'hp-*' programs
;; are not installed.
`(alist-delete 'wrap-binaries ,phases))))
#~(alist-delete 'wrap-binaries #$phases))))
(inputs (remove (match-lambda
((label . _)
(string-prefix? "python" label)))