User Tools

Site Tools


kodicompilingteleboy

Kodi: Compiling pvr.teleboy add-on for Linux, Windows or Android

For Kodi there is a great pvr.teleboy add-on, created by rbuehlma.
Unfortunately, if you want to compile this add-on by yourself for whatever reason, there is no reliable step-by-step instruction on how to compile this add-on for Linux, Windows or Android installation of Kodi anywhere. So I went through the steps and here is the solution:

First thoughts

Note

The whole tutorial is based on an x86 64-bit compiler environment.

Note

This tutorial is based on:

  • For Linux and Windows:
    - Kodi Leia 18.x
    - pvr.teleboy 18.2.3-Leia

  • For Android:
    - Kodi Omega 21.x
    - pvr.teleboy 21.0.0-Omega (Android 13 aarch64 architecture)

Note

Troubleshooting
Please keep generally in mind: Compiling and cross-compiling are very CPU intensive operations and can take a very long time to finish. Therefore it mostly makes sense to provide as much CPU cores as possible to the build management tool, unless something goes wrong during the build operation and you need the logs. Because the potential lack of useful logs being visible on the command line interface when using multiple CPU cores, it may result in an obstructive situation when it comes into troubleshooting in case of a failed build operation.

For such a case it is important to understand that the build management tool is scattering logs in a non-sequential way across the command line interface when multiple CPU cores are provided to run multiple building threads in parallel. Because of this and because the cmd-cache is limited, important log information for troubleshooting may not be visible to the user in a userful way - if even. To workaround this, after a failed build operation, please start the build operation again by replacing the according make -j$(getconf _NPROCESSORS_ONLN) command by make -j1. The latter will limit the provided CPU cores to a single one which will also limit the build process into single threads (while the former provides the whole available system's CPU cores which makes multi-threading possible). This will provide the build management tool's progression sequentially on the command line interface which will make troubleshooting in case of a failed compile operation much easier - or even possible in the first place.

Start of tutorial

Linux (Debian/Ubuntu 22.04)

Preparation

Installing dependencies:

$ sudo apt-get install cmake build-essential kodi-addons-dev libtinyxml-dev git

Compiling

$ mkdir ~/tmp
$ cd ~/tmp
$ git clone https://github.com/Pulse-Eight/platform.git
$ mkdir ./platform/build
$ cd ./platform/build
$ cmake ..
$ make -j$(getconf _NPROCESSORS_ONLN)
$ sudo make install
$ sudo ldconfig
$ cd ~/tmp
$ git clone https://github.com/xbmc/kodi-platform.git
$ mkdir ./kodi-platform/build
$ cd ./kodi-platform/build
$ cmake ..
$ make -j$(getconf _NPROCESSORS_ONLN)
$ sudo make install
$ sudo ldconfig
$ cd ~/tmp
$ git clone --branch Matrix https://github.com/xbmc/xbmc.git
$ git clone --branch Matrix https://github.com/rbuehlma/pvr.teleboy.git
$ cd ./pvr.teleboy && mkdir build && cd build
$ cmake -DADDONS_TO_BUILD=pvr.teleboy -DADDON_SRC_PREFIX=../.. -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=../../xbmc/addons -DPACKAGE_ZIP=1 ../../xbmc/cmake/addons
$ make package-pvr.teleboy -j$(getconf _NPROCESSORS_ONLN)

You will find the according compiled .zip-package here:
~/tmp/pvr.teleboy/build/build/zips/pvr.teleboy+linux/pvr.teleboy-18.2.3.zip


Windows (Windows 10)

Preparation

You need to have installed the following depending applications before proceeding:

  • CMake for Windows → Install by checking the following setting:
    CMake for Windows installer settings
  • Microsoft Visual Studio 2019 Community Edition → Install only the following required Visual Studio packages:
    Visual Studio 2019 installer settings
  • Git for Windows → Install with default installer settings

Compiling

cd /D C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build

vcvars64.bat

mkdir C:\temp\teleboy

cd /D C:\temp\teleboy

git clone https://github.com/Pulse-Eight/platform.git

cd platform

git submodule update --init --recursive

cd windows

build.cmd

cd /D C:\temp\teleboy

git clone --branch Matrix https://github.com/xbmc/xbmc.git

git clone --branch Matrix https://github.com/rbuehlma/pvr.teleboy.git

cd pvr.teleboy

mkdir build

cd build

cmake -DADDONS_TO_BUILD=pvr.teleboy -DADDON_SRC_PREFIX=../.. -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=../../xbmc/addons -DPACKAGE_ZIP=1 ../../xbmc/cmake/addons

msbuild pvr.teleboy.vcxproj /p:Configuration=Release

cd /D C:\temp\teleboy\pvr.teleboy\build\pvr.teleboy-prefix\src\pvr.teleboy-build

cpack

You will find the according compiled .zip-package here:
C:/Users/<myUser>/AppData/Local/Temp/addon-pvr.teleboy-18.2.3-windows-x86_64.zip


Android

Note: Compiling for Android is a more complex process as here we will have to cros-compile our Teleboy add-on. If something does not work the way as it is intended, please take help from the Kodi team via the official Kodi forum via the Development catergory.

Preparation

Helpful links:

First of all, please take not of the following helpful links:

Helpful links

  • There are several versions of Android available. Please be aware that every official Android version has its own API number bound to a specific NDK (Native Development Kit) being released for development purposes. It is needed when compiling for specific Android versions. To make 100% sure you choose the correct Android API version you can always check the following information on your Android device's Kodi installation:
    SettingsSystem informationSummary
    On the following link you can find the official Android API definitions:
    https://source.android.com/docs/setup/reference/build-numbers
    The following link provides the specific NDK downloads (which may be optional):
    https://github.com/android/ndk/wiki/Unsupported-Downloads
  • The following is the official Kodi compiling documentation for Android, where you can find instructions for compiling Kodi itself or even specific Kodi add-ons. It is very well documented, so please read it carefully! If something does not work, you might have missed something ;-):
    https://github.com/xbmc/xbmc/blob/master/docs/README.Android.md

Getting the Android device's architecture:

First off, because there are many(!) different Android devices based on different hardware on the market, you should first get to know about which architecture you need to compile for. To get the correct architecture you should use a shell client app on your Android device, for example ConnectBot.
After you have installed ConnectBot, please open the app and start a new session by tapping on the +-icon. Then tap on protocol and choose local. Now insert and execute the following command:

$ uname -m

The command line output will give you the architecture your Android device is based on, e.g. aarch64 or armv7 (32-bit) or armv8 (64-bit), …
Please keep this output information as you will need it later on.

Installing dependencies:

Now, on your compiling machine, install the according dependencies as follows:

$ sudo apt-get install openjdk-18-jre build-essential git curl autoconf unzip zip zlib1g-dev gawk gperf cmake lib32stdc++6 lib32z1 lib32z1-dev libcurl4-openssl-dev kodi-addons-dev libtinyxml-dev bison flex

Compiling

Note: As already mentioned the following cross-compiling example is for an aarch64 architecture Kodi 21.x Omega add-on target on Android version 13.

The following is just a (working) example. Replace the acording settings as you need for your specific target (Again: Read the official Kodi documentation linked above!):

// Get the latest SDK from here (Look for "Get just the command line tools"):
// https://developer.android.com/studio
// Replace the following link/file with the latest SDK download.
$ cd ~/Downloads
$ wget https://dl.google.com/android/repository/commandlinetools-linux-11076708_latest.zip
$ mkdir -p $HOME/android-tools/android-sdk-linux
$ unzip $HOME/Downloads/commandlinetools-linux-11076708_latest.zip -d $HOME/android-tools/android-sdk-linux/
$ rm -rf $HOME/Downloads/commandlinetools-linux-11076708_latest.zip
// Before Android SDK can be used, you need to accept the licenses and configure it:
$ cd $HOME/android-tools/android-sdk-linux/cmdline-tools/bin
$ ./sdkmanager --sdk_root=$(pwd)/../.. --licenses # Confirm every query by inserting "y"
$ ./sdkmanager --sdk_root=$(pwd)/../.. platform-tools
$ ./sdkmanager --sdk_root=$(pwd)/../.. "platforms;android-33" # Select Andriod API version
$ ./sdkmanager --sdk_root=$(pwd)/../.. "build-tools;33.0.1" # Select build tools version
$ ./sdkmanager --sdk_root=$(pwd)/../.. "ndk;21.4.7075529" # Select NDK version
// All packages must be signed. The following command will generate a self-signed debug key. If the result is a cryptic error, it probably just means a debug key already existed.
$ keytool -genkey -keystore ~/.android/debug.keystore -v -alias androiddebugkey -dname "CN=Android Debug,O=Android,C=US" -keypass android -storepass android -keyalg RSA -keysize 2048 -validity 10000
// Get the according Kodi branch source code:
$ cd $HOME
$ git clone -b Omega https://github.com/xbmc/xbmc kodi
// Prepare to configure build:
$ cd $HOME/kodi/tools/depends
$ ./bootstrap
// Configure build for aarch64:
$ ./configure --with-tarballs=$HOME/android-tools/xbmc-tarballs --host=aarch64-linux-android --with-sdk-path=$HOME/android-tools/android-sdk-linux --with-ndk-path=$HOME/android-tools/android-sdk-linux/ndk/21.4.7075529 --prefix=$HOME/android-tools/xbmc-depends
// Build tools and dependencies (This may take a long time!):
$ make -j$(getconf _NPROCESSORS_ONLN)
// Build the pvr.teleboy add-on:
$ cd $HOME/kodi
$ make -j$(getconf _NPROCESSORS_ONLN) -C tools/depends/target/binary-addons ADDONS="pvr.teleboy"
// Build the pvr.teleboy .ZIP-package:
$ cd $HOME/kodi/tools/depends/target/binary-addons/aarch64-linux-android-21-debug
$ make package-pvr.teleboy
// Move the built .ZIP-package to the user's home folder:
$ mv $HOME/kodi/tools/depends/target/binary-addons/aarch64-linux-android-21-debug/pvr.teleboy-prefix/src/pvr.teleboy-build/pvr.teleboy-0.1.1-Android.zip ~

Note that for some reason the build management tool is not naming the .ZIP-package accordingly, the version number on the package (version 0.1.1 in this case) is completely wrong.

Now after everything went successfully you might thinks this is it and you can just upload the .ZIP-package to your Android device and install the add-on, right? But wait… You will take notice that the add-on installation will fail due to …wrong file structure error message. So what's the deal here? Well, when taking a look into the generated .ZIP-package it comes out that the folder/file structure which is being generated automatically as follows is indeed wrong:

.
├── lib
│   └── kodi
│       └── addons
│           └── pvr.teleboy
│               └── libpvr.teleboy.so
└── share
    └── kodi
        └── addons
            └── pvr.teleboy
                ├── addon.xml
                ├── fanart.jpg
                ├── icon.png
                ├── LICENSE.txt
                └── resources
                    ├── eit_categories.txt
                    ├── language
                    │   └── resource.language.en_gb
                    │       └── strings.po
                    │   └── resource.language.de_de
                    │       └── strings.po
                    └── settings.xml

So the next step is to unzip the generated .ZIP-package, adjust the file structure and delete the needless data as follows and also copy and add the following file manually from here (this is due to the build management tool does not include the required libpvr.teleboy.so file into the .ZIP-package for whatever reason):

$HOME/kodi/tools/depends/target/binary-addons/aarch64-linux-android-21-debug/pvr.teleboy-prefix/src/pvr.teleboy-build/libpvr.teleboy.so

The .ZIP-package's folder/file structure is supposed to look like this (Yes, you have to delete the ./lib folder from above completely and you also have to extract the pvr.teleboy folder from ./share/kodi/addon completely):

pvr.teleboy
   ├── addon.xml
   ├── fanart.jpg
   ├── icon.png
   ├── libpvr.teleboy.so
   ├── LICENSE.txt
   └── resources
       ├── eit_categories.txt
       ├── language
       │   └── resource.language.en_gb
       │       └── strings.po
       │   └── resource.language.de_de
       │       └── strings.po
       └── settings.xml

Now create the .ZIP-package manually again, copy it over to your Android Kodi installation and install it (Please note that you will also need to install the inputstream.adaptive add-on (which you can install from the official Kodi video add-on repository) first before installing the pvr.teleboy add-on.).

End of tutorial



Appreciate my work?
Buy me a coffee or PayPal

kodicompilingteleboy.txt · Last modified: 2024/10/03