321.5. kodi-21.3
Ten-foot media centre for local and network video, music and pictures, with add-ons
| Version | 21.3, release 1 |
| Shelf | video-players — Video players and media centres, and their front-end add-ons |
| Phase | 44_apps (Applications), 404 of 422 in build order |
| Licence | GPL-2.0-or-later |
| Homepage | https://kodi.tv/ |
| Build time | 28.7 SBU |
| Installed size | 96.8 MiB in 2165 files |
| Recipe | ports/core/video-players/kodi/kpkgbuild |
About
Kodi is a ten-foot media centre: a full-screen interface for local and network video, music and pictures, driven by a remote, a keyboard or a game pad, and extended by add-ons written in Python. This port builds it for the Wayland windowing system, drawing with OpenGL ES through EGL and decoding through VA-API, with a menu entry that also offers to open it full screen.
Sources
kodi-21.3.tar.gz(39.4 MiB)
sha256a60afcb556e4a00cb19fc35b7e77758107c9a8096c6ce9b66af5f92396be31aa
upstream: https://github.com/xbmc/xbmc/archive/refs/tags/21.3-Omega.tar.gz
archive copy: sources-4/video-players--kodi-21.3.tar.gzcrossguid-ca1bf4b810e2d188d04cb6286f957008ee1b7681.tar.gz(138.3 KiB)
sha2566be27e0b3a4907f0cd3cfadec255ee1b925569e1bd06e67a4d2f4267299b69c4
upstream: https://mirrors.kodi.tv/build-deps/sources/crossguid-ca1bf4b810e2d188d04cb6286f957008ee1b7681.tar.gz
archive copy: sources-4/video-players--crossguid-ca1bf4b810e2d188d04cb6286f957008ee1b7681.tar.gzlibdvdcss-1.4.3-Next-Nexus-Alpha2-2.tar.gz(99.7 KiB)
sha256f38c4a4e7a4f4da6d8e83b8852489aa3bb6588a915dc41f5ee89d9aad305a06e
upstream: https://github.com/xbmc/libdvdcss/archive/1.4.3-Next-Nexus-Alpha2-2.tar.gz
archive copy: sources-4/video-players--libdvdcss-1.4.3-Next-Nexus-Alpha2-2.tar.gzlibdvdnav-6.1.1-Next-Nexus-Alpha2-2.tar.gz(125.5 KiB)
sha256584f62a3896794408d46368e2ecf2c6217ab9c676ce85921b2d68b8961f49dfc
upstream: https://github.com/xbmc/libdvdnav/archive/6.1.1-Next-Nexus-Alpha2-2.tar.gz
archive copy: sources-4/video-players--libdvdnav-6.1.1-Next-Nexus-Alpha2-2.tar.gzlibdvdread-6.1.3-Next-Nexus-Alpha2-2.tar.gz(107.9 KiB)
sha256719130091e3adc9725ba72df808f24a14737a009dca5a4c38c601c0c76449b62
upstream: https://github.com/xbmc/libdvdread/archive/6.1.3-Next-Nexus-Alpha2-2.tar.gz
archive copy: sources-4/video-players--libdvdread-6.1.3-Next-Nexus-Alpha2-2.tar.gzffmpeg-6.0.1.tar.gz(14.7 MiB)
sha256375fd8abab657d18578554927d23abfc9cb3b6794bd9839330230cf5f9fcea26
upstream: https://ffmpeg.org/releases/ffmpeg-6.0.1.tar.gz
archive copy: sources-4/video-players--ffmpeg-6.0.1.tar.gzfmt-9.1.0.tar.gz(818.3 KiB)
sha2565dea48d1fcddc3ec571ce2058e13910a0d4a6bab4cc09a809d8b1dd1c88ae6f2
upstream: https://mirrors.kodi.tv/build-deps/sources/fmt-9.1.0.tar.gz
archive copy: sources-4/video-players--fmt-9.1.0.tar.gzspdlog-1.10.0.tar.gz(360.0 KiB)
sha256697f91700237dbae2326b90469be32b876b2b44888302afbc7aceb68bcfe8224
upstream: https://mirrors.kodi.tv/build-deps/sources/spdlog-1.10.0.tar.gz
archive copy: sources-4/video-players--spdlog-1.10.0.tar.gzflatbuffers-23.3.3.tar.gz(2.1 MiB)
sha2568aff985da30aaab37edf8e5b02fda33ed4cbdd962699a8e2af98fdef306f4e4d
upstream: https://mirrors.kodi.tv/build-deps/sources/flatbuffers-23.3.3.tar.gz
archive copy: sources-4/video-players--flatbuffers-23.3.3.tar.gzfstrcmp-0.7.D001.tar.gz(385.6 KiB)
sha256e4018e850f80700acee8da296e56e15b1eef711ab15157e542e7d7e1237c3476
upstream: https://mirrors.kodi.tv/build-deps/sources/fstrcmp-0.7.D001.tar.gz
archive copy: sources-4/video-players--fstrcmp-0.7.D001.tar.gzpcre-8.45.tar.bz2(1.5 MiB)
sha2564dae6fdcd2bb0bb6c37b5f97c33c2be954da743985369cddac3546e3218bffb8
upstream: https://mirrors.kodi.tv/build-deps/sources/pcre-8.45.tar.bz2
archive copy: sources-4/video-players--pcre-8.45.tar.bz2apache-groovy-binary-4.0.33.zip(28.9 MiB)
sha256395a69a81d5e9915d360d630663c1d98534c9dec134cb267798e49370855d93d
upstream: https://archive.apache.org/dist/groovy/4.0.33/distribution/apache-groovy-binary-4.0.33.zip
archive copy: sources-4/video-players--apache-groovy-binary-4.0.33.zipcommons-lang3-3.17.0-bin.tar.gz(9.3 MiB)
sha25608b93712bed7f48725d93c44d70c71e7e661af390f22f0f3e6ba61e3af3cea36
upstream: https://archive.apache.org/dist/commons/lang/binaries/commons-lang3-3.17.0-bin.tar.gz
archive copy: sources-4/video-players--commons-lang3-3.17.0-bin.tar.gzcommons-text-1.13.0-bin.tar.gz(3.0 MiB)
sha256a690c1e868a373f2d0fa5e7e89f5359b24e544d1b5e310f5a709d95a03a95df5
upstream: https://archive.apache.org/dist/commons/text/binaries/commons-text-1.13.0-bin.tar.gz
archive copy: sources-4/video-players--commons-text-1.13.0-bin.tar.gz
Dependencies
Depends on: cmake, ninja, pkgconf, autoconf, automake, libtool, nasm, swig, openjdk, python3, waylandpp, wayland, wayland-protocols, libxkbcommon, libdrm, libglvnd, mesa, libva, libass, libcdio, curl, freetype2, fribidi, harfbuzz, lzo, openssl, rapidjson, sqlite, taglib, tinyxml, tinyxml2, zlib, giflib, libjpeg-turbo, libpng, libunistring, libxml2, libxslt, alsa-lib, libpulse, pipewire, avahi, bluez, libbluray, libcap, lcms2, dav1d, dbus, libmicrohttpd, libplist, samba, eudev, libudfread, gnutls, libcec, libnfs, shairplay, lirc.
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.
-DENABLE_LLD=OFF, line 45: lld
Patches
build.sh applies these; kpkg applies nothing by itself.
dyn-pagesize.patch— [UDMABufferObject] Use sysconf(_SC_PAGESIZE) to retrieve page sizegetpagesize() is deprecated and legacy since POSIX.1-2001 and is not available on architectures where PAGESIZE is not defined. Instead query the current page size at runtime.
fix-musl-incompability.patch— In the DLL loader’s C runtime emulation, treats every non-glibc C library like the BSDs:fpos_tis handled as a plain 64-bit offset instead of glibc’s__posfield,__off_tandoff64_tare defined where glibc would provide them, and_PATH_MOUNTEDand_PATH_MNTTABget fallback definitions.fmt-imported-configs.patch—FindFmt.cmakesets the imported target’s configuration list twice, the second call replacing the first, so a Release build is told only of the Debug library,libfmtd.a, which the internal build never makes. The patch appends each configuration (An imported library that names only its Debug build).gcc13.patch— Adds#include <cstdint>to five headers that use the fixed-width integer types without it (A standard header the source never includes).gcc15-musl.patch— [xbmc] Add missing include <stdint.h>Starting with gcc 15 it failed on musl libc with:
/home/buildozer/git/aports/community/kodi/src/xbmc-21.2-Omega/xbmc/guilib/GUIMessage.h:378:15: error: unknown type name 'int64_t' 378 | int64_t param1, | ^ ...
lfs64.patch— Replaces the glibc 64-bit file calls and types (stat64,fstat64,statvfs64,fseeko64,lseek64,off64_t) with the plain ones, which are 64-bit on musl.pcre-cmp0026.patch— Adds one more patch to the listFindPCRE.cmakeapplies to the internal PCRE, which drops itscmake_policy(SET CMP0026 OLD), a setting CMake 4 refuses (A policy set to its removed behaviour).platformdefs-limits.patch— Includes<limits.h>inPlatformDefs.h, which definesMAX_PATHasPATH_MAXand relied on another header to declare it.texturepacker-giflib6.patch— TexturePacker, the build tool that packs the skins’ images, tests for giflib 5 exactly and takes the giflib 4 calls for any other version; the patch tests for 5 or later, which the giflib port’s 6 is (A version test that excludes a newer major release).
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 kodi'
What kpkg does
kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/video-players/kodi.
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-players/kodi
echo 'a60afcb556e4a00cb19fc35b7e77758107c9a8096c6ce9b66af5f92396be31aa kodi-21.3.tar.gz' | sha256sum -c -
echo '6be27e0b3a4907f0cd3cfadec255ee1b925569e1bd06e67a4d2f4267299b69c4 crossguid-ca1bf4b810e2d188d04cb6286f957008ee1b7681.tar.gz' | sha256sum -c -
echo 'f38c4a4e7a4f4da6d8e83b8852489aa3bb6588a915dc41f5ee89d9aad305a06e libdvdcss-1.4.3-Next-Nexus-Alpha2-2.tar.gz' | sha256sum -c -
echo '584f62a3896794408d46368e2ecf2c6217ab9c676ce85921b2d68b8961f49dfc libdvdnav-6.1.1-Next-Nexus-Alpha2-2.tar.gz' | sha256sum -c -
echo '719130091e3adc9725ba72df808f24a14737a009dca5a4c38c601c0c76449b62 libdvdread-6.1.3-Next-Nexus-Alpha2-2.tar.gz' | sha256sum -c -
echo '375fd8abab657d18578554927d23abfc9cb3b6794bd9839330230cf5f9fcea26 ffmpeg-6.0.1.tar.gz' | sha256sum -c -
echo '5dea48d1fcddc3ec571ce2058e13910a0d4a6bab4cc09a809d8b1dd1c88ae6f2 fmt-9.1.0.tar.gz' | sha256sum -c -
echo '697f91700237dbae2326b90469be32b876b2b44888302afbc7aceb68bcfe8224 spdlog-1.10.0.tar.gz' | sha256sum -c -
echo '8aff985da30aaab37edf8e5b02fda33ed4cbdd962699a8e2af98fdef306f4e4d flatbuffers-23.3.3.tar.gz' | sha256sum -c -
echo 'e4018e850f80700acee8da296e56e15b1eef711ab15157e542e7d7e1237c3476 fstrcmp-0.7.D001.tar.gz' | sha256sum -c -
echo '4dae6fdcd2bb0bb6c37b5f97c33c2be954da743985369cddac3546e3218bffb8 pcre-8.45.tar.bz2' | sha256sum -c -
echo '395a69a81d5e9915d360d630663c1d98534c9dec134cb267798e49370855d93d apache-groovy-binary-4.0.33.zip' | sha256sum -c -
echo '08b93712bed7f48725d93c44d70c71e7e661af390f22f0f3e6ba61e3af3cea36 commons-lang3-3.17.0-bin.tar.gz' | sha256sum -c -
echo 'a690c1e868a373f2d0fa5e7e89f5359b24e544d1b5e310f5a709d95a03a95df5 commons-text-1.13.0-bin.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/kodi
SRC=$SRC_ROOT/kodi-21.3
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf kodi-21.3.tar.gz -C "$SRC" --strip-components=1
tar --no-same-permissions --warning=no-unknown-keyword -xf crossguid-ca1bf4b810e2d188d04cb6286f957008ee1b7681.tar.gz -C "$SRC_ROOT"
tar --no-same-permissions --warning=no-unknown-keyword -xf libdvdcss-1.4.3-Next-Nexus-Alpha2-2.tar.gz -C "$SRC_ROOT"
tar --no-same-permissions --warning=no-unknown-keyword -xf libdvdnav-6.1.1-Next-Nexus-Alpha2-2.tar.gz -C "$SRC_ROOT"
tar --no-same-permissions --warning=no-unknown-keyword -xf libdvdread-6.1.3-Next-Nexus-Alpha2-2.tar.gz -C "$SRC_ROOT"
tar --no-same-permissions --warning=no-unknown-keyword -xf ffmpeg-6.0.1.tar.gz -C "$SRC_ROOT"
tar --no-same-permissions --warning=no-unknown-keyword -xf fmt-9.1.0.tar.gz -C "$SRC_ROOT"
tar --no-same-permissions --warning=no-unknown-keyword -xf spdlog-1.10.0.tar.gz -C "$SRC_ROOT"
tar --no-same-permissions --warning=no-unknown-keyword -xf flatbuffers-23.3.3.tar.gz -C "$SRC_ROOT"
tar --no-same-permissions --warning=no-unknown-keyword -xf fstrcmp-0.7.D001.tar.gz -C "$SRC_ROOT"
tar --no-same-permissions --warning=no-unknown-keyword -xf pcre-8.45.tar.bz2 -C "$SRC_ROOT"
cp apache-groovy-binary-4.0.33.zip "$SRC"
tar --no-same-permissions --warning=no-unknown-keyword -xf commons-lang3-3.17.0-bin.tar.gz -C "$SRC_ROOT"
tar --no-same-permissions --warning=no-unknown-keyword -xf commons-text-1.13.0-bin.tar.gz -C "$SRC_ROOT"
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 _codename, _mirror, _crossguid, _dvdcss, _dvdnav, _dvdread, _ffmpeg, _fmt, _spdlog, _flatbuf, _fstrcmp, _pcre, _groovy, _langver, _textver and the five paths PKGNAME, PORT_SRC, SRC_ROOT, SRC and PKG set as shell variables. Its body, verbatim:
for _p in fix-musl-incompability gcc13 lfs64 gcc15-musl dyn-pagesize; do
patch -p1 -i "$PORT_SRC/$_p.patch"
done
patch -p1 -i "$PORT_SRC/fmt-imported-configs.patch"
patch -p1 -i "$PORT_SRC/texturepacker-giflib6.patch"
patch -p1 -i "$PORT_SRC/pcre-cmp0026.patch"
patch -p1 -i "$PORT_SRC/platformdefs-limits.patch"
_src() {
if [ -f "$PORT_SRC/$1" ]; then echo "$PORT_SRC/$1"; else echo "$SOURCE_DIR/$1"; fi
}
python3 -m zipfile -e "apache-groovy-binary-$_groovy.zip" "$SRC_ROOT/groovy"
_groovydir="$SRC_ROOT/groovy/groovy-$_groovy"
export LDFLAGS="$LDFLAGS -Wl,-z,stack-size=2097152"
export CFLAGS="$CFLAGS -D_LARGEFILE64_SOURCE"
export CXXFLAGS="$CXXFLAGS -D_LARGEFILE64_SOURCE"
export CMAKE_POLICY_VERSION_MINIMUM=3.5
mkdir build && cd build
cmake .. -G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/usr \
-DCMAKE_INSTALL_LIBDIR=lib \
-DCORE_PLATFORM_NAME=wayland \
-DAPP_RENDER_SYSTEM=gles \
-DENABLE_VAAPI=ON \
-DENABLE_VDPAU=OFF \
-DENABLE_GOLD=OFF \
-DENABLE_LLD=OFF \
-DENABLE_MOLD=OFF \
-DUSE_LTO=OFF \
-DENABLE_SSE=ON \
-DENABLE_SSE2=ON \
-DENABLE_SSE3=OFF \
-DENABLE_SSSE3=OFF \
-DENABLE_SSE4_1=OFF \
-DENABLE_SSE4_2=OFF \
-DENABLE_AVX=OFF \
-DENABLE_AVX2=OFF \
-DENABLE_TESTING=OFF \
-DENABLE_EVENTCLIENTS=OFF \
-DENABLE_PYTHON=ON \
-DENABLE_UPNP=ON \
-DENABLE_OPTICAL=ON \
-DENABLE_DVDCSS=ON \
-DENABLE_AIRTUNES=ON \
-DENABLE_ALSA=ON \
-DENABLE_PULSEAUDIO=ON \
-DENABLE_PIPEWIRE=ON \
-DENABLE_AVAHI=ON \
-DENABLE_BLUETOOTH=ON \
-DENABLE_BLURAY=ON \
-DENABLE_CAP=ON \
-DENABLE_DAV1D=ON \
-DENABLE_DBUS=ON \
-DENABLE_LCMS2=ON \
-DENABLE_MICROHTTPD=ON \
-DENABLE_PLIST=ON \
-DENABLE_SMBCLIENT=ON \
-DENABLE_UDEV=ON \
-DENABLE_UDFREAD=ON \
-DENABLE_XSLT=ON \
-DENABLE_CEC=ON \
-DENABLE_NFS=ON \
-DENABLE_ISO9660PP=ON \
-DENABLE_LIRCCLIENT=ON \
-DENABLE_MDNS=OFF \
-DENABLE_SNDIO=OFF \
-DENABLE_MARIADBCLIENT=OFF \
-DENABLE_MYSQLCLIENT=OFF \
-DENABLE_INTERNAL_FFMPEG=ON \
-DENABLE_INTERNAL_DAV1D=OFF \
-DENABLE_INTERNAL_CROSSGUID=ON \
-DENABLE_INTERNAL_CEC=OFF \
-DENABLE_INTERNAL_NFS=OFF \
-DENABLE_INTERNAL_FLATBUFFERS=ON \
-DENABLE_INTERNAL_FMT=ON \
-DENABLE_INTERNAL_SPDLOG=ON \
-DENABLE_INTERNAL_FSTRCMP=ON \
-DENABLE_INTERNAL_PCRE=ON \
-DENABLE_INTERNAL_RapidJSON=OFF \
-DENABLE_INTERNAL_TAGLIB=OFF \
-DENABLE_INTERNAL_UDFREAD=OFF \
-DENABLE_INTERNAL_KISSFFT=ON \
-DENABLE_INTERNAL_GTEST=OFF \
-DCROSSGUID_URL="$(_src "crossguid-$_crossguid.tar.gz")" \
-DLIBDVDCSS_URL="$(_src "libdvdcss-$_dvdcss.tar.gz")" \
-DLIBDVDNAV_URL="$(_src "libdvdnav-$_dvdnav.tar.gz")" \
-DLIBDVDREAD_URL="$(_src "libdvdread-$_dvdread.tar.gz")" \
-DFFMPEG_URL="$(_src "ffmpeg-$_ffmpeg.tar.gz")" \
-DFMT_URL="$(_src "fmt-$_fmt.tar.gz")" \
-DSPDLOG_URL="$(_src "spdlog-$_spdlog.tar.gz")" \
-DFLATBUFFERS_URL="$(_src "flatbuffers-$_flatbuf.tar.gz")" \
-DFSTRCMP_URL="$(_src "fstrcmp-$_fstrcmp.tar.gz")" \
-DPCRE_URL="$(_src "pcre-$_pcre.tar.bz2")" \
-Dgroovy_SOURCE_DIR="$_groovydir" \
-Dapache-commons-lang_SOURCE_DIR="$SRC_ROOT/commons-lang3-$_langver" \
-Dapache-commons-text_SOURCE_DIR="$SRC_ROOT/commons-text-$_textver" \
-Wno-dev
ninja crossguid
ninja
DESTDIR=$PKG ninja install
cd ..
rm -f "$PKG/usr/bin/TexturePacker"
rm -rf "$PKG/usr/share/xsessions" "$PKG/usr/share/wayland-sessions" \
"$PKG/usr/lib/firewalld"
install -Dm644 /dev/stdin "$PKG/usr/share/kodi/system/settings/appliance.xml" <<'XML'
<?xml version="1.0" encoding="utf-8" ?>
<settings version="1">
<section id="system">
<category id="addons">
<group id="1">
<setting id="general.addonupdates">
<default>2</default>
</setting>
</group>
</category>
</section>
</settings>
XML
cat > "$PKG/usr/share/applications/kodi.desktop" <<'DESKTOP'
[Desktop Entry]
Type=Application
Name=Kodi
GenericName=Media Center
Comment=Watch and listen to your videos, music and pictures
TryExec=kodi
Exec=kodi
Icon=kodi
Terminal=false
StartupWMClass=Kodi
Categories=AudioVideo;Video;Player;TV;
Keywords=kodi;xbmc;media;center;tv;movies;music;player;
Actions=Fullscreen;
[Desktop Action Fullscreen]
Name=Open in Full Screen
Exec=kodi -fs
DESKTOP
chmod 644 "$PKG/usr/share/applications/kodi.desktop"
The switches, and why each is set:
-DCORE_PLATFORM_NAME=wayland— Build Kodi’s Wayland windowing back end, the only one: no X11 and no direct-to-DRM (GBM) build.-DAPP_RENDER_SYSTEM=gles— Render with OpenGL ES rather than desktop OpenGL.-DENABLE_VAAPI=ON— Hardware video decoding through libva.-DENABLE_VDPAU=OFFbuilds no VDPAU path, an X11 interface with no port here.-DENABLE_GOLD=OFF— With-DENABLE_LLD=OFF,-DENABLE_MOLD=OFFand-DUSE_LTO=OFF: link with the ordinaryld, take no alternative linker, and do no link-time optimisation. The binutils port builds no gold.-DENABLE_SSE=ON— With-DENABLE_SSE2=ONand-DENABLE_SSE3=OFFthrough-DENABLE_AVX2=OFF: fix the SIMD level at SSE2, the x86-64 baseline. Left alone, Kodi’sFindSSE.cmakereads the builder’s/proc/cpuinfo, andArchSetup.cmaketurns on every level up to SSE4.1 that the building processor has, for every machine the package later runs on.-DENABLE_TESTING=OFF— Build no test suite.-DENABLE_EVENTCLIENTS=OFFbuilds none of the event-client programs that send remote-control events to Kodi over the network.-DENABLE_PYTHON=ON— The optional features are each namedON. Left unset, a missing library drops its feature with only a line in the configure summary; setON, a missing one stops the configure. The features are Python add-ons, UPnP, optical discs with libdvdcss, AirTunes (shairplay), ALSA, PulseAudio and PipeWire output, Avahi, BlueZ, Blu-ray, libcap, dav1d, D-Bus, LCMS2, the web server (libmicrohttpd), plist (AirPlay), Samba shares, udev, udfread, XSLT, HDMI-CEC (libcec), NFS shares (libnfs), ISO9660++ (libcdio’s C++ binding) and the LIRC client.-DENABLE_MDNS=OFF— With-DENABLE_SNDIO=OFF,-DENABLE_MARIADBCLIENT=OFFand-DENABLE_MYSQLCLIENT=OFF: build without the mDNSResponder client library (dnssdormDNSEmbedded; Zeroconf goes through Avahi), sndio output, and a MariaDB or MySQL server as a shared media library.-DENABLE_INTERNAL_FFMPEG=ON— Build Kodi’s pinned FFmpeg and link it in. Kodi’sFindFFMPEG.cmakeasks pkg-config for every FFmpeg library including libpostproc, and the ffmpeg port is a release that has no libpostproc.-DENABLE_INTERNAL_CROSSGUID=ON— With-DENABLE_INTERNAL_FLATBUFFERS=ON,-DENABLE_INTERNAL_FMT=ON,-DENABLE_INTERNAL_SPDLOG=ON,-DENABLE_INTERNAL_FSTRCMP=ON,-DENABLE_INTERNAL_PCRE=ONand-DENABLE_INTERNAL_KISSFFT=ON: build these from the copies Kodi pins and link them in statically. crossguid, flatbuffers, fstrcmp, PCRE 1 and kissfft are not ports. fmt is, at a release Kodi does not build against, and Kodi’sCMakeLists.txtforces an internal spdlog whenever fmt is internal.-DENABLE_INTERNAL_DAV1D=OFF— With-DENABLE_INTERNAL_CEC=OFF,-DENABLE_INTERNAL_NFS=OFF,-DENABLE_INTERNAL_RapidJSON=OFF,-DENABLE_INTERNAL_TAGLIB=OFF,-DENABLE_INTERNAL_UDFREAD=OFFand-DENABLE_INTERNAL_GTEST=OFF: take each of these from its port, never from Kodi’s pinned copy. gtest is looked for only when-DENABLE_TESTINGis on, so it is not independs.-DCROSSGUID_URL— With-DLIBDVDCSS_URL,-DLIBDVDNAV_URL,-DLIBDVDREAD_URL,-DFFMPEG_URL,-DFMT_URL,-DSPDLOG_URL,-DFLATBUFFERS_URL,-DFSTRCMP_URLand-DPCRE_URL: give every library Kodi would download as a local archive, a source of this recipe._srcnames the copy beside the recipe aftermake fetch, or the one in kpkg’s source directory on a machine that rebuilds from its own cache. Kodi checks each archive against the hash in its owntools/depends/target/*/*-VERSIONfile before it builds it.-Dgroovy_SOURCE_DIR— With-Dapache-commons-lang_SOURCE_DIRand-Dapache-commons-text_SOURCE_DIR: where the Groovy and Apache Commons jars are unpacked. The Python add-on bindings are generated by a Groovy script run on openjdk at build time; given these directories, the build does not download them. Groovy must be a release that reads the class files of the openjdk port’s Java; an older one stops with “Unsupported class file major version” (A JVM tool older than the JDK).-Wl,-z,stack-size=2097152— Ask for a 2 MiB default thread stack. musl gives a thread 128 KiB unless the executable asks for more, and Kodi’s threads need more than that.-D_LARGEFILE64_SOURCE— Kodi hands its compiler flags, and nothing else, to each library it builds from source, and some of them (spdlog and Kodi’s libdvdread among them) callfseeko64andfstat64, which musl declares only under this macro, so it goes intoCFLAGSandCXXFLAGS.CMAKE_POLICY_VERSION_MINIMUM=3.5— Exported, rather than given as a-D, because PCRE’s own CMake run asks for a CMake older than 3.5 and only the environment reaches that nested run (An old CMake policy floor).
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/kodi, 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 kodi-21.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/kodi, and runs the triggers its paths call for.
Contents
Installed programs: kodi, kodi-TexturePacker, kodi-standalone.
Installed directories: /usr/include/kodi, /usr/lib/kodi, /usr/share/doc/kodi, /usr/share/kodi, /usr/share/licenses/kodi.
Notes
- Patch order. One hunk of
lfs64.patchinemu_msvcrt.cppcarries, as context, a line thatfix-musl-incompability.patchwrites, so it applies only after that patch, as the loop inbuild.shorders them. - Parallel link. The static
libcrossguid.ais not a tracked output of its external project, so a parallel build can reach the link before it exists;ninja crossguidbuilds it first. - What
build.shremoves. The X and Wayland session files (no display manager reads them), the firewalld service definitions (no firewalld runs here), and/usr/bin/TexturePacker. - Add-on updates default to never. Kodi otherwise contacts its add-on repository at every start.
build.shinstallssystem/settings/appliance.xml, the settings file Kodi loads after every other so that it can override their defaults, settinggeneral.addonupdatesto 2, “Never check for updates” (AUTO_UPDATES_NEVERinsystem/settings/settings.xml). Settings > System > Add-ons turns updates back on. - The menu entry is replaced so that
StartupWMClassisKodi, Kodi’s application name and its Wayland app_id. - The Groovy and Commons jars, the fonts bundled in the skins and the web interface’s JavaScript are the exceptions to compiling everything here; see What is built from source.