Merge pull request #115871 from aanderse/kodi-packages

kodi: plugins cleanup
This commit is contained in:
Aaron Andersen 2021-03-13 10:10:20 -05:00 committed by GitHub
commit 0bf8f56105
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 388 additions and 383 deletions

View file

@ -57,6 +57,13 @@
for the motivation).
</para>
</listitem>
<listitem>
<para>
<link xlink:href="https://kodi.tv/">Kodi</link> has been updated to version 19.0 "Matrix". See
the <link xlink:href="https://kodi.tv/article/kodi-190-matrix-release">announcement</link> for
further details.
</para>
</listitem>
</itemizedlist>
</section>
@ -577,6 +584,37 @@ self: super:
for your Kafka version.
</para>
</listitem>
<listitem>
<para>
The <package>kodi</package> package has been modified to allow concise addon management. Consider
the following configuration from previous releases of NixOS to install <package>kodi</package>,
including the <package>kodiPackages.inputstream-adaptive</package> and <package>kodiPackages.vfs-sftp</package>
addons:
<programlisting>
environment.systemPackages = [
pkgs.kodi
];
nixpkgs.config.kodi = {
enableInputStreamAdaptive = true;
enableVFSSFTP = true;
};
</programlisting>
All Kodi <literal>config</literal> flags have been removed, and as a result the above configuration
should now be written as:
<programlisting>
environment.systemPackages = [
(pkgs.kodi.withPackages (p: with p; [
inputstream-adaptive
vfs-sftp
]))
];
</programlisting>
</para>
</listitem>
</itemizedlist>
</section>

View file

@ -1,250 +1,14 @@
{ stdenv, lib, fetchFromGitHub, autoconf, automake, libtool, makeWrapper
, pkg-config, cmake, gnumake, yasm, python3Packages
, libgcrypt, libgpgerror, libunistring
, boost, avahi, lame
, gettext, pcre-cpp, yajl, fribidi, which
, openssl, gperf, tinyxml2, taglib, libssh, swig, jre_headless
, gtest, ncurses, spdlog
, libxml2, systemd
, alsaLib, libGLU, libGL, fontconfig, freetype, ftgl
, libjpeg, libpng, libtiff
, libmpeg2, libsamplerate, libmad
, libogg, libvorbis, flac, libxslt
, lzo, libcdio, libmodplug, libass, libbluray
, sqlite, libmysqlclient, nasm, gnutls, libva, libdrm
, curl, bzip2, zip, unzip, glxinfo
, libcec, libcec_platform, dcadec, libuuid
, libcrossguid, libmicrohttpd
, bluez, doxygen, giflib, glib, harfbuzz, lcms2, libidn, libpthreadstubs, libtasn1
, libplist, p11-kit, zlib, flatbuffers, fmt, fstrcmp, rapidjson
, lirc
, x11Support ? true, libX11, xorgproto, libXt, libXmu, libXext, libXinerama, libXrandr, libXtst, libXfixes, xdpyinfo, libXdmcp
, dbusSupport ? true, dbus ? null
, joystickSupport ? true, cwiid ? null
, nfsSupport ? true, libnfs ? null
, pulseSupport ? true, libpulseaudio ? null
, rtmpSupport ? true, rtmpdump ? null
, sambaSupport ? true, samba ? null
, udevSupport ? true, udev ? null
, usbSupport ? false, libusb-compat-0_1 ? null
, vdpauSupport ? true, libvdpau ? null
, useWayland ? false, wayland ? null, wayland-protocols ? null
, waylandpp ? null, libxkbcommon ? null
, useGbm ? false, mesa ? null, libinput ? null
, buildPackages
}:
assert dbusSupport -> dbus != null;
assert nfsSupport -> libnfs != null;
assert pulseSupport -> libpulseaudio != null;
assert rtmpSupport -> rtmpdump != null;
assert sambaSupport -> samba != null;
assert udevSupport -> udev != null;
assert usbSupport -> libusb-compat-0_1 != null && ! udevSupport; # libusb-compat-0_1 won't be used if udev is avaliable
assert vdpauSupport -> libvdpau != null;
assert useWayland -> wayland != null && wayland-protocols != null && waylandpp != null && libxkbcommon != null;
assert useGbm || useWayland || x11Support;
{ callPackage, ... } @ args:
let
kodiReleaseDate = "20210219";
kodiVersion = "19.0";
rel = "Matrix";
kodi_src = fetchFromGitHub {
owner = "xbmc";
repo = "xbmc";
rev = "${kodiVersion}-${rel}";
sha256 = "097dg6a7v4ia85jx1pmlpwzdpqcqxlrmniqd005q73zvgj67zc2p";
};
ffmpeg = stdenv.mkDerivation rec {
pname = "kodi-ffmpeg";
version = "4.3.1";
src = fetchFromGitHub {
owner = "xbmc";
repo = "FFmpeg";
rev = "${version}-${rel}-Beta1";
sha256 = "1c5rwlxn6xj501iw7masdv2p6wb9rkmd299lmlkx97sw1kvxvg2w";
unwrapped = callPackage ./unwrapped.nix (removeAttrs args [ "callPackage" ]);
kodiPackages = callPackage ./packages.nix { kodi = unwrapped; };
in
unwrapped.overrideAttrs (oldAttrs: {
passthru = oldAttrs.passthru // {
packages = kodiPackages;
withPackages = func: callPackage ./wrapper.nix {
kodi = unwrapped;
addons = kodiPackages.requiredKodiAddons (func kodiPackages);
};
};
preConfigure = ''
cp ${kodi_src}/tools/depends/target/ffmpeg/{CMakeLists.txt,*.cmake} .
sed -i 's/ --cpu=''${CPU}//' CMakeLists.txt
sed -i 's/--strip=''${CMAKE_STRIP}/--strip=''${CMAKE_STRIP} --ranlib=''${CMAKE_RANLIB}/' CMakeLists.txt
'';
cmakeFlags = lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
"-DCROSSCOMPILING=ON"
"-DCPU=${stdenv.hostPlatform.parsed.cpu.name}"
"-DOS=${stdenv.hostPlatform.parsed.kernel.name}"
"-DPKG_CONFIG_EXECUTABLE=pkg-config"
];
buildInputs = [ libidn libtasn1 p11-kit zlib libva ]
++ lib.optional vdpauSupport libvdpau;
nativeBuildInputs = [ cmake nasm pkg-config gnutls ];
};
# We can build these externally but FindLibDvd.cmake forces us to build it
# them, so we currently just use them for the src.
libdvdcss = fetchFromGitHub {
owner = "xbmc";
repo = "libdvdcss";
rev = "1.4.2-${rel}-Beta-5";
sha256 = "0j41ydzx0imaix069s3z07xqw9q95k7llh06fc27dcn6f7b8ydyl";
};
libdvdnav = fetchFromGitHub {
owner = "xbmc";
repo = "libdvdnav";
rev = "6.0.0-${rel}-Alpha-3";
sha256 = "0qwlf4lgahxqxk1r2pzl866mi03pbp7l1fc0rk522sc0ak2s9jhb";
};
libdvdread = fetchFromGitHub {
owner = "xbmc";
repo = "libdvdread";
rev = "6.0.0-${rel}-Alpha-3";
sha256 = "1xxn01mhkdnp10cqdr357wx77vyzfb5glqpqyg8m0skyi75aii59";
};
kodi_platforms =
lib.optional useGbm "gbm" ++
lib.optional useWayland "wayland" ++
lib.optional x11Support "x11"
;
in stdenv.mkDerivation {
name = "kodi-${lib.optionalString useWayland "wayland-"}${kodiVersion}";
src = kodi_src;
buildInputs = [
gnutls libidn libtasn1 nasm p11-kit
libxml2 python3Packages.python
boost libmicrohttpd
gettext pcre-cpp yajl fribidi libva libdrm
openssl gperf tinyxml2 taglib libssh
gtest ncurses spdlog
alsaLib libGL libGLU fontconfig freetype ftgl
libjpeg libpng libtiff
libmpeg2 libsamplerate libmad
libogg libvorbis flac libxslt systemd
lzo libcdio libmodplug libass libbluray
sqlite libmysqlclient avahi lame
curl bzip2 zip unzip glxinfo
libcec libcec_platform dcadec libuuid
libgcrypt libgpgerror libunistring
libcrossguid libplist
bluez giflib glib harfbuzz lcms2 libpthreadstubs
ffmpeg flatbuffers fmt fstrcmp rapidjson
lirc
]
++ lib.optional x11Support [
libX11 xorgproto libXt libXmu libXext.dev libXdmcp
libXinerama libXrandr.dev libXtst libXfixes
]
++ lib.optional dbusSupport dbus
++ lib.optional joystickSupport cwiid
++ lib.optional nfsSupport libnfs
++ lib.optional pulseSupport libpulseaudio
++ lib.optional rtmpSupport rtmpdump
++ lib.optional sambaSupport samba
++ lib.optional udevSupport udev
++ lib.optional usbSupport libusb-compat-0_1
++ lib.optional vdpauSupport libvdpau
++ lib.optionals useWayland [
wayland
waylandpp.dev
wayland-protocols
# Not sure why ".dev" is needed here, but CMake doesn't find libxkbcommon otherwise
libxkbcommon.dev
]
++ lib.optional useGbm [
libxkbcommon.dev
mesa.dev
libinput.dev
];
nativeBuildInputs = [
cmake
doxygen
makeWrapper
which
pkg-config gnumake
autoconf automake libtool # still needed for some components. Check if that is the case with 19.0
jre_headless yasm gettext python3Packages.python flatbuffers
# for TexturePacker
giflib zlib libpng libjpeg lzo
] ++ lib.optionals useWayland [ wayland-protocols waylandpp.bin ];
depsBuildBuild = [
buildPackages.stdenv.cc
];
cmakeFlags = [
"-DAPP_RENDER_SYSTEM=${if useGbm then "gles" else "gl"}"
"-Dlibdvdcss_URL=${libdvdcss}"
"-Dlibdvdnav_URL=${libdvdnav}"
"-Dlibdvdread_URL=${libdvdread}"
"-DGIT_VERSION=${kodiReleaseDate}"
"-DENABLE_EVENTCLIENTS=ON"
"-DENABLE_INTERNAL_CROSSGUID=OFF"
"-DENABLE_OPTICAL=ON"
"-DLIRC_DEVICE=/run/lirc/lircd"
"-DSWIG_EXECUTABLE=${buildPackages.swig}/bin/swig"
"-DFLATBUFFERS_FLATC_EXECUTABLE=${buildPackages.flatbuffers}/bin/flatc"
"-DPYTHON_EXECUTABLE=${buildPackages.python3Packages.python}/bin/python"
] ++ lib.optional useWayland [
"-DWAYLANDPP_SCANNER=${buildPackages.waylandpp}/bin/wayland-scanner++"
];
# 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 = ''
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=${stdenv.cc.targetPrefix}c++ LD=ld make -C tools/depends/native/JsonSchemaBuilder
cmakeFlags+=" -DWITH_JSONSCHEMABUILDER=$PWD/tools/depends/native/JsonSchemaBuilder/bin"
CXX=${stdenv.cc.targetPrefix}c++ LD=ld make EXTRA_CONFIGURE= -C tools/depends/native/TexturePacker
cmakeFlags+=" -DWITH_TEXTUREPACKER=$PWD/tools/depends/native/TexturePacker/bin"
'';
postPatch = ''
substituteInPlace xbmc/platform/posix/PosixTimezone.cpp \
--replace 'usr/share/zoneinfo' 'etc/zoneinfo'
'';
postInstall = ''
for p in $(ls $out/bin/) ; do
wrapProgram $out/bin/$p \
--prefix PATH ":" "${lib.makeBinPath ([ python3Packages.python glxinfo ] ++ lib.optional x11Support xdpyinfo ++ lib.optional sambaSupport samba)}" \
--prefix LD_LIBRARY_PATH ":" "${lib.makeLibraryPath
([ curl systemd libmad libvdpau libcec libcec_platform libass ]
++ lib.optional nfsSupport libnfs
++ lib.optional rtmpSupport rtmpdump)}"
done
substituteInPlace $out/share/xsessions/kodi.desktop \
--replace kodi-standalone $out/bin/kodi-standalone
'';
doInstallCheck = true;
installCheckPhase = "$out/bin/kodi --version";
passthru = {
pythonPackages = python3Packages;
};
meta = with lib; {
description = "Media center";
homepage = "https://kodi.tv/";
license = licenses.gpl2;
platforms = platforms.linux;
maintainers = with maintainers; [ titanous edwtjo peterhoeg sephalon ];
};
}
})

View file

@ -1,5 +1,5 @@
{ lib, stdenv, callPackage, fetchFromGitHub
, cmake, kodiPlain, libcec_platform, tinyxml, pugixml
, cmake, kodi, libcec_platform, tinyxml, pugixml
, steam, udev, libusb1, jsoncpp, libhdhomerun, zlib
, python3Packages, expat, glib, nspr, nss, openssl
, libssh, libarchive, lzma, bzip2, lz4, lzo }:
@ -8,32 +8,27 @@ with lib;
let self = rec {
pluginDir = "/share/kodi/addons";
addonDir = "/share/kodi/addons";
rel = "Matrix";
kodi = kodiPlain;
inherit kodi;
# Convert derivation to a kodi module. Stolen from ../../../top-level/python-packages.nix
toKodiPlugin = drv: drv.overrideAttrs(oldAttrs: {
toKodiAddon = drv: drv.overrideAttrs(oldAttrs: {
# Use passthru in order to prevent rebuilds when possible.
passthru = (oldAttrs.passthru or {})// {
kodiPluginFor = kodi;
requiredKodiPlugins = requiredKodiPlugins drv.propagatedBuildInputs;
kodiAddonFor = kodi;
requiredKodiAddons = requiredKodiAddons drv.propagatedBuildInputs;
};
});
# Check whether a derivation provides a Kodi plugin.
hasKodiPlugin = drv: drv ? kodiPluginFor && drv.kodiPluginFor == kodi;
# Check whether a derivation provides a Kodi addon.
hasKodiAddon = drv: drv ? kodiAddonFor && drv.kodiAddonFor == kodi;
# Get list of required Kodi plugins given a list of derivations.
requiredKodiPlugins = drvs: let
modules = filter hasKodiPlugin drvs;
in unique (modules ++ concatLists (catAttrs "requiredKodiPlugins" modules));
kodiWithPlugins = func: callPackage ./wrapper.nix {
inherit kodi;
plugins = requiredKodiPlugins (func self);
};
# Get list of required Kodi addons given a list of derivations.
requiredKodiAddons = drvs: let
modules = filter hasKodiAddon drvs;
in unique (modules ++ concatLists (catAttrs "requiredKodiAddons" modules));
kodi-platform = stdenv.mkDerivation rec {
project = "kodi-platform";
@ -48,36 +43,45 @@ let self = rec {
};
nativeBuildInputs = [ cmake ];
buildInputs = [ kodiPlain libcec_platform tinyxml ];
buildInputs = [ kodi libcec_platform tinyxml ];
};
mkKodiPlugin = { plugin, namespace, version, sourceDir ? null, ... }@args:
toKodiPlugin (stdenv.mkDerivation ({
name = "kodi-plugin-${plugin}-${version}";
buildKodiAddon =
{ name ? "${attrs.pname}-${attrs.version}"
, namespace
, sourceDir ? ""
, ... } @ attrs:
toKodiAddon (stdenv.mkDerivation ({
name = "kodi-" + name;
dontStrip = true;
extraRuntimeDependencies = [ ];
installPhase = ''
${if sourceDir == null then "" else "cd $src/$sourceDir"}
d=$out${pluginDir}/${namespace}
cd $src/$sourceDir
d=$out${addonDir}/${namespace}
mkdir -p $d
sauce="."
[ -d ${namespace} ] && sauce=${namespace}
cp -R "$sauce/"* $d
'';
} // args));
} // attrs));
mkKodiABIPlugin = { plugin, namespace, version, extraBuildInputs ? [],
extraRuntimeDependencies ? [], extraInstallPhase ? "", ... }@args:
toKodiPlugin (stdenv.mkDerivation ({
name = "kodi-plugin-${plugin}-${version}";
buildKodiBinaryAddon =
{ name ? "${attrs.pname}-${attrs.version}"
, namespace
, version
, extraBuildInputs ? []
, extraRuntimeDependencies ? []
, extraInstallPhase ? "", ... } @ attrs:
toKodiAddon (stdenv.mkDerivation ({
name = "kodi-" + name;
dontStrip = true;
nativeBuildInputs = [ cmake ];
buildInputs = [ kodiPlain kodi-platform libcec_platform ] ++ extraBuildInputs;
buildInputs = [ kodi kodi-platform libcec_platform ] ++ extraBuildInputs;
inherit extraRuntimeDependencies;
@ -86,25 +90,25 @@ let self = rec {
"-DOVERRIDE_PATHS=1"
];
# kodi checks for plugin .so libs existance in the addon folder (share/...)
# kodi checks for addon .so libs existance in the addon folder (share/...)
# and the non-wrapped kodi lib/... folder before even trying to dlopen
# them. Symlinking .so, as setting LD_LIBRARY_PATH is of no use
installPhase = let n = namespace; in ''
make install
ln -s $out/lib/addons/${n}/${n}.so.${version} $out${pluginDir}/${n}/${n}.so.${version}
ln -s $out/lib/addons/${n}/${n}.so.${version} $out${addonDir}/${n}/${n}.so.${version}
${extraInstallPhase}
'';
} // args));
} // attrs));
advanced-launcher = mkKodiPlugin rec {
advanced-launcher = buildKodiAddon rec {
plugin = "advanced-launcher";
pname = "advanced-launcher";
namespace = "plugin.program.advanced.launcher";
version = "2.5.8";
src = fetchFromGitHub {
owner = "edwtjo";
repo = plugin;
repo = pname;
rev = version;
sha256 = "142vvgs37asq5m54xqhjzqvgmb0xlirvm0kz6lxaqynp0vvgrkx2";
};
@ -127,9 +131,9 @@ let self = rec {
};
advanced-emulator-launcher = mkKodiPlugin rec {
advanced-emulator-launcher = buildKodiAddon rec {
plugin = "advanced-emulator-launcher";
pname = "advanced-emulator-launcher";
namespace = "plugin.program.advanced.emulator.launcher";
version = "0.9.6";
@ -175,8 +179,8 @@ let self = rec {
};
mkController = controller: {
${controller} = mkKodiPlugin rec {
plugin = pname + "-" + controller;
${controller} = buildKodiAddon rec {
pname = pname + "-" + controller;
namespace = "game.controller." + controller;
sourceDir = "addons/" + namespace;
inherit version src meta;
@ -209,23 +213,22 @@ let self = rec {
broken = true; # requires port to python3
};
in {
service = mkKodiPlugin {
plugin = pname + "-service";
service = buildKodiAddon {
pname = pname + "-service";
version = "1.2.1";
namespace = "service.hyper.launcher";
inherit src meta;
};
plugin = mkKodiPlugin {
plugin = pname;
plugin = buildKodiAddon {
namespace = "plugin.hyper.launcher";
inherit version src meta;
inherit pname version src meta;
};
};
joystick = mkKodiABIPlugin rec {
joystick = buildKodiBinaryAddon rec {
pname = namespace;
namespace = "peripheral.joystick";
version = "1.7.1";
plugin = namespace;
src = fetchFromGitHub {
owner = "xbmc";
@ -243,8 +246,8 @@ let self = rec {
extraBuildInputs = [ tinyxml udev ];
};
simpleplugin = mkKodiPlugin rec {
plugin = "simpleplugin";
simpleplugin = buildKodiAddon rec {
pname = "simpleplugin";
namespace = "script.module.simpleplugin";
version = "2.3.2";
@ -263,16 +266,16 @@ let self = rec {
};
};
svtplay = mkKodiPlugin rec {
svtplay = buildKodiAddon rec {
plugin = "svtplay";
pname = "svtplay";
namespace = "plugin.video.svtplay";
version = "5.1.12";
src = fetchFromGitHub {
name = plugin + "-" + version + ".tar.gz";
name = pname + "-" + version + ".tar.gz";
owner = "nilzen";
repo = "xbmc-" + plugin;
repo = "xbmc-" + pname;
rev = "v${version}";
sha256 = "04j1nhm7mh9chs995lz6bv1vsq5xzk7a7c0lmk4bnfv8jrfpj0w6";
};
@ -292,10 +295,10 @@ let self = rec {
};
steam-controller = mkKodiABIPlugin rec {
steam-controller = buildKodiBinaryAddon rec {
pname = namespace;
namespace = "peripheral.steamcontroller";
version = "0.11.0";
plugin = namespace;
src = fetchFromGitHub {
owner = "kodi-game";
@ -314,9 +317,9 @@ let self = rec {
};
steam-launcher = mkKodiPlugin {
steam-launcher = buildKodiAddon {
plugin = "steam-launcher";
pname = "steam-launcher";
namespace = "script.steam.launcher";
version = "3.5.1";
@ -343,8 +346,8 @@ let self = rec {
};
};
pdfreader = mkKodiPlugin rec {
plugin = "pdfreader";
pdfreader = buildKodiAddon rec {
pname = "pdfreader";
namespace = "plugin.image.pdf";
version = "2.0.2";
@ -362,9 +365,9 @@ let self = rec {
};
};
pvr-hts = mkKodiABIPlugin rec {
pvr-hts = buildKodiBinaryAddon rec {
plugin = "pvr-hts";
pname = "pvr-hts";
namespace = "pvr.hts";
version = "8.2.2";
@ -384,9 +387,9 @@ let self = rec {
};
pvr-hdhomerun = mkKodiABIPlugin rec {
pvr-hdhomerun = buildKodiBinaryAddon rec {
plugin = "pvr-hdhomerun";
pname = "pvr-hdhomerun";
namespace = "pvr.hdhomerun";
version = "7.1.0";
@ -408,9 +411,9 @@ let self = rec {
};
pvr-iptvsimple = mkKodiABIPlugin rec {
pvr-iptvsimple = buildKodiBinaryAddon rec {
plugin = "pvr-iptvsimple";
pname = "pvr-iptvsimple";
namespace = "pvr.iptvsimple";
version = "7.4.2";
@ -432,9 +435,9 @@ let self = rec {
extraBuildInputs = [ zlib pugixml ];
};
osmc-skin = mkKodiPlugin rec {
osmc-skin = buildKodiAddon rec {
plugin = "osmc-skin";
pname = "osmc-skin";
namespace = "skin.osmc";
version = "18.0.0";
@ -454,8 +457,8 @@ let self = rec {
};
};
yatp = python3Packages.toPythonModule (mkKodiPlugin rec {
plugin = "yatp";
yatp = python3Packages.toPythonModule (buildKodiAddon rec {
pname = "yatp";
namespace = "plugin.video.yatp";
version = "3.3.2";
@ -482,9 +485,9 @@ let self = rec {
};
});
inputstream-adaptive = mkKodiABIPlugin rec {
inputstream-adaptive = buildKodiBinaryAddon rec {
plugin = "inputstream-adaptive";
pname = "inputstream-adaptive";
namespace = "inputstream.adaptive";
version = "2.6.7";
@ -500,7 +503,7 @@ let self = rec {
extraRuntimeDependencies = [ glib nspr nss stdenv.cc.cc.lib ];
extraInstallPhase = let n = namespace; in ''
ln -s $out/lib/addons/${n}/libssd_wv.so $out/${pluginDir}/${n}/libssd_wv.so
ln -s $out/lib/addons/${n}/libssd_wv.so $out/${addonDir}/${n}/libssd_wv.so
'';
meta = {
@ -511,10 +514,10 @@ let self = rec {
};
};
vfs-sftp = mkKodiABIPlugin rec {
vfs-sftp = buildKodiBinaryAddon rec {
pname = namespace;
namespace = "vfs.sftp";
version = "2.0.0";
plugin = namespace;
src = fetchFromGitHub {
owner = "xbmc";
@ -533,10 +536,10 @@ let self = rec {
extraBuildInputs = [ openssl libssh zlib ];
};
vfs-libarchive = mkKodiABIPlugin rec {
vfs-libarchive = buildKodiBinaryAddon rec {
pname = namespace;
namespace = "vfs.libarchive";
version = "2.0.0";
plugin = namespace;
src = fetchFromGitHub {
owner = "xbmc";

View file

@ -0,0 +1,242 @@
{ stdenv, lib, fetchFromGitHub, autoconf, automake, libtool, makeWrapper
, pkg-config, cmake, gnumake, yasm, python3Packages
, libgcrypt, libgpgerror, libunistring
, boost, avahi, lame
, gettext, pcre-cpp, yajl, fribidi, which
, openssl, gperf, tinyxml2, taglib, libssh, swig, jre_headless
, gtest, ncurses, spdlog
, libxml2, systemd
, alsaLib, libGLU, libGL, fontconfig, freetype, ftgl
, libjpeg, libpng, libtiff
, libmpeg2, libsamplerate, libmad
, libogg, libvorbis, flac, libxslt
, lzo, libcdio, libmodplug, libass, libbluray
, sqlite, libmysqlclient, nasm, gnutls, libva, libdrm
, curl, bzip2, zip, unzip, glxinfo
, libcec, libcec_platform, dcadec, libuuid
, libcrossguid, libmicrohttpd
, bluez, doxygen, giflib, glib, harfbuzz, lcms2, libidn, libpthreadstubs, libtasn1
, libplist, p11-kit, zlib, flatbuffers, fmt, fstrcmp, rapidjson
, lirc
, x11Support ? true, libX11, xorgproto, libXt, libXmu, libXext, libXinerama, libXrandr, libXtst, libXfixes, xdpyinfo, libXdmcp
, dbusSupport ? true, dbus
, joystickSupport ? true, cwiid
, nfsSupport ? true, libnfs
, pulseSupport ? true, libpulseaudio
, rtmpSupport ? true, rtmpdump
, sambaSupport ? true, samba
, udevSupport ? true, udev
, usbSupport ? false, libusb-compat-0_1
, vdpauSupport ? true, libvdpau
, waylandSupport ? false, wayland, wayland-protocols
, waylandpp ? null, libxkbcommon
, gbmSupport ? false, mesa, libinput
, buildPackages
}:
assert usbSupport -> !udevSupport; # libusb-compat-0_1 won't be used if udev is avaliable
assert gbmSupport || waylandSupport || x11Support;
let
kodiReleaseDate = "20210219";
kodiVersion = "19.0";
rel = "Matrix";
kodi_src = fetchFromGitHub {
owner = "xbmc";
repo = "xbmc";
rev = "${kodiVersion}-${rel}";
sha256 = "097dg6a7v4ia85jx1pmlpwzdpqcqxlrmniqd005q73zvgj67zc2p";
};
ffmpeg = stdenv.mkDerivation rec {
pname = "kodi-ffmpeg";
version = "4.3.1";
src = fetchFromGitHub {
owner = "xbmc";
repo = "FFmpeg";
rev = "${version}-${rel}-Beta1";
sha256 = "1c5rwlxn6xj501iw7masdv2p6wb9rkmd299lmlkx97sw1kvxvg2w";
};
preConfigure = ''
cp ${kodi_src}/tools/depends/target/ffmpeg/{CMakeLists.txt,*.cmake} .
sed -i 's/ --cpu=''${CPU}//' CMakeLists.txt
sed -i 's/--strip=''${CMAKE_STRIP}/--strip=''${CMAKE_STRIP} --ranlib=''${CMAKE_RANLIB}/' CMakeLists.txt
'';
cmakeFlags = lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
"-DCROSSCOMPILING=ON"
"-DCPU=${stdenv.hostPlatform.parsed.cpu.name}"
"-DOS=${stdenv.hostPlatform.parsed.kernel.name}"
"-DPKG_CONFIG_EXECUTABLE=pkg-config"
];
buildInputs = [ libidn libtasn1 p11-kit zlib libva ]
++ lib.optional vdpauSupport libvdpau;
nativeBuildInputs = [ cmake nasm pkg-config gnutls ];
};
# We can build these externally but FindLibDvd.cmake forces us to build it
# them, so we currently just use them for the src.
libdvdcss = fetchFromGitHub {
owner = "xbmc";
repo = "libdvdcss";
rev = "1.4.2-${rel}-Beta-5";
sha256 = "0j41ydzx0imaix069s3z07xqw9q95k7llh06fc27dcn6f7b8ydyl";
};
libdvdnav = fetchFromGitHub {
owner = "xbmc";
repo = "libdvdnav";
rev = "6.0.0-${rel}-Alpha-3";
sha256 = "0qwlf4lgahxqxk1r2pzl866mi03pbp7l1fc0rk522sc0ak2s9jhb";
};
libdvdread = fetchFromGitHub {
owner = "xbmc";
repo = "libdvdread";
rev = "6.0.0-${rel}-Alpha-3";
sha256 = "1xxn01mhkdnp10cqdr357wx77vyzfb5glqpqyg8m0skyi75aii59";
};
kodi_platforms = lib.optional gbmSupport "gbm"
++ lib.optional waylandSupport "wayland"
++ lib.optional x11Support "x11";
in stdenv.mkDerivation {
pname = "kodi";
version = kodiVersion;
src = kodi_src;
buildInputs = [
gnutls libidn libtasn1 nasm p11-kit
libxml2 python3Packages.python
boost libmicrohttpd
gettext pcre-cpp yajl fribidi libva libdrm
openssl gperf tinyxml2 taglib libssh
gtest ncurses spdlog
alsaLib libGL libGLU fontconfig freetype ftgl
libjpeg libpng libtiff
libmpeg2 libsamplerate libmad
libogg libvorbis flac libxslt systemd
lzo libcdio libmodplug libass libbluray
sqlite libmysqlclient avahi lame
curl bzip2 zip unzip glxinfo
libcec libcec_platform dcadec libuuid
libgcrypt libgpgerror libunistring
libcrossguid libplist
bluez giflib glib harfbuzz lcms2 libpthreadstubs
ffmpeg flatbuffers fmt fstrcmp rapidjson
lirc
]
++ lib.optional x11Support [
libX11 xorgproto libXt libXmu libXext.dev libXdmcp
libXinerama libXrandr.dev libXtst libXfixes
]
++ lib.optional dbusSupport dbus
++ lib.optional joystickSupport cwiid
++ lib.optional nfsSupport libnfs
++ lib.optional pulseSupport libpulseaudio
++ lib.optional rtmpSupport rtmpdump
++ lib.optional sambaSupport samba
++ lib.optional udevSupport udev
++ lib.optional usbSupport libusb-compat-0_1
++ lib.optional vdpauSupport libvdpau
++ lib.optionals waylandSupport [
wayland
waylandpp.dev
wayland-protocols
# Not sure why ".dev" is needed here, but CMake doesn't find libxkbcommon otherwise
libxkbcommon.dev
]
++ lib.optional gbmSupport [
libxkbcommon.dev
mesa.dev
libinput.dev
];
nativeBuildInputs = [
cmake
doxygen
makeWrapper
which
pkg-config gnumake
autoconf automake libtool # still needed for some components. Check if that is the case with 19.0
jre_headless yasm gettext python3Packages.python flatbuffers
# for TexturePacker
giflib zlib libpng libjpeg lzo
] ++ lib.optionals waylandSupport [ wayland-protocols waylandpp.bin ];
depsBuildBuild = [
buildPackages.stdenv.cc
];
cmakeFlags = [
"-DAPP_RENDER_SYSTEM=${if gbmSupport then "gles" else "gl"}"
"-Dlibdvdcss_URL=${libdvdcss}"
"-Dlibdvdnav_URL=${libdvdnav}"
"-Dlibdvdread_URL=${libdvdread}"
"-DGIT_VERSION=${kodiReleaseDate}"
"-DENABLE_EVENTCLIENTS=ON"
"-DENABLE_INTERNAL_CROSSGUID=OFF"
"-DENABLE_OPTICAL=ON"
"-DLIRC_DEVICE=/run/lirc/lircd"
"-DSWIG_EXECUTABLE=${buildPackages.swig}/bin/swig"
"-DFLATBUFFERS_FLATC_EXECUTABLE=${buildPackages.flatbuffers}/bin/flatc"
"-DPYTHON_EXECUTABLE=${buildPackages.python3Packages.python}/bin/python"
] ++ lib.optional waylandSupport [
"-DWAYLANDPP_SCANNER=${buildPackages.waylandpp}/bin/wayland-scanner++"
];
# 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 = ''
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=${stdenv.cc.targetPrefix}c++ LD=ld make -C tools/depends/native/JsonSchemaBuilder
cmakeFlags+=" -DWITH_JSONSCHEMABUILDER=$PWD/tools/depends/native/JsonSchemaBuilder/bin"
CXX=${stdenv.cc.targetPrefix}c++ LD=ld make EXTRA_CONFIGURE= -C tools/depends/native/TexturePacker
cmakeFlags+=" -DWITH_TEXTUREPACKER=$PWD/tools/depends/native/TexturePacker/bin"
'';
postPatch = ''
substituteInPlace xbmc/platform/posix/PosixTimezone.cpp \
--replace 'usr/share/zoneinfo' 'etc/zoneinfo'
'';
postInstall = ''
for p in $(ls $out/bin/) ; do
wrapProgram $out/bin/$p \
--prefix PATH ":" "${lib.makeBinPath ([ python3Packages.python glxinfo ]
++ lib.optional x11Support xdpyinfo ++ lib.optional sambaSupport samba)}" \
--prefix LD_LIBRARY_PATH ":" "${lib.makeLibraryPath
([ curl systemd libmad libvdpau libcec libcec_platform libass ]
++ lib.optional nfsSupport libnfs
++ lib.optional rtmpSupport rtmpdump)}"
done
substituteInPlace $out/share/xsessions/kodi.desktop \
--replace kodi-standalone $out/bin/kodi-standalone
'';
doInstallCheck = true;
installCheckPhase = "$out/bin/kodi --version";
passthru = {
pythonPackages = python3Packages;
};
meta = with lib; {
description = "Media center";
homepage = "https://kodi.tv/";
license = licenses.gpl2Plus;
platforms = platforms.linux;
maintainers = with maintainers; [ titanous edwtjo peterhoeg sephalon ];
};
}

View file

@ -1,11 +1,9 @@
{ lib, makeWrapper, buildEnv, kodi, plugins }:
{ lib, makeWrapper, buildEnv, kodi, addons }:
let
drvName = builtins.parseDrvName kodi.name;
in buildEnv {
name = "${drvName.name}-with-plugins-${drvName.version}";
buildEnv {
name = "${kodi.name}-env";
paths = [ kodi ] ++ plugins;
paths = [ kodi ] ++ addons;
pathsToLink = [ "/share" ];
buildInputs = [ makeWrapper ];
@ -15,16 +13,11 @@ in buildEnv {
for exe in kodi{,-standalone}
do
makeWrapper ${kodi}/bin/$exe $out/bin/$exe \
--prefix PYTHONPATH : ${kodi.pythonPackages.makePythonPath plugins} \
--prefix PYTHONPATH : ${kodi.pythonPackages.makePythonPath addons} \
--prefix KODI_HOME : $out/share/kodi \
--prefix LD_LIBRARY_PATH ":" "${lib.makeLibraryPath
(lib.concatMap
(plugin: plugin.extraRuntimeDependencies or []) plugins)}"
(plugin: plugin.extraRuntimeDependencies or []) addons)}"
done
'';
meta = kodi.meta // {
description = kodi.meta.description
+ " (with plugins: ${lib.concatMapStringsSep ", " (x: x.name) plugins})";
};
}

View file

@ -302,6 +302,9 @@ mapAliases ({
json_glib = json-glib; # added 2018-02-25
kdecoration-viewer = throw "kdecoration-viewer has been removed from nixpkgs, as there is no upstream activity"; # 2020-06-16
k9copy = throw "k9copy has been removed from nixpkgs, as there is no upstream activity"; # 2020-11-06
kodiGBM = kodi-gbm;
kodiPlain = kodi;
kodiPlainWayland = kodi-wayland;
julia_07 = throw "julia_07 is deprecated in favor of julia_10 LTS"; # added 2020-09-15
julia_11 = throw "julia_11 is deprecated in favor of latest Julia version"; # added 2020-09-15
kdeconnect = plasma5Packages.kdeconnect-kde; # added 2020-10-28
@ -780,7 +783,8 @@ mapAliases ({
xara = throw "xara has been removed from nixpkgs. Unmaintained since 2006"; # added 2020-06-24
xbmc = kodi; # added 2018-04-25
xbmcPlain = kodiPlain; # added 2018-04-25
xbmcPlugins = kodiPlugins; # added 2018-04-25
xbmcPlugins = kodiPackages; # added 2018-04-25
kodiPlugins = kodiPackages; # added 2021-03-09;
xmonad_log_applet_gnome3 = xmonad_log_applet; # added 2018-05-01
xmpppy = throw "xmpppy has been removed from nixpkgs as it is unmaintained and python2-only";
pyIRCt = throw "pyIRCt has been removed from nixpkgs as it is unmaintained and python2-only";

View file

@ -26180,33 +26180,6 @@ in
cores = retroArchCores;
};
wrapKodi = { kodi }: callPackage ../applications/video/kodi/wrapper.nix {
inherit kodi;
plugins = let inherit (lib) optional optionals; in with kodiPlugins;
([]
++ optional (config.kodi.enableAdvancedLauncher or false) advanced-launcher
++ optional (config.kodi.enableAdvancedEmulatorLauncher or false)
advanced-emulator-launcher
++ optionals (config.kodi.enableControllers or false)
(with controllers;
[ default dreamcast gba genesis mouse n64 nes ps snes ])
++ optional (config.kodi.enableExodus or false) exodus
++ optionals (config.kodi.enableHyperLauncher or false)
(with hyper-launcher; [ plugin service pdfreader ])
++ optional (config.kodi.enableJoystick or false) joystick
++ optional (config.kodi.enableOSMCskin or false) osmc-skin
++ optional (config.kodi.enableSVTPlay or false) svtplay
++ optional (config.kodi.enableSteamController or false) steam-controller
++ optional (config.kodi.enableSteamLauncher or false) steam-launcher
++ optional (config.kodi.enablePVRHTS or false) pvr-hts
++ optional (config.kodi.enablePVRHDHomeRun or false) pvr-hdhomerun
++ optional (config.kodi.enablePVRIPTVSimple or false) pvr-iptvsimple
++ optional (config.kodi.enableInputStreamAdaptive or false) inputstream-adaptive
++ optional (config.kodi.enableVFSSFTP or false) vfs-sftp
++ optional (config.kodi.enableVFSLibarchive or false) vfs-libarchive
);
};
wsjtx = qt5.callPackage ../applications/radio/wsjtx { };
wxhexeditor = callPackage ../applications/editors/wxhexeditor {
@ -26264,28 +26237,16 @@ in
gtk = gtk2;
};
kodiPlain = callPackage ../applications/video/kodi { };
kodiPackages = recurseIntoAttrs (kodi.packages);
kodiPlainWayland = callPackage ../applications/video/kodi {
useWayland = true;
kodi = callPackage ../applications/video/kodi { };
kodi-wayland = callPackage ../applications/video/kodi {
waylandSupport = true;
};
kodiGBM = callPackage ../applications/video/kodi {
useGbm = true;
};
kodiPlugins = recurseIntoAttrs (callPackage ../applications/video/kodi/plugins.nix {});
kodi = wrapKodi {
kodi = kodiPlain;
};
kodi-wayland = wrapKodi {
kodi = kodiPlainWayland;
};
kodi-gbm = wrapKodi {
kodi = kodiGBM;
kodi-gbm = callPackage ../applications/video/kodi {
gbmSupport = true;
};
kodi-cli = callPackage ../tools/misc/kodi-cli { };