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, 2020 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, 2020 Efraim Flashner <efraim@flashner.co.il>
9 ;;; Copyright © 2016 Nikita <nikita@n0.is>
10 ;;; Copyright © 2016, 2020 Marius Bakke <marius@gnu.org>
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 ;;; Copyright © 2021 Jean-Baptiste Volatier <jbv@pm.me>
24 ;;; Copyright © 2021 Simon Tournier <zimon.toutoune@gmail.com>
25 ;;; Copyright © 2021 Felix Gruber <felgru@posteo.net>
27 ;;; This file is part of GNU Guix.
29 ;;; GNU Guix is free software; you can redistribute it and/or modify it
30 ;;; under the terms of the GNU General Public License as published by
31 ;;; the Free Software Foundation; either version 3 of the License, or (at
32 ;;; your option) any later version.
34 ;;; GNU Guix is distributed in the hope that it will be useful, but
35 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
36 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
37 ;;; GNU General Public License for more details.
39 ;;; You should have received a copy of the GNU General Public License
40 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
42 (define-module (gnu packages textutils)
43 #:use-module ((guix licenses) #:prefix license:)
44 #:use-module (guix packages)
45 #:use-module (guix download)
46 #:use-module (guix git-download)
47 #:use-module (guix build-system ant)
48 #:use-module (guix build-system gnu)
49 #:use-module (guix build-system go)
50 #:use-module (guix build-system cmake)
51 #:use-module (guix build-system python)
52 #:use-module (guix utils)
53 #:use-module (gnu packages)
54 #:use-module (gnu packages autotools)
55 #:use-module (gnu packages base)
56 #:use-module (gnu packages compression)
57 #:use-module (gnu packages gcc)
58 #:use-module (gnu packages golang)
59 #:use-module (gnu packages gettext)
60 #:use-module (gnu packages java)
61 #:use-module (gnu packages ncurses)
62 #:use-module (gnu packages pcre)
63 #:use-module (gnu packages perl)
64 #:use-module (gnu packages pkg-config)
65 #:use-module (gnu packages python)
66 #:use-module (gnu packages python-build)
67 #:use-module (gnu packages python-xyz)
68 #:use-module (gnu packages readline)
69 #:use-module (gnu packages ruby)
70 #:use-module (gnu packages slang)
71 #:use-module (gnu packages web))
73 (define-public dos2unix
80 (uri (string-append "https://waterlan.home.xs4all.nl/dos2unix/"
81 "dos2unix-" version ".tar.gz"))
83 (base32 "00dfsf4rfyjb5j12gan8xjiirm0asshdz6dmd3l34a7ays6wadb0"))))
84 (build-system gnu-build-system)
87 (list (string-append "CC=" ,(cc-for-target))
88 (string-append "prefix=" (assoc-ref %outputs "out")))
90 (modify-phases %standard-phases
91 (delete 'configure)))) ; no configure script
93 `(("gettext" ,gettext-minimal)
95 (home-page "https://waterlan.home.xs4all.nl/dos2unix.html")
96 (synopsis "DOS/Mac to Unix and vice versa text file format converter")
98 "dos2unix is a tool to convert line breaks in a text file from Unix format
99 to DOS format and vice versa.")
100 (license license:bsd-2)))
102 (define-public recode
109 (uri (string-append "https://github.com/rrthomas/recode/releases/"
110 "download/v" version "/recode-" version ".tar.gz"))
112 (base32 "0m59sd1ca0zw1aydpc3m8sw03nc885knmccqryg7byzmqs585ia6"))))
113 (build-system gnu-build-system)
116 ("python-cython" ,python-cython)))
117 (home-page "https://github.com/rrthomas/recode")
118 (synopsis "Text encoding converter")
119 (description "The Recode library converts files between character sets and
120 usages. It recognises or produces over 200 different character sets (or about
121 300 if combined with an iconv library) and transliterates files between almost
122 any pair. When exact transliteration are not possible, it gets rid of
123 offending characters or falls back on approximations. The recode program is a
124 handy front-end to the library.")
125 (license license:gpl3+)))
135 (url "https://github.com/nijel/enca")
137 (file-name (git-file-name name version))
139 (base32 "19q7cwwxmmk5j9438bsqdpjvdjawsd3zmw1zyqgi7s4m0rasr3ah"))))
140 (build-system gnu-build-system)
141 ;; enca-1.19 tests fail with recent recode.
142 ;(inputs `(("recode" ,recode)))
143 (home-page "https://github.com/nijel/enca")
144 (synopsis "Text encoding detection tool")
145 (description "Enca (Extremely Naive Charset Analyser) consists of libenca,
146 an encoding detection library, and enca, a command line frontend, integrating
147 libenca and several charset conversion libraries and tools.")
148 (license license:gpl2)))
150 (define-public utf8proc
158 (url "https://github.com/JuliaStrings/utf8proc")
159 (commit (string-append "v" version))))
160 (file-name (git-file-name name version))
162 (base32 "1xlkazhdnja4lksn5c9nf4bln5gjqa35a8gwlam5r0728w0h83qq"))))
163 (build-system gnu-build-system)
165 (let ((UNICODE_VERSION "13.0.0")) ; defined in data/Makefile
166 ;; Test data that is otherwise downloaded with curl.
167 `(("NormalizationTest.txt"
170 (uri (string-append "https://www.unicode.org/Public/"
171 UNICODE_VERSION "/ucd/NormalizationTest.txt"))
173 (base32 "07g0ya4f6zfzvpp24ccxkb2yq568kh83gls85rjl950nv5fya3nn"))))
174 ("GraphemeBreakTest.txt"
177 (uri (string-append "https://www.unicode.org/Public/"
179 "/ucd/auxiliary/GraphemeBreakTest.txt"))
181 (base32 "07f8rrvcsq4pibdz6zxggxy8w7zjjqyw2ggclqlhalyv45yv7prj"))))
186 '(#:make-flags (list "CC=gcc"
187 (string-append "prefix=" (assoc-ref %outputs "out")))
189 (modify-phases %standard-phases
191 (add-before 'check 'check-data
192 (lambda* (#:key inputs #:allow-other-keys)
193 (for-each (lambda (i)
194 (copy-file (assoc-ref inputs i)
195 (string-append "data/" i)))
196 '("NormalizationTest.txt" "GraphemeBreakTest.txt"))
197 (substitute* "data/GraphemeBreakTest.txt"
201 (home-page "https://juliastrings.github.io/utf8proc/")
202 (synopsis "C library for processing UTF-8 Unicode data")
203 (description "utf8proc is a small C library that provides Unicode
204 normalization, case-folding, and other operations for data in the UTF-8
205 encoding, supporting Unicode version 9.0.0.")
206 (license license:expat)))
208 (define-public utf8proc-2.6.1
217 (url "https://github.com/JuliaStrings/utf8proc")
218 (commit (string-append "v" version))))
219 (file-name (git-file-name name version))
221 (base32 "1zqc6airkzkssbjxanx5v8blfk90180gc9id0dx8ncs54f1ib8w7"))))
223 (substitute-keyword-arguments (package-arguments utf8proc)
225 `(modify-phases ,phases
227 (lambda* (#:key inputs native-inputs #:allow-other-keys)
228 (display native-inputs)
229 (for-each (lambda (i)
230 (copy-file (assoc-ref (or native-inputs inputs) i)
231 (string-append "data/" i)))
232 '("NormalizationTest.txt" "GraphemeBreakTest.txt"
233 "DerivedCoreProperties.txt"))))))))
236 (package-native-inputs utf8proc)
237 (let ((UNICODE_VERSION "13.0.0"))
238 `(("DerivedCoreProperties.txt"
241 (uri (string-append "https://www.unicode.org/Public/"
242 UNICODE_VERSION "/ucd/DerivedCoreProperties.txt"))
244 (base32 "0j12x112cd8fpgazkc8izxnhhpia44p1m36ff8yapslxndcmzm55"))))
248 (define-public libconfuse
255 (uri (string-append "https://github.com/martinh/libconfuse/"
256 "releases/download/v" version
257 "/confuse-" version ".tar.xz"))
259 (base32 "043hqqykpprgrkw9s2hbdlxr308a7yxwsgxj4m8aadg1401hmm8x"))))
260 (build-system gnu-build-system)
262 '(#:configure-flags '("--disable-static")))
263 (home-page "https://github.com/martinh/libconfuse")
264 (synopsis "Configuration file parser library")
265 (description "libconfuse is a configuration file parser library. It
266 supports sections and (lists of) values (strings, integers, floats, booleans
267 or other sections), as well as some other features (such as
268 single/double-quoted strings, environment variable expansion, functions and
269 nested include statements).")
270 (license license:isc)))
272 (define-public libgtextutils
274 (name "libgtextutils")
280 "https://github.com/agordon/libgtextutils/releases/download/"
281 version "/libgtextutils-" version ".tar.gz"))
283 (base32 "0jiybkb2z58wa2msvllnphr4js2hvjvh988pavb3mzkgr6ihwbkr"))))
284 (build-system gnu-build-system)
287 (modify-phases %standard-phases
289 (lambda _ (invoke "sh" "reconf")))
290 (add-after 'set-paths 'hide-default-gcc
291 (lambda* (#:key inputs #:allow-other-keys)
292 (let ((gcc (assoc-ref inputs "gcc")))
293 ;; Remove the default GCC from CPLUS_INCLUDE_PATH to prevent
294 ;; conflicts with the GCC 5 input.
295 (setenv "CPLUS_INCLUDE_PATH"
297 (delete (string-append gcc "/include/c++")
298 (string-split (getenv "CPLUS_INCLUDE_PATH") #\:))
302 `(("autoconf" ,autoconf)
303 ("automake" ,automake)
304 ("gcc@5" ,gcc-5) ; doesn't build with later versions
305 ("libtool" ,libtool)))
306 (home-page "https://github.com/agordon/libgtextutils")
307 (synopsis "Gordon's text utils library")
309 "libgtextutils is a text utilities library used by the fastx toolkit from
311 (license license:agpl3+)))
313 (define-public cityhash
314 (let ((commit "8af9b8c"))
317 (version (string-append "1.1-2." commit))
321 (url "https://github.com/google/cityhash")
323 (file-name (string-append name "-" version ".tar.gz"))
326 "0n6skf5dv8yfl1ckax8dqhvsbslkwc9158zf2ims0xqdvzsahbi6"))))
327 (build-system gnu-build-system)
329 '(#:make-flags (list "CXXFLAGS=-g -O3")
331 (modify-phases %standard-phases
332 ;; citycrc is not installed by default but is used by some
334 (add-after 'install 'install-citycrc
335 (lambda* (#:key outputs #:allow-other-keys)
336 (let* ((out (assoc-ref outputs "out"))
337 (include (string-append out "/include")))
338 (install-file "src/citycrc.h" include))
340 (home-page "https://github.com/google/cityhash")
341 (synopsis "C++ hash functions for strings")
343 "CityHash provides hash functions for strings. The functions mix the
344 input bits thoroughly but are not suitable for cryptography.")
345 (license license:expat))))
353 (uri (string-append "http://www.and.org/ustr/" version
354 "/ustr-" version ".tar.bz2"))
357 "1i623ygdj7rkizj7985q9d6vj5amwg686aqb5j3ixpkqkyp6xbrx"))
358 (patches (search-patches "ustr-fix-build-with-gcc-5.patch"))))
359 (build-system gnu-build-system)
362 (list (string-append "CC=" ,(cc-for-target))
364 ;; Override "/sbin/ldconfig" with "echo" because we don't need
367 (string-append "prefix=" (assoc-ref %outputs "out"))
370 (modify-phases %standard-phases
371 (add-after 'unpack 'fix-cross-compilation
372 ;; The Makefile contains more insults than cross-compilation support.
373 ;; It poorly reinvents autotools by compiling C programmes with $CC,
374 ;; then tries to run them during the build. Hard-code the results.
376 (substitute* "Makefile"
377 (("\\./autoconf_64b")
378 ,(if (target-64bit? (or (%current-target-system)
382 (("\\./autoconf_vsnprintf") "echo 0"))))
383 (add-after 'unpack 'omit-static-libraries
384 ;; These are needed to build & test ustr, but don't install them.
386 (substitute* "Makefile"
387 ((".*install.*LIB_STATIC.*") ""))))
388 (add-after 'unpack 'disable-check-for-stdint
390 ;; Of course we have stdint.h, just not in /usr/include
391 (substitute* '("Makefile"
393 (("-f \"/usr/include/stdint.h\"") "-z \"\""))
395 ;; No configure script
396 (delete 'configure))))
397 (home-page "http://www.and.org/ustr/")
398 (synopsis "String library with very low memory overhead")
400 "Ustr is a string library for C with very low memory overhead.")
401 ;; Quoted from the home page: "The License for the code is MIT, new-BSD,
402 ;; LGPL, etc. ... if you need another license to help compatibility, just
403 ;; ask for it. It's basically public domain, without all the legal
404 ;; problems for everyone that trying to make something public domain
406 (license license:public-domain)))
408 (define-public ascii2binary
410 (name "ascii2binary")
415 (uri (string-append "http://billposer.org/Software/Downloads/"
416 "ascii2binary-" version ".tar.bz2"))
418 (base32 "0dc9fxcdmppbs9s06jvq61zbk552laxps0xyk098gj41697ihd96"))))
419 (build-system gnu-build-system)
421 `(("gettext" ,gettext-minimal)))
422 (home-page "https://billposer.org/Software/a2b.html")
423 (synopsis "Convert between ASCII, hexadecimal and binary representations")
424 (description "The two programs are useful for generating test data, for
425 inspecting binary files, and for interfacing programs that generate textual
426 output to programs that require binary input and conversely. They can also be
427 useful when it is desired to reformat numbers.
431 @item @command{ascii2binary} reads input consisting of ascii or hexadecimal
432 representation numbers separated by whitespace and produces as output
433 the binary equivalents. The type and precision of the binary output
434 is selected using command line flags.
436 @item @command{binary2ascii} reads input consisting of binary numbers
437 and converts them to their ascii or hexadecimal representation.
438 Command line flags specify the type and size of the binary numbers
439 and provide control over the format of the output.
440 Unsigned integers may be written out in binary, octal, decimal,
443 Signed integers may be written out only in binary or decimal. Floating
444 point numbers may be written out only decimal, either in standard or
445 scientific notation. (If you want to examine the binary representation
446 of floating point numbers, just treat the input as a sequence of unsigned
450 (license license:gpl3)))
452 (define-public uniutils
459 (uri (string-append "http://billposer.org/Software/Downloads/"
460 "uniutils-" version ".tar.bz2"))
462 (base32 "19w1510w87gx7n4qy3zsb0m467a4rn5scvh4ajajg7jh6x5xri08"))))
463 (build-system gnu-build-system)
465 '(#:configure-flags '("--disable-dependency-tracking")
467 (modify-phases %standard-phases
468 (add-after 'build 'fix-paths
469 (lambda* (#:key outputs inputs #:allow-other-keys)
470 (let ((out (assoc-ref outputs "out"))
471 (a2b (assoc-ref inputs "ascii2binary"))
472 (iconv (assoc-ref inputs "libiconv")))
473 (substitute* "utf8lookup"
474 (("^ascii2binary ") (string-append a2b "/bin/ascii2binary "))
475 (("^uniname ") (string-append out "/bin/uniname "))
476 (("^iconv ") (string-append iconv "/bin/iconv ")))
479 `(("ascii2binary" ,ascii2binary)
480 ("libiconv" ,libiconv)))
481 (home-page "https://billposer.org/Software/unidesc.html")
482 (synopsis "Find out what is in a Unicode file")
483 (description "Useful tools when working with Unicode files when one
484 doesn't know the writing system, doesn't have the necessary font, needs to
485 inspect invisible characters, needs to find out whether characters have been
486 combined or in what order they occur, or needs statistics on which characters
491 @item @command{uniname} defaults to printing the character offset of each
492 character, its byte offset, its hex code value, its encoding, the glyph
493 itself, and its name. It may also be used to validate UTF-8 input.
495 @item @command{unidesc} reports the character ranges to which different
496 portions of the text belong. It can also be used to identify Unicode encodings
497 (e.g. UTF-16be) flagged by magic numbers.
499 @item @command{unihist} generates a histogram of the characters in its input.
501 @item @command{ExplicateUTF8} is intended for debugging or for learning about
502 Unicode. It determines and explains the validity of a sequence of bytes as a
505 @item @command{utf8lookup} provides a handy way to look up Unicode characters
506 from the command line.
508 @item @command{unireverse} reverse each line of UTF-8 input
509 character-by-character.
512 (license license:gpl3)))
514 (define-public libconfig
518 (home-page "https://hyperrealm.github.io/libconfig/")
521 (uri (string-append home-page "/dist/libconfig-"
525 "1rqynfxl1zxwk4b42sniz9xlw285aidcrsfih51p8dy0rbb6clal"))))
526 (build-system gnu-build-system)
527 (synopsis "C/C++ configuration file library")
529 "Libconfig is a simple library for manipulating structured configuration
530 files. This file format is more compact and more readable than XML. And
531 unlike XML, it is type-aware, so it is not necessary to do string parsing in
533 (license license:lgpl2.1+)))
542 (url "https://github.com/pfff/pfff")
543 (commit (string-append "v" version))))
544 (file-name (git-file-name name version))
547 "1nxkfm7zliq3rmr7yp871sppwfnz71iz364m2sgazny71pzykggc"))))
548 (build-system cmake-build-system)
549 (home-page "https://biit.cs.ut.ee/pfff/")
550 (synopsis "Probabilistic fast file fingerprinting tool")
552 "pfff is a tool for calculating a compact digital fingerprint of a file
553 by sampling randomly from the file instead of reading it in full.
554 Consequently, the computation has a flat performance characteristic,
555 correlated with data variation rather than file size. pfff can be as reliable
556 as existing hashing techniques, with provably negligible risk of collisions.")
557 (license license:bsd-3)))
559 (define-public oniguruma
562 (version "6.9.5-rev1")
565 (uri (string-append "https://github.com/kkos/"
566 "oniguruma/releases/download/v"
567 ;; If there is a "-" in the version, convert
568 ;; to underscore for this part of the URI.
569 (string-map (lambda (c) (if (char=? #\- c) #\_ c))
571 "/onig-" version ".tar.gz"))
574 "17m92k1n6bvza6m35fpd5g36zwpwm3hfz3478iwj5bvj2sfq8g6k"))))
575 (build-system gnu-build-system)
576 (arguments '(#:configure-flags '("--disable-static")))
577 (home-page "https://github.com/kkos/oniguruma")
578 (synopsis "Regular expression library")
579 (description "Oniguruma is a regular expressions library. The special
580 characteristic of this library is that different character encoding for every
581 regular expression object can be specified.")
582 (license license:bsd-2)))
584 (define-public antiword
590 (uri (string-append "http://www.winfield.demon.nl/linux"
591 "/antiword-" version ".tar.gz"))
594 "1b7mi1l20jhj09kyh0bq14qzz8vdhhyf35gzwsq43mn6rc7h0b4f"))
595 (patches (search-patches "antiword-CVE-2014-8123.patch"))))
596 (build-system gnu-build-system)
598 `(#:tests? #f ; There are no tests
600 (list "-f" "Makefile.Linux"
601 (string-append "GLOBAL_INSTALL_DIR="
602 (assoc-ref %outputs "out") "/bin")
603 (string-append "GLOBAL_RESOURCES_DIR="
604 (assoc-ref %outputs "out") "/share/antiword"))
606 (modify-phases %standard-phases
608 (lambda* (#:key outputs #:allow-other-keys)
609 ;; Ensure that mapping files can be found in the actual package
611 (substitute* "antiword.h"
612 (("/usr/share/antiword")
613 (string-append (assoc-ref outputs "out") "/share/antiword")))
616 (lambda* (#:key make-flags #:allow-other-keys)
617 (apply invoke "make" `("global_install" ,@make-flags)))))))
618 (home-page "http://www.winfield.demon.nl/")
619 (synopsis "Microsoft Word document reader")
620 (description "Antiword is an application for displaying Microsoft Word
621 documents. It can also convert the document to PostScript or XML. Only
622 documents made by MS Word version 2 and version 6 or later are supported. The
623 name comes from: \"The antidote against people who send Microsoft Word files
624 to everybody, because they believe that everybody runs Windows and therefore
626 (license license:gpl2+)))
628 (define-public catdoc
634 (uri (string-append "http://ftp.wagner.pp.ru/pub/catdoc/"
635 "catdoc-" version ".tar.gz"))
636 (patches (search-patches "catdoc-CVE-2017-11110.patch"))
639 "15h7v3bmwfk4z8r78xs5ih6vd0pskn0rj90xghvbzdjj0cc88jji"))))
640 (build-system gnu-build-system)
641 ;; TODO: Also build `wordview` which requires `tk` – make a separate
644 '(#:tests? #f ; There are no tests
645 #:configure-flags '("--disable-wordview")
647 (modify-phases %standard-phases
648 (add-before 'install 'fix-install
649 (lambda* (#:key outputs #:allow-other-keys)
650 (let ((out (assoc-ref outputs "out")))
651 (mkdir-p (string-append out "/share/man/man1"))))))))
652 (home-page "https://www.wagner.pp.ru/~vitus/software/catdoc/")
653 (synopsis "MS-Word to TeX or plain text converter")
654 (description "@command{catdoc} extracts text from MS-Word files, trying to
655 preserve as many special printable characters as possible. It supports
656 everything up to Word-97. Also supported are MS Write documents and RTF files.
658 @command{catdoc} does not preserve complex word formatting, but it can
659 translate some non-ASCII characters into TeX escape codes. It's goal is to
660 extract plain text and allow you to read it and, probably, reformat with TeX,
661 according to TeXnical rules.
663 This package also provides @command{xls2csv}, which extracts data from Excel
664 spreadsheets and outputs it in comma-separated-value format, and
665 @command{catppt}, which extracts data from PowerPoint presentations.")
666 (license license:gpl2+)))
668 (define-public utfcpp
675 (url "https://github.com/nemtrif/utfcpp")
676 (commit (string-append "v" version))))
677 (file-name (git-file-name name version))
680 "1gr98d826z6wa58r1s5i7rz7q2x3r31v7zj0pjjlrc7gfxwklr4s"))))
681 (build-system cmake-build-system)
683 `(#:out-of-source? #f
685 (modify-phases %standard-phases
686 (replace 'install ; no install target
687 (lambda* (#:key outputs #:allow-other-keys)
688 (let* ((out (assoc-ref outputs "out"))
689 (include (string-append out "/include"))
690 (doc (string-append out "/share/doc/" ,name)))
691 (copy-recursively "source" include)
692 (install-file "README.md" doc)
694 (home-page "https://github.com/nemtrif/utfcpp")
695 (synopsis "Portable C++ library for handling UTF-8")
696 (description "UTF8-CPP is a C++ library for handling UTF-8 encoded text
698 (license license:boost1.0)))
707 (uri (string-append "mirror://sourceforge/dbacl/dbacl/" version "/"
708 "dbacl-" version ".tar.gz"))
710 (base32 "1gas0112wqjvwn9qg3hxnawk7h3prr0w9b2h68f3p1ifd1kzn3gz"))
711 (patches (search-patches "dbacl-include-locale.h.patch"))))
712 (build-system gnu-build-system)
716 (string-append "-I" (assoc-ref %build-inputs "slang")
718 (string-append "-I" (assoc-ref %build-inputs "ncurses")
721 (modify-phases %standard-phases
722 (add-after 'unpack 'delete-sample6-and-japanese
724 (substitute* "doc/Makefile.am"
726 (("japanese.txt") ""))
727 (delete-file "doc/sample6.txt")
728 (delete-file "doc/japanese.txt")
729 (substitute* (list "src/tests/Makefile.am"
730 "src/tests/Makefile.in")
731 (("dbacl-jap.shin") "")
732 (("dbacl-jap.sh") ""))
734 (add-after 'unpack 'delete-test
735 ;; See comments about the license.
737 (delete-file "src/tests/dbacl-jap.shin")
739 (add-after 'unpack 'fix-test-files
740 (lambda* (#:key inputs outputs #:allow-other-keys)
741 (let* ((out (assoc-ref outputs "out"))
742 (bin (string-append out "/bin")))
743 (substitute* (find-files "src/tests/" "\\.shin$")
744 (("PATH=/bin:/usr/bin")
745 "#PATH=/bin:/usr/bin")
746 (("diff") (string-append (which "diff")))
747 (("tr") (string-append (which "tr"))))
751 (invoke "autoreconf" "-vif")
754 `(("ncurses" ,ncurses)
756 ("readline" ,readline)
759 `(("libtool" ,libtool)
760 ("autoconf" ,autoconf)
761 ("automake" ,automake)
762 ("pkg-config" ,pkg-config)))
763 (home-page "https://www.lbreyer.com/dbacl.html")
764 (synopsis "Bayesian text and email classifier")
766 "dbacl is a fast Bayesian text and email classifier. It builds a variety
767 of language models using maximum entropy (minimum divergence) principles, and
768 these can then be used to categorize input data automatically among multiple
770 ;; The software is licensed as GPLv3 or later, but
771 ;; includes various sample texts in the doc dir:
772 ;; - sample1.txt, sample3 and sampe5.txt are in the public domain,
774 ;; - sample2.txt, sample4.txt are in the public domain, by Aristotle.
775 ;; - sample6.txt is a forwarded email, copyright unknown.
776 ;; Guix does exclude sample6.txt.
777 ;; - japanese.txt is a Japanese unoffical translation of the
778 ;; GNU General Public License, (c) by the Free Software Foundation.
779 ;; Guix excludes this file.
780 (license (list license:gpl3+ license:public-domain))))
782 (define-public dotconf
789 (url "https://github.com/williamh/dotconf")
790 (commit (string-append "v" version))))
791 (file-name (git-file-name name version))
794 "1sc95hw5k2xagpafny0v35filmcn05k1ds5ghkldfpf6xw4hakp7"))))
795 (build-system gnu-build-system)
796 (arguments `(#:tests? #f)) ; FIXME maketest.sh does not work.
798 `(("autoconf" ,autoconf)
799 ("automake" ,automake)
800 ("libtool" ,libtool)))
801 (home-page "https://github.com/williamh/dotconf")
802 (synopsis "Configuration file parser library")
804 "C library for creating and parsing configuration files.")
805 (license (list license:lgpl2.1 ; Main distribution.
806 license:asl1.1)))) ; src/readdir.{c,h}
808 (define-public drm-tools
814 (uri (string-append "mirror://sourceforge/drmtools/drm_tools-"
818 "187zbxw21zcg8gpyc13gxlycfw0n05a6rmqq6im5wr9zk1v1wj80"))))
819 (build-system cmake-build-system)
821 `(#:tests? #f ;the test suite fails
822 #:phases (modify-phases %standard-phases
823 (add-after 'unpack 'set-install-prefixes
824 (lambda* (#:key outputs #:allow-other-keys)
825 (let* ((out (assoc-ref outputs "out")))
826 (substitute* "CMakeLists.txt"
832 (add-after 'unpack 'adjust-test-paths
834 (substitute* '("test_extract_increment.sh"
835 "test_extract_features.sh"
836 "test_extract_features2.sh"
838 (("\\./extract") "extract")
839 (("\\./dmath") "dmath")
840 (("/usr/local/bin/") "")
845 ;; The produced binaries are written directly to %output/bin.
847 (add-after 'build 'check
848 (lambda* (#:key outputs tests? #:allow-other-keys)
850 (let* ((out (assoc-ref outputs "out"))
851 (bin (string-append out "/bin")))
852 (setenv "PATH" (string-append bin ":"
854 (with-directory-excursion
855 (format #f "../drm_tools-~a" ,version)
856 (invoke "sh" "test_all.sh")))))))))
857 (native-inputs `(("which" ,which))) ;for tests
858 (inputs `(("pcre" ,pcre)))
859 (home-page "http://drmtools.sourceforge.net/")
860 (synopsis "Utilities to manipulate text and binary files")
861 (description "The drm_tools package contains the following commands:
864 An extended version of the \"date\" program that has sub-second accuracy.
866 Format complex binary data into text.
868 Load data into a binary file using simple commands from the input.
870 Sort, merge, search, retrieve or generate test data consisting of fixed size
873 Find or find/replace in binary files.
875 Split test data consisting of fixed size binary records into one or more
878 Find changes between two files at the character level. Unlike \"diff\", it
879 lists just the characters that differ, so if the 40,000th character is
880 different only that one character will be shown, not the entire line.
882 Add columns of integers, decimals, and/or times.
884 A utility for formatting binary data dumps.
886 Double precision interactive command line math calculator.
888 Extract and emit data from text files based on character or token position.
890 A utility that reads from STDIN and executes each line as a command in a
893 A utility for rapid retrieval of text by line numbers, in any order, from a
898 Create message queues and send/receive messages.
901 Multiple buffer in and out. Used for buffering a lot of data between a slow
902 device and a fast device. Mostly for buffering streaming tape drives for use
903 with slower network connections, so that streaming is maintained as much as
904 possible to minimize wear on the tape device.
906 Corrupt data streams - useful for testing error correction and data recovery.
908 Filter, list, or split a tar file.
910 (license license:gpl2+)))
912 (define-public java-rsyntaxtextarea
914 (name "java-rsyntaxtextarea")
919 (url "https://github.com/bobbylight/RSyntaxTextArea")
921 (file-name (git-file-name name version))
924 "0dyflzvxq2wvs0rgqfyi5yzzrb6r4bzw2dm8cl304dakxk38ddys"))))
925 (build-system ant-build-system)
927 `(;; FIXME: some tests fail because locale resources cannot be found.
928 ;; Even when I add them to the class path,
929 ;; RSyntaxTextAreaEditorKitDumbCompleteWordActionTest fails.
931 #:jar-name "rsyntaxtextarea.jar"))
933 `(("java-junit" ,java-junit)
934 ("java-hamcrest-core" ,java-hamcrest-core)))
935 (home-page "https://bobbylight.github.io/RSyntaxTextArea/")
936 (synopsis "Syntax highlighting text component for Java Swing")
937 (description "RSyntaxTextArea is a syntax highlighting, code folding text
938 component for Java Swing. It extends @code{JTextComponent} so it integrates
939 completely with the standard @code{javax.swing.text} package. It is fast and
940 efficient, and can be used in any application that needs to edit or view
942 (license license:bsd-3)))
944 ;; We use the sources from git instead of the tarball from pypi, because the
945 ;; latter does not include the Cython source file from which bycython.cpp is
947 (define-public python-editdistance
948 (let ((commit "3ea84a7dd3258c76aa3be851ef3d50e59c886846")
951 (name "python-editdistance")
952 (version (string-append "0.3.1-" revision "." (string-take commit 7)))
957 (url "https://github.com/aflc/editdistance")
959 (file-name (git-file-name name version))
962 "1l43svsv12crvzphrgi6x435z6xg8m086c64armp8wzb4l8ccm7g"))))
963 (build-system python-build-system)
966 (modify-phases %standard-phases
967 (add-after 'unpack 'build-cython-code
969 (with-directory-excursion "editdistance"
970 (delete-file "bycython.cpp")
971 (invoke "cython" "--cplus" "bycython.pyx")))))))
973 `(("python-cython" ,python-cython)))
974 (home-page "https://www.github.com/aflc/editdistance")
975 (synopsis "Fast implementation of the edit distance (Levenshtein distance)")
977 "This library simply implements Levenshtein distance algorithm with C++
979 (license license:expat))))
981 (define-public go-github.com-mattn-go-runewidth
982 (let ((commit "703b5e6b11ae25aeb2af9ebb5d5fdf8fa2575211")
986 (name "go-github.com-mattn-go-runewidth")
987 (version (git-version version revision commit))
992 (url "https://github.com/mattn/runewidth")
994 (file-name (git-file-name name version))
997 "0znpyz71gajx3g0j2zp63nhjj2c07g16885vxv4ykwnrfmzbgk4w"))))
998 (build-system go-build-system)
1000 '(#:import-path "github.com/mattn/go-runewidth"))
1001 (synopsis "@code{runewidth} provides Go functions to work with string widths")
1003 "The @code{runewidth} library provides Go functions for padding,
1004 measuring and checking the width of strings, with support for East Asian
1006 (home-page "https://github.com/mattn/runewidth")
1007 (license license:expat))))
1009 (define-public docx2txt
1016 "mirror://sourceforge/docx2txt/docx2txt/v"
1017 version "/docx2txt-" version ".tgz"))
1020 "06vdikjvpj6qdb41d8wzfnyj44jpnknmlgbhbr1w215420lpb5xj"))))
1021 (build-system gnu-build-system)
1026 `(#:tests? #f ; No tests.
1027 #:make-flags (list (string-append "BINDIR="
1028 (assoc-ref %outputs "out") "/bin")
1029 (string-append "CONFIGDIR="
1030 (assoc-ref %outputs "out") "/etc")
1031 ;; Makefile seems to be a bit dumb at guessing.
1032 (string-append "INSTALL=install")
1033 (string-append "PERL=perl"))
1035 (modify-phases %standard-phases
1037 (add-after 'install 'fix-install
1038 (lambda* (#:key outputs inputs #:allow-other-keys)
1039 (let* ((out (assoc-ref outputs "out"))
1040 (bin (string-append out "/bin"))
1041 (config (string-append out "/etc/docx2txt.config"))
1042 (unzip (assoc-ref inputs "unzip")))
1043 ;; According to INSTALL, the .sh wrapper can be skipped.
1044 (delete-file (string-append bin "/docx2txt.sh"))
1045 (rename-file (string-append bin "/docx2txt.pl")
1046 (string-append bin "/docx2txt"))
1048 (("config_unzip => '/usr/bin/unzip',")
1049 (string-append "config_unzip => '"
1052 ;; Makefile is wrong.
1053 (chmod config #o644)
1055 (synopsis "Recover text from @file{.docx} files, with good formatting")
1057 "@command{docx2txt} is a Perl based command line utility to convert
1058 Microsoft Office @file{.docx} documents to equivalent text documents. Latest
1059 version supports following features during text extraction.
1062 @item Character conversions; currency characters are converted to respective
1064 @item Capitalisation of text blocks.
1065 @item Center and right justification of text fitting in a line of
1066 (configurable) 80 columns.
1067 @item Horizontal ruler, line breaks, paragraphs separation, tabs.
1068 @item Indicating hyperlinked text along with the hyperlink (configurable).
1069 @item Handling (bullet, decimal, letter, roman) lists along with (attempt at)
1072 (home-page "http://docx2txt.sourceforge.net")
1073 (license license:gpl3+)))
1075 (define-public html2text
1076 ;; Use commit directly to get the fixes to the installation phase
1077 ;; that are not in a release yet.
1078 (let ((commit "05364c1028026a87d6f45130a8e86e1ee67704d2")
1082 (version (git-version "2.0.1_pre" revision commit))
1087 (url "https://github.com/grobian/html2text")
1088 (commit (string-append commit))))
1089 (file-name (git-file-name name version))
1091 (base32 "0n6pl0nijcn4z3p0dvf3gmvvpjq261pagnk84s9f78c4c55bw5cm"))))
1092 (build-system gnu-build-system)
1095 (list (string-append "PREFIX=" (assoc-ref %outputs "out")))
1097 (modify-phases %standard-phases
1099 ;; The configure script is not from autotools and does not accept
1100 ;; ‘--style’ options. There is no proper error handling.
1101 (lambda* (#:key outputs #:allow-other-keys)
1102 (invoke "./configure"
1103 (string-append "CXX=" ,(cxx-for-target))))))))
1104 (home-page "https://github.com/grobian/html2text")
1105 (synopsis "HTML to plain text converter")
1107 "@code{html2text} is a command line utility that converts HTML
1108 documents into plain text.")
1109 (license (list license:bsd-4 ; cmp_nocase.cpp & sgml.h
1110 license:gpl2+))))) ; everything else
1112 (define-public odt2txt
1120 (url "https://github.com/dstosberg/odt2txt/")
1121 (commit (string-append "v" version))))
1122 (file-name (git-file-name name version))
1125 "0im3kzvhxkjlx57w6h13mc9584c74ma1dyymgvpq2y61av3gc35v"))))
1126 (build-system gnu-build-system)
1128 `(#:tests? #f ; no make check
1129 #:make-flags (list "CC=gcc"
1130 (string-append "DESTDIR=" (assoc-ref %outputs "out")))
1132 (modify-phases %standard-phases
1133 ;; no configure script
1134 (delete 'configure))))
1137 (home-page "https://github.com/dstosberg/odt2txt/")
1138 (synopsis "Converter from OpenDocument Text to plain text")
1139 (description "odt2txt is a command-line tool which extracts the text out
1140 of OpenDocument Texts, as produced by OpenOffice.org, KOffice, StarOffice and
1143 odt2txt can also extract text from some file formats similar to OpenDocument
1144 Text, such as OpenOffice.org XML (*.sxw), which was used by OpenOffice.org
1145 version 1.x and older StarOffice versions. To a lesser extent, odt2txt may be
1146 useful to extract content from OpenDocument spreadsheets (*.ods) and
1147 OpenDocument presentations (*.odp).")
1148 (license license:gpl2)))
1150 (define-public opencc
1158 (url "https://github.com/BYVoid/OpenCC")
1159 (commit (string-append "ver." version))))
1160 (file-name (git-file-name name version))
1163 "07y0pvxjlmpcnym229j87qcfwnfm7vi10dad0a20xy6as55a9j3d"))
1164 (modules '((guix build utils)))
1167 ;; TODO: Unbundle tclap, darts-clone, gtest
1168 (delete-file-recursively "deps/rapidjson-1.1.0") #t))))
1169 (build-system cmake-build-system)
1171 ;; Required to locate the install script properly.
1172 `(#:out-of-source? #f
1173 #:parallel-build? #f ;occasionally failed.
1175 (,@%cmake-build-system-modules
1176 (guix build python-build-system))
1177 #:modules ((guix build cmake-build-system)
1178 ((guix build python-build-system) #:prefix python:)
1181 (modify-phases %standard-phases
1182 (add-after 'unpack 'prevent-rebuild-during-installation
1184 (substitute* "python/setup.py"
1185 (("'build_py': BuildPyCommand,") ""))
1187 (add-after 'unpack 'patch-3rd-party-references
1188 (lambda* (#:key inputs #:allow-other-keys)
1189 (let ((rapidjson (assoc-ref inputs "rapidjson")))
1190 (substitute* "src/CMakeLists.txt"
1191 (("../deps/rapidjson-1.1.0")
1192 (string-append rapidjson "/include/rapidjson")))
1194 (add-before 'configure 'patch-python-binding-installation
1195 (lambda* (#:key outputs inputs #:allow-other-keys)
1196 (let ((out (assoc-ref outputs "out")))
1197 (substitute* "python/opencc/__init__.py"
1198 (("(_libopenccfile =).*$" _ prefix)
1199 (format #f "~a os.path.join('~a/lib', _libopenccfilename)~%"
1201 (("(_opencc_share_dir =).*$" _ prefix)
1202 (format #f "~a '~a/share/opencc'~%" prefix out))))
1204 (add-after 'install 'install-python-binding
1205 (lambda* (#:key outputs inputs #:allow-other-keys)
1206 (let* ((out (assoc-ref outputs "out"))
1207 (dist (string-append
1209 ,(version-major+minor (package-version python))
1213 (setenv "PYTHONPATH"
1214 (string-append dist ":" (getenv "GUIX_PYTHONPATH")))
1215 (invoke "python" "setup.py" "install"
1216 "--root=/" "--single-version-externally-managed"
1217 (string-append "--prefix=" out))
1219 (add-before 'install-python-binding 'enable-bytecode-determinism
1220 (assoc-ref python:%standard-phases 'enable-bytecode-determinism)))))
1222 `(("python" ,python-wrapper)
1223 ("rapidjson" ,rapidjson)
1224 ("python-setuptools" ,python-setuptools)
1225 ("python-wheel" ,python-wheel)))
1226 (home-page "https://github.com/BYVoid/OpenCC")
1227 (synopsis "Convert between Traditional Chinese and Simplified Chinese")
1228 (description "Open Chinese Convert (OpenCC) converts between Traditional
1229 Chinese and Simplified Chinese, supporting character-level conversion,
1230 phrase-level conversion, variant conversion, and regional idioms among
1231 Mainland China, Taiwan, and Hong-Kong.")
1232 (license license:asl2.0)))
1235 (let ((commit "08043eadf4abdddcf277842217e3c77a24740dc2")
1239 ;; The commits corresponding to specific versions are published
1241 ;; https://ja.osdn.net/projects/nkf/scm/git/nkf/
1246 (url "https://github.com/nurse/nkf")
1248 (file-name (git-file-name name version))
1251 "0anw0knr1iy4p9w3d3b3pbwzh1c43p1i2q4c28kw9zviw8kx2rly"))))
1252 (build-system gnu-build-system)
1254 `(#:tests? #f ; test for perl module
1255 #:make-flags (list "CC=gcc" "CFLAGS=-O2 -Wall -pedantic"
1256 (string-append "prefix=" %output)
1259 (modify-phases %standard-phases
1260 (delete 'configure)))) ; No ./configure script
1261 (home-page "https://ja.osdn.net/projects/nkf/")
1262 (synopsis "Network Kanji Filter")
1263 (description "Nkf is yet another kanji code converter among networks,
1264 hosts and terminals. It converts input kanji code to designated kanji code
1265 such as ISO-2022-JP, Shift_JIS, EUC-JP, UTF-8, UTF-16 or UTF-32.")
1266 (license license:zlib))))
1268 (define-public python-pandocfilters
1270 (name "python-pandocfilters")
1275 (uri (pypi-uri "pandocfilters" version))
1277 (base32 "1sq675dg4barb5949xxz4d5gk2ly524hi1p1xgwb3d1l0nsznqxw"))))
1278 (build-system python-build-system)
1279 (home-page "https://github.com/jgm/pandocfilters")
1280 (synopsis "Python module for writing Pandoc filters")
1281 (description "Pandoc is a powerful utility to transform various
1282 input formats into a wide range of output formats. To alter the
1283 exported output document, Pandoc allows the usage of filters, which
1284 are pipes that read a JSON serialization of the Pandoc AST from stdin,
1285 transform it in some way, and write it to stdout. It allows therefore
1286 to alter the processing of Pandoc's supported input formats, for
1287 instance one can add new syntax elements to markdown, etc.
1289 This package provides Python bindings.")
1290 (license license:bsd-3)))
1300 (url "https://github.com/theZiz/aha")
1303 (base32 "1gywad0rvvz3c5balz8cxsnx0562hj2ngzqyr8zsy2mb4pn0lpgv"))
1304 (file-name (git-file-name name version))))
1305 (build-system gnu-build-system)
1308 (modify-phases %standard-phases
1309 (delete 'configure))
1310 #:make-flags (list (string-append "CC=" ,(cc-for-target))
1311 (string-append "PREFIX="
1312 (assoc-ref %outputs "out")))
1313 #:tests? #f)) ; no test suite
1314 (home-page "https://github.com/theZiz/aha")
1315 (synopsis "Converts terminal escape sequences to HTML")
1316 (description "@command{aha} (Ansi Html Adapter) converts ANSI escape sequences
1317 of a Unix terminal to HTML code.")
1318 (license (list license:lgpl2.0+ license:mpl1.1))))
1320 (define-public go-github-com-errata-ai-vale
1322 (name "go-github-com-errata-ai-vale")
1328 (url "https://github.com/errata-ai/vale")
1329 (commit (string-append "v" version))))
1331 (base32 "0d07fwha2220m8j24h527xl0gnl3svvyaywflgk5292d6g49ach2"))
1332 (file-name (git-file-name name version))))
1333 (build-system go-build-system)
1335 `(("github.com/sp13/afero" ,go-github-com-spf13-afero)
1336 ("github.com/urfave/cli" ,go-github-com-urfave-cli)
1337 ("github.com/olekukonko/tablewriter" ,go-github-com-olekukonko-tablewriter)
1338 ("github.com/mitchellh/mapstructure" ,go-github-com-mitchellh-mapstructure)))
1340 `(#:import-path "github.com/errata-ai/vale"
1341 #:install-source? #f))
1342 (home-page "https://github.com/errata-ai/vale")
1343 (synopsis "Fully customizable syntax-aware linter that focuses on your style")
1345 "Vale is a fully extensible linter that focuses on your own writing style
1346 by making use of rules in individual YAML files. It is syntax-aware on markup
1347 languages such as HTML, Markdown, Asciidoc, and reStructuredText. The community
1348 around it also has a list of style guides implemented with Vale in
1349 @url{https://github.com/errata-ai/styles, their styles repo}.")
1350 (license license:expat)))