projects/guix·blob java-team · refs

358 lines · 13.0 KiB

1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2015 Paul van der Walt <[email protected]>
3;;; Copyright © 2020 Nicolas Goaziou <[email protected]>
4;;; Copyright © 2020 Tobias Geerinckx-Rice <[email protected]>
5;;; Copyright © 2020, 2021, 2025 Guillaume Le Vaillant <[email protected]>
6;;; Copyright © 2022 Maxim Cournoyer <[email protected]>
7;;;
8;;; This file is part of GNU Guix.
9;;;
10;;; GNU Guix is free software; you can redistribute it and/or modify it
11;;; under the terms of the GNU General Public License as published by
12;;; the Free Software Foundation; either version 3 of the License, or (at
13;;; your option) any later version.
14;;;
15;;; GNU Guix is distributed in the hope that it will be useful, but
16;;; WITHOUT ANY WARRANTY; without even the implied warranty of
17;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18;;; GNU General Public License for more details.
19;;;
20;;; You should have received a copy of the GNU General Public License
21;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
22
23(define-module (gnu packages djvu)
24 #:use-module ((guix licenses) #:prefix license:)
25 #:use-module (guix utils)
26 #:use-module (guix packages)
27 #:use-module (guix download)
28 #:use-module (guix gexp)
29 #:use-module (guix git-download)
30 #:use-module (guix build-system gnu)
31 #:use-module (guix build-system pyproject)
32 #:use-module (gnu packages autotools)
33 #:use-module (gnu packages base)
34 #:use-module (gnu packages bash)
35 #:use-module (gnu packages boost)
36 #:use-module (gnu packages check)
37 #:use-module (gnu packages compression)
38 #:use-module (gnu packages gawk)
39 #:use-module (gnu packages gettext)
40 #:use-module (gnu packages ghostscript)
41 #:use-module (gnu packages glib)
42 #:use-module (gnu packages gnome)
43 #:use-module (gnu packages image)
44 #:use-module (gnu packages imagemagick)
45 #:use-module (gnu packages linux)
46 #:use-module (gnu packages ncurses)
47 #:use-module (gnu packages ocr)
48 #:use-module (gnu packages pdf)
49 #:use-module (gnu packages pkg-config)
50 #:use-module (gnu packages python)
51 #:use-module (gnu packages python-build)
52 #:use-module (gnu packages python-check)
53 #:use-module (gnu packages python-graphics)
54 #:use-module (gnu packages python-web)
55 #:use-module (gnu packages python-xyz)
56 #:use-module (gnu packages qt)
57 #:use-module (gnu packages wxwidgets)
58 #:use-module (gnu packages xml)
59 #:use-module (gnu packages xorg))
60
61(define-public djvulibre
62 (package
63 (name "djvulibre")
64 (version "3.5.28")
65 (source
66 (origin
67 (method url-fetch)
68 (uri (string-append "mirror://sourceforge/djvu/DjVuLibre/"
69 (string-replace-substring version "." ",")
70 "/djvulibre-" version ".tar.gz"))
71 (sha256
72 (base32 "0manxn1ly5n8nqamv47hz7akxi6v0rzwc9j1c3x99vngrjlr5qw2"))
73 (modules '((guix build utils)))
74 (snippet
75 '(begin
76 ;; This bundles software (e.g., zlib) and is entirely superfluous.
77 (delete-file-recursively "win32")
78 #t))))
79 (build-system gnu-build-system)
80 (native-inputs
81 ;; The 3.5.28 release tarball isn't bootstrapped.
82 (list autoconf automake libtool))
83 (inputs
84 (list libjpeg-turbo libtiff zlib))
85 (arguments
86 `(#:phases
87 (modify-phases %standard-phases
88 (add-after 'bootstrap 'make-reproducible
89 (lambda _
90 ;; Ensure there are no timestamps in .svgz files.
91 (substitute* "desktopfiles/Makefile.am"
92 (("gzip") "gzip -n"))
93 #t)))))
94 (home-page "https://djvu.sourceforge.net/")
95 (synopsis "Implementation of DjVu, the document format")
96 (description "DjVuLibre is an implementation of DjVu,
97including viewers, browser plugins, decoders, simple encoders, and
98utilities.")
99 (license license:gpl2+)))
100
101(define-public djview
102 (package
103 (name "djview")
104 (version "4.12")
105 (source
106 (origin
107 (method git-fetch)
108 (uri (git-reference
109 (url "https://git.code.sf.net/p/djvu/djview-git")
110 (commit (string-append "release." version))))
111 (sha256
112 (base32 "0mn9ywjbc7iga50lbjclrk892g0x0rap0dmb6ybzjyarybdhhcxp"))
113 (file-name (git-file-name name version))))
114 (build-system gnu-build-system)
115 (native-inputs
116 (list autoconf automake libtool pkg-config qttools-5))
117 (inputs
118 (list djvulibre glib libxt libtiff qtbase-5))
119 (arguments
120 `(#:phases
121 (modify-phases %standard-phases
122 (add-after 'unpack 'fix-desktop-file
123 ;; Executable is "djview", not "djview4".
124 (lambda _
125 (substitute* "desktopfiles/djvulibre-djview4.desktop"
126 (("Exec=djview4 %f") "Exec=djview %f"))
127 #t))
128 (add-after 'unpack 'make-files-writable
129 (lambda _
130 (for-each make-file-writable
131 (find-files "."))
132 #t)))))
133 (home-page "https://djvu.sourceforge.net/djview4.html")
134 (synopsis "Viewer for the DjVu image format")
135 (description "DjView is a standalone viewer for DjVu files.
136
137Its features include navigating documents, zooming and panning page images,
138producing and displaying thumbnails, displaying document outlines, searching
139documents for particular words in the hidden text layer, copying hidden text
140to the clipboard, saving pages and documents as bundled or indirect multi-page
141files, and printing page and documents.
142
143The viewer can simultaneously display several pages using a side-by-side or
144a continuous layout.")
145 (license license:gpl2+)))
146
147(define-public pdf2djvu
148 (package
149 (name "pdf2djvu")
150 (version "0.9.19")
151 (source
152 (origin
153 (method url-fetch)
154 (uri (string-append
155 "https://github.com/jwilk/pdf2djvu/releases/download/" version
156 "/pdf2djvu-" version ".tar.xz"))
157 (sha256
158 (base32 "16ma6z62mqpb9q4cg784m3vqc1jx987g6kg8gyghg50m2f0a8igb"))))
159 (build-system gnu-build-system)
160 (native-inputs (list gettext-minimal pkg-config))
161 (inputs
162 (list djvulibre
163 exiv2
164 graphicsmagick
165 poppler
166 poppler-data
167 `(,util-linux "lib"))) ;for libuuid
168 (arguments
169 `(#:test-target "test"
170 #:tests? #f ;requires Python 2
171 #:phases
172 (modify-phases %standard-phases
173 (add-after 'unpack 'fix-tests
174 (lambda _
175 (substitute* "tests/test-xmp-broken.py"
176 ;; Error message changed in recent versions of XML parser
177 (("XML parsing failure")
178 "Error in XMLValidator"))))
179 (add-before 'check 'set-home-for-tests
180 (lambda _
181 (setenv "HOME" "/tmp"))))))
182 (synopsis "PDF to DjVu converter")
183 (description
184 "@code{pdf2djvu} creates DjVu files from PDF files.
185It is able to extract:
186@itemize
187@item graphics,
188@item text layer,
189@item hyperlinks,
190@item document outline (bookmarks),
191@item metadata (including XMP metadata).
192@end itemize\n")
193 (home-page "https://jwilk.net/software/pdf2djvu")
194 (license license:gpl2)))
195
196(define-public djvu2pdf
197 (package
198 (name "djvu2pdf")
199 (version "0.9.2")
200 (source
201 (origin
202 (method url-fetch)
203 (uri (string-append "https://0x2a.at/site/projects/djvu2pdf/djvu2pdf-"
204 version ".tar.gz"))
205 (sha256
206 (base32 "0v2ax30m7j1yi4m02nzn9rc4sn4vzqh5vywdh96r64j4pwvn5s5g"))))
207 (build-system gnu-build-system)
208 (inputs
209 (list djvulibre
210 gawk
211 ghostscript
212 grep
213 ncurses
214 which))
215 (arguments
216 `(#:tests? #f ; No test suite
217 #:phases
218 (modify-phases %standard-phases
219 (add-after 'unpack 'fix-paths
220 (lambda* (#:key inputs #:allow-other-keys)
221 (let ((djvulibre (assoc-ref inputs "djvulibre"))
222 (gawk (assoc-ref inputs "gawk"))
223 (ghostscript (assoc-ref inputs "ghostscript"))
224 (grep (assoc-ref inputs "grep"))
225 (ncurses (assoc-ref inputs "ncurses"))
226 (which (assoc-ref inputs "which")))
227 (substitute* "djvu2pdf"
228 (("awk")
229 (string-append gawk "/bin/awk"))
230 (("ddjvu")
231 (string-append djvulibre "/bin/ddjvu"))
232 (("djvudump")
233 (string-append djvulibre "/bin/djvudump"))
234 (("grep")
235 (string-append grep "/bin/grep"))
236 (("gs")
237 (string-append ghostscript "/bin/gs"))
238 (("tput ")
239 (string-append ncurses "/bin/tput "))
240 (("which")
241 (string-append which "/bin/which"))))
242 #t))
243 (delete 'configure)
244 (delete 'build)
245 (replace 'install
246 (lambda* (#:key outputs #:allow-other-keys)
247 (let ((out (assoc-ref %outputs "out")))
248 (install-file "djvu2pdf"
249 (string-append out "/bin"))
250 (install-file "djvu2pdf.1.gz"
251 (string-append out "/share/man/man1"))
252 #t))))))
253 (synopsis "DjVu to PDF converter")
254 (description "This is a small tool to convert DjVu files to PDF files.")
255 (home-page "https://0x2a.at/site/projects/djvu2pdf/")
256 (license license:gpl2+)))
257
258(define-public minidjvu
259 (package
260 (name "minidjvu")
261 (version "0.8")
262 (source
263 (origin
264 (method url-fetch)
265 (uri (string-append "mirror://sourceforge/minidjvu/minidjvu/"
266 version "/minidjvu-" version ".tar.gz"))
267 (sha256
268 (base32 "0jmpvy4g68k6xgplj9zsl6brg6vi81mx3nx2x9hfbr1f4zh95j79"))))
269 (build-system gnu-build-system)
270 (native-inputs
271 `(("gettext" ,gettext-minimal)))
272 (inputs
273 (list libjpeg-turbo libtiff zlib))
274 (arguments
275 '(#:configure-flags '("--disable-static")
276 #:parallel-build? #f
277 #:tests? #f ; No test suite
278 #:phases
279 (modify-phases %standard-phases
280 (add-after 'unpack 'fix-paths
281 (lambda _
282 (substitute* "Makefile.in"
283 (("/usr/bin/gzip")
284 "gzip"))
285 #t))
286 (add-before 'install 'make-lib-directory
287 (lambda* (#:key outputs #:allow-other-keys)
288 (mkdir-p (string-append (assoc-ref outputs "out") "/lib"))
289 #t)))))
290 (synopsis "Black and white DjVu encoder")
291 (description
292 "@code{minidjvu} is a multipage DjVu encoder and single page
293encoder/decoder. It doesn't support colors or grayscales, just black
294and white.")
295 (home-page "https://sourceforge.net/projects/minidjvu/")
296 (license license:gpl2)))
297
298(define-public didjvu
299 (package
300 (name "didjvu")
301 (version "0.11.0")
302 (source
303 (origin
304 (method git-fetch)
305 (uri (git-reference
306 ;; It's a fork of https://github.com/jwilk/didjvu, see:
307 ;; <https://github.com/FriedrichFroebel/didjvu/issues/47>.
308 (url "https://github.com/FriedrichFroebel/didjvu")
309 (commit version)))
310 (file-name (git-file-name name version))
311 (sha256
312 (base32 "11z9daa5qfm8cqaxdywfvrnaxid33p7lidj7i8xzv30wyzxdr6zg"))))
313 (build-system pyproject-build-system)
314 (arguments
315 (list
316 #:test-backend #~'unittest
317 #:test-flags
318 #~(list "discover" "--verbose" "--start-directory" "tests/")
319 #:phases
320 #~(modify-phases %standard-phases
321 (add-before 'check 'disable-failing-test
322 (lambda _
323 (substitute* "tests/test_ipc.py"
324 ;; test_path fails to find a file it should have created
325 (("path = os\\.getenv\\('PATH'\\)")
326 "return True"))
327 (substitute* (list "tests/test_ipc.py" "tests/test_cli.py")
328 ;; XXX: See:
329 ;; <https://github.com/FriedrichFroebel/didjvu/issues/48>.
330 (((string-append "(test_action_no_args|test_bad_action|"
331 "test_no_args|test_wait_signal)")
332 all)
333 (string-append "__off_" all)))))
334 (add-after 'wrap 'wrap-path
335 (lambda* (#:key inputs #:allow-other-keys)
336 (wrap-program (string-append #$output "/bin/didjvu")
337 `("PATH" ":" prefix
338 (,(dirname (search-input-file inputs "bin/ddjvu"))))))))))
339 (native-inputs
340 (list boost
341 tzdata-for-tests
342 python-setuptools))
343 (inputs
344 (list bash-minimal
345 djvulibre
346 gexiv2
347 minidjvu
348 python-gamera
349 python-pillow
350 python-py3exiv2
351 python-pygobject
352 python-xmp-toolkit))
353 (synopsis "DjVu encoder with foreground/background separation")
354 (description
355 "@code{didjvu} uses the @code{Gamera} framework to separate the foreground
356and background layers of images, which can then be encoded into a DjVu file.")
357 (home-page "https://jwilk.net/software/didjvu")
358 (license license:gpl2)))