# Kodi on FreeBSD - no more options to install or build a current version?



## recluce (Nov 11, 2020)

It looks like there is no maintainer now for any version of Kodi on FreeBSD. The developer version (multimedia/kodi-devel) is outdated and buggy, Kodi 18 is going to be removed soon due to Python 2 dependency. Also, 19.0.a20200727 (multimedia/kodi-devel) is buggy, it has a known breakage in that it cannot play any ISO file (DVD, Blu-Ray). This has been fixed for the current alpha version

So I wanted to build it myself, which I did successfully in the past. The instructions on the Kodi website are not very helpful and appear to be outdated, but anyway, I set up the build environment and started with cmake, which fails with an error. The exact error changes depending on which exact version I pull (all in the current 19-Alpha branch), but mostly configuration fails with lots of header files missing, e.g. gbm.h, drm_mode.h, linux/stat.h etc. Below is an example:




```
Checking whether the ASM compiler is GNU using "--version" did not match "(GNU assembler)|(GCC)|(Free Software Foundation)":
FreeBSD clang version 10.0.1 (git@github.com:llvm/llvm-project.git llvmorg-10.0.1-0-gef32c611aa2)
Target: x86_64-unknown-freebsd12.2
Thread model: posix
InstalledDir: /usr/bin
Determining if the include file sys/inotify.h exists failed with the following output:
Change Dir: /home/kodi/sources/kodi-build/CMakeFiles/CMakeTmp

Run Build Command(s):/usr/local/bin/gmake cmTC_9855e/fast && /usr/local/bin/gmake  -f CMakeFiles/cmTC_9855e.dir/build.make CMakeFiles/cmTC_9855e.dir/build
gmake[1]: Entering directory '/usr/home/kodi/sources/kodi-build/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_9855e.dir/CheckIncludeFile.c.o
/usr/bin/cc    -o CMakeFiles/cmTC_9855e.dir/CheckIncludeFile.c.o -c /home/kodi/sources/kodi-build/CMakeFiles/CMakeTmp/CheckIncludeFile.c
/home/kodi/sources/kodi-build/CMakeFiles/CMakeTmp/CheckIncludeFile.c:1:10: fatal error: 'sys/inotify.h' file not found
#include <sys/inotify.h>
         ^~~~~~~~~~~~~~~
1 error generated.
gmake[1]: *** [CMakeFiles/cmTC_9855e.dir/build.make:85: CMakeFiles/cmTC_9855e.dir/CheckIncludeFile.c.o] Error 1
gmake[1]: Leaving directory '/usr/home/kodi/sources/kodi-build/CMakeFiles/CMakeTmp'
gmake: *** [Makefile:140: cmTC_9855e/fast] Error 2


Determining if the STATX_BTIME exist failed with the following output:
Change Dir: /home/kodi/sources/kodi-build/CMakeFiles/CMakeTmp

Run Build Command(s):/usr/local/bin/gmake cmTC_c2b23/fast && /usr/local/bin/gmake  -f CMakeFiles/cmTC_c2b23.dir/build.make CMakeFiles/cmTC_c2b23.dir/build
gmake[1]: Entering directory '/usr/home/kodi/sources/kodi-build/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_c2b23.dir/CheckSymbolExists.c.o
/usr/bin/cc -D_GNU_SOURCE   -o CMakeFiles/cmTC_c2b23.dir/CheckSymbolExists.c.o -c /home/kodi/sources/kodi-build/CMakeFiles/CMakeTmp/CheckSymbolExists.c
/home/kodi/sources/kodi-build/CMakeFiles/CMakeTmp/CheckSymbolExists.c:2:10: fatal error: 'linux/stat.h' file not found
#include <linux/stat.h>
         ^~~~~~~~~~~~~~
1 error generated.
gmake[1]: *** [CMakeFiles/cmTC_c2b23.dir/build.make:85: CMakeFiles/cmTC_c2b23.dir/CheckSymbolExists.c.o] Error 1
gmake[1]: Leaving directory '/usr/home/kodi/sources/kodi-build/CMakeFiles/CMakeTmp'
gmake: *** [Makefile:140: cmTC_c2b23/fast] Error 2
```


I am compiling with 10.0.1 on FreeBSD 12-STABLE, base and ports are updated. I am sure I miss vital information here - but bare with me, my build skills are a bit rusty. I am happy to provide whatever a kind soul willing to help wants to know.

I am also getting a bit frustrated here: if I can't get Kodi to build, I would have to migrate the whole HTPC to Linux - which I really do not want (I had terrible audio issues, such as lagging and no pass-through, under Linux in the past).


----------



## SirDice (Nov 11, 2020)

If you want to update Kodi you should take the current port as a base. A lot of times you only have to change the version numbers and it'll build correctly. Other times you may need to adjust existing patches or create new ones. Having the original port as a basis will help with getting things to build as the build process itself is usually the same with every new version. So you don't have to figure it all out from scratch.

Just modify the DISTVERSION (and set PORTREVISION to 0). Useful commands:

```
make makesum # Downloads the distfile and calculates a new 'distinfo' file
make extract # Extract the distfiles
make patch # Apply local patches
make configure # Run the ./configure process
```


----------



## monwarez (Nov 11, 2020)

You should test from https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=250546 (which is an update to 19.0a2-Matrix), and then patch it to the latest


----------



## recluce (Nov 14, 2020)

Thank you SirDice and monwarez. Combining advice from both of you I was able to modify the port directory to successfully build 19.0a2. Now the next step is to build 19.0a3.

Looking at the patch file that rozhuk.im created for 19.0a2, there were a lot of changes in the header files for pkg-plist. I wonder how I would figure out changes for 19.0a3. Could anybody nudge me in  the right direction here, please?


----------



## monwarez (Nov 15, 2020)

It is a matter of changing the DISTVERSION to the desired version, and then do (assuming that you recalculate the distinfo)
`make BATCH=yes`
If this succeed you just need to do
`make makeplist > pkg-new`
And then compare pkg-plist with pkg-new, if everything seems ok you can remove the first line of pkg-new and replace pkg-plist with the content of pkg-new (you can remove pkg-new after).
Finally clean the workdir and do
`make package`
And check that there is no error

Finally you could use poudriere to test your update with testport option.


----------

