build-system: Add haskell-build-system.
[jackhill/guix/guix.git] / gnu / packages / pretty-print.scm
CommitLineData
58310341
EB
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)
c198872b 33 #:use-module (gnu packages perl))
58310341
EB
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)
c198872b 55 ("perl" ,perl)))
58310341 56 (arguments
d4bf49b1 57 '(#:phases (alist-cons-before
c198872b 58 'build 'patch-scripts
d4bf49b1 59 (lambda _
c198872b
MW
60 (substitute*
61 '("afm/make_fonts_map.sh"
62 "tests/defs"
63 "tests/backup.tst"
64 "tests/styles.tst")
65 (("/bin/rm") (which "rm"))))
58310341 66 (alist-cons-before
c198872b
MW
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))))
58310341
EB
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
35b9e423 92printing. It accomplishes this by being able to delegate files to external
58310341
EB
93handlers, such as Groff and Gzip. It handles as many steps as is necessary to
94produce a pretty-printed file. It also includes some extra abilities for
95special 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)
58310341
EB
111 (arguments
112 ;; Must define DIFF_CMD for tests to pass
c198872b 113 '(#:configure-flags '("CPPFLAGS=-DDIFF_CMD=\\\"diff\\\"")))
58310341
EB
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.
118In addition to the basic source code output, it can also perform diff-marking,
119indentation 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,
574e86f9 139HTML or RTF formats, to be stored in files or sent immediately to a printer.
58310341
EB
140It also includes the capability to perform syntax highlighting for several
141different 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
8a1f6a7e 164 `(("boost" ,boost)))
58310341
EB
165 (native-inputs
166 `(("bison" ,bison)
c198872b 167 ("flex" ,flex)))
58310341
EB
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
d4bf49b1 173 #:phases (alist-cons-before
c198872b 174 'check 'patch-test-files
d4bf49b1 175 (lambda _
c198872b
MW
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)))
58310341
EB
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
193file in which the keywords are highlighted in different colors to designate
194their syntactic role. It supports over 150 different languages and it can
195output to 8 different formats, including HTML, LaTeX and ODF. It can also
196output to ANSI color escape sequences, so that highlighted source code can be
197seen in a terminal.")
198 (license gpl3+)))
47833c90
EB
199
200(define-public astyle
201 (package
202 (name "astyle")
203 (version "2.05")
204 (source
205 (origin
206 (method url-fetch)
207 (uri (string-append "mirror://sourceforge/astyle/astyle/astyle%20"
208 version "/astyle_" version "_linux.tar.gz"))
209 (sha256
210 (base32
211 "0f9sh9kq5ajp1yz133h00fr9235p1m698x7n3h7zbrhjiwgynd6s"))))
212 (build-system gnu-build-system)
213 (arguments
214 `(#:tests? #f ;no tests
215 #:make-flags (list (string-append "prefix=" %output)
216 "INSTALL=install"
217 "all")
218 #:phases (alist-replace
219 'configure
220 (lambda _ (chdir "build/gcc"))
221 (alist-cons-after
222 'install 'install-libs
223 (lambda* (#:key outputs #:allow-other-keys)
224 ;; Libraries are not installed by default
225 (let* ((output (assoc-ref outputs "out"))
226 (libdir (string-append output "/lib")))
227 (begin
228 (mkdir-p libdir)
229 (for-each (lambda (l)
230 (copy-file
231 l (string-append libdir "/" (basename l))))
232 (find-files "bin" "lib*")))))
233 %standard-phases))))
234 (home-page "http://astyle.sourceforge.net/")
235 (synopsis "Source code indenter, formatter, and beautifier")
236 (description
237 "Artistic Style is a source code indenter, formatter, and beautifier for
238the C, C++, C++/CLI, Objective‑C, C#, and Java programming languages.")
239 (license lgpl3+)))