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