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 Ludovic Courtès <ludo@gnu.org>
6 ;;; Copyright © 2017, 2018, 2019, 2020 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>
11 ;;; This file is part of GNU Guix.
13 ;;; GNU Guix is free software; you can redistribute it and/or modify it
14 ;;; under the terms of the GNU General Public License as published by
15 ;;; the Free Software Foundation; either version 3 of the License, or (at
16 ;;; your option) any later version.
18 ;;; GNU Guix is distributed in the hope that it will be useful, but
19 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
20 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 ;;; GNU General Public License for more details.
23 ;;; You should have received a copy of the GNU General Public License
24 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
26 (define-module (gnu packages pretty-print)
27 #:use-module (guix packages)
28 #:use-module (guix licenses)
29 #:use-module (guix git-download)
30 #:use-module (guix download)
31 #:use-module (guix build-system cmake)
32 #:use-module (guix build-system gnu)
33 #:use-module (guix utils)
34 #:use-module (gnu packages)
35 #:use-module (gnu packages bison)
36 #:use-module (gnu packages boost)
37 #:use-module (gnu packages compression)
38 #:use-module (gnu packages flex)
39 #:use-module (gnu packages ghostscript)
40 #:use-module (gnu packages gperf)
41 #:use-module (gnu packages groff)
42 #:use-module (gnu packages gv)
43 #:use-module (gnu packages imagemagick)
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))
55 (uri (string-append "mirror://gnu/a2ps/a2ps-"
59 "195k78m1h03m961qn7jr120z815iyb93gwi159p1p9348lyqvbpk"))
60 (modules '((guix build utils)))
62 ;; Remove timestamp from the installed 'README' file.
64 (substitute* "etc/README.in"
66 "1st of some month, sometime after 1970"))
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)
74 `(("psutils" ,psutils)
76 ("imagemagick" ,imagemagick)))
83 (modify-phases %standard-phases
84 (add-before 'build 'patch-scripts
87 '("afm/make_fonts_map.sh"
91 (("/bin/rm") (which "rm")))))
92 (add-before 'check 'patch-test-files
93 ;; Alternatively, we could unpatch the shebangs in tstfiles
94 (lambda* (#:key inputs #:allow-other-keys)
95 (let ((perl (assoc-ref inputs "perl")))
96 (substitute* '("tests/ps-ref/includeres.ps"
97 "tests/gps-ref/includeres.ps")
98 (("/usr/local/bin/perl")
99 (string-append perl "/bin/perl"))))
100 ;; Some of the reference postscript contain a 'version 3'
101 ;; string that in inconsistent with the source text in the
102 ;; tstfiles directory. Erroneous search-and-replace?
103 (substitute* '("tests/ps-ref/InsertBlock.ps"
104 "tests/gps-ref/InsertBlock.ps"
105 "tests/ps-ref/bookie.ps"
106 "tests/gps-ref/bookie.ps")
107 (("version 3") "version 2"))
108 (substitute* '("tests/ps-ref/psmandup.ps"
109 "tests/gps-ref/psmandup.ps")
110 (("#! */bin/sh") (string-append
111 "#!" (which "sh")))))))))
112 (home-page "https://www.gnu.org/software/a2ps/")
113 (synopsis "Any file to PostScript, including pretty-printing")
115 "GNU a2ps converts almost anything to a PostScript file, ready for
116 printing. It accomplishes this by being able to delegate files to external
117 handlers, such as Groff and Gzip. It handles as many steps as is necessary to
118 produce a pretty-printed file. It also includes some extra abilities for
119 special cases, such as pretty-printing \"--help\" output.")
122 (define-public trueprint
129 (uri (string-append "mirror://gnu/trueprint/trueprint-"
133 "13rkc0fga10xyf56yy9dnq95zndnfadkhxflnp24skszj21y8jqh"))))
134 (build-system gnu-build-system)
136 ;; Must define DIFF_CMD for tests to pass
137 '(#:configure-flags '("CPPFLAGS=-DDIFF_CMD=\\\"diff\\\"")))
138 (home-page "https://www.gnu.org/software/trueprint/")
139 (synopsis "Pretty-print C sources and other plain text to PostScript")
141 "GNU Trueprint translates C source code files as PostScript files.
142 In addition to the basic source code output, it can also perform diff-marking,
143 indentation counting, function and file indices and more.")
146 (define-public enscript
153 (uri (string-append "mirror://gnu/enscript/enscript-"
157 "1fy0ymvzrrvs889zanxcaxjfcxarm2d3k43c9frmbl1ld7dblmkd"))))
158 (build-system gnu-build-system)
159 (home-page "https://www.gnu.org/software/enscript/")
160 (synopsis "Generating PostScript, including pretty-printing")
162 "GNU Enscript is a program to convert ASCII text files to PostScript,
163 HTML or RTF formats, to be stored in files or sent immediately to a printer.
164 It also includes the capability to perform syntax highlighting for several
165 different programming languages.")
175 (uri (string-append "https://github.com/fmtlib/fmt/releases/download/"
176 version "/fmt-" version ".zip"))
178 (base32 "0kgajl3qsrdyj0csqsz8b8h84kasdy0pnh16byl0y1vlsaddzkyy"))))
179 (build-system cmake-build-system)
181 '(#:configure-flags '("-DBUILD_SHARED_LIBS=ON")))
184 (home-page "https://fmt.dev")
185 (synopsis "Small and fast C++ formatting library")
187 "@code{fmt} (formerly @code{cppformat}) is a formatting library for C++.
188 It can be used as a safe alternative to @code{printf} or as a fast alternative
189 to @code{IOStreams}.")
190 ;; The library is bsd-2, but documentation and tests include other licenses.
191 (license (list bsd-2 bsd-3 psfl))))
201 (uri (string-append "https://github.com/fmtlib/fmt/releases/download/"
202 version "/fmt-" version ".zip"))
204 (base32 "06l8g59frbsbwj15kg6x2bbn6p8yidh6wzsigdhbdjncvm1agzll"))))))
206 (define-public source-highlight
208 (name "source-highlight")
213 (uri (string-append "mirror://gnu/src-highlite/source-highlight-"
217 "148w47k3zswbxvhg83z38ifi85f9dqcpg7icvvw1cm6bg21x4zrs"))))
218 (build-system gnu-build-system)
219 ;; The ctags that comes with emacs does not support the --excmd options,
228 (list (string-append "--with-boost="
229 (assoc-ref %build-inputs "boost")))
230 #:parallel-tests? #f ;There appear to be race conditions
232 (modify-phases %standard-phases
233 (add-before 'check 'patch-test-files
235 ;; Unpatch shebangs in test input so that source-highlight
236 ;; is still able to infer input language
237 (substitute* '("tests/test.sh"
240 (((string-append "#! *" (which "sh"))) "#!/bin/sh"))
241 ;; Initial patching unrecoverably removes whitespace, so
242 ;; remove it also in the comparison output.
243 (substitute* '("tests/test.sh.html"
244 "tests/test2.sh.html"
245 "tests/test.tcl.html")
246 (("#! */bin/sh") "#!/bin/sh"))
248 (home-page "https://www.gnu.org/software/src-highlite/")
249 (synopsis "Produce a document with syntax highlighting from a source file")
251 "GNU source-highlight reads in a source code file and produces an output
252 file in which the keywords are highlighted in different colors to designate
253 their syntactic role. It supports over 150 different languages and it can
254 output to 8 different formats, including HTML, LaTeX and ODF. It can also
255 output to ANSI color escape sequences, so that highlighted source code can be
256 seen in a terminal.")
258 (properties '((ftp-directory . "/gnu/src-highlite")))))
260 (define-public highlight
267 (uri (string-append "http://www.andre-simon.de/zip/highlight-"
270 (base32 "1y25vc3nysdih4y9z6yqn1k3i6lgkbyqkmdaib2xyfpqw4djb06z"))))
271 (build-system gnu-build-system)
273 `(#:tests? #f ; no tests
275 (let ((confdir (string-append %output "/share/highlight/config/")))
276 (list (string-append "PREFIX=" %output)
277 (string-append "HL_CONFIG_DIR=" confdir)
278 (string-append "conf_dir=" confdir)))
280 (modify-phases %standard-phases
281 (delete 'configure) ; no configure script
282 (add-after 'unpack 'fix-search-for-lua
284 (substitute* "src/makefile"
285 (("(LUA_PKG_NAME=).*" _ assignment)
286 (string-append assignment "lua-" ,(version-major+minor
287 (package-version lua))
289 (substitute* "extras/swig/makefile"
290 (("lua") (string-append "lua-" ,(version-major+minor
291 (package-version lua)))))
293 (add-after 'install 'install-perl-bindings
294 (lambda* (#:key outputs #:allow-other-keys)
295 (let* ((perldir (string-append (assoc-ref outputs "out")
296 "/lib/perl5/site_perl/"
297 ,(package-version perl)))
298 (autodir (string-append perldir "/auto/highlight")))
299 (with-directory-excursion "extras/swig"
300 (invoke "make" "perl")
301 (invoke "perl" "-I" "." "testmod.pl")
302 (install-file "highlight.pm" perldir)
303 (install-file "highlight.so" autodir))
310 `(("pkg-config" ,pkg-config)
312 (home-page "http://www.andre-simon.de/doku/highlight/en/highlight.php")
313 (synopsis "Convert code to documents with syntax highlighting")
314 (description "Highlight converts source code to HTML, XHTML, RTF, LaTeX,
315 TeX, SVG, BBCode and terminal escape sequences with colored syntax
316 highlighting. Language definitions and color themes are customizable.")