| 1 | ;;; GNU Guix --- Functional package management for GNU |
| 2 | ;;; Copyright © 2015, 2019, 2021 Ricardo Wurmus <rekado@elephly.net> |
| 3 | ;;; Copyright © 2015, 2016, 2017, 2019 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–2021 Tobias Geerinckx-Rice <me@tobias.gr> |
| 9 | ;;; Copyright © 2020 Marius Bakke <mbakke@fastmail.com> |
| 10 | ;;; |
| 11 | ;;; This file is part of GNU Guix. |
| 12 | ;;; |
| 13 | ;;; GNU Guix is free software; you can redistribute it and/or modify it |
| 14 | ;;; under the terms of the GNU General Public License as published by |
| 15 | ;;; the Free Software Foundation; either version 3 of the License, or (at |
| 16 | ;;; your option) any later version. |
| 17 | ;;; |
| 18 | ;;; GNU Guix is distributed in the hope that it will be useful, but |
| 19 | ;;; WITHOUT ANY WARRANTY; without even the implied warranty of |
| 20 | ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 21 | ;;; GNU General Public License for more details. |
| 22 | ;;; |
| 23 | ;;; You should have received a copy of the GNU General Public License |
| 24 | ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. |
| 25 | |
| 26 | (define-module (gnu packages cups) |
| 27 | #:use-module (gnu packages) |
| 28 | #:use-module (gnu packages algebra) |
| 29 | #:use-module (gnu packages autotools) |
| 30 | #:use-module (gnu packages avahi) |
| 31 | #:use-module (gnu packages base) |
| 32 | #:use-module (gnu packages compression) |
| 33 | #:use-module (gnu packages fonts) ; font-dejavu |
| 34 | #:use-module (gnu packages fontutils) |
| 35 | #:use-module (gnu packages ghostscript) |
| 36 | #:use-module (gnu packages glib) |
| 37 | #:use-module (gnu packages groff) |
| 38 | #:use-module (gnu packages image) |
| 39 | #:use-module (gnu packages libusb) |
| 40 | #:use-module (gnu packages pdf) |
| 41 | #:use-module (gnu packages perl) |
| 42 | #:use-module (gnu packages pkg-config) |
| 43 | #:use-module (gnu packages polkit) |
| 44 | #:use-module (gnu packages pretty-print) |
| 45 | #:use-module (gnu packages python) |
| 46 | #:use-module (gnu packages python-xyz) |
| 47 | #:use-module (gnu packages qt) |
| 48 | #:use-module (gnu packages scanner) |
| 49 | #:use-module (gnu packages tls) |
| 50 | #:use-module (guix build-system cmake) |
| 51 | #:use-module (guix build-system gnu) |
| 52 | #:use-module (guix build-system python) |
| 53 | #:use-module (guix download) |
| 54 | #:use-module (guix git-download) |
| 55 | #:use-module ((guix licenses) #:prefix license:) |
| 56 | #:use-module (guix packages) |
| 57 | #:use-module (guix utils) |
| 58 | #:use-module (srfi srfi-1) |
| 59 | #:use-module (ice-9 match)) |
| 60 | |
| 61 | (define-public brlaser |
| 62 | (let ((commit "9d7ddda8383bfc4d205b5e1b49de2b8bcd9137f1") |
| 63 | (revision "1")) |
| 64 | (package |
| 65 | (name "brlaser") |
| 66 | (version (git-version "6" revision commit)) |
| 67 | (source (origin |
| 68 | (method git-fetch) |
| 69 | (uri (git-reference |
| 70 | (url "https://github.com/pdewacht/brlaser") |
| 71 | (commit commit))) |
| 72 | (file-name (git-file-name name version)) |
| 73 | (sha256 |
| 74 | (base32 |
| 75 | "1drh0nk7amn9a8wykki4l9maqa4vy7vwminypfy1712alwj31nd4")))) |
| 76 | (build-system cmake-build-system) |
| 77 | (arguments |
| 78 | `(#:configure-flags |
| 79 | (list (string-append "-DCUPS_DATA_DIR=" |
| 80 | (assoc-ref %outputs "out") |
| 81 | "/share/cups") |
| 82 | (string-append "-DCUPS_SERVER_BIN=" |
| 83 | (assoc-ref %outputs "out") |
| 84 | "/lib/cups")))) |
| 85 | (inputs |
| 86 | `(("ghostscript" ,ghostscript) |
| 87 | ("cups" ,cups) |
| 88 | ("zlib" ,zlib))) |
| 89 | (home-page "https://github.com/pdewacht/brlaser") |
| 90 | (synopsis "Brother laser printer driver") |
| 91 | (description "Brlaser is a CUPS driver for Brother laser printers. This |
| 92 | driver is known to work with these printers: |
| 93 | |
| 94 | @enumerate |
| 95 | @item Brother DCP-1510 series |
| 96 | @item Brother DCP-1600 series |
| 97 | @item Brother DCP-7030 |
| 98 | @item Brother DCP-7040 |
| 99 | @item Brother DCP-7055 |
| 100 | @item Brother DCP-7055W |
| 101 | @item Brother DCP-7060D |
| 102 | @item Brother DCP-7065DN |
| 103 | @item Brother DCP-7080 |
| 104 | @item Brother DCP-L2500D series |
| 105 | @item Brother DCP-L2520D series |
| 106 | @item Brother DCP-L2540DW series |
| 107 | @item Brother HL-1110 series |
| 108 | @item Brother HL-1200 series |
| 109 | @item Brother HL-2030 series |
| 110 | @item Brother HL-2140 series |
| 111 | @item Brother HL-2220 series |
| 112 | @item Brother HL-2270DW series |
| 113 | @item Brother HL-5030 series |
| 114 | @item Brother HL-L2300D series |
| 115 | @item Brother HL-L2320D series |
| 116 | @item Brother HL-L2340D series |
| 117 | @item Brother HL-L2360D series |
| 118 | @item Brother MFC-1910W |
| 119 | @item Brother MFC-7240 |
| 120 | @item Brother MFC-7360N |
| 121 | @item Brother MFC-7365DN |
| 122 | @item Brother MFC-7840W |
| 123 | @item Brother MFC-L2710DW series |
| 124 | @item Lenovo M7605D |
| 125 | @end enumerate") |
| 126 | (license license:gpl2+)))) |
| 127 | |
| 128 | (define-public cups-filters |
| 129 | (package |
| 130 | (name "cups-filters") |
| 131 | (version "1.27.4") |
| 132 | (source(origin |
| 133 | (method url-fetch) |
| 134 | (uri |
| 135 | (string-append "https://openprinting.org/download/cups-filters/" |
| 136 | "cups-filters-" version ".tar.xz")) |
| 137 | (sha256 |
| 138 | (base32 |
| 139 | "110b1xhb5vfpcx0zq9kkas7pj281skx5dpnnr22idx509jfdzj8b")) |
| 140 | (modules '((guix build utils))) |
| 141 | (snippet |
| 142 | ;; install backends, banners and filters to cups-filters output |
| 143 | ;; directory, not the cups server directory |
| 144 | '(begin |
| 145 | (substitute* "Makefile.in" |
| 146 | (("CUPS_DATADIR = @CUPS_DATADIR@") |
| 147 | "CUPS_DATADIR = $(PREFIX)/share/cups") |
| 148 | (("pkgcupsserverrootdir = \\$\\(CUPS_SERVERROOT\\)") |
| 149 | "pkgcupsserverrootdir = $(PREFIX)") |
| 150 | ;; Choose standard directories notably so that binaries are |
| 151 | ;; stripped. |
| 152 | (("pkgbackenddir = \\$\\(CUPS_SERVERBIN\\)/backend") |
| 153 | "pkgbackenddir = $(PREFIX)/lib/cups/backend") |
| 154 | (("pkgfilterdir = \\$\\(CUPS_SERVERBIN\\)/filter") |
| 155 | "pkgfilterdir = $(PREFIX)/lib/cups/filter")) |
| 156 | ;; Find bannertopdf data such as the print test page in our |
| 157 | ;; output directory, not CUPS's prefix. |
| 158 | (substitute* "configure" |
| 159 | (("\\{CUPS_DATADIR\\}/data") |
| 160 | "{prefix}/share/cups/data")) |
| 161 | #t)))) |
| 162 | (build-system gnu-build-system) |
| 163 | (arguments |
| 164 | `(#:make-flags (list (string-append "PREFIX=" %output)) |
| 165 | #:configure-flags |
| 166 | `("--disable-driverless" ; TODO: enable this |
| 167 | "--disable-mutool" ; depends on yet another PDF library (mupdf) |
| 168 | |
| 169 | ;; Look for the "domain socket of CUPS" in /var/run/cups. |
| 170 | "--localstatedir=/var" |
| 171 | |
| 172 | ;; Free software for the win. |
| 173 | "--with-acroread-path=evince" |
| 174 | |
| 175 | ,(string-append "--with-test-font-path=" |
| 176 | (assoc-ref %build-inputs "font-dejavu") |
| 177 | "/share/fonts/truetype/DejaVuSans.ttf") |
| 178 | ,(string-append "--with-gs-path=" |
| 179 | (assoc-ref %build-inputs "ghostscript") |
| 180 | "/bin/gsc") |
| 181 | ,(string-append "--with-shell=" |
| 182 | (assoc-ref %build-inputs "bash") |
| 183 | "/bin/bash") |
| 184 | ,(string-append "--with-rcdir=" |
| 185 | (assoc-ref %outputs "out") "/etc/rc.d")) |
| 186 | |
| 187 | #:phases (modify-phases %standard-phases |
| 188 | (add-after 'unpack 'patch-foomatic-hardcoded-file-names |
| 189 | (lambda* (#:key inputs outputs #:allow-other-keys) |
| 190 | ;; Foomatic has hardcoded file names we need to fix. |
| 191 | (let ((out (assoc-ref outputs "out")) |
| 192 | (gs (assoc-ref inputs "ghostscript"))) |
| 193 | (substitute* "filter/foomatic-rip/foomaticrip.c" |
| 194 | (("/usr/local/lib/cups/filter") |
| 195 | (string-append out "/lib/cups/filter"))) |
| 196 | #t))) |
| 197 | (add-after 'install 'wrap-filters |
| 198 | (lambda* (#:key inputs outputs #:allow-other-keys) |
| 199 | ;; Some filters expect to find 'gs' in $PATH. We cannot |
| 200 | ;; just hard-code its absolute file name in the source |
| 201 | ;; because foomatic-rip, for example, has tests like |
| 202 | ;; 'startswith(cmd, "gs")'. |
| 203 | (let ((out (assoc-ref outputs "out")) |
| 204 | (ghostscript (assoc-ref inputs "ghostscript"))) |
| 205 | (for-each (lambda (file) |
| 206 | (wrap-program file |
| 207 | `("PATH" ":" prefix |
| 208 | (,(string-append ghostscript |
| 209 | "/bin"))))) |
| 210 | (find-files (string-append |
| 211 | out "/lib/cups/filter"))) |
| 212 | #t)))))) |
| 213 | (native-inputs |
| 214 | `(("glib" ,glib "bin") ; for gdbus-codegen |
| 215 | ("pkg-config" ,pkg-config))) |
| 216 | (inputs |
| 217 | `(("avahi" ,avahi) |
| 218 | ("fontconfig" ,fontconfig) |
| 219 | ("freetype" ,freetype) |
| 220 | ("font-dejavu" ,font-dejavu) ; also needed by test suite |
| 221 | ("ghostscript" ,ghostscript/cups) |
| 222 | ("ijs" ,ijs) |
| 223 | ("dbus" ,dbus) |
| 224 | ("lcms" ,lcms) |
| 225 | ("libjpeg" ,libjpeg-turbo) |
| 226 | ("libpng" ,libpng) |
| 227 | ("libtiff" ,libtiff) |
| 228 | ("glib" ,glib) |
| 229 | ("qpdf" ,qpdf) |
| 230 | ("poppler" ,poppler) |
| 231 | ("cups-minimal" ,cups-minimal))) |
| 232 | (home-page "https://wiki.linuxfoundation.org/openprinting/cups-filters") |
| 233 | (synopsis "OpenPrinting CUPS filters and backends") |
| 234 | (description |
| 235 | "Contains backends, filters, and other software that was once part of the |
| 236 | core CUPS distribution but is no longer maintained by Apple Inc. In addition |
| 237 | it contains additional filters developed independently of Apple, especially |
| 238 | filters for the PDF-centric printing workflow introduced by OpenPrinting.") |
| 239 | ;; Different filters and backends have different licenses; see COPYING for |
| 240 | ;; details |
| 241 | (license (list license:gpl2 |
| 242 | license:gpl2+ |
| 243 | license:gpl3 |
| 244 | license:gpl3+ |
| 245 | license:lgpl2.0+ |
| 246 | license:expat)))) |
| 247 | |
| 248 | ;; CUPS on non-MacOS systems requires cups-filters. Since cups-filters also |
| 249 | ;; depends on CUPS libraries and binaries, cups-minimal has been added to |
| 250 | ;; satisfy this dependency. |
| 251 | (define-public cups-minimal |
| 252 | (package |
| 253 | (name "cups-minimal") |
| 254 | (version "2.3.3") |
| 255 | (source |
| 256 | (origin |
| 257 | (method url-fetch) |
| 258 | (uri (string-append "https://github.com/apple/cups/releases/download/v" |
| 259 | version "/cups-" version "-source.tar.gz")) |
| 260 | (sha256 |
| 261 | (base32 |
| 262 | "1vpk0b2vq830f8fvf9z8qjsm5k141i7pi8djbinpnr78pi4dj7r6")))) |
| 263 | (build-system gnu-build-system) |
| 264 | (arguments |
| 265 | `(#:configure-flags |
| 266 | '("--disable-launchd" |
| 267 | "--disable-systemd" |
| 268 | "--disable-avahi" |
| 269 | "--disable-dnssd") |
| 270 | ;; Seven tests fail, mostly because of files that are provided by the |
| 271 | ;; cups-filters package. |
| 272 | #:tests? #f |
| 273 | #:phases |
| 274 | (modify-phases %standard-phases |
| 275 | (add-before 'configure 'patch-makedefs |
| 276 | (lambda _ |
| 277 | (substitute* "Makedefs.in" |
| 278 | (("INITDIR.*=.*@INITDIR@") "INITDIR = @prefix@/@INITDIR@") |
| 279 | (("/bin/sh") (which "sh"))) |
| 280 | #t)) |
| 281 | ;; Make the compressed manpages writable so that the |
| 282 | ;; reset-gzip-timestamps phase does not error out. |
| 283 | (add-before 'reset-gzip-timestamps 'make-manpages-writable |
| 284 | (lambda* (#:key outputs #:allow-other-keys) |
| 285 | (let* ((out (assoc-ref outputs "out")) |
| 286 | (man (string-append out "/share/man"))) |
| 287 | (for-each (lambda (file) (chmod file #o644)) |
| 288 | (find-files man "\\.gz")) |
| 289 | #t))) |
| 290 | (add-before 'build 'patch-tests |
| 291 | (lambda _ |
| 292 | (substitute* "tools/ippeveprinter.c" |
| 293 | (("# else /\\* HAVE_AVAHI \\*/") |
| 294 | "#elif defined(HAVE_AVAHI)")) |
| 295 | #t))))) |
| 296 | (native-inputs |
| 297 | `(("pkg-config" ,pkg-config))) |
| 298 | (inputs |
| 299 | `(("zlib" ,zlib) |
| 300 | ("gnutls" ,gnutls))) |
| 301 | (home-page "https://www.cups.org") |
| 302 | (synopsis "The Common Unix Printing System") |
| 303 | (description |
| 304 | "CUPS is a printing system that uses the Internet Printing Protocol |
| 305 | (@dfn{IPP}). It provides System V and BSD command-line interfaces, as well |
| 306 | as a Web interface and a C programming interface to manage printers and print |
| 307 | jobs. It supports printing to both local (parallel, serial, USB) and |
| 308 | networked printers, and printers can be shared from one computer to another. |
| 309 | Internally, CUPS uses PostScript Printer Description (@dfn{PPD}) files to |
| 310 | describe printer capabilities and features, and a wide variety of generic and |
| 311 | device-specific programs to convert and print many types of files.") |
| 312 | ;; CUPS is Apache 2.0 with exceptions, see the NOTICE file. |
| 313 | (license license:asl2.0))) |
| 314 | |
| 315 | (define-public cups |
| 316 | (package/inherit cups-minimal |
| 317 | (name "cups") |
| 318 | (arguments |
| 319 | `(;; Three tests fail: |
| 320 | ;; * two tests in ipp-1.1.test related to "RFC 2911 section 3.2.6: |
| 321 | ;; Get-Jobs Operation" |
| 322 | ;; * test of number of error/warning messages, probably related to a |
| 323 | ;; missing font. |
| 324 | #:tests? #f |
| 325 | #:configure-flags |
| 326 | '("--disable-launchd" |
| 327 | "--disable-systemd") |
| 328 | #:phases |
| 329 | (modify-phases %standard-phases |
| 330 | (add-before 'configure 'patch-makedefs |
| 331 | (lambda _ |
| 332 | (substitute* "Makedefs.in" |
| 333 | (("INITDIR.*=.*@INITDIR@") "INITDIR = @prefix@/@INITDIR@") |
| 334 | (("/bin/sh") (which "sh"))) |
| 335 | #t)) |
| 336 | (add-before 'check 'patch-tests |
| 337 | (lambda _ |
| 338 | (let ((filters (assoc-ref %build-inputs "cups-filters")) |
| 339 | (catpath (string-append |
| 340 | (assoc-ref %build-inputs "coreutils") "/bin/")) |
| 341 | (testdir (string-append (getcwd) "/tmp/"))) |
| 342 | (mkdir testdir) |
| 343 | (substitute* "test/run-stp-tests.sh" |
| 344 | ((" *BASE=/tmp/") (string-append "BASE=" testdir)) |
| 345 | |
| 346 | ;; allow installation of filters from output dir and from |
| 347 | ;; cups-filters |
| 348 | (("for dir in /usr/libexec/cups/filter /usr/lib/cups/filter") |
| 349 | (string-append |
| 350 | "for dir in " |
| 351 | (assoc-ref %outputs "out") "/lib/cups/filter " |
| 352 | filters "/lib/cups/filter")) |
| 353 | |
| 354 | ;; check for charsets in cups-filters output |
| 355 | (("/usr/share/cups/charsets") |
| 356 | (string-append filters "/share/cups/charsets")) |
| 357 | |
| 358 | ;; install additional required filters |
| 359 | (("instfilter texttopdf texttopdf pdf") |
| 360 | (string-append |
| 361 | "instfilter texttopdf texttopdf pdf;" |
| 362 | "instfilter imagetoraster imagetoraster raster;" |
| 363 | "instfilter gstoraster gstoraster raster;" |
| 364 | "instfilter urftopdf urftopdf pdf;" |
| 365 | "instfilter rastertopdf rastertopdf pdf;" |
| 366 | "instfilter pstopdf pstopdf pdf")) |
| 367 | |
| 368 | ;; specify location of lpstat binary |
| 369 | (("description=\"`lpstat -l") |
| 370 | "description=\"`../systemv/lpstat -l") |
| 371 | |
| 372 | ;; patch shebangs of embedded scripts |
| 373 | (("#!/bin/sh") (string-append "#!" (which "sh"))) |
| 374 | |
| 375 | ;; also link mime definitions from cups-filters |
| 376 | ;; to enable the additional filters for the test suite |
| 377 | (("ln -s \\$root/conf/mime\\.types") |
| 378 | (string-append |
| 379 | "ln -s " filters |
| 380 | "/share/cups/mime/cupsfilters.types $BASE/share/mime; " |
| 381 | "ln -s $root/conf/mime.types")) |
| 382 | (("ln -s \\$root/conf/mime\\.convs") |
| 383 | (string-append |
| 384 | "ln -s " filters |
| 385 | "/share/cups/mime/cupsfilters.convs $BASE/share/mime; " |
| 386 | "ln -s $root/conf/mime.convs"))) |
| 387 | |
| 388 | ;; fix search path for "cat" |
| 389 | (substitute* "cups/testfile.c" |
| 390 | (("cupsFileFind\\(\"cat\", \"/bin\"") |
| 391 | (string-append "cupsFileFind(\"cat\", \"" catpath "\"")) |
| 392 | (("cupsFileFind\\(\"cat\", \"/bin:/usr/bin\"") |
| 393 | (string-append "cupsFileFind(\"cat\", \"" catpath "\""))) |
| 394 | #t))) |
| 395 | ;; Make the compressed manpages writable so that the |
| 396 | ;; reset-gzip-timestamps phase does not error out. |
| 397 | (add-before 'reset-gzip-timestamps 'make-manpages-writable |
| 398 | (lambda* (#:key outputs #:allow-other-keys) |
| 399 | (let* ((out (assoc-ref outputs "out")) |
| 400 | (man (string-append out "/share/man"))) |
| 401 | (for-each (lambda (file) (chmod file #o644)) |
| 402 | (find-files man "\\.gz")) |
| 403 | #t))) |
| 404 | (add-after 'install 'install-cups-filters-symlinks |
| 405 | (lambda* (#:key inputs outputs #:allow-other-keys) |
| 406 | (let ((out (assoc-ref outputs "out")) |
| 407 | (cups-filters (assoc-ref inputs "cups-filters"))) |
| 408 | ;; charsets |
| 409 | (symlink |
| 410 | (string-append cups-filters "/share/cups/charsets") |
| 411 | (string-append out "/share/charsets")) |
| 412 | |
| 413 | ;; mime types, driver file, ppds |
| 414 | (for-each |
| 415 | (lambda (f) |
| 416 | (symlink (string-append cups-filters f) |
| 417 | (string-append out f))) |
| 418 | '("/share/cups/mime/cupsfilters.types" |
| 419 | "/share/cups/mime/cupsfilters.convs" |
| 420 | "/share/cups/drv/cupsfilters.drv" |
| 421 | "/share/ppd")) |
| 422 | |
| 423 | ;; filters |
| 424 | (for-each |
| 425 | (lambda (f) |
| 426 | (symlink f |
| 427 | (string-append out "/lib/cups/filter" (basename f)))) |
| 428 | (find-files (string-append cups-filters "/lib/cups/filter"))) |
| 429 | |
| 430 | ;; backends |
| 431 | (for-each |
| 432 | (lambda (f) |
| 433 | (symlink (string-append cups-filters f) |
| 434 | (string-append out "/lib/cups/backend/" |
| 435 | (basename f)))) |
| 436 | '("/lib/cups/backend/parallel" |
| 437 | "/lib/cups/backend/serial")) |
| 438 | |
| 439 | ;; banners |
| 440 | (let ((banners "/share/cups/banners")) |
| 441 | (delete-file-recursively (string-append out banners)) |
| 442 | (symlink (string-append cups-filters banners) |
| 443 | (string-append out banners))) |
| 444 | |
| 445 | ;; assorted data |
| 446 | (let ((data "/share/cups/data")) |
| 447 | (delete-file-recursively (string-append out data)) |
| 448 | (symlink (string-append cups-filters data) |
| 449 | (string-append out data))) |
| 450 | |
| 451 | #t)))))) |
| 452 | (inputs |
| 453 | `(("avahi" ,avahi) |
| 454 | ("gnutls" ,gnutls) |
| 455 | ("cups-filters" ,cups-filters) |
| 456 | ("zlib" ,zlib))))) |
| 457 | |
| 458 | (define-public cups-pk-helper |
| 459 | (package |
| 460 | (name "cups-pk-helper") |
| 461 | (version "0.2.6") |
| 462 | (source (origin |
| 463 | (method url-fetch) |
| 464 | (uri (string-append "https://freedesktop.org/software/" |
| 465 | name "/releases/" name "-" version ".tar.xz")) |
| 466 | (sha256 |
| 467 | (base32 |
| 468 | "0a52jw6rm7lr5nbyksiia0rn7sasyb5cjqcb95z1wxm2yprgi6lm")))) |
| 469 | (build-system gnu-build-system) |
| 470 | (native-inputs |
| 471 | `(("intltool" ,intltool) |
| 472 | ("pkg-config" ,pkg-config) |
| 473 | ("glib" ,glib) |
| 474 | ("polkit" ,polkit) |
| 475 | ("cups" ,cups))) |
| 476 | (home-page "https://www.freedesktop.org/wiki/Software/cups-pk-helper/") |
| 477 | (synopsis "PolicyKit helper to configure CUPS with fine-grained privileges") |
| 478 | (description |
| 479 | "This package provides the org.opensuse.CupsPkHelper.Mechanism DBus |
| 480 | system service which uses @file{cups-pk-helper-mechanism}. This package |
| 481 | should only be used as part of the Guix cups-pk-helper service.") |
| 482 | (license license:gpl2+))) |
| 483 | |
| 484 | (define-public hplip |
| 485 | (package |
| 486 | (name "hplip") |
| 487 | (version "3.21.2") |
| 488 | (source (origin |
| 489 | (method url-fetch) |
| 490 | (uri (string-append "mirror://sourceforge/hplip/hplip/" version |
| 491 | "/hplip-" version ".tar.gz")) |
| 492 | (sha256 |
| 493 | (base32 |
| 494 | "0hbwx9d4c8177vi0gavz9pxi7rc97jciacndp90ms8327shj2121")) |
| 495 | (modules '((guix build utils))) |
| 496 | (patches (search-patches "hplip-remove-imageprocessor.patch")) |
| 497 | (snippet |
| 498 | '(begin |
| 499 | ;; Delete non-free blobs: .so files, pre-compiled |
| 500 | ;; 'locatedriver' executable, etc. |
| 501 | (for-each delete-file |
| 502 | (find-files "." |
| 503 | (lambda (file stat) |
| 504 | (elf-file? file)))) |
| 505 | (delete-file "prnt/hpcups/ImageProcessor.h") |
| 506 | |
| 507 | ;; Install binaries under libexec/hplip instead of |
| 508 | ;; share/hplip; that'll at least ensure they get stripped. |
| 509 | ;; It's not even clear that they're of any use though... |
| 510 | (substitute* "Makefile.in" |
| 511 | (("^dat2drvdir =.*") |
| 512 | "dat2drvdir = $(pkglibexecdir)\n") |
| 513 | (("^locatedriverdir =.*") |
| 514 | "locatedriverdir = $(pkglibexecdir)\n")) |
| 515 | #t)))) |
| 516 | (build-system gnu-build-system) |
| 517 | (outputs (list "out" "ppd")) |
| 518 | (home-page "https://developers.hp.com/hp-linux-imaging-and-printing") |
| 519 | (synopsis "HP printer drivers") |
| 520 | (description |
| 521 | "Hewlett-Packard printer drivers and PostScript Printer Descriptions |
| 522 | (@dfn{PPD}s).") |
| 523 | |
| 524 | ;; The 'COPYING' file lists directories where each of these 3 licenses |
| 525 | ;; applies. |
| 526 | (license (list license:gpl2+ license:bsd-3 license:expat)) |
| 527 | |
| 528 | ;; TODO install apparmor profile files eventually. |
| 529 | (arguments |
| 530 | `(#:configure-flags |
| 531 | `("--disable-network-build" |
| 532 | ,(string-append "--prefix=" (assoc-ref %outputs "out")) |
| 533 | ,(string-append "--sysconfdir=" (assoc-ref %outputs "out") "/etc") |
| 534 | ,(string-append "LDFLAGS=-Wl,-rpath=" |
| 535 | (assoc-ref %outputs "out") "/lib") |
| 536 | ;; Disable until mime.types merging works (FIXME). |
| 537 | "--disable-fax-build" |
| 538 | "--enable-new-hpcups" |
| 539 | ;; TODO add foomatic drv install eventually. |
| 540 | ;; TODO --enable-policykit eventually. |
| 541 | ,(string-append "--with-cupsfilterdir=" |
| 542 | (assoc-ref %outputs "out") "/lib/cups/filter") |
| 543 | ,(string-append "--with-cupsbackenddir=" |
| 544 | (assoc-ref %outputs "out") "/lib/cups/backend") |
| 545 | ,(string-append "--with-hpppddir=" |
| 546 | (assoc-ref %outputs "ppd") "/share/ppd/HP") |
| 547 | ,(string-append "--with-icondir=" |
| 548 | (assoc-ref %outputs "out") "/share/applications") |
| 549 | ,(string-append "--with-systraydir=" |
| 550 | (assoc-ref %outputs "out") "/etc/xdg") |
| 551 | "--enable-qt5" "--disable-qt4") |
| 552 | |
| 553 | #:imported-modules ((guix build python-build-system) |
| 554 | ,@%gnu-build-system-modules) |
| 555 | #:modules ((guix build gnu-build-system) |
| 556 | (guix build utils) |
| 557 | ((guix build python-build-system) #:prefix python:)) |
| 558 | |
| 559 | #:phases |
| 560 | (modify-phases %standard-phases |
| 561 | (add-after 'unpack 'fix-hard-coded-file-names |
| 562 | (lambda* (#:key inputs outputs #:allow-other-keys) |
| 563 | (let ((out (assoc-ref outputs "out")) |
| 564 | ;; FIXME: use merged ppds (I think actually only |
| 565 | ;; drvs need to be merged). |
| 566 | (cupsdir (assoc-ref inputs "cups-minimal"))) |
| 567 | (substitute* "base/g.py" |
| 568 | (("'/usr/share;[^']*'") |
| 569 | (string-append "'" cupsdir "/share'")) |
| 570 | (("'/etc/hp/hplip.conf'") |
| 571 | (string-append "'" out |
| 572 | "/etc/hp/hplip.conf" "'"))) |
| 573 | |
| 574 | (substitute* "Makefile.in" |
| 575 | (("[[:blank:]]check-plugin\\.py[[:blank:]]") " ") |
| 576 | ;; FIXME Use beginning-of-word in regexp. |
| 577 | (("[[:blank:]]plugin\\.py[[:blank:]]") " ") |
| 578 | (("/usr/include/libusb-1.0") |
| 579 | (string-append (assoc-ref inputs "libusb") |
| 580 | "/include/libusb-1.0")) |
| 581 | (("hplip_statedir =.*$") |
| 582 | ;; Don't bail out while trying to create |
| 583 | ;; /var/lib/hplip. We can safely change its value |
| 584 | ;; here because it's hard-coded in the code anyway. |
| 585 | "hplip_statedir = $(prefix)\n") |
| 586 | (("hplip_confdir = /etc/hp") |
| 587 | ;; This is only used for installing the default config. |
| 588 | (string-append "hplip_confdir = " out |
| 589 | "/etc/hp")) |
| 590 | (("halpredir = /usr/share/hal/fdi/preprobe/10osvendor") |
| 591 | ;; We don't use hal. |
| 592 | (string-append "halpredir = " out |
| 593 | "/share/hal/fdi/preprobe/10osvendor")) |
| 594 | (("rulesdir = /etc/udev/rules.d") |
| 595 | ;; udev rules will be merged by base service. |
| 596 | (string-append "rulesdir = " out |
| 597 | "/lib/udev/rules.d")) |
| 598 | (("rulessystemdir = /usr/lib/systemd/system") |
| 599 | ;; We don't use systemd. |
| 600 | (string-append "rulessystemdir = " out |
| 601 | "/lib/systemd/system")) |
| 602 | (("/etc/sane.d") |
| 603 | (string-append out "/etc/sane.d"))) |
| 604 | #t))) |
| 605 | (add-before 'configure 'fix-build-with-python-3.8 |
| 606 | (lambda* (#:key inputs #:allow-other-keys) |
| 607 | (let ((python (assoc-ref inputs "python"))) |
| 608 | ;; XXX: The configure script looks for Python headers in the |
| 609 | ;; wrong places as of version 3.20.3. Help it by adding the |
| 610 | ;; include directory on C_INCLUDE_PATH. |
| 611 | (when python |
| 612 | (setenv "C_INCLUDE_PATH" |
| 613 | (string-append python "/include/python" |
| 614 | (python:python-version python) |
| 615 | ":" (getenv "C_INCLUDE_PATH")))) |
| 616 | #t))) |
| 617 | (add-after 'install 'install-models-dat |
| 618 | (lambda* (#:key outputs #:allow-other-keys) |
| 619 | (let* ((out (assoc-ref outputs "out")) |
| 620 | (models-dir (string-append out |
| 621 | "/share/hplip/data/models"))) |
| 622 | (install-file "data/models/models.dat" models-dir)) |
| 623 | #t)) |
| 624 | (add-after 'install 'wrap-binaries |
| 625 | ;; Scripts in /bin are all symlinks to .py files in /share/hplip. |
| 626 | ;; Symlinks are immune to the Python build system's 'WRAP phase, |
| 627 | ;; and the .py files can't be wrapped because they are reused as |
| 628 | ;; modules. Replacing the symlinks in /bin with copies and |
| 629 | ;; wrapping them also doesn't work (“ModuleNotFoundError: |
| 630 | ;; No module named 'base'”). Behold: a custom WRAP-PROGRAM. |
| 631 | (lambda* (#:key inputs outputs #:allow-other-keys) |
| 632 | (let* ((out (assoc-ref outputs "out")) |
| 633 | (bin (string-append out "/bin")) |
| 634 | (python (assoc-ref inputs "python"))) |
| 635 | (with-directory-excursion bin |
| 636 | (for-each (lambda (file) |
| 637 | (let ((target (readlink file))) |
| 638 | (delete-file file) |
| 639 | (with-output-to-file file |
| 640 | (lambda _ |
| 641 | (format #t |
| 642 | "#!~a~@ |
| 643 | export PYTHONPATH=\"~a:~a\"~@ |
| 644 | exec -a \"$0\" \"~a/~a\" \"$@\"~%" |
| 645 | (which "bash") |
| 646 | (string-append |
| 647 | out "/lib/python" |
| 648 | (python:python-version python) |
| 649 | "/site-packages") |
| 650 | (getenv "PYTHONPATH") |
| 651 | bin target))) |
| 652 | (chmod file #o755))) |
| 653 | (find-files "." (lambda (file stat) |
| 654 | (eq? 'symlink (stat:type stat))))) |
| 655 | #t))))))) |
| 656 | |
| 657 | ;; Note that the error messages printed by the tools in the case of |
| 658 | ;; missing dependencies are often downright misleading. |
| 659 | ;; TODO: hp-toolbox still fails to start with: |
| 660 | ;; from dbus.mainloop.pyqt5 import DBusQtMainLoop |
| 661 | ;; ModuleNotFoundError: No module named 'dbus.mainloop.pyqt5' |
| 662 | (inputs |
| 663 | `(("cups-minimal" ,cups-minimal) |
| 664 | ("dbus" ,dbus) |
| 665 | ("libjpeg" ,libjpeg-turbo) |
| 666 | ("libusb" ,libusb) |
| 667 | ("python" ,python) |
| 668 | ("python-dbus" ,python-dbus) |
| 669 | ("python-pygobject" ,python-pygobject) |
| 670 | ("python-pyqt" ,python-pyqt) |
| 671 | ("python-wrapper" ,python-wrapper) |
| 672 | ("sane-backends" ,sane-backends-minimal) |
| 673 | ("zlib" ,zlib))) |
| 674 | (native-inputs |
| 675 | `(("perl" ,perl) |
| 676 | ("pkg-config" ,pkg-config))))) |
| 677 | |
| 678 | (define-public hplip-minimal |
| 679 | (package/inherit hplip |
| 680 | (name "hplip-minimal") |
| 681 | (arguments |
| 682 | (substitute-keyword-arguments (package-arguments hplip) |
| 683 | ((#:configure-flags cf) |
| 684 | ;; Produce a "light build", meaning that only the printer (CUPS) and |
| 685 | ;; scanner (SANE) support gets built, without all the 'hp-*' |
| 686 | ;; command-line tools. |
| 687 | `(cons "--enable-lite-build" |
| 688 | (delete "--enable-qt5" ,cf))) |
| 689 | ((#:phases phases) |
| 690 | ;; The 'wrap-binaries' is not needed here since the 'hp-*' programs |
| 691 | ;; are not installed. |
| 692 | `(alist-delete 'wrap-binaries ,phases)))) |
| 693 | (inputs (remove (match-lambda |
| 694 | ((label . _) |
| 695 | (string-prefix? "python" label))) |
| 696 | (package-inputs hplip))) |
| 697 | (synopsis "GUI-less version of hplip"))) |
| 698 | |
| 699 | (define-public foomatic-filters |
| 700 | (package |
| 701 | (name "foomatic-filters") |
| 702 | (version "4.0.17") |
| 703 | (source (origin |
| 704 | (method url-fetch) |
| 705 | (uri (string-append |
| 706 | "http://www.openprinting.org/download/foomatic/" |
| 707 | "foomatic-filters-" version ".tar.gz")) |
| 708 | (sha256 |
| 709 | (base32 |
| 710 | "1qrkgbm5jay2r7sh9qbyf0aiyrsl1mdc844hxf7fhw95a0zfbqm2")) |
| 711 | (patches |
| 712 | (search-patches "foomatic-filters-CVE-2015-8327.patch" |
| 713 | "foomatic-filters-CVE-2015-8560.patch")))) |
| 714 | (build-system gnu-build-system) |
| 715 | (home-page |
| 716 | "https://wiki.linuxfoundation.org/openprinting/database/foomatic") |
| 717 | (native-inputs |
| 718 | `(("perl" ,perl) |
| 719 | ("pkg-config" ,pkg-config))) |
| 720 | (inputs |
| 721 | `(("dbus" ,dbus) |
| 722 | ("a2ps" ,a2ps))) |
| 723 | (arguments |
| 724 | '( ;; Specify the installation directories. |
| 725 | #:configure-flags (list (string-append "ac_cv_path_CUPS_BACKENDS=" |
| 726 | (assoc-ref %outputs "out") |
| 727 | "/lib/cups/backend") |
| 728 | (string-append "ac_cv_path_CUPS_FILTERS=" |
| 729 | (assoc-ref %outputs "out") |
| 730 | "/lib/cups/filter") |
| 731 | (string-append "ac_cv_path_PPR_INTERFACES=" |
| 732 | (assoc-ref %outputs "out") |
| 733 | "/lib/ppr/interfaces") |
| 734 | (string-append "ac_cv_path_PPR_LIB=" |
| 735 | (assoc-ref %outputs "out") |
| 736 | "/lib/ppr/lib") |
| 737 | |
| 738 | ;; For some reason these are misdiagnosed. |
| 739 | "ac_cv_func_malloc_0_nonnull=yes" |
| 740 | "ac_cv_func_realloc_0_nonnull=yes") |
| 741 | #:test-target "tests")) |
| 742 | (synopsis "Convert PostScript to the printer's native format") |
| 743 | (description |
| 744 | "This package contains filter scripts used by the printer spoolers to |
| 745 | convert the incoming PostScript data into the printer's native format using a |
| 746 | printer/driver specific, but spooler-independent PPD file.") |
| 747 | (license license:gpl2+))) |
| 748 | |
| 749 | (define-public foo2zjs |
| 750 | (package |
| 751 | (name "foo2zjs") |
| 752 | (version "20200610.1") |
| 753 | (source |
| 754 | (origin |
| 755 | (method url-fetch) |
| 756 | ;; The upstream tarball is unversioned: use a stable snapshot. |
| 757 | (uri (string-append "https://web.archive.org/web/20210224094943if_/" |
| 758 | "http://foo2zjs.rkkda.com/foo2zjs.tar.gz")) |
| 759 | (sha256 |
| 760 | (base32 "03ncif50n7ck7drggqxbc7w0kgzdb90ha0dbvqk98ky8lw3k76xd")))) |
| 761 | (build-system gnu-build-system) |
| 762 | (arguments |
| 763 | '(#:phases (modify-phases %standard-phases |
| 764 | (replace 'configure |
| 765 | (lambda* (#:key outputs #:allow-other-keys) |
| 766 | (substitute* (find-files "." "^Makefile$") |
| 767 | ;; Set the installation directory. |
| 768 | (("^PREFIX[[:blank:]]*=.*$") |
| 769 | (string-append "PREFIX = " |
| 770 | (assoc-ref outputs "out") |
| 771 | "\n")) |
| 772 | (("^UDEVBIN[[:blank:]]*=.*$") |
| 773 | "UDEVBIN = $(PREFIX)/bin\n") |
| 774 | ;; Don't try to chown/chgrp the installed files. |
| 775 | (("-oroot") |
| 776 | "") |
| 777 | (("-glp") |
| 778 | "") |
| 779 | ;; Placate the dependency checks. |
| 780 | (("/usr/include/stdio.h") |
| 781 | "/etc/passwd") |
| 782 | (("/usr/") |
| 783 | "$(PREFIX)/") |
| 784 | ;; Ensure fixed timestamps in man pages. |
| 785 | (("^MODTIME[[:blank:]]*=.*$") |
| 786 | "MODTIME = echo Thu Jan 01 01:00:00 1970\n")) |
| 787 | #t)) |
| 788 | (add-before 'install 'make-install-dirs |
| 789 | (lambda* (#:key outputs #:allow-other-keys) |
| 790 | ;; Make missing install dirs |
| 791 | (let ((out (assoc-ref outputs "out")) |
| 792 | (dirs '("/share/cups/model" |
| 793 | "/share/foomatic/db/source/opt" |
| 794 | "/share/foomatic/db/source/printer" |
| 795 | "/share/foomatic/db/source/driver" |
| 796 | "/lib/cups/filter"))) |
| 797 | (for-each (lambda (dir) |
| 798 | (mkdir-p (string-append out dir))) |
| 799 | dirs)))) |
| 800 | (add-after 'install 'wrap-wrappers |
| 801 | (lambda* (#:key inputs outputs #:allow-other-keys) |
| 802 | (let ((out (assoc-ref outputs "out")) |
| 803 | (ghostscript (assoc-ref inputs "ghostscript")) |
| 804 | (coreutils (assoc-ref inputs "coreutils")) |
| 805 | (sed (assoc-ref inputs "sed"))) |
| 806 | (for-each (lambda (file) |
| 807 | (wrap-program file |
| 808 | `("PATH" ":" prefix |
| 809 | (,(string-append ghostscript "/bin:" |
| 810 | coreutils "/bin:" |
| 811 | sed "/bin"))))) |
| 812 | (find-files (string-append |
| 813 | out "/bin") "wrapper$"))))) |
| 814 | (add-after 'install 'install-cups-filters-symlinks |
| 815 | (lambda* (#:key inputs outputs #:allow-other-keys) |
| 816 | (let ((out (assoc-ref outputs "out"))) |
| 817 | (for-each |
| 818 | (lambda (file) |
| 819 | (symlink file |
| 820 | (string-append out "/lib/cups/filter/" |
| 821 | (basename file)))) |
| 822 | (find-files (string-append out "/bin")))))) |
| 823 | (add-after 'install 'remove-pdf |
| 824 | (lambda* (#:key outputs #:allow-other-keys) |
| 825 | ;; Remove 'manual.pdf' which is (1) useless (it's a |
| 826 | ;; concatenation of man pages), and (2) not |
| 827 | ;; bit-reproducible due to <https://bugs.gnu.org/27593>. |
| 828 | (let ((out (assoc-ref outputs "out"))) |
| 829 | (for-each delete-file |
| 830 | (find-files out "^manual\\.pdf$")) |
| 831 | #t)))) |
| 832 | #:parallel-build? #f ;broken makefile |
| 833 | #:tests? #f ;no tests |
| 834 | #:make-flags '("CC=gcc"))) |
| 835 | (inputs |
| 836 | `(("coreutils" ,coreutils) |
| 837 | ("sed" ,sed) |
| 838 | ("ghostscript" ,ghostscript) |
| 839 | ("foomatic-filters" ,foomatic-filters))) ;for 'foomatic-rip' |
| 840 | (native-inputs |
| 841 | `(("bc" ,bc) |
| 842 | ("groff" ,groff))) |
| 843 | (home-page "http://foo2zjs.rkkda.com/") |
| 844 | (synopsis "Printer driver for ZjStream-based printers") |
| 845 | (description |
| 846 | "foo2zjs is a printer driver for printers that use the Zenographics |
| 847 | ZjStream wire protocol for their print data, often erroneously referred to as |
| 848 | winprinters or GDI printers. |
| 849 | |
| 850 | It supports Minolta/QMS@tie{}Magicolor, Minolta@tie{}Color@tie{}PageWorks/Pro, |
| 851 | HP@tie{}LaserJet, and possibly other printers. See @file{README} for details.") |
| 852 | (license (list license:expat ; icc2ps/*.[ch] |
| 853 | license:gpl2+)))) ; everything else |
| 854 | |
| 855 | (define-public epson-inkjet-printer-escpr |
| 856 | (package |
| 857 | (name "epson-inkjet-printer-escpr") |
| 858 | (version "1.7.9") |
| 859 | ;; XXX: This currently works. But it will break as soon as a newer |
| 860 | ;; version is available since the URLs for older versions are not |
| 861 | ;; preserved. An alternative source will be added as soon as |
| 862 | ;; available. |
| 863 | (source |
| 864 | (origin |
| 865 | (method url-fetch) |
| 866 | (uri (string-append "https://download3.ebz.epson.net/dsc/f/03/00/12/50/95/" |
| 867 | "322b8d6b915ab85add33d41f04ba5130866aadbe/" |
| 868 | "epson-inkjet-printer-escpr-1.7.9-1lsb3.2.tar.gz")) |
| 869 | (sha256 |
| 870 | (base32 "136hhvhimxfnrdn3ksbiswjxgsifrwlp3zz8h0v63w4k1vkzpgc0")))) |
| 871 | (build-system gnu-build-system) |
| 872 | (arguments |
| 873 | `(#:modules |
| 874 | ((srfi srfi-26) |
| 875 | ,@%gnu-build-system-modules) |
| 876 | #:configure-flags |
| 877 | `("--disable-static" |
| 878 | ,(string-append "--prefix=" |
| 879 | (assoc-ref %outputs "out")) |
| 880 | ,(string-append "--with-cupsfilterdir=" |
| 881 | (assoc-ref %outputs "out") "/lib/cups/filter") |
| 882 | ,(string-append "--with-cupsppddir=" |
| 883 | (assoc-ref %outputs "out") "/share/cups/model")) |
| 884 | #:phases |
| 885 | (modify-phases %standard-phases |
| 886 | (add-after 'unpack 'patch-autotools-version-requirement |
| 887 | (lambda _ |
| 888 | (substitute* "aclocal.m4" |
| 889 | (("1\\.15") |
| 890 | ,(package-version automake))) |
| 891 | (substitute* "configure" |
| 892 | (("^(ACLOCAL=).*" _ match) |
| 893 | (string-append match "aclocal")) |
| 894 | (("^(AUTOMAKE=).*" _ match) |
| 895 | (string-append match "automake"))) |
| 896 | #t)) |
| 897 | (add-after 'install 'compress-PPDs |
| 898 | (lambda* (#:key outputs #:allow-other-keys) |
| 899 | (let ((out (assoc-ref outputs "out"))) |
| 900 | (with-directory-excursion out |
| 901 | (for-each (cut invoke "gzip" "-9" <>) |
| 902 | (find-files "share/cups" "\\.ppd$"))))))))) |
| 903 | (native-inputs |
| 904 | `(("autoconf" ,autoconf) |
| 905 | ("automake" ,automake))) |
| 906 | (inputs |
| 907 | `(("cups" ,cups-minimal))) |
| 908 | (synopsis "ESC/P-R printer driver") |
| 909 | (description |
| 910 | "This package provides a filter for @acronym{CUPS, the Common UNIX Printing |
| 911 | System} that offers high-quality printing with Seiko@tie{}Epson color ink jet |
| 912 | printers. It can be used only with printers that support the Epson@tie{}ESC/P-R |
| 913 | language.") |
| 914 | (home-page "http://download.ebz.epson.net/dsc/search/01/search/?OSC=LX") |
| 915 | (license license:gpl2+))) |
| 916 | |
| 917 | (define-public escpr |
| 918 | (deprecated-package "escpr" epson-inkjet-printer-escpr)) |
| 919 | |
| 920 | (define-public splix |
| 921 | ;; Last released in 2009 <https://sourceforge.net/projects/splix/files/>. |
| 922 | ;; Last SVN commit was 2013 <https://svn.code.sf.net/p/splix/code/splix/>. |
| 923 | ;; Use a more maintained fork with several bug fixes and support for newer |
| 924 | ;; printer models. |
| 925 | (let ((commit "76268c4dd7dbc8218ea7426401104c3b40cc707a") |
| 926 | (revision "315")) |
| 927 | (package |
| 928 | (name "splix") |
| 929 | (version (git-version "2.0.0" revision commit)) |
| 930 | (source |
| 931 | (origin |
| 932 | (method git-fetch) |
| 933 | (uri (git-reference |
| 934 | (url "https://gitlab.com/ScumCoder/splix") |
| 935 | (commit commit))) |
| 936 | (file-name (git-file-name name version)) |
| 937 | (sha256 |
| 938 | (base32 "1mxsvllwwr1v8sgrax0b7gkajjhnm0l06s67spmaxz47lyll1qab")))) |
| 939 | (build-system gnu-build-system) |
| 940 | ;; PPDs have been obsolete since CUPS 1.2 and make up 90% of total size. |
| 941 | (outputs (list "out" "ppd")) |
| 942 | (arguments |
| 943 | `(#:modules |
| 944 | ((srfi srfi-26) |
| 945 | ,@%gnu-build-system-modules) |
| 946 | #:make-flags |
| 947 | (list (string-append "CUPSDRV=" |
| 948 | (assoc-ref %outputs "out") "/share/cups/drv") |
| 949 | (string-append "CUPSFILTER=" |
| 950 | (assoc-ref %outputs "out") "/lib/cups/filter") |
| 951 | (string-append "CUPSPPD=" |
| 952 | (assoc-ref %outputs "ppd") "/share/cups/model") |
| 953 | "CACHESIZE=100" ; pages in RAM, ±300 KiB each |
| 954 | "THREADS=4") ; compress and print faster |
| 955 | #:phases |
| 956 | (modify-phases %standard-phases |
| 957 | (add-after 'unpack 'enter-subdirectory |
| 958 | ;; The git repository replicates the top-level SVN layout. |
| 959 | (lambda _ |
| 960 | (chdir "splix") |
| 961 | #t)) |
| 962 | (delete 'configure) ; no configure script |
| 963 | (add-before 'build 'build-.drv-files |
| 964 | (lambda* (#:key make-flags #:allow-other-keys) |
| 965 | (apply invoke "make" "drv" make-flags))) |
| 966 | (add-after 'install 'install-.drv-files |
| 967 | (lambda* (#:key make-flags #:allow-other-keys) |
| 968 | (apply invoke "make" "install" "DRV_ONLY=1" make-flags))) |
| 969 | (add-after 'install 'compress-PPDs |
| 970 | (lambda* (#:key outputs #:allow-other-keys) |
| 971 | (let ((ppd (assoc-ref outputs "ppd"))) |
| 972 | (for-each (cut invoke "gzip" "-9" <>) |
| 973 | (find-files ppd "\\.ppd$")))))) |
| 974 | #:tests? #f)) ; no test suite |
| 975 | (inputs |
| 976 | `(("cups" ,cups-minimal) |
| 977 | ("jbigkit" ,jbigkit) |
| 978 | ("zlib" ,zlib))) |
| 979 | (synopsis "QPDL (SPL2) printer driver") |
| 980 | (description |
| 981 | "SpliX is a set of CUPS drivers for printers that speak @acronym{QPDL, |
| 982 | Quick Page Description Language}, also called @acronym{SPL2, Samsung Printer |
| 983 | Language version 2}. These include many laser printers sold by Samsung, |
| 984 | Xerox, Lexmark, Toshiba, and Dell. |
| 985 | |
| 986 | Colour printers need colour profile files to get better results. These |
| 987 | @file{cms} files are provided by the printer's manufacturer and must be |
| 988 | obtained and installed separately.") |
| 989 | (home-page "http://splix.ap2c.org/") |
| 990 | (license license:gpl2)))) |
| 991 | |
| 992 | (define-public python-pycups |
| 993 | (package |
| 994 | (name "python-pycups") |
| 995 | (version "1.9.74") |
| 996 | (source |
| 997 | (origin |
| 998 | (method url-fetch) |
| 999 | (uri (pypi-uri "pycups" version ".tar.bz2")) |
| 1000 | (sha256 |
| 1001 | (base32 |
| 1002 | "1ffp7sswhdsfpy88zg0cc8kl04wygkjs01rlm9f0spbwk8jhy2c6")))) |
| 1003 | (build-system python-build-system) |
| 1004 | (arguments |
| 1005 | '(;; Tests require CUPS to be running |
| 1006 | #:tests? #f)) |
| 1007 | (inputs |
| 1008 | `(("cups" ,cups))) |
| 1009 | (home-page "https://github.com/zdohnal/pycups") |
| 1010 | (synopsis "Python bindings for libcups") |
| 1011 | (description |
| 1012 | "This package provides Python bindings for libcups, wrapping the CUPS |
| 1013 | API.") |
| 1014 | (license license:gpl2+))) |