gnu-build-system: Add 'patch-usr-bin-file' to %standard-phases.
[jackhill/guix/guix.git] / gnu / packages / pretty-print.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2014 Eric Bavier <bavier@member.fsf.org>
3 ;;;
4 ;;; This file is part of GNU Guix.
5 ;;;
6 ;;; GNU Guix is free software; you can redistribute it and/or modify it
7 ;;; under the terms of the GNU General Public License as published by
8 ;;; the Free Software Foundation; either version 3 of the License, or (at
9 ;;; your option) any later version.
10 ;;;
11 ;;; GNU Guix is distributed in the hope that it will be useful, but
12 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
13 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 ;;; GNU General Public License for more details.
15 ;;;
16 ;;; You should have received a copy of the GNU General Public License
17 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
18
19 (define-module (gnu packages pretty-print)
20 #:use-module (guix packages)
21 #:use-module (guix licenses)
22 #:use-module (guix download)
23 #:use-module (guix build-system gnu)
24 #:use-module (gnu packages)
25 #:use-module (gnu packages ghostscript)
26 #:use-module (gnu packages groff)
27 #:use-module (gnu packages imagemagick)
28 #:use-module (gnu packages gv)
29 #:use-module (gnu packages boost)
30 #:use-module (gnu packages bison)
31 #:use-module (gnu packages flex)
32 #:use-module (gnu packages gperf)
33 #:use-module (gnu packages perl)
34 #:use-module (gnu packages file))
35
36 (define-public a2ps
37 (package
38 (name "a2ps")
39 (version "4.14")
40 (source
41 (origin
42 (method url-fetch)
43 (uri (string-append "mirror://gnu/a2ps/a2ps-"
44 version ".tar.gz"))
45 (sha256
46 (base32
47 "195k78m1h03m961qn7jr120z815iyb93gwi159p1p9348lyqvbpk"))))
48 (build-system gnu-build-system)
49 (inputs
50 `(("psutils" ,psutils)
51 ("groff" ,groff)
52 ("gv" ,gv)
53 ("imagemagick" ,imagemagick)))
54 (native-inputs
55 `(("gperf" ,gperf)
56 ("perl" ,perl)
57 ("file" ,file)))
58 (arguments
59 '(#:phases (alist-cons-before
60 'configure 'patch-configure
61 (lambda _
62 (substitute* "configure"
63 (("/usr/bin/file") (which "file"))))
64 (alist-cons-before
65 'build 'patch-scripts
66 (lambda _
67 (substitute*
68 '("afm/make_fonts_map.sh"
69 "tests/defs"
70 "tests/backup.tst"
71 "tests/styles.tst")
72 (("/bin/rm") (which "rm"))))
73 (alist-cons-before
74 'check 'patch-test-files
75 ;; Alternatively, we could unpatch the shebangs in tstfiles
76 (lambda* (#:key inputs #:allow-other-keys)
77 (let ((perl (assoc-ref inputs "perl")))
78 (substitute* '("tests/ps-ref/includeres.ps"
79 "tests/gps-ref/includeres.ps")
80 (("/usr/local/bin/perl")
81 (string-append perl "/bin/perl"))))
82 ;; Some of the reference postscript contain a 'version 3'
83 ;; string that in inconsistent with the source text in the
84 ;; tstfiles directory. Erroneous search-and-replace?
85 (substitute* '("tests/ps-ref/InsertBlock.ps"
86 "tests/gps-ref/InsertBlock.ps"
87 "tests/ps-ref/bookie.ps"
88 "tests/gps-ref/bookie.ps")
89 (("version 3") "version 2"))
90 (substitute* '("tests/ps-ref/psmandup.ps"
91 "tests/gps-ref/psmandup.ps")
92 (("#! */bin/sh") (string-append
93 "#!" (which "sh")))))
94 %standard-phases)))))
95 (home-page "http://www.gnu.org/software/a2ps")
96 (synopsis "Any file to PostScript, including pretty-printing")
97 (description
98 "GNU a2ps converts almost anything to a PostScript file, ready for
99 printing. It accomplishes this by being able to delegate files to external
100 handlers, such as Groff and Gzip. It handles as many steps as is necessary to
101 produce a pretty-printed file. It also includes some extra abilities for
102 special cases, such as pretty-printing \"--help\" output.")
103 (license gpl3+)))
104
105 (define-public trueprint
106 (package
107 (name "trueprint")
108 (version "5.4")
109 (source
110 (origin
111 (method url-fetch)
112 (uri (string-append "mirror://gnu/trueprint/trueprint-"
113 version ".tar.gz"))
114 (sha256
115 (base32
116 "13rkc0fga10xyf56yy9dnq95zndnfadkhxflnp24skszj21y8jqh"))))
117 (build-system gnu-build-system)
118 (native-inputs `(("file" ,file)))
119 (arguments
120 ;; Must define DIFF_CMD for tests to pass
121 '(#:configure-flags '("CPPFLAGS=-DDIFF_CMD=\\\"diff\\\"")
122 #:phases (alist-cons-before
123 'configure 'patch-configure
124 (lambda _
125 (substitute* "configure"
126 (("/usr/bin/file") (which "file"))))
127 %standard-phases)))
128 (home-page "http://www.gnu.org/software/trueprint")
129 (synopsis "Pretty-print C sources and other plain text to PostScript")
130 (description
131 "GNU Trueprint translates C source code files as PostScript files.
132 In addition to the basic source code output, it can also perform diff-marking,
133 indentation counting, function and file indices and more.")
134 (license gpl2)))
135
136 (define-public enscript
137 (package
138 (name "enscript")
139 (version "1.6.6")
140 (source
141 (origin
142 (method url-fetch)
143 (uri (string-append "mirror://gnu/enscript/enscript-"
144 version ".tar.gz"))
145 (sha256
146 (base32
147 "1fy0ymvzrrvs889zanxcaxjfcxarm2d3k43c9frmbl1ld7dblmkd"))))
148 (build-system gnu-build-system)
149 (home-page "http://www.gnu.org/software/enscript")
150 (synopsis "Generating PostScript, including pretty-printing")
151 (description
152 "GNU Enscript is a program to convert ASCII text files to PostScript,
153 HTML or RTF formats, to be stored in files or sent immediately to a printer.
154 It also includes the capability to perform syntax highlighting for several
155 different programming languages.")
156 (license gpl3+)))
157
158 (define-public source-highlight
159 (package
160 (name "source-highlight")
161 (version "3.1.7")
162 (source
163 (origin
164 (method url-fetch)
165 (uri (string-append "mirror://gnu/src-highlite/source-highlight-"
166 version ".tar.gz"))
167 (sha256
168 (base32
169 "1s49ld8cnpzhhwq0r7s0sfm3cg3nhhm0wla27lwraifrrl3y1cp1"))
170 (patches
171 (list (search-patch
172 ;; Patch submitted as Savannah item #41786
173 "source-highlight-regexrange-test.patch")))))
174 (build-system gnu-build-system)
175 ;; The ctags that comes with emacs does not support the --excmd options,
176 ;; so can't be used
177 (inputs
178 `(("boost" ,boost)))
179 (native-inputs
180 `(("bison" ,bison)
181 ("flex" ,flex)
182 ("file" ,file)))
183 (arguments
184 `(#:configure-flags
185 (list (string-append "--with-boost="
186 (assoc-ref %build-inputs "boost")))
187 #:parallel-tests? #f ;There appear to be race conditions
188 #:phases (alist-cons-before
189 'configure 'patch-configure
190 (lambda _
191 (substitute* "configure"
192 (("/usr/bin/file") (which "file"))))
193 (alist-cons-before
194 'check 'patch-test-files
195 (lambda _
196 ;; Unpatch shebangs in test input so that source-highlight
197 ;; is still able to infer input language
198 (substitute* '("tests/test.sh"
199 "tests/test2.sh"
200 "tests/test.tcl")
201 (((string-append "#! *" (which "sh"))) "#!/bin/sh"))
202 ;; Initial patching unrecoverably removes whitespace, so
203 ;; remove it also in the comparison output.
204 (substitute* '("tests/test.sh.html"
205 "tests/test2.sh.html"
206 "tests/test.tcl.html")
207 (("#! */bin/sh") "#!/bin/sh")))
208 %standard-phases))))
209 (home-page "http://www.gnu.org/software/src-highlite")
210 (synopsis "Produce a document with syntax highlighting from a source file")
211 (description
212 "GNU source-highlight reads in a source code file and produces an output
213 file in which the keywords are highlighted in different colors to designate
214 their syntactic role. It supports over 150 different languages and it can
215 output to 8 different formats, including HTML, LaTeX and ODF. It can also
216 output to ANSI color escape sequences, so that highlighted source code can be
217 seen in a terminal.")
218 (license gpl3+)))