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