textutils.scm 55 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351
  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>
  26. ;;;
  27. ;;; This file is part of GNU Guix.
  28. ;;;
  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.
  33. ;;;
  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.
  38. ;;;
  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/>.
  41. (define-module (gnu packages textutils)
  42. #:use-module ((guix licenses) #:prefix license:)
  43. #:use-module (guix packages)
  44. #:use-module (guix download)
  45. #:use-module (guix git-download)
  46. #:use-module (guix build-system ant)
  47. #:use-module (guix build-system gnu)
  48. #:use-module (guix build-system go)
  49. #:use-module (guix build-system cmake)
  50. #:use-module (guix build-system python)
  51. #:use-module (guix utils)
  52. #:use-module (gnu packages)
  53. #:use-module (gnu packages autotools)
  54. #:use-module (gnu packages base)
  55. #:use-module (gnu packages compression)
  56. #:use-module (gnu packages gcc)
  57. #:use-module (gnu packages golang)
  58. #:use-module (gnu packages gettext)
  59. #:use-module (gnu packages java)
  60. #:use-module (gnu packages ncurses)
  61. #:use-module (gnu packages pcre)
  62. #:use-module (gnu packages perl)
  63. #:use-module (gnu packages pkg-config)
  64. #:use-module (gnu packages python)
  65. #:use-module (gnu packages python-build)
  66. #:use-module (gnu packages python-xyz)
  67. #:use-module (gnu packages readline)
  68. #:use-module (gnu packages ruby)
  69. #:use-module (gnu packages slang)
  70. #:use-module (gnu packages web))
  71. (define-public dos2unix
  72. (package
  73. (name "dos2unix")
  74. (version "7.4.2")
  75. (source
  76. (origin
  77. (method url-fetch)
  78. (uri (string-append "https://waterlan.home.xs4all.nl/dos2unix/"
  79. "dos2unix-" version ".tar.gz"))
  80. (sha256
  81. (base32 "00dfsf4rfyjb5j12gan8xjiirm0asshdz6dmd3l34a7ays6wadb0"))))
  82. (build-system gnu-build-system)
  83. (arguments
  84. `(#:make-flags
  85. (list (string-append "CC=" ,(cc-for-target))
  86. (string-append "prefix=" (assoc-ref %outputs "out")))
  87. #:phases
  88. (modify-phases %standard-phases
  89. (delete 'configure)))) ; no configure script
  90. (native-inputs
  91. `(("gettext" ,gettext-minimal)
  92. ("perl" ,perl)))
  93. (home-page "https://waterlan.home.xs4all.nl/dos2unix.html")
  94. (synopsis "DOS/Mac to Unix and vice versa text file format converter")
  95. (description
  96. "dos2unix is a tool to convert line breaks in a text file from Unix format
  97. to DOS format and vice versa.")
  98. (license license:bsd-2)))
  99. (define-public recode
  100. (package
  101. (name "recode")
  102. (version "3.7.6")
  103. (source
  104. (origin
  105. (method url-fetch)
  106. (uri (string-append "https://github.com/rrthomas/recode/releases/"
  107. "download/v" version "/recode-" version ".tar.gz"))
  108. (sha256
  109. (base32 "0m59sd1ca0zw1aydpc3m8sw03nc885knmccqryg7byzmqs585ia6"))))
  110. (build-system gnu-build-system)
  111. (native-inputs
  112. `(("python" ,python)
  113. ("python-cython" ,python-cython)))
  114. (home-page "https://github.com/rrthomas/recode")
  115. (synopsis "Text encoding converter")
  116. (description "The Recode library converts files between character sets and
  117. usages. It recognises or produces over 200 different character sets (or about
  118. 300 if combined with an iconv library) and transliterates files between almost
  119. any pair. When exact transliteration are not possible, it gets rid of
  120. offending characters or falls back on approximations. The recode program is a
  121. handy front-end to the library.")
  122. (license license:gpl3+)))
  123. (define-public enca
  124. (package
  125. (name "enca")
  126. (version "1.19")
  127. (source
  128. (origin
  129. (method git-fetch)
  130. (uri (git-reference
  131. (url "https://github.com/nijel/enca")
  132. (commit version)))
  133. (file-name (git-file-name name version))
  134. (sha256
  135. (base32 "19q7cwwxmmk5j9438bsqdpjvdjawsd3zmw1zyqgi7s4m0rasr3ah"))))
  136. (build-system gnu-build-system)
  137. ;; enca-1.19 tests fail with recent recode.
  138. ;(inputs `(("recode" ,recode)))
  139. (home-page "https://github.com/nijel/enca")
  140. (synopsis "Text encoding detection tool")
  141. (description "Enca (Extremely Naive Charset Analyser) consists of libenca,
  142. an encoding detection library, and enca, a command line frontend, integrating
  143. libenca and several charset conversion libraries and tools.")
  144. (license license:gpl2)))
  145. (define-public utf8proc
  146. (package
  147. (name "utf8proc")
  148. (version "2.5.0")
  149. (source
  150. (origin
  151. (method git-fetch)
  152. (uri (git-reference
  153. (url "https://github.com/JuliaStrings/utf8proc")
  154. (commit (string-append "v" version))))
  155. (file-name (git-file-name name version))
  156. (sha256
  157. (base32 "1xlkazhdnja4lksn5c9nf4bln5gjqa35a8gwlam5r0728w0h83qq"))))
  158. (build-system gnu-build-system)
  159. (native-inputs
  160. (let ((UNICODE_VERSION "13.0.0")) ; defined in data/Makefile
  161. ;; Test data that is otherwise downloaded with curl.
  162. `(("NormalizationTest.txt"
  163. ,(origin
  164. (method url-fetch)
  165. (uri (string-append "https://www.unicode.org/Public/"
  166. UNICODE_VERSION "/ucd/NormalizationTest.txt"))
  167. (sha256
  168. (base32 "07g0ya4f6zfzvpp24ccxkb2yq568kh83gls85rjl950nv5fya3nn"))))
  169. ("GraphemeBreakTest.txt"
  170. ,(origin
  171. (method url-fetch)
  172. (uri (string-append "https://www.unicode.org/Public/"
  173. UNICODE_VERSION
  174. "/ucd/auxiliary/GraphemeBreakTest.txt"))
  175. (sha256
  176. (base32 "07f8rrvcsq4pibdz6zxggxy8w7zjjqyw2ggclqlhalyv45yv7prj"))))
  177. ;; For tests.
  178. ("perl" ,perl))))
  179. (arguments
  180. '(#:make-flags (list "CC=gcc"
  181. (string-append "prefix=" (assoc-ref %outputs "out")))
  182. #:phases
  183. (modify-phases %standard-phases
  184. (delete 'configure)
  185. (add-before 'check 'check-data
  186. (lambda* (#:key inputs #:allow-other-keys)
  187. (for-each (lambda (i)
  188. (copy-file (assoc-ref inputs i)
  189. (string-append "data/" i)))
  190. '("NormalizationTest.txt" "GraphemeBreakTest.txt"))
  191. (substitute* "data/GraphemeBreakTest.txt"
  192. (("÷") "/")
  193. (("×") "+"))
  194. #t)))))
  195. (home-page "https://juliastrings.github.io/utf8proc/")
  196. (synopsis "C library for processing UTF-8 Unicode data")
  197. (description "utf8proc is a small C library that provides Unicode
  198. normalization, case-folding, and other operations for data in the UTF-8
  199. encoding, supporting Unicode version 9.0.0.")
  200. (license license:expat)))
  201. (define-public utf8proc-2.6.1
  202. (package
  203. (inherit utf8proc)
  204. (name "utf8proc")
  205. (version "2.6.1")
  206. (source
  207. (origin
  208. (method git-fetch)
  209. (uri (git-reference
  210. (url "https://github.com/JuliaStrings/utf8proc")
  211. (commit (string-append "v" version))))
  212. (file-name (git-file-name name version))
  213. (sha256
  214. (base32 "1zqc6airkzkssbjxanx5v8blfk90180gc9id0dx8ncs54f1ib8w7"))))
  215. (arguments
  216. (substitute-keyword-arguments (package-arguments utf8proc)
  217. ((#:phases phases)
  218. `(modify-phases ,phases
  219. (replace 'check-data
  220. (lambda* (#:key inputs native-inputs #:allow-other-keys)
  221. (display native-inputs)
  222. (for-each (lambda (i)
  223. (copy-file (assoc-ref (or native-inputs inputs) i)
  224. (string-append "data/" i)))
  225. '("NormalizationTest.txt" "GraphemeBreakTest.txt"
  226. "DerivedCoreProperties.txt"))))))))
  227. (native-inputs
  228. (append
  229. (package-native-inputs utf8proc)
  230. (let ((UNICODE_VERSION "13.0.0"))
  231. `(("DerivedCoreProperties.txt"
  232. ,(origin
  233. (method url-fetch)
  234. (uri (string-append "https://www.unicode.org/Public/"
  235. UNICODE_VERSION "/ucd/DerivedCoreProperties.txt"))
  236. (sha256
  237. (base32 "0j12x112cd8fpgazkc8izxnhhpia44p1m36ff8yapslxndcmzm55"))))
  238. ;; For tests
  239. ("ruby" ,ruby)))))))
  240. (define-public libconfuse
  241. (package
  242. (name "libconfuse")
  243. (version "3.3")
  244. (source
  245. (origin
  246. (method url-fetch)
  247. (uri (string-append "https://github.com/martinh/libconfuse/"
  248. "releases/download/v" version
  249. "/confuse-" version ".tar.xz"))
  250. (sha256
  251. (base32 "043hqqykpprgrkw9s2hbdlxr308a7yxwsgxj4m8aadg1401hmm8x"))))
  252. (build-system gnu-build-system)
  253. (arguments
  254. '(#:configure-flags '("--disable-static")))
  255. (home-page "https://github.com/martinh/libconfuse")
  256. (synopsis "Configuration file parser library")
  257. (description "libconfuse is a configuration file parser library. It
  258. supports sections and (lists of) values (strings, integers, floats, booleans
  259. or other sections), as well as some other features (such as
  260. single/double-quoted strings, environment variable expansion, functions and
  261. nested include statements).")
  262. (license license:isc)))
  263. (define-public libgtextutils
  264. (package
  265. (name "libgtextutils")
  266. (version "0.7")
  267. (source
  268. (origin
  269. (method url-fetch)
  270. (uri (string-append
  271. "https://github.com/agordon/libgtextutils/releases/download/"
  272. version "/libgtextutils-" version ".tar.gz"))
  273. (sha256
  274. (base32 "0jiybkb2z58wa2msvllnphr4js2hvjvh988pavb3mzkgr6ihwbkr"))))
  275. (build-system gnu-build-system)
  276. (arguments
  277. `(#:phases
  278. (modify-phases %standard-phases
  279. (replace 'bootstrap
  280. (lambda _ (invoke "sh" "reconf")))
  281. (add-after 'set-paths 'hide-default-gcc
  282. (lambda* (#:key inputs #:allow-other-keys)
  283. (let ((gcc (assoc-ref inputs "gcc")))
  284. ;; Remove the default GCC from CPLUS_INCLUDE_PATH to prevent
  285. ;; conflicts with the GCC 5 input.
  286. (setenv "CPLUS_INCLUDE_PATH"
  287. (string-join
  288. (delete (string-append gcc "/include/c++")
  289. (string-split (getenv "CPLUS_INCLUDE_PATH") #\:))
  290. ":"))
  291. #t))))))
  292. (native-inputs
  293. `(("autoconf" ,autoconf)
  294. ("automake" ,automake)
  295. ("gcc@5" ,gcc-5) ; doesn't build with later versions
  296. ("libtool" ,libtool)))
  297. (home-page "https://github.com/agordon/libgtextutils")
  298. (synopsis "Gordon's text utils library")
  299. (description
  300. "libgtextutils is a text utilities library used by the fastx toolkit from
  301. the Hannon Lab.")
  302. (license license:agpl3+)))
  303. (define-public cityhash
  304. (let ((commit "8af9b8c"))
  305. (package
  306. (name "cityhash")
  307. (version (string-append "1.1-2." commit))
  308. (source (origin
  309. (method git-fetch)
  310. (uri (git-reference
  311. (url "https://github.com/google/cityhash")
  312. (commit commit)))
  313. (file-name (string-append name "-" version ".tar.gz"))
  314. (sha256
  315. (base32
  316. "0n6skf5dv8yfl1ckax8dqhvsbslkwc9158zf2ims0xqdvzsahbi6"))))
  317. (build-system gnu-build-system)
  318. (arguments
  319. '(#:make-flags (list "CXXFLAGS=-g -O3")
  320. #:phases
  321. (modify-phases %standard-phases
  322. ;; citycrc is not installed by default but is used by some
  323. ;; programs.
  324. (add-after 'install 'install-citycrc
  325. (lambda* (#:key outputs #:allow-other-keys)
  326. (let* ((out (assoc-ref outputs "out"))
  327. (include (string-append out "/include")))
  328. (install-file "src/citycrc.h" include))
  329. #t)))))
  330. (home-page "https://github.com/google/cityhash")
  331. (synopsis "C++ hash functions for strings")
  332. (description
  333. "CityHash provides hash functions for strings. The functions mix the
  334. input bits thoroughly but are not suitable for cryptography.")
  335. (license license:expat))))
  336. (define-public ustr
  337. (package
  338. (name "ustr")
  339. (version "1.0.4")
  340. (source (origin
  341. (method url-fetch)
  342. (uri (string-append "http://www.and.org/ustr/" version
  343. "/ustr-" version ".tar.bz2"))
  344. (sha256
  345. (base32
  346. "1i623ygdj7rkizj7985q9d6vj5amwg686aqb5j3ixpkqkyp6xbrx"))
  347. (patches (search-patches "ustr-fix-build-with-gcc-5.patch"))))
  348. (build-system gnu-build-system)
  349. (arguments
  350. `(#:make-flags
  351. (list (string-append "CC=" ,(cc-for-target))
  352. "HIDE="
  353. ;; Override "/sbin/ldconfig" with "echo" because we don't need
  354. ;; "ldconfig".
  355. "LDCONFIG=echo"
  356. (string-append "prefix=" (assoc-ref %outputs "out"))
  357. "all-shared")
  358. #:phases
  359. (modify-phases %standard-phases
  360. (add-after 'unpack 'fix-cross-compilation
  361. ;; The Makefile contains more insults than cross-compilation support.
  362. ;; It poorly reinvents autotools by compiling C programmes with $CC,
  363. ;; then tries to run them during the build. Hard-code the results.
  364. (lambda _
  365. (substitute* "Makefile"
  366. (("\\./autoconf_64b")
  367. ,(if (target-64bit? (or (%current-target-system)
  368. (%current-system)))
  369. "echo 1"
  370. "echo 0"))
  371. (("\\./autoconf_vsnprintf") "echo 0"))))
  372. (add-after 'unpack 'omit-static-libraries
  373. ;; These are needed to build & test ustr, but don't install them.
  374. (lambda _
  375. (substitute* "Makefile"
  376. ((".*install.*LIB_STATIC.*") ""))))
  377. (add-after 'unpack 'disable-check-for-stdint
  378. (lambda _
  379. ;; Of course we have stdint.h, just not in /usr/include
  380. (substitute* '("Makefile"
  381. "ustr-import.in")
  382. (("-f \"/usr/include/stdint.h\"") "-z \"\""))
  383. #t))
  384. ;; No configure script
  385. (delete 'configure))))
  386. (home-page "http://www.and.org/ustr/")
  387. (synopsis "String library with very low memory overhead")
  388. (description
  389. "Ustr is a string library for C with very low memory overhead.")
  390. ;; Quoted from the home page: "The License for the code is MIT, new-BSD,
  391. ;; LGPL, etc. ... if you need another license to help compatibility, just
  392. ;; ask for it. It's basically public domain, without all the legal
  393. ;; problems for everyone that trying to make something public domain
  394. ;; entails."
  395. (license license:public-domain)))
  396. (define-public ascii2binary
  397. (package
  398. (name "ascii2binary")
  399. (version "2.14")
  400. (source
  401. (origin
  402. (method url-fetch)
  403. (uri (string-append "http://billposer.org/Software/Downloads/"
  404. "ascii2binary-" version ".tar.bz2"))
  405. (sha256
  406. (base32 "0dc9fxcdmppbs9s06jvq61zbk552laxps0xyk098gj41697ihd96"))))
  407. (build-system gnu-build-system)
  408. (native-inputs
  409. `(("gettext" ,gettext-minimal)))
  410. (home-page "https://billposer.org/Software/a2b.html")
  411. (synopsis "Convert between ASCII, hexadecimal and binary representations")
  412. (description "The two programs are useful for generating test data, for
  413. inspecting binary files, and for interfacing programs that generate textual
  414. output to programs that require binary input and conversely. They can also be
  415. useful when it is desired to reformat numbers.
  416. @itemize
  417. @item @command{ascii2binary} reads input consisting of ascii or hexadecimal
  418. representation numbers separated by whitespace and produces as output
  419. the binary equivalents. The type and precision of the binary output
  420. is selected using command line flags.
  421. @item @command{binary2ascii} reads input consisting of binary numbers
  422. and converts them to their ascii or hexadecimal representation.
  423. Command line flags specify the type and size of the binary numbers
  424. and provide control over the format of the output.
  425. Unsigned integers may be written out in binary, octal, decimal,
  426. or hexadecimal.
  427. Signed integers may be written out only in binary or decimal. Floating
  428. point numbers may be written out only decimal, either in standard or
  429. scientific notation. (If you want to examine the binary representation
  430. of floating point numbers, just treat the input as a sequence of unsigned
  431. characters.)
  432. @end itemize")
  433. (license license:gpl3)))
  434. (define-public uniutils
  435. (package
  436. (name "uniutils")
  437. (version "2.27")
  438. (source
  439. (origin
  440. (method url-fetch)
  441. (uri (string-append "http://billposer.org/Software/Downloads/"
  442. "uniutils-" version ".tar.bz2"))
  443. (sha256
  444. (base32 "19w1510w87gx7n4qy3zsb0m467a4rn5scvh4ajajg7jh6x5xri08"))))
  445. (build-system gnu-build-system)
  446. (arguments
  447. '(#:configure-flags '("--disable-dependency-tracking")
  448. #:phases
  449. (modify-phases %standard-phases
  450. (add-after 'build 'fix-paths
  451. (lambda* (#:key outputs inputs #:allow-other-keys)
  452. (let ((out (assoc-ref outputs "out"))
  453. (a2b (assoc-ref inputs "ascii2binary"))
  454. (iconv (assoc-ref inputs "libiconv")))
  455. (substitute* "utf8lookup"
  456. (("^ascii2binary ") (string-append a2b "/bin/ascii2binary "))
  457. (("^uniname ") (string-append out "/bin/uniname "))
  458. (("^iconv ") (string-append iconv "/bin/iconv ")))
  459. #t))))))
  460. (inputs
  461. `(("ascii2binary" ,ascii2binary)
  462. ("libiconv" ,libiconv)))
  463. (home-page "https://billposer.org/Software/unidesc.html")
  464. (synopsis "Find out what is in a Unicode file")
  465. (description "Useful tools when working with Unicode files when one
  466. doesn't know the writing system, doesn't have the necessary font, needs to
  467. inspect invisible characters, needs to find out whether characters have been
  468. combined or in what order they occur, or needs statistics on which characters
  469. occur.
  470. @itemize
  471. @item @command{uniname} defaults to printing the character offset of each
  472. character, its byte offset, its hex code value, its encoding, the glyph
  473. itself, and its name. It may also be used to validate UTF-8 input.
  474. @item @command{unidesc} reports the character ranges to which different
  475. portions of the text belong. It can also be used to identify Unicode encodings
  476. (e.g. UTF-16be) flagged by magic numbers.
  477. @item @command{unihist} generates a histogram of the characters in its input.
  478. @item @command{ExplicateUTF8} is intended for debugging or for learning about
  479. Unicode. It determines and explains the validity of a sequence of bytes as a
  480. UTF8 encoding.
  481. @item @command{utf8lookup} provides a handy way to look up Unicode characters
  482. from the command line.
  483. @item @command{unireverse} reverse each line of UTF-8 input
  484. character-by-character.
  485. @end itemize")
  486. (license license:gpl3)))
  487. (define-public libconfig
  488. (package
  489. (name "libconfig")
  490. (version "1.7.3")
  491. (home-page "https://hyperrealm.github.io/libconfig/")
  492. (source (origin
  493. (method url-fetch)
  494. (uri (string-append home-page "/dist/libconfig-"
  495. version ".tar.gz"))
  496. (sha256
  497. (base32
  498. "1rqynfxl1zxwk4b42sniz9xlw285aidcrsfih51p8dy0rbb6clal"))))
  499. (build-system gnu-build-system)
  500. (synopsis "C/C++ configuration file library")
  501. (description
  502. "Libconfig is a simple library for manipulating structured configuration
  503. files. This file format is more compact and more readable than XML. And
  504. unlike XML, it is type-aware, so it is not necessary to do string parsing in
  505. application code.")
  506. (license license:lgpl2.1+)))
  507. (define-public pfff
  508. (package
  509. (name "pfff")
  510. (version "1.0")
  511. (source (origin
  512. (method git-fetch)
  513. (uri (git-reference
  514. (url "https://github.com/pfff/pfff")
  515. (commit (string-append "v" version))))
  516. (file-name (git-file-name name version))
  517. (sha256
  518. (base32
  519. "1nxkfm7zliq3rmr7yp871sppwfnz71iz364m2sgazny71pzykggc"))))
  520. (build-system cmake-build-system)
  521. (home-page "https://biit.cs.ut.ee/pfff/")
  522. (synopsis "Probabilistic fast file fingerprinting tool")
  523. (description
  524. "pfff is a tool for calculating a compact digital fingerprint of a file
  525. by sampling randomly from the file instead of reading it in full.
  526. Consequently, the computation has a flat performance characteristic,
  527. correlated with data variation rather than file size. pfff can be as reliable
  528. as existing hashing techniques, with provably negligible risk of collisions.")
  529. (license license:bsd-3)))
  530. (define-public oniguruma
  531. (package
  532. (name "oniguruma")
  533. (version "6.9.5-rev1")
  534. (source (origin
  535. (method url-fetch)
  536. (uri (string-append "https://github.com/kkos/"
  537. "oniguruma/releases/download/v"
  538. ;; If there is a "-" in the version, convert
  539. ;; to underscore for this part of the URI.
  540. (string-map (lambda (c) (if (char=? #\- c) #\_ c))
  541. version)
  542. "/onig-" version ".tar.gz"))
  543. (sha256
  544. (base32
  545. "17m92k1n6bvza6m35fpd5g36zwpwm3hfz3478iwj5bvj2sfq8g6k"))))
  546. (build-system gnu-build-system)
  547. (arguments '(#:configure-flags '("--disable-static")))
  548. (home-page "https://github.com/kkos/oniguruma")
  549. (synopsis "Regular expression library")
  550. (description "Oniguruma is a regular expressions library. The special
  551. characteristic of this library is that different character encoding for every
  552. regular expression object can be specified.")
  553. (license license:bsd-2)))
  554. (define-public antiword
  555. (package
  556. (name "antiword")
  557. (version "0.37")
  558. (source (origin
  559. (method url-fetch)
  560. (uri (string-append "http://www.winfield.demon.nl/linux"
  561. "/antiword-" version ".tar.gz"))
  562. (sha256
  563. (base32
  564. "1b7mi1l20jhj09kyh0bq14qzz8vdhhyf35gzwsq43mn6rc7h0b4f"))
  565. (patches (search-patches "antiword-CVE-2014-8123.patch"))))
  566. (build-system gnu-build-system)
  567. (arguments
  568. `(#:tests? #f ; There are no tests
  569. #:make-flags
  570. (list "-f" "Makefile.Linux"
  571. (string-append "GLOBAL_INSTALL_DIR="
  572. (assoc-ref %outputs "out") "/bin")
  573. (string-append "GLOBAL_RESOURCES_DIR="
  574. (assoc-ref %outputs "out") "/share/antiword"))
  575. #:phases
  576. (modify-phases %standard-phases
  577. (replace 'configure
  578. (lambda* (#:key outputs #:allow-other-keys)
  579. ;; Ensure that mapping files can be found in the actual package
  580. ;; data directory.
  581. (substitute* "antiword.h"
  582. (("/usr/share/antiword")
  583. (string-append (assoc-ref outputs "out") "/share/antiword")))
  584. #t))
  585. (replace 'install
  586. (lambda* (#:key make-flags #:allow-other-keys)
  587. (apply invoke "make" `("global_install" ,@make-flags)))))))
  588. (home-page "http://www.winfield.demon.nl/")
  589. (synopsis "Microsoft Word document reader")
  590. (description "Antiword is an application for displaying Microsoft Word
  591. documents. It can also convert the document to PostScript or XML. Only
  592. documents made by MS Word version 2 and version 6 or later are supported. The
  593. name comes from: \"The antidote against people who send Microsoft Word files
  594. to everybody, because they believe that everybody runs Windows and therefore
  595. runs Word\".")
  596. (license license:gpl2+)))
  597. (define-public catdoc
  598. (package
  599. (name "catdoc")
  600. (version "0.95")
  601. (source (origin
  602. (method url-fetch)
  603. (uri (string-append "http://ftp.wagner.pp.ru/pub/catdoc/"
  604. "catdoc-" version ".tar.gz"))
  605. (patches (search-patches "catdoc-CVE-2017-11110.patch"))
  606. (sha256
  607. (base32
  608. "15h7v3bmwfk4z8r78xs5ih6vd0pskn0rj90xghvbzdjj0cc88jji"))))
  609. (build-system gnu-build-system)
  610. ;; TODO: Also build `wordview` which requires `tk` – make a separate
  611. ;; package for this.
  612. (arguments
  613. '(#:tests? #f ; There are no tests
  614. #:configure-flags '("--disable-wordview")
  615. #:phases
  616. (modify-phases %standard-phases
  617. (add-before 'install 'fix-install
  618. (lambda* (#:key outputs #:allow-other-keys)
  619. (let ((out (assoc-ref outputs "out")))
  620. (mkdir-p (string-append out "/share/man/man1"))))))))
  621. (home-page "https://www.wagner.pp.ru/~vitus/software/catdoc/")
  622. (synopsis "MS-Word to TeX or plain text converter")
  623. (description "@command{catdoc} extracts text from MS-Word files, trying to
  624. preserve as many special printable characters as possible. It supports
  625. everything up to Word-97. Also supported are MS Write documents and RTF files.
  626. @command{catdoc} does not preserve complex word formatting, but it can
  627. translate some non-ASCII characters into TeX escape codes. It's goal is to
  628. extract plain text and allow you to read it and, probably, reformat with TeX,
  629. according to TeXnical rules.
  630. This package also provides @command{xls2csv}, which extracts data from Excel
  631. spreadsheets and outputs it in comma-separated-value format, and
  632. @command{catppt}, which extracts data from PowerPoint presentations.")
  633. (license license:gpl2+)))
  634. (define-public utfcpp
  635. (package
  636. (name "utfcpp")
  637. (version "2.3.5")
  638. (source (origin
  639. (method git-fetch)
  640. (uri (git-reference
  641. (url "https://github.com/nemtrif/utfcpp")
  642. (commit (string-append "v" version))))
  643. (file-name (git-file-name name version))
  644. (sha256
  645. (base32
  646. "1gr98d826z6wa58r1s5i7rz7q2x3r31v7zj0pjjlrc7gfxwklr4s"))))
  647. (build-system cmake-build-system)
  648. (arguments
  649. `(#:out-of-source? #f
  650. #:phases
  651. (modify-phases %standard-phases
  652. (replace 'install ; no install target
  653. (lambda* (#:key outputs #:allow-other-keys)
  654. (let* ((out (assoc-ref outputs "out"))
  655. (include (string-append out "/include"))
  656. (doc (string-append out "/share/doc/" ,name)))
  657. (copy-recursively "source" include)
  658. (install-file "README.md" doc)
  659. #t))))))
  660. (home-page "https://github.com/nemtrif/utfcpp")
  661. (synopsis "Portable C++ library for handling UTF-8")
  662. (description "UTF8-CPP is a C++ library for handling UTF-8 encoded text
  663. in a portable way.")
  664. (license license:boost1.0)))
  665. (define-public dbacl
  666. (package
  667. (name "dbacl")
  668. (version "1.14.1")
  669. (source
  670. (origin
  671. (method url-fetch)
  672. (uri (string-append "mirror://sourceforge/dbacl/dbacl/" version "/"
  673. "dbacl-" version ".tar.gz"))
  674. (sha256
  675. (base32 "1gas0112wqjvwn9qg3hxnawk7h3prr0w9b2h68f3p1ifd1kzn3gz"))
  676. (patches (search-patches "dbacl-include-locale.h.patch"))))
  677. (build-system gnu-build-system)
  678. (arguments
  679. `(#:make-flags
  680. (list
  681. (string-append "-I" (assoc-ref %build-inputs "slang")
  682. "/include/slang")
  683. (string-append "-I" (assoc-ref %build-inputs "ncurses")
  684. "/include/ncurses"))
  685. #:phases
  686. (modify-phases %standard-phases
  687. (add-after 'unpack 'delete-sample6-and-japanese
  688. (lambda _
  689. (substitute* "doc/Makefile.am"
  690. (("sample6.txt") "")
  691. (("japanese.txt") ""))
  692. (delete-file "doc/sample6.txt")
  693. (delete-file "doc/japanese.txt")
  694. (substitute* (list "src/tests/Makefile.am"
  695. "src/tests/Makefile.in")
  696. (("dbacl-jap.shin") "")
  697. (("dbacl-jap.sh") ""))
  698. #t))
  699. (add-after 'unpack 'delete-test
  700. ;; See comments about the license.
  701. (lambda _
  702. (delete-file "src/tests/dbacl-jap.shin")
  703. #t))
  704. (add-after 'unpack 'fix-test-files
  705. (lambda* (#:key inputs outputs #:allow-other-keys)
  706. (let* ((out (assoc-ref outputs "out"))
  707. (bin (string-append out "/bin")))
  708. (substitute* (find-files "src/tests/" "\\.shin$")
  709. (("PATH=/bin:/usr/bin")
  710. "#PATH=/bin:/usr/bin")
  711. (("diff") (string-append (which "diff")))
  712. (("tr") (string-append (which "tr"))))
  713. #t)))
  714. (replace 'bootstrap
  715. (lambda _
  716. (invoke "autoreconf" "-vif")
  717. #t)))))
  718. (inputs
  719. `(("ncurses" ,ncurses)
  720. ("perl" ,perl)
  721. ("readline" ,readline)
  722. ("slang" ,slang)))
  723. (native-inputs
  724. `(("libtool" ,libtool)
  725. ("autoconf" ,autoconf)
  726. ("automake" ,automake)
  727. ("pkg-config" ,pkg-config)))
  728. (home-page "https://www.lbreyer.com/dbacl.html")
  729. (synopsis "Bayesian text and email classifier")
  730. (description
  731. "dbacl is a fast Bayesian text and email classifier. It builds a variety
  732. of language models using maximum entropy (minimum divergence) principles, and
  733. these can then be used to categorize input data automatically among multiple
  734. categories.")
  735. ;; The software is licensed as GPLv3 or later, but
  736. ;; includes various sample texts in the doc dir:
  737. ;; - sample1.txt, sample3 and sampe5.txt are in the public domain,
  738. ;; by Mark Twain.
  739. ;; - sample2.txt, sample4.txt are in the public domain, by Aristotle.
  740. ;; - sample6.txt is a forwarded email, copyright unknown.
  741. ;; Guix does exclude sample6.txt.
  742. ;; - japanese.txt is a Japanese unoffical translation of the
  743. ;; GNU General Public License, (c) by the Free Software Foundation.
  744. ;; Guix excludes this file.
  745. (license (list license:gpl3+ license:public-domain))))
  746. (define-public dotconf
  747. (package
  748. (name "dotconf")
  749. (version "1.3")
  750. (source (origin
  751. (method git-fetch)
  752. (uri (git-reference
  753. (url "https://github.com/williamh/dotconf")
  754. (commit (string-append "v" version))))
  755. (file-name (git-file-name name version))
  756. (sha256
  757. (base32
  758. "1sc95hw5k2xagpafny0v35filmcn05k1ds5ghkldfpf6xw4hakp7"))))
  759. (build-system gnu-build-system)
  760. (arguments `(#:tests? #f)) ; FIXME maketest.sh does not work.
  761. (native-inputs
  762. `(("autoconf" ,autoconf)
  763. ("automake" ,automake)
  764. ("libtool" ,libtool)))
  765. (home-page "https://github.com/williamh/dotconf")
  766. (synopsis "Configuration file parser library")
  767. (description
  768. "C library for creating and parsing configuration files.")
  769. (license (list license:lgpl2.1 ; Main distribution.
  770. license:asl1.1)))) ; src/readdir.{c,h}
  771. (define-public drm-tools
  772. (package
  773. (name "drm-tools")
  774. (version "1.1.33")
  775. (source (origin
  776. (method url-fetch)
  777. (uri (string-append "mirror://sourceforge/drmtools/drm_tools-"
  778. version ".tar.gz"))
  779. (sha256
  780. (base32
  781. "187zbxw21zcg8gpyc13gxlycfw0n05a6rmqq6im5wr9zk1v1wj80"))))
  782. (build-system cmake-build-system)
  783. (arguments
  784. `(#:tests? #f ;the test suite fails
  785. #:phases (modify-phases %standard-phases
  786. (add-after 'unpack 'set-install-prefixes
  787. (lambda* (#:key outputs #:allow-other-keys)
  788. (let* ((out (assoc-ref outputs "out")))
  789. (substitute* "CMakeLists.txt"
  790. (("tmp/testinstall")
  791. (string-drop out 1))
  792. (("/man/man1")
  793. "/share/man/man1"))
  794. #t)))
  795. (add-after 'unpack 'adjust-test-paths
  796. (lambda _
  797. (substitute* '("test_extract_increment.sh"
  798. "test_extract_features.sh"
  799. "test_extract_features2.sh"
  800. "test_dmath.sh")
  801. (("\\./extract") "extract")
  802. (("\\./dmath") "dmath")
  803. (("/usr/local/bin/") "")
  804. (("/bin/rm") "rm")
  805. (("/bin/cp") "cp"))
  806. #t))
  807. (delete 'check)
  808. ;; The produced binaries are written directly to %output/bin.
  809. (delete 'install)
  810. (add-after 'build 'check
  811. (lambda* (#:key outputs tests? #:allow-other-keys)
  812. (when tests?
  813. (let* ((out (assoc-ref outputs "out"))
  814. (bin (string-append out "/bin")))
  815. (setenv "PATH" (string-append bin ":"
  816. (getenv "PATH")))
  817. (with-directory-excursion
  818. (format #f "../drm_tools-~a" ,version)
  819. (invoke "sh" "test_all.sh")))))))))
  820. (native-inputs `(("which" ,which))) ;for tests
  821. (inputs `(("pcre" ,pcre)))
  822. (home-page "http://drmtools.sourceforge.net/")
  823. (synopsis "Utilities to manipulate text and binary files")
  824. (description "The drm_tools package contains the following commands:
  825. @table @command
  826. @item accudate
  827. An extended version of the \"date\" program that has sub-second accuracy.
  828. @item binformat
  829. Format complex binary data into text.
  830. @item binload
  831. Load data into a binary file using simple commands from the input.
  832. @item binorder
  833. Sort, merge, search, retrieve or generate test data consisting of fixed size
  834. binary records.
  835. @item binreplace
  836. Find or find/replace in binary files.
  837. @item binsplit
  838. Split test data consisting of fixed size binary records into one or more
  839. output streams.
  840. @item chardiff
  841. Find changes between two files at the character level. Unlike \"diff\", it
  842. lists just the characters that differ, so if the 40,000th character is
  843. different only that one character will be shown, not the entire line.
  844. @item columnadd
  845. Add columns of integers, decimals, and/or times.
  846. @item datasniffer
  847. A utility for formatting binary data dumps.
  848. @item dmath
  849. Double precision interactive command line math calculator.
  850. @item extract
  851. Extract and emit data from text files based on character or token position.
  852. @item execinput
  853. A utility that reads from STDIN and executes each line as a command in a
  854. sub-process.
  855. @item indexed_text
  856. A utility for rapid retrieval of text by line numbers, in any order, from a
  857. text file.
  858. @item mdump
  859. Format binary data.
  860. @item msgqueue
  861. Create message queues and send/receive messages.
  862. @item mbin
  863. @itemx mbout
  864. Multiple buffer in and out. Used for buffering a lot of data between a slow
  865. device and a fast device. Mostly for buffering streaming tape drives for use
  866. with slower network connections, so that streaming is maintained as much as
  867. possible to minimize wear on the tape device.
  868. @item pockmark
  869. Corrupt data streams - useful for testing error correction and data recovery.
  870. @item tarsieve
  871. Filter, list, or split a tar file.
  872. @end table")
  873. (license license:gpl2+)))
  874. (define-public java-rsyntaxtextarea
  875. (package
  876. (name "java-rsyntaxtextarea")
  877. (version "2.6.1")
  878. (source (origin
  879. (method git-fetch)
  880. (uri (git-reference
  881. (url "https://github.com/bobbylight/RSyntaxTextArea")
  882. (commit version)))
  883. (file-name (git-file-name name version))
  884. (sha256
  885. (base32
  886. "0dyflzvxq2wvs0rgqfyi5yzzrb6r4bzw2dm8cl304dakxk38ddys"))))
  887. (build-system ant-build-system)
  888. (arguments
  889. `(;; FIXME: some tests fail because locale resources cannot be found.
  890. ;; Even when I add them to the class path,
  891. ;; RSyntaxTextAreaEditorKitDumbCompleteWordActionTest fails.
  892. #:tests? #f
  893. #:jar-name "rsyntaxtextarea.jar"))
  894. (native-inputs
  895. `(("java-junit" ,java-junit)
  896. ("java-hamcrest-core" ,java-hamcrest-core)))
  897. (home-page "https://bobbylight.github.io/RSyntaxTextArea/")
  898. (synopsis "Syntax highlighting text component for Java Swing")
  899. (description "RSyntaxTextArea is a syntax highlighting, code folding text
  900. component for Java Swing. It extends @code{JTextComponent} so it integrates
  901. completely with the standard @code{javax.swing.text} package. It is fast and
  902. efficient, and can be used in any application that needs to edit or view
  903. source code.")
  904. (license license:bsd-3)))
  905. ;; We use the sources from git instead of the tarball from pypi, because the
  906. ;; latter does not include the Cython source file from which bycython.cpp is
  907. ;; generated.
  908. (define-public python-editdistance
  909. (let ((commit "3ea84a7dd3258c76aa3be851ef3d50e59c886846")
  910. (revision "1"))
  911. (package
  912. (name "python-editdistance")
  913. (version (string-append "0.3.1-" revision "." (string-take commit 7)))
  914. (source
  915. (origin
  916. (method git-fetch)
  917. (uri (git-reference
  918. (url "https://github.com/aflc/editdistance")
  919. (commit commit)))
  920. (file-name (git-file-name name version))
  921. (sha256
  922. (base32
  923. "1l43svsv12crvzphrgi6x435z6xg8m086c64armp8wzb4l8ccm7g"))))
  924. (build-system python-build-system)
  925. (arguments
  926. `(#:phases
  927. (modify-phases %standard-phases
  928. (add-after 'unpack 'build-cython-code
  929. (lambda _
  930. (with-directory-excursion "editdistance"
  931. (delete-file "bycython.cpp")
  932. (invoke "cython" "--cplus" "bycython.pyx")))))))
  933. (native-inputs
  934. `(("python-cython" ,python-cython)))
  935. (home-page "https://www.github.com/aflc/editdistance")
  936. (synopsis "Fast implementation of the edit distance (Levenshtein distance)")
  937. (description
  938. "This library simply implements Levenshtein distance algorithm with C++
  939. and Cython.")
  940. (license license:expat))))
  941. (define-public go-github.com-mattn-go-runewidth
  942. (let ((commit "703b5e6b11ae25aeb2af9ebb5d5fdf8fa2575211")
  943. (version "0.0.4")
  944. (revision "1"))
  945. (package
  946. (name "go-github.com-mattn-go-runewidth")
  947. (version (git-version version revision commit))
  948. (source
  949. (origin
  950. (method git-fetch)
  951. (uri (git-reference
  952. (url "https://github.com/mattn/runewidth")
  953. (commit commit)))
  954. (file-name (git-file-name name version))
  955. (sha256
  956. (base32
  957. "0znpyz71gajx3g0j2zp63nhjj2c07g16885vxv4ykwnrfmzbgk4w"))))
  958. (build-system go-build-system)
  959. (arguments
  960. '(#:import-path "github.com/mattn/go-runewidth"))
  961. (synopsis "@code{runewidth} provides Go functions to work with string widths")
  962. (description
  963. "The @code{runewidth} library provides Go functions for padding,
  964. measuring and checking the width of strings, with support for East Asian
  965. text.")
  966. (home-page "https://github.com/mattn/runewidth")
  967. (license license:expat))))
  968. (define-public docx2txt
  969. (package
  970. (name "docx2txt")
  971. (version "1.4")
  972. (source (origin
  973. (method url-fetch)
  974. (uri (string-append
  975. "mirror://sourceforge/docx2txt/docx2txt/v"
  976. version "/docx2txt-" version ".tgz"))
  977. (sha256
  978. (base32
  979. "06vdikjvpj6qdb41d8wzfnyj44jpnknmlgbhbr1w215420lpb5xj"))))
  980. (build-system gnu-build-system)
  981. (inputs
  982. `(("unzip" ,unzip)
  983. ("perl" ,perl)))
  984. (arguments
  985. `(#:tests? #f ; No tests.
  986. #:make-flags (list (string-append "BINDIR="
  987. (assoc-ref %outputs "out") "/bin")
  988. (string-append "CONFIGDIR="
  989. (assoc-ref %outputs "out") "/etc")
  990. ;; Makefile seems to be a bit dumb at guessing.
  991. (string-append "INSTALL=install")
  992. (string-append "PERL=perl"))
  993. #:phases
  994. (modify-phases %standard-phases
  995. (delete 'configure)
  996. (add-after 'install 'fix-install
  997. (lambda* (#:key outputs inputs #:allow-other-keys)
  998. (let* ((out (assoc-ref outputs "out"))
  999. (bin (string-append out "/bin"))
  1000. (config (string-append out "/etc/docx2txt.config"))
  1001. (unzip (assoc-ref inputs "unzip")))
  1002. ;; According to INSTALL, the .sh wrapper can be skipped.
  1003. (delete-file (string-append bin "/docx2txt.sh"))
  1004. (rename-file (string-append bin "/docx2txt.pl")
  1005. (string-append bin "/docx2txt"))
  1006. (substitute* config
  1007. (("config_unzip => '/usr/bin/unzip',")
  1008. (string-append "config_unzip => '"
  1009. unzip
  1010. "/bin/unzip',")))
  1011. ;; Makefile is wrong.
  1012. (chmod config #o644)
  1013. #t))))))
  1014. (synopsis "Recover text from @file{.docx} files, with good formatting")
  1015. (description
  1016. "@command{docx2txt} is a Perl based command line utility to convert
  1017. Microsoft Office @file{.docx} documents to equivalent text documents. Latest
  1018. version supports following features during text extraction.
  1019. @itemize
  1020. @item Character conversions; currency characters are converted to respective
  1021. names like Euro.
  1022. @item Capitalisation of text blocks.
  1023. @item Center and right justification of text fitting in a line of
  1024. (configurable) 80 columns.
  1025. @item Horizontal ruler, line breaks, paragraphs separation, tabs.
  1026. @item Indicating hyperlinked text along with the hyperlink (configurable).
  1027. @item Handling (bullet, decimal, letter, roman) lists along with (attempt at)
  1028. indentation.
  1029. @end itemize\n")
  1030. (home-page "http://docx2txt.sourceforge.net")
  1031. (license license:gpl3+)))
  1032. (define-public html2text
  1033. ;; Use commit directly to get the fixes to the installation phase
  1034. ;; that are not in a release yet.
  1035. (let ((commit "05364c1028026a87d6f45130a8e86e1ee67704d2")
  1036. (revision "1"))
  1037. (package
  1038. (name "html2text")
  1039. (version (git-version "2.0.1_pre" revision commit))
  1040. (source
  1041. (origin
  1042. (method git-fetch)
  1043. (uri (git-reference
  1044. (url "https://github.com/grobian/html2text")
  1045. (commit (string-append commit))))
  1046. (file-name (git-file-name name version))
  1047. (sha256
  1048. (base32 "0n6pl0nijcn4z3p0dvf3gmvvpjq261pagnk84s9f78c4c55bw5cm"))))
  1049. (build-system gnu-build-system)
  1050. (arguments
  1051. `(#:make-flags
  1052. (list (string-append "PREFIX=" (assoc-ref %outputs "out")))
  1053. #:phases
  1054. (modify-phases %standard-phases
  1055. (replace 'configure
  1056. ;; The configure script is not from autotools and does not accept
  1057. ;; ‘--style’ options. There is no proper error handling.
  1058. (lambda* (#:key outputs #:allow-other-keys)
  1059. (invoke "./configure"
  1060. (string-append "CXX=" ,(cxx-for-target))))))))
  1061. (home-page "https://github.com/grobian/html2text")
  1062. (synopsis "HTML to plain text converter")
  1063. (description
  1064. "@code{html2text} is a command line utility that converts HTML
  1065. documents into plain text.")
  1066. (license (list license:bsd-4 ; cmp_nocase.cpp & sgml.h
  1067. license:gpl2+))))) ; everything else
  1068. (define-public odt2txt
  1069. (package
  1070. (name "odt2txt")
  1071. (version "0.5")
  1072. (source
  1073. (origin
  1074. (method git-fetch)
  1075. (uri (git-reference
  1076. (url "https://github.com/dstosberg/odt2txt/")
  1077. (commit (string-append "v" version))))
  1078. (file-name (git-file-name name version))
  1079. (sha256
  1080. (base32
  1081. "0im3kzvhxkjlx57w6h13mc9584c74ma1dyymgvpq2y61av3gc35v"))))
  1082. (build-system gnu-build-system)
  1083. (arguments
  1084. `(#:tests? #f ; no make check
  1085. #:make-flags (list "CC=gcc"
  1086. (string-append "DESTDIR=" (assoc-ref %outputs "out")))
  1087. #:phases
  1088. (modify-phases %standard-phases
  1089. ;; no configure script
  1090. (delete 'configure))))
  1091. (inputs
  1092. `(("zlib" ,zlib)))
  1093. (home-page "https://github.com/dstosberg/odt2txt/")
  1094. (synopsis "Converter from OpenDocument Text to plain text")
  1095. (description "odt2txt is a command-line tool which extracts the text out
  1096. of OpenDocument Texts, as produced by OpenOffice.org, KOffice, StarOffice and
  1097. others.
  1098. odt2txt can also extract text from some file formats similar to OpenDocument
  1099. Text, such as OpenOffice.org XML (*.sxw), which was used by OpenOffice.org
  1100. version 1.x and older StarOffice versions. To a lesser extent, odt2txt may be
  1101. useful to extract content from OpenDocument spreadsheets (*.ods) and
  1102. OpenDocument presentations (*.odp).")
  1103. (license license:gpl2)))
  1104. (define-public opencc
  1105. (package
  1106. (name "opencc")
  1107. (version "1.1.1")
  1108. (source
  1109. (origin
  1110. (method git-fetch)
  1111. (uri (git-reference
  1112. (url "https://github.com/BYVoid/OpenCC")
  1113. (commit (string-append "ver." version))))
  1114. (file-name (git-file-name name version))
  1115. (sha256
  1116. (base32
  1117. "07y0pvxjlmpcnym229j87qcfwnfm7vi10dad0a20xy6as55a9j3d"))
  1118. (modules '((guix build utils)))
  1119. (snippet
  1120. '(begin
  1121. ;; TODO: Unbundle tclap, darts-clone, gtest
  1122. (delete-file-recursively "deps/rapidjson-1.1.0") #t))))
  1123. (build-system cmake-build-system)
  1124. (arguments
  1125. ;; Required to locate the install script properly.
  1126. `(#:out-of-source? #f
  1127. #:parallel-build? #f ;occasionally failed.
  1128. #:imported-modules
  1129. (,@%cmake-build-system-modules
  1130. (guix build python-build-system))
  1131. #:modules ((guix build cmake-build-system)
  1132. ((guix build python-build-system) #:prefix python:)
  1133. (guix build utils))
  1134. #:phases
  1135. (modify-phases %standard-phases
  1136. (add-after 'unpack 'prevent-rebuild-during-installation
  1137. (lambda _
  1138. (substitute* "python/setup.py"
  1139. (("'build_py': BuildPyCommand,") ""))
  1140. #t))
  1141. (add-after 'unpack 'patch-3rd-party-references
  1142. (lambda* (#:key inputs #:allow-other-keys)
  1143. (let ((rapidjson (assoc-ref inputs "rapidjson")))
  1144. (substitute* "src/CMakeLists.txt"
  1145. (("../deps/rapidjson-1.1.0")
  1146. (string-append rapidjson "/include/rapidjson")))
  1147. #t)))
  1148. (add-before 'configure 'patch-python-binding-installation
  1149. (lambda* (#:key outputs inputs #:allow-other-keys)
  1150. (let ((out (assoc-ref outputs "out")))
  1151. (substitute* "python/opencc/__init__.py"
  1152. (("(_libopenccfile =).*$" _ prefix)
  1153. (format #f "~a os.path.join('~a/lib', _libopenccfilename)~%"
  1154. prefix out))
  1155. (("(_opencc_share_dir =).*$" _ prefix)
  1156. (format #f "~a '~a/share/opencc'~%" prefix out))))
  1157. #t))
  1158. (add-after 'install 'install-python-binding
  1159. (lambda* (#:key outputs inputs #:allow-other-keys)
  1160. (let* ((out (assoc-ref outputs "out"))
  1161. (dist (string-append
  1162. out "/lib/python"
  1163. ,(version-major+minor (package-version python))
  1164. "/site-packages")))
  1165. (chdir "python")
  1166. (mkdir-p dist)
  1167. (setenv "PYTHONPATH"
  1168. (string-append dist ":" (getenv "GUIX_PYTHONPATH")))
  1169. (invoke "python" "setup.py" "install"
  1170. "--root=/" "--single-version-externally-managed"
  1171. (string-append "--prefix=" out))
  1172. #t)))
  1173. (add-before 'install-python-binding 'enable-bytecode-determinism
  1174. (assoc-ref python:%standard-phases 'enable-bytecode-determinism)))))
  1175. (native-inputs
  1176. `(("python" ,python-wrapper)
  1177. ("rapidjson" ,rapidjson)
  1178. ("python-setuptools" ,python-setuptools)
  1179. ("python-wheel" ,python-wheel)))
  1180. (home-page "https://github.com/BYVoid/OpenCC")
  1181. (synopsis "Convert between Traditional Chinese and Simplified Chinese")
  1182. (description "Open Chinese Convert (OpenCC) converts between Traditional
  1183. Chinese and Simplified Chinese, supporting character-level conversion,
  1184. phrase-level conversion, variant conversion, and regional idioms among
  1185. Mainland China, Taiwan, and Hong-Kong.")
  1186. (license license:asl2.0)))
  1187. (define-public nkf
  1188. (let ((commit "08043eadf4abdddcf277842217e3c77a24740dc2")
  1189. (revision "1"))
  1190. (package
  1191. (name "nkf")
  1192. ;; The commits corresponding to specific versions are published
  1193. ;; here:
  1194. ;; https://ja.osdn.net/projects/nkf/scm/git/nkf/
  1195. (version "2.1.5")
  1196. (source (origin
  1197. (method git-fetch)
  1198. (uri (git-reference
  1199. (url "https://github.com/nurse/nkf")
  1200. (commit commit)))
  1201. (file-name (git-file-name name version))
  1202. (sha256
  1203. (base32
  1204. "0anw0knr1iy4p9w3d3b3pbwzh1c43p1i2q4c28kw9zviw8kx2rly"))))
  1205. (build-system gnu-build-system)
  1206. (arguments
  1207. `(#:tests? #f ; test for perl module
  1208. #:make-flags (list "CC=gcc" "CFLAGS=-O2 -Wall -pedantic"
  1209. (string-append "prefix=" %output)
  1210. "MKDIR=mkdir -p")
  1211. #:phases
  1212. (modify-phases %standard-phases
  1213. (delete 'configure)))) ; No ./configure script
  1214. (home-page "https://ja.osdn.net/projects/nkf/")
  1215. (synopsis "Network Kanji Filter")
  1216. (description "Nkf is yet another kanji code converter among networks,
  1217. hosts and terminals. It converts input kanji code to designated kanji code
  1218. such as ISO-2022-JP, Shift_JIS, EUC-JP, UTF-8, UTF-16 or UTF-32.")
  1219. (license license:zlib))))
  1220. (define-public python-pandocfilters
  1221. (package
  1222. (name "python-pandocfilters")
  1223. (version "1.4.3")
  1224. (source
  1225. (origin
  1226. (method url-fetch)
  1227. (uri (pypi-uri "pandocfilters" version))
  1228. (sha256
  1229. (base32 "1sq675dg4barb5949xxz4d5gk2ly524hi1p1xgwb3d1l0nsznqxw"))))
  1230. (build-system python-build-system)
  1231. (home-page "https://github.com/jgm/pandocfilters")
  1232. (synopsis "Python module for writing Pandoc filters")
  1233. (description "Pandoc is a powerful utility to transform various
  1234. input formats into a wide range of output formats. To alter the
  1235. exported output document, Pandoc allows the usage of filters, which
  1236. are pipes that read a JSON serialization of the Pandoc AST from stdin,
  1237. transform it in some way, and write it to stdout. It allows therefore
  1238. to alter the processing of Pandoc's supported input formats, for
  1239. instance one can add new syntax elements to markdown, etc.
  1240. This package provides Python bindings.")
  1241. (license license:bsd-3)))
  1242. (define-public aha
  1243. (package
  1244. (name "aha")
  1245. (version "0.5.1")
  1246. (source
  1247. (origin
  1248. (method git-fetch)
  1249. (uri (git-reference
  1250. (url "https://github.com/theZiz/aha")
  1251. (commit version)))
  1252. (sha256
  1253. (base32 "1gywad0rvvz3c5balz8cxsnx0562hj2ngzqyr8zsy2mb4pn0lpgv"))
  1254. (file-name (git-file-name name version))))
  1255. (build-system gnu-build-system)
  1256. (arguments
  1257. `(#:phases
  1258. (modify-phases %standard-phases
  1259. (delete 'configure))
  1260. #:make-flags (list (string-append "CC=" ,(cc-for-target))
  1261. (string-append "PREFIX="
  1262. (assoc-ref %outputs "out")))
  1263. #:tests? #f)) ; no test suite
  1264. (home-page "https://github.com/theZiz/aha")
  1265. (synopsis "Converts terminal escape sequences to HTML")
  1266. (description "@command{aha} (Ansi Html Adapter) converts ANSI escape sequences
  1267. of a Unix terminal to HTML code.")
  1268. (license (list license:lgpl2.0+ license:mpl1.1))))
  1269. (define-public go-github-com-errata-ai-vale
  1270. (package
  1271. (name "go-github-com-errata-ai-vale")
  1272. (version "2.4.0")
  1273. (source
  1274. (origin
  1275. (method git-fetch)
  1276. (uri (git-reference
  1277. (url "https://github.com/errata-ai/vale")
  1278. (commit (string-append "v" version))))
  1279. (sha256
  1280. (base32 "0d07fwha2220m8j24h527xl0gnl3svvyaywflgk5292d6g49ach2"))
  1281. (file-name (git-file-name name version))))
  1282. (build-system go-build-system)
  1283. (native-inputs
  1284. `(("github.com/sp13/afero" ,go-github-com-spf13-afero)
  1285. ("github.com/urfave/cli" ,go-github-com-urfave-cli)
  1286. ("github.com/olekukonko/tablewriter" ,go-github-com-olekukonko-tablewriter)
  1287. ("github.com/mitchellh/mapstructure" ,go-github-com-mitchellh-mapstructure)))
  1288. (arguments
  1289. `(#:import-path "github.com/errata-ai/vale"
  1290. #:install-source? #f))
  1291. (home-page "https://github.com/errata-ai/vale")
  1292. (synopsis "Fully customizable syntax-aware linter that focuses on your style")
  1293. (description
  1294. "Vale is a fully extensible linter that focuses on your own writing style
  1295. by making use of rules in individual YAML files. It is syntax-aware on markup
  1296. languages such as HTML, Markdown, Asciidoc, and reStructuredText. The community
  1297. around it also has a list of style guides implemented with Vale in
  1298. @url{https://github.com/errata-ai/styles, their styles repo}.")
  1299. (license license:expat)))