| 1 | |
| 2 | |
| 3 | |
| 4 | |
| 5 | |
| 6 | |
| 7 | |
| 8 | |
| 9 | |
| 10 | |
| 11 | |
| 12 | |
| 13 | |
| 14 | |
| 15 | |
| 16 | |
| 17 | |
| 18 | |
| 19 | |
| 20 | |
| 21 | |
| 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 | |
| 77 | (delete-file-recursively "win32")
|
| 78 | #t))))
|
| 79 | (build-system gnu-build-system)
|
| 80 | (native-inputs
|
| 81 | |
| 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 | |
| 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,
|
| 97 | including viewers, browser plugins, decoders, simple encoders, and
|
| 98 | utilities.")
|
| 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 | |
| 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 |
|
| 137 | Its features include navigating documents, zooming and panning page images,
|
| 138 | producing and displaying thumbnails, displaying document outlines, searching
|
| 139 | documents for particular words in the hidden text layer, copying hidden text
|
| 140 | to the clipboard, saving pages and documents as bundled or indirect multi-page
|
| 141 | files, and printing page and documents.
|
| 142 |
|
| 143 | The viewer can simultaneously display several pages using a side-by-side or
|
| 144 | a 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"))) |
| 168 | (arguments
|
| 169 | `(#:test-target "test"
|
| 170 | #:tests? #f |
| 171 | #:phases
|
| 172 | (modify-phases %standard-phases
|
| 173 | (add-after 'unpack 'fix-tests
|
| 174 | (lambda _
|
| 175 | (substitute* "tests/test-xmp-broken.py"
|
| 176 | |
| 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.
|
| 185 | It 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 |
| 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 |
| 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
|
| 293 | encoder/decoder. It doesn't support colors or grayscales, just black
|
| 294 | and 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 | |
| 307 | |
| 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 | |
| 325 | (("path = os\\.getenv\\('PATH'\\)")
|
| 326 | "return True"))
|
| 327 | (substitute* (list "tests/test_ipc.py" "tests/test_cli.py")
|
| 328 | |
| 329 | |
| 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
|
| 356 | and 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)))
|