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