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