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>
6 ;;; This file is part of GNU Guix.
8 ;;; GNU Guix is free software; you can redistribute it and/or modify it
9 ;;; under the terms of the GNU General Public License as published by
10 ;;; the Free Software Foundation; either version 3 of the License, or (at
11 ;;; your option) any later version.
13 ;;; GNU Guix is distributed in the hope that it will be useful, but
14 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
15 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 ;;; GNU General Public License for more details.
18 ;;; You should have received a copy of the GNU General Public License
19 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
21 (define-module (gnu packages pretty-print)
22 #:use-module (guix packages)
23 #:use-module (guix licenses)
24 #:use-module (guix download)
25 #:use-module (guix build-system gnu)
26 #:use-module (gnu packages)
27 #:use-module (gnu packages ghostscript)
28 #:use-module (gnu packages groff)
29 #:use-module (gnu packages imagemagick)
30 #:use-module (gnu packages gv)
31 #:use-module (gnu packages boost)
32 #:use-module (gnu packages bison)
33 #:use-module (gnu packages flex)
34 #:use-module (gnu packages gperf)
35 #:use-module (gnu packages lua)
36 #:use-module (gnu packages perl)
37 #:use-module (gnu packages pkg-config))
46 (uri (string-append "mirror://gnu/a2ps/a2ps-"
50 "195k78m1h03m961qn7jr120z815iyb93gwi159p1p9348lyqvbpk"))
51 (patches (search-patches
52 "a2ps-CVE-2001-1593.patch"
53 "a2ps-CVE-2014-0466.patch"))))
54 (build-system gnu-build-system)
56 `(("psutils" ,psutils)
59 ("imagemagick" ,imagemagick)))
65 (modify-phases %standard-phases
66 (add-before 'build 'patch-scripts
69 '("afm/make_fonts_map.sh"
73 (("/bin/rm") (which "rm")))))
74 (add-before 'check 'patch-test-files
75 ;; Alternatively, we could unpatch the shebangs in tstfiles
76 (lambda* (#:key inputs #:allow-other-keys)
77 (let ((perl (assoc-ref inputs "perl")))
78 (substitute* '("tests/ps-ref/includeres.ps"
79 "tests/gps-ref/includeres.ps")
80 (("/usr/local/bin/perl")
81 (string-append perl "/bin/perl"))))
82 ;; Some of the reference postscript contain a 'version 3'
83 ;; string that in inconsistent with the source text in the
84 ;; tstfiles directory. Erroneous search-and-replace?
85 (substitute* '("tests/ps-ref/InsertBlock.ps"
86 "tests/gps-ref/InsertBlock.ps"
87 "tests/ps-ref/bookie.ps"
88 "tests/gps-ref/bookie.ps")
89 (("version 3") "version 2"))
90 (substitute* '("tests/ps-ref/psmandup.ps"
91 "tests/gps-ref/psmandup.ps")
92 (("#! */bin/sh") (string-append
93 "#!" (which "sh")))))))))
94 (home-page "http://www.gnu.org/software/a2ps")
95 (synopsis "Any file to PostScript, including pretty-printing")
97 "GNU a2ps converts almost anything to a PostScript file, ready for
98 printing. It accomplishes this by being able to delegate files to external
99 handlers, such as Groff and Gzip. It handles as many steps as is necessary to
100 produce a pretty-printed file. It also includes some extra abilities for
101 special cases, such as pretty-printing \"--help\" output.")
104 (define-public trueprint
111 (uri (string-append "mirror://gnu/trueprint/trueprint-"
115 "13rkc0fga10xyf56yy9dnq95zndnfadkhxflnp24skszj21y8jqh"))))
116 (build-system gnu-build-system)
118 ;; Must define DIFF_CMD for tests to pass
119 '(#:configure-flags '("CPPFLAGS=-DDIFF_CMD=\\\"diff\\\"")))
120 (home-page "http://www.gnu.org/software/trueprint")
121 (synopsis "Pretty-print C sources and other plain text to PostScript")
123 "GNU Trueprint translates C source code files as PostScript files.
124 In addition to the basic source code output, it can also perform diff-marking,
125 indentation counting, function and file indices and more.")
128 (define-public enscript
135 (uri (string-append "mirror://gnu/enscript/enscript-"
139 "1fy0ymvzrrvs889zanxcaxjfcxarm2d3k43c9frmbl1ld7dblmkd"))))
140 (build-system gnu-build-system)
141 (home-page "http://www.gnu.org/software/enscript")
142 (synopsis "Generating PostScript, including pretty-printing")
144 "GNU Enscript is a program to convert ASCII text files to PostScript,
145 HTML or RTF formats, to be stored in files or sent immediately to a printer.
146 It also includes the capability to perform syntax highlighting for several
147 different programming languages.")
150 (define-public source-highlight
152 (name "source-highlight")
157 (uri (string-append "mirror://gnu/src-highlite/source-highlight-"
161 "18xdalxg7yzrxc1njzgw7aryq2jdm7zq2yqz41sc7k6il5z6lcq1"))))
162 (build-system gnu-build-system)
163 ;; The ctags that comes with emacs does not support the --excmd options,
172 (list (string-append "--with-boost="
173 (assoc-ref %build-inputs "boost")))
174 #:parallel-tests? #f ;There appear to be race conditions
175 #:phases (alist-cons-before
176 'check 'patch-test-files
178 ;; Unpatch shebangs in test input so that source-highlight
179 ;; is still able to infer input language
180 (substitute* '("tests/test.sh"
183 (((string-append "#! *" (which "sh"))) "#!/bin/sh"))
184 ;; Initial patching unrecoverably removes whitespace, so
185 ;; remove it also in the comparison output.
186 (substitute* '("tests/test.sh.html"
187 "tests/test2.sh.html"
188 "tests/test.tcl.html")
189 (("#! */bin/sh") "#!/bin/sh")))
191 (home-page "http://www.gnu.org/software/src-highlite")
192 (synopsis "Produce a document with syntax highlighting from a source file")
194 "GNU source-highlight reads in a source code file and produces an output
195 file in which the keywords are highlighted in different colors to designate
196 their syntactic role. It supports over 150 different languages and it can
197 output to 8 different formats, including HTML, LaTeX and ODF. It can also
198 output to ANSI color escape sequences, so that highlighted source code can be
199 seen in a terminal.")
201 (properties '((ftp-directory . "/gnu/src-highlite")))))
203 (define-public highlight
210 (uri (string-append "http://www.andre-simon.de/zip/highlight-"
214 "0g2whi6pxl640795vymikm82a1my841jmh7fiqzbrjpc9wsk1db4"))))
215 (build-system gnu-build-system)
217 `(#:tests? #f ; no tests
219 (let ((confdir (string-append %output "/share/highlight/config/")))
220 (list (string-append "PREFIX=" %output)
221 (string-append "HL_CONFIG_DIR=" confdir)
222 (string-append "conf_dir=" confdir)))
224 (modify-phases %standard-phases
226 (add-after 'unpack 'fix-search-for-lua
228 (substitute* "src/makefile"
229 (("(pkg-config.*)lua" _ prefix)
230 (string-append prefix "lua-5.3")))
236 `(("pkg-config" ,pkg-config)))
237 (home-page "http://www.andre-simon.de/doku/highlight/en/highlight.php")
238 (synopsis "Convert code to documents with syntax highlighting")
239 (description "Highlight converts source code to HTML, XHTML, RTF, LaTeX,
240 TeX, SVG, BBCode and terminal escape sequences with colored syntax
241 highlighting. Language definitions and color themes are customizable.")
244 (define-public astyle
251 (uri (string-append "mirror://sourceforge/astyle/astyle/astyle%20"
252 version "/astyle_" version "_linux.tar.gz"))
255 "0f9sh9kq5ajp1yz133h00fr9235p1m698x7n3h7zbrhjiwgynd6s"))))
256 (build-system gnu-build-system)
258 `(#:tests? #f ;no tests
259 #:make-flags (list (string-append "prefix=" %output)
262 #:phases (alist-replace
264 (lambda _ (chdir "build/gcc"))
266 'install 'install-libs
267 (lambda* (#:key outputs #:allow-other-keys)
268 ;; Libraries are not installed by default
269 (let* ((output (assoc-ref outputs "out"))
270 (libdir (string-append output "/lib")))
273 (for-each (lambda (l)
275 l (string-append libdir "/" (basename l))))
276 (find-files "bin" "lib*")))))
278 (home-page "http://astyle.sourceforge.net/")
279 (synopsis "Source code indenter, formatter, and beautifier")
281 "Artistic Style is a source code indenter, formatter, and beautifier for
282 the C, C++, C++/CLI, Objective‑C, C#, and Java programming languages.")