320.1. qv4l2-1.32.0
qv4l2 and qvidcap — Qt 6 test benches for Video4Linux devices: every control, format and stream, and a capture viewer
| Version | 1.32.0, release 1 |
| Shelf | media-frameworks — Multimedia frameworks, capture, and media inspection |
| Phase | 44_apps (Applications), 294 of 422 in build order |
| Licence | GPL-2.0-or-later |
| Homepage | https://linuxtv.org/wiki/index.php/V4l-utils |
| Build time | 4.9 SBU |
| Installed size | 1.1 MiB in 19 files |
| Recipe | ports/core/media-frameworks/qv4l2/kpkgbuild |
About
qv4l2 and qvidcap are the two Qt programs of v4l-utils, the Video4Linux tools. qv4l2 is a test bench for a capture or output device: it shows every control, input and format the driver offers and streams from it, through OpenGL or plain Qt. qvidcap is a viewer for a capture stream. The libraries and command-line tools come from the v4l-utils port, which is built in 41_system, before any toolkit; this port builds the same source again in 44_apps and keeps only the two Qt programs.
Sources
v4l-utils-1.32.0.tar.xz(1.3 MiB)
sha2566828828a17775526eb93fb258a9294d1d1073d633c344dd71ecd4e7a1ffb7dfc
upstream: https://linuxtv.org/downloads/v4l-utils/v4l-utils-1.32.0.tar.xz
archive copy: sources-3/media-frameworks--v4l-utils-1.32.0.tar.xz
Dependencies
Depends on: v4l-utils, meson, ninja, pkgconf, perl, gettext, libintl, libjpeg-turbo, eudev, argp-standalone, qt6-qtbase, qt6-qt5compat, mesa, libglvnd, alsa-lib.
Required by: no port names it.
Optional, off in KDOS
These switches in build.sh turn off a feature whose library is a port here. The recipe may turn each off on purpose, or because the library was not yet a port when the recipe was written; this list cannot tell which.
-Dbpf=disabled, line 18: libbpf (explained with the switches below)
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 qv4l2'
What kpkg does
kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/media-frameworks/qv4l2.
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/media-frameworks/qv4l2
echo '6828828a17775526eb93fb258a9294d1d1073d633c344dd71ecd4e7a1ffb7dfc v4l-utils-1.32.0.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/qv4l2
SRC=$SRC_ROOT/qv4l2-1.32.0
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf v4l-utils-1.32.0.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 recipe’s helpers group and the five paths PKGNAME, PORT_SRC, SRC_ROOT, SRC and PKG set as shell variables. Its body, verbatim:
export CFLAGS="$CFLAGS -D_LARGEFILE64_SOURCE"
export CXXFLAGS="$CXXFLAGS -D_LARGEFILE64_SOURCE"
meson setup build \
--prefix=/usr --sysconfdir=/etc --libdir=lib \
--buildtype=release \
-Dudevdir=/lib/udev \
-Dbpf=disabled \
-Dgconv=disabled \
-Djpeg=enabled \
-Dlibdvbv5=disabled \
-Dqv4l2=enabled \
-Dqvidcap=enabled \
-Dv4l2-tracer=disabled \
-Dv4l-plugins=true \
-Dv4l-utils=true \
-Dv4l-wrappers=true \
-Dv4l2-compliance-libv4l=true \
-Dv4l2-ctl-libv4l=true \
-Dv4l2-ctl-stream-to=true \
-Ddoxygen-doc=disabled
meson compile -C build
DESTDIR=$PWD/stage meson install --no-rebuild -C build
for f in usr/bin/qv4l2 usr/bin/qvidcap \
usr/share/man/man1/qv4l2.1 usr/share/man/man1/qvidcap.1 \
usr/share/applications/qv4l2.desktop usr/share/applications/qvidcap.desktop; do
install -D "stage/$f" "$PKG/$f"
done
for d in stage/usr/share/icons/hicolor/*/apps; do
s=${d#stage/}
install -d "$PKG/$s"
cp -a "$d"/qv4l2.* "$d"/qvidcap.* "$PKG/$s/"
done
test -x "$PKG/usr/bin/qv4l2"
test -x "$PKG/usr/bin/qvidcap"
readelf -d "$PKG/usr/bin/qv4l2" | grep -q 'NEEDED.*\[libQt6Widgets\.so\.6\]'
The switches, and why each is set:
-D_LARGEFILE64_SOURCE— added toCFLAGSandCXXFLAGS, as in the v4l-utils recipe. musl declaresopen64andmmap64only under this macro. In v4l-utils the code that calls them isv4l2-tracer, which this build leaves out, and upstream’smeson.buildalready passes the macro to the preload wrappers.-Dqv4l2=enabled— with-Dqvidcap=enabled: build both programs, so a missing Qt stops the configure. With the options atauto, meson skips them without an error.-Dbpf=disabled— with-Dlibdvbv5=disabledand-Dv4l2-tracer=disabled: skip the parts of the tree this port does not install (ir-keytable’s BPF decoders, the DVB library and tools, and the call tracer). v4l-utils builds and ships them.-Dv4l-plugins=true— and the-Dv4l-*and-Dv4l2-*trueswitches after it,-Dgconv,-Djpegand-Dudevdir: the same values as the v4l-utils recipe, so the libraries the two Qt programs are linked against here are configured as the shipped ones are.
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/qv4l2, 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 qv4l2-1.32.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/qv4l2, and runs the triggers its paths call for.
Contents
Installed programs: qv4l2, qvidcap.
Installed directories: /usr/share/licenses/qv4l2.
Short descriptions
qv4l2 |
A test bench application for video4linux devices |
qvidcap |
A v4l2 video capture viewer |
Notes
meson install goes into a staging directory, stage/, not into $PKG. build.sh then copies only the two programs, their manual pages, their desktop entries and their icons into the package. Every other file of the tree is in the v4l-utils package, and kpkg’s conflict scan refuses a package that claims a path another installed package owns (see Who owns a file).
meson takes Qt 6 when it finds Qt 6 with Core5Compat, and otherwise falls back to Qt 5. The last line of build.sh checks that qv4l2 names libQt6Widgets.so.6, so a build that fell back to Qt 5 fails instead of shipping. That is why qt6-qt5compat is in depends.