Skip to end of metadata
Go to start of metadata

I've had my Kodi install running on a Raspberry Pi for a while and have been happy with it.  But when a Mac Mini freed up I wanted to move my setup over to it and free up the Pi for other uses.  I was not prepared for the shoddy state of Kodi packaging.

First off, if you're about to install Fedora 25 on a box you want to run Kodi on, stop.  As of this writing there are two places to get Kodi for Fedora: RPMfusion and United RPMs.  You can't enable those repositories concurrently, United RPMs doesn't have any of the tvheadend code, and RPMfusion just generally has more software.  However, RPMfusion currently only has Kodi 17 (Krypton) which is in beta and horribly unprepared for the world (the changes in Kodi 17 have all but neutralized what little good Kodi documentation is out there).

My current recommendation is Fedora 24 with Kodi 16 (Jarvis).  Ubuntu and OpenELEC are also good choices (and of course, Raspian) but didn't work for my situation.

What you need to know, and what the majority of the Internet apparently has failed to realize, is that Kodi stopped shipping many plugins - such as HTS, the TVHeadend client - and you can't just pull them from a repository.  If you search for instructions for how to enable any of this you're going to find tons of articles, forums, and email list posts basically saying "OMG, just enabled it, GAWD".  These people are running some distribution which has already packaged all the necessary stuff.  RPMfusion used to do this for Fedora but stopped after Fedora 22 and Kodi 14.

So where do you begin?  Well, you need to have Fedora 24 installed.  I started with the Cinnamon spin, which means many packages were included (such as gcc and make).  In my case my tuner card is in the same box and I already installed TVHeadend and set it up.  Here's what you want to do next:

$ sudo dnf install kodi kodi-devel kodi-platform-devel git cmake gcc-c++

Now you're going to want to pull down the source for HTS:

$ git clone -b Jarvis https://github.com/kodi-pvr/pvr.hts.git
$ cd pvr.hts
$ mkdir build

Note that we're specifically pulling the "Jarvis" branch.  If you didn't heed my warning and went with Fedora 25 and Kodi 17 you can omit the -b stuff.

Here's where it gets really interesting.  The HTS source refers to "platform" just as that in source / headers.  However, the Fedora Platform RPM include paths and namespace is p8-platform and P8PLATFORM respectively.  So we have to update the HTS source code for these differences.

There are three changes we need to make in CMakeLists.txt (presented as a unified diff):

--- CMakeLists.txt.dist	2016-12-04 16:23:21.767653860 -0600
+++ CMakeLists.txt	2016-12-04 16:23:40.781270537 -0600
@@ -6,10 +6,10 @@
 
 find_package(kodi REQUIRED)
 find_package(kodiplatform REQUIRED)
-find_package(platform REQUIRED)
+find_package(p8-platform REQUIRED)
 
 include_directories(${kodiplatform_INCLUDE_DIRS}
-                    ${platform_INCLUDE_DIRS}
+                    ${p8-platform_INCLUDE_DIRS}
                     ${KODI_INCLUDE_DIR}
                     ${PROJECT_SOURCE_DIR}/lib)
 
@@ -95,7 +95,7 @@
 
 add_subdirectory(lib/libhts)
 
-set(DEPLIBS ${platform_LIBRARIES} hts)
+set(DEPLIBS ${p8-platform_LIBRARIES} hts)
 if(WIN32)
   list(APPEND DEPLIBS ws2_32)
 endif()

The remaining changes we can make programmatically:

$ for a in $(egrep -r 'platform|PLATFORM' debian/ lib/ pvr.hts/ src/ | egrep 'include| PLATFORM|\tPLATFORM' | awk -F: '{print $1}' | sort -u); do
    sed -i -e 's,platform/,p8-platform/,g' -e 's,PLATFORM,P8PLATFORM,g' "$a"
  done

Now we can compile and install the plugin:

$ cd build
$ cmake -DCMAKE_INSTALL_PREFIX=${HOME}/.kodi/addons -DPACKAGE_ZIP=1 ..
$ make
$ make install

Now you can follow all those guides that say "OMG, just install it, GAWD!"  When you start Kodi the plugin will already be enabled (assuming you built/installed this under the same user as you run Kodi) and you can enable Live TV in the settings.

  • No labels