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