gnu: a2ps: Build reproducibly.
[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>
6447e191 3;;; Copyright © 2016 Efraim Flashner <efraim@flashner.co.il>
57b94e9d 4;;; Copyright © 2016 Ricardo Wurmus <rekado@elephly.net>
0a15ee7b 5;;; Copyright © 2017 Marius Bakke <mbakke@fastmail.com>
cba988ed 6;;; Copyright © 2017 Ludovic Courtès <ludo@gnu.org>
58310341
EB
7;;;
8;;; This file is part of GNU Guix.
9;;;
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.
14;;;
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.
19;;;
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/>.
22
23(define-module (gnu packages pretty-print)
24 #:use-module (guix packages)
25 #:use-module (guix licenses)
26 #:use-module (guix download)
0a15ee7b 27 #:use-module (guix build-system cmake)
58310341
EB
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)
57b94e9d
RW
38 #:use-module (gnu packages lua)
39 #:use-module (gnu packages perl)
0a15ee7b 40 #:use-module (gnu packages pkg-config)
148585c2 41 #:use-module (gnu packages compression))
58310341
EB
42
43(define-public a2ps
44 (package
45 (name "a2ps")
46 (version "4.14")
cba988ed
LC
47 (source (origin
48 (method url-fetch)
49 (uri (string-append "mirror://gnu/a2ps/a2ps-"
50 version ".tar.gz"))
51 (sha256
52 (base32
53 "195k78m1h03m961qn7jr120z815iyb93gwi159p1p9348lyqvbpk"))
54 (modules '((guix build utils)))
55 (snippet
56 ;; Remove timestamp from the installed 'README' file.
57 '(substitute* "etc/README.in"
58 (("@date@")
59 "1st of some month, sometime after 1970")))
60 (patches (search-patches
61 "a2ps-CVE-2001-1593.patch"
62 "a2ps-CVE-2014-0466.patch"))))
58310341
EB
63 (build-system gnu-build-system)
64 (inputs
65 `(("psutils" ,psutils)
66 ("groff" ,groff)
67 ("gv" ,gv)
68 ("imagemagick" ,imagemagick)))
69 (native-inputs
70 `(("gperf" ,gperf)
c198872b 71 ("perl" ,perl)))
58310341 72 (arguments
d01f680c
EF
73 '(#:phases
74 (modify-phases %standard-phases
75 (add-before 'build 'patch-scripts
76 (lambda _
77 (substitute*
78 '("afm/make_fonts_map.sh"
79 "tests/defs"
80 "tests/backup.tst"
81 "tests/styles.tst")
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")))))))))
6fd52309 103 (home-page "https://www.gnu.org/software/a2ps/")
58310341
EB
104 (synopsis "Any file to PostScript, including pretty-printing")
105 (description
106 "GNU a2ps converts almost anything to a PostScript file, ready for
35b9e423 107printing. It accomplishes this by being able to delegate files to external
58310341
EB
108handlers, such as Groff and Gzip. It handles as many steps as is necessary to
109produce a pretty-printed file. It also includes some extra abilities for
110special cases, such as pretty-printing \"--help\" output.")
111 (license gpl3+)))
112
113(define-public trueprint
114 (package
115 (name "trueprint")
116 (version "5.4")
117 (source
118 (origin
119 (method url-fetch)
120 (uri (string-append "mirror://gnu/trueprint/trueprint-"
121 version ".tar.gz"))
122 (sha256
123 (base32
124 "13rkc0fga10xyf56yy9dnq95zndnfadkhxflnp24skszj21y8jqh"))))
125 (build-system gnu-build-system)
58310341
EB
126 (arguments
127 ;; Must define DIFF_CMD for tests to pass
c198872b 128 '(#:configure-flags '("CPPFLAGS=-DDIFF_CMD=\\\"diff\\\"")))
6fd52309 129 (home-page "https://www.gnu.org/software/trueprint/")
58310341
EB
130 (synopsis "Pretty-print C sources and other plain text to PostScript")
131 (description
132 "GNU Trueprint translates C source code files as PostScript files.
133In addition to the basic source code output, it can also perform diff-marking,
134indentation counting, function and file indices and more.")
135 (license gpl2)))
136
137(define-public enscript
138 (package
139 (name "enscript")
140 (version "1.6.6")
141 (source
142 (origin
143 (method url-fetch)
144 (uri (string-append "mirror://gnu/enscript/enscript-"
145 version ".tar.gz"))
146 (sha256
147 (base32
148 "1fy0ymvzrrvs889zanxcaxjfcxarm2d3k43c9frmbl1ld7dblmkd"))))
149 (build-system gnu-build-system)
6fd52309 150 (home-page "https://www.gnu.org/software/enscript/")
58310341
EB
151 (synopsis "Generating PostScript, including pretty-printing")
152 (description
153 "GNU Enscript is a program to convert ASCII text files to PostScript,
e881752c 154HTML or RTF formats, to be stored in files or sent immediately to a printer.
58310341
EB
155It also includes the capability to perform syntax highlighting for several
156different programming languages.")
157 (license gpl3+)))
158
0a15ee7b
MB
159(define-public fmt
160 (package
161 (name "fmt")
162 (version "3.0.1")
163 (source (origin
164 (method url-fetch)
165 (uri (string-append
166 "https://github.com/fmtlib/fmt/releases/download/"
167 version "/fmt-" version ".zip"))
168 (sha256
169 (base32
170 "0l4514mk83cjimynci3ghrfdchjy8cya1qa45c1fg2lsj7fg16jc"))))
171 (build-system cmake-build-system)
172 (native-inputs
173 `(("unzip" ,unzip)))
174 (home-page "http://fmtlib.net/latest/")
175 (synopsis "Small and fast C++ formatting library")
176 (description
177 "@code{fmt} (formerly @code{cppformat}) is a formatting library for C++.
178It can be used as a safe alternative to @code{printf} or as a fast alternative
179to @code{IOStreams}.")
180 ;; The library is bsd-2, but documentation and tests include other licenses.
181 (license (list bsd-2 bsd-3 psfl))))
182
58310341
EB
183(define-public source-highlight
184 (package
185 (name "source-highlight")
a952b10c 186 (version "3.1.8")
58310341
EB
187 (source
188 (origin
189 (method url-fetch)
190 (uri (string-append "mirror://gnu/src-highlite/source-highlight-"
191 version ".tar.gz"))
192 (sha256
193 (base32
f905286b 194 "18xdalxg7yzrxc1njzgw7aryq2jdm7zq2yqz41sc7k6il5z6lcq1"))))
58310341
EB
195 (build-system gnu-build-system)
196 ;; The ctags that comes with emacs does not support the --excmd options,
197 ;; so can't be used
198 (inputs
8a1f6a7e 199 `(("boost" ,boost)))
58310341
EB
200 (native-inputs
201 `(("bison" ,bison)
c198872b 202 ("flex" ,flex)))
58310341
EB
203 (arguments
204 `(#:configure-flags
205 (list (string-append "--with-boost="
206 (assoc-ref %build-inputs "boost")))
207 #:parallel-tests? #f ;There appear to be race conditions
d4bf49b1 208 #:phases (alist-cons-before
c198872b 209 'check 'patch-test-files
d4bf49b1 210 (lambda _
c198872b
MW
211 ;; Unpatch shebangs in test input so that source-highlight
212 ;; is still able to infer input language
213 (substitute* '("tests/test.sh"
214 "tests/test2.sh"
215 "tests/test.tcl")
216 (((string-append "#! *" (which "sh"))) "#!/bin/sh"))
217 ;; Initial patching unrecoverably removes whitespace, so
218 ;; remove it also in the comparison output.
219 (substitute* '("tests/test.sh.html"
220 "tests/test2.sh.html"
221 "tests/test.tcl.html")
222 (("#! */bin/sh") "#!/bin/sh")))
223 %standard-phases)))
6fd52309 224 (home-page "https://www.gnu.org/software/src-highlite/")
58310341
EB
225 (synopsis "Produce a document with syntax highlighting from a source file")
226 (description
227 "GNU source-highlight reads in a source code file and produces an output
228file in which the keywords are highlighted in different colors to designate
229their syntactic role. It supports over 150 different languages and it can
230output to 8 different formats, including HTML, LaTeX and ODF. It can also
231output to ANSI color escape sequences, so that highlighted source code can be
232seen in a terminal.")
63e8bb12
LC
233 (license gpl3+)
234 (properties '((ftp-directory . "/gnu/src-highlite")))))
47833c90 235
57b94e9d
RW
236(define-public highlight
237 (package
238 (name "highlight")
239 (version "3.33")
240 (source
241 (origin
242 (method url-fetch)
243 (uri (string-append "http://www.andre-simon.de/zip/highlight-"
244 version ".tar.bz2"))
245 (sha256
246 (base32
247 "0g2whi6pxl640795vymikm82a1my841jmh7fiqzbrjpc9wsk1db4"))))
248 (build-system gnu-build-system)
249 (arguments
250 `(#:tests? #f ; no tests
251 #:make-flags
252 (let ((confdir (string-append %output "/share/highlight/config/")))
253 (list (string-append "PREFIX=" %output)
254 (string-append "HL_CONFIG_DIR=" confdir)
255 (string-append "conf_dir=" confdir)))
256 #:phases
257 (modify-phases %standard-phases
258 (delete 'configure)
259 (add-after 'unpack 'fix-search-for-lua
260 (lambda _
261 (substitute* "src/makefile"
262 (("(pkg-config.*)lua" _ prefix)
263 (string-append prefix "lua-5.3")))
264 #t)))))
265 (inputs
266 `(("lua" ,lua)
267 ("boost" ,boost)))
268 (native-inputs
269 `(("pkg-config" ,pkg-config)))
270 (home-page "http://www.andre-simon.de/doku/highlight/en/highlight.php")
271 (synopsis "Convert code to documents with syntax highlighting")
272 (description "Highlight converts source code to HTML, XHTML, RTF, LaTeX,
273TeX, SVG, BBCode and terminal escape sequences with colored syntax
274highlighting. Language definitions and color themes are customizable.")
275 (license gpl3+)))
276
47833c90
EB
277(define-public astyle
278 (package
279 (name "astyle")
280 (version "2.05")
281 (source
282 (origin
283 (method url-fetch)
284 (uri (string-append "mirror://sourceforge/astyle/astyle/astyle%20"
285 version "/astyle_" version "_linux.tar.gz"))
286 (sha256
287 (base32
288 "0f9sh9kq5ajp1yz133h00fr9235p1m698x7n3h7zbrhjiwgynd6s"))))
289 (build-system gnu-build-system)
290 (arguments
291 `(#:tests? #f ;no tests
292 #:make-flags (list (string-append "prefix=" %output)
293 "INSTALL=install"
294 "all")
295 #:phases (alist-replace
296 'configure
297 (lambda _ (chdir "build/gcc"))
298 (alist-cons-after
299 'install 'install-libs
300 (lambda* (#:key outputs #:allow-other-keys)
301 ;; Libraries are not installed by default
302 (let* ((output (assoc-ref outputs "out"))
303 (libdir (string-append output "/lib")))
304 (begin
305 (mkdir-p libdir)
306 (for-each (lambda (l)
307 (copy-file
308 l (string-append libdir "/" (basename l))))
309 (find-files "bin" "lib*")))))
310 %standard-phases))))
311 (home-page "http://astyle.sourceforge.net/")
312 (synopsis "Source code indenter, formatter, and beautifier")
313 (description
314 "Artistic Style is a source code indenter, formatter, and beautifier for
315the C, C++, C++/CLI, Objective‑C, C#, and Java programming languages.")
316 (license lgpl3+)))