gnu: cvs-fast-export: Update to 1.56.
[jackhill/guix/guix.git] / gnu / packages / djvu.scm
CommitLineData
1a8bf1dc
PW
1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2015 Paul van der Walt <paul@denknerd.org>
794ebb6b 3;;; Copyright © 2020 Nicolas Goaziou <mail@nicolasgoaziou.fr>
e6c2a88f 4;;; Copyright © 2020 Tobias Geerinckx-Rice <me@tobias.gr>
f6a42ac9 5;;; Copyright © 2020 Guillaume Le Vaillant <glv@posteo.net>
1a8bf1dc
PW
6;;;
7;;; This file is part of GNU Guix.
8;;;
9;;; GNU Guix is free software; you can redistribute it and/or modify it
10;;; under the terms of the GNU General Public License as published by
11;;; the Free Software Foundation; either version 3 of the License, or (at
12;;; your option) any later version.
13;;;
14;;; GNU Guix is distributed in the hope that it will be useful, but
15;;; WITHOUT ANY WARRANTY; without even the implied warranty of
16;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17;;; GNU General Public License for more details.
18;;;
19;;; You should have received a copy of the GNU General Public License
20;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
21
22(define-module (gnu packages djvu)
23 #:use-module ((guix licenses) #:prefix license:)
794ebb6b 24 #:use-module (guix utils)
1a8bf1dc
PW
25 #:use-module (guix packages)
26 #:use-module (guix download)
e6c2a88f 27 #:use-module (guix git-download)
794ebb6b 28 #:use-module (guix build-system gnu)
f14c6af5 29 #:use-module (guix build-system python)
e6c2a88f 30 #:use-module (gnu packages autotools)
42c8c30f 31 #:use-module (gnu packages base)
f6a42ac9 32 #:use-module (gnu packages check)
b7c392a6 33 #:use-module (gnu packages compression)
42c8c30f 34 #:use-module (gnu packages gawk)
f6a42ac9 35 #:use-module (gnu packages gettext)
42c8c30f 36 #:use-module (gnu packages ghostscript)
794ebb6b
NG
37 #:use-module (gnu packages glib)
38 #:use-module (gnu packages image)
f6a42ac9
GLV
39 #:use-module (gnu packages imagemagick)
40 #:use-module (gnu packages linux)
42c8c30f 41 #:use-module (gnu packages ncurses)
7c2e6740 42 #:use-module (gnu packages ocr)
f6a42ac9 43 #:use-module (gnu packages pdf)
794ebb6b 44 #:use-module (gnu packages pkg-config)
f6a42ac9 45 #:use-module (gnu packages python)
7c2e6740 46 #:use-module (gnu packages python-web)
f14c6af5 47 #:use-module (gnu packages python-xyz)
794ebb6b 48 #:use-module (gnu packages qt)
f14c6af5 49 #:use-module (gnu packages wxwidgets)
7c2e6740 50 #:use-module (gnu packages xml)
794ebb6b 51 #:use-module (gnu packages xorg))
1a8bf1dc
PW
52
53(define-public djvulibre
54 (package
55 (name "djvulibre")
2aa8e847
TGR
56 (version "3.5.28")
57 (source
58 (origin
59 (method url-fetch)
60 (uri (string-append "mirror://sourceforge/djvu/DjVuLibre/"
61 (string-replace-substring version "." ",")
62 "/djvulibre-" version ".tar.gz"))
63 (sha256
f404fc1b
TGR
64 (base32 "0manxn1ly5n8nqamv47hz7akxi6v0rzwc9j1c3x99vngrjlr5qw2"))
65 (modules '((guix build utils)))
66 (snippet
67 '(begin
68 ;; This bundles software (e.g., zlib) and is entirely superfluous.
69 (delete-file-recursively "win32")
70 #t))))
1a8bf1dc 71 (build-system gnu-build-system)
2aa8e847
TGR
72 (native-inputs
73 ;; The 3.5.28 release tarball isn't bootstrapped.
74 `(("autoconf" ,autoconf)
75 ("automake" ,automake)
76 ("libtool" ,libtool)))
e75d121c
GLV
77 (inputs
78 `(("libjpeg-turbo" ,libjpeg-turbo)
2aa8e847
TGR
79 ("libtiff" ,libtiff)
80 ("zlib" ,zlib)))
5fe2a139 81 (arguments
2aa8e847
TGR
82 `(#:phases
83 (modify-phases %standard-phases
84 (add-after 'bootstrap 'make-reproducible
85 (lambda _
86 ;; Ensure there are no timestamps in .svgz files.
87 (substitute* "desktopfiles/Makefile.am"
88 (("gzip") "gzip -n"))
89 #t)))))
1a8bf1dc
PW
90 (home-page "http://djvu.sourceforge.net/")
91 (synopsis "Implementation of DjVu, the document format")
92 (description "DjVuLibre is an implementation of DjVu,
93including viewers, browser plugins, decoders, simple encoders, and
94utilities.")
95 (license license:gpl2+)))
794ebb6b
NG
96
97(define-public djview
98 (package
99 (name "djview")
8cc6cd34 100 (version "4.12")
794ebb6b
NG
101 (source
102 (origin
e6c2a88f
TGR
103 (method git-fetch)
104 (uri (git-reference
105 (url "https://git.code.sf.net/p/djvu/djview-git")
106 (commit (string-append "release." version))))
794ebb6b 107 (sha256
8cc6cd34 108 (base32 "0mn9ywjbc7iga50lbjclrk892g0x0rap0dmb6ybzjyarybdhhcxp"))
e6c2a88f 109 (file-name (git-file-name name version))))
794ebb6b
NG
110 (build-system gnu-build-system)
111 (native-inputs
e6c2a88f
TGR
112 `(("autoconf" ,autoconf)
113 ("automake" ,automake)
114 ("libtool" ,libtool)
115 ("pkg-config" ,pkg-config)
794ebb6b
NG
116 ("qttools" ,qttools)))
117 (inputs
f8c2d324
NG
118 `(("djvulibre" ,djvulibre)
119 ("glib" ,glib)
794ebb6b
NG
120 ("libxt" ,libxt)
121 ("libtiff" ,libtiff)
f8c2d324
NG
122 ("qtbase" ,qtbase)))
123 (arguments
124 `(#:phases
125 (modify-phases %standard-phases
126 (add-after 'unpack 'fix-desktop-file
127 ;; Executable is "djview", not "djview4".
128 (lambda _
129 (substitute* "desktopfiles/djvulibre-djview4.desktop"
130 (("Exec=djview4 %f") "Exec=djview %f"))
e6c2a88f
TGR
131 #t))
132 (add-after 'unpack 'make-files-writable
133 (lambda _
134 (for-each make-file-writable
135 (find-files "."))
f8c2d324 136 #t)))))
0d79e82a 137 (home-page "http://djvu.sourceforge.net/djview4.html")
794ebb6b
NG
138 (synopsis "Viewer for the DjVu image format")
139 (description "DjView is a standalone viewer for DjVu files.
140
141Its features include navigating documents, zooming and panning page images,
142producing and displaying thumbnails, displaying document outlines, searching
143documents for particular words in the hidden text layer, copying hidden text
144to the clipboard, saving pages and documents as bundled or indirect multi-page
145files, and printing page and documents.
146
147The viewer can simultaneously display several pages using a side-by-side or
148a continuous layout.")
149 (license license:gpl2+)))
f6a42ac9
GLV
150
151(define-public pdf2djvu
152 (package
153 (name "pdf2djvu")
154 (version "0.9.17.1")
155 (source
156 (origin
157 (method url-fetch)
158 (uri (string-append
159 "https://github.com/jwilk/pdf2djvu/releases/download/" version
160 "/pdf2djvu-" version ".tar.xz"))
161 (sha256
162 (base32 "18r648kna6ccw0m0nfxxnsmz541k69d0w9zzqvm1x2l5qyyvgfsv"))))
163 (build-system gnu-build-system)
164 (native-inputs
165 `(("gettext" ,gettext-minimal)
166 ("pkg-config" ,pkg-config)
167 ("python2" ,python-2)
168 ("python2-nose" ,python2-nose)))
169 (inputs
170 `(("djvulibre" ,djvulibre)
171 ("exiv2" ,exiv2)
172 ("graphicsmagick" ,graphicsmagick)
173 ("poppler" ,poppler)
174 ("poppler-data" ,poppler-data)
175 ("util-linux-lib" ,util-linux "lib"))) ; for libuuid
176 (arguments
177 `(#:test-target "test"))
178 (synopsis "PDF to DjVu converter")
179 (description
180 "@code{pdf2djvu} creates DjVu files from PDF files.
181It is able to extract:
182@itemize
183@item graphics,
184@item text layer,
185@item hyperlinks,
186@item document outline (bookmarks),
187@item metadata (including XMP metadata).
188@end itemize\n")
189 (home-page "https://jwilk.net/software/pdf2djvu")
190 (license license:gpl2)))
42c8c30f
GLV
191
192(define-public djvu2pdf
193 (package
194 (name "djvu2pdf")
195 (version "0.9.2")
196 (source
197 (origin
198 (method url-fetch)
199 (uri (string-append "https://0x2a.at/site/projects/djvu2pdf/djvu2pdf-"
200 version ".tar.gz"))
201 (sha256
202 (base32 "0v2ax30m7j1yi4m02nzn9rc4sn4vzqh5vywdh96r64j4pwvn5s5g"))))
203 (build-system gnu-build-system)
204 (inputs
205 `(("djvulibre" ,djvulibre)
206 ("gawk" ,gawk)
207 ("ghostscript" ,ghostscript)
208 ("grep" ,grep)
209 ("ncurses" ,ncurses)
210 ("which" ,which)))
211 (arguments
212 `(#:tests? #f ; No test suite
213 #:phases
214 (modify-phases %standard-phases
215 (add-after 'unpack 'fix-paths
216 (lambda* (#:key inputs #:allow-other-keys)
217 (let ((djvulibre (assoc-ref inputs "djvulibre"))
218 (gawk (assoc-ref inputs "gawk"))
219 (ghostscript (assoc-ref inputs "ghostscript"))
220 (grep (assoc-ref inputs "grep"))
221 (ncurses (assoc-ref inputs "ncurses"))
222 (which (assoc-ref inputs "which")))
223 (substitute* "djvu2pdf"
224 (("awk")
225 (string-append gawk "/bin/awk"))
226 (("ddjvu")
227 (string-append djvulibre "/bin/ddjvu"))
228 (("djvudump")
229 (string-append djvulibre "/bin/djvudump"))
230 (("grep")
231 (string-append grep "/bin/grep"))
232 (("gs")
233 (string-append ghostscript "/bin/gs"))
234 (("tput ")
235 (string-append ncurses "/bin/tput "))
236 (("which")
237 (string-append which "/bin/which"))))
238 #t))
239 (delete 'configure)
240 (delete 'build)
241 (replace 'install
242 (lambda* (#:key outputs #:allow-other-keys)
243 (let ((out (assoc-ref %outputs "out")))
244 (install-file "djvu2pdf"
245 (string-append out "/bin"))
246 (install-file "djvu2pdf.1.gz"
247 (string-append out "/share/man/man1"))
248 #t))))))
249 (synopsis "DjVu to PDF converter")
250 (description "This is a small tool to convert DjVu files to PDF files.")
251 (home-page "https://0x2a.at/site/projects/djvu2pdf/")
252 (license license:gpl2+)))
b7c392a6
GLV
253
254(define-public minidjvu
255 (package
256 (name "minidjvu")
257 (version "0.8")
258 (source
259 (origin
260 (method url-fetch)
261 (uri (string-append "mirror://sourceforge/minidjvu/minidjvu/"
262 version "/minidjvu-" version ".tar.gz"))
263 (sha256
264 (base32 "0jmpvy4g68k6xgplj9zsl6brg6vi81mx3nx2x9hfbr1f4zh95j79"))))
265 (build-system gnu-build-system)
266 (native-inputs
267 `(("gettext" ,gettext-minimal)))
268 (inputs
269 `(("libjpeg-turbo" ,libjpeg-turbo)
270 ("libtiff" ,libtiff)
271 ("zlib" ,zlib)))
272 (arguments
273 '(#:configure-flags '("--disable-static")
274 #:parallel-build? #f
275 #:tests? #f ; No test suite
276 #:phases
277 (modify-phases %standard-phases
278 (add-after 'unpack 'fix-paths
279 (lambda _
280 (substitute* "Makefile.in"
281 (("/usr/bin/gzip")
282 "gzip"))
283 #t))
284 (add-before 'install 'make-lib-directory
285 (lambda* (#:key outputs #:allow-other-keys)
286 (mkdir-p (string-append (assoc-ref outputs "out") "/lib"))
287 #t)))))
288 (synopsis "Black and white DjVu encoder")
289 (description
290 "@code{minidjvu} is a multipage DjVu encoder and single page
291encoder/decoder. It doesn't support colors or grayscales, just black
292and white.")
293 (home-page "https://sourceforge.net/projects/minidjvu/")
294 (license license:gpl2)))
f14c6af5
GLV
295
296(define-public djvusmooth
297 (package
298 (name "djvusmooth")
299 (version "0.3")
300 (source
301 (origin
302 (method url-fetch)
303 (uri (string-append
304 "https://github.com/jwilk/djvusmooth/releases/download/" version
305 "/djvusmooth-" version ".tar.gz"))
306 (sha256
307 (base32 "0z403cklvxzz0qaczgv83ax0nknrd9h8micp04j9kjfdxk2sgval"))))
308 (build-system python-build-system)
309 (inputs
310 `(("djvulibre" ,djvulibre)
311 ("python2-djvulibre" ,python2-djvulibre)
312 ("python2-subprocess32" ,python2-subprocess32)
313 ("python2-wxpython" ,python2-wxpython)))
314 (arguments
446ec88a
GLV
315 `(#:python ,python-2
316 #:phases
317 (modify-phases %standard-phases
318 (add-after 'unpack 'fix-paths
319 (lambda* (#:key inputs #:allow-other-keys)
320 (substitute* "lib/djvused.py"
321 (("djvused_path = 'djvused'")
322 (string-append "djvused_path = '"
323 (assoc-ref inputs "djvulibre")
324 "/bin/djvused'"))))))))
f14c6af5
GLV
325 (synopsis "Graphical editor for DjVu documents")
326 (description
327 "@code{djvusmooth} is a graphical editor for DjVu_ documents.
328It is able to:
329@itemize
330@item edit document metadata,
331@item edit document outline (bookmarks),
332@item add, remove or edit hyperlinks,
333@item correct occasional errors in the hidden text layer.
334@end itemize\n")
335 (home-page "https://jwilk.net/software/djvusmooth")
336 (license license:gpl2)))
e7fb2c6e
GLV
337
338(define-public didjvu
339 (package
340 (name "didjvu")
341 (version "0.9")
342 (source
343 (origin
344 (method url-fetch)
345 (uri (string-append
346 "https://github.com/jwilk/didjvu/releases/download/" version
347 "/didjvu-" version ".tar.gz"))
348 (sha256
349 (base32 "0xyrnk8d2khi7q1zr28gjkjq6frz4mkb5jdl8821yzf12k7c8pbv"))))
350 (build-system gnu-build-system)
351 (native-inputs
352 `(("python2-nose" ,python2-nose)))
353 (inputs
354 `(("djvulibre" ,djvulibre)
355 ("minidjvu" ,minidjvu)
356 ("python" ,python-2)
357 ("python2-gamera" ,python2-gamera)
358 ("python2-pillow" ,python2-pillow)))
359 (arguments
360 `(#:modules ((guix build gnu-build-system)
361 ((guix build python-build-system) #:prefix python:)
362 (guix build utils))
363 #:imported-modules (,@%gnu-build-system-modules
364 (guix build python-build-system))
365 #:test-target "test"
366 #:phases
367 (modify-phases %standard-phases
368 (delete 'configure)
369 (add-before 'check 'disable-failing-test
370 (lambda _
371 (substitute* "tests/test_ipc.py"
372 ;; test_wait_signal gets stuck forever
373 (("yield self\\._test_signal, name")
374 "return True")
375 ;; test_path fails to find a file it should have created
376 (("path = os\\.getenv\\('PATH'\\)\\.split\\(':'\\)")
377 "return True"))
378 (substitute* "tests/test_timestamp.py"
379 ;; test_timezones fails with:
380 ;; '2009-12-18T21:25:14Z' != '2009-12-18T22:25:14+01:00'
381 (("@fork_isolation")
382 "return True"))))
383 (replace 'install
384 (lambda* (#:key outputs #:allow-other-keys)
385 (let ((out (assoc-ref outputs "out")))
386 (invoke "make"
387 "DESTDIR="
388 (string-append "PREFIX=" out)
389 "install"))))
390 (add-after 'install 'wrap-python
391 (assoc-ref python:%standard-phases 'wrap))
392 (add-after 'wrap-python 'wrap-path
393 (lambda* (#:key inputs outputs #:allow-other-keys)
394 (let ((out (assoc-ref outputs "out"))
395 (djvulibre (assoc-ref inputs "djvulibre")))
396 (wrap-program (string-append out "/bin/didjvu")
397 `("PATH" ":" prefix (,(string-append djvulibre "/bin"))))))))))
398 (synopsis "DjVu encoder with foreground/background separation")
399 (description
400 "@code{didjvu} uses the @code{Gamera} framework to separate the foreground
401and background layers of images, which can then be encoded into a DjVu file.")
402 (home-page "https://jwilk.net/software/didjvu")
403 (license license:gpl2)))
7c2e6740
GLV
404
405(define-public ocrodjvu
406 (package
407 (name "ocrodjvu")
408 (version "0.12")
409 (source
410 (origin
411 (method url-fetch)
412 (uri (string-append
413 "https://github.com/jwilk/ocrodjvu/releases/download/" version
414 "/ocrodjvu-" version ".tar.xz"))
415 (sha256
416 (base32 "09w9rqr7z2jd5kwp178zz2yrsc82mxs7gksipg92znxzgzhmw2ng"))))
417 (build-system gnu-build-system)
418 (native-inputs
419 `(("libxml2" ,libxml2)
420 ("python2-nose" ,python2-nose)
421 ("python2-pillow" ,python2-pillow)))
422 (inputs
423 `(("djvulibre" ,djvulibre)
424 ("ocrad" ,ocrad)
425 ("python" ,python-2)
426 ("python2-djvulibre" ,python2-djvulibre)
427 ("python2-html5lib" ,python2-html5lib)
428 ("python2-lxml" ,python2-lxml)
429 ("python2-pyicu" ,python2-pyicu)
430 ("python2-subprocess32" ,python2-subprocess32)
431 ("tesseract-ocr" ,tesseract-ocr)))
432 (arguments
433 `(#:modules ((guix build gnu-build-system)
434 ((guix build python-build-system) #:prefix python:)
435 (guix build utils))
436 #:imported-modules (,@%gnu-build-system-modules
437 (guix build python-build-system))
438 #:test-target "test"
439 #:phases
440 (modify-phases %standard-phases
441 (delete 'configure)
442 (add-before 'check 'disable-failing-test
443 (lambda _
444 (substitute* "tests/test_ipc.py"
445 ;; test_wait_signal gets stuck forever
446 (("yield self\\._test_signal, name")
447 "return True")
448 ;; test_path fails to find a file it should have created
449 (("path = os\\.getenv\\('PATH'\\)\\.split\\(':'\\)")
450 "return True"))
451 ;; Disable tests with tesseract. They can't work without
452 ;; the language files that must downloaded by the final user
453 ;; as they are not packaged in Guix.
454 (substitute* "tests/ocrodjvu/test.py"
455 (("engines = stdout\\.getvalue\\(\\)\\.splitlines\\(\\)")
456 "engines = ['ocrad']"))
457 (substitute* "tests/ocrodjvu/test_integration.py"
458 (("engines = 'tesseract', 'cuneiform', 'gocr', 'ocrad'")
459 "engines = 'ocrad'"))))
460 (replace 'install
461 (lambda* (#:key outputs #:allow-other-keys)
462 (let ((out (assoc-ref outputs "out")))
463 (invoke "make"
464 "DESTDIR="
465 (string-append "PREFIX=" out)
466 "install"))))
467 (add-after 'install 'wrap-python
468 (assoc-ref python:%standard-phases 'wrap))
469 (add-after 'wrap-python 'wrap-path
470 (lambda* (#:key inputs outputs #:allow-other-keys)
471 (let ((out (assoc-ref outputs "out"))
472 (djvulibre (assoc-ref inputs "djvulibre"))
473 (ocrad (assoc-ref inputs "ocrad"))
474 (tesseract (assoc-ref inputs "tesseract-ocr")))
475 (for-each (lambda (file)
476 (wrap-program (string-append out "/bin/" file)
477 `("PATH" ":" prefix
478 (,(string-append djvulibre "/bin:"
479 ocrad "/bin:"
480 tesseract "/bin")))))
481 '("djvu2hocr"
482 "hocr2djvused"
483 "ocrodjvu"))))))))
484 (synopsis "Program to perform OCR on DjVu files")
485 (description
486 "@code{ocrodjvu} is a wrapper for OCR systems, that allows you to perform
487OCR on DjVu files.")
488 (home-page "https://jwilk.net/software/ocrodjvu")
489 (license license:gpl2)))