Commit | Line | Data |
---|---|---|
58310341 | 1 | ;;; GNU Guix --- Functional package management for GNU |
841bddb4 | 2 | ;;; Copyright © 2016, 2019 Efraim Flashner <efraim@flashner.co.il> |
57b94e9d | 3 | ;;; Copyright © 2016 Ricardo Wurmus <rekado@elephly.net> |
0a15ee7b | 4 | ;;; Copyright © 2017 Marius Bakke <mbakke@fastmail.com> |
cba988ed | 5 | ;;; Copyright © 2017 Ludovic Courtès <ludo@gnu.org> |
edb4265e | 6 | ;;; Copyright © 2017, 2018, 2019 Tobias Geerinckx-Rice <me@tobias.gr> |
f970946c | 7 | ;;; Copyright © 2019 Meiyo Peng <meiyo@riseup.net> |
b24d523e | 8 | ;;; Copyright © 2020 Paul Garlick <pgarlick@tourbillion-technology.com> |
6e834bdd | 9 | ;;; Copyright © 2020 Vincent Legoll <vincent.legoll@gmail.com> |
58310341 EB |
10 | ;;; |
11 | ;;; This file is part of GNU Guix. | |
12 | ;;; | |
13 | ;;; GNU Guix is free software; you can redistribute it and/or modify it | |
14 | ;;; under the terms of the GNU General Public License as published by | |
15 | ;;; the Free Software Foundation; either version 3 of the License, or (at | |
16 | ;;; your option) any later version. | |
17 | ;;; | |
18 | ;;; GNU Guix is distributed in the hope that it will be useful, but | |
19 | ;;; WITHOUT ANY WARRANTY; without even the implied warranty of | |
20 | ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
21 | ;;; GNU General Public License for more details. | |
22 | ;;; | |
23 | ;;; You should have received a copy of the GNU General Public License | |
24 | ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. | |
25 | ||
26 | (define-module (gnu packages pretty-print) | |
27 | #:use-module (guix packages) | |
28 | #:use-module (guix licenses) | |
744f445c | 29 | #:use-module (guix git-download) |
58310341 | 30 | #:use-module (guix download) |
0a15ee7b | 31 | #:use-module (guix build-system cmake) |
58310341 | 32 | #:use-module (guix build-system gnu) |
6e48fbb1 | 33 | #:use-module (guix utils) |
58310341 EB |
34 | #:use-module (gnu packages) |
35 | #:use-module (gnu packages ghostscript) | |
36 | #:use-module (gnu packages groff) | |
37 | #:use-module (gnu packages imagemagick) | |
38 | #:use-module (gnu packages gv) | |
39 | #:use-module (gnu packages boost) | |
40 | #:use-module (gnu packages bison) | |
41 | #:use-module (gnu packages flex) | |
42 | #:use-module (gnu packages gperf) | |
57b94e9d RW |
43 | #:use-module (gnu packages lua) |
44 | #:use-module (gnu packages perl) | |
0a15ee7b | 45 | #:use-module (gnu packages pkg-config) |
b24d523e PG |
46 | #:use-module (gnu packages compression) |
47 | #:use-module (gnu packages swig)) | |
58310341 EB |
48 | |
49 | (define-public a2ps | |
50 | (package | |
51 | (name "a2ps") | |
52 | (version "4.14") | |
cba988ed LC |
53 | (source (origin |
54 | (method url-fetch) | |
55 | (uri (string-append "mirror://gnu/a2ps/a2ps-" | |
56 | version ".tar.gz")) | |
57 | (sha256 | |
58 | (base32 | |
59 | "195k78m1h03m961qn7jr120z815iyb93gwi159p1p9348lyqvbpk")) | |
60 | (modules '((guix build utils))) | |
61 | (snippet | |
62 | ;; Remove timestamp from the installed 'README' file. | |
6cbee49d MW |
63 | '(begin |
64 | (substitute* "etc/README.in" | |
65 | (("@date@") | |
66 | "1st of some month, sometime after 1970")) | |
67 | #t)) | |
cba988ed LC |
68 | (patches (search-patches |
69 | "a2ps-CVE-2001-1593.patch" | |
841bddb4 EF |
70 | "a2ps-CVE-2014-0466.patch" |
71 | "a2ps-CVE-2015-8107.patch")))) | |
58310341 EB |
72 | (build-system gnu-build-system) |
73 | (inputs | |
74 | `(("psutils" ,psutils) | |
58310341 EB |
75 | ("gv" ,gv) |
76 | ("imagemagick" ,imagemagick))) | |
77 | (native-inputs | |
78 | `(("gperf" ,gperf) | |
6e834bdd | 79 | ("groff" ,groff) |
c198872b | 80 | ("perl" ,perl))) |
58310341 | 81 | (arguments |
d01f680c EF |
82 | '(#:phases |
83 | (modify-phases %standard-phases | |
84 | (add-before 'build 'patch-scripts | |
85 | (lambda _ | |
86 | (substitute* | |
87 | '("afm/make_fonts_map.sh" | |
88 | "tests/defs" | |
89 | "tests/backup.tst" | |
90 | "tests/styles.tst") | |
91 | (("/bin/rm") (which "rm"))))) | |
92 | (add-before 'check 'patch-test-files | |
93 | ;; Alternatively, we could unpatch the shebangs in tstfiles | |
94 | (lambda* (#:key inputs #:allow-other-keys) | |
95 | (let ((perl (assoc-ref inputs "perl"))) | |
96 | (substitute* '("tests/ps-ref/includeres.ps" | |
97 | "tests/gps-ref/includeres.ps") | |
98 | (("/usr/local/bin/perl") | |
99 | (string-append perl "/bin/perl")))) | |
100 | ;; Some of the reference postscript contain a 'version 3' | |
101 | ;; string that in inconsistent with the source text in the | |
102 | ;; tstfiles directory. Erroneous search-and-replace? | |
103 | (substitute* '("tests/ps-ref/InsertBlock.ps" | |
104 | "tests/gps-ref/InsertBlock.ps" | |
105 | "tests/ps-ref/bookie.ps" | |
106 | "tests/gps-ref/bookie.ps") | |
107 | (("version 3") "version 2")) | |
108 | (substitute* '("tests/ps-ref/psmandup.ps" | |
109 | "tests/gps-ref/psmandup.ps") | |
110 | (("#! */bin/sh") (string-append | |
111 | "#!" (which "sh"))))))))) | |
6fd52309 | 112 | (home-page "https://www.gnu.org/software/a2ps/") |
58310341 EB |
113 | (synopsis "Any file to PostScript, including pretty-printing") |
114 | (description | |
115 | "GNU a2ps converts almost anything to a PostScript file, ready for | |
35b9e423 | 116 | printing. It accomplishes this by being able to delegate files to external |
58310341 EB |
117 | handlers, such as Groff and Gzip. It handles as many steps as is necessary to |
118 | produce a pretty-printed file. It also includes some extra abilities for | |
119 | special cases, such as pretty-printing \"--help\" output.") | |
120 | (license gpl3+))) | |
121 | ||
122 | (define-public trueprint | |
123 | (package | |
124 | (name "trueprint") | |
125 | (version "5.4") | |
126 | (source | |
127 | (origin | |
128 | (method url-fetch) | |
129 | (uri (string-append "mirror://gnu/trueprint/trueprint-" | |
130 | version ".tar.gz")) | |
131 | (sha256 | |
132 | (base32 | |
133 | "13rkc0fga10xyf56yy9dnq95zndnfadkhxflnp24skszj21y8jqh")))) | |
134 | (build-system gnu-build-system) | |
58310341 EB |
135 | (arguments |
136 | ;; Must define DIFF_CMD for tests to pass | |
c198872b | 137 | '(#:configure-flags '("CPPFLAGS=-DDIFF_CMD=\\\"diff\\\""))) |
6fd52309 | 138 | (home-page "https://www.gnu.org/software/trueprint/") |
58310341 EB |
139 | (synopsis "Pretty-print C sources and other plain text to PostScript") |
140 | (description | |
141 | "GNU Trueprint translates C source code files as PostScript files. | |
142 | In addition to the basic source code output, it can also perform diff-marking, | |
143 | indentation counting, function and file indices and more.") | |
144 | (license gpl2))) | |
145 | ||
146 | (define-public enscript | |
147 | (package | |
148 | (name "enscript") | |
149 | (version "1.6.6") | |
150 | (source | |
151 | (origin | |
152 | (method url-fetch) | |
153 | (uri (string-append "mirror://gnu/enscript/enscript-" | |
154 | version ".tar.gz")) | |
155 | (sha256 | |
156 | (base32 | |
157 | "1fy0ymvzrrvs889zanxcaxjfcxarm2d3k43c9frmbl1ld7dblmkd")))) | |
158 | (build-system gnu-build-system) | |
6fd52309 | 159 | (home-page "https://www.gnu.org/software/enscript/") |
58310341 EB |
160 | (synopsis "Generating PostScript, including pretty-printing") |
161 | (description | |
162 | "GNU Enscript is a program to convert ASCII text files to PostScript, | |
e881752c | 163 | HTML or RTF formats, to be stored in files or sent immediately to a printer. |
58310341 EB |
164 | It also includes the capability to perform syntax highlighting for several |
165 | different programming languages.") | |
166 | (license gpl3+))) | |
167 | ||
0a15ee7b MB |
168 | (define-public fmt |
169 | (package | |
170 | (name "fmt") | |
8be782c7 | 171 | (version "6.1.2") |
0a15ee7b | 172 | (source (origin |
ece22a25 PN |
173 | (method url-fetch) |
174 | (uri (string-append "https://github.com/fmtlib/fmt/releases/download/" | |
175 | version "/fmt-" version ".zip")) | |
0a15ee7b MB |
176 | (sha256 |
177 | (base32 | |
ece22a25 | 178 | "1s1hxaby5byb07rgmrk4a0q11fxhz7b42khch7sp2qx974y0yrb3")))) |
0a15ee7b | 179 | (build-system cmake-build-system) |
71ce0b52 MB |
180 | (arguments |
181 | '(#:configure-flags '("-DBUILD_SHARED_LIBS=ON"))) | |
0a15ee7b MB |
182 | (native-inputs |
183 | `(("unzip" ,unzip))) | |
366c2c8f | 184 | (home-page "https://fmt.dev") |
0a15ee7b MB |
185 | (synopsis "Small and fast C++ formatting library") |
186 | (description | |
187 | "@code{fmt} (formerly @code{cppformat}) is a formatting library for C++. | |
188 | It can be used as a safe alternative to @code{printf} or as a fast alternative | |
189 | to @code{IOStreams}.") | |
190 | ;; The library is bsd-2, but documentation and tests include other licenses. | |
191 | (license (list bsd-2 bsd-3 psfl)))) | |
192 | ||
58310341 EB |
193 | (define-public source-highlight |
194 | (package | |
195 | (name "source-highlight") | |
e4da86f3 | 196 | (version "3.1.9") |
58310341 EB |
197 | (source |
198 | (origin | |
199 | (method url-fetch) | |
200 | (uri (string-append "mirror://gnu/src-highlite/source-highlight-" | |
201 | version ".tar.gz")) | |
202 | (sha256 | |
203 | (base32 | |
e4da86f3 | 204 | "148w47k3zswbxvhg83z38ifi85f9dqcpg7icvvw1cm6bg21x4zrs")))) |
58310341 EB |
205 | (build-system gnu-build-system) |
206 | ;; The ctags that comes with emacs does not support the --excmd options, | |
207 | ;; so can't be used | |
208 | (inputs | |
8a1f6a7e | 209 | `(("boost" ,boost))) |
58310341 EB |
210 | (native-inputs |
211 | `(("bison" ,bison) | |
c198872b | 212 | ("flex" ,flex))) |
58310341 EB |
213 | (arguments |
214 | `(#:configure-flags | |
215 | (list (string-append "--with-boost=" | |
216 | (assoc-ref %build-inputs "boost"))) | |
217 | #:parallel-tests? #f ;There appear to be race conditions | |
dc1d3cde KK |
218 | #:phases |
219 | (modify-phases %standard-phases | |
220 | (add-before 'check 'patch-test-files | |
221 | (lambda _ | |
222 | ;; Unpatch shebangs in test input so that source-highlight | |
223 | ;; is still able to infer input language | |
224 | (substitute* '("tests/test.sh" | |
225 | "tests/test2.sh" | |
226 | "tests/test.tcl") | |
227 | (((string-append "#! *" (which "sh"))) "#!/bin/sh")) | |
228 | ;; Initial patching unrecoverably removes whitespace, so | |
229 | ;; remove it also in the comparison output. | |
230 | (substitute* '("tests/test.sh.html" | |
231 | "tests/test2.sh.html" | |
232 | "tests/test.tcl.html") | |
233 | (("#! */bin/sh") "#!/bin/sh")) | |
234 | #t))))) | |
6fd52309 | 235 | (home-page "https://www.gnu.org/software/src-highlite/") |
58310341 EB |
236 | (synopsis "Produce a document with syntax highlighting from a source file") |
237 | (description | |
238 | "GNU source-highlight reads in a source code file and produces an output | |
239 | file in which the keywords are highlighted in different colors to designate | |
240 | their syntactic role. It supports over 150 different languages and it can | |
241 | output to 8 different formats, including HTML, LaTeX and ODF. It can also | |
242 | output to ANSI color escape sequences, so that highlighted source code can be | |
243 | seen in a terminal.") | |
63e8bb12 LC |
244 | (license gpl3+) |
245 | (properties '((ftp-directory . "/gnu/src-highlite"))))) | |
47833c90 | 246 | |
57b94e9d RW |
247 | (define-public highlight |
248 | (package | |
249 | (name "highlight") | |
34032ff5 | 250 | (version "3.54") |
57b94e9d RW |
251 | (source |
252 | (origin | |
253 | (method url-fetch) | |
254 | (uri (string-append "http://www.andre-simon.de/zip/highlight-" | |
255 | version ".tar.bz2")) | |
256 | (sha256 | |
34032ff5 | 257 | (base32 "1l6nxk3vwd7rkxpq9aqisjyps89r008wzn3abh4566q6jigahl4a")))) |
57b94e9d RW |
258 | (build-system gnu-build-system) |
259 | (arguments | |
3a5c0277 | 260 | `(#:tests? #f ; no tests |
57b94e9d RW |
261 | #:make-flags |
262 | (let ((confdir (string-append %output "/share/highlight/config/"))) | |
263 | (list (string-append "PREFIX=" %output) | |
264 | (string-append "HL_CONFIG_DIR=" confdir) | |
265 | (string-append "conf_dir=" confdir))) | |
266 | #:phases | |
267 | (modify-phases %standard-phases | |
3a5c0277 | 268 | (delete 'configure) ; no configure script |
57b94e9d RW |
269 | (add-after 'unpack 'fix-search-for-lua |
270 | (lambda _ | |
271 | (substitute* "src/makefile" | |
15ceaa91 TGR |
272 | (("(LUA_PKG_NAME=).*" _ assignment) |
273 | (string-append assignment "lua-" ,(version-major+minor | |
274 | (package-version lua)) | |
275 | "\n"))) | |
b24d523e PG |
276 | (substitute* "extras/swig/makefile" |
277 | (("lua") (string-append "lua-" ,(version-major+minor | |
278 | (package-version lua))))) | |
279 | #t)) | |
280 | (add-after 'install 'install-perl-bindings | |
281 | (lambda* (#:key outputs #:allow-other-keys) | |
282 | (let* ((perldir (string-append (assoc-ref outputs "out") | |
283 | "/lib/perl5/site_perl/" | |
284 | ,(package-version perl))) | |
285 | (autodir (string-append perldir "/auto/highlight"))) | |
286 | (with-directory-excursion "extras/swig" | |
287 | (invoke "make" "perl") | |
288 | (invoke "perl" "-I" "." "testmod.pl") | |
289 | (install-file "highlight.pm" perldir) | |
290 | (install-file "highlight.so" autodir)) | |
291 | #t)))))) | |
57b94e9d RW |
292 | (inputs |
293 | `(("lua" ,lua) | |
b24d523e PG |
294 | ("boost" ,boost) |
295 | ("perl" ,perl))) | |
57b94e9d | 296 | (native-inputs |
b24d523e PG |
297 | `(("pkg-config" ,pkg-config) |
298 | ("swig" ,swig))) | |
57b94e9d RW |
299 | (home-page "http://www.andre-simon.de/doku/highlight/en/highlight.php") |
300 | (synopsis "Convert code to documents with syntax highlighting") | |
301 | (description "Highlight converts source code to HTML, XHTML, RTF, LaTeX, | |
302 | TeX, SVG, BBCode and terminal escape sequences with colored syntax | |
303 | highlighting. Language definitions and color themes are customizable.") | |
304 | (license gpl3+))) |