gnu: cups: Use 'modify-phases'.

* gnu/packages/cups.scm (cups)[arguments]: Use 'modify-phases'.
This commit is contained in:
Efraim Flashner 2016-08-15 11:22:59 +03:00
parent 8337cb210d
commit 3064d1763b
No known key found for this signature in database
GPG Key ID: F4C1D3917EACEE93
1 changed files with 98 additions and 104 deletions

View File

@ -178,122 +178,116 @@ device-specific programs to convert and print many types of files.")
'("--disable-launchd" '("--disable-launchd"
"--disable-systemd") "--disable-systemd")
#:phases #:phases
(alist-cons-before (modify-phases %standard-phases
'configure (add-before 'configure 'patch-makedefs
'patch-makedefs (lambda _
(lambda _ (substitute* "Makedefs.in"
(substitute* "Makedefs.in" (("INITDIR.*=.*@INITDIR@") "INITDIR = @prefix@/@INITDIR@")
(("INITDIR.*=.*@INITDIR@") "INITDIR = @prefix@/@INITDIR@") (("/bin/sh") (which "sh")))))
(("/bin/sh") (which "sh")))) (add-before 'check 'patch-tests
(alist-cons-before (lambda _
'check (let ((filters (assoc-ref %build-inputs "cups-filters"))
'patch-tests (catpath (string-append
(lambda _ (assoc-ref %build-inputs "coreutils") "/bin/"))
(let ((filters (assoc-ref %build-inputs "cups-filters")) (testdir (string-append (getcwd) "/tmp/")))
(catpath (string-append (mkdir testdir)
(assoc-ref %build-inputs "coreutils") "/bin/")) (substitute* "test/run-stp-tests.sh"
(testdir (string-append (getcwd) "/tmp/"))) ((" *BASE=/tmp/") (string-append "BASE=" testdir))
(mkdir testdir)
(substitute* "test/run-stp-tests.sh"
((" *BASE=/tmp/") (string-append "BASE=" testdir))
;; allow installation of filters from output dir and from ;; allow installation of filters from output dir and from
;; cups-filters ;; cups-filters
(("for dir in /usr/libexec/cups/filter /usr/lib/cups/filter") (("for dir in /usr/libexec/cups/filter /usr/lib/cups/filter")
(string-append (string-append
"for dir in " "for dir in "
(assoc-ref %outputs "out") "/lib/cups/filter " (assoc-ref %outputs "out") "/lib/cups/filter "
filters "/lib/cups/filter")) filters "/lib/cups/filter"))
;; check for charsets in cups-filters output ;; check for charsets in cups-filters output
(("/usr/share/cups/charsets") (("/usr/share/cups/charsets")
(string-append filters "/share/cups/charsets")) (string-append filters "/share/cups/charsets"))
;; install additional required filters ;; install additional required filters
(("instfilter texttopdf texttopdf pdf") (("instfilter texttopdf texttopdf pdf")
(string-append (string-append
"instfilter texttopdf texttopdf pdf;" "instfilter texttopdf texttopdf pdf;"
"instfilter imagetoraster imagetoraster raster;" "instfilter imagetoraster imagetoraster raster;"
"instfilter gstoraster gstoraster raster;" "instfilter gstoraster gstoraster raster;"
"instfilter urftopdf urftopdf pdf;" "instfilter urftopdf urftopdf pdf;"
"instfilter rastertopdf rastertopdf pdf;" "instfilter rastertopdf rastertopdf pdf;"
"instfilter pstopdf pstopdf pdf")) "instfilter pstopdf pstopdf pdf"))
;; specify location of lpstat binary ;; specify location of lpstat binary
(("description=\"`lpstat -l") (("description=\"`lpstat -l")
"description=\"`../systemv/lpstat -l") "description=\"`../systemv/lpstat -l")
;; patch shebangs of embedded scripts ;; patch shebangs of embedded scripts
(("#!/bin/sh") (string-append "#!" (which "sh"))) (("#!/bin/sh") (string-append "#!" (which "sh")))
;; also link mime definitions from cups-filters ;; also link mime definitions from cups-filters
;; to enable the additional filters for the test suite ;; to enable the additional filters for the test suite
(("ln -s \\$root/conf/mime\\.types") (("ln -s \\$root/conf/mime\\.types")
(string-append (string-append
"ln -s " filters "ln -s " filters
"/share/cups/mime/cupsfilters.types $BASE/share/mime; " "/share/cups/mime/cupsfilters.types $BASE/share/mime; "
"ln -s $root/conf/mime.types")) "ln -s $root/conf/mime.types"))
(("ln -s \\$root/conf/mime\\.convs") (("ln -s \\$root/conf/mime\\.convs")
(string-append (string-append
"ln -s " filters "ln -s " filters
"/share/cups/mime/cupsfilters.convs $BASE/share/mime; " "/share/cups/mime/cupsfilters.convs $BASE/share/mime; "
"ln -s $root/conf/mime.convs"))) "ln -s $root/conf/mime.convs")))
;; fix search path for "cat" ;; fix search path for "cat"
(substitute* "cups/testfile.c" (substitute* "cups/testfile.c"
(("cupsFileFind\\(\"cat\", \"/bin\"") (("cupsFileFind\\(\"cat\", \"/bin\"")
(string-append "cupsFileFind(\"cat\", \"" catpath "\"")) (string-append "cupsFileFind(\"cat\", \"" catpath "\""))
(("cupsFileFind\\(\"cat\", \"/bin:/usr/bin\"") (("cupsFileFind\\(\"cat\", \"/bin:/usr/bin\"")
(string-append "cupsFileFind(\"cat\", \"" catpath "\""))))) (string-append "cupsFileFind(\"cat\", \"" catpath "\""))))))
(alist-cons-after (add-after 'install 'install-cups-filters-symlinks
'install (lambda* (#:key inputs outputs #:allow-other-keys)
'install-cups-filters-symlinks (let ((out (assoc-ref outputs "out"))
(lambda* (#:key inputs outputs #:allow-other-keys) (cups-filters (assoc-ref inputs "cups-filters")))
(let ((out (assoc-ref outputs "out")) ;; charsets
(cups-filters (assoc-ref inputs "cups-filters"))) (symlink
;; charsets (string-append cups-filters "/share/cups/charsets")
(symlink (string-append out "/share/charsets"))
(string-append cups-filters "/share/cups/charsets")
(string-append out "/share/charsets"))
;; mime types, driver file, ppds ;; mime types, driver file, ppds
(for-each (for-each
(lambda (f) (lambda (f)
(symlink (string-append cups-filters f) (symlink (string-append cups-filters f)
(string-append out f))) (string-append out f)))
'("/share/cups/mime/cupsfilters.types" '("/share/cups/mime/cupsfilters.types"
"/share/cups/mime/cupsfilters.convs" "/share/cups/mime/cupsfilters.convs"
"/share/cups/drv/cupsfilters.drv" "/share/cups/drv/cupsfilters.drv"
"/share/ppd")) "/share/ppd"))
;; filters ;; filters
(for-each (for-each
(lambda (f) (lambda (f)
(symlink f (symlink f
(string-append out "/lib/cups/filter" (basename f)))) (string-append out "/lib/cups/filter" (basename f))))
(find-files (string-append cups-filters "/lib/cups/filter"))) (find-files (string-append cups-filters "/lib/cups/filter")))
;; backends ;; backends
(for-each (for-each
(lambda (f) (lambda (f)
(symlink (string-append cups-filters f) (symlink (string-append cups-filters f)
(string-append out "/lib/cups/backend/" (string-append out "/lib/cups/backend/"
(basename f)))) (basename f))))
'("/lib/cups/backend/parallel" '("/lib/cups/backend/parallel"
"/lib/cups/backend/serial")) "/lib/cups/backend/serial"))
;; banners ;; banners
(let ((banners "/share/cups/banners")) (let ((banners "/share/cups/banners"))
(delete-file-recursively (string-append out banners)) (delete-file-recursively (string-append out banners))
(symlink (string-append cups-filters banners) (symlink (string-append cups-filters banners)
(string-append out banners))) (string-append out banners)))
;; assorted data ;; assorted data
(let ((data "/share/cups/data")) (let ((data "/share/cups/data"))
(delete-file-recursively (string-append out data)) (delete-file-recursively (string-append out data))
(symlink (string-append cups-filters data) (symlink (string-append cups-filters data)
(string-append out data))))) (string-append out data)))))))))
%standard-phases)))))
(inputs (inputs
`(("avahi" ,avahi) `(("avahi" ,avahi)
("gnutls" ,gnutls) ("gnutls" ,gnutls)