2024-04-21 15:54:59 +00:00
|
|
|
{ stdenv, lib, fetchFromGitHub, fetchzip
|
|
|
|
, autoconf, automake, libtool, makeWrapper
|
2022-04-27 09:35:20 +00:00
|
|
|
, pkg-config, cmake, yasm, python3Packages
|
2022-10-30 15:09:59 +00:00
|
|
|
, libxcrypt, libgcrypt, libgpg-error, libunistring
|
2021-03-15 08:37:03 +00:00
|
|
|
, boost, avahi, lame
|
|
|
|
, gettext, pcre-cpp, yajl, fribidi, which
|
2024-04-21 15:54:59 +00:00
|
|
|
, openssl, gperf, tinyxml2, tinyxml-2, taglib, libssh, swig, jre_headless
|
2021-03-15 08:37:03 +00:00
|
|
|
, gtest, ncurses, spdlog
|
|
|
|
, libxml2, systemd
|
2024-04-21 15:54:59 +00:00
|
|
|
, alsa-lib, libGLU, libGL, ffmpeg, fontconfig, freetype, ftgl
|
2021-03-15 08:37:03 +00:00
|
|
|
, libjpeg, libpng, libtiff
|
|
|
|
, libmpeg2, libsamplerate, libmad
|
|
|
|
, libogg, libvorbis, flac, libxslt
|
2022-01-13 20:06:32 +00:00
|
|
|
, lzo, libcdio, libmodplug, libass, libbluray, libudfread
|
2021-03-15 08:37:03 +00:00
|
|
|
, sqlite, libmysqlclient, nasm, gnutls, libva, libdrm
|
|
|
|
, curl, bzip2, zip, unzip, glxinfo
|
|
|
|
, libcec, libcec_platform, dcadec, libuuid
|
|
|
|
, libcrossguid, libmicrohttpd
|
2023-03-24 00:07:29 +00:00
|
|
|
, bluez, doxygen, giflib, glib, harfbuzz, lcms2, libidn2, libpthreadstubs, libtasn1
|
2021-12-06 16:07:01 +00:00
|
|
|
, libplist, p11-kit, zlib, flatbuffers, fstrcmp, rapidjson
|
2021-03-15 08:37:03 +00:00
|
|
|
, 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
|
2024-02-29 20:09:43 +00:00
|
|
|
, pipewireSupport ? true, pipewire
|
2021-03-15 08:37:03 +00:00
|
|
|
, rtmpSupport ? true, rtmpdump
|
|
|
|
, sambaSupport ? true, samba
|
|
|
|
, udevSupport ? true, udev
|
2024-04-21 15:54:59 +00:00
|
|
|
, opticalSupport ? true
|
2021-03-15 08:37:03 +00:00
|
|
|
, usbSupport ? false, libusb-compat-0_1
|
|
|
|
, vdpauSupport ? true, libvdpau
|
|
|
|
, waylandSupport ? false, wayland, wayland-protocols
|
|
|
|
, waylandpp ? null, libxkbcommon
|
2024-04-21 15:54:59 +00:00
|
|
|
, gbmSupport ? false, mesa, libinput, libdisplay-info
|
2021-03-15 08:37:03 +00:00
|
|
|
, buildPackages
|
|
|
|
}:
|
|
|
|
|
2022-12-28 21:21:41 +00:00
|
|
|
assert usbSupport -> !udevSupport; # libusb-compat-0_1 won't be used if udev is available
|
2021-03-15 08:37:03 +00:00
|
|
|
assert gbmSupport || waylandSupport || x11Support;
|
|
|
|
|
|
|
|
let
|
2023-03-15 16:39:30 +00:00
|
|
|
# see https://github.com/xbmc/xbmc/blob/${kodiVersion}-${rel}/tools/depends/target/ to get suggested versions for all dependencies
|
|
|
|
|
2021-03-15 08:37:03 +00:00
|
|
|
# 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";
|
2023-03-15 16:39:30 +00:00
|
|
|
rev = "1.4.3-Next-Nexus-Alpha2-2";
|
|
|
|
sha256 = "sha256-CJMGH50mNAkovccNcol5ArF3zUnZKfbVB9EXyQgu5k4=";
|
2021-03-15 08:37:03 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
libdvdnav = fetchFromGitHub {
|
|
|
|
owner = "xbmc";
|
|
|
|
repo = "libdvdnav";
|
2023-03-15 16:39:30 +00:00
|
|
|
rev = "6.1.1-Next-Nexus-Alpha2-2";
|
|
|
|
sha256 = "sha256-m8SCjOokVbwJ7eVfYKHap1pQjVbI+BXaoxhGZQIg0+k=";
|
2021-03-15 08:37:03 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
libdvdread = fetchFromGitHub {
|
|
|
|
owner = "xbmc";
|
|
|
|
repo = "libdvdread";
|
2023-03-15 16:39:30 +00:00
|
|
|
rev = "6.1.3-Next-Nexus-Alpha2-2";
|
|
|
|
sha256 = "sha256-AphBQhXud+a6wm52zjzC5biz53NnqWdgpL2QDt2ZuXc=";
|
2021-03-15 08:37:03 +00:00
|
|
|
};
|
|
|
|
|
2024-04-21 15:54:59 +00:00
|
|
|
groovy = fetchzip {
|
|
|
|
url = "mirror://apache/groovy/4.0.16/distribution/apache-groovy-binary-4.0.16.zip";
|
|
|
|
sha256 = "sha256-OfZBiMVrhw6VqHRHCSC7ZV3FiZ26n4+F8hsskk+L6yU=";
|
|
|
|
};
|
|
|
|
|
|
|
|
apache_commons_lang = fetchzip {
|
|
|
|
url = "mirror://apache/commons/lang/binaries/commons-lang3-3.14.0-bin.zip";
|
|
|
|
sha512 = "sha512-eKF1IQ6PDtifb4pMHWQ2SYHIh0HbMi3qpc92lfbOo3uSsFJVR3n7JD0AdzrG17tLJQA4z5PGDhwyYw0rLeLsXw==";
|
|
|
|
};
|
|
|
|
|
|
|
|
apache_commons_text = fetchzip {
|
|
|
|
url = "mirror://apache/commons/text/binaries/commons-text-1.11.0-bin.zip";
|
|
|
|
sha512 = "sha512-P2IvnrHSYRF70LllTMI8aev43h2oe8lq6rrMYw450PEhEa7OuuCjh1Krnc/A4OqENUcidVAAX5dK1RAsZHh8Dg==";
|
|
|
|
};
|
|
|
|
|
2021-03-15 08:37:03 +00:00
|
|
|
kodi_platforms = lib.optional gbmSupport "gbm"
|
|
|
|
++ lib.optional waylandSupport "wayland"
|
|
|
|
++ lib.optional x11Support "x11";
|
|
|
|
|
2024-04-21 15:54:59 +00:00
|
|
|
in stdenv.mkDerivation (finalAttrs: {
|
2021-03-15 08:37:03 +00:00
|
|
|
pname = "kodi";
|
2024-04-21 15:54:59 +00:00
|
|
|
version = "21.0";
|
|
|
|
kodiReleaseName = "Omega";
|
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "xbmc";
|
|
|
|
repo = "xbmc";
|
|
|
|
rev = "${finalAttrs.version}-${finalAttrs.kodiReleaseName}";
|
|
|
|
hash = "sha256-xrFWqgwTkurEwt3/+/e4SCM6Uk9nxuW62SrCFWWqZO0=";
|
|
|
|
};
|
|
|
|
|
|
|
|
# make derivations declared in the let binding available here, so
|
|
|
|
# they can be overridden
|
|
|
|
inherit libdvdcss libdvdnav libdvdread groovy
|
|
|
|
apache_commons_lang apache_commons_text;
|
2021-03-15 08:37:03 +00:00
|
|
|
|
|
|
|
buildInputs = [
|
2023-03-24 00:07:29 +00:00
|
|
|
gnutls libidn2 libtasn1 nasm p11-kit
|
2021-03-15 08:37:03 +00:00
|
|
|
libxml2 python3Packages.python
|
|
|
|
boost libmicrohttpd
|
|
|
|
gettext pcre-cpp yajl fribidi libva libdrm
|
2024-04-21 15:54:59 +00:00
|
|
|
openssl gperf tinyxml2 tinyxml-2 taglib libssh
|
2021-03-15 08:37:03 +00:00
|
|
|
gtest ncurses spdlog
|
2021-06-28 23:13:55 +00:00
|
|
|
alsa-lib libGL libGLU fontconfig freetype ftgl
|
2021-03-15 08:37:03 +00:00
|
|
|
libjpeg libpng libtiff
|
|
|
|
libmpeg2 libsamplerate libmad
|
|
|
|
libogg libvorbis flac libxslt systemd
|
2022-01-13 20:06:32 +00:00
|
|
|
lzo libcdio libmodplug libass libbluray libudfread
|
2021-03-15 08:37:03 +00:00
|
|
|
sqlite libmysqlclient avahi lame
|
|
|
|
curl bzip2 zip unzip glxinfo
|
|
|
|
libcec libcec_platform dcadec libuuid
|
2022-10-30 15:09:59 +00:00
|
|
|
libxcrypt libgcrypt libgpg-error libunistring
|
2021-03-15 08:37:03 +00:00
|
|
|
libcrossguid libplist
|
|
|
|
bluez giflib glib harfbuzz lcms2 libpthreadstubs
|
2021-12-06 16:07:01 +00:00
|
|
|
ffmpeg flatbuffers fstrcmp rapidjson
|
2021-03-15 08:37:03 +00:00
|
|
|
lirc
|
2021-04-26 19:14:03 +00:00
|
|
|
mesa # for libEGL
|
2021-03-15 08:37:03 +00:00
|
|
|
]
|
2022-10-30 15:09:59 +00:00
|
|
|
++ lib.optionals x11Support [
|
2021-03-15 08:37:03 +00:00
|
|
|
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
|
2024-02-29 20:09:43 +00:00
|
|
|
++ lib.optional pipewireSupport pipewire
|
2021-03-15 08:37:03 +00:00
|
|
|
++ 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
|
|
|
|
]
|
2022-10-30 15:09:59 +00:00
|
|
|
++ lib.optionals gbmSupport [
|
2021-03-15 08:37:03 +00:00
|
|
|
libxkbcommon.dev
|
|
|
|
mesa.dev
|
|
|
|
libinput.dev
|
2024-04-21 15:54:59 +00:00
|
|
|
libdisplay-info
|
2021-03-15 08:37:03 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
nativeBuildInputs = [
|
|
|
|
cmake
|
|
|
|
doxygen
|
|
|
|
makeWrapper
|
|
|
|
which
|
2022-04-27 09:35:20 +00:00
|
|
|
pkg-config
|
2021-03-15 08:37:03 +00:00
|
|
|
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"}"
|
2024-04-21 15:54:59 +00:00
|
|
|
"-Dlibdvdcss_URL=${finalAttrs.libdvdcss}"
|
|
|
|
"-Dlibdvdnav_URL=${finalAttrs.libdvdnav}"
|
|
|
|
"-Dlibdvdread_URL=${finalAttrs.libdvdread}"
|
|
|
|
"-Dgroovy_SOURCE_DIR=${finalAttrs.groovy}"
|
|
|
|
"-Dapache-commons-lang_SOURCE_DIR=${finalAttrs.apache_commons_lang}"
|
|
|
|
"-Dapache-commons-text_SOURCE_DIR=${finalAttrs.apache_commons_text}"
|
|
|
|
# Upstream derives this from the git HEADs hash and date.
|
|
|
|
# LibreElec (minimal distro for kodi) uses the equivalent to this.
|
|
|
|
"-DGIT_VERSION=${finalAttrs.version}-${finalAttrs.kodiReleaseName}"
|
2021-03-15 08:37:03 +00:00
|
|
|
"-DENABLE_EVENTCLIENTS=ON"
|
|
|
|
"-DENABLE_INTERNAL_CROSSGUID=OFF"
|
2023-03-15 16:39:30 +00:00
|
|
|
"-DENABLE_INTERNAL_RapidJSON=OFF"
|
2024-04-21 15:54:59 +00:00
|
|
|
"-DENABLE_OPTICAL=${if opticalSupport then "ON" else "OFF"}"
|
|
|
|
"-DENABLE_VDPAU=${if vdpauSupport then "ON" else "OFF"}"
|
2021-03-15 08:37:03 +00:00
|
|
|
"-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"
|
2022-04-27 09:35:20 +00:00
|
|
|
# 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
|
|
|
|
# whitelisted directories). This adds the entire nix store to the Kodi
|
|
|
|
# webserver whitelist to avoid this problem.
|
|
|
|
"-DKODI_WEBSERVER_EXTRA_WHITELIST=${builtins.storeDir}"
|
2022-10-30 15:09:59 +00:00
|
|
|
] ++ lib.optionals waylandSupport [
|
2021-03-15 08:37:03 +00:00
|
|
|
"-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.
|
2021-12-06 16:07:01 +00:00
|
|
|
CXX=$CXX_FOR_BUILD LD=ld make -C tools/depends/native/JsonSchemaBuilder
|
2021-03-15 08:37:03 +00:00
|
|
|
cmakeFlags+=" -DWITH_JSONSCHEMABUILDER=$PWD/tools/depends/native/JsonSchemaBuilder/bin"
|
|
|
|
|
2021-12-06 16:07:01 +00:00
|
|
|
CXX=$CXX_FOR_BUILD LD=ld make EXTRA_CONFIGURE= -C tools/depends/native/TexturePacker
|
2021-03-15 08:37:03 +00:00
|
|
|
cmakeFlags+=" -DWITH_TEXTUREPACKER=$PWD/tools/depends/native/TexturePacker/bin"
|
|
|
|
'';
|
|
|
|
|
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace xbmc/platform/posix/PosixTimezone.cpp \
|
|
|
|
--replace 'usr/share/zoneinfo' 'etc/zoneinfo'
|
|
|
|
'';
|
|
|
|
|
|
|
|
postInstall = ''
|
2023-01-20 10:41:00 +00:00
|
|
|
# TODO: figure out which binaries should be wrapped this way and which shouldn't
|
|
|
|
for p in $(ls --ignore=kodi-send $out/bin/) ; do
|
2021-03-15 08:37:03 +00:00
|
|
|
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
|
2024-04-21 15:54:59 +00:00
|
|
|
([ curl systemd libmad libcec libcec_platform libass ]
|
|
|
|
++ lib.optional vdpauSupport libvdpau
|
2021-03-15 08:37:03 +00:00
|
|
|
++ lib.optional nfsSupport libnfs
|
|
|
|
++ lib.optional rtmpSupport rtmpdump)}"
|
|
|
|
done
|
|
|
|
|
2023-01-20 10:41:00 +00:00
|
|
|
wrapProgram $out/bin/kodi-send \
|
|
|
|
--prefix PYTHONPATH : $out/${python3Packages.python.sitePackages}
|
|
|
|
|
2021-03-15 08:37:03 +00:00
|
|
|
substituteInPlace $out/share/xsessions/kodi.desktop \
|
|
|
|
--replace kodi-standalone $out/bin/kodi-standalone
|
|
|
|
'';
|
|
|
|
|
|
|
|
doInstallCheck = true;
|
|
|
|
|
|
|
|
installCheckPhase = "$out/bin/kodi --version";
|
|
|
|
|
|
|
|
passthru = {
|
|
|
|
pythonPackages = python3Packages;
|
2021-04-05 15:23:46 +00:00
|
|
|
ffmpeg = ffmpeg;
|
2024-04-21 15:54:59 +00:00
|
|
|
kodi = finalAttrs.finalPackage;
|
2021-03-15 08:37:03 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "Media center";
|
|
|
|
homepage = "https://kodi.tv/";
|
|
|
|
license = licenses.gpl2Plus;
|
|
|
|
platforms = platforms.linux;
|
2021-03-23 19:22:30 +00:00
|
|
|
maintainers = teams.kodi.members;
|
2021-03-15 08:37:03 +00:00
|
|
|
};
|
2024-04-21 15:54:59 +00:00
|
|
|
})
|