guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

01/03: gnu: cups-filters: Make sure filters find Ghostscript.


From: Ludovic Courtès
Subject: 01/03: gnu: cups-filters: Make sure filters find Ghostscript.
Date: Tue, 12 Sep 2017 18:05:07 -0400 (EDT)

civodul pushed a commit to branch staging
in repository guix.

commit 1728c411718e3b358c06561d6e80b47d7b331617
Author: Ludovic Courtès <address@hidden>
Date:   Tue Sep 12 23:07:41 2017 +0200

    gnu: cups-filters: Make sure filters find Ghostscript.
    
    * gnu/packages/cups.scm (cups-filters)[arguments]: Add
    'patch-foomatic-hardcoded-file-names' and 'wrap-filters' phases.
---
 gnu/packages/cups.scm | 31 +++++++++++++++++++++++++++++--
 1 file changed, 29 insertions(+), 2 deletions(-)

diff --git a/gnu/packages/cups.scm b/gnu/packages/cups.scm
index aba8ce7..879ec42 100644
--- a/gnu/packages/cups.scm
+++ b/gnu/packages/cups.scm
@@ -1,6 +1,6 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2015 Ricardo Wurmus <address@hidden>
-;;; Copyright © 2015, 2016 Ludovic Courtès <address@hidden>
+;;; Copyright © 2015, 2016, 2017 Ludovic Courtès <address@hidden>
 ;;; Copyright © 2015, 2016, 2017 Efraim Flashner <address@hidden>
 ;;; Copyright © 2016 Danny Milosavljevic <address@hidden>
 ;;; Copyright © 2017 Leo Famulari <address@hidden>
@@ -99,7 +99,34 @@
                          (assoc-ref %build-inputs "bash")
                          "/bin/bash")
          ,(string-append "--with-rcdir="
-                         (assoc-ref %outputs "out") "/etc/rc.d"))))
+                         (assoc-ref %outputs "out") "/etc/rc.d"))
+
+       #:phases (modify-phases %standard-phases
+                  (add-after 'unpack 'patch-foomatic-hardcoded-file-names
+                    (lambda* (#:key inputs outputs #:allow-other-keys)
+                      ;; Foomatic has hardcoded file names we need to fix.
+                      (let ((out (assoc-ref outputs "out"))
+                            (gs  (assoc-ref inputs "ghostscript")))
+                        (substitute* "filter/foomatic-rip/foomaticrip.c"
+                          (("/usr/local/lib/cups/filter")
+                           (string-append out "/lib/cups/filter")))
+                        #t)))
+                  (add-after 'install 'wrap-filters
+                    (lambda* (#:key inputs outputs #:allow-other-keys)
+                      ;; Some filters expect to find 'gs' in $PATH.  We cannot
+                      ;; just hard-code its absolute file name in the source
+                      ;; because foomatic-rip, for example, has tests like
+                      ;; 'startswith(cmd, "gs")'.
+                      (let ((out         (assoc-ref outputs "out"))
+                            (ghostscript (assoc-ref inputs "ghostscript")))
+                        (for-each (lambda (file)
+                                    (wrap-program file
+                                      `("PATH" ":" prefix
+                                        (,(string-append ghostscript
+                                                         "/bin")))))
+                                  (find-files (string-append
+                                               out "/lib/cups/filter")))
+                        #t))))))
     (native-inputs
      `(("glib" ,glib "bin") ; for gdbus-codegen
        ("pkg-config" ,pkg-config)))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]