cups.scm 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736
  1. ;;; GNU Guix --- Functional package management for GNU
  2. ;;; Copyright © 2015 Ricardo Wurmus <rekado@elephly.net>
  3. ;;; Copyright © 2015, 2016, 2017 Ludovic Courtès <ludo@gnu.org>
  4. ;;; Copyright © 2015, 2016, 2017, 2018 Efraim Flashner <efraim@flashner.co.il>
  5. ;;; Copyright © 2016 Danny Milosavljevic <dannym@scratchpost.org>
  6. ;;; Copyright © 2017 Leo Famulari <leo@famulari.name>
  7. ;;; Copyright © 2017 Mark H Weaver <mhw@netris.org>
  8. ;;; Copyright © 2017, 2018 Tobias Geerinckx-Rice <me@tobias.gr>
  9. ;;;
  10. ;;; This file is part of GNU Guix.
  11. ;;;
  12. ;;; GNU Guix is free software; you can redistribute it and/or modify it
  13. ;;; under the terms of the GNU General Public License as published by
  14. ;;; the Free Software Foundation; either version 3 of the License, or (at
  15. ;;; your option) any later version.
  16. ;;;
  17. ;;; GNU Guix is distributed in the hope that it will be useful, but
  18. ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
  19. ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  20. ;;; GNU General Public License for more details.
  21. ;;;
  22. ;;; You should have received a copy of the GNU General Public License
  23. ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
  24. (define-module (gnu packages cups)
  25. #:use-module (gnu packages)
  26. #:use-module (gnu packages algebra)
  27. #:use-module (gnu packages autotools)
  28. #:use-module (gnu packages avahi)
  29. #:use-module (gnu packages compression)
  30. #:use-module (gnu packages fonts) ; font-dejavu
  31. #:use-module (gnu packages fontutils)
  32. #:use-module (gnu packages ghostscript)
  33. #:use-module (gnu packages glib)
  34. #:use-module (gnu packages groff)
  35. #:use-module (gnu packages image)
  36. #:use-module (gnu packages libusb)
  37. #:use-module (gnu packages pdf)
  38. #:use-module (gnu packages perl)
  39. #:use-module (gnu packages pkg-config)
  40. #:use-module (gnu packages polkit)
  41. #:use-module (gnu packages pretty-print)
  42. #:use-module (gnu packages python)
  43. #:use-module (gnu packages python-xyz)
  44. #:use-module (gnu packages qt)
  45. #:use-module (gnu packages scanner)
  46. #:use-module (gnu packages tls)
  47. #:use-module (guix build-system gnu)
  48. #:use-module (guix build-system python)
  49. #:use-module (guix download)
  50. #:use-module ((guix licenses) #:prefix license:)
  51. #:use-module (guix packages)
  52. #:use-module (guix utils)
  53. #:use-module (srfi srfi-1))
  54. (define-public cups-filters
  55. (package
  56. (name "cups-filters")
  57. (version "1.21.5")
  58. (source(origin
  59. (method url-fetch)
  60. (uri
  61. (string-append "https://openprinting.org/download/cups-filters/"
  62. "cups-filters-" version ".tar.xz"))
  63. (sha256
  64. (base32
  65. "0azq9j7kqy18g6vgmvrbw8i4mcqdp3cbgh7q79x1b8p92w4si6rq"))
  66. (modules '((guix build utils)))
  67. (snippet
  68. ;; install backends, banners and filters to cups-filters output
  69. ;; directory, not the cups server directory
  70. '(begin
  71. (substitute* "Makefile.in"
  72. (("CUPS_DATADIR = @CUPS_DATADIR@")
  73. "CUPS_DATADIR = $(PREFIX)/share/cups")
  74. (("pkgcupsserverrootdir = \\$\\(CUPS_SERVERROOT\\)")
  75. "pkgcupsserverrootdir = $(PREFIX)")
  76. ;; Choose standard directories notably so that binaries are
  77. ;; stripped.
  78. (("pkgbackenddir = \\$\\(CUPS_SERVERBIN\\)/backend")
  79. "pkgbackenddir = $(PREFIX)/lib/cups/backend")
  80. (("pkgfilterdir = \\$\\(CUPS_SERVERBIN\\)/filter")
  81. "pkgfilterdir = $(PREFIX)/lib/cups/filter"))
  82. ;; Find bannertopdf data such as the print test page in our
  83. ;; output directory, not CUPS's prefix.
  84. (substitute* "configure"
  85. (("\\{CUPS_DATADIR\\}/data")
  86. "{prefix}/share/cups/data"))
  87. #t))))
  88. (build-system gnu-build-system)
  89. (arguments
  90. `(#:make-flags (list (string-append "PREFIX=" %output))
  91. #:configure-flags
  92. `("--disable-driverless" ; TODO: enable this
  93. "--disable-mutool" ; depends on yet another PDF library (mupdf)
  94. ;; Look for the "domain socket of CUPS" in /var/run/cups.
  95. "--localstatedir=/var"
  96. ;; Free software for the win.
  97. "--with-acroread-path=evince"
  98. ,(string-append "--with-test-font-path="
  99. (assoc-ref %build-inputs "font-dejavu")
  100. "/share/fonts/truetype/DejaVuSans.ttf")
  101. ,(string-append "--with-gs-path="
  102. (assoc-ref %build-inputs "ghostscript")
  103. "/bin/gsc")
  104. ,(string-append "--with-shell="
  105. (assoc-ref %build-inputs "bash")
  106. "/bin/bash")
  107. ,(string-append "--with-rcdir="
  108. (assoc-ref %outputs "out") "/etc/rc.d"))
  109. #:phases (modify-phases %standard-phases
  110. (add-after 'unpack 'patch-foomatic-hardcoded-file-names
  111. (lambda* (#:key inputs outputs #:allow-other-keys)
  112. ;; Foomatic has hardcoded file names we need to fix.
  113. (let ((out (assoc-ref outputs "out"))
  114. (gs (assoc-ref inputs "ghostscript")))
  115. (substitute* "filter/foomatic-rip/foomaticrip.c"
  116. (("/usr/local/lib/cups/filter")
  117. (string-append out "/lib/cups/filter")))
  118. #t)))
  119. (add-after 'install 'wrap-filters
  120. (lambda* (#:key inputs outputs #:allow-other-keys)
  121. ;; Some filters expect to find 'gs' in $PATH. We cannot
  122. ;; just hard-code its absolute file name in the source
  123. ;; because foomatic-rip, for example, has tests like
  124. ;; 'startswith(cmd, "gs")'.
  125. (let ((out (assoc-ref outputs "out"))
  126. (ghostscript (assoc-ref inputs "ghostscript")))
  127. (for-each (lambda (file)
  128. (wrap-program file
  129. `("PATH" ":" prefix
  130. (,(string-append ghostscript
  131. "/bin")))))
  132. (find-files (string-append
  133. out "/lib/cups/filter")))
  134. #t))))))
  135. (native-inputs
  136. `(("glib" ,glib "bin") ; for gdbus-codegen
  137. ("pkg-config" ,pkg-config)))
  138. (inputs
  139. `(("avahi" ,avahi)
  140. ("fontconfig" ,fontconfig)
  141. ("freetype" ,freetype)
  142. ("font-dejavu" ,font-dejavu) ; also needed by test suite
  143. ("ghostscript" ,ghostscript/cups)
  144. ("ijs" ,ijs)
  145. ("dbus" ,dbus)
  146. ("lcms" ,lcms)
  147. ("libjpeg" ,libjpeg)
  148. ("libpng" ,libpng)
  149. ("libtiff" ,libtiff)
  150. ("glib" ,glib)
  151. ("qpdf" ,qpdf)
  152. ("poppler" ,poppler)
  153. ("cups-minimal" ,cups-minimal)))
  154. (home-page "https://wiki.linuxfoundation.org/openprinting/cups-filters")
  155. (synopsis "OpenPrinting CUPS filters and backends")
  156. (description
  157. "Contains backends, filters, and other software that was once part of the
  158. core CUPS distribution but is no longer maintained by Apple Inc. In addition
  159. it contains additional filters developed independently of Apple, especially
  160. filters for the PDF-centric printing workflow introduced by OpenPrinting.")
  161. ;; Different filters and backends have different licenses; see COPYING for
  162. ;; details
  163. (license (list license:gpl2
  164. license:gpl2+
  165. license:gpl3
  166. license:gpl3+
  167. license:lgpl2.0+
  168. license:expat))))
  169. ;; CUPS on non-MacOS systems requires cups-filters. Since cups-filters also
  170. ;; depends on CUPS libraries and binaries, cups-minimal has been added to
  171. ;; satisfy this dependency.
  172. (define-public cups-minimal
  173. (package
  174. (name "cups-minimal")
  175. (version "2.2.10")
  176. (source
  177. (origin
  178. (method url-fetch)
  179. (uri (string-append "https://github.com/apple/cups/releases/download/v"
  180. version "/cups-" version "-source.tar.gz"))
  181. (sha256
  182. (base32
  183. "1fq52aw1mini3ld2czv5gg37wbbvh4n7yc7wzzxvbs3zpfrv5j3p"))))
  184. (build-system gnu-build-system)
  185. (arguments
  186. `(#:configure-flags
  187. '("--disable-launchd"
  188. "--disable-systemd"
  189. "--disable-avahi"
  190. "--disable-dnssd")
  191. ;; Seven tests fail, mostly because of files that are provided by the
  192. ;; cups-filters package.
  193. #:tests? #f
  194. #:phases
  195. (modify-phases %standard-phases
  196. (add-before 'configure 'patch-makedefs
  197. (lambda _
  198. (substitute* "Makedefs.in"
  199. (("INITDIR.*=.*@INITDIR@") "INITDIR = @prefix@/@INITDIR@")
  200. (("/bin/sh") (which "sh")))
  201. #t))
  202. ;; Make the compressed manpages writable so that the
  203. ;; reset-gzip-timestamps phase does not error out.
  204. (add-before 'reset-gzip-timestamps 'make-manpages-writable
  205. (lambda* (#:key outputs #:allow-other-keys)
  206. (let* ((out (assoc-ref outputs "out"))
  207. (man (string-append out "/share/man")))
  208. (for-each (lambda (file) (chmod file #o644))
  209. (find-files man "\\.gz"))
  210. #t)))
  211. (add-before 'build 'patch-tests
  212. (lambda _
  213. (substitute* "test/ippserver.c"
  214. (("# else /\\* HAVE_AVAHI \\*/")
  215. "#elif defined(HAVE_AVAHI)"))
  216. #t)))))
  217. (native-inputs
  218. `(("pkg-config" ,pkg-config)))
  219. (inputs
  220. `(("zlib" ,zlib)
  221. ("gnutls" ,gnutls)))
  222. (home-page "https://www.cups.org")
  223. (synopsis "The Common Unix Printing System")
  224. (description
  225. "CUPS is a printing system that uses the Internet Printing Protocol
  226. (@dfn{IPP}). It provides System V and BSD command-line interfaces, as well
  227. as a Web interface and a C programming interface to manage printers and print
  228. jobs. It supports printing to both local (parallel, serial, USB) and
  229. networked printers, and printers can be shared from one computer to another.
  230. Internally, CUPS uses PostScript Printer Description (@dfn{PPD}) files to
  231. describe printer capabilities and features, and a wide variety of generic and
  232. device-specific programs to convert and print many types of files.")
  233. (license license:gpl2)))
  234. (define-public cups
  235. (package (inherit cups-minimal)
  236. (name "cups")
  237. (arguments
  238. `(;; Three tests fail:
  239. ;; * two tests in ipp-1.1.test related to "RFC 2911 section 3.2.6:
  240. ;; Get-Jobs Operation"
  241. ;; * test of number of error/warning messages, probably related to a
  242. ;; missing font.
  243. #:tests? #f
  244. #:configure-flags
  245. '("--disable-launchd"
  246. "--disable-systemd")
  247. #:phases
  248. (modify-phases %standard-phases
  249. (add-before 'configure 'patch-makedefs
  250. (lambda _
  251. (substitute* "Makedefs.in"
  252. (("INITDIR.*=.*@INITDIR@") "INITDIR = @prefix@/@INITDIR@")
  253. (("/bin/sh") (which "sh")))
  254. #t))
  255. (add-before 'check 'patch-tests
  256. (lambda _
  257. (let ((filters (assoc-ref %build-inputs "cups-filters"))
  258. (catpath (string-append
  259. (assoc-ref %build-inputs "coreutils") "/bin/"))
  260. (testdir (string-append (getcwd) "/tmp/")))
  261. (mkdir testdir)
  262. (substitute* "test/run-stp-tests.sh"
  263. ((" *BASE=/tmp/") (string-append "BASE=" testdir))
  264. ;; allow installation of filters from output dir and from
  265. ;; cups-filters
  266. (("for dir in /usr/libexec/cups/filter /usr/lib/cups/filter")
  267. (string-append
  268. "for dir in "
  269. (assoc-ref %outputs "out") "/lib/cups/filter "
  270. filters "/lib/cups/filter"))
  271. ;; check for charsets in cups-filters output
  272. (("/usr/share/cups/charsets")
  273. (string-append filters "/share/cups/charsets"))
  274. ;; install additional required filters
  275. (("instfilter texttopdf texttopdf pdf")
  276. (string-append
  277. "instfilter texttopdf texttopdf pdf;"
  278. "instfilter imagetoraster imagetoraster raster;"
  279. "instfilter gstoraster gstoraster raster;"
  280. "instfilter urftopdf urftopdf pdf;"
  281. "instfilter rastertopdf rastertopdf pdf;"
  282. "instfilter pstopdf pstopdf pdf"))
  283. ;; specify location of lpstat binary
  284. (("description=\"`lpstat -l")
  285. "description=\"`../systemv/lpstat -l")
  286. ;; patch shebangs of embedded scripts
  287. (("#!/bin/sh") (string-append "#!" (which "sh")))
  288. ;; also link mime definitions from cups-filters
  289. ;; to enable the additional filters for the test suite
  290. (("ln -s \\$root/conf/mime\\.types")
  291. (string-append
  292. "ln -s " filters
  293. "/share/cups/mime/cupsfilters.types $BASE/share/mime; "
  294. "ln -s $root/conf/mime.types"))
  295. (("ln -s \\$root/conf/mime\\.convs")
  296. (string-append
  297. "ln -s " filters
  298. "/share/cups/mime/cupsfilters.convs $BASE/share/mime; "
  299. "ln -s $root/conf/mime.convs")))
  300. ;; fix search path for "cat"
  301. (substitute* "cups/testfile.c"
  302. (("cupsFileFind\\(\"cat\", \"/bin\"")
  303. (string-append "cupsFileFind(\"cat\", \"" catpath "\""))
  304. (("cupsFileFind\\(\"cat\", \"/bin:/usr/bin\"")
  305. (string-append "cupsFileFind(\"cat\", \"" catpath "\"")))
  306. #t)))
  307. ;; Make the compressed manpages writable so that the
  308. ;; reset-gzip-timestamps phase does not error out.
  309. (add-before 'reset-gzip-timestamps 'make-manpages-writable
  310. (lambda* (#:key outputs #:allow-other-keys)
  311. (let* ((out (assoc-ref outputs "out"))
  312. (man (string-append out "/share/man")))
  313. (for-each (lambda (file) (chmod file #o644))
  314. (find-files man "\\.gz"))
  315. #t)))
  316. (add-after 'install 'install-cups-filters-symlinks
  317. (lambda* (#:key inputs outputs #:allow-other-keys)
  318. (let ((out (assoc-ref outputs "out"))
  319. (cups-filters (assoc-ref inputs "cups-filters")))
  320. ;; charsets
  321. (symlink
  322. (string-append cups-filters "/share/cups/charsets")
  323. (string-append out "/share/charsets"))
  324. ;; mime types, driver file, ppds
  325. (for-each
  326. (lambda (f)
  327. (symlink (string-append cups-filters f)
  328. (string-append out f)))
  329. '("/share/cups/mime/cupsfilters.types"
  330. "/share/cups/mime/cupsfilters.convs"
  331. "/share/cups/drv/cupsfilters.drv"
  332. "/share/ppd"))
  333. ;; filters
  334. (for-each
  335. (lambda (f)
  336. (symlink f
  337. (string-append out "/lib/cups/filter" (basename f))))
  338. (find-files (string-append cups-filters "/lib/cups/filter")))
  339. ;; backends
  340. (for-each
  341. (lambda (f)
  342. (symlink (string-append cups-filters f)
  343. (string-append out "/lib/cups/backend/"
  344. (basename f))))
  345. '("/lib/cups/backend/parallel"
  346. "/lib/cups/backend/serial"))
  347. ;; banners
  348. (let ((banners "/share/cups/banners"))
  349. (delete-file-recursively (string-append out banners))
  350. (symlink (string-append cups-filters banners)
  351. (string-append out banners)))
  352. ;; assorted data
  353. (let ((data "/share/cups/data"))
  354. (delete-file-recursively (string-append out data))
  355. (symlink (string-append cups-filters data)
  356. (string-append out data)))
  357. #t))))))
  358. (inputs
  359. `(("avahi" ,avahi)
  360. ("gnutls" ,gnutls)
  361. ("cups-filters" ,cups-filters)
  362. ("zlib" ,zlib)))))
  363. (define-public cups-pk-helper
  364. (package
  365. (name "cups-pk-helper")
  366. (version "0.2.6")
  367. (source (origin
  368. (method url-fetch)
  369. (uri (string-append "https://freedesktop.org/software/"
  370. name "/releases/" name "-" version ".tar.xz"))
  371. (sha256
  372. (base32
  373. "0a52jw6rm7lr5nbyksiia0rn7sasyb5cjqcb95z1wxm2yprgi6lm"))))
  374. (build-system gnu-build-system)
  375. (native-inputs
  376. `(("intltool" ,intltool)
  377. ("pkg-config" ,pkg-config)
  378. ("glib" ,glib)
  379. ("polkit" ,polkit)
  380. ("cups" ,cups)))
  381. (home-page "https://www.freedesktop.org/wiki/Software/cups-pk-helper/")
  382. (synopsis "PolicyKit helper to configure CUPS with fine-grained privileges")
  383. (description
  384. "This package provides the org.opensuse.CupsPkHelper.Mechanism DBus
  385. system service which uses @file{cups-pk-helper-mechanism}. This package
  386. should only be used as part of the Guix cups-pk-helper service.")
  387. (license license:gpl2+)))
  388. (define-public hplip
  389. (package
  390. (name "hplip")
  391. (version "3.18.9")
  392. (source (origin
  393. (method url-fetch)
  394. (uri (string-append "mirror://sourceforge/hplip/hplip/" version
  395. "/hplip-" version ".tar.gz"))
  396. (sha256
  397. (base32
  398. "0g3q5mm2crjyc1z4z6gv4lam6sc5d3diz704djrnpqadk4q3h290"))
  399. (modules '((guix build utils)))
  400. (patches (search-patches "hplip-remove-imageprocessor.patch"))
  401. (snippet
  402. '(begin
  403. ;; Delete non-free blobs
  404. (for-each delete-file (find-files "." "\\.so$"))
  405. (delete-file "prnt/hpcups/ImageProcessor.h")
  406. ;; Fix type mismatch.
  407. (substitute* "prnt/hpcups/genPCLm.cpp"
  408. (("boolean") "bool"))
  409. #t))))
  410. (build-system gnu-build-system)
  411. (home-page "https://developers.hp.com/hp-linux-imaging-and-printing")
  412. (synopsis "HP printer drivers")
  413. (description
  414. "Hewlett-Packard printer drivers and PostScript Printer Descriptions
  415. (@dfn{PPD}s).")
  416. ;; The 'COPYING' file lists directories where each of these 3 licenses
  417. ;; applies.
  418. (license (list license:gpl2+ license:bsd-3 license:expat))
  419. ;; TODO install apparmor profile files eventually.
  420. (arguments
  421. `(#:configure-flags
  422. `("--disable-network-build"
  423. ,(string-append "--prefix=" (assoc-ref %outputs "out"))
  424. ,(string-append "--sysconfdir=" (assoc-ref %outputs "out") "/etc")
  425. ,(string-append "LDFLAGS=-Wl,-rpath="
  426. (assoc-ref %outputs "out") "/lib")
  427. ;; Disable until mime.types merging works (FIXME).
  428. "--disable-fax-build"
  429. "--enable-hpcups-install"
  430. "--enable-new-hpcups"
  431. "--enable-cups_ppd_install"
  432. "--enable-cups_drv_install"
  433. ;; TODO add foomatic drv install eventually.
  434. ;; TODO --enable-policykit eventually.
  435. ,(string-append "--with-cupsfilterdir="
  436. (assoc-ref %outputs "out") "/lib/cups/filter")
  437. ,(string-append "--with-cupsbackenddir="
  438. (assoc-ref %outputs "out") "/lib/cups/backend")
  439. ,(string-append "--with-icondir="
  440. (assoc-ref %outputs "out") "/share/applications")
  441. ,(string-append "--with-systraydir="
  442. (assoc-ref %outputs "out") "/etc/xdg")
  443. "--enable-qt5" "--disable-qt4")
  444. #:imported-modules ((guix build python-build-system)
  445. ,@%gnu-build-system-modules)
  446. #:modules ((guix build gnu-build-system)
  447. (guix build utils)
  448. ((guix build python-build-system) #:prefix python:))
  449. #:phases (modify-phases %standard-phases
  450. (add-after 'unpack 'fix-hard-coded-file-names
  451. (lambda* (#:key inputs outputs #:allow-other-keys)
  452. (let ((out (assoc-ref outputs "out"))
  453. ;; FIXME: use merged ppds (I think actually only
  454. ;; drvs need to be merged).
  455. (cupsdir (assoc-ref inputs "cups-minimal")))
  456. (substitute* "base/g.py"
  457. (("'/usr/share;[^']*'")
  458. (string-append "'" cupsdir "/share'"))
  459. (("'/etc/hp/hplip.conf'")
  460. (string-append "'" out
  461. "/etc/hp/hplip.conf" "'")))
  462. (substitute* "Makefile.in"
  463. (("[[:blank:]]check-plugin\\.py[[:blank:]]") " ")
  464. ;; FIXME Use beginning-of-word in regexp.
  465. (("[[:blank:]]plugin\\.py[[:blank:]]") " ")
  466. (("/usr/include/libusb-1.0")
  467. (string-append (assoc-ref inputs "libusb")
  468. "/include/libusb-1.0"))
  469. (("hplip_statedir =.*$")
  470. ;; Don't bail out while trying to create
  471. ;; /var/lib/hplip. We can safely change its value
  472. ;; here because it's hard-coded in the code anyway.
  473. "hplip_statedir = $(prefix)\n")
  474. (("hplip_confdir = /etc/hp")
  475. ;; This is only used for installing the default config.
  476. (string-append "hplip_confdir = " out
  477. "/etc/hp"))
  478. (("halpredir = /usr/share/hal/fdi/preprobe/10osvendor")
  479. ;; We don't use hal.
  480. (string-append "halpredir = " out
  481. "/share/hal/fdi/preprobe/10osvendor"))
  482. (("rulesdir = /etc/udev/rules.d")
  483. ;; udev rules will be merged by base service.
  484. (string-append "rulesdir = " out
  485. "/lib/udev/rules.d"))
  486. (("rulessystemdir = /usr/lib/systemd/system")
  487. ;; We don't use systemd.
  488. (string-append "rulessystemdir = " out
  489. "/lib/systemd/system"))
  490. (("/etc/sane.d")
  491. (string-append out "/etc/sane.d"))))))
  492. ;; Wrap bin/* so that the Python libraries are found.
  493. (add-after 'install 'wrap-binaries
  494. (assoc-ref python:%standard-phases 'wrap)))))
  495. ;; Note that the error messages printed by the tools in the case of
  496. ;; missing dependencies are often downright misleading.
  497. ;; TODO: hp-toolbox still fails to start with:
  498. ;; from dbus.mainloop.pyqt5 import DBusQtMainLoop
  499. ;; ModuleNotFoundError: No module named 'dbus.mainloop.pyqt5'
  500. (inputs
  501. `(("cups-minimal" ,cups-minimal)
  502. ("dbus" ,dbus)
  503. ("libjpeg" ,libjpeg)
  504. ("libusb" ,libusb)
  505. ("python" ,python)
  506. ("python-dbus" ,python-dbus)
  507. ("python-pygobject" ,python-pygobject)
  508. ("python-pyqt" ,python-pyqt)
  509. ("python-wrapper" ,python-wrapper)
  510. ("sane-backends" ,sane-backends-minimal)
  511. ("zlib" ,zlib)))
  512. (native-inputs
  513. `(("perl" ,perl)
  514. ("pkg-config" ,pkg-config)))))
  515. (define-public hplip-minimal
  516. (package
  517. (inherit hplip)
  518. (name "hplip-minimal")
  519. (arguments
  520. (substitute-keyword-arguments (package-arguments hplip)
  521. ((#:configure-flags cf)
  522. `(delete "--enable-qt5" ,cf))))
  523. (inputs
  524. (fold alist-delete (package-inputs hplip)
  525. '("python-pygobject" "python-pyqt")))
  526. (synopsis "GUI-less version of hplip")))
  527. (define-public foomatic-filters
  528. (package
  529. (name "foomatic-filters")
  530. (version "4.0.17")
  531. (source (origin
  532. (method url-fetch)
  533. (uri (string-append
  534. "http://www.openprinting.org/download/foomatic/"
  535. name "-" version ".tar.gz"))
  536. (sha256
  537. (base32
  538. "1qrkgbm5jay2r7sh9qbyf0aiyrsl1mdc844hxf7fhw95a0zfbqm2"))
  539. (patches
  540. (search-patches "foomatic-filters-CVE-2015-8327.patch"
  541. "foomatic-filters-CVE-2015-8560.patch"))))
  542. (build-system gnu-build-system)
  543. (home-page
  544. "https://wiki.linuxfoundation.org/openprinting/database/foomatic")
  545. (native-inputs
  546. `(("perl" ,perl)
  547. ("pkg-config" ,pkg-config)))
  548. (inputs
  549. `(("dbus" ,dbus)
  550. ("a2ps" ,a2ps)))
  551. (arguments
  552. '( ;; Specify the installation directories.
  553. #:configure-flags (list (string-append "ac_cv_path_CUPS_BACKENDS="
  554. (assoc-ref %outputs "out")
  555. "/lib/cups/backend")
  556. (string-append "ac_cv_path_CUPS_FILTERS="
  557. (assoc-ref %outputs "out")
  558. "/lib/cups/filter")
  559. (string-append "ac_cv_path_PPR_INTERFACES="
  560. (assoc-ref %outputs "out")
  561. "/lib/ppr/interfaces")
  562. (string-append "ac_cv_path_PPR_LIB="
  563. (assoc-ref %outputs "out")
  564. "/lib/ppr/lib")
  565. ;; For some reason these are misdiagnosed.
  566. "ac_cv_func_malloc_0_nonnull=yes"
  567. "ac_cv_func_realloc_0_nonnull=yes")
  568. #:test-target "tests"))
  569. (synopsis "Convert PostScript to the printer's native format")
  570. (description
  571. "This package contains filter scripts used by the printer spoolers to
  572. convert the incoming PostScript data into the printer's native format using a
  573. printer/driver specific, but spooler-independent PPD file.")
  574. (license license:gpl2+)))
  575. (define-public foo2zjs
  576. (package
  577. (name "foo2zjs")
  578. (version "20180910")
  579. (source (origin
  580. (method url-fetch)
  581. ;; XXX: This is an unversioned URL!
  582. (uri "http://foo2zjs.rkkda.com/foo2zjs.tar.gz")
  583. (sha256
  584. (base32
  585. "1clddqy4y4vvws0lllv1v90dfiihihdc23bn93c544yb3fvmwmr6"))))
  586. (build-system gnu-build-system)
  587. (arguments
  588. '(#:phases (modify-phases %standard-phases
  589. (replace 'configure
  590. (lambda* (#:key outputs #:allow-other-keys)
  591. (substitute* (find-files "." "^Makefile$")
  592. ;; Set the installation directory.
  593. (("^PREFIX[[:blank:]]*=.*$")
  594. (string-append "PREFIX = "
  595. (assoc-ref outputs "out")
  596. "\n"))
  597. (("^UDEVBIN[[:blank:]]*=.*$")
  598. "UDEVBIN = $(PREFIX)/bin\n")
  599. ;; Don't try to chown/chgrp the installed files.
  600. (("-oroot")
  601. "")
  602. (("-glp")
  603. "")
  604. ;; Placate the dependency checks.
  605. (("/usr/include/stdio.h")
  606. "/etc/passwd")
  607. (("/usr/")
  608. "$(PREFIX)/")
  609. ;; Ensure fixed timestamps in man pages.
  610. (("^MODTIME[[:blank:]]*=.*$")
  611. "MODTIME = echo Thu Jan 01 01:00:00 1970\n"))
  612. #t))
  613. (add-after 'install 'remove-pdf
  614. (lambda* (#:key outputs #:allow-other-keys)
  615. ;; Remove 'manual.pdf' which is (1) useless (it's a
  616. ;; concatenation of man pages), and (2) not
  617. ;; bit-reproducible due to <https://bugs.gnu.org/27593>.
  618. (let ((out (assoc-ref outputs "out")))
  619. (for-each delete-file
  620. (find-files out "^manual\\.pdf$"))
  621. #t))))
  622. #:parallel-build? #f ;broken makefile
  623. #:tests? #f ;no tests
  624. #:make-flags '("CC=gcc")))
  625. (inputs
  626. `(("ghostscript" ,ghostscript)
  627. ("foomatic-filters" ,foomatic-filters))) ;for 'foomatic-rip'
  628. (native-inputs
  629. `(("bc" ,bc)
  630. ("groff" ,groff)))
  631. (home-page "http://foo2zjs.rkkda.com/")
  632. (synopsis "Printer driver for ZjStream-based printers")
  633. (description
  634. "foo2zjs is a printer driver for printers that use the Zenographics
  635. ZjStream wire protocol for their print data, often erroneously referred to as
  636. winprinters or GDI printers.
  637. It supports Minolta/QMS@tie{}Magicolor, Minolta@tie{}Color@tie{}PageWorks/Pro,
  638. HP@tie{}LaserJet, and possibly other printers. See @file{README} for details.")
  639. (license (list license:expat ; icc2ps/*.[ch]
  640. license:gpl2+)))) ; everything else
  641. (define-public escpr
  642. (package
  643. (name "escpr")
  644. (version "1.6.30")
  645. ;; XXX: This currently works. But it will break as soon as a newer
  646. ;; version is available since the URLs for older versions are not
  647. ;; preserved. An alternative source will be added as soon as
  648. ;; available.
  649. (source (origin
  650. (method url-fetch)
  651. ;; The uri has to be chopped up in order to satisfy guix lint.
  652. (uri (string-append "https://download3.ebz.epson.net/dsc/f/03/00/08/18/20/"
  653. "e94de600e28e510c1cfa158929d8b2c0aadc8aa0/"
  654. "epson-inkjet-printer-escpr-1.6.30-1lsb3.2.tar.gz"))
  655. (sha256
  656. (base32
  657. "0m8pyfkixisp0vclwxj340isn15zzisal0v2xvv66kxfd68dzf12"))))
  658. (build-system gnu-build-system)
  659. (arguments
  660. `(#:configure-flags
  661. `(,(string-append "--prefix="
  662. (assoc-ref %outputs "out"))
  663. ,(string-append "--with-cupsfilterdir="
  664. (assoc-ref %outputs "out") "/lib/cups/filter")
  665. ,(string-append "--with-cupsppddir="
  666. (assoc-ref %outputs "out") "/share/ppd"))))
  667. (inputs `(("cups" ,cups-minimal)))
  668. (synopsis "ESC/P-R printer driver")
  669. (description
  670. "This package provides a filter for the Common UNIX Printing
  671. System (CUPS). It offers high-quality printing with Seiko Epson color ink jet
  672. printers. It can only be used with printers that support the Epson ESC/P-R
  673. language.")
  674. (home-page "http://download.ebz.epson.net/dsc/search/01/search")
  675. (license license:gpl2+)))
  676. (define-public python-pycups
  677. (package
  678. (name "python-pycups")
  679. (version "1.9.74")
  680. (source
  681. (origin
  682. (method url-fetch)
  683. (uri (pypi-uri "pycups" version ".tar.bz2"))
  684. (sha256
  685. (base32
  686. "1ffp7sswhdsfpy88zg0cc8kl04wygkjs01rlm9f0spbwk8jhy2c6"))))
  687. (build-system python-build-system)
  688. (arguments
  689. '(;; Tests require CUPS to be running
  690. #:tests? #f))
  691. (inputs
  692. `(("cups" ,cups)))
  693. (home-page "https://github.com/zdohnal/pycups")
  694. (synopsis "Python bindings for libcups")
  695. (description
  696. "This package provides Python bindings for libcups, wrapping the CUPS
  697. API.")
  698. (license license:gpl2+)))