kodi: package build-time tools separately (#404040)

This commit is contained in:
Colin 2025-06-02 00:47:58 +00:00 committed by GitHub
commit 184cf80254
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -186,9 +186,65 @@ let
lib.optional gbmSupport "gbm"
++ lib.optional waylandSupport "wayland"
++ lib.optional x11Support "x11";
in
stdenv.mkDerivation (finalAttrs: {
stdenv.mkDerivation (
finalAttrs:
let
texturePacker = buildPackages.callPackage (
{
cmake,
giflib,
libjpeg,
libpng,
lzo,
stdenv,
zlib,
pkg-config,
}:
stdenv.mkDerivation {
pname = finalAttrs.pname + "-build-tool-texture-packer";
inherit (finalAttrs) version src;
sourceRoot = "${finalAttrs.src.name}/tools/depends/native/TexturePacker/src";
nativeBuildInputs = [
pkg-config
cmake
];
buildInputs = [
giflib
libjpeg
libpng
lzo
zlib
];
env.NIX_CFLAGS_COMPILE = lib.optionalString (!stdenv.hostPlatform.isWindows) "-DTARGET_POSIX";
preConfigure = ''
cmakeFlagsArray+=(-DKODI_SOURCE_DIR=$src -DCMAKE_MODULE_PATH=$src/cmake/modules)
'';
meta.mainProgram = "TexturePacker";
}
) { };
jsonSchemaBuilder = buildPackages.callPackage (
{ stdenv, cmake }:
stdenv.mkDerivation {
pname = finalAttrs.pname + "-build-tool-json-schema-builder";
inherit (finalAttrs) version src;
sourceRoot = "${finalAttrs.src.name}/tools/depends/native/JsonSchemaBuilder/src";
nativeBuildInputs = [ cmake ];
meta.mainProgram = "JsonSchemaBuilder";
}
) { };
in
{
pname = "kodi";
version = "21.2";
kodiReleaseName = "Omega";
@ -289,7 +345,6 @@ stdenv.mkDerivation (finalAttrs: {
libcrossguid
libplist
bluez
giflib
glib
harfbuzz
lcms2
@ -300,6 +355,12 @@ stdenv.mkDerivation (finalAttrs: {
rapidjson
lirc
mesa-gl-headers
# Deps needed by TexturePacker, which is built and installed in normal
# kodi build, however the one used during the build is not this one
# in order to support cross-compilation.
giflib
zlib
]
++ lib.optionals x11Support [
libX11
@ -352,13 +413,6 @@ stdenv.mkDerivation (finalAttrs: {
gettext
python3Packages.python
flatbuffers
# for TexturePacker
giflib
zlib
libpng
libjpeg
lzo
]
++ lib.optionals waylandSupport [
wayland-protocols
@ -391,6 +445,7 @@ stdenv.mkDerivation (finalAttrs: {
"-DFLATBUFFERS_FLATC_EXECUTABLE=${buildPackages.flatbuffers}/bin/flatc"
"-DPYTHON_EXECUTABLE=${buildPackages.python3Packages.python}/bin/python"
"-DPYTHON_LIB_PATH=${python3Packages.python.sitePackages}"
"-DWITH_JSONSCHEMABUILDER=${lib.getExe jsonSchemaBuilder}"
# When wrapped KODI_HOME will likely contain symlinks to static assets
# that Kodi's built in webserver will cautiously refuse to serve up
# (because their realpaths are outside of KODI_HOME and the other
@ -400,24 +455,17 @@ stdenv.mkDerivation (finalAttrs: {
]
++ lib.optionals waylandSupport [
"-DWAYLANDPP_SCANNER=${buildPackages.waylandpp}/bin/wayland-scanner++"
]
++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
"-DWITH_TEXTUREPACKER=${lib.getExe texturePacker}"
];
# 14 tests fail but the biggest issue is that every test takes 30 seconds -
# I'm guessing there is a thing waiting to time out
doCheck = false;
preConfigure =
''
preConfigure = ''
cmakeFlagsArray+=("-DCORE_PLATFORM_NAME=${lib.concatStringsSep " " kodi_platforms}")
''
+ lib.optionalString (stdenv.hostPlatform != stdenv.buildPlatform) ''
# Need these tools on the build system when cross compiling,
# hacky, but have found no other way.
CXX=$CXX_FOR_BUILD LD=ld make -C tools/depends/native/JsonSchemaBuilder
appendToVar cmakeFlags "-DWITH_JSONSCHEMABUILDER=$PWD/tools/depends/native/JsonSchemaBuilder/bin"
CXX=$CXX_FOR_BUILD LD=ld make EXTRA_CONFIGURE= -C tools/depends/native/TexturePacker
appendToVar cmakeFlags "-DWITH_TEXTUREPACKER=$PWD/tools/depends/native/TexturePacker/bin"
'';
postInstall = ''
@ -476,4 +524,5 @@ stdenv.mkDerivation (finalAttrs: {
teams = [ teams.kodi ];
mainProgram = "kodi";
};
})
}
)