212.1. djvulibre-3.5.30
DjVu document library and command-line tools — ddjvu, djvused, c44, cjb2
| Version | 3.5.30, release 1 |
| Shelf | documents — PDF, PostScript, DjVu, EPUB, CHM and DOCX viewers, libraries and tools, and ebook managers |
| Phase | 42_graphics (Graphics Stack), 81 of 189 in build order |
| Licence | GPL-2.0-or-later |
| Homepage | https://djvu.sourceforge.net/ |
| Build time | 1.4 SBU |
| Installed size | 4.2 MiB in 76 files |
| Recipe | ports/core/documents/djvulibre/kpkgbuild |
About
DjVuLibre is the reference implementation of DjVu, a document format for scanned pages that stores text, line art and photographs as separately compressed layers. The port installs libdjvulibre, which Okular, ImageMagick, kio-extras and gImageReader link to read DjVu files, and the command-line tools: ddjvu renders pages to images, djvused edits a document’s structure, text and annotations, and c44 and cjb2 encode photographs and bilevel scans.
Sources
djvulibre-3.5.30.tar.gz(3.5 MiB)
sha256ee5e457d4cfebe566f94b99e5e3d3cc7f5c79ddb741c2ac2ba2e456f00329644
upstream: https://downloads.sourceforge.net/djvu/djvulibre-3.5.30.tar.gz
archive copy: sources-1/documents--djvulibre-3.5.30.tar.gz
Dependencies
Depends on: libjpeg-turbo, libtiff, librsvg.
Required by (4): gimagereader, imagemagick, kio-extras, okular.
Patches
build.sh applies these; kpkg applies nothing by itself.
djvuport-stack-overflow.patch— MakesDjVuPortcaster::id_to_file()remember the id it is opening and throw “recursive opening of the same file (corrupted file?)” when it is asked for the same id again before it returns. A corrupted multi-page document whose component refers to itself otherwise recurses until the stack overflows and the program crashes.
Installation
From the repository root, inside the build container, this is the line kdosbuild runs for the port:
script/chroot/exec.sh bash -c 'source script/phases/42_graphics/phase.env && kpkg install djvulibre'
What kpkg does
kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/documents/djvulibre.
1. Verify every declared source. Each file a sha256 = line names, found in the port directory or in /var/cache/kpkg/sources, must hash to its line; a mismatch stops the build before anything is unpacked.
cd /ports/core/documents/djvulibre
echo 'ee5e457d4cfebe566f94b99e5e3d3cc7f5c79ddb741c2ac2ba2e456f00329644 djvulibre-3.5.30.tar.gz' | sha256sum -c -
2. Unpack. The work directory is emptied and the first source is unpacked into $SRC with its top directory stripped; any later tarball lands unstripped beside it in $SRC_ROOT, and a file that is not a tarball is copied into $SRC.
SRC_ROOT=/var/cache/kpkg/work/djvulibre
SRC=$SRC_ROOT/djvulibre-3.5.30
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf djvulibre-3.5.30.tar.gz -C "$SRC" --strip-components=1
Every config.guess and config.sub older than automake’s is then replaced with automake’s, so a configure script recognises the musl target.
3. Build. build.sh is sourced in a subshell under set -e, from $SRC, with name, version, release and the five paths PKGNAME, PORT_SRC, SRC_ROOT, SRC and PKG set as shell variables. Its body, verbatim:
patch -p1 -i "$PORT_SRC/djvuport-stack-overflow.patch"
./configure --prefix=/usr --sysconfdir=/etc --libdir=/usr/lib \
--disable-static \
--with-jpeg \
--with-tiff \
--enable-xmltools \
--enable-desktopfiles
make
make DESTDIR=$PKG install
The switches, and why each is set:
--with-jpeg,--with-tiff— Link libjpeg-turbo and libtiff. Both are link probes, on by default, that build without the library when the probe fails, and say so only in the configure summary: without JPEG, the library cannot decode a layer stored as JPEG andc44cannot read a JPEG file; without TIFF,ddjvucannot write TIFF andcjb2cannot read it. Both libraries are independs.--enable-xmltools— Builddjvutoxmlanddjvuxmlparser, which export a document’s text and annotations as XML and apply them back. It is upstream’s default, stated.--enable-desktopfiles— Install the DjVu MIME type definition and its icons. It is upstream’s default, stated. When configure findsrsvg-convertthe icons are rasterised fromdjvu.svg; otherwise the prebuilt PNGs in the tarball are installed. librsvg is independsfor it.
The common switches of each build system are explained in the Flag glossary.
4. Package. kpkg removes libtool archives, the info directory index, mimeinfo.cache and every fonts.dir from $PKG, copies the source’s licence files into /usr/share/licenses/djvulibre, prunes what the image does not ship, lints the tree and rolls it reproducibly:
tar --sort=name --format=gnu --numeric-owner --owner=0 --group=0 \
--mtime=@$SOURCE_DATE_EPOCH \
--use-compress-program='xz -9 -T0 --block-size=32MiB --no-adjust' \
-cf djvulibre-3.5.30-1.tar.xz -C "$PKG" .
5. Adopt. kpkgadd installs the package’s files over the root, refusing a path another package owns, records the file list in /var/lib/kpkg/db/djvulibre, and runs the triggers its paths call for.
Contents
Installed programs: any2djvu, bzz, c44, cjb2, cpaldjvu, csepdjvu, ddjvu, djvm, djvmcvt, djvudigital, djvudump, djvuextract, djvumake, djvups, djvused, djvuserve, djvutoxml, djvutxt, djvuxmlparser.
Installed libraries: libdjvulibre.so.
Installed directories: /usr/include/libdjvu, /usr/share/djvu, /usr/share/icons/hicolor/20x20, /usr/share/licenses/djvulibre.
Short descriptions
any2djvu |
Convert .ps/.ps.gz/.pdf to .djvu |
bzz |
DjVu general purpose compression utility. |
c44 |
DjVuPhoto encode. |
cjb2 |
Simple DjVuBitonal encoder. |
cpaldjvu |
DjVuDocument encoder for low-color images. |
csepdjvu |
DjVu encoder for separated data files. |
ddjvu |
Command line DjVu decoder. |
djvm |
Manipulate bundled multi-page DjVu documents. |
djvmcvt |
Convert multi-page DjVu documents. |
djvudigital |
creates DjVu files from PS or PDF files. |
djvudump |
Display internal structure of DjVu files. |
djvuextract |
Extract chunks from DjVu image files. |
djvumake |
Assemble DjVu image files. |
djvups |
Convert DjVu documents to PostScript. |
djvused |
Multi-purpose DjVu document editor. |
djvuserve |
Generate indirect DjVu documents on the fly. |
djvutxt |
Extract the hidden text from DjVu documents. |
ddjvuapi.pc |
DjVu Decoding API |