332.1. pdf4qt-1.6.0.0
PDF viewer and editor — annotate, redact, sign, compare, split and merge pages
| Version | 1.6.0.0, release 2 |
| Shelf | documents — PDF, PostScript, DjVu, EPUB, CHM and DOCX viewers, libraries and tools, and ebook managers |
| Phase | 44_apps (Applications), 65 of 422 in build order |
| Licence | MIT |
| Homepage | https://jakubmelka.github.io/ |
| Build time | 35.9 SBU |
| Installed size | 22.6 MiB in 158 files |
| Recipe | ports/core/documents/pdf4qt/kpkgbuild |
About
PDF4QT is a PDF suite on Qt 6 with its own rendering library: a viewer, an editor that annotates, redacts, fills forms and signs, PageMaster for merging, splitting and reordering pages, and Diff for comparing two documents. Each is its own program (Pdf4QtViewer, Pdf4QtEditor, Pdf4QtPageMaster, Pdf4QtDiff), with Pdf4QtLaunchPad to choose between them. It requires blend2d, a 2D vector rasteriser, and onetbb at configure time, and reads text aloud through Qt Speech.
Sources
pdf4qt-1.6.0.0.tar.gz(7.5 MiB)
sha256a5f9952723acbb8a2431207cf76e53a17941292fbd003a2ed1b79503677ab2ec
upstream: https://github.com/JakubMelka/PDF4QT/archive/refs/tags/v1.6.0.0.tar.gz
archive copy: sources-1/documents--pdf4qt-1.6.0.0.tar.gz
Dependencies
Depends on: cmake, ninja, qt6-qtbase, qt6-qtsvg, qt6-qtspeech, qt6-qttools, qt6-qtwayland, openssl, zlib, freetype2, openjpeg, libjpeg-turbo, libpng, lcms2, blend2d, onetbb, sane-backends.
Required by: no port names it.
Patches
build.sh applies these; kpkg applies nothing by itself.
openssl4.patch— ports the certificate and signature code inPdf4QtLibCoreto OpenSSL 4. Pointers toX509_NAME,X509_NAME_ENTRY,ASN1_STRING,ASN1_TYPEandX509_PUBKEYthat OpenSSL 4’s accessors return asconstare declaredconst; anASN1_STRING’s bytes and length are read throughASN1_STRING_get0_data()andASN1_STRING_length()instead of itsdataandlengthfields; and a new self-signed certificate builds its name in a freshX509_NAMEand sets it withX509_set_subject_name(), because under OpenSSL 4 the subject thatX509_get_subject_name()returns isconstand cannot be written to. Without it the build fails against the tree’s openssl, which is OpenSSL 4.
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 pdf4qt'
What kpkg does
kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/documents/pdf4qt.
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/pdf4qt
echo 'a5f9952723acbb8a2431207cf76e53a17941292fbd003a2ed1b79503677ab2ec pdf4qt-1.6.0.0.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/pdf4qt
SRC=$SRC_ROOT/pdf4qt-1.6.0.0
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf pdf4qt-1.6.0.0.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/openssl4.patch"
cmake -S . -B build -G Ninja \
-D CMAKE_POLICY_VERSION_MINIMUM=3.5 \
-D CMAKE_INSTALL_PREFIX=/usr \
-D CMAKE_INSTALL_LIBDIR=lib \
-D CMAKE_BUILD_TYPE=Release \
-D PDF4QT_BUILD_TESTS=OFF \
-D PDF4QT_INSTALL_DEPENDENCIES=OFF \
-D PDF4QT_INSTALL_QT_DEPENDENCIES=OFF \
-D PDF4QT_INSTALL_TO_USR=OFF \
-Wno-dev
cmake --build build
DESTDIR=$PKG cmake --install build
_apps="$PKG/usr/share/applications"
_entry() {
cat > "$_apps/io.github.JakubMelka.Pdf4qt.$1.desktop" <<EOF
[Desktop Entry]
Version=1.0
Type=Application
Name=$2
Comment=$3
Exec=$1${4:+ $4}
Icon=io.github.JakubMelka.Pdf4qt.$1
Terminal=false
Categories=Office;
${4:+MimeType=application/pdf;
}StartupWMClass=$1
EOF
}
_entry Pdf4QtViewer 'PDF4QT Viewer' 'View and navigate PDF documents' %f
_entry Pdf4QtEditor 'PDF4QT Editor' 'Edit and modify PDF files' %f
_entry Pdf4QtPageMaster 'PDF4QT PageMaster' \
'Organize, merge, split, and duplicate pages in PDF files'
_entry Pdf4QtDiff 'PDF4QT Diff' 'Compare PDF documents' %F
cat > "$_apps/io.github.JakubMelka.Pdf4qt.desktop" <<'EOF'
[Desktop Entry]
Version=1.0
Type=Application
Name=PDF4QT LaunchPad
Comment=Launch PDF applications
Exec=Pdf4QtLaunchPad
Icon=io.github.JakubMelka.Pdf4qt
Terminal=false
NoDisplay=true
Categories=Office;
StartupWMClass=Pdf4QtLaunchPad
EOF
The switches, and why each is set:
-D PDF4QT_BUILD_TESTS=OFF— no unit tests, which upstream builds by default.-D PDF4QT_INSTALL_DEPENDENCIES=OFF— do not copy the third-party libraries into the install, and with-D PDF4QT_INSTALL_QT_DEPENDENCIES=OFFnot Qt either. Upstream turns both on for a vcpkg build, which bundles its libraries; here every library is a port.-D PDF4QT_INSTALL_TO_USR=OFF— do not add ausr/level of upstream’s own under the install prefix, which withCMAKE_INSTALL_PREFIX=/usrwould install into/usr/usr. Upstream turns it on only for a vcpkg build.
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/pdf4qt, 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 pdf4qt-1.6.0.0-2.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/pdf4qt, and runs the triggers its paths call for.
Contents
Installed programs: Pdf4QtDiff, Pdf4QtEditor, Pdf4QtLaunchPad, Pdf4QtPageMaster, Pdf4QtViewer, PdfTool.
Installed libraries: libPdf4QtLibCore.so, libPdf4QtLibGui.so, libPdf4QtLibWidgets.so.
Installed directories: /usr/include/Pdf4QtLibCore, /usr/include/Pdf4QtLibWidgets, /usr/lib/pdf4qt, /usr/share/licenses/pdf4qt, /usr/share/pdf4qt.
Notes
Upstream installs a desktop entry for each program. build.sh writes its own over them, adding %f to the Viewer’s and Editor’s Exec and %F to Diff’s, so a file opened from the file manager reaches the program, and a StartupWMClass for each. Upstream’s entries all claim application/pdf; the port’s keep that only for the three that take a file, so PageMaster and the LaunchPad are not offered for opening a PDF, and the LaunchPad’s entry has NoDisplay=true, which the menu then leaves out.