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>
9 ;;; This file is part of GNU Guix.
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.
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.
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/>.
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))
51 (uri (string-append "mirror://gnu/a2ps/a2ps-"
55 "195k78m1h03m961qn7jr120z815iyb93gwi159p1p9348lyqvbpk"))
56 (modules '((guix build utils)))
58 ;; Remove timestamp from the installed 'README' file.
59 '(substitute* "etc/README.in"
61 "1st of some month, sometime after 1970")))
62 (patches (search-patches
63 "a2ps-CVE-2001-1593.patch"
64 "a2ps-CVE-2014-0466.patch"))))
65 (build-system gnu-build-system)
67 `(("psutils" ,psutils)
70 ("imagemagick" ,imagemagick)))
76 (modify-phases %standard-phases
77 (add-before 'build 'patch-scripts
80 '("afm/make_fonts_map.sh"
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")))))))))
105 (home-page "https://www.gnu.org/software/a2ps/")
106 (synopsis "Any file to PostScript, including pretty-printing")
108 "GNU a2ps converts almost anything to a PostScript file, ready for
109 printing. It accomplishes this by being able to delegate files to external
110 handlers, such as Groff and Gzip. It handles as many steps as is necessary to
111 produce a pretty-printed file. It also includes some extra abilities for
112 special cases, such as pretty-printing \"--help\" output.")
115 (define-public trueprint
122 (uri (string-append "mirror://gnu/trueprint/trueprint-"
126 "13rkc0fga10xyf56yy9dnq95zndnfadkhxflnp24skszj21y8jqh"))))
127 (build-system gnu-build-system)
129 ;; Must define DIFF_CMD for tests to pass
130 '(#:configure-flags '("CPPFLAGS=-DDIFF_CMD=\\\"diff\\\"")))
131 (home-page "https://www.gnu.org/software/trueprint/")
132 (synopsis "Pretty-print C sources and other plain text to PostScript")
134 "GNU Trueprint translates C source code files as PostScript files.
135 In addition to the basic source code output, it can also perform diff-marking,
136 indentation counting, function and file indices and more.")
139 (define-public enscript
146 (uri (string-append "mirror://gnu/enscript/enscript-"
150 "1fy0ymvzrrvs889zanxcaxjfcxarm2d3k43c9frmbl1ld7dblmkd"))))
151 (build-system gnu-build-system)
152 (home-page "https://www.gnu.org/software/enscript/")
153 (synopsis "Generating PostScript, including pretty-printing")
155 "GNU Enscript is a program to convert ASCII text files to PostScript,
156 HTML or RTF formats, to be stored in files or sent immediately to a printer.
157 It also includes the capability to perform syntax highlighting for several
158 different programming languages.")
168 "https://github.com/fmtlib/fmt/releases/download/"
169 version "/fmt-" version ".zip"))
172 "1swyqw3dn2vx5sw2yh5vk0vrvrkp7fv07cj4272yxl5rrq1byjcx"))))
173 (build-system cmake-build-system)
178 (list (string-append "-DCMAKE_INSTALL_LIBDIR="
179 (assoc-ref %outputs "out") "/lib"))))
180 (home-page "http://fmtlib.net/")
181 (synopsis "Small and fast C++ formatting library")
183 "@code{fmt} (formerly @code{cppformat}) is a formatting library for C++.
184 It can be used as a safe alternative to @code{printf} or as a fast alternative
185 to @code{IOStreams}.")
186 ;; The library is bsd-2, but documentation and tests include other licenses.
187 (license (list bsd-2 bsd-3 psfl))))
189 (define-public source-highlight
191 (name "source-highlight")
196 (uri (string-append "mirror://gnu/src-highlite/source-highlight-"
200 "18xdalxg7yzrxc1njzgw7aryq2jdm7zq2yqz41sc7k6il5z6lcq1"))))
201 (build-system gnu-build-system)
202 ;; The ctags that comes with emacs does not support the --excmd options,
211 (list (string-append "--with-boost="
212 (assoc-ref %build-inputs "boost")))
213 #:parallel-tests? #f ;There appear to be race conditions
215 (modify-phases %standard-phases
216 (add-before 'check 'patch-test-files
218 ;; Unpatch shebangs in test input so that source-highlight
219 ;; is still able to infer input language
220 (substitute* '("tests/test.sh"
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"))
231 (home-page "https://www.gnu.org/software/src-highlite/")
232 (synopsis "Produce a document with syntax highlighting from a source file")
234 "GNU source-highlight reads in a source code file and produces an output
235 file in which the keywords are highlighted in different colors to designate
236 their syntactic role. It supports over 150 different languages and it can
237 output to 8 different formats, including HTML, LaTeX and ODF. It can also
238 output to ANSI color escape sequences, so that highlighted source code can be
239 seen in a terminal.")
241 (properties '((ftp-directory . "/gnu/src-highlite")))))
243 (define-public highlight
250 (uri (string-append "http://www.andre-simon.de/zip/highlight-"
254 "07iihzy8ckzdrxqd6bzbij4hy4mmlixibjnjviqfihd0hh1q30m5"))))
255 (build-system gnu-build-system)
257 `(#:tests? #f ; no tests
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)))
264 (modify-phases %standard-phases
265 (delete 'configure) ; no configure script
266 (add-after 'unpack 'fix-search-for-lua
268 (substitute* "src/makefile"
269 (("(pkg-config.*)lua" _ prefix)
270 (string-append prefix "lua-" ,(version-major+minor
271 (package-version lua)))))
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,
281 TeX, SVG, BBCode and terminal escape sequences with colored syntax
282 highlighting. Language definitions and color themes are customizable.")
285 (define-public astyle
292 (uri (string-append "mirror://sourceforge/astyle/astyle/astyle%20"
293 version "/astyle_" version "_linux.tar.gz"))
296 "0f9sh9kq5ajp1yz133h00fr9235p1m698x7n3h7zbrhjiwgynd6s"))))
297 (build-system gnu-build-system)
299 `(#:tests? #f ;no tests
300 #:make-flags (list (string-append "prefix=" %output)
304 (modify-phases %standard-phases
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")))
314 (for-each (lambda (l)
316 l (string-append libdir "/" (basename l))))
317 (find-files "bin" "lib*"))))
319 (home-page "http://astyle.sourceforge.net/")
320 (synopsis "Source code indenter, formatter, and beautifier")
322 "Artistic Style is a source code indenter, formatter, and beautifier for
323 the C, C++, C++/CLI, Objective‑C, C#, and Java programming languages.")