135.27. id3lib-3.8.3
ID3v1 and ID3v2 tag library, with the id3tag, id3info, id3convert and id3cp commands
| Version | 3.8.3, release 1 |
| Shelf | audio-codecs — Audio codecs, containers and tagging, including the Bluetooth audio codecs |
| Phase | 41_system (System), 133 of 1047 in build order |
| Licence | LGPL-2.0-or-later |
| Homepage | https://id3lib.sourceforge.net/ |
| Build time | 0.5 SBU |
| Installed size | 587.2 KiB in 22 files |
| Recipe | ports/core/audio-codecs/id3lib/kpkgbuild |
About
id3lib is a C++ library for reading, writing and stripping ID3 v1 and v2 tags in MP3 files, with a C interface, and it installs the id3tag, id3info, id3convert and id3cp commands. The patches beside it are Alpine’s set for this release: standard C++ headers, the iomanip.h check, a bool typedef that C23 rejects, the UTF-16 writer, a null-pointer check, a stack overrun and an insecure temporary file. In KDOS, kwave links it.
Sources
id3lib-3.8.3.tar.gz(928.4 KiB)
sha2562749cc3c0cd7280b299518b1ddf5a5bcfe2d1100614519b68702230e26c7d079
upstream: https://downloads.sourceforge.net/id3lib/id3lib-3.8.3.tar.gz
archive copy: sources-1/audio-codecs--id3lib-3.8.3.tar.gz
Dependencies
Depends on: autoconf, automake, libtool, zlib.
Required by (1): kwave.
Patches
build.sh applies these; kpkg applies nothing by itself.
10-fix-compilation-with-cpp-headers.patch— Includes<cstring>inid3lib_strings.handwriters.h, which callmemcpywithout including the header that declares it.30-fix-utf16.patch— Reads the bytes of a UTF-16 string through anunsigned charpointer when writing it, so a byte with its top bit set is not sign-extended into the code unit it belongs to.50-remove-outdated-check.patch— Dropsiomanip.h, the pre-standard C++ header, from the list of headersconfigure.inrefuses to build without; nothing in the library includes it.60-id3lib-missing-nullpointer-check.patch— Checks that the tag header has its version information (_info) before reading its extended-header flag inheader_tag.cpp.61-fix_vbr_stack_smash.patch— Raises the largest Xing VBR headermp3_parse.cppwill read from 116 to 120 bytes, the size of a header with every optional field; with 116, reading such a header overruns the stack buffer it is copied into.CVE-2007-4460.patch— Writes a rewritten tag through the temporary filemkstempcreated whenevermkstempexists, instead of a predictable name opened withfstreamunder GCC 3 and later (CVE-2007-4460).bool-typedef.patch— Skips the Ctypedef int boolinglobals.hunder C23, wherebool,trueandfalseare keywords and the typedef is an error.
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 id3lib'
What kpkg does
kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/audio-codecs/id3lib.
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/audio-codecs/id3lib
echo '2749cc3c0cd7280b299518b1ddf5a5bcfe2d1100614519b68702230e26c7d079 id3lib-3.8.3.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/id3lib
SRC=$SRC_ROOT/id3lib-3.8.3
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf id3lib-3.8.3.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:
for p in 10-fix-compilation-with-cpp-headers 30-fix-utf16 \
50-remove-outdated-check 60-id3lib-missing-nullpointer-check \
61-fix_vbr_stack_smash CVE-2007-4460 bool-typedef; do
patch -p1 -i "$PORT_SRC/$p.patch"
done
libtoolize --force --copy --install
aclocal -I m4
autoconf
automake --add-missing --copy
./configure --prefix=/usr --libdir=/usr/lib --disable-static
make
make DESTDIR=$PKG install
nm -D "$PKG/usr/lib/libid3-3.8.so.3" | grep -q " U iconv_open"
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/id3lib, 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 id3lib-3.8.3-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/id3lib, and runs the triggers its paths call for.
Contents
Installed programs: id3convert, id3cp, id3info, id3tag.
Installed libraries: libid3-3.8.so, libid3.so.
Installed directories: /usr/include/id3, /usr/share/licenses/id3lib.
Notes
- The autotools are run by hand, in this order. The shipped
configureand libtool are generated by Autoconf 2.53a and libtool 1.4.2, and50-remove-outdated-check.patcheditsconfigure.in, so the build system is regenerated;aclocal -I m4is what finds id3lib’s own macros inm4/, among them the iconv probes.autoheaderis left out on purpose: the shippedconfig.h.inis the one the sources expect, andautoheaderwould rewrite it from the obsoleteacconfig.h. - zlib comes from the system. With
libzfound, the copy bundled underzlib/is configured but not built, and nothing from it is installed. - The last line of
build.shis a check, not an install step. id3lib compiles its iconv text conversion only whenconfigurefinds<iconv.h>and itsID3_UNICODEmacro finds, by running a test program for each, an iconv name for UTF-8, UTF-16, UTF-16BE and ASCII; when any is missing it falls back without a warning to its own converter.nm -Don the installedlibid3-3.8.so.3must showiconv_openas an undefined symbol, so the fallback fails the build instead of shipping.