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