| 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 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 | |
| 25 | (define-module (gnu packages cups) |
| 26 | #:use-module ((guix licenses) #:prefix license:) |
| 27 | #:use-module (guix packages) |
| 28 | #:use-module (guix download) |
| 29 | #:use-module (guix build-system gnu) |
| 30 | #:use-module (gnu packages) |
| 31 | #:use-module (gnu packages algebra) |
| 32 | #:use-module (gnu packages autotools) |
| 33 | #:use-module (gnu packages avahi) |
| 34 | #:use-module (gnu packages compression) |
| 35 | #:use-module (gnu packages groff) |
| 36 | #:use-module (gnu packages libusb) |
| 37 | #:use-module (gnu packages perl) |
| 38 | #:use-module (gnu packages pretty-print) |
| 39 | #:use-module (gnu packages python) |
| 40 | #:use-module (gnu packages scanner) |
| 41 | #:use-module (gnu packages image) |
| 42 | #:use-module (gnu packages fonts) ;font-dejavu |
| 43 | #:use-module (gnu packages fontutils) |
| 44 | #:use-module (gnu packages ghostscript) |
| 45 | #:use-module (gnu packages glib) |
| 46 | #:use-module (gnu packages pdf) |
| 47 | #:use-module (gnu packages pkg-config) |
| 48 | #:use-module (gnu packages tls)) |
| 49 | |
| 50 | (define-public cups-filters |
| 51 | (package |
| 52 | (name "cups-filters") |
| 53 | (version "1.20.1") |
| 54 | (source(origin |
| 55 | (method url-fetch) |
| 56 | (uri |
| 57 | (string-append "https://openprinting.org/download/cups-filters/" |
| 58 | "cups-filters-" version ".tar.xz")) |
| 59 | (sha256 |
| 60 | (base32 |
| 61 | "0qix1whz5n4ijnl6d44f1v8nzkpv99wqjyrby8vx6xnpskw5hsxk")) |
| 62 | (modules '((guix build utils))) |
| 63 | (snippet |
| 64 | ;; install backends, banners and filters to cups-filters output |
| 65 | ;; directory, not the cups server directory |
| 66 | '(begin |
| 67 | (substitute* "Makefile.in" |
| 68 | (("CUPS_DATADIR = @CUPS_DATADIR@") |
| 69 | "CUPS_DATADIR = $(PREFIX)/share/cups") |
| 70 | (("pkgcupsserverrootdir = \\$\\(CUPS_SERVERROOT\\)") |
| 71 | "pkgcupsserverrootdir = $(PREFIX)") |
| 72 | ;; Choose standard directories notably so that binaries are |
| 73 | ;; stripped. |
| 74 | (("pkgbackenddir = \\$\\(CUPS_SERVERBIN\\)/backend") |
| 75 | "pkgbackenddir = $(PREFIX)/lib/cups/backend") |
| 76 | (("pkgfilterdir = \\$\\(CUPS_SERVERBIN\\)/filter") |
| 77 | "pkgfilterdir = $(PREFIX)/lib/cups/filter")) |
| 78 | ;; Find bannertopdf data such as the print test page in our |
| 79 | ;; output directory, not CUPS's prefix. |
| 80 | (substitute* "configure" |
| 81 | (("\\{CUPS_DATADIR\\}/data") |
| 82 | "{prefix}/share/cups/data")) |
| 83 | #t)))) |
| 84 | (build-system gnu-build-system) |
| 85 | (arguments |
| 86 | `(#:make-flags (list (string-append "PREFIX=" %output)) |
| 87 | #:configure-flags |
| 88 | `("--disable-driverless" ; TODO: enable this |
| 89 | "--disable-mutool" ; depends on yet another PDF library (mupdf) |
| 90 | |
| 91 | ;; Look for the "domain socket of CUPS" in /var/run/cups. |
| 92 | "--localstatedir=/var" |
| 93 | |
| 94 | ;; Free software for the win. |
| 95 | "--with-acroread-path=evince" |
| 96 | |
| 97 | ,(string-append "--with-test-font-path=" |
| 98 | (assoc-ref %build-inputs "font-dejavu") |
| 99 | "/share/fonts/truetype/DejaVuSans.ttf") |
| 100 | ,(string-append "--with-gs-path=" |
| 101 | (assoc-ref %build-inputs "ghostscript") |
| 102 | "/bin/gsc") |
| 103 | ,(string-append "--with-shell=" |
| 104 | (assoc-ref %build-inputs "bash") |
| 105 | "/bin/bash") |
| 106 | ,(string-append "--with-rcdir=" |
| 107 | (assoc-ref %outputs "out") "/etc/rc.d")) |
| 108 | |
| 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 | |
| 170 | ;; CUPS on non-MacOS systems requires cups-filters. Since cups-filters also |
| 171 | ;; depends on CUPS libraries and binaries, cups-minimal has been added to |
| 172 | ;; satisfy this dependency. |
| 173 | (define-public cups-minimal |
| 174 | (package |
| 175 | (name "cups-minimal") |
| 176 | (version "2.2.6") |
| 177 | (source |
| 178 | (origin |
| 179 | (method url-fetch) |
| 180 | (uri (string-append "https://github.com/apple/cups/releases/download/v" |
| 181 | version "/cups-" version "-source.tar.gz")) |
| 182 | (sha256 |
| 183 | (base32 |
| 184 | "16qn41b84xz6khrr2pa2wdwlqxr29rrrkjfi618gbgdkq9w5ff20")))) |
| 185 | (build-system gnu-build-system) |
| 186 | (arguments |
| 187 | `(#:configure-flags |
| 188 | '("--disable-launchd" |
| 189 | "--disable-systemd" |
| 190 | "--disable-avahi" |
| 191 | "--disable-dnssd") |
| 192 | ;; Seven tests fail, mostly because of files that are provided by the |
| 193 | ;; cups-filters package. |
| 194 | #:tests? #f |
| 195 | #:phases |
| 196 | (modify-phases %standard-phases |
| 197 | (add-before 'configure 'patch-makedefs |
| 198 | (lambda _ |
| 199 | (substitute* "Makedefs.in" |
| 200 | (("INITDIR.*=.*@INITDIR@") "INITDIR = @prefix@/@INITDIR@") |
| 201 | (("/bin/sh") (which "sh"))) |
| 202 | #t)) |
| 203 | ;; Make the compressed manpages writable so that the |
| 204 | ;; reset-gzip-timestamps phase does not error out. |
| 205 | (add-before 'reset-gzip-timestamps 'make-manpages-writable |
| 206 | (lambda* (#:key outputs #:allow-other-keys) |
| 207 | (let* ((out (assoc-ref outputs "out")) |
| 208 | (man (string-append out "/share/man"))) |
| 209 | (for-each (lambda (file) (chmod file #o644)) |
| 210 | (find-files man "\\.gz")) |
| 211 | #t))) |
| 212 | (add-before 'build 'patch-tests |
| 213 | (lambda _ |
| 214 | (substitute* "test/ippserver.c" |
| 215 | (("# else /\\* HAVE_AVAHI \\*/") |
| 216 | "#elif defined(HAVE_AVAHI)")) |
| 217 | #t))))) |
| 218 | (native-inputs |
| 219 | `(("pkg-config" ,pkg-config))) |
| 220 | (inputs |
| 221 | `(("zlib" ,zlib) |
| 222 | ("gnutls" ,gnutls))) |
| 223 | (home-page "https://www.cups.org") |
| 224 | (synopsis "The Common Unix Printing System") |
| 225 | (description |
| 226 | "CUPS is a printing system that uses the Internet Printing Protocol |
| 227 | (@dfn{IPP}). It provides System V and BSD command-line interfaces, as well |
| 228 | as a Web interface and a C programming interface to manage printers and print |
| 229 | jobs. It supports printing to both local (parallel, serial, USB) and |
| 230 | networked printers, and printers can be shared from one computer to another. |
| 231 | Internally, CUPS uses PostScript Printer Description (@dfn{PPD}) files to |
| 232 | describe printer capabilities and features, and a wide variety of generic and |
| 233 | device-specific programs to convert and print many types of files.") |
| 234 | (license license:gpl2))) |
| 235 | |
| 236 | (define-public cups |
| 237 | (package (inherit cups-minimal) |
| 238 | (name "cups") |
| 239 | (arguments |
| 240 | `(;; Three tests fail: |
| 241 | ;; * two tests in ipp-1.1.test related to "RFC 2911 section 3.2.6: |
| 242 | ;; Get-Jobs Operation" |
| 243 | ;; * test of number of error/warning messages, probably related to a |
| 244 | ;; missing font. |
| 245 | #:tests? #f |
| 246 | #:configure-flags |
| 247 | '("--disable-launchd" |
| 248 | "--disable-systemd") |
| 249 | #:phases |
| 250 | (modify-phases %standard-phases |
| 251 | (add-before 'configure 'patch-makedefs |
| 252 | (lambda _ |
| 253 | (substitute* "Makedefs.in" |
| 254 | (("INITDIR.*=.*@INITDIR@") "INITDIR = @prefix@/@INITDIR@") |
| 255 | (("/bin/sh") (which "sh"))) |
| 256 | #t)) |
| 257 | (add-before 'check 'patch-tests |
| 258 | (lambda _ |
| 259 | (let ((filters (assoc-ref %build-inputs "cups-filters")) |
| 260 | (catpath (string-append |
| 261 | (assoc-ref %build-inputs "coreutils") "/bin/")) |
| 262 | (testdir (string-append (getcwd) "/tmp/"))) |
| 263 | (mkdir testdir) |
| 264 | (substitute* "test/run-stp-tests.sh" |
| 265 | ((" *BASE=/tmp/") (string-append "BASE=" testdir)) |
| 266 | |
| 267 | ;; allow installation of filters from output dir and from |
| 268 | ;; cups-filters |
| 269 | (("for dir in /usr/libexec/cups/filter /usr/lib/cups/filter") |
| 270 | (string-append |
| 271 | "for dir in " |
| 272 | (assoc-ref %outputs "out") "/lib/cups/filter " |
| 273 | filters "/lib/cups/filter")) |
| 274 | |
| 275 | ;; check for charsets in cups-filters output |
| 276 | (("/usr/share/cups/charsets") |
| 277 | (string-append filters "/share/cups/charsets")) |
| 278 | |
| 279 | ;; install additional required filters |
| 280 | (("instfilter texttopdf texttopdf pdf") |
| 281 | (string-append |
| 282 | "instfilter texttopdf texttopdf pdf;" |
| 283 | "instfilter imagetoraster imagetoraster raster;" |
| 284 | "instfilter gstoraster gstoraster raster;" |
| 285 | "instfilter urftopdf urftopdf pdf;" |
| 286 | "instfilter rastertopdf rastertopdf pdf;" |
| 287 | "instfilter pstopdf pstopdf pdf")) |
| 288 | |
| 289 | ;; specify location of lpstat binary |
| 290 | (("description=\"`lpstat -l") |
| 291 | "description=\"`../systemv/lpstat -l") |
| 292 | |
| 293 | ;; patch shebangs of embedded scripts |
| 294 | (("#!/bin/sh") (string-append "#!" (which "sh"))) |
| 295 | |
| 296 | ;; also link mime definitions from cups-filters |
| 297 | ;; to enable the additional filters for the test suite |
| 298 | (("ln -s \\$root/conf/mime\\.types") |
| 299 | (string-append |
| 300 | "ln -s " filters |
| 301 | "/share/cups/mime/cupsfilters.types $BASE/share/mime; " |
| 302 | "ln -s $root/conf/mime.types")) |
| 303 | (("ln -s \\$root/conf/mime\\.convs") |
| 304 | (string-append |
| 305 | "ln -s " filters |
| 306 | "/share/cups/mime/cupsfilters.convs $BASE/share/mime; " |
| 307 | "ln -s $root/conf/mime.convs"))) |
| 308 | |
| 309 | ;; fix search path for "cat" |
| 310 | (substitute* "cups/testfile.c" |
| 311 | (("cupsFileFind\\(\"cat\", \"/bin\"") |
| 312 | (string-append "cupsFileFind(\"cat\", \"" catpath "\"")) |
| 313 | (("cupsFileFind\\(\"cat\", \"/bin:/usr/bin\"") |
| 314 | (string-append "cupsFileFind(\"cat\", \"" catpath "\""))) |
| 315 | #t))) |
| 316 | ;; Make the compressed manpages writable so that the |
| 317 | ;; reset-gzip-timestamps phase does not error out. |
| 318 | (add-before 'reset-gzip-timestamps 'make-manpages-writable |
| 319 | (lambda* (#:key outputs #:allow-other-keys) |
| 320 | (let* ((out (assoc-ref outputs "out")) |
| 321 | (man (string-append out "/share/man"))) |
| 322 | (for-each (lambda (file) (chmod file #o644)) |
| 323 | (find-files man "\\.gz")) |
| 324 | #t))) |
| 325 | (add-after 'install 'install-cups-filters-symlinks |
| 326 | (lambda* (#:key inputs outputs #:allow-other-keys) |
| 327 | (let ((out (assoc-ref outputs "out")) |
| 328 | (cups-filters (assoc-ref inputs "cups-filters"))) |
| 329 | ;; charsets |
| 330 | (symlink |
| 331 | (string-append cups-filters "/share/cups/charsets") |
| 332 | (string-append out "/share/charsets")) |
| 333 | |
| 334 | ;; mime types, driver file, ppds |
| 335 | (for-each |
| 336 | (lambda (f) |
| 337 | (symlink (string-append cups-filters f) |
| 338 | (string-append out f))) |
| 339 | '("/share/cups/mime/cupsfilters.types" |
| 340 | "/share/cups/mime/cupsfilters.convs" |
| 341 | "/share/cups/drv/cupsfilters.drv" |
| 342 | "/share/ppd")) |
| 343 | |
| 344 | ;; filters |
| 345 | (for-each |
| 346 | (lambda (f) |
| 347 | (symlink f |
| 348 | (string-append out "/lib/cups/filter" (basename f)))) |
| 349 | (find-files (string-append cups-filters "/lib/cups/filter"))) |
| 350 | |
| 351 | ;; backends |
| 352 | (for-each |
| 353 | (lambda (f) |
| 354 | (symlink (string-append cups-filters f) |
| 355 | (string-append out "/lib/cups/backend/" |
| 356 | (basename f)))) |
| 357 | '("/lib/cups/backend/parallel" |
| 358 | "/lib/cups/backend/serial")) |
| 359 | |
| 360 | ;; banners |
| 361 | (let ((banners "/share/cups/banners")) |
| 362 | (delete-file-recursively (string-append out banners)) |
| 363 | (symlink (string-append cups-filters banners) |
| 364 | (string-append out banners))) |
| 365 | |
| 366 | ;; assorted data |
| 367 | (let ((data "/share/cups/data")) |
| 368 | (delete-file-recursively (string-append out data)) |
| 369 | (symlink (string-append cups-filters data) |
| 370 | (string-append out data))) |
| 371 | |
| 372 | #t)))))) |
| 373 | (inputs |
| 374 | `(("avahi" ,avahi) |
| 375 | ("gnutls" ,gnutls) |
| 376 | ("cups-filters" ,cups-filters) |
| 377 | ("zlib" ,zlib))))) |
| 378 | |
| 379 | (define-public hplip |
| 380 | (package |
| 381 | (name "hplip") |
| 382 | (version "3.18.3") |
| 383 | (source (origin |
| 384 | (method url-fetch) |
| 385 | (uri (string-append "mirror://sourceforge/hplip/hplip/" version |
| 386 | "/hplip-" version ".tar.gz")) |
| 387 | (sha256 |
| 388 | (base32 |
| 389 | "0x5xs86v18w46rxz5whc15bl4fb7p4km6xqjpwzclp83nl7rl01y")) |
| 390 | (modules '((guix build utils))) |
| 391 | (snippet |
| 392 | ;; Fix type mismatch. |
| 393 | '(begin |
| 394 | (substitute* "prnt/hpcups/genPCLm.cpp" |
| 395 | (("boolean") "bool")) |
| 396 | #t)))) |
| 397 | (build-system gnu-build-system) |
| 398 | (home-page "http://hplipopensource.com/") |
| 399 | (synopsis "HP Printer Drivers") |
| 400 | (description "Hewlett-Packard Printer Drivers and PPDs.") |
| 401 | |
| 402 | ;; The 'COPYING' file lists directories where each of these 3 licenses |
| 403 | ;; applies. |
| 404 | (license (list license:gpl2+ license:bsd-3 license:expat)) |
| 405 | |
| 406 | ;; TODO install apparmor profile files eventually. |
| 407 | (arguments |
| 408 | `(#:configure-flags |
| 409 | `("--disable-network-build" |
| 410 | ,(string-append "--prefix=" (assoc-ref %outputs "out")) |
| 411 | ,(string-append "--sysconfdir=" (assoc-ref %outputs "out") "/etc") |
| 412 | ;; Disable until mime.types merging works (FIXME). |
| 413 | "--disable-fax-build" |
| 414 | "--enable-hpcups-install" |
| 415 | "--enable-new-hpcups" |
| 416 | "--enable-cups_ppd_install" |
| 417 | "--enable-cups_drv_install" |
| 418 | ;; TODO add foomatic drv install eventually. |
| 419 | ;; TODO --enable-policykit eventually. |
| 420 | ,(string-append "--with-cupsfilterdir=" |
| 421 | (assoc-ref %outputs "out") "/lib/cups/filter") |
| 422 | ,(string-append "--with-cupsbackenddir=" |
| 423 | (assoc-ref %outputs "out") "/lib/cups/backend") |
| 424 | ,(string-append "--with-icondir=" |
| 425 | (assoc-ref %outputs "out") "/share/applications") |
| 426 | ,(string-append "--with-systraydir=" |
| 427 | (assoc-ref %outputs "out") "/etc/xdg")) |
| 428 | |
| 429 | #:imported-modules ((guix build python-build-system) |
| 430 | ,@%gnu-build-system-modules) |
| 431 | #:modules ((guix build gnu-build-system) |
| 432 | (guix build utils) |
| 433 | ((guix build python-build-system) #:prefix python:)) |
| 434 | |
| 435 | #:phases (modify-phases %standard-phases |
| 436 | (add-after 'unpack 'fix-hard-coded-file-names |
| 437 | (lambda* (#:key inputs outputs #:allow-other-keys) |
| 438 | (let ((out (assoc-ref outputs "out")) |
| 439 | ;; FIXME: use merged ppds (I think actually only |
| 440 | ;; drvs need to be merged). |
| 441 | (cupsdir (assoc-ref inputs "cups-minimal"))) |
| 442 | (substitute* "base/g.py" |
| 443 | (("'/usr/share;[^']*'") |
| 444 | (string-append "'" cupsdir "/share'")) |
| 445 | (("'/etc/hp/hplip.conf'") |
| 446 | (string-append "'" out |
| 447 | "/etc/hp/hplip.conf" "'"))) |
| 448 | |
| 449 | (substitute* "Makefile.in" |
| 450 | (("[[:blank:]]check-plugin\\.py[[:blank:]]") " ") |
| 451 | ;; FIXME Use beginning-of-word in regexp. |
| 452 | (("[[:blank:]]plugin\\.py[[:blank:]]") " ") |
| 453 | (("/usr/include/libusb-1.0") |
| 454 | (string-append (assoc-ref inputs "libusb") |
| 455 | "/include/libusb-1.0")) |
| 456 | (("hplip_statedir =.*$") |
| 457 | ;; Don't bail out while trying to create |
| 458 | ;; /var/lib/hplip. We can safely change its value |
| 459 | ;; here because it's hard-coded in the code anyway. |
| 460 | "hplip_statedir = $(prefix)\n") |
| 461 | (("hplip_confdir = /etc/hp") |
| 462 | ;; This is only used for installing the default config. |
| 463 | (string-append "hplip_confdir = " out |
| 464 | "/etc/hp")) |
| 465 | (("halpredir = /usr/share/hal/fdi/preprobe/10osvendor") |
| 466 | ;; Note: We don't use hal. |
| 467 | (string-append "halpredir = " out |
| 468 | "/share/hal/fdi/preprobe/10osvendor")) |
| 469 | (("rulesdir = /etc/udev/rules.d") |
| 470 | ;; udev rules will be merged by base service. |
| 471 | (string-append "rulesdir = " out |
| 472 | "/lib/udev/rules.d")) |
| 473 | (("rulessystemdir = /usr/lib/systemd/system") |
| 474 | ;; We don't use systemd. |
| 475 | (string-append "rulessystemdir = " out |
| 476 | "/lib/systemd/system")) |
| 477 | (("/etc/sane.d") |
| 478 | (string-append out "/etc/sane.d")))))) |
| 479 | |
| 480 | ;; Wrap bin/* so that the Python libs are found. |
| 481 | (add-after 'install 'wrap-binaries |
| 482 | (assoc-ref python:%standard-phases 'wrap))))) |
| 483 | |
| 484 | ;; Python3 support is available starting from hplip@3.15.2. |
| 485 | (inputs `(("libjpeg" ,libjpeg) |
| 486 | ("cups-minimal" ,cups-minimal) |
| 487 | ("libusb" ,libusb) |
| 488 | ("sane-backends" ,sane-backends-minimal) |
| 489 | ("zlib" ,zlib) |
| 490 | ("dbus" ,dbus) |
| 491 | ("python-wrapper" ,python-wrapper) |
| 492 | ("python" ,python) |
| 493 | ;; TODO: Make hp-setup find python-dbus. |
| 494 | ("python-dbus" ,python-dbus))) |
| 495 | (native-inputs `(("pkg-config" ,pkg-config) |
| 496 | ("perl" ,perl))))) |
| 497 | |
| 498 | (define-public foomatic-filters |
| 499 | (package |
| 500 | (name "foomatic-filters") |
| 501 | (version "4.0.17") |
| 502 | (source (origin |
| 503 | (method url-fetch) |
| 504 | (uri (string-append |
| 505 | "http://www.openprinting.org/download/foomatic/" |
| 506 | name "-" version ".tar.gz")) |
| 507 | (sha256 |
| 508 | (base32 |
| 509 | "1qrkgbm5jay2r7sh9qbyf0aiyrsl1mdc844hxf7fhw95a0zfbqm2")) |
| 510 | (patches |
| 511 | (search-patches "foomatic-filters-CVE-2015-8327.patch" |
| 512 | "foomatic-filters-CVE-2015-8560.patch")))) |
| 513 | (build-system gnu-build-system) |
| 514 | (home-page |
| 515 | "https://wiki.linuxfoundation.org/openprinting/database/foomatic") |
| 516 | (native-inputs |
| 517 | `(("perl" ,perl) |
| 518 | ("pkg-config" ,pkg-config))) |
| 519 | (inputs |
| 520 | `(("dbus" ,dbus) |
| 521 | ("a2ps" ,a2ps))) |
| 522 | (arguments |
| 523 | '( ;; Specify the installation directories. |
| 524 | #:configure-flags (list (string-append "ac_cv_path_CUPS_BACKENDS=" |
| 525 | (assoc-ref %outputs "out") |
| 526 | "/lib/cups/backend") |
| 527 | (string-append "ac_cv_path_CUPS_FILTERS=" |
| 528 | (assoc-ref %outputs "out") |
| 529 | "/lib/cups/filter") |
| 530 | (string-append "ac_cv_path_PPR_INTERFACES=" |
| 531 | (assoc-ref %outputs "out") |
| 532 | "/lib/ppr/interfaces") |
| 533 | (string-append "ac_cv_path_PPR_LIB=" |
| 534 | (assoc-ref %outputs "out") |
| 535 | "/lib/ppr/lib") |
| 536 | |
| 537 | ;; For some reason these are misdiagnosed. |
| 538 | "ac_cv_func_malloc_0_nonnull=yes" |
| 539 | "ac_cv_func_realloc_0_nonnull=yes") |
| 540 | #:test-target "tests")) |
| 541 | (synopsis "Convert PostScript to the printer's native format") |
| 542 | (description |
| 543 | "This package contains filter scripts used by the printer spoolers to |
| 544 | convert the incoming PostScript data into the printer's native format using a |
| 545 | printer/driver specific, but spooler-independent PPD file.") |
| 546 | (license license:gpl2+))) |
| 547 | |
| 548 | (define-public foo2zjs |
| 549 | (package |
| 550 | (name "foo2zjs") |
| 551 | (version "20171202") |
| 552 | (source (origin |
| 553 | (method url-fetch) |
| 554 | ;; XXX: This is an unversioned URL! |
| 555 | (uri "http://foo2zjs.rkkda.com/foo2zjs.tar.gz") |
| 556 | (sha256 |
| 557 | (base32 |
| 558 | "10m1ksbzqsrsl4faqyl73ahfnj2hv1y3zrmr366zvjg7w3l6ag5n")))) |
| 559 | (build-system gnu-build-system) |
| 560 | (arguments |
| 561 | '(#:phases (modify-phases %standard-phases |
| 562 | (replace 'configure |
| 563 | (lambda* (#:key outputs #:allow-other-keys) |
| 564 | (substitute* (find-files "." "^Makefile$") |
| 565 | ;; Set the installation directory. |
| 566 | (("^PREFIX[[:blank:]]*=.*$") |
| 567 | (string-append "PREFIX = " |
| 568 | (assoc-ref outputs "out") |
| 569 | "\n")) |
| 570 | (("^UDEVBIN[[:blank:]]*=.*$") |
| 571 | "UDEVBIN = $(PREFIX)/bin\n") |
| 572 | ;; Don't try to chown/chgrp the installed files. |
| 573 | (("-oroot") |
| 574 | "") |
| 575 | (("-glp") |
| 576 | "") |
| 577 | ;; Placate the dependency checks. |
| 578 | (("/usr/include/stdio.h") |
| 579 | "/etc/passwd") |
| 580 | (("/usr/") |
| 581 | "$(PREFIX)/") |
| 582 | ;; Ensure fixed timestamps in man pages. |
| 583 | (("^MODTIME[[:blank:]]*=.*$") |
| 584 | "MODTIME = echo Thu Jan 01 01:00:00 1970\n")) |
| 585 | #t)) |
| 586 | (add-after 'install 'remove-pdf |
| 587 | (lambda* (#:key outputs #:allow-other-keys) |
| 588 | ;; Remove 'manual.pdf' which is (1) useless (it's a |
| 589 | ;; concatenation of man pages), and (2) not |
| 590 | ;; bit-reproducible due to <https://bugs.gnu.org/27593>. |
| 591 | (let ((out (assoc-ref outputs "out"))) |
| 592 | (for-each delete-file |
| 593 | (find-files out "^manual\\.pdf$")) |
| 594 | #t)))) |
| 595 | #:parallel-build? #f ;broken makefile |
| 596 | #:tests? #f ;no tests |
| 597 | #:make-flags '("CC=gcc"))) |
| 598 | (inputs |
| 599 | `(("ghostscript" ,ghostscript) |
| 600 | ("foomatic-filters" ,foomatic-filters))) ;for 'foomatic-rip' |
| 601 | (native-inputs |
| 602 | `(("bc" ,bc) |
| 603 | ("groff" ,groff))) |
| 604 | (home-page "http://foo2zjs.rkkda.com/") |
| 605 | (synopsis "Printer driver for ZjStream-based printers") |
| 606 | (description |
| 607 | "foo2zjs is a printer driver for printers that use the Zenographics |
| 608 | ZjStream wire protocol for their print data, often erroneously referred to as |
| 609 | winprinters or GDI printers. |
| 610 | |
| 611 | It supports Minolta/QMS@tie{}Magicolor, Minolta@tie{}Color@tie{}PageWorks/Pro, |
| 612 | HP@tie{}LaserJet, and possibly other printers. See @file{README} for details.") |
| 613 | (license (list license:expat ; icc2ps/*.[ch] |
| 614 | license:gpl2+)))) ; everything else |
| 615 | |
| 616 | (define-public escpr |
| 617 | (package |
| 618 | (name "escpr") |
| 619 | (version "1.6.20") |
| 620 | ;; XXX: This currently works. But it will break as soon as a newer |
| 621 | ;; version is available since the URLs for older versions are not |
| 622 | ;; preserved. An alternative source will be added as soon as |
| 623 | ;; available. |
| 624 | (source (origin |
| 625 | (method url-fetch) |
| 626 | ;; The uri has to be chopped up in order to satisfy guix lint. |
| 627 | (uri (string-append "https://download3.ebz.epson.net/dsc/f/03/00/07/16/23/" |
| 628 | "804253d188a31ae6a0f2722648248ef952afedfb/" |
| 629 | "epson-inkjet-printer-escpr-1.6.20-1lsb3.2.tar.gz")) |
| 630 | (sha256 |
| 631 | (base32 |
| 632 | "19800pl7kbbgdzbsy9ijmd7dm3ly4kr2h1dxypqpd075g6n0i770")))) |
| 633 | (build-system gnu-build-system) |
| 634 | (arguments |
| 635 | `(#:configure-flags |
| 636 | `(,(string-append "--prefix=" |
| 637 | (assoc-ref %outputs "out")) |
| 638 | ,(string-append "--with-cupsfilterdir=" |
| 639 | (assoc-ref %outputs "out") "/lib/cups/filter") |
| 640 | ,(string-append "--with-cupsppddir=" |
| 641 | (assoc-ref %outputs "out") "/share/ppd")))) |
| 642 | (inputs `(("cups" ,cups-minimal))) |
| 643 | (synopsis "ESC/P-R printer driver") |
| 644 | (description |
| 645 | "This package provides a filter for the Common UNIX Printing |
| 646 | System (CUPS). It offers high-quality printing with Seiko Epson color ink jet |
| 647 | printers. It can only be used with printers that support the Epson ESC/P-R |
| 648 | language.") |
| 649 | (home-page "http://download.ebz.epson.net/dsc/search/01/search") |
| 650 | (license license:gpl2+))) |