2017-03-22 06:08:01 +00:00
|
|
|
{ stdenv, lib, fetchFromGitHub, fetchurl, autoconf, automake, libtool, makeWrapper
|
2016-10-18 13:53:18 +01:00
|
|
|
, pkgconfig, cmake, gnumake, yasm, python2
|
2017-03-22 06:08:01 +00:00
|
|
|
, libgcrypt, libgpgerror, libunistring
|
|
|
|
, boost, avahi, lame, autoreconfHook
|
2016-04-15 08:57:13 +01:00
|
|
|
, gettext, pcre-cpp, yajl, fribidi, which
|
2014-12-24 09:57:34 +00:00
|
|
|
, openssl, gperf, tinyxml2, taglib, libssh, swig, jre
|
|
|
|
, libX11, xproto, inputproto, libxml2
|
|
|
|
, libXt, libXmu, libXext, xextproto
|
|
|
|
, libXinerama, libXrandr, randrproto
|
|
|
|
, libXtst, libXfixes, fixesproto, systemd
|
2018-02-24 13:12:44 +00:00
|
|
|
, alsaLib, libGLU_combined, glew, fontconfig, freetype, ftgl
|
2014-12-24 09:57:34 +00:00
|
|
|
, libjpeg, jasper, libpng, libtiff
|
|
|
|
, libmpeg2, libsamplerate, libmad
|
|
|
|
, libogg, libvorbis, flac, libxslt
|
|
|
|
, lzo, libcdio, libmodplug, libass, libbluray
|
2018-03-25 22:33:23 +01:00
|
|
|
, sqlite, mysql, nasm, gnutls, libva, libdrm, wayland
|
2014-12-24 09:57:34 +00:00
|
|
|
, curl, bzip2, zip, unzip, glxinfo, xdpyinfo
|
2016-02-21 14:31:41 +00:00
|
|
|
, libcec, libcec_platform, dcadec, libuuid
|
2017-03-22 06:08:01 +00:00
|
|
|
, libcrossguid, libmicrohttpd
|
|
|
|
, bluez, doxygen, giflib, glib, harfbuzz, lcms2, libidn, libpthreadstubs, libtasn1, libXdmcp
|
2018-02-25 02:23:58 +00:00
|
|
|
, libplist, p11-kit, zlib
|
2017-03-22 06:08:01 +00:00
|
|
|
, dbusSupport ? true, dbus_libs ? 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 ? null
|
|
|
|
, vdpauSupport ? true, libvdpau ? null
|
2014-12-24 09:57:34 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
assert dbusSupport -> dbus_libs != null;
|
2017-03-22 06:08:01 +00:00
|
|
|
assert nfsSupport -> libnfs != null;
|
|
|
|
assert pulseSupport -> libpulseaudio != null;
|
|
|
|
assert rtmpSupport -> rtmpdump != null;
|
|
|
|
assert sambaSupport -> samba != null;
|
2014-12-24 09:57:34 +00:00
|
|
|
assert udevSupport -> udev != null;
|
|
|
|
assert usbSupport -> libusb != null && ! udevSupport; # libusb won't be used if udev is avaliable
|
|
|
|
assert vdpauSupport -> libvdpau != null;
|
2017-03-22 06:08:01 +00:00
|
|
|
|
|
|
|
# TODO for Kodi 18.0
|
|
|
|
# - cmake is no longer in project/cmake
|
|
|
|
# - maybe we can remove auto{conf,make} and libtool from inputs
|
|
|
|
# - check if dbus support PR has been merged and add dbus as a buildInput
|
2017-12-23 08:28:53 +00:00
|
|
|
# - try to use system ffmpeg (kodi 17 works best with bundled 3.1 with patches)
|
2014-12-24 09:57:34 +00:00
|
|
|
|
|
|
|
let
|
2017-03-22 06:08:01 +00:00
|
|
|
kodiReleaseDate = "20171115";
|
|
|
|
kodiVersion = "17.6";
|
2016-10-08 17:07:15 +01:00
|
|
|
rel = "Krypton";
|
2017-03-22 06:08:01 +00:00
|
|
|
|
|
|
|
kodi_src = fetchFromGitHub {
|
|
|
|
owner = "xbmc";
|
|
|
|
repo = "xbmc";
|
|
|
|
rev = "${kodiVersion}-${rel}";
|
|
|
|
sha256 = "1pwmmbry7dajwdpmc1mdygjvxna4kl38h32d71g10yf3mdm5wmz3";
|
2014-12-24 09:57:34 +00:00
|
|
|
};
|
2017-03-22 06:08:01 +00:00
|
|
|
|
|
|
|
kodiDependency = { name, version, rev, sha256, ... } @attrs:
|
|
|
|
let
|
|
|
|
attrs' = builtins.removeAttrs attrs ["name" "version" "rev" "sha256"];
|
|
|
|
in stdenv.mkDerivation ({
|
|
|
|
name = "kodi-${lib.toLower name}-${version}";
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "xbmc";
|
|
|
|
repo = name;
|
|
|
|
inherit rev sha256;
|
|
|
|
};
|
|
|
|
enableParallelBuilding = true;
|
|
|
|
} // attrs');
|
|
|
|
|
|
|
|
ffmpeg = kodiDependency rec {
|
|
|
|
name = "FFmpeg";
|
|
|
|
version = "3.1.11";
|
|
|
|
rev = "${version}-${rel}-17.5"; # TODO: change 17.5 back to ${kodiVersion}
|
|
|
|
sha256 = "0nc4sb6v1g3l11v9h5l9n44a8r40186rcbp2xg5c7vg6wcpjid13";
|
|
|
|
preConfigure = ''
|
|
|
|
cp ${kodi_src}/tools/depends/target/ffmpeg/{CMakeLists.txt,*.cmake} .
|
|
|
|
'';
|
2018-02-25 02:23:58 +00:00
|
|
|
buildInputs = [ gnutls libidn libtasn1 p11-kit zlib libva ]
|
2017-12-23 08:28:53 +00:00
|
|
|
++ lib.optional vdpauSupport libvdpau;
|
2017-03-22 06:08:01 +00:00
|
|
|
nativeBuildInputs = [ cmake nasm pkgconfig ];
|
2017-04-02 13:12:24 +01:00
|
|
|
};
|
2017-03-22 06:08:01 +00:00
|
|
|
|
|
|
|
# we should be able to build these externally and have kodi reference them as buildInputs.
|
|
|
|
# Doesn't work ATM though so we just use them for the src
|
|
|
|
|
|
|
|
libdvdcss = kodiDependency {
|
|
|
|
name = "libdvdcss";
|
|
|
|
version = "20160215";
|
|
|
|
rev = "2f12236bc1c92f73c21e973363f79eb300de603f";
|
|
|
|
sha256 = "198r0q73i55ga1dvyqq9nfcri0zq08b94hy8671lg14i3izx44dd";
|
|
|
|
buildInputs = [ libdvdread ];
|
|
|
|
nativeBuildInputs = [ autoreconfHook pkgconfig ];
|
|
|
|
};
|
|
|
|
|
|
|
|
libdvdnav = kodiDependency {
|
|
|
|
name = "libdvdnav";
|
|
|
|
version = "20170217";
|
|
|
|
rev = "981488f7f27554b103cca10c1fbeba027396c94a";
|
|
|
|
sha256 = "089pswc51l3avh95zl4cpsh7gh1innh7b2y4xgx840mcmy46ycr8";
|
|
|
|
buildInputs = [ libdvdread ];
|
|
|
|
nativeBuildInputs = [ autoreconfHook pkgconfig ];
|
2017-04-02 13:12:24 +01:00
|
|
|
};
|
2017-03-22 06:08:01 +00:00
|
|
|
|
|
|
|
libdvdread = kodiDependency {
|
|
|
|
name = "libdvdread";
|
|
|
|
version = "20160221";
|
|
|
|
rev = "17d99db97e7b8f23077b342369d3c22a6250affd";
|
|
|
|
sha256 = "1gr5aq1cjr3as9mnwrw29cxn4m6f6pfrxdahkdcjy70q3ldg90sl";
|
|
|
|
nativeBuildInputs = [ autoreconfHook pkgconfig ];
|
|
|
|
};
|
|
|
|
|
2014-12-24 09:57:34 +00:00
|
|
|
in stdenv.mkDerivation rec {
|
2017-03-22 06:08:01 +00:00
|
|
|
name = "kodi-${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
|
2017-03-22 06:08:01 +00:00
|
|
|
libxml2 yasm python2
|
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
|
2014-12-24 09:57:34 +00:00
|
|
|
openssl gperf tinyxml2 taglib libssh swig jre
|
2017-03-22 06:08:01 +00:00
|
|
|
libX11 xproto inputproto libXt libXmu libXext xextproto
|
|
|
|
libXinerama libXrandr randrproto libXtst libXfixes fixesproto
|
2018-02-24 13:12:44 +00:00
|
|
|
alsaLib libGLU_combined glew fontconfig freetype ftgl
|
2017-12-23 08:28:53 +00:00
|
|
|
libjpeg jasper libpng libtiff wayland
|
2014-12-24 09:57:34 +00:00
|
|
|
libmpeg2 libsamplerate libmad
|
|
|
|
libogg libvorbis flac libxslt systemd
|
|
|
|
lzo libcdio libmodplug libass libbluray
|
2017-07-09 16:43:03 +01:00
|
|
|
sqlite mysql.connector-c avahi lame
|
2014-12-24 09:57:34 +00:00
|
|
|
curl bzip2 zip unzip glxinfo xdpyinfo
|
2016-02-21 14:31:41 +00:00
|
|
|
libcec libcec_platform dcadec libuuid
|
2017-03-22 06:08:01 +00:00
|
|
|
libgcrypt libgpgerror libunistring
|
|
|
|
libcrossguid cwiid libplist
|
|
|
|
bluez giflib glib harfbuzz lcms2 libpthreadstubs libXdmcp
|
|
|
|
ffmpeg
|
|
|
|
# libdvdcss libdvdnav libdvdread
|
2014-12-24 09:57:34 +00:00
|
|
|
]
|
2017-03-22 06:08:01 +00:00
|
|
|
++ lib.optional dbusSupport dbus_libs
|
2017-12-23 08:28:53 +00:00
|
|
|
++ lib.optionals 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
|
|
|
|
++ lib.optional usbSupport libusb
|
|
|
|
++ lib.optional vdpauSupport libvdpau;
|
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
|
|
|
|
pkgconfig gnumake
|
|
|
|
autoconf automake libtool # still needed for some components. Check if that is the case with 18.0
|
2017-05-24 09:03:17 +01:00
|
|
|
];
|
2014-12-24 09:57:34 +00:00
|
|
|
|
2017-03-22 06:08:01 +00:00
|
|
|
cmakeFlags = [
|
|
|
|
"-Dlibdvdcss_URL=${libdvdcss.src}"
|
|
|
|
"-Dlibdvdnav_URL=${libdvdnav.src}"
|
|
|
|
"-Dlibdvdread_URL=${libdvdread.src}"
|
|
|
|
"-DGIT_VERSION=${kodiReleaseDate}"
|
|
|
|
"-DENABLE_EVENTCLIENTS=ON"
|
|
|
|
"-DENABLE_INTERNAL_CROSSGUID=OFF"
|
|
|
|
"-DENABLE_OPTICAL=ON"
|
|
|
|
"-DLIRC_DEVICE=/run/lirc/lircd"
|
|
|
|
];
|
|
|
|
|
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
|
|
|
# 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
|
|
|
|
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace xbmc/linux/LinuxTimezone.cpp \
|
|
|
|
--replace 'usr/share/zoneinfo' 'etc/zoneinfo'
|
|
|
|
'';
|
|
|
|
|
|
|
|
preConfigure = ''
|
2017-03-22 06:08:01 +00:00
|
|
|
cd project/cmake
|
2014-12-24 09:57:34 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
postInstall = ''
|
|
|
|
for p in $(ls $out/bin/) ; do
|
|
|
|
wrapProgram $out/bin/$p \
|
2017-03-22 06:08:01 +00:00
|
|
|
--prefix PATH ":" "${lib.makeBinPath [ python2 glxinfo xdpyinfo ]}" \
|
2015-10-06 14:32:17 +01:00
|
|
|
--prefix LD_LIBRARY_PATH ":" "${lib.makeLibraryPath
|
2017-12-23 08:28:53 +00:00
|
|
|
[ curl systemd libmad libvdpau libcec libcec_platform rtmpdump libass ]}"
|
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";
|
|
|
|
|
2014-12-24 09:57:34 +00:00
|
|
|
meta = with stdenv.lib; {
|
|
|
|
description = "Media center";
|
2017-03-22 06:08:01 +00:00
|
|
|
homepage = https://kodi.tv/;
|
|
|
|
license = licenses.gpl2;
|
|
|
|
platforms = platforms.linux;
|
|
|
|
maintainers = with maintainers; [ domenkozar titanous edwtjo peterhoeg ];
|
2014-12-24 09:57:34 +00:00
|
|
|
};
|
|
|
|
}
|