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