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