1{
2 stdenv,
3 toKodiAddon,
4 addonDir,
5 cmake,
6 kodi,
7 kodi-platform,
8 libcec_platform,
9}:
10{
11 name ? "${attrs.pname}-${attrs.version}",
12 namespace,
13 version,
14 extraNativeBuildInputs ? [ ],
15 extraBuildInputs ? [ ],
16 extraRuntimeDependencies ? [ ],
17 extraCMakeFlags ? [ ],
18 extraInstallPhase ? "",
19 ...
20}@attrs:
21toKodiAddon (
22 stdenv.mkDerivation (
23 {
24 name = "kodi-" + name;
25
26 dontStrip = true;
27
28 nativeBuildInputs = [ cmake ] ++ extraNativeBuildInputs;
29 buildInputs = [
30 kodi
31 kodi-platform
32 libcec_platform
33 ]
34 ++ extraBuildInputs;
35
36 inherit extraRuntimeDependencies;
37
38 # disables check ensuring install prefix is that of kodi
39 cmakeFlags = [
40 "-DOVERRIDE_PATHS=1"
41 ]
42 ++ extraCMakeFlags;
43
44 # kodi checks for addon .so libs existence in the addon folder (share/...)
45 # and the non-wrapped kodi lib/... folder before even trying to dlopen
46 # them. Symlinking .so, as setting LD_LIBRARY_PATH is of no use
47 installPhase =
48 let
49 n = namespace;
50 in
51 ''
52 runHook preInstall
53
54 make install
55
56 [[ -f $out/lib/addons/${n}/${n}.so ]] && ln -s $out/lib/addons/${n}/${n}.so $out${addonDir}/${n}/${n}.so || true
57 [[ -f $out/lib/addons/${n}/${n}.so.${version} ]] && ln -s $out/lib/addons/${n}/${n}.so.${version} $out${addonDir}/${n}/${n}.so.${version} || true
58
59 ${extraInstallPhase}
60
61 runHook postInstall
62 '';
63 }
64 // attrs
65 )
66)