139.20. libdovi-3.4.0
C API of dovi_tool's dolby_vision crate: parse, convert and write Dolby Vision RPU metadata
| Version | 3.4.0, release 1 |
| Shelf | video-libs — Video codecs, containers, subtitles, disc playback and effects libraries |
| Phase | 41_system (System), 999 of 1047 in build order |
| Licence | MIT |
| Homepage | https://github.com/quietvoid/dovi_tool |
| Build time | 0.9 SBU |
| Installed size | 11.3 MiB in 7 files |
| Recipe | ports/core/video-libs/libdovi/kpkgbuild |
About
libdovi is the C library of dolby_vision, the Rust crate inside quietvoid’s dovi_tool: it parses, converts and writes the Dolby Vision RPU metadata a video stream carries, and is installed as libdovi.so and the static libdovi.a, with the header libdovi/rpu_parser.h and the pkg-config module dovi. HandBrake links it to carry Dolby Vision through a transcode.
Sources
libdovi-3.4.0.tar.gz(483.1 KiB)
sha2568eac4d1c3134f53e8eb216db6450307a737425844113e480d1e9713c142a9fa2
upstream: https://github.com/quietvoid/dovi_tool/archive/refs/tags/libdovi-3.4.0.tar.gz
archive copy: sources-4/video-libs--libdovi-3.4.0.tar.gzlibdovi-vendor-3.4.0.tar.xz(9.7 MiB)
sha2562bee0239a253c1f6d0ea1b6cad902a2d8e5b77eac2afadd79221a3b2ebad2800
a vendor bundle: the dependencies upstream’s own tool would download, packed once
archive copy: sources-4/video-libs--libdovi-vendor-3.4.0.tar.xz
Dependencies
Required by (1): handbrake.
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/41_system/phase.env && kpkg install libdovi'
What kpkg does
kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/video-libs/libdovi.
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/video-libs/libdovi
echo '8eac4d1c3134f53e8eb216db6450307a737425844113e480d1e9713c142a9fa2 libdovi-3.4.0.tar.gz' | sha256sum -c -
echo '2bee0239a253c1f6d0ea1b6cad902a2d8e5b77eac2afadd79221a3b2ebad2800 libdovi-vendor-3.4.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/libdovi
SRC=$SRC_ROOT/libdovi-3.4.0
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf libdovi-3.4.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 recipe’s helpers vendordir and the five paths PKGNAME, PORT_SRC, SRC_ROOT, SRC and PKG set as shell variables. Its body, verbatim:
cd $vendordir
tar xf $PORT_SRC/${name}-vendor-${version}.tar.xz
export CARGO_HOME="$SRC_ROOT/.cargo"
export RUSTFLAGS="-C target-feature=-crt-static"
export CARGO_NET_OFFLINE=true
cargo cinstall --release --frozen --offline \
--features capi \
--prefix /usr --libdir /usr/lib --destdir $PKG
test -f "$PKG/usr/lib/libdovi.so"
test -f "$PKG/usr/include/libdovi/rpu_parser.h"
The switches, and why each is set:
--features capi— Turn on the crate’scapifeature, which enables the optionallibcdependency and the crate’sserdefeature.cargo cinstallcompiles the C API module whether the feature is on or not, and that module importslibc, so without the feature the build has nolibccrate; the C functions that take a JSON configuration are compiled only withserde.
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/libdovi, 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 libdovi-3.4.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/libdovi, and runs the triggers its paths call for.
Contents
Installed libraries: libdovi.a, libdovi.so.
Installed directories: /usr/include/libdovi, /usr/share/licenses/libdovi.
Short descriptions
dovi.pc |
Dolby Vision metadata parsing and writing |
Notes
- Only the library is built. The tarball is the whole dovi_tool repository; its top-level
Cargo.tomlis thedovi_toolcommand, anddolby_vision/is the library crate with a manifest andCargo.lockof its own.vendordir = dolby_visionmakesports/fetchvendor that manifest’s crates, andbuild.shchanges into the directory before unpacking the bundle, so the.cargo/config.tomlit carries is where cargo stands (see Where the bundle goes). - cargo-c does the install.
cargo cinstallbuilds the crate as a C shared library and a static archive, and installs both with the header and.pcfile, taking the library namedovi, the header subdirectorylibdoviand-Cpanic=abortfrom the crate’s[package.metadata.capi]. The twotest -flines stop the build if the library or the header is missing from$PKG.