gnu: Add drm-tools.
[jackhill/guix/guix.git] / gnu / packages / textutils.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2015 Taylan Ulrich Bayırlı/Kammer <taylanbayirli@gmail.com>
3 ;;; Copyright © 2015, 2016, 2017, 2018, 2019 Ricardo Wurmus <rekado@elephly.net>
4 ;;; Copyright © 2015, 2016 Ben Woodcroft <donttrustben@gmail.com>
5 ;;; Copyright © 2015 Roel Janssen <roel@gnu.org>
6 ;;; Copyright © 2016 Jelle Licht <jlicht@fsfe.org>
7 ;;; Copyright © 2016 Alex Griffin <a@ajgrf.com>
8 ;;; Copyright © 2016, 2018, 2019 Efraim Flashner <efraim@flashner.co.il>
9 ;;; Copyright © 2016 Nikita <nikita@n0.is>
10 ;;; Copyright © 2016 Marius Bakke <mbakke@fastmail.com>
11 ;;; Copyright © 2017 Eric Bavier <bavier@member.fsf.org>
12 ;;; Copyright © 2017 Rene Saavedra <rennes@openmailbox.org>
13 ;;; Copyright © 2017,2019 Hartmut Goebel <h.goebel@crazy-compilers.com>
14 ;;; Copyright © 2017 Kei Kebreau <kkebreau@posteo.net>
15 ;;; Copyright © 2017 Alex Vong <alexvong1995@gmail.com>
16 ;;; Copyright © 2018, 2019, 2020 Tobias Geerinckx-Rice <me@tobias.gr>
17 ;;; Copyright © 2018 Pierre Neidhardt <mail@ambrevar.xyz>
18 ;;; Copyright © 2018 Meiyo Peng <meiyo.peng@gmail.com>
19 ;;; Copyright © 2019 Yoshinori Arai <kumagusu08@gmail.com>
20 ;;; Copyright © 2019 Mădălin Ionel Patrașcu <madalinionel.patrascu@mdc-berlin.de>
21 ;;; Copyright © 2019 Wiktor Żelazny <wzelazny@vurv.cz>
22 ;;; Copyright © 2020 Maxim Cournoyer <maxim.cournoyer@gmail.com>
23 ;;;
24 ;;; This file is part of GNU Guix.
25 ;;;
26 ;;; GNU Guix is free software; you can redistribute it and/or modify it
27 ;;; under the terms of the GNU General Public License as published by
28 ;;; the Free Software Foundation; either version 3 of the License, or (at
29 ;;; your option) any later version.
30 ;;;
31 ;;; GNU Guix is distributed in the hope that it will be useful, but
32 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
33 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
34 ;;; GNU General Public License for more details.
35 ;;;
36 ;;; You should have received a copy of the GNU General Public License
37 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
38
39 (define-module (gnu packages textutils)
40 #:use-module ((guix licenses) #:prefix license:)
41 #:use-module (guix packages)
42 #:use-module (guix download)
43 #:use-module (guix git-download)
44 #:use-module (guix build-system ant)
45 #:use-module (guix build-system gnu)
46 #:use-module (guix build-system go)
47 #:use-module (guix build-system cmake)
48 #:use-module (guix build-system python)
49 #:use-module (gnu packages)
50 #:use-module (gnu packages autotools)
51 #:use-module (gnu packages base)
52 #:use-module (gnu packages compression)
53 #:use-module (gnu packages gcc)
54 #:use-module (gnu packages gettext)
55 #:use-module (gnu packages java)
56 #:use-module (gnu packages ncurses)
57 #:use-module (gnu packages pcre)
58 #:use-module (gnu packages perl)
59 #:use-module (gnu packages pkg-config)
60 #:use-module (gnu packages python)
61 #:use-module (gnu packages python-xyz)
62 #:use-module (gnu packages readline)
63 #:use-module (gnu packages slang)
64 #:use-module (gnu packages web))
65
66 (define-public dos2unix
67 (package
68 (name "dos2unix")
69 (version "7.4.1")
70 (source
71 (origin
72 (method url-fetch)
73 (uri (string-append "https://waterlan.home.xs4all.nl/dos2unix/"
74 "dos2unix-" version ".tar.gz"))
75 (sha256
76 (base32 "08w6yywzirsxq8bh87jycvvw922ybhc2l426j2iqzliyn1h8mm8w"))))
77 (build-system gnu-build-system)
78 (arguments
79 '(#:make-flags (list "CC=gcc"
80 (string-append "prefix=" (assoc-ref %outputs "out")))
81 #:phases
82 (modify-phases %standard-phases
83 (delete 'configure)))) ; no configure script
84 (native-inputs
85 `(("gettext" ,gettext-minimal)
86 ("perl" ,perl)))
87 (home-page "https://waterlan.home.xs4all.nl/dos2unix.html")
88 (synopsis "DOS/Mac to Unix and vice versa text file format converter")
89 (description
90 "dos2unix is a tool to convert line breaks in a text file from Unix format
91 to DOS format and vice versa.")
92 (license license:bsd-2)))
93
94 (define-public recode
95 (package
96 (name "recode")
97 (version "3.7.6")
98 (source
99 (origin
100 (method url-fetch)
101 (uri (string-append "https://github.com/rrthomas/recode/releases/"
102 "download/v" version "/recode-" version ".tar.gz"))
103 (sha256
104 (base32 "0m59sd1ca0zw1aydpc3m8sw03nc885knmccqryg7byzmqs585ia6"))))
105 (build-system gnu-build-system)
106 (native-inputs
107 `(("python" ,python)
108 ("python-cython" ,python-cython)))
109 (home-page "https://github.com/rrthomas/recode")
110 (synopsis "Text encoding converter")
111 (description "The Recode library converts files between character sets and
112 usages. It recognises or produces over 200 different character sets (or about
113 300 if combined with an iconv library) and transliterates files between almost
114 any pair. When exact transliteration are not possible, it gets rid of
115 offending characters or falls back on approximations. The recode program is a
116 handy front-end to the library.")
117 (license license:gpl3+)))
118
119 (define-public enca
120 (package
121 (name "enca")
122 (version "1.19")
123 (source
124 (origin
125 (method git-fetch)
126 (uri (git-reference
127 (url "https://github.com/nijel/enca")
128 (commit version)))
129 (file-name (git-file-name name version))
130 (sha256
131 (base32 "19q7cwwxmmk5j9438bsqdpjvdjawsd3zmw1zyqgi7s4m0rasr3ah"))))
132 (build-system gnu-build-system)
133 ;; enca-1.19 tests fail with recent recode.
134 ;(inputs `(("recode" ,recode)))
135 (home-page "https://github.com/nijel/enca")
136 (synopsis "Text encoding detection tool")
137 (description "Enca (Extremely Naive Charset Analyser) consists of libenca,
138 an encoding detection library, and enca, a command line frontend, integrating
139 libenca and several charset conversion libraries and tools.")
140 (license license:gpl2)))
141
142 (define-public utf8proc
143 (package
144 (name "utf8proc")
145 (version "2.5.0")
146 (source
147 (origin
148 (method git-fetch)
149 (uri (git-reference
150 (url "https://github.com/JuliaStrings/utf8proc")
151 (commit (string-append "v" version))))
152 (file-name (git-file-name name version))
153 (sha256
154 (base32 "1xlkazhdnja4lksn5c9nf4bln5gjqa35a8gwlam5r0728w0h83qq"))))
155 (build-system gnu-build-system)
156 (native-inputs
157 (let ((UNICODE_VERSION "13.0.0")) ; defined in data/Makefile
158 ;; Test data that is otherwise downloaded with curl.
159 `(("NormalizationTest.txt"
160 ,(origin
161 (method url-fetch)
162 (uri (string-append "https://www.unicode.org/Public/"
163 UNICODE_VERSION "/ucd/NormalizationTest.txt"))
164 (sha256
165 (base32 "07g0ya4f6zfzvpp24ccxkb2yq568kh83gls85rjl950nv5fya3nn"))))
166 ("GraphemeBreakTest.txt"
167 ,(origin
168 (method url-fetch)
169 (uri (string-append "https://www.unicode.org/Public/"
170 UNICODE_VERSION
171 "/ucd/auxiliary/GraphemeBreakTest.txt"))
172 (sha256
173 (base32 "07f8rrvcsq4pibdz6zxggxy8w7zjjqyw2ggclqlhalyv45yv7prj"))))
174
175 ;; For tests.
176 ("perl" ,perl))))
177 (arguments
178 '(#:make-flags (list "CC=gcc"
179 (string-append "prefix=" (assoc-ref %outputs "out")))
180 #:phases
181 (modify-phases %standard-phases
182 (delete 'configure)
183 (add-before 'check 'check-data
184 (lambda* (#:key inputs #:allow-other-keys)
185 (for-each (lambda (i)
186 (copy-file (assoc-ref inputs i)
187 (string-append "data/" i)))
188 '("NormalizationTest.txt" "GraphemeBreakTest.txt"))
189 (substitute* "data/GraphemeBreakTest.txt"
190 (("÷") "/")
191 (("×") "+"))
192 #t)))))
193 (home-page "https://juliastrings.github.io/utf8proc/")
194 (synopsis "C library for processing UTF-8 Unicode data")
195 (description "utf8proc is a small C library that provides Unicode
196 normalization, case-folding, and other operations for data in the UTF-8
197 encoding, supporting Unicode version 9.0.0.")
198 (license license:expat)))
199
200 (define-public libconfuse
201 (package
202 (name "libconfuse")
203 (version "3.2.2")
204 (source
205 (origin
206 (method url-fetch)
207 (uri (string-append "https://github.com/martinh/libconfuse/"
208 "releases/download/v" version
209 "/confuse-" version ".tar.xz"))
210 (sha256
211 (base32 "02r1mmzik2m0iigbc2da3y754vj24i18r3ml5p2wzs027mjhn959"))))
212 (build-system gnu-build-system)
213 (home-page "https://github.com/martinh/libconfuse")
214 (synopsis "Configuration file parser library")
215 (description "libconfuse is a configuration file parser library. It
216 supports sections and (lists of) values (strings, integers, floats, booleans
217 or other sections), as well as some other features (such as
218 single/double-quoted strings, environment variable expansion, functions and
219 nested include statements).")
220 (license license:isc)))
221
222 (define-public libgtextutils
223 (package
224 (name "libgtextutils")
225 (version "0.7")
226 (source
227 (origin
228 (method url-fetch)
229 (uri (string-append
230 "https://github.com/agordon/libgtextutils/releases/download/"
231 version "/libgtextutils-" version ".tar.gz"))
232 (sha256
233 (base32 "0jiybkb2z58wa2msvllnphr4js2hvjvh988pavb3mzkgr6ihwbkr"))))
234 (build-system gnu-build-system)
235 (arguments
236 '(#:phases
237 (modify-phases %standard-phases
238 (replace 'bootstrap
239 (lambda _ (invoke "sh" "reconf"))))))
240 (native-inputs
241 `(("autoconf" ,autoconf)
242 ("automake" ,automake)
243 ("gcc" ,gcc-5) ;; doesn't build with later versions
244 ("libtool" ,libtool)))
245 (home-page "https://github.com/agordon/libgtextutils")
246 (synopsis "Gordon's text utils library")
247 (description
248 "libgtextutils is a text utilities library used by the fastx toolkit from
249 the Hannon Lab.")
250 (license license:agpl3+)))
251
252 (define-public cityhash
253 (let ((commit "8af9b8c"))
254 (package
255 (name "cityhash")
256 (version (string-append "1.1-2." commit))
257 (source (origin
258 (method git-fetch)
259 (uri (git-reference
260 (url "https://github.com/google/cityhash.git")
261 (commit commit)))
262 (file-name (string-append name "-" version ".tar.gz"))
263 (sha256
264 (base32
265 "0n6skf5dv8yfl1ckax8dqhvsbslkwc9158zf2ims0xqdvzsahbi6"))))
266 (build-system gnu-build-system)
267 (arguments
268 '(#:make-flags (list "CXXFLAGS=-g -O3")
269 #:phases
270 (modify-phases %standard-phases
271 ;; citycrc is not installed by default but is used by some
272 ;; programs.
273 (add-after 'install 'install-citycrc
274 (lambda* (#:key outputs #:allow-other-keys)
275 (let* ((out (assoc-ref outputs "out"))
276 (include (string-append out "/include")))
277 (install-file "src/citycrc.h" include))
278 #t)))))
279 (home-page "https://github.com/google/cityhash")
280 (synopsis "C++ hash functions for strings")
281 (description
282 "CityHash provides hash functions for strings. The functions mix the
283 input bits thoroughly but are not suitable for cryptography.")
284 (license license:expat))))
285
286 (define-public ustr
287 (package
288 (name "ustr")
289 (version "1.0.4")
290 (source (origin
291 (method url-fetch)
292 (uri (string-append "http://www.and.org/ustr/" version
293 "/ustr-" version ".tar.bz2"))
294 (sha256
295 (base32
296 "1i623ygdj7rkizj7985q9d6vj5amwg686aqb5j3ixpkqkyp6xbrx"))
297 (patches (search-patches "ustr-fix-build-with-gcc-5.patch"))))
298 (build-system gnu-build-system)
299 (arguments
300 `(#:make-flags
301 (list "CC=gcc"
302 "HIDE="
303 ;; Override "/sbin/ldconfig" with "echo" because we don't need
304 ;; "ldconfig".
305 "LDCONFIG=echo"
306 (string-append "prefix=" (assoc-ref %outputs "out"))
307 "all-shared")
308 #:phases
309 (modify-phases %standard-phases
310 (add-after 'unpack 'disable-check-for-stdint
311 (lambda _
312 ;; Of course we have stdint.h, just not in /usr/include
313 (substitute* '("Makefile"
314 "ustr-import.in")
315 (("-f \"/usr/include/stdint.h\"") "-z \"\""))
316 #t))
317 ;; No configure script
318 (delete 'configure))))
319 (home-page "http://www.and.org/ustr/")
320 (synopsis "String library with very low memory overhead")
321 (description
322 "Ustr is a string library for C with very low memory overhead.")
323 ;; Quoted from the home page: "The License for the code is MIT, new-BSD,
324 ;; LGPL, etc. ... if you need another license to help compatibility, just
325 ;; ask for it. It's basically public domain, without all the legal
326 ;; problems for everyone that trying to make something public domain
327 ;; entails."
328 (license license:public-domain)))
329
330 (define-public ascii2binary
331 (package
332 (name "ascii2binary")
333 (version "2.14")
334 (source
335 (origin
336 (method url-fetch)
337 (uri (string-append "http://billposer.org/Software/Downloads/"
338 "ascii2binary-" version ".tar.bz2"))
339 (sha256
340 (base32 "0dc9fxcdmppbs9s06jvq61zbk552laxps0xyk098gj41697ihd96"))))
341 (build-system gnu-build-system)
342 (native-inputs
343 `(("gettext" ,gettext-minimal)))
344 (home-page "https://billposer.org/Software/a2b.html")
345 (synopsis "Convert between ASCII, hexadecimal and binary representations")
346 (description "The two programs are useful for generating test data, for
347 inspecting binary files, and for interfacing programs that generate textual
348 output to programs that require binary input and conversely. They can also be
349 useful when it is desired to reformat numbers.
350
351 @itemize
352
353 @item @command{ascii2binary} reads input consisting of ascii or hexadecimal
354 representation numbers separated by whitespace and produces as output
355 the binary equivalents. The type and precision of the binary output
356 is selected using command line flags.
357
358 @item @command{binary2ascii} reads input consisting of binary numbers
359 and converts them to their ascii or hexadecimal representation.
360 Command line flags specify the type and size of the binary numbers
361 and provide control over the format of the output.
362 Unsigned integers may be written out in binary, octal, decimal,
363 or hexadecimal.
364
365 Signed integers may be written out only in binary or decimal. Floating
366 point numbers may be written out only decimal, either in standard or
367 scientific notation. (If you want to examine the binary representation
368 of floating point numbers, just treat the input as a sequence of unsigned
369 characters.)
370
371 @end itemize")
372 (license license:gpl3)))
373
374 (define-public uniutils
375 (package
376 (name "uniutils")
377 (version "2.27")
378 (source
379 (origin
380 (method url-fetch)
381 (uri (string-append "http://billposer.org/Software/Downloads/"
382 "uniutils-" version ".tar.bz2"))
383 (sha256
384 (base32 "19w1510w87gx7n4qy3zsb0m467a4rn5scvh4ajajg7jh6x5xri08"))))
385 (build-system gnu-build-system)
386 (arguments
387 '(#:configure-flags '("--disable-dependency-tracking")
388 #:phases
389 (modify-phases %standard-phases
390 (add-after 'build 'fix-paths
391 (lambda* (#:key outputs inputs #:allow-other-keys)
392 (let ((out (assoc-ref outputs "out"))
393 (a2b (assoc-ref inputs "ascii2binary"))
394 (iconv (assoc-ref inputs "libiconv")))
395 (substitute* "utf8lookup"
396 (("^ascii2binary ") (string-append a2b "/bin/ascii2binary "))
397 (("^uniname ") (string-append out "/bin/uniname "))
398 (("^iconv ") (string-append iconv "/bin/iconv ")))
399 #t))))))
400 (inputs
401 `(("ascii2binary" ,ascii2binary)
402 ("libiconv" ,libiconv)))
403 (home-page "https://billposer.org/Software/unidesc.html")
404 (synopsis "Find out what is in a Unicode file")
405 (description "Useful tools when working with Unicode files when one
406 doesn't know the writing system, doesn't have the necessary font, needs to
407 inspect invisible characters, needs to find out whether characters have been
408 combined or in what order they occur, or needs statistics on which characters
409 occur.
410
411 @itemize
412
413 @item @command{uniname} defaults to printing the character offset of each
414 character, its byte offset, its hex code value, its encoding, the glyph
415 itself, and its name. It may also be used to validate UTF-8 input.
416
417 @item @command{unidesc} reports the character ranges to which different
418 portions of the text belong. It can also be used to identify Unicode encodings
419 (e.g. UTF-16be) flagged by magic numbers.
420
421 @item @command{unihist} generates a histogram of the characters in its input.
422
423 @item @command{ExplicateUTF8} is intended for debugging or for learning about
424 Unicode. It determines and explains the validity of a sequence of bytes as a
425 UTF8 encoding.
426
427 @item @command{utf8lookup} provides a handy way to look up Unicode characters
428 from the command line.
429
430 @item @command{unireverse} reverse each line of UTF-8 input
431 character-by-character.
432
433 @end itemize")
434 (license license:gpl3)))
435
436 (define-public libconfig
437 (package
438 (name "libconfig")
439 (version "1.7.2")
440 (home-page "https://hyperrealm.github.io/libconfig/")
441 (source (origin
442 (method url-fetch)
443 (uri (string-append home-page "/dist/libconfig-"
444 version ".tar.gz"))
445 (sha256
446 (base32
447 "1ngs2qx3cx5cbwinc5mvadly0b5n7s86zsc68c404czzfff7lg3w"))))
448 (build-system gnu-build-system)
449 (synopsis "C/C++ configuration file library")
450 (description
451 "Libconfig is a simple library for manipulating structured configuration
452 files. This file format is more compact and more readable than XML. And
453 unlike XML, it is type-aware, so it is not necessary to do string parsing in
454 application code.")
455 (license license:lgpl2.1+)))
456
457 (define-public pfff
458 (package
459 (name "pfff")
460 (version "1.0")
461 (source (origin
462 (method git-fetch)
463 (uri (git-reference
464 (url "https://github.com/pfff/pfff")
465 (commit (string-append "v" version))))
466 (file-name (git-file-name name version))
467 (sha256
468 (base32
469 "1nxkfm7zliq3rmr7yp871sppwfnz71iz364m2sgazny71pzykggc"))))
470 (build-system cmake-build-system)
471 (home-page "https://biit.cs.ut.ee/pfff/")
472 (synopsis "Probabilistic fast file fingerprinting tool")
473 (description
474 "pfff is a tool for calculating a compact digital fingerprint of a file
475 by sampling randomly from the file instead of reading it in full.
476 Consequently, the computation has a flat performance characteristic,
477 correlated with data variation rather than file size. pfff can be as reliable
478 as existing hashing techniques, with provably negligible risk of collisions.")
479 (license license:bsd-3)))
480
481 (define-public oniguruma
482 (package
483 (name "oniguruma")
484 (version "6.9.5-rev1")
485 (source (origin
486 (method url-fetch)
487 (uri (string-append "https://github.com/kkos/"
488 "oniguruma/releases/download/v"
489 ;; If there is a "-" in the version, convert
490 ;; to underscore for this part of the URI.
491 (string-map (lambda (c) (if (char=? #\- c) #\_ c))
492 version)
493 "/onig-" version ".tar.gz"))
494 (sha256
495 (base32
496 "17m92k1n6bvza6m35fpd5g36zwpwm3hfz3478iwj5bvj2sfq8g6k"))))
497 (build-system gnu-build-system)
498 (arguments '(#:configure-flags '("--disable-static")))
499 (home-page "https://github.com/kkos/oniguruma")
500 (synopsis "Regular expression library")
501 (description "Oniguruma is a regular expressions library. The special
502 characteristic of this library is that different character encoding for every
503 regular expression object can be specified.")
504 (license license:bsd-2)))
505
506 (define-public antiword
507 (package
508 (name "antiword")
509 (version "0.37")
510 (source (origin
511 (method url-fetch)
512 (uri (string-append "http://www.winfield.demon.nl/linux"
513 "/antiword-" version ".tar.gz"))
514 (sha256
515 (base32
516 "1b7mi1l20jhj09kyh0bq14qzz8vdhhyf35gzwsq43mn6rc7h0b4f"))
517 (patches (search-patches "antiword-CVE-2014-8123.patch"))))
518 (build-system gnu-build-system)
519 (arguments
520 `(#:tests? #f ; There are no tests
521 #:make-flags
522 (list "-f" "Makefile.Linux"
523 (string-append "GLOBAL_INSTALL_DIR="
524 (assoc-ref %outputs "out") "/bin")
525 (string-append "GLOBAL_RESOURCES_DIR="
526 (assoc-ref %outputs "out") "/share/antiword"))
527 #:phases
528 (modify-phases %standard-phases
529 (replace 'configure
530 (lambda* (#:key outputs #:allow-other-keys)
531 ;; Ensure that mapping files can be found in the actual package
532 ;; data directory.
533 (substitute* "antiword.h"
534 (("/usr/share/antiword")
535 (string-append (assoc-ref outputs "out") "/share/antiword")))
536 #t))
537 (replace 'install
538 (lambda* (#:key make-flags #:allow-other-keys)
539 (apply invoke "make" `("global_install" ,@make-flags)))))))
540 (home-page "http://www.winfield.demon.nl/")
541 (synopsis "Microsoft Word document reader")
542 (description "Antiword is an application for displaying Microsoft Word
543 documents. It can also convert the document to PostScript or XML. Only
544 documents made by MS Word version 2 and version 6 or later are supported. The
545 name comes from: \"The antidote against people who send Microsoft Word files
546 to everybody, because they believe that everybody runs Windows and therefore
547 runs Word\".")
548 (license license:gpl2+)))
549
550 (define-public catdoc
551 (package
552 (name "catdoc")
553 (version "0.95")
554 (source (origin
555 (method url-fetch)
556 (uri (string-append "http://ftp.wagner.pp.ru/pub/catdoc/"
557 "catdoc-" version ".tar.gz"))
558 (patches (search-patches "catdoc-CVE-2017-11110.patch"))
559 (sha256
560 (base32
561 "15h7v3bmwfk4z8r78xs5ih6vd0pskn0rj90xghvbzdjj0cc88jji"))))
562 (build-system gnu-build-system)
563 ;; TODO: Also build `wordview` which requires `tk` – make a separate
564 ;; package for this.
565 (arguments
566 '(#:tests? #f ; There are no tests
567 #:configure-flags '("--disable-wordview")
568 #:phases
569 (modify-phases %standard-phases
570 (add-before 'install 'fix-install
571 (lambda* (#:key outputs #:allow-other-keys)
572 (let ((out (assoc-ref outputs "out")))
573 (mkdir-p (string-append out "/share/man/man1"))))))))
574 (home-page "https://www.wagner.pp.ru/~vitus/software/catdoc/")
575 (synopsis "MS-Word to TeX or plain text converter")
576 (description "@command{catdoc} extracts text from MS-Word files, trying to
577 preserve as many special printable characters as possible. It supports
578 everything up to Word-97. Also supported are MS Write documents and RTF files.
579
580 @command{catdoc} does not preserve complex word formatting, but it can
581 translate some non-ASCII characters into TeX escape codes. It's goal is to
582 extract plain text and allow you to read it and, probably, reformat with TeX,
583 according to TeXnical rules.
584
585 This package also provides @command{xls2csv}, which extracts data from Excel
586 spreadsheets and outputs it in comma-separated-value format, and
587 @command{catppt}, which extracts data from PowerPoint presentations.")
588 (license license:gpl2+)))
589
590 (define-public utfcpp
591 (package
592 (name "utfcpp")
593 (version "2.3.5")
594 (source (origin
595 (method git-fetch)
596 (uri (git-reference
597 (url "https://github.com/nemtrif/utfcpp")
598 (commit (string-append "v" version))))
599 (file-name (git-file-name name version))
600 (sha256
601 (base32
602 "1gr98d826z6wa58r1s5i7rz7q2x3r31v7zj0pjjlrc7gfxwklr4s"))))
603 (build-system cmake-build-system)
604 (arguments
605 `(#:out-of-source? #f
606 #:phases
607 (modify-phases %standard-phases
608 (replace 'install ; no install target
609 (lambda* (#:key outputs #:allow-other-keys)
610 (let* ((out (assoc-ref outputs "out"))
611 (include (string-append out "/include"))
612 (doc (string-append out "/share/doc/" ,name)))
613 (copy-recursively "source" include)
614 (install-file "README.md" doc)
615 #t))))))
616 (home-page "https://github.com/nemtrif/utfcpp")
617 (synopsis "Portable C++ library for handling UTF-8")
618 (description "UTF8-CPP is a C++ library for handling UTF-8 encoded text
619 in a portable way.")
620 (license license:boost1.0)))
621
622 (define-public dbacl
623 (package
624 (name "dbacl")
625 (version "1.14.1")
626 (source
627 (origin
628 (method url-fetch)
629 (uri (string-append "mirror://sourceforge/dbacl/dbacl/" version "/"
630 "dbacl-" version ".tar.gz"))
631 (sha256
632 (base32 "1gas0112wqjvwn9qg3hxnawk7h3prr0w9b2h68f3p1ifd1kzn3gz"))
633 (patches (search-patches "dbacl-include-locale.h.patch"))))
634 (build-system gnu-build-system)
635 (arguments
636 `(#:make-flags
637 (list
638 (string-append "-I" (assoc-ref %build-inputs "slang")
639 "/include/slang")
640 (string-append "-I" (assoc-ref %build-inputs "ncurses")
641 "/include/ncurses"))
642 #:phases
643 (modify-phases %standard-phases
644 (add-after 'unpack 'delete-sample6-and-japanese
645 (lambda _
646 (substitute* "doc/Makefile.am"
647 (("sample6.txt") "")
648 (("japanese.txt") ""))
649 (delete-file "doc/sample6.txt")
650 (delete-file "doc/japanese.txt")
651 (substitute* (list "src/tests/Makefile.am"
652 "src/tests/Makefile.in")
653 (("dbacl-jap.shin") "")
654 (("dbacl-jap.sh") ""))
655 #t))
656 (add-after 'unpack 'delete-test
657 ;; See comments about the license.
658 (lambda _
659 (delete-file "src/tests/dbacl-jap.shin")
660 #t))
661 (add-after 'unpack 'fix-test-files
662 (lambda* (#:key inputs outputs #:allow-other-keys)
663 (let* ((out (assoc-ref outputs "out"))
664 (bin (string-append out "/bin")))
665 (substitute* (find-files "src/tests/" "\\.shin$")
666 (("PATH=/bin:/usr/bin")
667 "#PATH=/bin:/usr/bin")
668 (("diff") (string-append (which "diff")))
669 (("tr") (string-append (which "tr"))))
670 #t)))
671 (replace 'bootstrap
672 (lambda _
673 (invoke "autoreconf" "-vif")
674 #t)))))
675 (inputs
676 `(("ncurses" ,ncurses)
677 ("perl" ,perl)
678 ("readline" ,readline)
679 ("slang" ,slang)))
680 (native-inputs
681 `(("libtool" ,libtool)
682 ("autoconf" ,autoconf)
683 ("automake" ,automake)
684 ("pkg-config" ,pkg-config)))
685 (home-page "https://www.lbreyer.com/dbacl.html")
686 (synopsis "Bayesian text and email classifier")
687 (description
688 "dbacl is a fast Bayesian text and email classifier. It builds a variety
689 of language models using maximum entropy (minimum divergence) principles, and
690 these can then be used to categorize input data automatically among multiple
691 categories.")
692 ;; The software is licensed as GPLv3 or later, but
693 ;; includes various sample texts in the doc dir:
694 ;; - sample1.txt, sample3 and sampe5.txt are in the public domain,
695 ;; by Mark Twain.
696 ;; - sample2.txt, sample4.txt are in the public domain, by Aristotle.
697 ;; - sample6.txt is a forwarded email, copyright unknown.
698 ;; Guix does exclude sample6.txt.
699 ;; - japanese.txt is a Japanese unoffical translation of the
700 ;; GNU General Public License, (c) by the Free Software Foundation.
701 ;; Guix excludes this file.
702 (license (list license:gpl3+ license:public-domain))))
703
704 (define-public dotconf
705 (package
706 (name "dotconf")
707 (version "1.3")
708 (source (origin
709 (method git-fetch)
710 (uri (git-reference
711 (url "https://github.com/williamh/dotconf.git")
712 (commit (string-append "v" version))))
713 (file-name (git-file-name name version))
714 (sha256
715 (base32
716 "1sc95hw5k2xagpafny0v35filmcn05k1ds5ghkldfpf6xw4hakp7"))))
717 (build-system gnu-build-system)
718 (arguments `(#:tests? #f)) ; FIXME maketest.sh does not work.
719 (native-inputs
720 `(("autoconf" ,autoconf)
721 ("automake" ,automake)
722 ("libtool" ,libtool)))
723 (home-page "https://github.com/williamh/dotconf")
724 (synopsis "Configuration file parser library")
725 (description
726 "C library for creating and parsing configuration files.")
727 (license (list license:lgpl2.1 ; Main distribution.
728 license:asl1.1)))) ; src/readdir.{c,h}
729
730 (define-public drm-tools
731 (package
732 (name "drm-tools")
733 (version "1.1.33")
734 (source (origin
735 (method url-fetch)
736 (uri (string-append "mirror://sourceforge/drmtools/drm_tools-"
737 version ".tar.gz"))
738 (sha256
739 (base32
740 "187zbxw21zcg8gpyc13gxlycfw0n05a6rmqq6im5wr9zk1v1wj80"))))
741 (build-system cmake-build-system)
742 (arguments
743 `(#:tests? #f ;the test suite fails
744 #:phases (modify-phases %standard-phases
745 (add-after 'unpack 'set-install-prefixes
746 (lambda* (#:key outputs #:allow-other-keys)
747 (let* ((out (assoc-ref outputs "out")))
748 (substitute* "CMakeLists.txt"
749 (("tmp/testinstall")
750 (string-drop out 1))
751 (("/man/man1")
752 "/share/man/man1"))
753 #t)))
754 (add-after 'unpack 'adjust-test-paths
755 (lambda _
756 (substitute* '("test_extract_increment.sh"
757 "test_extract_features.sh"
758 "test_extract_features2.sh"
759 "test_dmath.sh")
760 (("\\./extract") "extract")
761 (("\\./dmath") "dmath")
762 (("/usr/local/bin/") "")
763 (("/bin/rm") "rm")
764 (("/bin/cp") "cp"))
765 #t))
766 (delete 'check)
767 ;; The produced binaries are written directly to %output/bin.
768 (delete 'install)
769 (add-after 'build 'check
770 (lambda* (#:key outputs tests? #:allow-other-keys)
771 (when tests?
772 (let* ((out (assoc-ref outputs "out"))
773 (bin (string-append out "/bin")))
774 (setenv "PATH" (string-append bin ":"
775 (getenv "PATH")))
776 (with-directory-excursion
777 (format #f "../drm_tools-~a" ,version)
778 (invoke "sh" "test_all.sh")))))))))
779 (native-inputs `(("which" ,which))) ;for tests
780 (inputs `(("pcre" ,pcre)))
781 (home-page "http://drmtools.sourceforge.net/")
782 (synopsis "Utilities to manipulate text and binary files")
783 (description "The drm_tools package contains the following commands:
784 @table @command
785 @item accudate
786 An extended version of the \"date\" program that has sub-second accuracy.
787 @item binformat
788 Format complex binary data into text.
789 @item binload
790 Load data into a binary file using simple commands from the input.
791 @item binorder
792 Sort, merge, search, retrieve or generate test data consisting of fixed size
793 binary records.
794 @item binreplace
795 Find or find/replace in binary files.
796 @item binsplit
797 Split test data consisting of fixed size binary records into one or more
798 output streams.
799 @item chardiff
800 Find changes between two files at the character level. Unlike \"diff\", it
801 lists just the characters that differ, so if the 40,000th character is
802 different only that one character will be shown, not the entire line.
803 @item columnadd
804 Add columns of integers, decimals, and/or times.
805 @item datasniffer
806 A utility for formatting binary data dumps.
807 @item dmath
808 Double precision interactive command line math calculator.
809 @item extract
810 Extract and emit data from text files based on character or token position.
811 @item execinput
812 A utility that reads from STDIN and executes each line as a command in a
813 sub-process.
814 @item indexed_text
815 A utility for rapid retrieval of text by line numbers, in any order, from a
816 text file.
817 @item mdump
818 Format binary data.
819 @item msgqueue
820 Create message queues and send/receive messages.
821 @item mbin
822 @itemx mbout
823 Multiple buffer in and out. Used for buffering a lot of data between a slow
824 device and a fast device. Mostly for buffering streaming tape drives for use
825 with slower network connections, so that streaming is maintained as much as
826 possible to minimize wear on the tape device.
827 @item pockmark
828 Corrupt data streams - useful for testing error correction and data recovery.
829 @item tarsieve
830 Filter, list, or split a tar file.
831 @end table")
832 (license license:gpl2+)))
833
834 (define-public java-rsyntaxtextarea
835 (package
836 (name "java-rsyntaxtextarea")
837 (version "2.6.1")
838 (source (origin
839 (method url-fetch)
840 (uri (string-append "https://github.com/bobbylight/"
841 "RSyntaxTextArea/archive/"
842 version ".tar.gz"))
843 (file-name (string-append name "-" version ".tar.gz"))
844 (sha256
845 (base32
846 "0c5mqg2klj5rvf8fhycrli8rf6s37l9p7a8knw9gpp65r1c120q2"))))
847 (build-system ant-build-system)
848 (arguments
849 `(;; FIXME: some tests fail because locale resources cannot be found.
850 ;; Even when I add them to the class path,
851 ;; RSyntaxTextAreaEditorKitDumbCompleteWordActionTest fails.
852 #:tests? #f
853 #:jar-name "rsyntaxtextarea.jar"))
854 (native-inputs
855 `(("java-junit" ,java-junit)
856 ("java-hamcrest-core" ,java-hamcrest-core)))
857 (home-page "https://bobbylight.github.io/RSyntaxTextArea/")
858 (synopsis "Syntax highlighting text component for Java Swing")
859 (description "RSyntaxTextArea is a syntax highlighting, code folding text
860 component for Java Swing. It extends @code{JTextComponent} so it integrates
861 completely with the standard @code{javax.swing.text} package. It is fast and
862 efficient, and can be used in any application that needs to edit or view
863 source code.")
864 (license license:bsd-3)))
865
866 ;; We use the sources from git instead of the tarball from pypi, because the
867 ;; latter does not include the Cython source file from which bycython.cpp is
868 ;; generated.
869 (define-public python-editdistance
870 (let ((commit "3ea84a7dd3258c76aa3be851ef3d50e59c886846")
871 (revision "1"))
872 (package
873 (name "python-editdistance")
874 (version (string-append "0.3.1-" revision "." (string-take commit 7)))
875 (source
876 (origin
877 (method git-fetch)
878 (uri (git-reference
879 (url "https://github.com/aflc/editdistance.git")
880 (commit commit)))
881 (file-name (git-file-name name version))
882 (sha256
883 (base32
884 "1l43svsv12crvzphrgi6x435z6xg8m086c64armp8wzb4l8ccm7g"))))
885 (build-system python-build-system)
886 (arguments
887 `(#:phases
888 (modify-phases %standard-phases
889 (add-after 'unpack 'build-cython-code
890 (lambda _
891 (with-directory-excursion "editdistance"
892 (delete-file "bycython.cpp")
893 (invoke "cython" "--cplus" "bycython.pyx")))))))
894 (native-inputs
895 `(("python-cython" ,python-cython)))
896 (home-page "https://www.github.com/aflc/editdistance")
897 (synopsis "Fast implementation of the edit distance (Levenshtein distance)")
898 (description
899 "This library simply implements Levenshtein distance algorithm with C++
900 and Cython.")
901 (license license:expat))))
902
903 (define-public go-github.com-mattn-go-runewidth
904 (let ((commit "703b5e6b11ae25aeb2af9ebb5d5fdf8fa2575211")
905 (version "0.0.4")
906 (revision "1"))
907 (package
908 (name "go-github.com-mattn-go-runewidth")
909 (version (git-version version revision commit))
910 (source
911 (origin
912 (method git-fetch)
913 (uri (git-reference
914 (url "https://github.com/mattn/runewidth")
915 (commit commit)))
916 (file-name (git-file-name name version))
917 (sha256
918 (base32
919 "0znpyz71gajx3g0j2zp63nhjj2c07g16885vxv4ykwnrfmzbgk4w"))))
920 (build-system go-build-system)
921 (arguments
922 '(#:import-path "github.com/mattn/go-runewidth"))
923 (synopsis "@code{runewidth} provides Go functions to work with string widths")
924 (description
925 "The @code{runewidth} library provides Go functions for padding,
926 measuring and checking the width of strings, with support for East Asian
927 text.")
928 (home-page "https://github.com/mattn/runewidth")
929 (license license:expat))))
930
931 (define-public docx2txt
932 (package
933 (name "docx2txt")
934 (version "1.4")
935 (source (origin
936 (method url-fetch)
937 (uri (string-append
938 "mirror://sourceforge/docx2txt/docx2txt/v"
939 version "/docx2txt-" version ".tgz"))
940 (sha256
941 (base32
942 "06vdikjvpj6qdb41d8wzfnyj44jpnknmlgbhbr1w215420lpb5xj"))))
943 (build-system gnu-build-system)
944 (inputs
945 `(("unzip" ,unzip)
946 ("perl" ,perl)))
947 (arguments
948 `(#:tests? #f ; No tests.
949 #:make-flags (list (string-append "BINDIR="
950 (assoc-ref %outputs "out") "/bin")
951 (string-append "CONFIGDIR="
952 (assoc-ref %outputs "out") "/etc")
953 ;; Makefile seems to be a bit dumb at guessing.
954 (string-append "INSTALL=install")
955 (string-append "PERL=perl"))
956 #:phases
957 (modify-phases %standard-phases
958 (delete 'configure)
959 (add-after 'install 'fix-install
960 (lambda* (#:key outputs inputs #:allow-other-keys)
961 (let* ((out (assoc-ref outputs "out"))
962 (bin (string-append out "/bin"))
963 (config (string-append out "/etc/docx2txt.config"))
964 (unzip (assoc-ref inputs "unzip")))
965 ;; According to INSTALL, the .sh wrapper can be skipped.
966 (delete-file (string-append bin "/docx2txt.sh"))
967 (rename-file (string-append bin "/docx2txt.pl")
968 (string-append bin "/docx2txt"))
969 (substitute* config
970 (("config_unzip => '/usr/bin/unzip',")
971 (string-append "config_unzip => '"
972 unzip
973 "/bin/unzip',")))
974 ;; Makefile is wrong.
975 (chmod config #o644)
976 #t))))))
977 (synopsis "Recover text from @file{.docx} files, with good formatting")
978 (description
979 "@command{docx2txt} is a Perl based command line utility to convert
980 Microsoft Office @file{.docx} documents to equivalent text documents. Latest
981 version supports following features during text extraction.
982
983 @itemize
984 @item Character conversions; currency characters are converted to respective
985 names like Euro.
986 @item Capitalisation of text blocks.
987 @item Center and right justification of text fitting in a line of
988 (configurable) 80 columns.
989 @item Horizontal ruler, line breaks, paragraphs separation, tabs.
990 @item Indicating hyperlinked text along with the hyperlink (configurable).
991 @item Handling (bullet, decimal, letter, roman) lists along with (attempt at)
992 indentation.
993 @end itemize\n")
994 (home-page "http://docx2txt.sourceforge.net")
995 (license license:gpl3+)))
996
997 (define-public odt2txt
998 (package
999 (name "odt2txt")
1000 (version "0.5")
1001 (source
1002 (origin
1003 (method git-fetch)
1004 (uri (git-reference
1005 (url "https://github.com/dstosberg/odt2txt/")
1006 (commit (string-append "v" version))))
1007 (file-name (git-file-name name version))
1008 (sha256
1009 (base32
1010 "0im3kzvhxkjlx57w6h13mc9584c74ma1dyymgvpq2y61av3gc35v"))))
1011 (build-system gnu-build-system)
1012 (arguments
1013 `(#:tests? #f ; no make check
1014 #:make-flags (list "CC=gcc"
1015 (string-append "DESTDIR=" (assoc-ref %outputs "out")))
1016 #:phases
1017 (modify-phases %standard-phases
1018 ;; no configure script
1019 (delete 'configure))))
1020 (inputs
1021 `(("zlib" ,zlib)))
1022 (home-page "https://github.com/dstosberg/odt2txt/")
1023 (synopsis "Converter from OpenDocument Text to plain text")
1024 (description "odt2txt is a command-line tool which extracts the text out
1025 of OpenDocument Texts, as produced by OpenOffice.org, KOffice, StarOffice and
1026 others.
1027
1028 odt2txt can also extract text from some file formats similar to OpenDocument
1029 Text, such as OpenOffice.org XML (*.sxw), which was used by OpenOffice.org
1030 version 1.x and older StarOffice versions. To a lesser extent, odt2txt may be
1031 useful to extract content from OpenDocument spreadsheets (*.ods) and
1032 OpenDocument presentations (*.odp).")
1033 (license license:gpl2)))
1034
1035 (define-public opencc
1036 (package
1037 (name "opencc")
1038 (version "1.0.5")
1039 (source
1040 (origin
1041 (method git-fetch)
1042 (uri (git-reference
1043 (url "https://github.com/BYVoid/OpenCC")
1044 (commit (string-append "ver." version))))
1045 (file-name (git-file-name name version))
1046 (sha256
1047 (base32
1048 "1pv5md225qwhbn8ql932zdg6gh1qlx3paiajaks8gfsa07yzvhr4"))
1049 (modules '((guix build utils)))
1050 (snippet
1051 '(begin
1052 ;; TODO: Unbundle tclap, darts-clone, gtest
1053 (delete-file-recursively "deps/rapidjson-0.11") #t))))
1054 (build-system cmake-build-system)
1055 (arguments
1056 '(#:phases
1057 (modify-phases %standard-phases
1058 (add-after 'unpack 'patch-3rd-party-references
1059 (lambda* (#:key inputs #:allow-other-keys)
1060 (let ((rapidjson (assoc-ref inputs "rapidjson")))
1061 (substitute* "src/CMakeLists.txt"
1062 (("../deps/rapidjson-0.11")
1063 (string-append rapidjson "/include/rapidjson")))
1064 #t))))))
1065 (native-inputs
1066 `(("python" ,python-wrapper)
1067 ("rapidjson" ,rapidjson)))
1068 (home-page "https://github.com/BYVoid/OpenCC")
1069 (synopsis "Convert between Traditional Chinese and Simplified Chinese")
1070 (description "Open Chinese Convert (OpenCC) converts between Traditional
1071 Chinese and Simplified Chinese, supporting character-level conversion,
1072 phrase-level conversion, variant conversion, and regional idioms among
1073 Mainland China, Taiwan, and Hong-Kong.")
1074 (license license:asl2.0)))
1075
1076 (define-public nkf
1077 (let ((commit "08043eadf4abdddcf277842217e3c77a24740dc2")
1078 (revision "1"))
1079 (package
1080 (name "nkf")
1081 ;; The commits corresponding to specific versions are published
1082 ;; here:
1083 ;; https://ja.osdn.net/projects/nkf/scm/git/nkf/
1084 (version "2.1.5")
1085 (source (origin
1086 (method git-fetch)
1087 (uri (git-reference
1088 (url "https://github.com/nurse/nkf.git")
1089 (commit commit)))
1090 (file-name (git-file-name name version))
1091 (sha256
1092 (base32
1093 "0anw0knr1iy4p9w3d3b3pbwzh1c43p1i2q4c28kw9zviw8kx2rly"))))
1094 (build-system gnu-build-system)
1095 (arguments
1096 `(#:tests? #f ; test for perl module
1097 #:make-flags (list "CC=gcc" "CFLAGS=-O2 -Wall -pedantic"
1098 (string-append "prefix=" %output)
1099 "MKDIR=mkdir -p")
1100 #:phases
1101 (modify-phases %standard-phases
1102 (delete 'configure)))) ; No ./configure script
1103 (home-page "https://ja.osdn.net/projects/nkf/")
1104 (synopsis "Network Kanji Filter")
1105 (description "Nkf is yet another kanji code converter among networks,
1106 hosts and terminals. It converts input kanji code to designated kanji code
1107 such as ISO-2022-JP, Shift_JIS, EUC-JP, UTF-8, UTF-16 or UTF-32.")
1108 (license license:zlib))))
1109
1110 (define-public python-pandocfilters
1111 (package
1112 (name "python-pandocfilters")
1113 (version "1.4.2")
1114 (source
1115 (origin
1116 (method url-fetch)
1117 (uri (pypi-uri "pandocfilters" version))
1118 (sha256
1119 (base32
1120 "1a8d9b7s48gmq9zj0pmbyv2sivn5i7m6mybgpkk4jm5vd7hp1pdk"))))
1121 (build-system python-build-system)
1122 (home-page "https://github.com/jgm/pandocfilters")
1123 (synopsis "Python module for writing Pandoc filters")
1124 (description "Pandoc is a powerful utility to transform various
1125 input formats into a wide range of output formats. To alter the
1126 exported output document, Pandoc allows the usage of filters, which
1127 are pipes that read a JSON serialization of the Pandoc AST from stdin,
1128 transform it in some way, and write it to stdout. It allows therefore
1129 to alter the processing of Pandoc's supported input formats, for
1130 instance one can add new syntax elements to markdown, etc.
1131
1132 This package provides Python bindings.")
1133 (license license:bsd-3)))
1134
1135 (define-public aha
1136 (package
1137 (name "aha")
1138 (version "0.5")
1139 (source
1140 (origin
1141 (method git-fetch)
1142 (uri (git-reference
1143 (url "https://github.com/theZiz/aha")
1144 (commit version)))
1145 (sha256
1146 (base32
1147 "0byml4rmpiaalwx69jcixl3yvpvwmwiss1jzgsqwshilb2p4qnmz"))
1148 (file-name (git-file-name name version))))
1149 (build-system gnu-build-system)
1150 (arguments
1151 '(#:phases
1152 (modify-phases %standard-phases
1153 (delete 'configure))
1154 #:make-flags (list "CC=gcc"
1155 (string-append "PREFIX="
1156 (assoc-ref %outputs "out")))
1157 ;; no check target
1158 #:tests? #f))
1159 (home-page "https://github.com/theZiz/aha")
1160 (synopsis "Converts terminal escape sequences to HTML")
1161 (description "@command{aha} (Ansi Html Adapter) converts ANSI escape sequences
1162 of a Unix terminal to HTML code.")
1163 (license (list license:lgpl2.0+ license:mpl1.1))))