textutils.scm 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797
  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 Efraim Flashner <efraim@flashner.co.il>
  9. ;;; Copyright © 2016 Nils Gillmann <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 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 Tobias Geerinckx-Rice <me@tobias.gr>
  17. ;;; Copyright © 2018 Pierre Neidhardt <mail@ambrevar.xyz>
  18. ;;; Copyright © 2018 Meiyo Peng <meiyo.peng@gmail.com>
  19. ;;;
  20. ;;; This file is part of GNU Guix.
  21. ;;;
  22. ;;; GNU Guix is free software; you can redistribute it and/or modify it
  23. ;;; under the terms of the GNU General Public License as published by
  24. ;;; the Free Software Foundation; either version 3 of the License, or (at
  25. ;;; your option) any later version.
  26. ;;;
  27. ;;; GNU Guix is distributed in the hope that it will be useful, but
  28. ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
  29. ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  30. ;;; GNU General Public License for more details.
  31. ;;;
  32. ;;; You should have received a copy of the GNU General Public License
  33. ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
  34. (define-module (gnu packages textutils)
  35. #:use-module ((guix licenses) #:prefix license:)
  36. #:use-module (guix packages)
  37. #:use-module (guix download)
  38. #:use-module (guix git-download)
  39. #:use-module (guix build-system ant)
  40. #:use-module (guix build-system gnu)
  41. #:use-module (guix build-system go)
  42. #:use-module (guix build-system cmake)
  43. #:use-module (guix build-system python)
  44. #:use-module (gnu packages)
  45. #:use-module (gnu packages autotools)
  46. #:use-module (gnu packages compression)
  47. #:use-module (gnu packages gettext)
  48. #:use-module (gnu packages java)
  49. #:use-module (gnu packages ncurses)
  50. #:use-module (gnu packages perl)
  51. #:use-module (gnu packages pkg-config)
  52. #:use-module (gnu packages python)
  53. #:use-module (gnu packages python-xyz)
  54. #:use-module (gnu packages readline)
  55. #:use-module (gnu packages slang)
  56. #:use-module (gnu packages web))
  57. (define-public dos2unix
  58. (package
  59. (name "dos2unix")
  60. (version "7.4.0")
  61. (source
  62. (origin
  63. (method url-fetch)
  64. (uri (string-append "https://waterlan.home.xs4all.nl/" name "/"
  65. name "-" version ".tar.gz"))
  66. (sha256
  67. (base32 "12h4c61g376bhq03y5g2xszkrkrj5hwd928rly3xsp6rvfmnbixs"))))
  68. (build-system gnu-build-system)
  69. (arguments
  70. '(#:make-flags (list "CC=gcc"
  71. (string-append "prefix=" (assoc-ref %outputs "out")))
  72. #:phases
  73. (modify-phases %standard-phases
  74. (delete 'configure)))) ; no configure script
  75. (native-inputs
  76. `(("gettext" ,gettext-minimal)
  77. ("perl" ,perl)))
  78. (home-page "https://waterlan.home.xs4all.nl/dos2unix.html")
  79. (synopsis "DOS/Mac to Unix and vice versa text file format converter")
  80. (description
  81. "dos2unix is a tool to convert line breaks in a text file from Unix format
  82. to DOS format and vice versa.")
  83. (license license:bsd-2)))
  84. (define-public recode
  85. (package
  86. (name "recode")
  87. (version "3.7.1")
  88. (source
  89. (origin
  90. (method url-fetch)
  91. (uri (string-append "https://github.com/rrthomas/recode/releases/"
  92. "download/v" version "/" name "-" version ".tar.gz"))
  93. (sha256
  94. (base32
  95. "0215hfj0rhlh0grg91qfx75pp6z09bpv8211qdxqihniw7y9a4fs"))
  96. (modules '((guix build utils)))
  97. (snippet '(begin
  98. (delete-file "tests/Recode.c")
  99. #t))))
  100. (build-system gnu-build-system)
  101. (native-inputs
  102. `(("python" ,python-2)
  103. ("python2-cython" ,python2-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. (define-public enca
  114. (package
  115. (name "enca")
  116. (version "1.19")
  117. (source
  118. (origin
  119. (method url-fetch)
  120. (uri (string-append
  121. "https://github.com/nijel/enca/archive/" version ".tar.gz"))
  122. (sha256
  123. (base32 "099z526i7qgij7q1w3lvhl88iv3jc3nqxca2i09h6s08ghyrmzf4"))
  124. (file-name (string-append name "-" version ".tar.gz"))))
  125. (build-system gnu-build-system)
  126. ;; enca-1.19 tests fail with recent recode.
  127. ;(inputs `(("recode" ,recode)))
  128. (home-page "https://github.com/nijel/enca")
  129. (synopsis "Text encoding detection tool")
  130. (description "Enca (Extremely Naive Charset Analyser) consists of libenca,
  131. an encoding detection library, and enca, a command line frontend, integrating
  132. libenca and several charset conversion libraries and tools.")
  133. (license license:gpl2)))
  134. (define-public utf8proc
  135. (package
  136. (name "utf8proc")
  137. (version "2.1.1")
  138. (source
  139. (origin
  140. (method url-fetch)
  141. (uri (string-append
  142. "https://github.com/JuliaLang/utf8proc/archive/v"
  143. version ".tar.gz"))
  144. (file-name (string-append name "-" version ".tar.gz"))
  145. (sha256
  146. (base32 "1cnpigrazhslw65s4j1a56j7p6d7d61wsxxjf1218i9mkwv2yw17"))))
  147. (build-system gnu-build-system)
  148. (inputs ; test data that is otherwise downloaded with curl
  149. `(("NormalizationTest.txt"
  150. ,(origin
  151. (method url-fetch)
  152. (uri (string-append "http://www.unicode.org/Public/9.0.0/ucd/"
  153. "NormalizationTest.txt"))
  154. (sha256
  155. (base32 "1fxrz0bilsbwl685336aqi88k62i6nqhm62rvy4zhg3bcm4dhj1d"))))
  156. ("GraphemeBreakTest.txt"
  157. ,(origin
  158. (method url-fetch)
  159. (uri (string-append "http://www.unicode.org/Public/9.0.0/ucd/"
  160. "auxiliary/GraphemeBreakTest.txt"))
  161. (sha256
  162. (base32 "0qbhyhmf0778lc2hcwlpizrvmdxwpk959v2q2wb8abv09ba7wvn7"))))))
  163. (arguments
  164. '(#:make-flags (list "CC=gcc"
  165. (string-append "prefix=" (assoc-ref %outputs "out")))
  166. #:phases
  167. (modify-phases %standard-phases
  168. (delete 'configure)
  169. (add-before 'check 'check-data
  170. (lambda* (#:key inputs #:allow-other-keys)
  171. (for-each (lambda (i)
  172. (copy-file (assoc-ref inputs i)
  173. (string-append "data/" i)))
  174. '("NormalizationTest.txt" "GraphemeBreakTest.txt"))
  175. (substitute* "data/GraphemeBreakTest.txt"
  176. (("÷") "/")
  177. (("×") "+")))))))
  178. (home-page "https://julialang.org/utf8proc/")
  179. (synopsis "C library for processing UTF-8 Unicode data")
  180. (description "utf8proc is a small C library that provides Unicode
  181. normalization, case-folding, and other operations for data in the UTF-8
  182. encoding, supporting Unicode version 9.0.0.")
  183. (license license:expat)))
  184. (define-public libgtextutils
  185. (package
  186. (name "libgtextutils")
  187. (version "0.7")
  188. (source
  189. (origin
  190. (method url-fetch)
  191. (uri (string-append
  192. "https://github.com/agordon/libgtextutils/releases/download/"
  193. version "/libgtextutils-" version ".tar.gz"))
  194. (sha256
  195. (base32 "0jiybkb2z58wa2msvllnphr4js2hvjvh988pavb3mzkgr6ihwbkr"))))
  196. (build-system gnu-build-system)
  197. (arguments
  198. '(#:phases
  199. (modify-phases %standard-phases
  200. (replace 'bootstrap
  201. (lambda _ (invoke "sh" "reconf"))))))
  202. (native-inputs
  203. `(("autoconf" ,autoconf)
  204. ("automake" ,automake)
  205. ("libtool" ,libtool)))
  206. (home-page "https://github.com/agordon/libgtextutils")
  207. (synopsis "Gordon's text utils library")
  208. (description
  209. "libgtextutils is a text utilities library used by the fastx toolkit from
  210. the Hannon Lab.")
  211. (license license:agpl3+)))
  212. (define-public cityhash
  213. (let ((commit "8af9b8c"))
  214. (package
  215. (name "cityhash")
  216. (version (string-append "1.1-2." commit))
  217. (source (origin
  218. (method git-fetch)
  219. (uri (git-reference
  220. (url "https://github.com/google/cityhash.git")
  221. (commit commit)))
  222. (file-name (string-append name "-" version ".tar.gz"))
  223. (sha256
  224. (base32
  225. "0n6skf5dv8yfl1ckax8dqhvsbslkwc9158zf2ims0xqdvzsahbi6"))))
  226. (build-system gnu-build-system)
  227. (arguments
  228. '(#:make-flags (list "CXXFLAGS=-g -O3")
  229. #:phases
  230. (modify-phases %standard-phases
  231. ;; citycrc is not installed by default but is used by some
  232. ;; programs.
  233. (add-after 'install 'install-citycrc
  234. (lambda* (#:key outputs #:allow-other-keys)
  235. (let* ((out (assoc-ref outputs "out"))
  236. (include (string-append out "/include")))
  237. (install-file "src/citycrc.h" include))
  238. #t)))))
  239. (home-page "https://github.com/google/cityhash")
  240. (synopsis "C++ hash functions for strings")
  241. (description
  242. "CityHash provides hash functions for strings. The functions mix the
  243. input bits thoroughly but are not suitable for cryptography.")
  244. (license license:expat))))
  245. (define-public ustr
  246. (package
  247. (name "ustr")
  248. (version "1.0.4")
  249. (source (origin
  250. (method url-fetch)
  251. (uri (string-append "http://www.and.org/ustr/" version
  252. "/ustr-" version ".tar.bz2"))
  253. (sha256
  254. (base32
  255. "1i623ygdj7rkizj7985q9d6vj5amwg686aqb5j3ixpkqkyp6xbrx"))
  256. (patches (search-patches "ustr-fix-build-with-gcc-5.patch"))))
  257. (build-system gnu-build-system)
  258. (arguments
  259. `(#:make-flags
  260. (list "CC=gcc"
  261. "HIDE="
  262. ;; Override "/sbin/ldconfig" with "echo" because we don't need
  263. ;; "ldconfig".
  264. "LDCONFIG=echo"
  265. (string-append "prefix=" (assoc-ref %outputs "out"))
  266. "all-shared")
  267. #:phases
  268. (modify-phases %standard-phases
  269. (add-after 'unpack 'disable-check-for-stdint
  270. (lambda _
  271. ;; Of course we have stdint.h, just not in /usr/include
  272. (substitute* '("Makefile"
  273. "ustr-import.in")
  274. (("-f \"/usr/include/stdint.h\"") "-z \"\""))
  275. #t))
  276. ;; No configure script
  277. (delete 'configure))))
  278. (home-page "http://www.and.org/ustr/")
  279. (synopsis "String library with very low memory overhead")
  280. (description
  281. "Ustr is a string library for C with very low memory overhead.")
  282. ;; Quoted from the home page: "The License for the code is MIT, new-BSD,
  283. ;; LGPL, etc. ... if you need another license to help compatibility, just
  284. ;; ask for it. It's basically public domain, without all the legal
  285. ;; problems for everyone that trying to make something public domain
  286. ;; entails."
  287. (license license:public-domain)))
  288. (define-public libconfig
  289. (package
  290. (name "libconfig")
  291. (version "1.7.2")
  292. (home-page "https://hyperrealm.github.io/libconfig/")
  293. (source (origin
  294. (method url-fetch)
  295. (uri (string-append home-page "/dist/libconfig-"
  296. version ".tar.gz"))
  297. (sha256
  298. (base32
  299. "1ngs2qx3cx5cbwinc5mvadly0b5n7s86zsc68c404czzfff7lg3w"))))
  300. (build-system gnu-build-system)
  301. (synopsis "C/C++ configuration file library")
  302. (description
  303. "Libconfig is a simple library for manipulating structured configuration
  304. files. This file format is more compact and more readable than XML. And
  305. unlike XML, it is type-aware, so it is not necessary to do string parsing in
  306. application code.")
  307. (license license:lgpl2.1+)))
  308. (define-public pfff
  309. (package
  310. (name "pfff")
  311. (version "1.0")
  312. (source (origin
  313. (method url-fetch)
  314. (uri (string-append "https://github.com/pfff/pfff/archive/v"
  315. version ".tar.gz"))
  316. (file-name (string-append name "-" version ".tar.gz"))
  317. (sha256
  318. (base32
  319. "00m553aa277iarxj6dalmklyb64r7ias49bfwzbacsfg8h3kar8m"))))
  320. (build-system cmake-build-system)
  321. (home-page "http://biit.cs.ut.ee/pfff/")
  322. (synopsis "Probabilistic fast file fingerprinting tool")
  323. (description
  324. "pfff is a tool for calculating a compact digital fingerprint of a file
  325. by sampling randomly from the file instead of reading it in full.
  326. Consequently, the computation has a flat performance characteristic,
  327. correlated with data variation rather than file size. pfff can be as reliable
  328. as existing hashing techniques, with provably negligible risk of collisions.")
  329. (license license:bsd-3)))
  330. (define-public oniguruma
  331. (package
  332. (name "oniguruma")
  333. (version "6.9.1")
  334. (source (origin
  335. (method url-fetch)
  336. (uri (string-append "https://github.com/kkos/"
  337. "oniguruma/releases/download/v" version
  338. "/onig-" version ".tar.gz"))
  339. (sha256
  340. (base32
  341. "04pa6dk946xbzy8wz6d2zrpjwhks6559n8zc5ngwr9a5psvzxhy7"))))
  342. (build-system gnu-build-system)
  343. (home-page "https://github.com/kkos/oniguruma")
  344. (synopsis "Regular expression library")
  345. (description "Oniguruma is a regular expressions library. The special
  346. characteristic of this library is that different character encoding for every
  347. regular expression object can be specified.")
  348. (license license:bsd-2)))
  349. ;; PHP < 7.3.0 requires this old version. Remove once no longer needed.
  350. (define-public oniguruma-5
  351. (package
  352. (inherit oniguruma)
  353. (version "5.9.6")
  354. (source (origin
  355. (method url-fetch)
  356. (uri (string-append "https://github.com/kkos/"
  357. "oniguruma/releases/download/v" version
  358. "/onig-" version ".tar.gz"))
  359. (sha256
  360. (base32
  361. "19s79vsclqn170mw0ajwv7j37qsbn4f1yjz3yavnhvva6c820r6m"))))))
  362. (define-public antiword
  363. (package
  364. (name "antiword")
  365. (version "0.37")
  366. (source (origin
  367. (method url-fetch)
  368. (uri (string-append "http://www.winfield.demon.nl/linux"
  369. "/antiword-" version ".tar.gz"))
  370. (sha256
  371. (base32
  372. "1b7mi1l20jhj09kyh0bq14qzz8vdhhyf35gzwsq43mn6rc7h0b4f"))
  373. (patches (search-patches "antiword-CVE-2014-8123.patch"))))
  374. (build-system gnu-build-system)
  375. (arguments
  376. `(#:tests? #f ; There are no tests
  377. #:make-flags
  378. (list "-f" "Makefile.Linux"
  379. (string-append "GLOBAL_INSTALL_DIR="
  380. (assoc-ref %outputs "out") "/bin")
  381. (string-append "GLOBAL_RESOURCES_DIR="
  382. (assoc-ref %outputs "out") "/share/antiword"))
  383. #:phases
  384. (modify-phases %standard-phases
  385. (replace 'configure
  386. (lambda* (#:key outputs #:allow-other-keys)
  387. ;; Ensure that mapping files can be found in the actual package
  388. ;; data directory.
  389. (substitute* "antiword.h"
  390. (("/usr/share/antiword")
  391. (string-append (assoc-ref outputs "out") "/share/antiword")))
  392. #t))
  393. (replace 'install
  394. (lambda* (#:key make-flags #:allow-other-keys)
  395. (apply invoke "make" `("global_install" ,@make-flags)))))))
  396. (home-page "http://www.winfield.demon.nl/")
  397. (synopsis "Microsoft Word document reader")
  398. (description "Antiword is an application for displaying Microsoft Word
  399. documents. It can also convert the document to PostScript or XML. Only
  400. documents made by MS Word version 2 and version 6 or later are supported. The
  401. name comes from: \"The antidote against people who send Microsoft Word files
  402. to everybody, because they believe that everybody runs Windows and therefore
  403. runs Word\".")
  404. (license license:gpl2+)))
  405. (define-public catdoc
  406. (package
  407. (name "catdoc")
  408. (version "0.95")
  409. (source (origin
  410. (method url-fetch)
  411. (uri (string-append "http://ftp.wagner.pp.ru/pub/catdoc/"
  412. "catdoc-" version ".tar.gz"))
  413. (patches (search-patches "catdoc-CVE-2017-11110.patch"))
  414. (sha256
  415. (base32
  416. "15h7v3bmwfk4z8r78xs5ih6vd0pskn0rj90xghvbzdjj0cc88jji"))))
  417. (build-system gnu-build-system)
  418. ;; TODO: Also build `wordview` which requires `tk` – make a separate
  419. ;; package for this.
  420. (arguments
  421. '(#:tests? #f ; There are no tests
  422. #:configure-flags '("--disable-wordview")
  423. #:phases
  424. (modify-phases %standard-phases
  425. (add-before 'install 'fix-install
  426. (lambda* (#:key outputs #:allow-other-keys)
  427. (let ((out (assoc-ref outputs "out")))
  428. (mkdir-p (string-append out "/share/man/man1"))))))))
  429. (home-page "http://www.wagner.pp.ru/~vitus/software/catdoc/")
  430. (synopsis "MS-Word to TeX or plain text converter")
  431. (description "@command{catdoc} extracts text from MS-Word files, trying to
  432. preserve as many special printable characters as possible. It supports
  433. everything up to Word-97. Also supported are MS Write documents and RTF files.
  434. @command{catdoc} does not preserve complex word formatting, but it can
  435. translate some non-ASCII characters into TeX escape codes. It's goal is to
  436. extract plain text and allow you to read it and, probably, reformat with TeX,
  437. according to TeXnical rules.
  438. This package also provides @command{xls2csv}, which extracts data from Excel
  439. spreadsheets and outputs it in comma-separated-value format, and
  440. @command{catppt}, which extracts data from PowerPoint presentations.")
  441. (license license:gpl2+)))
  442. (define-public utfcpp
  443. (package
  444. (name "utfcpp")
  445. (version "2.3.5")
  446. (source (origin
  447. (method url-fetch)
  448. (uri
  449. (string-append "https://github.com/nemtrif/utfcpp/archive/v"
  450. version ".tar.gz"))
  451. (file-name (string-append name "-" version ".tar.gz"))
  452. (sha256
  453. (base32
  454. "0gcqcfw19kfim8xw29xdp91l310yfjyrqdj2zsx8xx02dkpy1zzk"))))
  455. (build-system cmake-build-system)
  456. (arguments
  457. `(#:out-of-source? #f
  458. #:phases
  459. (modify-phases %standard-phases
  460. (replace 'install ; no install target
  461. (lambda* (#:key outputs #:allow-other-keys)
  462. (let* ((out (assoc-ref outputs "out"))
  463. (include (string-append out "/include"))
  464. (doc (string-append out "/share/doc/" ,name)))
  465. (copy-recursively "source" include)
  466. (install-file "README.md" doc)
  467. #t))))))
  468. (home-page "https://github.com/nemtrif/utfcpp")
  469. (synopsis "Portable C++ library for handling UTF-8")
  470. (description "UTF8-CPP is a C++ library for handling UTF-8 encoded text
  471. in a portable way.")
  472. (license license:boost1.0)))
  473. (define-public dbacl
  474. (package
  475. (name "dbacl")
  476. (version "1.14")
  477. (source
  478. (origin
  479. (method url-fetch)
  480. (uri (string-append "http://www.lbreyer.com/gpl/"
  481. name "-" version ".tar.gz"))
  482. (sha256
  483. (base32
  484. "0224g6x71hyvy7jikfxmgcwww1r5lvk0jx36cva319cb9nmrbrq7"))))
  485. (build-system gnu-build-system)
  486. (arguments
  487. `(#:make-flags
  488. (list
  489. (string-append "-I" (assoc-ref %build-inputs "slang")
  490. "/include/slang")
  491. (string-append "-I" (assoc-ref %build-inputs "ncurses")
  492. "/include/ncurses"))
  493. #:phases
  494. (modify-phases %standard-phases
  495. (add-after 'unpack 'delete-sample6-and-japanese
  496. (lambda _
  497. (substitute* "doc/Makefile.am"
  498. (("sample6.txt") "")
  499. (("japanese.txt") ""))
  500. (delete-file "doc/sample6.txt")
  501. (delete-file "doc/japanese.txt")
  502. (substitute* (list "src/tests/Makefile.am"
  503. "src/tests/Makefile.in")
  504. (("dbacl-jap.shin") "")
  505. (("dbacl-jap.sh") ""))
  506. #t))
  507. (add-after 'unpack 'delete-test
  508. ;; See comments about the license.
  509. (lambda _
  510. (delete-file "src/tests/dbacl-jap.shin")
  511. #t))
  512. (add-after 'delete-sample6-and-japanese 'autoreconf
  513. (lambda _
  514. (invoke "autoreconf" "-vif")
  515. #t))
  516. (add-after 'unpack 'fix-test-files
  517. (lambda* (#:key inputs outputs #:allow-other-keys)
  518. (let* ((out (assoc-ref outputs "out"))
  519. (bin (string-append out "/bin")))
  520. (substitute* (find-files "src/tests/" "\\.shin$")
  521. (("PATH=/bin:/usr/bin")
  522. "#PATH=/bin:/usr/bin")
  523. (("diff") (string-append (which "diff")))
  524. (("tr") (string-append (which "tr"))))
  525. #t))))))
  526. (inputs
  527. `(("ncurses" ,ncurses)
  528. ("perl" ,perl)
  529. ("readline" ,readline)
  530. ("slang" ,slang)))
  531. (native-inputs
  532. `(("libtool" ,libtool)
  533. ("autoconf" ,autoconf)
  534. ("automake" ,automake)
  535. ("pkg-config" ,pkg-config)))
  536. (home-page "https://www.lbreyer.com/dbacl.html")
  537. (synopsis "Bayesian text and email classifier")
  538. (description
  539. "dbacl is a fast Bayesian text and email classifier. It builds a variety
  540. of language models using maximum entropy (minimum divergence) principles, and
  541. these can then be used to categorize input data automatically among multiple
  542. categories.")
  543. ;; The software is licensed as GPLv3 or later, but
  544. ;; includes various sample texts in the doc dir:
  545. ;; - sample1.txt, sample3 and sampe5.txt are in the public domain,
  546. ;; by Mark Twain.
  547. ;; - sample2.txt, sample4.txt are in the public domain, by Aristotle.
  548. ;; - sample6.txt is a forwarded email, copyright unknown.
  549. ;; Guix does exclude sample6.txt.
  550. ;; - japanese.txt is a Japanese unoffical translation of the
  551. ;; GNU General Public License, (c) by the Free Software Foundation.
  552. ;; Guix excludes this file.
  553. (license (list license:gpl3+ license:public-domain))))
  554. (define-public dotconf
  555. (package
  556. (name "dotconf")
  557. (version "1.3")
  558. (source (origin
  559. (method git-fetch)
  560. (uri (git-reference
  561. (url "https://github.com/williamh/dotconf.git")
  562. (commit (string-append "v" version))))
  563. (file-name (git-file-name name version))
  564. (sha256
  565. (base32
  566. "1sc95hw5k2xagpafny0v35filmcn05k1ds5ghkldfpf6xw4hakp7"))))
  567. (build-system gnu-build-system)
  568. (arguments `(#:tests? #f)) ; FIXME maketest.sh does not work.
  569. (native-inputs
  570. `(("autoconf" ,autoconf)
  571. ("automake" ,automake)
  572. ("libtool" ,libtool)))
  573. (home-page "https://github.com/williamh/dotconf")
  574. (synopsis "Configuration file parser library")
  575. (description
  576. "C library for creating and parsing configuration files.")
  577. (license (list license:lgpl2.1 ; Main distribution.
  578. license:asl1.1)))) ; src/readdir.{c,h}
  579. (define-public java-rsyntaxtextarea
  580. (package
  581. (name "java-rsyntaxtextarea")
  582. (version "2.6.1")
  583. (source (origin
  584. (method url-fetch)
  585. (uri (string-append "https://github.com/bobbylight/"
  586. "RSyntaxTextArea/archive/"
  587. version ".tar.gz"))
  588. (file-name (string-append name "-" version ".tar.gz"))
  589. (sha256
  590. (base32
  591. "0c5mqg2klj5rvf8fhycrli8rf6s37l9p7a8knw9gpp65r1c120q2"))))
  592. (build-system ant-build-system)
  593. (arguments
  594. `(;; FIXME: some tests fail because locale resources cannot be found.
  595. ;; Even when I add them to the class path,
  596. ;; RSyntaxTextAreaEditorKitDumbCompleteWordActionTest fails.
  597. #:tests? #f
  598. #:jar-name "rsyntaxtextarea.jar"))
  599. (native-inputs
  600. `(("java-junit" ,java-junit)
  601. ("java-hamcrest-core" ,java-hamcrest-core)))
  602. (home-page "https://bobbylight.github.io/RSyntaxTextArea/")
  603. (synopsis "Syntax highlighting text component for Java Swing")
  604. (description "RSyntaxTextArea is a syntax highlighting, code folding text
  605. component for Java Swing. It extends @code{JTextComponent} so it integrates
  606. completely with the standard @code{javax.swing.text} package. It is fast and
  607. efficient, and can be used in any application that needs to edit or view
  608. source code.")
  609. (license license:bsd-3)))
  610. ;; We use the sources from git instead of the tarball from pypi, because the
  611. ;; latter does not include the Cython source file from which bycython.cpp is
  612. ;; generated.
  613. (define-public python-editdistance
  614. (let ((commit "3ea84a7dd3258c76aa3be851ef3d50e59c886846")
  615. (revision "1"))
  616. (package
  617. (name "python-editdistance")
  618. (version (string-append "0.3.1-" revision "." (string-take commit 7)))
  619. (source
  620. (origin
  621. (method git-fetch)
  622. (uri (git-reference
  623. (url "https://github.com/aflc/editdistance.git")
  624. (commit commit)))
  625. (file-name (git-file-name name version))
  626. (sha256
  627. (base32
  628. "1l43svsv12crvzphrgi6x435z6xg8m086c64armp8wzb4l8ccm7g"))))
  629. (build-system python-build-system)
  630. (arguments
  631. `(#:phases
  632. (modify-phases %standard-phases
  633. (add-after 'unpack 'build-cython-code
  634. (lambda _
  635. (with-directory-excursion "editdistance"
  636. (delete-file "bycython.cpp")
  637. (invoke "cython" "--cplus" "bycython.pyx")))))))
  638. (native-inputs
  639. `(("python-cython" ,python-cython)))
  640. (home-page "https://www.github.com/aflc/editdistance")
  641. (synopsis "Fast implementation of the edit distance (Levenshtein distance)")
  642. (description
  643. "This library simply implements Levenshtein distance algorithm with C++
  644. and Cython.")
  645. (license license:expat))))
  646. (define-public go-github.com-mattn-go-runewidth
  647. (package
  648. (name "go-github.com-mattn-go-runewidth")
  649. (version "0.0.2")
  650. (source (origin
  651. (method git-fetch)
  652. (uri (git-reference
  653. (url "https://github.com/mattn/go-runewidth")
  654. (commit (string-append "v" version))))
  655. (file-name (git-file-name name version))
  656. (sha256
  657. (base32
  658. "0vkrfrz3fzn5n6ix4k8s0cg0b448459sldq8bp4riavsxm932jzb"))))
  659. (build-system go-build-system)
  660. (arguments
  661. '(#:import-path "github.com/mattn/go-runewidth"))
  662. (synopsis "@code{runewidth} provides Go functions to work with string widths")
  663. (description
  664. "The @code{runewidth} library provides Go functions for padding,
  665. measuring and checking the width of strings, with support east asian text.")
  666. (home-page "https://github.com/jessevdk/go-flags")
  667. (license license:expat)))
  668. (define-public docx2txt
  669. (package
  670. (name "docx2txt")
  671. (version "1.4")
  672. (source (origin
  673. (method url-fetch)
  674. (uri (string-append
  675. "mirror://sourceforge/docx2txt/docx2txt/v"
  676. version "/docx2txt-" version ".tgz"))
  677. (sha256
  678. (base32
  679. "06vdikjvpj6qdb41d8wzfnyj44jpnknmlgbhbr1w215420lpb5xj"))))
  680. (build-system gnu-build-system)
  681. (inputs
  682. `(("unzip" ,unzip)
  683. ("perl" ,perl)))
  684. (arguments
  685. `(#:tests? #f ; No tests.
  686. #:make-flags (list (string-append "BINDIR="
  687. (assoc-ref %outputs "out") "/bin")
  688. (string-append "CONFIGDIR="
  689. (assoc-ref %outputs "out") "/etc")
  690. ;; Makefile seems to be a bit dumb at guessing.
  691. (string-append "INSTALL=install")
  692. (string-append "PERL=perl"))
  693. #:phases
  694. (modify-phases %standard-phases
  695. (delete 'configure)
  696. (add-after 'install 'fix-install
  697. (lambda* (#:key outputs inputs #:allow-other-keys)
  698. (let* ((out (assoc-ref outputs "out"))
  699. (bin (string-append out "/bin"))
  700. (config (string-append out "/etc/docx2txt.config"))
  701. (unzip (assoc-ref inputs "unzip")))
  702. ;; According to INSTALL, the .sh wrapper can be skipped.
  703. (delete-file (string-append bin "/docx2txt.sh"))
  704. (rename-file (string-append bin "/docx2txt.pl")
  705. (string-append bin "/docx2txt"))
  706. (substitute* config
  707. (("config_unzip => '/usr/bin/unzip',")
  708. (string-append "config_unzip => '"
  709. unzip
  710. "/bin/unzip',")))
  711. ;; Makefile is wrong.
  712. (chmod config #o644)
  713. #t))))))
  714. (synopsis "Recover text from @file{.docx} files, with good formatting")
  715. (description
  716. "@command{docx2txt} is a Perl based command line utility to convert
  717. Microsoft Office @file{.docx} documents to equivalent text documents. Latest
  718. version supports following features during text extraction.
  719. @itemize
  720. @item Character conversions; currency characters are converted to respective
  721. names like Euro.
  722. @item Capitalisation of text blocks.
  723. @item Center and right justification of text fitting in a line of
  724. (configurable) 80 columns.
  725. @item Horizontal ruler, line breaks, paragraphs separation, tabs.
  726. @item Indicating hyperlinked text along with the hyperlink (configurable).
  727. @item Handling (bullet, decimal, letter, roman) lists along with (attempt at)
  728. indentation.
  729. @end itemize\n")
  730. (home-page "http://docx2txt.sourceforge.net")
  731. (license license:gpl3+)))
  732. (define-public opencc
  733. (package
  734. (name "opencc")
  735. (version "1.0.5")
  736. (source
  737. (origin
  738. (method git-fetch)
  739. (uri (git-reference
  740. (url "https://github.com/BYVoid/OpenCC")
  741. (commit (string-append "ver." version))))
  742. (file-name (git-file-name name version))
  743. (sha256
  744. (base32
  745. "1pv5md225qwhbn8ql932zdg6gh1qlx3paiajaks8gfsa07yzvhr4"))
  746. (modules '((guix build utils)))
  747. (snippet
  748. '(begin
  749. ;; TODO: Unbundle tclap, darts-clone, gtest
  750. (delete-file-recursively "deps/rapidjson-0.11") #t))))
  751. (build-system cmake-build-system)
  752. (arguments
  753. '(#:phases
  754. (modify-phases %standard-phases
  755. (add-after 'unpack 'patch-3rd-party-references
  756. (lambda* (#:key inputs #:allow-other-keys)
  757. (let ((rapidjson (assoc-ref inputs "rapidjson")))
  758. (substitute* "src/CMakeLists.txt"
  759. (("../deps/rapidjson-0.11")
  760. (string-append rapidjson "/include/rapidjson")))
  761. #t))))))
  762. (native-inputs
  763. `(("python" ,python-wrapper)
  764. ("rapidjson" ,rapidjson)))
  765. (home-page "https://github.com/BYVoid/OpenCC")
  766. (synopsis "Convert between Traditional Chinese and Simplified Chinese")
  767. (description "Open Chinese Convert (OpenCC) converts between Traditional
  768. Chinese and Simplified Chinese, supporting character-level conversion,
  769. phrase-level conversion, variant conversion, and regional idioms among
  770. Mainland China, Taiwan, and Hong-Kong.")
  771. (license license:asl2.0)))