Merge branch 'master' into core-updates
[jackhill/guix/guix.git] / gnu / packages / search.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2014 Mark H Weaver <mhw@netris.org>
3 ;;; Copyright © 2015, 2016 Eric Bavier <bavier@member.fsf.org>
4 ;;; Copyright © 2017 Thomas Danckaert <post@thomasdanckaert.be>
5 ;;; Copyright © 2017 Ricardo Wurmus <rekado@elephly.net>
6 ;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
7 ;;; Copyright © 2018 Adam Massmann <massmannak@gmail.com>
8 ;;;
9 ;;; This file is part of GNU Guix.
10 ;;;
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.
15 ;;;
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.
20 ;;;
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/>.
23
24 (define-module (gnu packages search)
25 #:use-module ((guix licenses)
26 #:select (gpl2 gpl2+ gpl3+ lgpl2.1+ bsd-3 x11))
27 #:use-module (guix packages)
28 #:use-module (guix download)
29 #:use-module (guix utils)
30 #:use-module (guix build-system gnu)
31 #:use-module (guix build-system python)
32 #:use-module (gnu packages)
33 #:use-module (gnu packages compression)
34 #:use-module (gnu packages check)
35 #:use-module (gnu packages databases)
36 #:use-module (gnu packages freedesktop)
37 #:use-module (gnu packages linux)
38 #:use-module (gnu packages perl)
39 #:use-module (gnu packages pdf)
40 #:use-module (gnu packages python)
41 #:use-module (gnu packages python-web)
42 #:use-module (gnu packages web)
43 #:use-module (gnu packages xdisorg)
44 #:use-module (gnu packages xml))
45
46 (define-public xapian
47 (package
48 (name "xapian")
49 (version "1.4.7")
50 ;; Note: When updating Xapian, remember to update xapian-bindings below.
51 (source (origin
52 (method url-fetch)
53 (uri (string-append "https://oligarchy.co.uk/xapian/" version
54 "/xapian-core-" version ".tar.xz"))
55 (patches (search-patches "xapian-revert-5489fb2f8.patch"))
56 (sha256
57 (base32 "1lxmlds3v5s1gng9nk1rvmln1zcksrw5ds509y0glylwch5qmw0k"))))
58 (build-system gnu-build-system)
59 (inputs `(("zlib" ,zlib)
60 ("util-linux" ,util-linux)))
61 (arguments
62 `(#:phases
63 (modify-phases %standard-phases
64 (replace 'check
65 ;; As of Xapian 1.3.3, the TCP server implementation uses
66 ;; getaddrinfo(). This does not work in the build environment,
67 ;; so exclude those tests. See HACKING for the list of targets.
68 (lambda _
69 (invoke "make"
70 "check-inmemory"
71 "check-remoteprog"
72 ;"check-remotetcp"
73 "check-multi"
74 "check-glass"
75 "check-chert"))))))
76 (synopsis "Search Engine Library")
77 (description
78 "Xapian is a highly adaptable toolkit which allows developers to easily
79 add advanced indexing and search facilities to their own applications. It
80 supports the Probabilistic Information Retrieval model and also supports a
81 rich set of boolean query operators.")
82 (home-page "https://xapian.org/")
83 (license (list gpl2+ bsd-3 x11))))
84
85 (define-public python-xapian-bindings
86 (package (inherit xapian)
87 (name "python-xapian-bindings")
88 (version (package-version xapian))
89 (source (origin
90 (method url-fetch)
91 (uri (string-append "https://oligarchy.co.uk/xapian/" version
92 "/xapian-bindings-" version ".tar.xz"))
93 (sha256
94 (base32
95 "0sjf9ck3a6p7xnd84w09l6s0xn2g03k9a9417f4mjnywfq9pa6a5"))))
96 (build-system gnu-build-system)
97 (arguments
98 `(#:configure-flags '("--with-python3")
99 #:make-flags
100 (list (string-append "pkgpylibdir="
101 (assoc-ref %outputs "out")
102 "/lib/python" ,(version-major+minor
103 (package-version python))
104 "/site-packages/xapian"))))
105 (inputs
106 `(("python" ,python)
107 ("python-sphinx" ,python-sphinx) ; for documentation
108 ("xapian" ,xapian)
109 ("zlib" ,zlib)))
110 (synopsis "Python bindings for the Xapian search engine library")
111 (license gpl2+)))
112
113 (define-public libtocc
114 (package
115 (name "libtocc")
116 (version "1.0.1")
117 (source
118 (origin
119 (method url-fetch)
120 (uri (string-append "https://github.com/aidin36/tocc/releases/download/"
121 "v" version "/tocc-" version ".tar.gz"))
122 (sha256
123 (base32
124 "1kd2jd74m8ksc8s7hh0haz0q0c3n0mr39bbky262kk4l58f1g068"))))
125 (build-system gnu-build-system)
126 (native-inputs `(("catch" ,catch-framework)))
127 (inputs `(("unqlite" ,unqlite)))
128 (arguments
129 `(#:phases (modify-phases %standard-phases
130 (add-before 'configure 'chdir-source
131 (lambda _
132 (chdir "libtocc/src")
133 #t))
134 (replace 'check
135 (lambda _
136 (with-directory-excursion "../tests"
137 (invoke "./configure"
138 (string-append "CONFIG_SHELL="
139 (which "sh"))
140 (string-append "SHELL="
141 (which "sh"))
142 "CPPFLAGS=-I../src"
143 (string-append
144 "LDFLAGS=-L../src/.libs "
145 "-Wl,-rpath=../src/.libs"))
146 (invoke "make")
147 (invoke "./libtocctests")))))))
148 (home-page "https://t-o-c-c.com/")
149 (synopsis "Tool for Obsessive Compulsive Classifiers")
150 (description
151 "libtocc is the engine of the Tocc project, a tag-based file management
152 system. The goal of Tocc is to provide a better system for classifying files
153 that is more flexible than classic file systems that are based on a tree of
154 files and directories.")
155 (license gpl3+)))
156
157 (define-public tocc
158 (package
159 (name "tocc")
160 (version (package-version libtocc))
161 (source (package-source libtocc))
162 (build-system gnu-build-system)
163 (inputs
164 `(("libtocc" ,libtocc)
165 ("unqlite" ,unqlite)))
166 (arguments
167 `(#:tests? #f ;No tests
168 #:phases (modify-phases %standard-phases
169 (add-after
170 'unpack 'chdir-source
171 (lambda _ (chdir "cli/src"))))))
172 (home-page "https://t-o-c-c.com/")
173 (synopsis "Command-line interface to libtocc")
174 (description
175 "Tocc is a tag-based file management system. This package contains the
176 command line tool for interacting with libtocc.")
177 (license gpl3+)))
178
179 (define-public bool
180 (package
181 (name "bool")
182 (version "0.2.2")
183 (source
184 (origin
185 (method url-fetch)
186 (uri (string-append "mirror://gnu/bool/bool-"
187 version ".tar.xz"))
188 (sha256
189 (base32
190 "1frdmgrmb509fxbdpsxxw3lvvwv7xm1pavqrqgm4jg698iix6xfw"))))
191 (build-system gnu-build-system)
192 (home-page "https://www.gnu.org/software/bool/")
193 (synopsis "Finding text and HTML files that match boolean expressions")
194 (description
195 "GNU Bool is a utility to perform text searches on files using Boolean
196 expressions. For example, a search for \"hello AND world\" would return a
197 file containing the phrase \"Hello, world!\". It supports both AND and OR
198 statements, as well as the NEAR statement to search for the occurrence of
199 words in close proximity to each other. It handles context gracefully,
200 accounting for new lines and paragraph changes. It also has robust support
201 for parsing HTML files.")
202 (license gpl3+)))
203
204 (define-public hyperestraier
205 (package
206 (name "hyperestraier")
207 (version "1.4.13")
208 (source
209 (origin
210 (method url-fetch)
211 (uri (string-append "http://fallabs.com/" name "/"
212 name "-" version ".tar.gz"))
213 (sha256
214 (base32
215 "1qk3pxgzyrpcz5qfyd5xs2hw9q1cbb7j5zd4kp1diq501wcj2vs9"))))
216 (inputs
217 `(("qdbm" ,qdbm)
218 ("zlib" ,zlib)))
219 (build-system gnu-build-system)
220 (arguments
221 `(#:configure-flags (list (string-append "LDFLAGS=-Wl,-rpath="
222 (assoc-ref %outputs "out")
223 "/lib"))))
224 (home-page "http://fallabs.com/hyperestraier")
225 (synopsis "Full-text search system")
226 (description "Hyper Estraier can be used to integrate full-text
227 search into applications, using either the provided command line and CGI
228 interfaces, or a C API.")
229 (license lgpl2.1+)))
230
231 (define-public mlocate
232 (package
233 (name "mlocate")
234 (version "0.26")
235 (source (origin
236 (method url-fetch)
237 (uri (string-append "http://releases.pagure.org/mlocate/"
238 "mlocate-" version ".tar.xz"))
239 (sha256
240 (base32
241 "0gi6y52gkakhhlnzy0p6izc36nqhyfx5830qirhvk3qrzrwxyqrh"))))
242 (build-system gnu-build-system)
243 (home-page "https://pagure.io/mlocate")
244 (synopsis "Locate files on the file system")
245 (description
246 "mlocate is a locate/updatedb implementation. The 'm' stands for
247 \"merging\": @code{updatedb} reuses the existing database to avoid rereading
248 most of the file system, which makes it faster and does not trash the system
249 caches as much. The locate(1) utility is intended to be completely compatible
250 with slocate, and attempts to be compatible to GNU locate when it does not
251 conflict with slocate compatibility.")
252 (license gpl2)))
253
254 (define-public swish-e
255 (package
256 (name "swish-e")
257 (version "2.4.7")
258 (source (origin
259 (method url-fetch)
260 (uri (list (string-append
261 "https://web.archive.org/web/20160730145202/"
262 "http://swish-e.org/distribution/"
263 "swish-e-" version ".tar.gz")
264 (string-append "http://http.debian.net/debian/pool/"
265 "main/s/swish-e/swish-e_" version
266 ".orig.tar.gz")))
267 (file-name (string-append name "-" version ".tar.gz"))
268 (sha256
269 (base32
270 "0qkrk7z25yp9hynj21vxkyn7yi8gcagcfxnass5cgczcz0gm9pax"))
271 (patches (search-patches "swish-e-search.patch"
272 "swish-e-format-security.patch"))))
273 (build-system gnu-build-system)
274 ;; Several other packages and perl modules may be installed alongside
275 ;; swish-e to extend its features at runtime, but are not required for
276 ;; building: xpdf, catdoc, MP3::Tag, Spreadsheet::ParseExcel,
277 ;; HTML::Entities.
278 (inputs
279 `(("perl" ,perl)
280 ("perl-uri" ,perl-uri)
281 ("perl-html-parser" ,perl-html-parser)
282 ("perl-html-tagset" ,perl-html-tagset)
283 ("perl-mime-types" ,perl-mime-types)))
284 (arguments
285 `(;; XXX: This fails to build with zlib (API mismatch) and tests fail
286 ;; with libxml2, so disable both.
287 #:configure-flags (list (string-append "--without-zlib")
288 (string-append "--without-libxml2"))
289 #:phases (modify-phases %standard-phases
290 (add-after 'install 'wrap-programs
291 (lambda* (#:key inputs outputs #:allow-other-keys)
292 (let* ((out (assoc-ref outputs "out")))
293 (for-each
294 (lambda (program)
295 (wrap-program program
296 `("PERL5LIB" ":" prefix
297 ,(map (lambda (i)
298 (string-append (assoc-ref inputs i)
299 "/lib/perl5/site_perl"))
300 ;; These perl modules have no propagated
301 ;; inputs, so no further analysis needed.
302 '("perl-uri"
303 "perl-html-parser"
304 "perl-html-tagset"
305 "perl-mime-types")))))
306 (list (string-append out "/lib/swish-e/swishspider")
307 (string-append out "/bin/swish-filter-test")))
308 #t))))))
309 (home-page (string-append "https://web.archive.org/web/20160730145202/"
310 "http://swish-e.org"))
311 (synopsis "Web indexing system")
312 (description
313 "Swish-e is Simple Web Indexing System for Humans - Enhanced. Swish-e
314 can quickly and easily index directories of files or remote web sites and
315 search the generated indexes.")
316 (license gpl2+))) ;with exception
317
318 (define-public xapers
319 (package
320 (name "xapers")
321 (version "0.8.2")
322 (source
323 (origin
324 (method url-fetch)
325 (uri (string-append
326 "https://finestructure.net/xapers/releases/xapers-"
327 version ".tar.gz"))
328 (sha256
329 (base32
330 "0ykz6hn3qj46w3c99d6q0pi5ncq2894simcl7vapv047zm3cylmd"))))
331 (build-system python-build-system)
332 (propagated-inputs
333 `(("poppler" ,poppler)
334 ("python-urwid" ,python-urwid)
335 ("xclip" ,xclip)
336 ("xdg-utils" ,xdg-utils)))
337 (inputs
338 `(("python-latexcodec" ,python-latexcodec)
339 ("python-pybtex" ,python-pybtex)
340 ("python-pycurl" ,python-pycurl)
341 ("python-pyyaml" ,python-pyyaml)
342 ("python-six" ,python-six)
343 ("python-xapian-bindings" ,python-xapian-bindings)))
344 (arguments
345 `(#:modules ((ice-9 rdelim)
346 (guix build python-build-system)
347 (guix build utils))
348 #:phases
349 (modify-phases %standard-phases
350 (add-after 'install 'install-doc
351 (lambda* (#:key inputs outputs #:allow-other-keys)
352 (define (purge-term-support input output)
353 (let loop ((line (read-line input)))
354 (if (string-prefix? "if [[ \"$term\"" line)
355 (begin (display "eval \"$cmd\"\n" output)
356 #t)
357 (begin (display (string-append line "\n") output)
358 (loop (read-line input))))))
359 (let* ((out (assoc-ref outputs "out"))
360 (bin (string-append out "/bin"))
361 (adder-out (string-append bin "/xapers-adder"))
362 (man1 (string-append out "/share/man/man1")))
363 (install-file "man/man1/xapers.1" man1)
364 (install-file "man/man1/xapers-adder.1" man1)
365 ;; below is equivalent to setting --no-term option
366 ;; permanently on; this is desirable to avoid imposing
367 ;; an x-terminal installation on the user but breaks
368 ;; some potential xapers-adder uses like auto browser
369 ;; pdf handler, but user could instead still use
370 ;; e.g. "xterm -e xapers-adder %F" for same use.
371 ;; alternatively we could propagate xterm as an input
372 ;; and replace 'x-terminal-emulator' with 'xterm'
373 (call-with-input-file "bin/xapers-adder"
374 (lambda (input)
375 (call-with-output-file adder-out
376 (lambda (output)
377 (purge-term-support input output)))))
378 (chmod adder-out #o555)))))))
379 (home-page "https://finestructure.net/xapers/")
380 (synopsis "Personal document indexing system")
381 (description
382 "Xapers is a personal document indexing system,
383 geared towards academic journal articles build on the Xapian search engine.
384 Think of it as your own personal document search engine, or a local cache of
385 online libraries. It provides fast search of document text and
386 bibliographic data and simple document and bibtex retrieval.")
387 (license gpl3+)))
388
389 ;;; search.scm ends here