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