gnu: Add AVR-Libc.
[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 ;;;
4 ;;; This file is part of GNU Guix.
5 ;;;
6 ;;; GNU Guix is free software; you can redistribute it and/or modify it
7 ;;; under the terms of the GNU General Public License as published by
8 ;;; the Free Software Foundation; either version 3 of the License, or (at
9 ;;; your option) any later version.
10 ;;;
11 ;;; GNU Guix is distributed in the hope that it will be useful, but
12 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
13 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 ;;; GNU General Public License for more details.
15 ;;;
16 ;;; You should have received a copy of the GNU General Public License
17 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
18
19 (define-module (gnu packages pretty-print)
20 #:use-module (guix packages)
21 #:use-module (guix licenses)
22 #:use-module (guix download)
23 #:use-module (guix build-system gnu)
24 #:use-module (gnu packages)
25 #:use-module (gnu packages ghostscript)
26 #:use-module (gnu packages groff)
27 #:use-module (gnu packages imagemagick)
28 #:use-module (gnu packages gv)
29 #:use-module (gnu packages boost)
30 #:use-module (gnu packages bison)
31 #:use-module (gnu packages flex)
32 #:use-module (gnu packages gperf)
33 #:use-module (gnu packages perl))
34
35 (define-public a2ps
36 (package
37 (name "a2ps")
38 (version "4.14")
39 (source
40 (origin
41 (method url-fetch)
42 (uri (string-append "mirror://gnu/a2ps/a2ps-"
43 version ".tar.gz"))
44 (sha256
45 (base32
46 "195k78m1h03m961qn7jr120z815iyb93gwi159p1p9348lyqvbpk"))))
47 (build-system gnu-build-system)
48 (inputs
49 `(("psutils" ,psutils)
50 ("groff" ,groff)
51 ("gv" ,gv)
52 ("imagemagick" ,imagemagick)))
53 (native-inputs
54 `(("gperf" ,gperf)
55 ("perl" ,perl)))
56 (arguments
57 '(#:phases (alist-cons-before
58 'build 'patch-scripts
59 (lambda _
60 (substitute*
61 '("afm/make_fonts_map.sh"
62 "tests/defs"
63 "tests/backup.tst"
64 "tests/styles.tst")
65 (("/bin/rm") (which "rm"))))
66 (alist-cons-before
67 'check 'patch-test-files
68 ;; Alternatively, we could unpatch the shebangs in tstfiles
69 (lambda* (#:key inputs #:allow-other-keys)
70 (let ((perl (assoc-ref inputs "perl")))
71 (substitute* '("tests/ps-ref/includeres.ps"
72 "tests/gps-ref/includeres.ps")
73 (("/usr/local/bin/perl")
74 (string-append perl "/bin/perl"))))
75 ;; Some of the reference postscript contain a 'version 3'
76 ;; string that in inconsistent with the source text in the
77 ;; tstfiles directory. Erroneous search-and-replace?
78 (substitute* '("tests/ps-ref/InsertBlock.ps"
79 "tests/gps-ref/InsertBlock.ps"
80 "tests/ps-ref/bookie.ps"
81 "tests/gps-ref/bookie.ps")
82 (("version 3") "version 2"))
83 (substitute* '("tests/ps-ref/psmandup.ps"
84 "tests/gps-ref/psmandup.ps")
85 (("#! */bin/sh") (string-append
86 "#!" (which "sh")))))
87 %standard-phases))))
88 (home-page "http://www.gnu.org/software/a2ps")
89 (synopsis "Any file to PostScript, including pretty-printing")
90 (description
91 "GNU a2ps converts almost anything to a PostScript file, ready for
92 printing. It accomplishes this by being able to delegate files to external
93 handlers, such as Groff and Gzip. It handles as many steps as is necessary to
94 produce a pretty-printed file. It also includes some extra abilities for
95 special cases, such as pretty-printing \"--help\" output.")
96 (license gpl3+)))
97
98 (define-public trueprint
99 (package
100 (name "trueprint")
101 (version "5.4")
102 (source
103 (origin
104 (method url-fetch)
105 (uri (string-append "mirror://gnu/trueprint/trueprint-"
106 version ".tar.gz"))
107 (sha256
108 (base32
109 "13rkc0fga10xyf56yy9dnq95zndnfadkhxflnp24skszj21y8jqh"))))
110 (build-system gnu-build-system)
111 (arguments
112 ;; Must define DIFF_CMD for tests to pass
113 '(#:configure-flags '("CPPFLAGS=-DDIFF_CMD=\\\"diff\\\"")))
114 (home-page "http://www.gnu.org/software/trueprint")
115 (synopsis "Pretty-print C sources and other plain text to PostScript")
116 (description
117 "GNU Trueprint translates C source code files as PostScript files.
118 In addition to the basic source code output, it can also perform diff-marking,
119 indentation counting, function and file indices and more.")
120 (license gpl2)))
121
122 (define-public enscript
123 (package
124 (name "enscript")
125 (version "1.6.6")
126 (source
127 (origin
128 (method url-fetch)
129 (uri (string-append "mirror://gnu/enscript/enscript-"
130 version ".tar.gz"))
131 (sha256
132 (base32
133 "1fy0ymvzrrvs889zanxcaxjfcxarm2d3k43c9frmbl1ld7dblmkd"))))
134 (build-system gnu-build-system)
135 (home-page "http://www.gnu.org/software/enscript")
136 (synopsis "Generating PostScript, including pretty-printing")
137 (description
138 "GNU Enscript is a program to convert ASCII text files to PostScript,
139 HTML or RTF formats, to be stored in files or sent immediately to a printer.
140 It also includes the capability to perform syntax highlighting for several
141 different programming languages.")
142 (license gpl3+)))
143
144 (define-public source-highlight
145 (package
146 (name "source-highlight")
147 (version "3.1.7")
148 (source
149 (origin
150 (method url-fetch)
151 (uri (string-append "mirror://gnu/src-highlite/source-highlight-"
152 version ".tar.gz"))
153 (sha256
154 (base32
155 "1s49ld8cnpzhhwq0r7s0sfm3cg3nhhm0wla27lwraifrrl3y1cp1"))
156 (patches
157 (list (search-patch
158 ;; Patch submitted as Savannah item #41786
159 "source-highlight-regexrange-test.patch")))))
160 (build-system gnu-build-system)
161 ;; The ctags that comes with emacs does not support the --excmd options,
162 ;; so can't be used
163 (inputs
164 `(("boost" ,boost)))
165 (native-inputs
166 `(("bison" ,bison)
167 ("flex" ,flex)))
168 (arguments
169 `(#:configure-flags
170 (list (string-append "--with-boost="
171 (assoc-ref %build-inputs "boost")))
172 #:parallel-tests? #f ;There appear to be race conditions
173 #:phases (alist-cons-before
174 'check 'patch-test-files
175 (lambda _
176 ;; Unpatch shebangs in test input so that source-highlight
177 ;; is still able to infer input language
178 (substitute* '("tests/test.sh"
179 "tests/test2.sh"
180 "tests/test.tcl")
181 (((string-append "#! *" (which "sh"))) "#!/bin/sh"))
182 ;; Initial patching unrecoverably removes whitespace, so
183 ;; remove it also in the comparison output.
184 (substitute* '("tests/test.sh.html"
185 "tests/test2.sh.html"
186 "tests/test.tcl.html")
187 (("#! */bin/sh") "#!/bin/sh")))
188 %standard-phases)))
189 (home-page "http://www.gnu.org/software/src-highlite")
190 (synopsis "Produce a document with syntax highlighting from a source file")
191 (description
192 "GNU source-highlight reads in a source code file and produces an output
193 file in which the keywords are highlighted in different colors to designate
194 their syntactic role. It supports over 150 different languages and it can
195 output to 8 different formats, including HTML, LaTeX and ODF. It can also
196 output to ANSI color escape sequences, so that highlighted source code can be
197 seen in a terminal.")
198 (license gpl3+)))