about summary refs log tree commit diff
path: root/nixpkgs/pkgs/applications/video/kodi/build-kodi-binary-addon.nix
blob: e0ca5d1cf6eb70cdc3361784d84372cda9b837dd (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
{ 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 ''
    runHook preInstall

    make install
    ln -s $out/lib/addons/${n}/${n}.so.${version} $out${addonDir}/${n}/${n}.so.${version}
    ${extraInstallPhase}

    runHook postInstall
  '';
} // attrs))