322.7. mkvtoolnix-102.0
MKVToolNix: create, split, edit and inspect Matroska files, with the Qt 6 GUI
| Version | 102.0, release 1 |
| Shelf | video-tools — Video editing, transcoding, muxing, recording, streaming and webcam apps |
| Phase | 44_apps (Applications), 415 of 422 in build order |
| Licence | GPL-2.0-only |
| Homepage | https://mkvtoolnix.download/ |
| Build time | 35.2 SBU |
| Installed size | 32.2 MiB in 27 files |
| Recipe | ports/core/video-tools/mkvtoolnix/kpkgbuild |
About
MKVToolNix creates, splits, edits and inspects Matroska and WebM files: mkvmerge, mkvextract, mkvinfo and mkvpropedit on the command line, and mkvtoolnix-gui, the Qt 6 application that drives them. It reads and writes Matroska through libebml and libmatroska.
Sources
mkvtoolnix-102.0.tar.xz(10.7 MiB)
sha2569f0a810f17c7df8adb9064a3a41d5784399be412d19704cf080745ad7d45da30
upstream: https://mkvtoolnix.download/sources/mkvtoolnix-102.0.tar.xz
archive copy: sources-4/video-tools--mkvtoolnix-102.0.tar.xz
Dependencies
Depends on: ruby, pkgconf, boost, gmp, libebml, libmatroska, libogg, libvorbis, flac, zlib, fmt, pugixml, nlohmann-json, libdvdread, cmark, qt6-qtbase, qt6-qtsvg, qt6-qtmultimedia, qt6-qtwayland, libxslt, docbook-xsl, librsvg.
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 mkvtoolnix'
What kpkg does
kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/video-tools/mkvtoolnix.
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-tools/mkvtoolnix
echo '9f0a810f17c7df8adb9064a3a41d5784399be412d19704cf080745ad7d45da30 mkvtoolnix-102.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/mkvtoolnix
SRC=$SRC_ROOT/mkvtoolnix-102.0
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf mkvtoolnix-102.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 five paths PKGNAME, PORT_SRC, SRC_ROOT, SRC and PKG set as shell variables. Its body, verbatim:
./configure --prefix=/usr --sysconfdir=/etc --mandir=/usr/share/man \
ac_cv_path_INKSCAPE= \
--enable-gui \
--enable-dbus \
--disable-update-check \
--disable-precompiled-headers \
--without-gettext \
--with-flac \
--with-dvdread
./drake V=1 -j"$KDOS_JOBS"
./drake DESTDIR=$PKG install
for s in 48 64 128 256; do
install -d "$PKG/usr/share/icons/hicolor/${s}x${s}/apps"
rsvg-convert -w $s -h $s \
-o "$PKG/usr/share/icons/hicolor/${s}x${s}/apps/mkvtoolnix-gui.png" \
"$PKG/usr/share/icons/hicolor/scalable/apps/mkvtoolnix-gui.svg"
done
cat > "$PKG/usr/share/applications/org.bunkus.mkvtoolnix-gui.desktop" <<'DESKTOP'
[Desktop Entry]
Type=Application
Name=MKVToolNix
GenericName=Matroska Muxer
Comment=Merge, split and edit tracks of Matroska and WebM files
Exec=mkvtoolnix-gui %F
Icon=mkvtoolnix-gui
Terminal=false
StartupWMClass=org.bunkus.mkvtoolnix-gui
MimeType=application/x-mkvtoolnix-gui-settings;
Categories=AudioVideo;AudioVideoEditing;
Keywords=matroska;mkv;webm;mux;remux;subtitles;chapters;tracks;
DESKTOP
chmod 644 "$PKG/usr/share/applications/org.bunkus.mkvtoolnix-gui.desktop"
The switches, and why each is set:
ac_cv_path_INKSCAPE=— Record Inkscape as not found. The Rakefile renders the Windows icon set whenever configure finds both Inkscape and ImageMagick, and Inkscape crashes in the chroot; the empty answer keeps that Windows-only step out whatever the tree holds (An optional tool found in the tree).--enable-gui— Build the Qt 6 GUI. Upstream’s default, named.--enable-dbus— Build the GUI with Qt’s D-Bus module. Upstream’s default isauto.--disable-update-check— Compile out the GUI’s daily download of the release list from the MKVToolNix home page.--disable-precompiled-headers— Build without precompiled headers, which configure otherwise turns on for any compiler at version 4.1.0 or later (ac/precompiled_headers.m4).--without-gettext— Build the programs in English, with no message catalogues.--with-flac— With--with-dvdread: FLAC audio, and reading chapters from DVDs through libdvdread. Both are upstream’s defaults, named; neither makes a missing library an error, and configure reports what it found.
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/mkvtoolnix, 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 mkvtoolnix-102.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/mkvtoolnix, and runs the triggers its paths call for.
Contents
Installed programs: mkvextract, mkvinfo, mkvmerge, mkvpropedit, mkvtoolnix-gui.
Installed directories: /usr/share/licenses/mkvtoolnix, /usr/share/mkvtoolnix.
Notes
- The build tool. The build runs on
drake, a parallel version of rake that the tarball carries underrake.d/vendor, so ruby is all it needs.V=1prints each command in full, and-j"$KDOS_JOBS"gives it the tree’s job count. - Manual pages come from DocBook through
xsltproc, with docbook-xsl. The translated pages need po4a, which is not a port, and are not built. - The menu icon. Upstream installs SVGs;
build.shalso renders 48, 64, 128 and 256 pixel PNGs ofmkvtoolnix-gui.svg. - The menu entry is replaced to add
StartupWMClass, which upstream’s lacks: Qt builds the Wayland app_id from the organisation domain and the program,org.bunkus.mkvtoolnix-gui. It claims only the GUI’s own settings type; the Matroska and WebM types belong to the players.