2021-03-15 22:50:58 +00:00
|
|
|
{ stdenv, toKodiAddon, addonDir, cmake, kodi, kodi-platform, libcec_platform }:
|
|
|
|
{ name ? "${attrs.pname}-${attrs.version}"
|
|
|
|
, namespace
|
|
|
|
, version
|
2021-04-16 18:24:14 +00:00
|
|
|
, extraNativeBuildInputs ? []
|
2021-03-15 22:50:58 +00:00
|
|
|
, extraBuildInputs ? []
|
|
|
|
, extraRuntimeDependencies ? []
|
2021-10-30 19:46:46 +00:00
|
|
|
, extraCMakeFlags ? []
|
2021-03-15 22:50:58 +00:00
|
|
|
, extraInstallPhase ? "", ... } @ attrs:
|
|
|
|
toKodiAddon (stdenv.mkDerivation ({
|
|
|
|
name = "kodi-" + name;
|
|
|
|
|
|
|
|
dontStrip = true;
|
|
|
|
|
2021-04-16 18:24:14 +00:00
|
|
|
nativeBuildInputs = [ cmake ] ++ extraNativeBuildInputs;
|
2021-03-15 22:50:58 +00:00
|
|
|
buildInputs = [ kodi kodi-platform libcec_platform ] ++ extraBuildInputs;
|
|
|
|
|
|
|
|
inherit extraRuntimeDependencies;
|
|
|
|
|
|
|
|
# disables check ensuring install prefix is that of kodi
|
|
|
|
cmakeFlags = [
|
|
|
|
"-DOVERRIDE_PATHS=1"
|
2021-10-30 19:46:46 +00:00
|
|
|
] ++ extraCMakeFlags;
|
2021-03-15 22:50:58 +00:00
|
|
|
|
|
|
|
# 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 ''
|
2021-03-20 14:40:52 +00:00
|
|
|
runHook preInstall
|
|
|
|
|
2021-03-15 22:50:58 +00:00
|
|
|
make install
|
2021-10-30 19:46:46 +00:00
|
|
|
|
|
|
|
[[ -f $out/lib/addons/${n}/${n}.so ]] && ln -s $out/lib/addons/${n}/${n}.so $out${addonDir}/${n}/${n}.so || true
|
|
|
|
[[ -f $out/lib/addons/${n}/${n}.so.${version} ]] && ln -s $out/lib/addons/${n}/${n}.so.${version} $out${addonDir}/${n}/${n}.so.${version} || true
|
|
|
|
|
2021-03-15 22:50:58 +00:00
|
|
|
${extraInstallPhase}
|
2021-03-20 14:40:52 +00:00
|
|
|
|
|
|
|
runHook postInstall
|
2021-03-15 22:50:58 +00:00
|
|
|
'';
|
|
|
|
} // attrs))
|