gnu: emacs-svg-icon: Fix grammar.
[jackhill/guix/guix.git] / gnu / packages / pretty-print.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2016, 2019, 2020 Efraim Flashner <efraim@flashner.co.il>
3 ;;; Copyright © 2016 Ricardo Wurmus <rekado@elephly.net>
4 ;;; Copyright © 2017 Marius Bakke <mbakke@fastmail.com>
5 ;;; Copyright © 2017, 2020 Ludovic Courtès <ludo@gnu.org>
6 ;;; Copyright © 2017–2021 Tobias Geerinckx-Rice <me@tobias.gr>
7 ;;; Copyright © 2019 Meiyo Peng <meiyo@riseup.net>
8 ;;; Copyright © 2020 Paul Garlick <pgarlick@tourbillion-technology.com>
9 ;;; Copyright © 2020 Vincent Legoll <vincent.legoll@gmail.com>
10 ;;; Copyright © 2021 Greg Hogan <code@greghogan.com>
11 ;;;
12 ;;; This file is part of GNU Guix.
13 ;;;
14 ;;; GNU Guix is free software; you can redistribute it and/or modify it
15 ;;; under the terms of the GNU General Public License as published by
16 ;;; the Free Software Foundation; either version 3 of the License, or (at
17 ;;; your option) any later version.
18 ;;;
19 ;;; GNU Guix is distributed in the hope that it will be useful, but
20 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
21 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 ;;; GNU General Public License for more details.
23 ;;;
24 ;;; You should have received a copy of the GNU General Public License
25 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
26
27 (define-module (gnu packages pretty-print)
28 #:use-module (guix packages)
29 #:use-module (guix licenses)
30 #:use-module (guix git-download)
31 #:use-module (guix download)
32 #:use-module (guix build-system cmake)
33 #:use-module (guix build-system gnu)
34 #:use-module (guix utils)
35 #:use-module (gnu packages)
36 #:use-module (gnu packages bison)
37 #:use-module (gnu packages boost)
38 #:use-module (gnu packages compression)
39 #:use-module (gnu packages flex)
40 #:use-module (gnu packages ghostscript)
41 #:use-module (gnu packages gperf)
42 #:use-module (gnu packages groff)
43 #:use-module (gnu packages gv)
44 #:use-module (gnu packages lua)
45 #:use-module (gnu packages perl)
46 #:use-module (gnu packages pkg-config)
47 #:use-module (gnu packages swig))
48
49 (define-public a2ps
50 (package
51 (name "a2ps")
52 (version "4.14")
53 (source (origin
54 (method url-fetch)
55 (uri (string-append "mirror://gnu/a2ps/a2ps-"
56 version ".tar.gz"))
57 (sha256
58 (base32
59 "195k78m1h03m961qn7jr120z815iyb93gwi159p1p9348lyqvbpk"))
60 (modules '((guix build utils)))
61 (snippet
62 ;; Remove timestamp from the installed 'README' file.
63 '(begin
64 (substitute* "etc/README.in"
65 (("@date@")
66 "1st of some month, sometime after 1970"))
67 #t))
68 (patches (search-patches
69 "a2ps-CVE-2001-1593.patch"
70 "a2ps-CVE-2014-0466.patch"
71 "a2ps-CVE-2015-8107.patch"))))
72 (build-system gnu-build-system)
73 (inputs
74 `(("psutils" ,psutils)
75 ("gv" ,gv)))
76 (native-inputs
77 `(("gperf" ,gperf)
78 ("groff" ,groff)
79 ("perl" ,perl)))
80 (arguments
81 '(#:phases
82 (modify-phases %standard-phases
83 (add-before 'build 'patch-scripts
84 (lambda _
85 (substitute*
86 '("afm/make_fonts_map.sh"
87 "tests/defs"
88 "tests/backup.tst"
89 "tests/styles.tst")
90 (("/bin/rm") (which "rm")))))
91 (add-before 'check 'patch-test-files
92 ;; Alternatively, we could unpatch the shebangs in tstfiles
93 (lambda* (#:key inputs #:allow-other-keys)
94 (let ((perl (assoc-ref inputs "perl")))
95 (substitute* '("tests/ps-ref/includeres.ps"
96 "tests/gps-ref/includeres.ps")
97 (("/usr/local/bin/perl")
98 (string-append perl "/bin/perl"))))
99 ;; Some of the reference postscript contain a 'version 3'
100 ;; string that in inconsistent with the source text in the
101 ;; tstfiles directory. Erroneous search-and-replace?
102 (substitute* '("tests/ps-ref/InsertBlock.ps"
103 "tests/gps-ref/InsertBlock.ps"
104 "tests/ps-ref/bookie.ps"
105 "tests/gps-ref/bookie.ps")
106 (("version 3") "version 2"))
107 (substitute* '("tests/ps-ref/psmandup.ps"
108 "tests/gps-ref/psmandup.ps")
109 (("#! */bin/sh") (string-append
110 "#!" (which "sh")))))))))
111 (home-page "https://www.gnu.org/software/a2ps/")
112 (synopsis "Any file to PostScript, including pretty-printing")
113 (description
114 "GNU a2ps converts almost anything to a PostScript file, ready for
115 printing. It accomplishes this by being able to delegate files to external
116 handlers, such as Groff and Gzip. It handles as many steps as is necessary to
117 produce a pretty-printed file. It also includes some extra abilities for
118 special cases, such as pretty-printing \"--help\" output.")
119 (license gpl3+)))
120
121 (define-public trueprint
122 (package
123 (name "trueprint")
124 (version "5.4")
125 (source
126 (origin
127 (method url-fetch)
128 (uri (string-append "mirror://gnu/trueprint/trueprint-"
129 version ".tar.gz"))
130 (sha256
131 (base32
132 "13rkc0fga10xyf56yy9dnq95zndnfadkhxflnp24skszj21y8jqh"))))
133 (build-system gnu-build-system)
134 (arguments
135 ;; Must define DIFF_CMD for tests to pass
136 '(#:configure-flags '("CPPFLAGS=-DDIFF_CMD=\\\"diff\\\"")))
137 (home-page "https://www.gnu.org/software/trueprint/")
138 (synopsis "Pretty-print C sources and other plain text to PostScript")
139 (description
140 "GNU Trueprint translates C source code files as PostScript files.
141 In addition to the basic source code output, it can also perform diff-marking,
142 indentation counting, function and file indices and more.")
143 (license gpl2)))
144
145 (define-public enscript
146 (package
147 (name "enscript")
148 (version "1.6.6")
149 (source
150 (origin
151 (method url-fetch)
152 (uri (string-append "mirror://gnu/enscript/enscript-"
153 version ".tar.gz"))
154 (sha256
155 (base32
156 "1fy0ymvzrrvs889zanxcaxjfcxarm2d3k43c9frmbl1ld7dblmkd"))))
157 (build-system gnu-build-system)
158 (home-page "https://www.gnu.org/software/enscript/")
159 (synopsis "Generating PostScript, including pretty-printing")
160 (description
161 "GNU Enscript is a program to convert ASCII text files to PostScript,
162 HTML or RTF formats, to be stored in files or sent immediately to a printer.
163 It also includes the capability to perform syntax highlighting for several
164 different programming languages.")
165 (license gpl3+)))
166
167 (define-public fmt
168 (package
169 (name "fmt")
170 (version "7.1.3")
171 (source
172 (origin
173 (method url-fetch)
174 (uri (string-append "https://github.com/fmtlib/fmt/releases/download/"
175 version "/fmt-" version ".zip"))
176 (sha256
177 (base32 "17sc10hfg087z0s774lnn05wwy3bfzmcv7j448p92pr0s02cb62x"))))
178 (build-system cmake-build-system)
179 (arguments
180 '(#:configure-flags '("-DBUILD_SHARED_LIBS=ON")))
181 (native-inputs
182 `(("unzip" ,unzip)))
183 (home-page "https://fmt.dev")
184 (synopsis "Small and fast C++ formatting library")
185 (description
186 "@code{fmt} (formerly @code{cppformat}) is a formatting library for C++.
187 It can be used as a safe alternative to @code{printf} or as a fast alternative
188 to @code{IOStreams}.")
189 ;; The library is bsd-2, but documentation and tests include other licenses.
190 (license (list bsd-2 bsd-3 psfl))))
191
192 (define-public source-highlight
193 (package
194 (name "source-highlight")
195 (version "3.1.9")
196 (source
197 (origin
198 (method url-fetch)
199 (uri (string-append "mirror://gnu/src-highlite/source-highlight-"
200 version ".tar.gz"))
201 (sha256
202 (base32
203 "148w47k3zswbxvhg83z38ifi85f9dqcpg7icvvw1cm6bg21x4zrs"))))
204 (build-system gnu-build-system)
205 ;; The ctags that comes with emacs does not support the --excmd options,
206 ;; so can't be used
207 (inputs
208 `(("boost" ,boost)))
209 (native-inputs
210 `(("bison" ,bison)
211 ("flex" ,flex)))
212 (arguments
213 `(#:configure-flags
214 (list (string-append "--with-boost="
215 (assoc-ref %build-inputs "boost")))
216 #:parallel-tests? #f ;There appear to be race conditions
217 #:phases
218 (modify-phases %standard-phases
219 ,@(if (%current-target-system)
220 ;; 'doc/Makefile.am' tries to run stuff even when
221 ;; cross-compiling. Explicitly skip it.
222 ;; XXX: Inline this on next rebuild cycle.
223 `((add-before 'build 'skip-doc-directory
224 (lambda _
225 (substitute* "Makefile"
226 (("^SUBDIRS = (.*) doc(.*)$" _ before after)
227 (string-append "SUBDIRS = " before
228 " " after "\n")))
229 #t)))
230 '())
231 (add-before 'check 'patch-test-files
232 (lambda _
233 ;; Unpatch shebangs in test input so that source-highlight
234 ;; is still able to infer input language
235 (substitute* '("tests/test.sh"
236 "tests/test2.sh"
237 "tests/test.tcl")
238 (((string-append "#! *" (which "sh"))) "#!/bin/sh"))
239 ;; Initial patching unrecoverably removes whitespace, so
240 ;; remove it also in the comparison output.
241 (substitute* '("tests/test.sh.html"
242 "tests/test2.sh.html"
243 "tests/test.tcl.html")
244 (("#! */bin/sh") "#!/bin/sh"))
245 #t)))))
246 (home-page "https://www.gnu.org/software/src-highlite/")
247 (synopsis "Produce a document with syntax highlighting from a source file")
248 (description
249 "GNU source-highlight reads in a source code file and produces an output
250 file in which the keywords are highlighted in different colors to designate
251 their syntactic role. It supports over 150 different languages and it can
252 output to 8 different formats, including HTML, LaTeX and ODF. It can also
253 output to ANSI color escape sequences, so that highlighted source code can be
254 seen in a terminal.")
255 (license gpl3+)
256 (properties '((ftp-directory . "/gnu/src-highlite")))))
257
258 (define-public highlight
259 (package
260 (name "highlight")
261 (version "3.62")
262 (source
263 (origin
264 (method url-fetch)
265 (uri (string-append "http://www.andre-simon.de/zip/highlight-"
266 version ".tar.bz2"))
267 (sha256
268 (base32 "088di7qxd6b2r22qljllhnly0r9a0lfnwnfqswjn23s09awjbl6p"))))
269 (build-system gnu-build-system)
270 (arguments
271 `(#:tests? #f ; no tests
272 #:make-flags
273 (let ((confdir (string-append %output "/share/highlight/config/")))
274 (list (string-append "PREFIX=" %output)
275 (string-append "HL_CONFIG_DIR=" confdir)
276 (string-append "conf_dir=" confdir)))
277 #:phases
278 (modify-phases %standard-phases
279 (delete 'configure) ; no configure script
280 (add-after 'unpack 'fix-search-for-lua
281 (lambda _
282 (substitute* "src/makefile"
283 (("(LUA_PKG_NAME=).*" _ assignment)
284 (string-append assignment "lua-" ,(version-major+minor
285 (package-version lua))
286 "\n")))
287 (substitute* "extras/swig/makefile"
288 (("lua") (string-append "lua-" ,(version-major+minor
289 (package-version lua)))))
290 #t))
291 (add-after 'install 'install-perl-bindings
292 (lambda* (#:key outputs #:allow-other-keys)
293 (let* ((perldir (string-append (assoc-ref outputs "out")
294 "/lib/perl5/site_perl/"
295 ,(package-version perl)))
296 (autodir (string-append perldir "/auto/highlight")))
297 (with-directory-excursion "extras/swig"
298 (invoke "make" "perl")
299 (invoke "perl" "-I" "." "testmod.pl")
300 (install-file "highlight.pm" perldir)
301 (install-file "highlight.so" autodir))
302 #t))))))
303 (inputs
304 `(("lua" ,lua)
305 ("boost" ,boost)
306 ("perl" ,perl)))
307 (native-inputs
308 `(("pkg-config" ,pkg-config)
309 ("swig" ,swig)))
310 (home-page "http://www.andre-simon.de/doku/highlight/en/highlight.php")
311 (synopsis "Convert code to documents with syntax highlighting")
312 (description "Highlight converts source code to HTML, XHTML, RTF, LaTeX,
313 TeX, SVG, BBCode and terminal escape sequences with colored syntax
314 highlighting. Language definitions and color themes are customizable.")
315 (license gpl3+)))