241 lines
10 KiB
Scheme
241 lines
10 KiB
Scheme
;;; SPDX-License-Identifier: GPL-3.0-or-later
|
|
;;; Copyright © 2021 Petr Hodina <phodina@protonmail.com>
|
|
;;; Copyright © 2021 Kahka F
|
|
;;; Copyright © 2021 Jonathan Brielmaier <jonathan.brielmaier@web.de>
|
|
;;; Copyright © 2023 EuAndreh <eu@euandre.org>
|
|
|
|
(define-module (nongnu packages printers)
|
|
#:use-module (gnu packages)
|
|
#:use-module (gnu packages cpio)
|
|
#:use-module (gnu packages cups)
|
|
#:use-module (gnu packages image)
|
|
#:use-module (gnu packages package-management)
|
|
#:use-module (guix gexp)
|
|
#:use-module (guix packages)
|
|
#:use-module (guix utils)
|
|
#:use-module (srfi srfi-1)
|
|
#:use-module (guix download)
|
|
#:use-module (guix build utils)
|
|
#:use-module (guix build-system gnu)
|
|
#:use-module ((guix licenses) #:prefix license:)
|
|
#:use-module (nonguix licenses))
|
|
|
|
(define-public hplip-plugin
|
|
(package
|
|
(inherit hplip)
|
|
(name "hplip-plugin")
|
|
(description "Hewlett-Packard printer drivers with nonfree plugin.")
|
|
(source (origin
|
|
(inherit (package-source hplip))
|
|
(snippet
|
|
(delete '(for-each
|
|
delete-file
|
|
(find-files "." (lambda (file stat)
|
|
(elf-file? file))))
|
|
(origin-snippet (package-source hplip))))))
|
|
(inputs (alist-delete "python-pyqt" (package-inputs hplip)))
|
|
(native-inputs
|
|
(append
|
|
`(("hplip-plugin"
|
|
,(origin
|
|
(method url-fetch)
|
|
(uri (string-append "https://developers.hp.com/sites/default/files/hplip-"
|
|
(package-version hplip) "-plugin.run"))
|
|
;; TODO: Since this needs to be updated on every update to Guix's
|
|
;; hplip in order to build, might be better to decouple this
|
|
;; package from hplip. In the meantime, update this hash when
|
|
;; hplip is updated in Guix.
|
|
(sha256
|
|
(base32
|
|
"09kixd9pb0p94bw3xyqy9h62gwqnbwcjjsvb2g3wvl6zxp4j1fvy")))))
|
|
(package-native-inputs hplip)))
|
|
(arguments
|
|
(substitute-keyword-arguments (package-arguments hplip)
|
|
((#:configure-flags cf)
|
|
#~(delete "--enable-qt5" #$cf))
|
|
((#:phases ph)
|
|
#~(modify-phases #$ph
|
|
(replace 'fix-hard-coded-file-names
|
|
(lambda* (#:key inputs outputs #:allow-other-keys)
|
|
(let ((out (assoc-ref outputs "out"))
|
|
;; FIXME: use merged ppds (I think actually only
|
|
;; drvs need to be merged).
|
|
(cupsdir (assoc-ref inputs "cups-minimal")))
|
|
(substitute* "base/g.py"
|
|
(("'/usr/share;[^']*'")
|
|
(string-append "'" cupsdir "/share'"))
|
|
(("'/etc/hp/hplip.conf'")
|
|
(string-append "'" out
|
|
"/etc/hp/hplip.conf" "'"))
|
|
(("/var/lib/hp")
|
|
(string-append
|
|
out
|
|
"/var/lib/hp")))
|
|
|
|
(substitute* "Makefile.in"
|
|
(("[[:blank:]]check-plugin\\.py[[:blank:]]") " ")
|
|
;; 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"))
|
|
(("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)/var/lib/hp\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")
|
|
;; 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"))
|
|
(("rulessystemdir = /usr/lib/systemd/system")
|
|
;; We don't use systemd.
|
|
(string-append "rulessystemdir = " out
|
|
"/lib/systemd/system"))
|
|
(("/etc/sane.d")
|
|
(string-append out "/etc/sane.d")))
|
|
|
|
(substitute* "common/utils.h"
|
|
(("/var/lib/hp")
|
|
(string-append
|
|
out
|
|
"/var/lib/hp"))))))
|
|
(add-after 'install-models-dat 'install-plugins
|
|
(lambda* (#:key outputs system inputs #:allow-other-keys)
|
|
(let* ((out (assoc-ref outputs "out"))
|
|
(state-dir (string-append out "/var/lib/hp"))
|
|
(hp-arch (assoc-ref
|
|
'(("i686-linux" . "x86_32")
|
|
("x86_64-linux" . "x86_64")
|
|
("armhf-linux" . "arm32")
|
|
("aarch64-linux" . "aarch64"))
|
|
system)))
|
|
(unless hp-arch
|
|
(error (string-append
|
|
"HPLIP plugin not supported on "
|
|
system)))
|
|
(invoke "sh" (assoc-ref inputs "hplip-plugin")
|
|
"--noexec" "--keep")
|
|
(chdir "plugin_tmp")
|
|
(install-file "plugin.spec"
|
|
(string-append out "/share/hplip/"))
|
|
|
|
(for-each
|
|
(lambda (file)
|
|
(install-file
|
|
file
|
|
(string-append out "/share/hplip/data/firmware")))
|
|
(find-files "." "\\.fw.gz$"))
|
|
|
|
(install-file "license.txt"
|
|
(string-append out "/share/hplip/data/plugins"))
|
|
(mkdir-p
|
|
(string-append out "/share/hplip/prnt/plugins"))
|
|
(for-each
|
|
(lambda (type plugins)
|
|
(for-each
|
|
(lambda (plugin)
|
|
(let ((file (string-append plugin "-" hp-arch ".so"))
|
|
(dir (string-append out "/share/hplip/"
|
|
type "/plugins")))
|
|
(install-file file dir)
|
|
(chmod (string-append dir "/" file) #o755)
|
|
(symlink (string-append dir "/" file)
|
|
(string-append dir "/" plugin ".so"))))
|
|
plugins))
|
|
'("prnt" "scan")
|
|
'(("lj" "hbpl1")
|
|
("bb_soap" "bb_marvell" "bb_soapht" "bb_escl")))
|
|
(mkdir-p state-dir)
|
|
(call-with-output-file
|
|
(string-append state-dir "/hplip.state")
|
|
(lambda (port)
|
|
(simple-format port "[plugin]
|
|
installed=1
|
|
eula=1
|
|
version=~A
|
|
" #$(package-version hplip))))
|
|
|
|
(substitute* (string-append out "/etc/hp/hplip.conf")
|
|
(("/usr") out)))))))))))
|
|
|
|
(define-public epson-201401w
|
|
(package
|
|
(name "epson-201401w")
|
|
(version "1.0.0")
|
|
(source
|
|
(origin
|
|
(method url-fetch)
|
|
(uri
|
|
(string-append
|
|
"https://download3.ebz.epson.net/dsc/f/03/00/03/45/41/92e9c9254f0ee4230a069545ba27ec2858a2c457/epson-inkjet-printer-201401w-"
|
|
version
|
|
"-1lsb3.2.src.rpm"))
|
|
(sha256
|
|
(base32 "0c60m1sd59s4sda38dc5nniwa7dh1b0kv1maajr0x9d38gqlyk3x"))))
|
|
(build-system gnu-build-system)
|
|
(arguments
|
|
(list
|
|
#:phases
|
|
#~(modify-phases %standard-phases
|
|
(replace 'unpack
|
|
(lambda* (#:key outputs #:allow-other-keys)
|
|
(mkdir "source")
|
|
(chdir "source")
|
|
(system (string-append "rpm2cpio " #$source " | cpio -idv"))
|
|
(invoke "tar" "-xvf" (string-append "epson-inkjet-printer-201401w-" #$version ".tar.gz"))
|
|
(invoke "tar" "-xvf" (string-append "epson-inkjet-printer-filter-" #$version ".tar.gz"))
|
|
(substitute* (find-files (string-append "epson-inkjet-printer-201401w-" #$version "/ppds/"))
|
|
(("/opt/epson-inkjet-printer-201401w/cups/lib")
|
|
(string-append (assoc-ref outputs "out")
|
|
"/lib/cups")))
|
|
(chdir (string-append "epson-inkjet-printer-filter-" #$version))))
|
|
(add-after 'install 'install-extra-files
|
|
(lambda* (#:key outputs #:allow-other-keys)
|
|
(let* ((out (assoc-ref outputs "out"))
|
|
(model-dir (string-append out "/share/cups/model/epson-inkjet-printer-201401w")))
|
|
(chdir (string-append "../epson-inkjet-printer-201401w-" #$version))
|
|
(mkdir-p model-dir)
|
|
(invoke "cp" "-a" "ppds" model-dir)
|
|
(invoke "cp" "-a" "lib64" "resource" "watermark" out)))))))
|
|
(native-inputs
|
|
(list
|
|
cpio
|
|
cups-minimal
|
|
libjpeg-turbo
|
|
rpm))
|
|
(synopsis
|
|
"Epson printer driver for L series devices")
|
|
(description
|
|
"This software is a filter program used with the Common UNIX Printing
|
|
System (CUPS) under Linux. It supplies high quality printing with
|
|
Seiko Epson Color Ink Jet Printers.
|
|
|
|
Supported printers are:
|
|
@itemize
|
|
@item L456
|
|
@item L455
|
|
@item L366
|
|
@item L365
|
|
@item L362
|
|
@item L360
|
|
@item L312
|
|
@item L310
|
|
@item L222
|
|
@item L220
|
|
@item L132
|
|
@item L130
|
|
@end itemize")
|
|
(home-page "http://download.ebz.epson.net/dsc/du/02/DriverDownloadInfo.do?LG2=FR&CN2=&DSCMI=34541&DSCCHK=4aa5c50773bc3611620a9c42dd549a72c42693a2")
|
|
(license ; SEIKO EPSON CORPORATION SOFTWARE LICENSE AGREEMENT
|
|
(list (nonfree "https://epson.com/SoftwareLicenseAgreement")
|
|
license:lgpl2.1))))
|