305.1. zint-2.16.0
Barcode encoder for over 50 symbologies, with a CLI and the Zint Barcode Studio GUI
| Version | 2.16.0, release 1 |
| Shelf | image-libs — Raster image formats, codecs, metadata, processing, barcodes, and terminal image output |
| Phase | 44_apps (Applications), 257 of 422 in build order |
| Licence | BSD-3-Clause AND GPL-3.0-or-later |
| Homepage | https://zint.org.uk/ |
| Build time | 6.2 SBU |
| Installed size | 2.2 MiB in 17 files |
| Recipe | ports/core/image-libs/zint/kpkgbuild |
About
Zint encodes barcodes in a wide range of symbologies, from Code 128, EAN and UPC to QR Code, Data Matrix, Aztec and the postal codes. The port installs the libzint library, the zint command, the libQZint Qt widget library and Zint Barcode Studio, the Qt 6 GUI built on it.
Sources
zint-2.16.0.tar.gz(6.1 MiB)
sha25637e767afada2403bb9ae49b93a19eb0a9e944a0c278d9f23522746b3d08a3c4b
upstream: https://downloads.sourceforge.net/zint/zint-2.16.0-src.tar.gz
archive copy: sources-3/image-libs--zint-2.16.0.tar.gz
Dependencies
Depends on: cmake, ninja, zlib, libpng, qt6-qtbase, qt6-qtsvg, qt6-qttools, qt6-qtwayland, hicolor-icon-theme.
Required by: no port names it.
Patches
build.sh applies these; kpkg applies nothing by itself.
shared-libqzint.patch— Inbackend_qt/CMakeLists.txt, build libQZint as a shared library instead of a static one, so the GUI and any other Qt program that uses it link one copy.
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 zint'
What kpkg does
kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/image-libs/zint.
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/image-libs/zint
echo '37e767afada2403bb9ae49b93a19eb0a9e944a0c278d9f23522746b3d08a3c4b zint-2.16.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/zint
SRC=$SRC_ROOT/zint-2.16.0
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf zint-2.16.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/shared-libqzint.patch"
cmake -B build -G Ninja \
-DCMAKE_POLICY_VERSION_MINIMUM=3.5 \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/usr \
-DCMAKE_INSTALL_LIBDIR=lib \
-DZINT_SHARED=ON \
-DZINT_STATIC=OFF \
-DZINT_FRONTEND=ON \
-DZINT_USE_PNG=ON \
-DZINT_USE_QT=ON \
-DZINT_QT6=ON \
-DZINT_USE_GS1SE=OFF \
-DZINT_TEST=OFF \
-DZINT_UNINSTALL=OFF
cmake --build build
DESTDIR=$PKG cmake --install build
install -Dm644 zint-qt.png "$PKG/usr/share/icons/hicolor/48x48/apps/zint-qt.png"
install -d "$PKG/usr/share/applications"
cat > "$PKG/usr/share/applications/zint-qt.desktop" <<'EOF2'
[Desktop Entry]
Type=Application
Name=Zint Barcode Studio
GenericName=Barcode Generator
Comment=Make barcodes and QR codes for labels and print
Exec=zint-qt
Icon=zint-qt
Terminal=false
StartupWMClass=uk.org.zint.zint-qt
Categories=Graphics;2DGraphics;Office;
Keywords=barcode;qr;ean;upc;code128;datamatrix;label;zint;
EOF2
chmod 644 "$PKG/usr/share/applications/zint-qt.desktop"
The switches, and why each is set:
-DZINT_QT6=ON— Build the Qt backend and the GUI against Qt 6;-DZINT_USE_QT=ONbuilds them at all. WithoutZINT_QT6the project looks for Qt 5 unless theCMAKE_PREFIX_PATHenvironment variable holds a Qt 6 version number such as6.8.0. A Qt 6 with a component missing is only a status message, and the build goes on withoutlibQZintand the GUI.-DZINT_USE_GS1SE=OFF— Do not look for libgs1encoders, the GS1 Syntax Engine, which is not a port; upstream’s default looks for it and links it when found. Zint then checks GS1 data with its own rules.-DZINT_UNINSTALL=OFF— Add nouninstalltarget; the package manager removes the files.-DZINT_SHARED=ON— With-DZINT_STATIC=OFF,-DZINT_FRONTEND=ONand-DZINT_USE_PNG=ON, these are upstream’s defaults, written out: the shared library only, thezintcommand, and PNG output through libpng.
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/zint, 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 zint-2.16.0-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/zint, and runs the triggers its paths call for.
Contents
Installed programs: zint, zint-qt.
Installed libraries: libQZint.so, libzint.so.
Installed directories: /usr/lib/cmake/zint, /usr/share/licenses/zint.
Short descriptions
zint |
encode data as a barcode image |
Notes
Upstream’s CMake installs no desktop entry or icon, so build.sh installs the source tree’s zint-qt.png and writes the entry. The program sets no desktop file name, so Qt’s Wayland app id is the organisation domain it sets, zint.org.uk, reversed, before the executable’s name: uk.org.zint.zint-qt, which the entry’s StartupWMClass names.