gnu: Add ratpoints.
[jackhill/guix/guix.git] / gnu / packages / textutils.scm
CommitLineData
7939e70a
TUBK
1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2015 Taylan Ulrich Bayırlı/Kammer <taylanbayirli@gmail.com>
0ad0ecee 3;;; Copyright © 2015, 2016, 2017, 2018, 2019 Ricardo Wurmus <rekado@elephly.net>
a64a8c46 4;;; Copyright © 2015, 2016 Ben Woodcroft <donttrustben@gmail.com>
e522d840 5;;; Copyright © 2015 Roel Janssen <roel@gnu.org>
2d8cf0b3 6;;; Copyright © 2016 Jelle Licht <jlicht@fsfe.org>
f17a5447 7;;; Copyright © 2016 Alex Griffin <a@ajgrf.com>
20a792b5 8;;; Copyright © 2016, 2018 Efraim Flashner <efraim@flashner.co.il>
47956fa0 9;;; Copyright © 2016 ng0 <ng0@n0.is>
0905048a 10;;; Copyright © 2016 Marius Bakke <mbakke@fastmail.com>
5353cea0 11;;; Copyright © 2017 Eric Bavier <bavier@member.fsf.org>
7fdca77e 12;;; Copyright © 2017 Rene Saavedra <rennes@openmailbox.org>
d0abaf89 13;;; Copyright © 2017 Hartmut Goebel <h.goebel@crazy-compilers.com>
3c8ba11a 14;;; Copyright © 2017 Kei Kebreau <kkebreau@posteo.net>
bfcdf887 15;;; Copyright © 2017 Alex Vong <alexvong1995@gmail.com>
f9c84cd4 16;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
4715f92e 17;;; Copyright © 2018 Pierre Neidhardt <mail@ambrevar.xyz>
1a0363cf 18;;; Copyright © 2018 Meiyo Peng <meiyo.peng@gmail.com>
933ac939 19;;; Copyright © 2019 Yoshinori Arai <kumagusu08@gmail.com>
7939e70a
TUBK
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)
ff3f6766 41 #:use-module (guix build-system ant)
7939e70a 42 #:use-module (guix build-system gnu)
03f801aa 43 #:use-module (guix build-system go)
c8d969b5 44 #:use-module (guix build-system cmake)
03639d03 45 #:use-module (guix build-system python)
9116f126 46 #:use-module (gnu packages)
f571e1c3 47 #:use-module (gnu packages autotools)
148585c2 48 #:use-module (gnu packages compression)
2f6e988d 49 #:use-module (gnu packages gettext)
ff3f6766 50 #:use-module (gnu packages java)
8888fe82 51 #:use-module (gnu packages ncurses)
52 #:use-module (gnu packages perl)
53 #:use-module (gnu packages pkg-config)
f17a5447 54 #:use-module (gnu packages python)
44d10b1f 55 #:use-module (gnu packages python-xyz)
8888fe82 56 #:use-module (gnu packages readline)
1506d491
EF
57 #:use-module (gnu packages slang)
58 #:use-module (gnu packages web))
7939e70a 59
2f6e988d
KK
60(define-public dos2unix
61 (package
62 (name "dos2unix")
3b2fa478 63 (version "7.4.0")
2f6e988d
KK
64 (source
65 (origin
66 (method url-fetch)
67 (uri (string-append "https://waterlan.home.xs4all.nl/" name "/"
68 name "-" version ".tar.gz"))
69 (sha256
3b2fa478 70 (base32 "12h4c61g376bhq03y5g2xszkrkrj5hwd928rly3xsp6rvfmnbixs"))))
2f6e988d
KK
71 (build-system gnu-build-system)
72 (arguments
73 '(#:make-flags (list "CC=gcc"
74 (string-append "prefix=" (assoc-ref %outputs "out")))
75 #:phases
76 (modify-phases %standard-phases
77 (delete 'configure)))) ; no configure script
78 (native-inputs
79 `(("gettext" ,gettext-minimal)
80 ("perl" ,perl)))
81 (home-page "https://waterlan.home.xs4all.nl/dos2unix.html")
82 (synopsis "DOS/Mac to Unix and vice versa text file format converter")
83 (description
84 "dos2unix is a tool to convert line breaks in a text file from Unix format
85to DOS format and vice versa.")
86 (license license:bsd-2)))
87
7939e70a
TUBK
88(define-public recode
89 (package
90 (name "recode")
08cbd4f3 91 (version "3.7.1")
7939e70a
TUBK
92 (source
93 (origin
20a792b5
EF
94 (method url-fetch)
95 (uri (string-append "https://github.com/rrthomas/recode/releases/"
96 "download/v" version "/" name "-" version ".tar.gz"))
7939e70a 97 (sha256
20a792b5 98 (base32
08cbd4f3 99 "0215hfj0rhlh0grg91qfx75pp6z09bpv8211qdxqihniw7y9a4fs"))
20a792b5 100 (modules '((guix build utils)))
6cbee49d
MW
101 (snippet '(begin
102 (delete-file "tests/Recode.c")
103 #t))))
7939e70a 104 (build-system gnu-build-system)
20a792b5
EF
105 (native-inputs
106 `(("python" ,python-2)
107 ("python2-cython" ,python2-cython)))
108 (home-page "https://github.com/rrthomas/recode")
7939e70a
TUBK
109 (synopsis "Text encoding converter")
110 (description "The Recode library converts files between character sets and
111usages. It recognises or produces over 200 different character sets (or about
112300 if combined with an iconv library) and transliterates files between almost
113any pair. When exact transliteration are not possible, it gets rid of
114offending characters or falls back on approximations. The recode program is a
115handy front-end to the library.")
20a792b5 116 (license license:gpl3+)))
688fe865
TUBK
117
118(define-public enca
119 (package
120 (name "enca")
1462b456 121 (version "1.19")
688fe865
TUBK
122 (source
123 (origin
124 (method url-fetch)
125 (uri (string-append
126 "https://github.com/nijel/enca/archive/" version ".tar.gz"))
127 (sha256
1462b456 128 (base32 "099z526i7qgij7q1w3lvhl88iv3jc3nqxca2i09h6s08ghyrmzf4"))
bbee7bd7 129 (file-name (string-append name "-" version ".tar.gz"))))
688fe865 130 (build-system gnu-build-system)
1462b456
EF
131 ;; enca-1.19 tests fail with recent recode.
132 ;(inputs `(("recode" ,recode)))
688fe865
TUBK
133 (home-page "https://github.com/nijel/enca")
134 (synopsis "Text encoding detection tool")
135 (description "Enca (Extremely Naive Charset Analyser) consists of libenca,
136an encoding detection library, and enca, a command line frontend, integrating
137libenca and several charset conversion libraries and tools.")
138 (license license:gpl2)))
cd15ad82
RW
139
140(define-public utf8proc
141 (package
142 (name "utf8proc")
8bcda205 143 (version "2.1.1")
cd15ad82
RW
144 (source
145 (origin
146 (method url-fetch)
147 (uri (string-append
148 "https://github.com/JuliaLang/utf8proc/archive/v"
149 version ".tar.gz"))
150 (file-name (string-append name "-" version ".tar.gz"))
151 (sha256
8bcda205 152 (base32 "1cnpigrazhslw65s4j1a56j7p6d7d61wsxxjf1218i9mkwv2yw17"))))
cd15ad82 153 (build-system gnu-build-system)
8bcda205 154 (inputs ; test data that is otherwise downloaded with curl
5353cea0
EB
155 `(("NormalizationTest.txt"
156 ,(origin
157 (method url-fetch)
158 (uri (string-append "http://www.unicode.org/Public/9.0.0/ucd/"
159 "NormalizationTest.txt"))
160 (sha256
161 (base32 "1fxrz0bilsbwl685336aqi88k62i6nqhm62rvy4zhg3bcm4dhj1d"))))
162 ("GraphemeBreakTest.txt"
163 ,(origin
164 (method url-fetch)
165 (uri (string-append "http://www.unicode.org/Public/9.0.0/ucd/"
166 "auxiliary/GraphemeBreakTest.txt"))
167 (sha256
168 (base32 "0qbhyhmf0778lc2hcwlpizrvmdxwpk959v2q2wb8abv09ba7wvn7"))))))
cd15ad82 169 (arguments
5353cea0 170 '(#:make-flags (list "CC=gcc"
f1e3a8ae 171 (string-append "prefix=" (assoc-ref %outputs "out")))
cd15ad82 172 #:phases
f1e3a8ae 173 (modify-phases %standard-phases
5353cea0
EB
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 (("×") "+")))))))
4f447d2f 184 (home-page "https://julialang.org/utf8proc/")
cd15ad82
RW
185 (synopsis "C library for processing UTF-8 Unicode data")
186 (description "utf8proc is a small C library that provides Unicode
187normalization, case-folding, and other operations for data in the UTF-8
9b72ce60 188encoding, supporting Unicode version 9.0.0.")
cd15ad82 189 (license license:expat)))
f571e1c3 190
205df739
TGR
191(define-public libconfuse
192 (package
193 (name "libconfuse")
194 (version "3.2.2")
195 (source
196 (origin
197 (method url-fetch)
198 (uri (string-append "https://github.com/martinh/libconfuse/"
199 "releases/download/v" version
200 "/confuse-" version ".tar.xz"))
201 (sha256
202 (base32 "02r1mmzik2m0iigbc2da3y754vj24i18r3ml5p2wzs027mjhn959"))))
203 (build-system gnu-build-system)
204 (home-page "https://github.com/martinh/libconfuse")
205 (synopsis "Configuration file parser library")
206 (description "libconfuse is a configuration file parser library. It
207supports sections and (lists of) values (strings, integers, floats, booleans
208or other sections), as well as some other features (such as
209single/double-quoted strings, environment variable expansion, functions and
210nested include statements).")
211 (license license:isc)))
212
f571e1c3
RW
213(define-public libgtextutils
214 (package
215 (name "libgtextutils")
216 (version "0.7")
217 (source
218 (origin
219 (method url-fetch)
220 (uri (string-append
221 "https://github.com/agordon/libgtextutils/releases/download/"
222 version "/libgtextutils-" version ".tar.gz"))
223 (sha256
224 (base32 "0jiybkb2z58wa2msvllnphr4js2hvjvh988pavb3mzkgr6ihwbkr"))))
225 (build-system gnu-build-system)
e005ddc2
EF
226 (arguments
227 '(#:phases
228 (modify-phases %standard-phases
229 (replace 'bootstrap
230 (lambda _ (invoke "sh" "reconf"))))))
f571e1c3
RW
231 (native-inputs
232 `(("autoconf" ,autoconf)
233 ("automake" ,automake)
234 ("libtool" ,libtool)))
235 (home-page "https://github.com/agordon/libgtextutils")
236 (synopsis "Gordon's text utils library")
237 (description
238 "libgtextutils is a text utilities library used by the fastx toolkit from
239the Hannon Lab.")
240 (license license:agpl3+)))
aae2b445
BW
241
242(define-public cityhash
a64a8c46 243 (let ((commit "8af9b8c"))
aae2b445
BW
244 (package
245 (name "cityhash")
a64a8c46 246 (version (string-append "1.1-2." commit))
aae2b445
BW
247 (source (origin
248 (method git-fetch)
249 (uri (git-reference
250 (url "https://github.com/google/cityhash.git")
251 (commit commit)))
252 (file-name (string-append name "-" version ".tar.gz"))
253 (sha256
254 (base32
255 "0n6skf5dv8yfl1ckax8dqhvsbslkwc9158zf2ims0xqdvzsahbi6"))))
a64a8c46
BW
256 (build-system gnu-build-system)
257 (arguments
258 '(#:make-flags (list "CXXFLAGS=-g -O3")
259 #:phases
260 (modify-phases %standard-phases
261 ;; citycrc is not installed by default but is used by some
262 ;; programs.
263 (add-after 'install 'install-citycrc
264 (lambda* (#:key outputs #:allow-other-keys)
265 (let* ((out (assoc-ref outputs "out"))
266 (include (string-append out "/include")))
267 (install-file "src/citycrc.h" include))
268 #t)))))
269 (home-page "https://github.com/google/cityhash")
270 (synopsis "C++ hash functions for strings")
271 (description
272 "CityHash provides hash functions for strings. The functions mix the
aae2b445 273input bits thoroughly but are not suitable for cryptography.")
a64a8c46 274 (license license:expat))))
e522d840 275
9128db21
RW
276(define-public ustr
277 (package
278 (name "ustr")
279 (version "1.0.4")
280 (source (origin
281 (method url-fetch)
282 (uri (string-append "http://www.and.org/ustr/" version
283 "/ustr-" version ".tar.bz2"))
284 (sha256
285 (base32
7fdca77e
RS
286 "1i623ygdj7rkizj7985q9d6vj5amwg686aqb5j3ixpkqkyp6xbrx"))
287 (patches (search-patches "ustr-fix-build-with-gcc-5.patch"))))
9128db21
RW
288 (build-system gnu-build-system)
289 (arguments
290 `(#:make-flags
291 (list "CC=gcc"
292 "HIDE="
293 ;; Override "/sbin/ldconfig" with "echo" because we don't need
294 ;; "ldconfig".
295 "LDCONFIG=echo"
296 (string-append "prefix=" (assoc-ref %outputs "out"))
297 "all-shared")
298 #:phases
299 (modify-phases %standard-phases
300 (add-after 'unpack 'disable-check-for-stdint
301 (lambda _
302 ;; Of course we have stdint.h, just not in /usr/include
303 (substitute* '("Makefile"
304 "ustr-import.in")
305 (("-f \"/usr/include/stdint.h\"") "-z \"\""))
306 #t))
307 ;; No configure script
308 (delete 'configure))))
309 (home-page "http://www.and.org/ustr/")
310 (synopsis "String library with very low memory overhead")
311 (description
312 "Ustr is a string library for C with very low memory overhead.")
313 ;; Quoted from the home page: "The License for the code is MIT, new-BSD,
314 ;; LGPL, etc. ... if you need another license to help compatibility, just
315 ;; ask for it. It's basically public domain, without all the legal
316 ;; problems for everyone that trying to make something public domain
317 ;; entails."
318 (license license:public-domain)))
319
e522d840
RJ
320(define-public libconfig
321 (package
322 (name "libconfig")
1b362016
MB
323 (version "1.7.2")
324 (home-page "https://hyperrealm.github.io/libconfig/")
e522d840
RJ
325 (source (origin
326 (method url-fetch)
1b362016
MB
327 (uri (string-append home-page "/dist/libconfig-"
328 version ".tar.gz"))
e522d840
RJ
329 (sha256
330 (base32
1b362016 331 "1ngs2qx3cx5cbwinc5mvadly0b5n7s86zsc68c404czzfff7lg3w"))))
e522d840 332 (build-system gnu-build-system)
e522d840
RJ
333 (synopsis "C/C++ configuration file library")
334 (description
335 "Libconfig is a simple library for manipulating structured configuration
336files. This file format is more compact and more readable than XML. And
337unlike XML, it is type-aware, so it is not necessary to do string parsing in
338application code.")
339 (license license:lgpl2.1+)))
c8d969b5
PP
340
341(define-public pfff
342 (package
343 (name "pfff")
344 (version "1.0")
345 (source (origin
346 (method url-fetch)
347 (uri (string-append "https://github.com/pfff/pfff/archive/v"
348 version ".tar.gz"))
349 (file-name (string-append name "-" version ".tar.gz"))
350 (sha256
351 (base32
352 "00m553aa277iarxj6dalmklyb64r7ias49bfwzbacsfg8h3kar8m"))))
353 (build-system cmake-build-system)
354 (home-page "http://biit.cs.ut.ee/pfff/")
355 (synopsis "Probabilistic fast file fingerprinting tool")
356 (description
357 "pfff is a tool for calculating a compact digital fingerprint of a file
358by sampling randomly from the file instead of reading it in full.
359Consequently, the computation has a flat performance characteristic,
360correlated with data variation rather than file size. pfff can be as reliable
361as existing hashing techniques, with provably negligible risk of collisions.")
362 (license license:bsd-3)))
2d8cf0b3
JL
363
364(define-public oniguruma
365 (package
366 (name "oniguruma")
142a1684 367 (version "6.9.2")
2d8cf0b3
JL
368 (source (origin
369 (method url-fetch)
370 (uri (string-append "https://github.com/kkos/"
371 "oniguruma/releases/download/v" version
372 "/onig-" version ".tar.gz"))
373 (sha256
374 (base32
142a1684 375 "0slp4hpw9qxk4xhn7abyw7065sd355xwkyfq72glxczcjsqxsynv"))))
2d8cf0b3
JL
376 (build-system gnu-build-system)
377 (home-page "https://github.com/kkos/oniguruma")
378 (synopsis "Regular expression library")
379 (description "Oniguruma is a regular expressions library. The special
380characteristic of this library is that different character encoding for every
381regular expression object can be specified.")
382 (license license:bsd-2)))
1b90e57e 383
d5019f9c
MB
384;; PHP < 7.3.0 requires this old version. Remove once no longer needed.
385(define-public oniguruma-5
386 (package
387 (inherit oniguruma)
388 (version "5.9.6")
389 (source (origin
390 (method url-fetch)
391 (uri (string-append "https://github.com/kkos/"
392 "oniguruma/releases/download/v" version
393 "/onig-" version ".tar.gz"))
394 (sha256
395 (base32
396 "19s79vsclqn170mw0ajwv7j37qsbn4f1yjz3yavnhvva6c820r6m"))))))
397
1b90e57e
RW
398(define-public antiword
399 (package
400 (name "antiword")
401 (version "0.37")
402 (source (origin
403 (method url-fetch)
404 (uri (string-append "http://www.winfield.demon.nl/linux"
405 "/antiword-" version ".tar.gz"))
406 (sha256
407 (base32
9116f126
EF
408 "1b7mi1l20jhj09kyh0bq14qzz8vdhhyf35gzwsq43mn6rc7h0b4f"))
409 (patches (search-patches "antiword-CVE-2014-8123.patch"))))
1b90e57e
RW
410 (build-system gnu-build-system)
411 (arguments
412 `(#:tests? #f ; There are no tests
413 #:make-flags
414 (list "-f" "Makefile.Linux"
415 (string-append "GLOBAL_INSTALL_DIR="
416 (assoc-ref %outputs "out") "/bin")
417 (string-append "GLOBAL_RESOURCES_DIR="
418 (assoc-ref %outputs "out") "/share/antiword"))
419 #:phases
420 (modify-phases %standard-phases
b28e05d4
RW
421 (replace 'configure
422 (lambda* (#:key outputs #:allow-other-keys)
423 ;; Ensure that mapping files can be found in the actual package
424 ;; data directory.
425 (substitute* "antiword.h"
426 (("/usr/share/antiword")
427 (string-append (assoc-ref outputs "out") "/share/antiword")))
428 #t))
1b90e57e
RW
429 (replace 'install
430 (lambda* (#:key make-flags #:allow-other-keys)
0ad0ecee 431 (apply invoke "make" `("global_install" ,@make-flags)))))))
1b90e57e
RW
432 (home-page "http://www.winfield.demon.nl/")
433 (synopsis "Microsoft Word document reader")
434 (description "Antiword is an application for displaying Microsoft Word
435documents. It can also convert the document to PostScript or XML. Only
436documents made by MS Word version 2 and version 6 or later are supported. The
437name comes from: \"The antidote against people who send Microsoft Word files
438to everybody, because they believe that everybody runs Windows and therefore
439runs Word\".")
440 (license license:gpl2+)))
f17a5447 441
d0abaf89
HG
442(define-public catdoc
443 (package
444 (name "catdoc")
445 (version "0.95")
446 (source (origin
447 (method url-fetch)
448 (uri (string-append "http://ftp.wagner.pp.ru/pub/catdoc/"
449 "catdoc-" version ".tar.gz"))
bfcdf887 450 (patches (search-patches "catdoc-CVE-2017-11110.patch"))
d0abaf89
HG
451 (sha256
452 (base32
453 "15h7v3bmwfk4z8r78xs5ih6vd0pskn0rj90xghvbzdjj0cc88jji"))))
454 (build-system gnu-build-system)
455 ;; TODO: Also build `wordview` which requires `tk` – make a separate
456 ;; package for this.
457 (arguments
458 '(#:tests? #f ; There are no tests
459 #:configure-flags '("--disable-wordview")
460 #:phases
461 (modify-phases %standard-phases
462 (add-before 'install 'fix-install
463 (lambda* (#:key outputs #:allow-other-keys)
464 (let ((out (assoc-ref outputs "out")))
465 (mkdir-p (string-append out "/share/man/man1"))))))))
466 (home-page "http://www.wagner.pp.ru/~vitus/software/catdoc/")
467 (synopsis "MS-Word to TeX or plain text converter")
468 (description "@command{catdoc} extracts text from MS-Word files, trying to
469preserve as many special printable characters as possible. It supports
470everything up to Word-97. Also supported are MS Write documents and RTF files.
471
472@command{catdoc} does not preserve complex word formatting, but it can
473translate some non-ASCII characters into TeX escape codes. It's goal is to
474extract plain text and allow you to read it and, probably, reformat with TeX,
475according to TeXnical rules.
476
477This package also provides @command{xls2csv}, which extracts data from Excel
478spreadsheets and outputs it in comma-separated-value format, and
479@command{catppt}, which extracts data from PowerPoint presentations.")
480 (license license:gpl2+)))
481
f17a5447
AG
482(define-public utfcpp
483 (package
484 (name "utfcpp")
f9c84cd4 485 (version "2.3.5")
f17a5447
AG
486 (source (origin
487 (method url-fetch)
488 (uri
f9c84cd4
TGR
489 (string-append "https://github.com/nemtrif/utfcpp/archive/v"
490 version ".tar.gz"))
491 (file-name (string-append name "-" version ".tar.gz"))
f17a5447
AG
492 (sha256
493 (base32
f9c84cd4
TGR
494 "0gcqcfw19kfim8xw29xdp91l310yfjyrqdj2zsx8xx02dkpy1zzk"))))
495 (build-system cmake-build-system)
f17a5447 496 (arguments
f9c84cd4
TGR
497 `(#:out-of-source? #f
498 #:phases
499 (modify-phases %standard-phases
500 (replace 'install ; no install target
501 (lambda* (#:key outputs #:allow-other-keys)
502 (let* ((out (assoc-ref outputs "out"))
503 (include (string-append out "/include"))
504 (doc (string-append out "/share/doc/" ,name)))
505 (copy-recursively "source" include)
506 (install-file "README.md" doc)
507 #t))))))
f17a5447
AG
508 (home-page "https://github.com/nemtrif/utfcpp")
509 (synopsis "Portable C++ library for handling UTF-8")
510 (description "UTF8-CPP is a C++ library for handling UTF-8 encoded text
511in a portable way.")
512 (license license:boost1.0)))
8888fe82 513
514(define-public dbacl
515 (package
516 (name "dbacl")
517 (version "1.14")
518 (source
519 (origin
520 (method url-fetch)
521 (uri (string-append "http://www.lbreyer.com/gpl/"
50b01dcf 522 "dbacl-" version ".tar.gz"))
8888fe82 523 (sha256
524 (base32
525 "0224g6x71hyvy7jikfxmgcwww1r5lvk0jx36cva319cb9nmrbrq7"))))
526 (build-system gnu-build-system)
527 (arguments
528 `(#:make-flags
529 (list
530 (string-append "-I" (assoc-ref %build-inputs "slang")
531 "/include/slang")
532 (string-append "-I" (assoc-ref %build-inputs "ncurses")
533 "/include/ncurses"))
534 #:phases
535 (modify-phases %standard-phases
536 (add-after 'unpack 'delete-sample6-and-japanese
537 (lambda _
538 (substitute* "doc/Makefile.am"
539 (("sample6.txt") "")
540 (("japanese.txt") ""))
541 (delete-file "doc/sample6.txt")
542 (delete-file "doc/japanese.txt")
543 (substitute* (list "src/tests/Makefile.am"
544 "src/tests/Makefile.in")
545 (("dbacl-jap.shin") "")
546 (("dbacl-jap.sh") ""))
547 #t))
548 (add-after 'unpack 'delete-test
549 ;; See comments about the license.
550 (lambda _
db317b38
TGR
551 (delete-file "src/tests/dbacl-jap.shin")
552 #t))
8888fe82 553 (add-after 'delete-sample6-and-japanese 'autoreconf
554 (lambda _
db317b38
TGR
555 (invoke "autoreconf" "-vif")
556 #t))
8888fe82 557 (add-after 'unpack 'fix-test-files
558 (lambda* (#:key inputs outputs #:allow-other-keys)
559 (let* ((out (assoc-ref outputs "out"))
560 (bin (string-append out "/bin")))
561 (substitute* (find-files "src/tests/" "\\.shin$")
562 (("PATH=/bin:/usr/bin")
563 "#PATH=/bin:/usr/bin")
564 (("diff") (string-append (which "diff")))
565 (("tr") (string-append (which "tr"))))
566 #t))))))
567 (inputs
568 `(("ncurses" ,ncurses)
569 ("perl" ,perl)
570 ("readline" ,readline)
571 ("slang" ,slang)))
572 (native-inputs
573 `(("libtool" ,libtool)
574 ("autoconf" ,autoconf)
575 ("automake" ,automake)
576 ("pkg-config" ,pkg-config)))
7314a547 577 (home-page "https://www.lbreyer.com/dbacl.html")
8888fe82 578 (synopsis "Bayesian text and email classifier")
579 (description
580 "dbacl is a fast Bayesian text and email classifier. It builds a variety
581of language models using maximum entropy (minimum divergence) principles, and
582these can then be used to categorize input data automatically among multiple
583categories.")
584 ;; The software is licensed as GPLv3 or later, but
585 ;; includes various sample texts in the doc dir:
586 ;; - sample1.txt, sample3 and sampe5.txt are in the public domain,
587 ;; by Mark Twain.
588 ;; - sample2.txt, sample4.txt are in the public domain, by Aristotle.
589 ;; - sample6.txt is a forwarded email, copyright unknown.
590 ;; Guix does exclude sample6.txt.
591 ;; - japanese.txt is a Japanese unoffical translation of the
592 ;; GNU General Public License, (c) by the Free Software Foundation.
593 ;; Guix excludes this file.
594 (license (list license:gpl3+ license:public-domain))))
0905048a
MB
595
596(define-public dotconf
597 (package
598 (name "dotconf")
599 (version "1.3")
600 (source (origin
08bc7f26
RW
601 (method git-fetch)
602 (uri (git-reference
603 (url "https://github.com/williamh/dotconf.git")
604 (commit (string-append "v" version))))
605 (file-name (git-file-name name version))
0905048a
MB
606 (sha256
607 (base32
08bc7f26 608 "1sc95hw5k2xagpafny0v35filmcn05k1ds5ghkldfpf6xw4hakp7"))))
0905048a 609 (build-system gnu-build-system)
7a52d0e0 610 (arguments `(#:tests? #f)) ; FIXME maketest.sh does not work.
0905048a
MB
611 (native-inputs
612 `(("autoconf" ,autoconf)
613 ("automake" ,automake)
614 ("libtool" ,libtool)))
615 (home-page "https://github.com/williamh/dotconf")
616 (synopsis "Configuration file parser library")
617 (description
618 "C library for creating and parsing configuration files.")
619 (license (list license:lgpl2.1 ; Main distribution.
620 license:asl1.1)))) ; src/readdir.{c,h}
ff3f6766
RW
621
622(define-public java-rsyntaxtextarea
623 (package
624 (name "java-rsyntaxtextarea")
625 (version "2.6.1")
626 (source (origin
627 (method url-fetch)
628 (uri (string-append "https://github.com/bobbylight/"
629 "RSyntaxTextArea/archive/"
630 version ".tar.gz"))
631 (file-name (string-append name "-" version ".tar.gz"))
632 (sha256
633 (base32
634 "0c5mqg2klj5rvf8fhycrli8rf6s37l9p7a8knw9gpp65r1c120q2"))))
635 (build-system ant-build-system)
636 (arguments
637 `(;; FIXME: some tests fail because locale resources cannot be found.
638 ;; Even when I add them to the class path,
639 ;; RSyntaxTextAreaEditorKitDumbCompleteWordActionTest fails.
640 #:tests? #f
641 #:jar-name "rsyntaxtextarea.jar"))
642 (native-inputs
643 `(("java-junit" ,java-junit)
644 ("java-hamcrest-core" ,java-hamcrest-core)))
645 (home-page "https://bobbylight.github.io/RSyntaxTextArea/")
646 (synopsis "Syntax highlighting text component for Java Swing")
647 (description "RSyntaxTextArea is a syntax highlighting, code folding text
648component for Java Swing. It extends @code{JTextComponent} so it integrates
649completely with the standard @code{javax.swing.text} package. It is fast and
650efficient, and can be used in any application that needs to edit or view
651source code.")
652 (license license:bsd-3)))
03639d03
RW
653
654;; We use the sources from git instead of the tarball from pypi, because the
655;; latter does not include the Cython source file from which bycython.cpp is
656;; generated.
657(define-public python-editdistance
658 (let ((commit "3ea84a7dd3258c76aa3be851ef3d50e59c886846")
659 (revision "1"))
660 (package
661 (name "python-editdistance")
662 (version (string-append "0.3.1-" revision "." (string-take commit 7)))
663 (source
664 (origin
665 (method git-fetch)
666 (uri (git-reference
667 (url "https://github.com/aflc/editdistance.git")
668 (commit commit)))
54335b59 669 (file-name (git-file-name name version))
03639d03
RW
670 (sha256
671 (base32
672 "1l43svsv12crvzphrgi6x435z6xg8m086c64armp8wzb4l8ccm7g"))))
673 (build-system python-build-system)
674 (arguments
675 `(#:phases
676 (modify-phases %standard-phases
677 (add-after 'unpack 'build-cython-code
678 (lambda _
679 (with-directory-excursion "editdistance"
680 (delete-file "bycython.cpp")
54d5b27e 681 (invoke "cython" "--cplus" "bycython.pyx")))))))
03639d03
RW
682 (native-inputs
683 `(("python-cython" ,python-cython)))
684 (home-page "https://www.github.com/aflc/editdistance")
685 (synopsis "Fast implementation of the edit distance (Levenshtein distance)")
686 (description
687 "This library simply implements Levenshtein distance algorithm with C++
688and Cython.")
689 (license license:expat))))
03f801aa
CB
690
691(define-public go-github.com-mattn-go-runewidth
692 (package
693 (name "go-github.com-mattn-go-runewidth")
694 (version "0.0.2")
695 (source (origin
696 (method git-fetch)
697 (uri (git-reference
698 (url "https://github.com/mattn/go-runewidth")
699 (commit (string-append "v" version))))
700 (file-name (git-file-name name version))
701 (sha256
702 (base32
703 "0vkrfrz3fzn5n6ix4k8s0cg0b448459sldq8bp4riavsxm932jzb"))))
704 (build-system go-build-system)
705 (arguments
706 '(#:import-path "github.com/mattn/go-runewidth"))
707 (synopsis "@code{runewidth} provides Go functions to work with string widths")
708 (description
709 "The @code{runewidth} library provides Go functions for padding,
710measuring and checking the width of strings, with support east asian text.")
711 (home-page "https://github.com/jessevdk/go-flags")
712 (license license:expat)))
74fa77e9
PN
713
714(define-public docx2txt
715 (package
716 (name "docx2txt")
717 (version "1.4")
718 (source (origin
719 (method url-fetch)
720 (uri (string-append
721 "mirror://sourceforge/docx2txt/docx2txt/v"
722 version "/docx2txt-" version ".tgz"))
723 (sha256
724 (base32
725 "06vdikjvpj6qdb41d8wzfnyj44jpnknmlgbhbr1w215420lpb5xj"))))
726 (build-system gnu-build-system)
727 (inputs
728 `(("unzip" ,unzip)
729 ("perl" ,perl)))
730 (arguments
731 `(#:tests? #f ; No tests.
732 #:make-flags (list (string-append "BINDIR="
733 (assoc-ref %outputs "out") "/bin")
734 (string-append "CONFIGDIR="
735 (assoc-ref %outputs "out") "/etc")
736 ;; Makefile seems to be a bit dumb at guessing.
737 (string-append "INSTALL=install")
738 (string-append "PERL=perl"))
739 #:phases
740 (modify-phases %standard-phases
741 (delete 'configure)
742 (add-after 'install 'fix-install
743 (lambda* (#:key outputs inputs #:allow-other-keys)
744 (let* ((out (assoc-ref outputs "out"))
745 (bin (string-append out "/bin"))
746 (config (string-append out "/etc/docx2txt.config"))
747 (unzip (assoc-ref inputs "unzip")))
748 ;; According to INSTALL, the .sh wrapper can be skipped.
749 (delete-file (string-append bin "/docx2txt.sh"))
750 (rename-file (string-append bin "/docx2txt.pl")
751 (string-append bin "/docx2txt"))
752 (substitute* config
753 (("config_unzip => '/usr/bin/unzip',")
754 (string-append "config_unzip => '"
755 unzip
756 "/bin/unzip',")))
757 ;; Makefile is wrong.
f6ccb95a
TGR
758 (chmod config #o644)
759 #t))))))
74fa77e9
PN
760 (synopsis "Recover text from @file{.docx} files, with good formatting")
761 (description
762 "@command{docx2txt} is a Perl based command line utility to convert
763Microsoft Office @file{.docx} documents to equivalent text documents. Latest
764version supports following features during text extraction.
765
766@itemize
767@item Character conversions; currency characters are converted to respective
768names like Euro.
769@item Capitalisation of text blocks.
770@item Center and right justification of text fitting in a line of
771(configurable) 80 columns.
772@item Horizontal ruler, line breaks, paragraphs separation, tabs.
773@item Indicating hyperlinked text along with the hyperlink (configurable).
774@item Handling (bullet, decimal, letter, roman) lists along with (attempt at)
775indentation.
776@end itemize\n")
777 (home-page "http://docx2txt.sourceforge.net")
778 (license license:gpl3+)))
1a0363cf
MP
779
780(define-public opencc
781 (package
782 (name "opencc")
783 (version "1.0.5")
784 (source
785 (origin
bf5af934
EF
786 (method git-fetch)
787 (uri (git-reference
788 (url "https://github.com/BYVoid/OpenCC")
789 (commit (string-append "ver." version))))
790 (file-name (git-file-name name version))
1a0363cf 791 (sha256
1506d491
EF
792 (base32
793 "1pv5md225qwhbn8ql932zdg6gh1qlx3paiajaks8gfsa07yzvhr4"))
794 (modules '((guix build utils)))
795 (snippet
796 '(begin
797 ;; TODO: Unbundle tclap, darts-clone, gtest
798 (delete-file-recursively "deps/rapidjson-0.11") #t))))
1a0363cf 799 (build-system cmake-build-system)
1506d491
EF
800 (arguments
801 '(#:phases
802 (modify-phases %standard-phases
803 (add-after 'unpack 'patch-3rd-party-references
804 (lambda* (#:key inputs #:allow-other-keys)
805 (let ((rapidjson (assoc-ref inputs "rapidjson")))
806 (substitute* "src/CMakeLists.txt"
807 (("../deps/rapidjson-0.11")
808 (string-append rapidjson "/include/rapidjson")))
809 #t))))))
1a0363cf 810 (native-inputs
1506d491
EF
811 `(("python" ,python-wrapper)
812 ("rapidjson" ,rapidjson)))
1a0363cf
MP
813 (home-page "https://github.com/BYVoid/OpenCC")
814 (synopsis "Convert between Traditional Chinese and Simplified Chinese")
815 (description "Open Chinese Convert (OpenCC) converts between Traditional
816Chinese and Simplified Chinese, supporting character-level conversion,
817phrase-level conversion, variant conversion, and regional idioms among
818Mainland China, Taiwan, and Hong-Kong.")
819 (license license:asl2.0)))
933ac939
YA
820
821(define-public nkf
822 (let ((commit "08043eadf4abdddcf277842217e3c77a24740dc2")
823 (revision "1"))
824 (package
825 (name "nkf")
826 ;; The commits corresponding to specific versions are published
827 ;; here:
828 ;; https://ja.osdn.net/projects/nkf/scm/git/nkf/
829 (version "2.1.5")
830 (source (origin
831 (method git-fetch)
832 (uri (git-reference
833 (url "https://github.com/nurse/nkf.git")
834 (commit commit)))
835 (file-name (git-file-name name version))
836 (sha256
837 (base32
838 "0anw0knr1iy4p9w3d3b3pbwzh1c43p1i2q4c28kw9zviw8kx2rly"))))
839 (build-system gnu-build-system)
840 (arguments
841 `(#:tests? #f ; test for perl module
842 #:make-flags (list "CC=gcc" "CFLAGS=-O2 -Wall -pedantic"
843 (string-append "prefix=" %output)
844 "MKDIR=mkdir -p")
845 #:phases
846 (modify-phases %standard-phases
847 (delete 'configure)))) ; No ./configure script
848 (home-page "https://ja.osdn.net/projects/nkf/")
849 (synopsis "Network Kanji Filter")
850 (description "Nkf is yet another kanji code converter among networks,
851hosts and terminals. It converts input kanji code to designated kanji code
852such as ISO-2022-JP, Shift_JIS, EUC-JP, UTF-8, UTF-16 or UTF-32.")
853 (license license:zlib))))