about summary refs log tree commit diff
path: root/pkgs/applications/video/kodi/build-kodi-binary-addon.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/applications/video/kodi/build-kodi-binary-addon.nix')
-rw-r--r--pkgs/applications/video/kodi/build-kodi-binary-addon.nix31
1 files changed, 31 insertions, 0 deletions
diff --git a/pkgs/applications/video/kodi/build-kodi-binary-addon.nix b/pkgs/applications/video/kodi/build-kodi-binary-addon.nix
new file mode 100644
index 0000000000000..74ce508ab6a60
--- /dev/null
+++ b/pkgs/applications/video/kodi/build-kodi-binary-addon.nix
@@ -0,0 +1,31 @@
+{ stdenv, toKodiAddon, addonDir, cmake, kodi, kodi-platform, libcec_platform }:
+{ name ? "${attrs.pname}-${attrs.version}"
+, namespace
+, version
+, extraBuildInputs ? []
+, extraRuntimeDependencies ? []
+, extraInstallPhase ? "", ... } @ attrs:
+toKodiAddon (stdenv.mkDerivation ({
+  name = "kodi-" + name;
+
+  dontStrip = true;
+
+  nativeBuildInputs = [ cmake ];
+  buildInputs = [ kodi kodi-platform libcec_platform ] ++ extraBuildInputs;
+
+  inherit extraRuntimeDependencies;
+
+  # disables check ensuring install prefix is that of kodi
+  cmakeFlags = [
+    "-DOVERRIDE_PATHS=1"
+  ];
+
+  # 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${addonDir}/${n}/${n}.so.${version}
+    ${extraInstallPhase}
+  '';
+} // attrs))