1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2015 Taylan Ulrich Bayırlı/Kammer <taylanbayirli@gmail.com>
3 ;;; Copyright © 2015, 2016 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>
9 ;;; This file is part of GNU Guix.
11 ;;; GNU Guix is free software; you can redistribute it and/or modify it
12 ;;; under the terms of the GNU General Public License as published by
13 ;;; the Free Software Foundation; either version 3 of the License, or (at
14 ;;; your option) any later version.
16 ;;; GNU Guix is distributed in the hope that it will be useful, but
17 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
18 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 ;;; GNU General Public License for more details.
21 ;;; You should have received a copy of the GNU General Public License
22 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
24 (define-module (gnu packages textutils)
25 #:use-module ((guix licenses) #:prefix license:)
26 #:use-module (guix packages)
27 #:use-module (guix download)
28 #:use-module (guix git-download)
29 #:use-module (guix build-system gnu)
30 #:use-module (guix build-system cmake)
31 #:use-module (guix build-system trivial)
32 #:use-module (gnu packages autotools)
33 #:use-module (gnu packages python)
34 #:use-module (gnu packages zip))
39 ;; Last beta release (3.7-beta2) is from 2008; last commit from Feb 2014.
40 ;; So we use that commit instead.
41 (version "3.7.0.201402")
46 (url "https://github.com/pinard/Recode.git")
47 (commit "2d7092a9999194fc0e9449717a8048c8d8e26c18")))
49 (base32 "1wssv8z6g3ryrw33sksz4rjhlnhgvvdqszw1ggl4rcwks34n86zm"))
50 (file-name (string-append name "-" version "-checkout"))))
51 (build-system gnu-build-system)
52 (native-inputs `(("python" ,python-2)))
58 (substitute* "tests/setup.py"
59 (("([[:space:]]*)include_dirs=.*" all space)
60 (string-append all space "library_dirs=['../src/.libs'],\n")))
61 ;; The test extension 'Recode.so' lacks RUNPATH for 'librecode.so'.
62 (setenv "LD_LIBRARY_PATH" (string-append (getcwd) "/src/.libs")))
64 (home-page "https://github.com/pinard/Recode")
65 (synopsis "Text encoding converter")
66 (description "The Recode library converts files between character sets and
67 usages. It recognises or produces over 200 different character sets (or about
68 300 if combined with an iconv library) and transliterates files between almost
69 any pair. When exact transliteration are not possible, it gets rid of
70 offending characters or falls back on approximations. The recode program is a
71 handy front-end to the library.")
72 (license license:gpl2+)))
82 "https://github.com/nijel/enca/archive/" version ".tar.gz"))
84 (base32 "1xik00x0yvhswsw2isnclabhv536xk1s42cf5z54gfbpbhc7ni8l"))
85 (file-name (string-append name "-" version ".tar.gz"))))
86 (build-system gnu-build-system)
87 (inputs `(("recode" ,recode)))
89 ;; Both 'test-convert-64.sh' and 'test-convert-filter.sh' manipulate a
90 ;; 'test.tmp' file, so they have to run in sequence.
91 (arguments '(#:parallel-tests? #f))
93 (home-page "https://github.com/nijel/enca")
94 (synopsis "Text encoding detection tool")
95 (description "Enca (Extremely Naive Charset Analyser) consists of libenca,
96 an encoding detection library, and enca, a command line frontend, integrating
97 libenca and several charset conversion libraries and tools.")
98 (license license:gpl2)))
100 (define-public utf8proc
108 "https://github.com/JuliaLang/utf8proc/archive/v"
110 (file-name (string-append name "-" version ".tar.gz"))
112 (base32 "1k48as5kjkar4yj3dwxyll8ykj4k723ib5a6mnw1g86q3zi0zdl3"))))
113 (build-system gnu-build-system)
115 '(#:tests? #f ;no "check" target
116 #:make-flags (list "CC=gcc"
117 (string-append "prefix=" (assoc-ref %outputs "out")))
119 (modify-phases %standard-phases
120 (delete 'configure))))
121 (home-page "http://julialang.org/utf8proc/")
122 (synopsis "C library for processing UTF-8 Unicode data")
123 (description "utf8proc is a small C library that provides Unicode
124 normalization, case-folding, and other operations for data in the UTF-8
125 encoding, supporting Unicode version 7.0.")
126 (license license:expat)))
128 (define-public libgtextutils
130 (name "libgtextutils")
136 "https://github.com/agordon/libgtextutils/releases/download/"
137 version "/libgtextutils-" version ".tar.gz"))
139 (base32 "0jiybkb2z58wa2msvllnphr4js2hvjvh988pavb3mzkgr6ihwbkr"))))
140 (build-system gnu-build-system)
145 (lambda _ (zero? (system* "autoreconf" "-vif")))
148 `(("autoconf" ,autoconf)
149 ("automake" ,automake)
150 ("libtool" ,libtool)))
151 (home-page "https://github.com/agordon/libgtextutils")
152 (synopsis "Gordon's text utils library")
154 "libgtextutils is a text utilities library used by the fastx toolkit from
156 (license license:agpl3+)))
158 (define-public cityhash
159 (let ((commit "8af9b8c"))
162 (version (string-append "1.1-2." commit))
166 (url "https://github.com/google/cityhash.git")
168 (file-name (string-append name "-" version ".tar.gz"))
171 "0n6skf5dv8yfl1ckax8dqhvsbslkwc9158zf2ims0xqdvzsahbi6"))))
172 (build-system gnu-build-system)
174 '(#:make-flags (list "CXXFLAGS=-g -O3")
176 (modify-phases %standard-phases
177 ;; citycrc is not installed by default but is used by some
179 (add-after 'install 'install-citycrc
180 (lambda* (#:key outputs #:allow-other-keys)
181 (let* ((out (assoc-ref outputs "out"))
182 (include (string-append out "/include")))
183 (install-file "src/citycrc.h" include))
185 (home-page "https://github.com/google/cityhash")
186 (synopsis "C++ hash functions for strings")
188 "CityHash provides hash functions for strings. The functions mix the
189 input bits thoroughly but are not suitable for cryptography.")
190 (license license:expat))))
198 (uri (string-append "http://www.and.org/ustr/" version
199 "/ustr-" version ".tar.bz2"))
202 "1i623ygdj7rkizj7985q9d6vj5amwg686aqb5j3ixpkqkyp6xbrx"))))
203 (build-system gnu-build-system)
208 ;; Override "/sbin/ldconfig" with "echo" because we don't need
211 (string-append "prefix=" (assoc-ref %outputs "out"))
214 (modify-phases %standard-phases
215 (add-after 'unpack 'disable-check-for-stdint
217 ;; Of course we have stdint.h, just not in /usr/include
218 (substitute* '("Makefile"
220 (("-f \"/usr/include/stdint.h\"") "-z \"\""))
222 ;; No configure script
223 (delete 'configure))))
224 (home-page "http://www.and.org/ustr/")
225 (synopsis "String library with very low memory overhead")
227 "Ustr is a string library for C with very low memory overhead.")
228 ;; Quoted from the home page: "The License for the code is MIT, new-BSD,
229 ;; LGPL, etc. ... if you need another license to help compatibility, just
230 ;; ask for it. It's basically public domain, without all the legal
231 ;; problems for everyone that trying to make something public domain
233 (license license:public-domain)))
235 (define-public libconfig
241 (uri (string-append "http://www.hyperrealm.com/libconfig/"
242 "libconfig-" version ".tar.gz"))
245 "1xh3hzk63v4y8815lc5209m3s6ms2cpgw4h5hg462i4f1lwsl7g3"))))
246 (build-system gnu-build-system)
247 (home-page "http://www.hyperrealm.com/libconfig/")
248 (synopsis "C/C++ configuration file library")
250 "Libconfig is a simple library for manipulating structured configuration
251 files. This file format is more compact and more readable than XML. And
252 unlike XML, it is type-aware, so it is not necessary to do string parsing in
254 (license license:lgpl2.1+)))
262 (uri (string-append "https://github.com/pfff/pfff/archive/v"
264 (file-name (string-append name "-" version ".tar.gz"))
267 "00m553aa277iarxj6dalmklyb64r7ias49bfwzbacsfg8h3kar8m"))))
268 (build-system cmake-build-system)
269 (home-page "http://biit.cs.ut.ee/pfff/")
270 (synopsis "Probabilistic fast file fingerprinting tool")
272 "pfff is a tool for calculating a compact digital fingerprint of a file
273 by sampling randomly from the file instead of reading it in full.
274 Consequently, the computation has a flat performance characteristic,
275 correlated with data variation rather than file size. pfff can be as reliable
276 as existing hashing techniques, with provably negligible risk of collisions.")
277 (license license:bsd-3)))
279 (define-public oniguruma
285 (uri (string-append "https://github.com/kkos/"
286 "oniguruma/releases/download/v" version
287 "/onig-" version ".tar.gz"))
290 "19s79vsclqn170mw0ajwv7j37qsbn4f1yjz3yavnhvva6c820r6m"))))
291 (build-system gnu-build-system)
292 (home-page "https://github.com/kkos/oniguruma")
293 (synopsis "Regular expression library")
294 (description "Oniguruma is a regular expressions library. The special
295 characteristic of this library is that different character encoding for every
296 regular expression object can be specified.")
297 (license license:bsd-2)))
299 (define-public antiword
305 (uri (string-append "http://www.winfield.demon.nl/linux"
306 "/antiword-" version ".tar.gz"))
309 "1b7mi1l20jhj09kyh0bq14qzz8vdhhyf35gzwsq43mn6rc7h0b4f"))))
310 (build-system gnu-build-system)
312 `(#:tests? #f ; There are no tests
314 (list "-f" "Makefile.Linux"
315 (string-append "GLOBAL_INSTALL_DIR="
316 (assoc-ref %outputs "out") "/bin")
317 (string-append "GLOBAL_RESOURCES_DIR="
318 (assoc-ref %outputs "out") "/share/antiword"))
320 (modify-phases %standard-phases
323 (lambda* (#:key make-flags #:allow-other-keys)
324 (zero? (apply system* "make" `("global_install" ,@make-flags))))))))
325 (home-page "http://www.winfield.demon.nl/")
326 (synopsis "Microsoft Word document reader")
327 (description "Antiword is an application for displaying Microsoft Word
328 documents. It can also convert the document to PostScript or XML. Only
329 documents made by MS Word version 2 and version 6 or later are supported. The
330 name comes from: \"The antidote against people who send Microsoft Word files
331 to everybody, because they believe that everybody runs Windows and therefore
333 (license license:gpl2+)))
335 (define-public utfcpp
343 "mirror://sourceforge/project/utfcpp/utf8cpp_2x/Release%20"
345 (string-map (lambda (x) (if (eq? x #\.) #\_ x)) version)
347 (file-name (string-append name "-" version ".zip"))
350 "1vqhs0aipcvvdrwcs7h3jsryg6mgbmc4s34n5cm6d36q4nxwwwrk"))))
351 (build-system trivial-build-system)
353 `(#:modules ((guix build utils))
356 (use-modules (guix build utils))
357 (let ((source (assoc-ref %build-inputs "source"))
358 (out (assoc-ref %outputs "out"))
359 (unzip (string-append (assoc-ref %build-inputs "unzip")
362 (with-directory-excursion out
363 (system* unzip source)
364 (mkdir-p "share/doc")
365 (rename-file "doc" "share/doc/utfcpp")
366 (rename-file "source" "include"))))))
367 (native-inputs `(("unzip" ,unzip)))
368 (home-page "https://github.com/nemtrif/utfcpp")
369 (synopsis "Portable C++ library for handling UTF-8")
370 (description "UTF8-CPP is a C++ library for handling UTF-8 encoded text
372 (license license:boost1.0)))