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