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>
8 ;;; This file is part of GNU Guix.
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.
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.
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/>.
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))
49 (uri (string-append "mirror://gnu/a2ps/a2ps-"
53 "195k78m1h03m961qn7jr120z815iyb93gwi159p1p9348lyqvbpk"))
54 (modules '((guix build utils)))
56 ;; Remove timestamp from the installed 'README' file.
57 '(substitute* "etc/README.in"
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)
65 `(("psutils" ,psutils)
68 ("imagemagick" ,imagemagick)))
74 (modify-phases %standard-phases
75 (add-before 'build 'patch-scripts
78 '("afm/make_fonts_map.sh"
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")
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.")
113 (define-public trueprint
120 (uri (string-append "mirror://gnu/trueprint/trueprint-"
124 "13rkc0fga10xyf56yy9dnq95zndnfadkhxflnp24skszj21y8jqh"))))
125 (build-system gnu-build-system)
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")
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.")
137 (define-public enscript
144 (uri (string-append "mirror://gnu/enscript/enscript-"
148 "1fy0ymvzrrvs889zanxcaxjfcxarm2d3k43c9frmbl1ld7dblmkd"))))
149 (build-system gnu-build-system)
150 (home-page "https://www.gnu.org/software/enscript/")
151 (synopsis "Generating PostScript, including pretty-printing")
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.")
166 "https://github.com/fmtlib/fmt/releases/download/"
167 version "/fmt-" version ".zip"))
170 "0l4514mk83cjimynci3ghrfdchjy8cya1qa45c1fg2lsj7fg16jc"))))
171 (build-system cmake-build-system)
174 (home-page "http://fmtlib.net/latest/")
175 (synopsis "Small and fast C++ formatting library")
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))))
183 (define-public source-highlight
185 (name "source-highlight")
190 (uri (string-append "mirror://gnu/src-highlite/source-highlight-"
194 "18xdalxg7yzrxc1njzgw7aryq2jdm7zq2yqz41sc7k6il5z6lcq1"))))
195 (build-system gnu-build-system)
196 ;; The ctags that comes with emacs does not support the --excmd options,
205 (list (string-append "--with-boost="
206 (assoc-ref %build-inputs "boost")))
207 #:parallel-tests? #f ;There appear to be race conditions
209 (modify-phases %standard-phases
210 (add-before 'check 'patch-test-files
212 ;; Unpatch shebangs in test input so that source-highlight
213 ;; is still able to infer input language
214 (substitute* '("tests/test.sh"
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"))
225 (home-page "https://www.gnu.org/software/src-highlite/")
226 (synopsis "Produce a document with syntax highlighting from a source file")
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.")
235 (properties '((ftp-directory . "/gnu/src-highlite")))))
237 (define-public highlight
244 (uri (string-append "http://www.andre-simon.de/zip/highlight-"
248 "0g2whi6pxl640795vymikm82a1my841jmh7fiqzbrjpc9wsk1db4"))))
249 (build-system gnu-build-system)
251 `(#:tests? #f ; no tests
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)))
258 (modify-phases %standard-phases
260 (add-after 'unpack 'fix-search-for-lua
262 (substitute* "src/makefile"
263 (("(pkg-config.*)lua" _ prefix)
264 (string-append prefix "lua-5.3")))
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.")
278 (define-public astyle
285 (uri (string-append "mirror://sourceforge/astyle/astyle/astyle%20"
286 version "/astyle_" version "_linux.tar.gz"))
289 "0f9sh9kq5ajp1yz133h00fr9235p1m698x7n3h7zbrhjiwgynd6s"))))
290 (build-system gnu-build-system)
292 `(#:tests? #f ;no tests
293 #:make-flags (list (string-append "prefix=" %output)
297 (modify-phases %standard-phases
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")))
307 (for-each (lambda (l)
309 l (string-append libdir "/" (basename l))))
310 (find-files "bin" "lib*"))))
312 (home-page "http://astyle.sourceforge.net/")
313 (synopsis "Source code indenter, formatter, and beautifier")
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.")