summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarel Kočí <cynerd@email.cz>2020-02-04 23:56:44 +0100
committerKarel Kočí <cynerd@email.cz>2020-02-04 23:56:44 +0100
commitfda42396b11d15726b9264f9bfdd6f68c439f5ff (patch)
tree66149f03b80f07074844b506cdfb37f4d2a3bd7e
parentdfcb10fdfdd7f18be775c142fe70b6d06e124d3a (diff)
downloadalpine-personal-pkgs-fda42396b11d15726b9264f9bfdd6f68c439f5ff.tar.gz
alpine-personal-pkgs-fda42396b11d15726b9264f9bfdd6f68c439f5ff.tar.bz2
alpine-personal-pkgs-fda42396b11d15726b9264f9bfdd6f68c439f5ff.zip
kodi: add and try to add raspberry pi build
-rw-r--r--kodi/60-kodi.rules12
-rw-r--r--kodi/APKBUILD278
-rw-r--r--kodi/cassert.patch25
-rw-r--r--kodi/fix-musl-incompability.patch108
-rw-r--r--kodi/kodi-gbm.pre-install10
-rw-r--r--kodi/kodi.initd12
-rw-r--r--kodi/set-default-stacksize.patch10
7 files changed, 455 insertions, 0 deletions
diff --git a/kodi/60-kodi.rules b/kodi/60-kodi.rules
new file mode 100644
index 0000000..7023ff7
--- /dev/null
+++ b/kodi/60-kodi.rules
@@ -0,0 +1,12 @@
+// DO NOT EDIT THIS FILE, it will be overwritten on update
+//
+// Allows shutting down the system when using Kodi with a dedicated user
+
+polkit.addRule(function(action, subject) {
+ if (( (action.id.indexOf("org.freedesktop.udisks.") == 0) ||
+ (action.id.indexOf("org.freedesktop.upower.") == 0) ||
+ (action.id.indexOf("org.freedesktop.login1.") == 0) ) &&
+ subject.user == "kodi") {
+ return polkit.Result.YES;
+ }
+});
diff --git a/kodi/APKBUILD b/kodi/APKBUILD
new file mode 100644
index 0000000..1b3f6d5
--- /dev/null
+++ b/kodi/APKBUILD
@@ -0,0 +1,278 @@
+# Contributor: Carlo Landmeter <clandmeter@gmail.com>
+# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
+pkgname=kodi
+pkgver=18.5
+_realname=Leia
+pkgrel=0
+_libdvdcss_pkgver="1.4.2-Leia-Beta-5"
+_libdvdread_pkgver="6.0.0-Leia-Alpha-3"
+_libdvdnav_pkgver="6.0.0-Leia-Alpha-3"
+_crossguid_hash="8f399e8bd4"
+pkgdesc="A software media player and entertainment hub for digital media"
+url="https://kodi.tv"
+arch="x86 x86_64 armhf armv7 aarch64"
+license="GPL-2.0-only"
+depends="python2
+ hicolor-icon-theme
+ xdpyinfo
+ curl
+ py-pillow
+ py-bluez
+ py-simplejson"
+# Required dependencies
+depends_dev="libass-dev
+ libcdio-dev
+ curl-dev
+ ffmpeg-dev
+ flatbuffers-dev
+ fmt-dev
+ freetype-dev
+ fribidi-dev
+ fstrcmp-dev
+ libdvdcss-dev
+ lzo-dev
+ openssl-dev
+ pcre-dev
+ rapidjson-dev
+ sqlite-dev
+ taglib-dev
+ tinyxml-dev
+ zlib-dev
+ giflib-dev
+ mesa-dev
+ glu-dev
+ libjpeg-turbo-dev
+"
+
+# Required for Wayland
+depends_dev="$depends_dev
+ waylandpp-dev
+ libxkbcommon-dev
+"
+
+# Required for gbm
+depends_dev="$depends_dev
+ libinput-dev
+"
+
+# Required for Raspberry Pi
+depends_dev="$depends_dev
+ raspberrypi-dev
+"
+
+# Optional for extra features
+depends_dev="$depends_dev
+ alsa-lib-dev
+ avahi-dev
+ bluez-dev
+ libbluray-dev
+ libcap-dev
+ libcec-dev
+ dbus-dev
+ libmicrohttpd-dev
+ libnfs-dev
+ libplist-dev
+ pulseaudio-dev
+ python2-dev
+ samba-dev
+ eudev-dev
+ libxslt-dev
+ mariadb-connector-c-dev
+ libshairport-dev
+ libva-glx-dev"
+makedepends="$depends_dev
+ cmake
+ swig
+ autoconf
+ automake
+ libtool
+ doxygen
+ graphviz
+ xz
+ tar
+ openjdk8-jre-base
+ wayland-protocols"
+subpackages="$pkgname-dev $pkgname-doc $pkgname-openrc $pkgname-dbg $pkgname-bin $pkgname-wayland $pkgname-gbm $pkgname-rpi $pkgname-polkit::noarch"
+replaces="xbmc"
+options="ldpath-recursive !check" # No testsuite
+source="https://github.com/xbmc/xbmc/archive/$pkgver-$_realname.tar.gz
+ libdvdcss-$_libdvdcss_pkgver.tar.gz::https://github.com/xbmc/libdvdcss/archive/$_libdvdcss_pkgver.tar.gz
+ libdvdread-$_libdvdread_pkgver.tar.gz::https://github.com/xbmc/libdvdread/archive/$_libdvdread_pkgver.tar.gz
+ libdvdnav-$_libdvdnav_pkgver.tar.gz::https://github.com/xbmc/libdvdnav/archive/$_libdvdnav_pkgver.tar.gz
+ crossguid-$_crossguid_hash.tar.gz::https://mirrors.kodi.tv/build-deps/sources/crossguid-$_crossguid_hash.tar.gz
+ set-default-stacksize.patch
+ fix-musl-incompability.patch
+ cassert.patch
+ kodi.initd
+ 60-kodi.rules
+ "
+
+builddir="$srcdir/xbmc-$pkgver-$_realname"
+
+# secfixes:
+# 18.2-r0:
+# - CVE-2018-8831
+
+prepare() {
+ default_prepare
+
+ mkdir "$builddir"/build-x11
+ mkdir "$builddir"/build-wayland
+ mkdir "$builddir"/build-gbm
+}
+
+build() {
+ make -C tools/depends/target/crossguid PREFIX="$PWD"/usr
+
+ # X11
+ cd "$builddir"/build-x11
+ cmake "$builddir" \
+ -DCMAKE_BUILD_TYPE=RelWithDebInfo \
+ -DCMAKE_INSTALL_PREFIX=/usr \
+ -DCMAKE_INSTALL_LIBDIR=lib \
+ -DENABLE_INTERNAL_CROSSGUID=ON \
+ -DENABLE_INTERNAL_FFMPEG=OFF \
+ -DENABLE_INTERNAL_RapidJSON=OFF \
+ -DENABLE_INTERNAL_FMT=OFF \
+ -DENABLE_INTERNAL_FSTRCMP=OFF \
+ -DENABLE_INTERNAL_FLATBUFFERS=OFF \
+ -Dlibdvdcss_URL="$srcdir"/libdvdcss-$_libdvdcss_pkgver.tar.gz \
+ -Dlibdvdread_URL="$srcdir"/libdvdread-$_libdvdread_pkgver.tar.gz \
+ -Dlibdvdnav_URL="$srcdir"/libdvdnav-$_libdvdnav_pkgver.tar.gz \
+ -DCROSSGUID_URL="$srcdir"/crossguid-$_crossguid_hash.tar.gz
+ make
+ make preinstall
+
+ # Wayland
+ cd "$builddir"/build-wayland
+ cmake "$builddir" \
+ -DCMAKE_BUILD_TYPE=RelWithDebInfo \
+ -DCMAKE_INSTALL_PREFIX=/usr \
+ -DCMAKE_INSTALL_LIBDIR=lib \
+ -DENABLE_INTERNAL_CROSSGUID=ON \
+ -DENABLE_INTERNAL_FFMPEG=OFF \
+ -DENABLE_INTERNAL_RapidJSON=OFF \
+ -DENABLE_INTERNAL_FMT=OFF \
+ -DENABLE_INTERNAL_FSTRCMP=OFF \
+ -DENABLE_INTERNAL_FLATBUFFERS=OFF \
+ -Dlibdvdcss_URL="$srcdir"/libdvdcss-$_libdvdcss_pkgver.tar.gz \
+ -Dlibdvdread_URL="$srcdir"/libdvdread-$_libdvdread_pkgver.tar.gz \
+ -Dlibdvdnav_URL="$srcdir"/libdvdnav-$_libdvdnav_pkgver.tar.gz \
+ -DCROSSGUID_URL="$srcdir"/crossguid-$_crossguid_hash.tar.gz \
+ -DCORE_PLATFORM_NAME=wayland \
+ -DWAYLAND_RENDER_SYSTEM=gl
+ make
+ make preinstall
+
+ # GBM
+ cd "$builddir"/build-gbm
+ cmake "$builddir" \
+ -DCMAKE_BUILD_TYPE=RelWithDebInfo \
+ -DCMAKE_INSTALL_PREFIX=/usr \
+ -DCMAKE_INSTALL_LIBDIR=lib \
+ -DENABLE_INTERNAL_CROSSGUID=ON \
+ -DENABLE_INTERNAL_FFMPEG=OFF \
+ -DENABLE_INTERNAL_RapidJSON=OFF \
+ -DENABLE_INTERNAL_FMT=OFF \
+ -DENABLE_INTERNAL_FSTRCMP=OFF \
+ -DENABLE_INTERNAL_FLATBUFFERS=OFF \
+ -Dlibdvdcss_URL="$srcdir"/libdvdcss-$_libdvdcss_pkgver.tar.gz \
+ -Dlibdvdread_URL="$srcdir"/libdvdread-$_libdvdread_pkgver.tar.gz \
+ -Dlibdvdnav_URL="$srcdir"/libdvdnav-$_libdvdnav_pkgver.tar.gz \
+ -DCROSSGUID_URL="$srcdir"/crossguid-$_crossguid_hash.tar.gz \
+ -DCORE_PLATFORM_NAME=gbm \
+ -DGBM_RENDER_SYSTEM=gles
+ make
+ make preinstall
+
+
+ # Raspberry Pi
+ cd "$builddir"/build-rpi
+ cmake "$builddir" \
+ -DCMAKE_BUILD_TYPE=RelWithDebInfo \
+ -DCMAKE_INSTALL_PREFIX=/usr \
+ -DCMAKE_INSTALL_LIBDIR=lib \
+ -DCMAKE_PREFIX_PATH=/opt/vc \
+ -DENABLE_EVENTCLIENTS=ON \
+ -DENABLE_OPENGL=OFF \
+ -DENABLE_INTERNAL_FFMPEG=ON \
+ -DENABLE_INTERNAL_FMT=OFF \
+ -DENABLE_INTERNAL_CROSSGUID=ON \
+ -DENABLE_INTERNAL_FSTRCMP=OFF \
+ -DENABLE_INTERNAL_FLATBUFFERS=OFF \
+ -DENABLE_INTERNAL_RapidJSON=OFF \
+ -Dlibdvdcss_URL="$srcdir"/libdvdcss-$_libdvdcss_pkgver.tar.gz \
+ -Dlibdvdread_URL="$srcdir"/libdvdread-$_libdvdread_pkgver.tar.gz \
+ -Dlibdvdnav_URL="$srcdir"/libdvdnav-$_libdvdnav_pkgver.tar.gz \
+ -DCROSSGUID_URL="$srcdir"/crossguid-$_crossguid_hash.tar.gz \
+ -DCORE_PLATFORM_NAME=rbpi
+ make
+ make preinstall
+}
+
+package() {
+ depends="$pkgname-bin"
+
+ cd "$builddir"/build-x11
+ make DESTDIR="$pkgdir" install
+
+ install -Dm755 "$srcdir"/kodi.initd "$pkgdir"/etc/init.d/kodi
+
+ rm \
+ "$pkgdir"/usr/lib/kodi/kodi-x11 \
+ "$pkgdir"/usr/lib/kodi/kodi-xrandr
+}
+
+bin() {
+ pkgdesc="X11 Kodi binary"
+
+ cd "$builddir"/build-x11
+ install -Dm755 kodi-x11 "$subpkgdir"/usr/lib/kodi/kodi-x11
+ install -Dm755 kodi-xrandr "$subpkgdir"/usr/lib/kodi/kodi-xrandr
+}
+
+wayland() {
+ pkgdesc="Wayland Kodi binary"
+ provides="$pkgname-bin"
+
+ cd "$builddir"/build-wayland
+ install -Dm755 kodi-wayland "$subpkgdir"/usr/lib/kodi/kodi-wayland
+}
+
+gbm() {
+ pkgdesc="GBM Kodi binary"
+ provides="$pkgname-bin"
+ depends="$pkgname-openrc"
+ install="$subpkgname.pre-install"
+
+ cd "$builddir"/build-gbm
+ install -Dm755 kodi-gbm "$subpkgdir"/usr/lib/kodi/kodi-gbm
+}
+
+rpi() {
+ pkgdesc="Kodi binary for Raspberry Pi"
+ provides="$pkgname-bin"
+
+ cd "$builddir"/build-rpi
+ ls
+ install -Dm755 kodi-x11 "$subpkgdir"/usr/lib/kodi/kodi-x11
+ install -Dm755 kodi-xrandr "$subpkgdir"/usr/lib/kodi/kodi-xrandr
+}
+
+polkit() {
+ pkgdesc="Polkit rules for Kodi in combination with GBM"
+ install_if="$pkgname-gbm polkit"
+
+ install -Dm644 "$srcdir"/60-kodi.rules "$subpkgdir"/etc/polkit-1/rules.d/60-kodi.rules
+}
+
+sha512sums="6fe70d8ee5b6ffd3d43b89487554e41eed8dbf95bb017b82578b547ec248ae94f4dda298f0d85c5896019f7032eba4e1e2494c8140dde9c9b9cb21802acfd029 18.5-Leia.tar.gz
+5185dbdbeb1bd13ea9d8723f1f4ab599d6f3102f5ba1096cd085aa1cda252c045f327c719227bba8e1b742352ade5e335106c8d0c1637a5a6b93ce661620dd7e libdvdcss-1.4.2-Leia-Beta-5.tar.gz
+b3419ba0a1a2dd70f1bb6236afdfe1c6e88c9ad4264198b289e3bba9375e077cecf7f89848c7b09debaa445327f3507101f3d157e692f7a7163b2bb52643e1e7 libdvdread-6.0.0-Leia-Alpha-3.tar.gz
+11c93eaacd156f8fd7dec7c43d366438b201f31ad55b2870463a9e286912b6ada08882319a021fb7992190f87b909a49f2b83e0321cc17aedc29f7fe5898fa72 libdvdnav-6.0.0-Leia-Alpha-3.tar.gz
+2682d63609d3dcdfcd8136be632e45df26ad88ce93b9c49745cf728bbd2e6254a7b05c8b059ab581d532372e504206a525a52564b64d076dfdae9c965a09fd16 crossguid-8f399e8bd4.tar.gz
+3fd97e9fa22e59b3cd30fdad19474e177a9d062598765fa8ba4955f1da4e10581ff1463dd0794d3ee3cefebf753007a4d445b2bc47a257574d3927c1408b8876 set-default-stacksize.patch
+65b78a96bef33cec975b371f1a930d551d7b224955d6075b7edc7e51ec30fec9c77d34f622abbaf827c60df6029206b72c02ee2d2f138d276c1b843336fd14ab fix-musl-incompability.patch
+7348495a805d07730dc569b091f15765ca9d86fa28987a343dfc7fa36cd6ecbb52ac4ea76d7c9fe9eab90ed8552ef6aeae7ffd72edd11f8d780c1de2e9ffe49d cassert.patch
+7e2a2289da3098e0007e461ad538dcd6435e908283caf1719788248fe736615890175e11392ca0cd68002872217bbf7b70cf909f228307828aa82467d5502ed4 kodi.initd
+465a2079d598bf909a458d8e9d0ddd2b2a41dff83ba736542cffec7811c044295d5af092928f20aaa6cd3bc8b13bb03ede5c7ded1783680f890464e103392787 60-kodi.rules"
diff --git a/kodi/cassert.patch b/kodi/cassert.patch
new file mode 100644
index 0000000..5246c5c
--- /dev/null
+++ b/kodi/cassert.patch
@@ -0,0 +1,25 @@
+diff --git a/xbmc/profiles/dialogs/GUIDialogProfileSettings.cpp b/xbmc/profiles/dialogs/GUIDialogProfileSettings.cpp
+index 222d1fa..0f654ee 100644
+--- a/xbmc/profiles/dialogs/GUIDialogProfileSettings.cpp
++++ b/xbmc/profiles/dialogs/GUIDialogProfileSettings.cpp
+@@ -30,6 +30,7 @@
+ #include "utils/log.h"
+ #include "utils/StringUtils.h"
+ #include "utils/URIUtils.h"
++#include <cassert>
+ #include "utils/Variant.h"
+ #include "ServiceBroker.h"
+
+diff --git a/xbmc/windowing/GraphicContext.cpp b/xbmc/windowing/GraphicContext.cpp
+index 1ced496..0ddbe64 100644
+--- a/xbmc/windowing/GraphicContext.cpp
++++ b/xbmc/windowing/GraphicContext.cpp
+@@ -24,6 +24,8 @@
+ #include "guilib/GUIWindowManager.h"
+ #include "guilib/TextureManager.h"
+
++#include <cassert>
++
+ using namespace KODI::MESSAGING;
+
+ CGraphicContext::CGraphicContext(void) = default;
diff --git a/kodi/fix-musl-incompability.patch b/kodi/fix-musl-incompability.patch
new file mode 100644
index 0000000..77d9bb8
--- /dev/null
+++ b/kodi/fix-musl-incompability.patch
@@ -0,0 +1,108 @@
+diff --git a/xbmc/cores/DllLoader/exports/emu_msvcrt.cpp b/xbmc/cores/DllLoader/exports/emu_msvcrt.cpp
+index 1d5564c8c5..73c07fb586 100644
+--- a/xbmc/cores/DllLoader/exports/emu_msvcrt.cpp
++++ b/xbmc/cores/DllLoader/exports/emu_msvcrt.cpp
+@@ -72,6 +72,13 @@
+ #include "platform/win32/CharsetConverter.h"
+ #endif
+
++#ifndef _PATH_MOUNTED
++#define _PATH_MOUNTED "/proc/mounts"
++#endif
++#ifndef _PATH_MNTTAB
++#define _PATH_MNTTAB "/etc/fstab"
++#endif
++
+ using namespace XFILE;
+
+ struct SDirData
+@@ -124,7 +131,7 @@ extern "C" void __stdcall init_emu_environ()
+ dll_putenv("OS=win10");
+ #elif defined(TARGET_DARWIN)
+ dll_putenv("OS=darwin");
+-#elif defined(TARGET_POSIX)
++#elif defined(TARGET_POSIX) || !defined(__GLIBC__)
+ dll_putenv("OS=linux");
+ #else
+ dll_putenv("OS=unknown");
+@@ -1480,7 +1487,7 @@ extern "C"
+ int ret;
+
+ ret = dll_fgetpos64(stream, &tmpPos);
+-#if !defined(TARGET_POSIX) || defined(TARGET_DARWIN) || defined(TARGET_FREEBSD) || defined(TARGET_ANDROID)
++#if !defined(__GLIBC__) || !defined(TARGET_POSIX) || defined(TARGET_DARWIN) || defined(TARGET_FREEBSD) || defined(TARGET_ANDROID)
+ *pos = (fpos_t)tmpPos;
+ #else
+ pos->__pos = (off_t)tmpPos.__pos;
+@@ -1493,8 +1500,9 @@ extern "C"
+ CFile* pFile = g_emuFileWrapper.GetFileXbmcByStream(stream);
+ if (pFile != NULL)
+ {
+-#if !defined(TARGET_POSIX) || defined(TARGET_DARWIN) || defined(TARGET_FREEBSD) || defined(TARGET_ANDROID)
+- *pos = pFile->GetPosition();
++#if !defined(__GLIBC__) || !defined(TARGET_POSIX) || defined(TARGET_DARWIN) || defined(TARGET_FREEBSD) || defined(TARGET_ANDROID)
++ uint64_t *ppos = (uint64_t *)pos;
++ *ppos = pFile->GetPosition();
+ #else
+ pos->__pos = pFile->GetPosition();
+ #endif
+@@ -1509,8 +1517,9 @@ extern "C"
+ int fd = g_emuFileWrapper.GetDescriptorByStream(stream);
+ if (fd >= 0)
+ {
+-#if !defined(TARGET_POSIX) || defined(TARGET_DARWIN) || defined(TARGET_FREEBSD) || defined(TARGET_ANDROID)
+- if (dll_lseeki64(fd, *pos, SEEK_SET) >= 0)
++#if !defined(TARGET_POSIX) || !defined(__GLIBC__) || defined(TARGET_DARWIN) || defined(TARGET_FREEBSD) || defined(TARGET_ANDROID)
++ const uint64_t *ppos = (const uint64_t *) pos;
++ if (dll_lseeki64(fd, *ppos, SEEK_SET) >= 0)
+ #else
+ if (dll_lseeki64(fd, (__off64_t)pos->__pos, SEEK_SET) >= 0)
+ #endif
+@@ -1532,7 +1541,7 @@ extern "C"
+ if (fd >= 0)
+ {
+ fpos64_t tmpPos;
+-#if !defined(TARGET_POSIX) || defined(TARGET_DARWIN) || defined(TARGET_FREEBSD) || defined(TARGET_ANDROID)
++#if !defined(__GLIBC__) || !defined(TARGET_POSIX) || defined(TARGET_DARWIN) || defined(TARGET_FREEBSD) || defined(TARGET_ANDROID)
+ tmpPos= *pos;
+ #else
+ tmpPos.__pos = (off64_t)(pos->__pos);
+diff --git a/xbmc/cores/DllLoader/exports/emu_msvcrt.h b/xbmc/cores/DllLoader/exports/emu_msvcrt.h
+index 7869dc221c..3b86d6b45b 100644
+--- a/xbmc/cores/DllLoader/exports/emu_msvcrt.h
++++ b/xbmc/cores/DllLoader/exports/emu_msvcrt.h
+@@ -17,7 +17,7 @@
+ #define _onexit_t void*
+ #endif
+
+-#if defined(TARGET_DARWIN) || defined(TARGET_FREEBSD) || defined(TARGET_ANDROID)
++#if !defined(__GLIBC__) || defined(TARGET_DARWIN) || defined(TARGET_FREEBSD) || defined(TARGET_ANDROID)
+ typedef off_t __off_t;
+ typedef int64_t off64_t;
+ typedef off64_t __off64_t;
+diff --git a/xbmc/cores/DllLoader/exports/wrapper.c b/xbmc/cores/DllLoader/exports/wrapper.c
+index 33ab3437c1..5a68de2c64 100644
+--- a/xbmc/cores/DllLoader/exports/wrapper.c
++++ b/xbmc/cores/DllLoader/exports/wrapper.c
+@@ -23,7 +23,7 @@
+ #include <dirent.h>
+ #include <dlfcn.h>
+
+-#if defined(TARGET_DARWIN) || defined(TARGET_FREEBSD) || defined(TARGET_ANDROID)
++#if !defined(__GLIBC__) || defined(TARGET_DARWIN) || defined(TARGET_FREEBSD) || defined(TARGET_ANDROID)
+ typedef off_t __off_t;
+ typedef int64_t off64_t;
+ typedef off64_t __off64_t;
+diff --git a/xbmc/cores/DllLoader/ldt_keeper.c b/xbmc/cores/DllLoader/ldt_keeper.c
+index 0e6bc81bf7..73f1346458 100644
+--- a/xbmc/cores/DllLoader/ldt_keeper.c
++++ b/xbmc/cores/DllLoader/ldt_keeper.c
+@@ -49,7 +49,7 @@
+ #ifdef __cplusplus
+ extern "C" {
+ #endif
+-#if defined(TARGET_ANDROID) && defined(__i386__) && !defined(modify_ldt)
++#if defined(__linux__) && !defined(__GLIBC__) && !defined(modify_ldt)
+ #define modify_ldt(a,b,c) syscall( __NR_modify_ldt, a, b, c);
+ #else
+ int modify_ldt(int func, void *ptr, unsigned long bytecount);
diff --git a/kodi/kodi-gbm.pre-install b/kodi/kodi-gbm.pre-install
new file mode 100644
index 0000000..03b2e52
--- /dev/null
+++ b/kodi/kodi-gbm.pre-install
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+addgroup -S kodi 2>/dev/null
+adduser -S -D -h /var/lib/kodi -s /sbin/nologin -G kodi kodi 2>/dev/null
+
+for group in video audio input; do
+ adduser kodi $group 2>/dev/null
+done
+
+exit 0
diff --git a/kodi/kodi.initd b/kodi/kodi.initd
new file mode 100644
index 0000000..4fedd31
--- /dev/null
+++ b/kodi/kodi.initd
@@ -0,0 +1,12 @@
+#!/sbin/openrc-run
+
+supervisor=supervise-daemon
+
+name="Kodi"
+description="A software media player and entertainment hub for digital media"
+
+command=/usr/lib/kodi/kodi-gbm
+command_args="--standalone"
+command_background=true
+pidfile="/var/run/kodi.pid"
+command_user="kodi:kodi"
diff --git a/kodi/set-default-stacksize.patch b/kodi/set-default-stacksize.patch
new file mode 100644
index 0000000..8a79215
--- /dev/null
+++ b/kodi/set-default-stacksize.patch
@@ -0,0 +1,10 @@
+--- ./xbmc/threads/platform/pthreads/ThreadImpl.cpp.orig
++++ ./xbmc/threads/platform/pthreads/ThreadImpl.cpp
+@@ -42,6 +42,7 @@
+ {
+ pthread_attr_t attr;
+ pthread_attr_init(&attr);
++ if (!stacksize) stacksize = 1024*1024;
+ #if !defined(TARGET_ANDROID) // http://code.google.com/p/android/issues/detail?id=7808
+ if (stacksize > PTHREAD_STACK_MIN)
+ pthread_attr_setstacksize(&attr, stacksize);