Subject: [PATCH v4] gnu: Add gutenprint.

From: Brice Waegeneire <[email-masked]>
Date: Sat, 12 Feb 2022 10:34:10 +0100

From: John Doe <[email-masked]>

* gnu/packages/cups.scm (gutenprint): New variable.

Co-authored-by: Brice Waegeneire <[email-masked]>
---
I reworked this patch from John Doe by:
- updating it to 5.3.4
- adding the copyright header
- using the new input style
- fixing the synopsis and description as suggested by Ludo’

It works fine in cups-service-type, as I'm using a driver from gutenprint to
print to my local printer.

 gnu/packages/cups.scm | 55 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 55 insertions(+)

diff --git a/gnu/packages/cups.scm b/gnu/packages/cups.scm
index da113ac168..0831fad764 100644
--- a/gnu/packages/cups.scm
+++ b/gnu/packages/cups.scm
@@ -8,6 +8,8 @@
 ;;; Copyright © 2017–2021 Tobias Geerinckx-Rice <[email-masked]>
 ;;; Copyright © 2020 Marius Bakke <[email-masked]>
 ;;; Copyright © 2021 Maxim Cournoyer <[email-masked]>
+;;; Copyright © 2021 John Doe <[email-masked]>
+;;; Copyright © 2022 Brice Waegeneire <[email-masked]>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -47,6 +49,7 @@ (define-module (gnu packages cups)
   #:use-module (gnu packages python-xyz)
   #:use-module (gnu packages qt)
   #:use-module (gnu packages scanner)
+  #:use-module (gnu packages time)
   #:use-module (gnu packages tls)
   #:use-module (guix build-system cmake)
   #:use-module (guix build-system gnu)
@@ -984,6 +987,58 @@ (define-public splix
       (home-page "http://splix.ap2c.org/")
       (license license:gpl2))))
 
+(define-public gutenprint
+  (package
+    (name "gutenprint")
+    (version "5.3.4")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (string-append "mirror://sourceforge/gimp-print/" name "-"
+                           (version-major+minor version) "/" version "/"
+                           name "-" version ".tar.xz"))
+       (sha256
+        (base32 "0fq2y9sx37d342fihp1ys9kf4sr2j5nc1kl33j9sirmqs80sfi6v"))))
+    (build-system gnu-build-system)
+    (arguments
+     `(#:test-target "check-parallel"
+       #:configure-flags (list "--enable-cups-level3-ppds"
+                               "--enable-globalized-cups-ppds"
+                               "--enable-cups-ppds"
+                               "--enable-cups-1_2-enhancements")
+       #:phases
+       (modify-phases %standard-phases
+         (add-before 'configure 'fix-paths
+           (lambda* (#:key outputs native-inputs #:allow-other-keys)
+             (substitute* "Makefile.in"
+               (("/usr/bin/time") "time"))
+             (let ((out (assoc-ref outputs "out")))
+               (substitute* (find-files "." "^(Makefile|Makefile\\.in|configure)$")
+                 (("^(\\s*)cups_conf_serverbin(\\s*)=(.+)$")
+                  (string-append "cups_conf_serverbin=" out "/lib/cups\n"))
+                 (("^(\\s*)cups_conf_serverroot(\\s*)=(.+)$")
+                  (string-append "cups_conf_serverroot=" out "/etc/cups\n"))
+                 (("^(\\s*)cups_conf_datadir(\\s*)=(.+)$")
+                  (string-append "cups_conf_datadir=" out "/share/cups\n")))
+               (substitute* "src/cups/Makefile.in"
+                 (("^(\\s*)bindir(\\s*)=(.+)$")
+                  (string-append "bindir = " out "/bin\n"))
+                 (("^(\\s*)sbindir(\\s*)=(.+)$")
+                  (string-append "sbindir = " out "/sbin\n")))
+               #t))))))
+    (native-inputs
+     (list perl
+           time))
+    (inputs
+     (list cups-minimal))
+    (synopsis "Printer drivers for CUPS")
+    (description "This package provides printer drivers for CUPS.
+This project also maintains an enhanced Print plug-in for GIMP 2.x from
+the same code base.  This driver supports widespread inkjet printers by major vendors,
+  including Canon, Epson, Fujitsu, SONY, @dots{}")
+    (home-page "http://gimp-print.sourceforge.net/")
+    (license license:gpl2+)))
+
 (define-public python-pycups
   (package
     (name "python-pycups")

base-commit: 068d99978a0c9c6fb66f95455060c8d08ba55ac5
-- 
2.34.0