334.2. gimagereader-3.4.3
OCR front end for Tesseract — scan or open images and PDFs, recognise and edit text
| Version | 3.4.3, release 1 |
| Shelf | printing — Printing, printer drivers, labels, scanning and OCR |
| Phase | 44_apps (Applications), 344 of 422 in build order |
| Licence | GPL-3.0-or-later |
| Homepage | https://github.com/manisandro/gImageReader |
| Build time | 1.2 SBU |
| Installed size | 2.4 MiB in 8 files |
| Recipe | ports/core/printing/gimagereader/kpkgbuild |
About
gImageReader is a graphical front end for the tesseract OCR engine: it scans a page through SANE or opens an image, a PDF or a DjVu file, recognises the text, and lets it be corrected and spell-checked as plain text or as an hOCR document, from which it can generate a PDF. This build is its Qt 6 interface, gimagereader-qt6. PDF input comes through poppler, DjVu input through the ddjvuapi of djvulibre, and PDF output through podofo.
Sources
gimagereader-3.4.3.tar.xz(675.0 KiB)
sha2564604b53e8d952c68ce4198d7b8d864327ef6afaf597e7909f6b31f0eb9b4c425
upstream: https://github.com/manisandro/gImageReader/releases/download/v3.4.3/gimagereader-3.4.3.tar.xz
archive copy: sources-3/printing--gimagereader-3.4.3.tar.xz
Dependencies
Depends on: cmake, ninja, gettext, intltool, pkgconf, qt6-qtbase, qt6-qttools, qt6-qtwayland, qtspell, enchant, poppler, quazip, djvulibre, podofo, tesseract, leptonica, sane-backends.
Required by: no port names it.
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/44_apps/phase.env && kpkg install gimagereader'
What kpkg does
kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/printing/gimagereader.
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/printing/gimagereader
echo '4604b53e8d952c68ce4198d7b8d864327ef6afaf597e7909f6b31f0eb9b4c425 gimagereader-3.4.3.tar.xz' | 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/gimagereader
SRC=$SRC_ROOT/gimagereader-3.4.3
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf gimagereader-3.4.3.tar.xz -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:
cmake -S . -B build -G Ninja \
-D CMAKE_POLICY_VERSION_MINIMUM=3.5 \
-D CMAKE_BUILD_TYPE=Release \
-D CMAKE_INSTALL_PREFIX=/usr \
-D INTERFACE_TYPE=qt6 \
-D ENABLE_VERSIONCHECK=0 \
-D CMAKE_REQUIRE_FIND_PACKAGE_QuaZip-Qt6=ON \
-Wno-dev
for m in PODOFO SANE TESSERACT; do
grep -q "^${m}_FOUND:INTERNAL=1" build/CMakeCache.txt || {
echo "gimagereader: pkg-config found no $m" >&2
exit 1
}
done
cmake --build build
DESTDIR=$PKG cmake --install build
rm -f "$PKG"/usr/share/doc/gimagereader/manual-*.html
cat > "$PKG/usr/share/applications/gimagereader-qt6.desktop" <<'DESKTOP'
[Desktop Entry]
Type=Application
Name=gImageReader
GenericName=OCR Application
Comment=Recognise text in scans, images and PDFs
Exec=gimagereader-qt6 %F
Icon=gimagereader
Terminal=false
StartupNotify=true
StartupWMClass=gimagereader-qt6
Categories=Qt;Graphics;OCR;Scanning;
Keywords=ocr;optical character recognition;scan;scanner;tesseract;text;
DESKTOP
chmod 644 "$PKG/usr/share/applications/gimagereader-qt6.desktop"
The switches, and why each is set:
-D INTERFACE_TYPE=qt6— Build the Qt 6 interface rather than the Qt 5 or GTK one. It is upstream’s default, written out.-D ENABLE_VERSIONCHECK=0— No check at startup that asks the project’s server for a newer release.-D CMAKE_REQUIRE_FIND_PACKAGE_QuaZip-Qt6=ON— Require quazip’s Qt 6 CMake package. Upstream looks it up quietly and falls back to a QuaZip 5 package or to a bare header search.
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/gimagereader, 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 gimagereader-3.4.3-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/gimagereader, and runs the triggers its paths call for.
Contents
Installed programs: gimagereader-qt6.
Installed directories: /usr/share/doc/gimagereader, /usr/share/licenses/gimagereader.
Notes
Tesseract, PoDoFo and SANE are found by pkg_check_modules without REQUIRED, so a module pkg-config cannot find does not stop the configuration; for Tesseract and PoDoFo upstream then guesses an include directory and a -l flag. build.sh reads CMakeCache.txt after the configuration and stops the build unless pkg-config found all three.
build.sh removes the translated manuals, manual-*.html, from the package; the English manual stays.
build.sh replaces upstream’s desktop entry to drop its MimeType line, which claims images, PDF and HTML that the image viewers and the browser open. The Wayland app id is the executable’s name, gimagereader-qt6, which the entry names in StartupWMClass.