gnu: source-highlight: Fix lesspipe file name and use gexps.

This fixes src-hilite-lesspipe.sh so that lesspipe.sh is called instead of lesspipe.

* gnu/packages/pretty-print.scm (source-highlight):
[arguments]: Use gexps, remove trailing #ts.
[phases]: Add phase to make src-highlight-lesspipe.sh work.

Signed-off-by: Mathieu Othacehe <othacehe@gnu.org>
Signed-off-by: Tobias Geerinckx-Rice <me@tobias.gr>
This commit is contained in:
kiasoc5 2022-09-19 02:57:30 -04:00 committed by Tobias Geerinckx-Rice
parent 4d0befe66a
commit 91db77c955
No known key found for this signature in database
GPG key ID: 0DB0FF884F556D79

View file

@ -32,6 +32,7 @@ (define-module (gnu packages pretty-print)
#:use-module (guix download) #:use-module (guix download)
#:use-module (guix build-system cmake) #:use-module (guix build-system cmake)
#:use-module (guix build-system gnu) #:use-module (guix build-system gnu)
#:use-module (guix gexp)
#:use-module (guix utils) #:use-module (guix utils)
#:use-module (gnu packages) #:use-module (gnu packages)
#:use-module (gnu packages bison) #:use-module (gnu packages bison)
@ -278,39 +279,40 @@ (define-public source-highlight
(native-inputs (native-inputs
(list bison flex)) (list bison flex))
(arguments (arguments
`(#:configure-flags (list #:configure-flags
(list (string-append "--with-boost=" #~(list (string-append "--with-boost=" (assoc-ref %build-inputs "boost")))
(assoc-ref %build-inputs "boost"))) #:parallel-tests? #f ;There appear to be race conditions
#:parallel-tests? #f ;There appear to be race conditions #:phases
#:phases #~(modify-phases %standard-phases
(modify-phases %standard-phases (add-before 'build 'rename-lesspipe-to-lesspipe.sh.in
,@(if (%current-target-system) (lambda _
;; 'doc/Makefile.am' tries to run stuff even when (substitute* "src/src-hilite-lesspipe.sh.in"
;; cross-compiling. Explicitly skip it. (("lesspipe") "lesspipe.sh"))))
;; XXX: Inline this on next rebuild cycle. #$@(if (%current-target-system)
`((add-before 'build 'skip-doc-directory ;; 'doc/Makefile.am' tries to run stuff even when
(lambda _ ;; cross-compiling. Explicitly skip it.
(substitute* "Makefile" ;; XXX: Inline this on next rebuild cycle.
(("^SUBDIRS = (.*) doc(.*)$" _ before after) #~((add-before 'build 'skip-doc-directory
(string-append "SUBDIRS = " before (lambda _
" " after "\n"))) (substitute* "Makefile"
#t))) (("^SUBDIRS = (.*) doc(.*)$" _ before after)
'()) (string-append "SUBDIRS = " before
(add-before 'check 'patch-test-files " " after "\n"))))))
(lambda _ '())
;; Unpatch shebangs in test input so that source-highlight (add-before 'check 'patch-test-files
;; is still able to infer input language (lambda _
(substitute* '("tests/test.sh" ;; Unpatch shebangs in test input so that source-highlight
"tests/test2.sh" ;; is still able to infer input language
"tests/test.tcl") (substitute* '("tests/test.sh"
(((string-append "#! *" (which "sh"))) "#!/bin/sh")) "tests/test2.sh"
;; Initial patching unrecoverably removes whitespace, so "tests/test.tcl")
;; remove it also in the comparison output. (((string-append "#! *" (which "sh"))) "#!/bin/sh"))
(substitute* '("tests/test.sh.html" ;; Initial patching unrecoverably removes whitespace, so
"tests/test2.sh.html" ;; remove it also in the comparison output.
"tests/test.tcl.html") (substitute* '("tests/test.sh.html"
(("#! */bin/sh") "#!/bin/sh")) "tests/test2.sh.html"
#t))))) "tests/test.tcl.html")
(("#! */bin/sh") "#!/bin/sh")))))))
(home-page "https://www.gnu.org/software/src-highlite/") (home-page "https://www.gnu.org/software/src-highlite/")
(synopsis "Produce a document with syntax highlighting from a source file") (synopsis "Produce a document with syntax highlighting from a source file")
(description (description