139.14. libmpeg2-0.5.1
MPEG-1 and MPEG-2 video stream decoder library
| Version | 0.5.1, release 1 |
| Shelf | video-libs — Video codecs, containers, subtitles, disc playback and effects libraries |
| Phase | 41_system (System), 993 of 1047 in build order |
| Licence | GPL-2.0-or-later |
| Homepage | https://libmpeg2.sourceforge.net/ |
| Build time | 0.2 SBU |
| Installed size | 298.8 KiB in 16 files |
| Recipe | ports/core/video-libs/libmpeg2/kpkgbuild |
About
libmpeg2 decodes MPEG-1 and MPEG-2 video streams, the video of DVDs and of DVB and ATSC broadcasts. KDOS carries it for GStreamer: the mpeg2dec element of gst-plugins-ugly wraps it. VLC, ScummVM and Amiberry link it as well. The package also installs three programs: mpeg2dec, the demonstration decoder, which here can only write its output to files; extract_mpeg2, which pulls the MPEG video out of a program or transport stream; and corrupt_mpeg2, which damages a stream on purpose, for testing a decoder.
Why it is in KDOS
The comment above it in script/phases/41_system/packages.d/video-libs.txt:
The MPEG-2 video decoder gst-plugins-ugly's mpeg2dec element wraps.
Sources
libmpeg2-0.5.1.tar.gz(512.5 KiB)
sha256dee22e893cb5fc2b2b6ebd60b88478ab8556cb3b93f9a0d7ce8f3b61851871d4
upstream: https://download.videolan.org/contrib/libmpeg2/libmpeg2-0.5.1.tar.gz
archive copy: sources-4/video-libs--libmpeg2-0.5.1.tar.gz
Dependencies
Depends on: nothing a recipe names.
Required by (4): amiberry, gst-plugins-ugly, scummvm, vlc.
Patches
build.sh applies these; kpkg applies nothing by itself.
gcc-15.patch— Gives thegetenvdeclaration in the bundledsrc/getopt.cits argument list,char *getenv (const char *): GCC 15 compiles C23 by default, wheregetenv ()declares a function with no arguments and conflicts with the C library’s prototype. It also widens the guard insrc/getopt.hthat prototypesgetopt, from__GNU_LIBRARY__alone to any C library that is not glibc, so the bundled header givesgetoptits full prototype instead of the emptygetopt (), which conflicts the same way.
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 libmpeg2'
What kpkg does
kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/video-libs/libmpeg2.
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/libmpeg2
echo 'dee22e893cb5fc2b2b6ebd60b88478ab8556cb3b93f9a0d7ce8f3b61851871d4 libmpeg2-0.5.1.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/libmpeg2
SRC=$SRC_ROOT/libmpeg2-0.5.1
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf libmpeg2-0.5.1.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/gcc-15.patch"
./configure --prefix=/usr --libdir=/usr/lib \
--enable-shared \
--disable-static \
--with-pic \
--without-x \
--disable-sdl \
--enable-accel-detect
make
make DESTDIR=$PKG install
The switches, and why each is set:
--enable-shared— Buildlibmpeg2.soandlibmpeg2convert.so.--with-pic— Compile the libraries’ objects position-independent.--without-x— Buildmpeg2decwithout its X11 video output. Its display outputs are X11 and SDL; with both off it decodes to files only.--disable-sdl— Buildmpeg2decwithout its SDL output. configure otherwise turns it on wheneversdl-configis on the path, which sdl12-compat installs.--enable-accel-detect— Choose the processor’s SIMD routines at run time rather than at build time. It is upstream’s default.
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/libmpeg2, 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 libmpeg2-0.5.1-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/libmpeg2, and runs the triggers its paths call for.
Contents
Installed programs: corrupt_mpeg2, extract_mpeg2, mpeg2dec.
Installed libraries: libmpeg2.so, libmpeg2convert.so.
Installed directories: /usr/include/mpeg2dec, /usr/share/licenses/libmpeg2.
Short descriptions
extract_mpeg2 |
extract MPEG video streams from a multiplexed stream. |
mpeg2dec |
decode MPEG and MPEG2 video streams |
libmpeg2.pc |
MPEG-1 and MPEG-2 stream decoding library |
libmpeg2convert.pc |
Image conversion library helper for libmpeg2 |