added alarm/kodi-rbp

Upstream dropped support for RPi platform since gbm matured and is stable[1].
This package should support RPi2+ hardware.

1. https://github.com/xbmc/xbmc/pull/16321
This commit is contained in:
graysky 2020-12-09 16:44:39 -05:00
parent 2fd46d9343
commit 143a7443c6
9 changed files with 632 additions and 0 deletions

View file

@ -0,0 +1,221 @@
From 7a1aadd24415ee0af3a0a57877c499f8933b08fc Mon Sep 17 00:00:00 2001
From: Lukas Rusak <lorusak@gmail.com>
Date: Thu, 30 Jan 2020 14:32:12 -0800
Subject: [PATCH 1/2] FFmpeg: Bump to 4.2.2-Matrix-Alpha1
---
cmake/modules/FindFFMPEG.cmake | 16 ++++++------
.../patches/0001-ffmpeg-detect-openssl.patch | 19 +++-----------
.../0002-ffmpeg-zlib-config-conflict.patch | 13 +++++++++-
.../windows/patches/0003-ffmpeg-static.patch | 25 +++++++++++++++++--
tools/depends/target/Makefile | 1 +
tools/depends/target/ffmpeg/FFMPEG-VERSION | 2 +-
6 files changed, 48 insertions(+), 28 deletions(-)
diff --git a/cmake/modules/FindFFMPEG.cmake b/cmake/modules/FindFFMPEG.cmake
index ef74671d4002..26ee23944d2a 100644
--- a/cmake/modules/FindFFMPEG.cmake
+++ b/cmake/modules/FindFFMPEG.cmake
@@ -33,14 +33,14 @@
#
# required ffmpeg library versions
-set(REQUIRED_FFMPEG_VERSION 4.0)
-set(_avcodec_ver ">=58.18.100")
-set(_avfilter_ver ">=7.16.100")
-set(_avformat_ver ">=58.12.100")
-set(_avutil_ver ">=56.14.100")
-set(_swscale_ver ">=5.1.100")
-set(_swresample_ver ">=3.1.100")
-set(_postproc_ver ">=55.1.100")
+set(REQUIRED_FFMPEG_VERSION 4.2)
+set(_avcodec_ver ">=58.54.100")
+set(_avfilter_ver ">=7.57.100")
+set(_avformat_ver ">=58.29.100")
+set(_avutil_ver ">=56.31.100")
+set(_swscale_ver ">=5.5.100")
+set(_swresample_ver ">=3.5.100")
+set(_postproc_ver ">=55.5.100")
# Allows building with external ffmpeg not found in system paths,
diff --git a/tools/buildsteps/windows/patches/0001-ffmpeg-detect-openssl.patch b/tools/buildsteps/windows/patches/0001-ffmpeg-detect-openssl.patch
index d5277ecc4165..aec54109d78e 100644
--- a/tools/buildsteps/windows/patches/0001-ffmpeg-detect-openssl.patch
+++ b/tools/buildsteps/windows/patches/0001-ffmpeg-detect-openssl.patch
@@ -1,26 +1,13 @@
-From 18de5c60ae0a987680681d5a0602009b428504fa Mon Sep 17 00:00:00 2001
-From: Gilles Khouzam <gillesk@microsoft.com>
-Date: Mon, 19 Jun 2017 16:33:38 -0700
-Subject: [PATCH] Add better detection for Openssl on Windows.
-
-Look for libeay32 and ssleay32 as another detection mechanism
----
- configure | 1 +
- 1 file changed, 1 insertion(+)
-
diff --git a/configure b/configure
-index a1818dc..1cf2a7c 100755
+index 34c2adb4a4..160884d8f9 100755
--- a/configure
+++ b/configure
-@@ -6147,6 +6147,8 @@
+@@ -6358,6 +6358,8 @@ enabled openssl && { check_pkg_config openssl openssl openssl/ssl.h OP
check_lib openssl openssl/ssl.h SSL_library_init -lssl -lcrypto ||
check_lib openssl openssl/ssl.h SSL_library_init -lssl32 -leay32 ||
check_lib openssl openssl/ssl.h SSL_library_init -lssl -lcrypto -lws2_32 -lgdi32 ||
+ check_lib openssl openssl/ssl.h OPENSSL_init_ssl -llibssl -llibcrypto -lws2_32 -lgdi32 -ladvapi32 -luser32 ||
+ check_lib openssl openssl/ssl.h SSL_library_init -llibeay32 -lssleay32 ||
die "ERROR: openssl not found"; }
+ enabled pocketsphinx && require_pkg_config pocketsphinx pocketsphinx pocketsphinx/pocketsphinx.h ps_init
enabled rkmpp && { require_pkg_config rkmpp rockchip_mpp rockchip/rk_mpi.h mpp_create &&
- require_pkg_config rockchip_mpp "rockchip_mpp >= 1.3.7" rockchip/rk_mpi.h mpp_create &&
---
-2.10.1.windows.1
-
diff --git a/tools/buildsteps/windows/patches/0002-ffmpeg-zlib-config-conflict.patch b/tools/buildsteps/windows/patches/0002-ffmpeg-zlib-config-conflict.patch
index 632cc55bfb77..7896759375a0 100644
--- a/tools/buildsteps/windows/patches/0002-ffmpeg-zlib-config-conflict.patch
+++ b/tools/buildsteps/windows/patches/0002-ffmpeg-zlib-config-conflict.patch
@@ -1,6 +1,17 @@
+diff --git a/configure b/configure
+index 34c2adb4a4..a2a2515525 100755
--- a/configure
+++ b/configure
-@@ -7197,6 +7197,9 @@
+@@ -6358,6 +6358,8 @@ enabled openssl && { check_pkg_config openssl openssl openssl/ssl.h OP
+ check_lib openssl openssl/ssl.h SSL_library_init -lssl -lcrypto ||
+ check_lib openssl openssl/ssl.h SSL_library_init -lssl32 -leay32 ||
+ check_lib openssl openssl/ssl.h SSL_library_init -lssl -lcrypto -lws2_32 -lgdi32 ||
++ check_lib openssl openssl/ssl.h OPENSSL_init_ssl -llibssl -llibcrypto -lws2_32 -lgdi32 -ladvapi32 -luser32 ||
++ check_lib openssl openssl/ssl.h SSL_library_init -llibeay32 -lssleay32 ||
+ die "ERROR: openssl not found"; }
+ enabled pocketsphinx && require_pkg_config pocketsphinx pocketsphinx pocketsphinx/pocketsphinx.h ps_init
+ enabled rkmpp && { require_pkg_config rkmpp rockchip_mpp rockchip/rk_mpi.h mpp_create &&
+@@ -7437,6 +7439,9 @@ print_config CONFIG_ "$config_files" $CONFIG_LIST \
$CONFIG_EXTRA \
$ALL_COMPONENTS \
diff --git a/tools/buildsteps/windows/patches/0003-ffmpeg-static.patch b/tools/buildsteps/windows/patches/0003-ffmpeg-static.patch
index fb78864a7d0f..6852ffc2d71e 100644
--- a/tools/buildsteps/windows/patches/0003-ffmpeg-static.patch
+++ b/tools/buildsteps/windows/patches/0003-ffmpeg-static.patch
@@ -1,6 +1,8 @@
+diff --git a/configure b/configure
+index 34c2adb4a4..9c0ff0cd88 100755
--- a/configure
+++ b/configure
-@@ -5131,6 +5131,8 @@
+@@ -5312,6 +5312,8 @@ case $target_os in
enabled shared && ! enabled small && test_cmd $windres --version && enable gnu_windres
enabled x86_32 && check_ldflags -Wl,--large-address-aware
shlibdir_default="$bindir_default"
@@ -9,7 +11,7 @@
SLIBPREF=""
SLIBSUF=".dll"
SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
-@@ -5180,6 +5182,8 @@
+@@ -5361,6 +5363,8 @@ case $target_os in
fi
enabled x86_32 && check_ldflags -LARGEADDRESSAWARE
shlibdir_default="$bindir_default"
@@ -18,3 +20,22 @@
SLIBPREF=""
SLIBSUF=".dll"
SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
+@@ -6358,6 +6362,8 @@ enabled openssl && { check_pkg_config openssl openssl openssl/ssl.h OP
+ check_lib openssl openssl/ssl.h SSL_library_init -lssl -lcrypto ||
+ check_lib openssl openssl/ssl.h SSL_library_init -lssl32 -leay32 ||
+ check_lib openssl openssl/ssl.h SSL_library_init -lssl -lcrypto -lws2_32 -lgdi32 ||
++ check_lib openssl openssl/ssl.h OPENSSL_init_ssl -llibssl -llibcrypto -lws2_32 -lgdi32 -ladvapi32 -luser32 ||
++ check_lib openssl openssl/ssl.h SSL_library_init -llibeay32 -lssleay32 ||
+ die "ERROR: openssl not found"; }
+ enabled pocketsphinx && require_pkg_config pocketsphinx pocketsphinx pocketsphinx/pocketsphinx.h ps_init
+ enabled rkmpp && { require_pkg_config rkmpp rockchip_mpp rockchip/rk_mpi.h mpp_create &&
+@@ -7437,6 +7443,9 @@ print_config CONFIG_ "$config_files" $CONFIG_LIST \
+ $CONFIG_EXTRA \
+ $ALL_COMPONENTS \
+
++echo "#if defined(HAVE_UNISTD_H) && HAVE_UNISTD_H == 0" >> $TMPH
++echo "#undef HAVE_UNISTD_H" >> $TMPH
++echo "#endif" >> $TMPH
+ echo "#endif /* FFMPEG_CONFIG_H */" >> $TMPH
+ echo "endif # FFMPEG_CONFIG_MAK" >> ffbuild/config.mak
+
diff --git a/tools/depends/target/Makefile b/tools/depends/target/Makefile
index 8b513ed100ee..96ef2640e0b3 100644
--- a/tools/depends/target/Makefile
+++ b/tools/depends/target/Makefile
@@ -184,3 +184,4 @@ linux-system-libs: linux-system-libs-egl
[ -f $(PREFIX)/lib/pkgconfig/xmu.pc ] || ln -sf /usr/lib/$(HOST)/pkgconfig/xmu.pc $(PREFIX)/lib/pkgconfig/xmu.pc
[ -f $(PREFIX)/lib/pkgconfig/libdrm.pc ] || ln -sf /usr/lib/$(HOST)/pkgconfig/libdrm.pc $(PREFIX)/lib/pkgconfig/libdrm.pc
[ -f $(PREFIX)/lib/pkgconfig/xkbcommon.pc ] || ln -sf /usr/lib/$(HOST)/pkgconfig/xkbcommon.pc $(PREFIX)/lib/pkgconfig/xkbcommon.pc
+ [ -f $(PREFIX)/lib/pkgconfig/libva.pc ] || ln -sf /usr/lib/$(HOST)/pkgconfig/libva.pc $(PREFIX)/lib/pkgconfig/libva.pc
diff --git a/tools/depends/target/ffmpeg/FFMPEG-VERSION b/tools/depends/target/ffmpeg/FFMPEG-VERSION
index 620fe798de97..d105be356ec5 100644
--- a/tools/depends/target/ffmpeg/FFMPEG-VERSION
+++ b/tools/depends/target/ffmpeg/FFMPEG-VERSION
@@ -1,4 +1,4 @@
LIBNAME=ffmpeg
BASE_URL=https://github.com/xbmc/FFmpeg
-VERSION=4.0.4-Leia-18.4
+VERSION=4.2.2-Matrix-Alpha1
ARCHIVE=$(LIBNAME)-$(VERSION).tar.gz
From e71b4cc63d03c31c49395015e54f631be08d23d1 Mon Sep 17 00:00:00 2001
From: peak3d <pfau@peak3d.de>
Date: Sat, 15 Feb 2020 19:15:26 +0100
Subject: [PATCH 2/2] [ffmpeg] CActiveAEFilter: initialize frame pts only once
after filter creation
This fixes an issue when using the atempo filter after ffmpeg commit 181031906e4984c1c539dc84d21386a4397e257e
---
.../cores/AudioEngine/Engines/ActiveAE/ActiveAEFilter.cpp | 8 ++++++++
xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEFilter.h | 1 +
2 files changed, 9 insertions(+)
diff --git a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEFilter.cpp b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEFilter.cpp
index 8dd0af4d713e..f950623dd218 100644
--- a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEFilter.cpp
+++ b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEFilter.cpp
@@ -157,6 +157,7 @@ bool CActiveAEFilter::CreateAtempoFilter()
m_needData = true;
m_filterEof = false;
m_started = false;
+ m_ptsInitialized = false;
return true;
}
@@ -182,6 +183,8 @@ void CActiveAEFilter::CloseFilter()
m_SamplesIn = 0;
m_SamplesOut = 0;
+
+ m_ptsInitialized = false;
}
int CActiveAEFilter::ProcessFilter(uint8_t **dst_buffer, int dst_samples, uint8_t **src_buffer, int src_samples, int src_bufsize)
@@ -211,6 +214,11 @@ int CActiveAEFilter::ProcessFilter(uint8_t **dst_buffer, int dst_samples, uint8_
frame->sample_rate = m_sampleRate;
frame->nb_samples = src_samples;
frame->format = m_sampleFormat;
+ if (!m_ptsInitialized)
+ {
+ frame->pts = 0;
+ m_ptsInitialized = true;
+ }
m_SamplesIn += src_samples;
diff --git a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEFilter.h b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEFilter.h
index e51502f89e85..8cb15e7e009e 100644
--- a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEFilter.h
+++ b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEFilter.h
@@ -52,6 +52,7 @@ class CActiveAEFilter
bool m_started;
bool m_hasData;
bool m_needData;
+ bool m_ptsInitialized;
int m_sampleOffset;
int64_t m_SamplesIn;
int64_t m_SamplesOut;

View file

@ -0,0 +1,20 @@
--- a/tools/depends/target/ffmpeg/CMakeLists.txt 2019-07-18 11:05:21.000000000 -0400
+++ b/tools/depends/target/ffmpeg/CMakeLists.txt 2019-07-25 16:22:19.506991490 -0400
@@ -19,7 +19,7 @@ if(CROSSCOMPILING)
endif()
#if(CORE_PLATFORM_NAME STREQUAL rbpi)
- string(CONCAT CMAKE_C_FLAGS ${CMAKE_C_FLAGS} " -I/opt/vc/include -I/opt/vc/include/interface/vcos/pthreads -I/opt/vc/include/interface/vmcs_host/linux")
+ string(CONCAT CMAKE_C_FLAGS ${CMAKE_C_FLAGS} " -I/build/kodi-rpi/src/opt/vc/include -I/build/kodi-rpi/src/opt/vc/include/interface/vcos/pthreads -I/build/kodi-rpi/src/opt/vc/include/interface/vmcs_host/linux")
list(APPEND ffmpeg_conf --enable-rpi --disable-ffmpeg --disable-ffprobe)
#endif()
@@ -31,6 +31,8 @@ if(CMAKE_CXX_FLAGS)
list(APPEND ffmpeg_conf --extra-cxxflags=${CMAKE_CXX_FLAGS})
endif()
+string(CONCAT CMAKE_EXE_LINKER_FLAGS ${CMAKE_EXE_LINKER_FLAGS} " -L/build/kodi-rpi/src/opt/vc/lib")
+
if(CMAKE_EXE_LINKER_FLAGS)
list(APPEND ffmpeg_conf --extra-ldflags=${CMAKE_EXE_LINKER_FLAGS})
endif()

View file

@ -0,0 +1,7 @@
SUBSYSTEM=="bcm2835-gpiomem", GROUP="gpio", MODE="0660"
SUBSYSTEM=="bcm2708_vcio",GROUP="video",MODE="0660"
SUBSYSTEM=="rpivid-*", GROUP="video", MODE="0660"
SUBSYSTEM=="argon-*", GROUP="video", MODE="0660"
SUBSYSTEM=="vc-sm",GROUP="video",MODE="0660"
SUBSYSTEM=="vchiq",GROUP="video",MODE="0660"
SUBSYSTEM=="tty", KERNEL=="tty[0-9]*", GROUP="tty", MODE="0660"

321
alarm/kodi-rpi/PKGBUILD Normal file
View file

@ -0,0 +1,321 @@
# vim:set ts=2 sw=2 et:
# Contributor: graysky <graysky AT archlinux DOT us>
# Contributor: popcornmix & asavah from kodi forums - adapting for makechrootpkg
# Contributor: BlackIkeEagle < ike DOT devolder AT gmail DOT com >
# Contributor: Oleg Rakhmanov <oleg [at] archlinuxarm [dot] com>
# Contributor: tomasgroth at yahoo.dk
# Contributor: WarheadsSE <max@warheads.net>
# Contributor: Adrian Fedoreanu <adrian [dot] fedoreanu [at] gmail [dot] com>
# Contributor: Sergej Pupykin <pupykin.s+arch@gmail.com>
# Contributor: DonVla <donvla@users.sourceforge.net>
# Contributor: Ulf Winkelvos <ulf [at] winkelvos [dot] de>
# Contributor: Ralf Barth <archlinux dot org at haggy dot org>
# Contributor: B & monty - Thanks for your hints :)
# Contributor: marzoul
# Contributor: Sergej Pupykin <pupykin.s+arch@gmail.com>
# Contributor: Brad Fanella <bradfanella@archlinux.us>
# Contributor: [vEX] <niechift.dot.vex.at.gmail.dot.com>
# Contributor: Zeqadious <zeqadious.at.gmail.dot.com>
# Contributor: Bartłomiej Piotrowski <bpiotrowski@archlinux.org>
# Contributor: Maxime Gauduin <alucryd@gmail.com>
buildarch=4
_prefix=/usr
pkgbase=kodi-rpi
pkgname=('kodi-rpi' 'kodi-rpi-eventclients' 'kodi-rpi-tools-texturepacker' 'kodi-rpi-dev')
pkgver=18.9
pkgrel=1
_codename=Leia
_ffmpeg_version="4.2.2-Matrix-Alpha1"
_libdvdcss_version="1.4.2-$_codename-Beta-5"
_libdvdnav_version="6.0.0-$_codename-Alpha-3"
_libdvdread_version="6.0.0-$_codename-Alpha-3"
_fmt_version="5.1.0"
_crossguid_version="8f399e8bd4"
_fstrcmp_version="0.7.D001"
_flatbuffers_version="1.9.0"
arch=('armv7h')
url="https://kodi.tv"
license=('GPL2')
makedepends=(
'afpfs-ng' 'bluez-libs' 'cmake' 'curl' 'doxygen' 'glew'
'gperf' 'hicolor-icon-theme' 'java-runtime' 'libaacs' 'libass'
'libbluray' 'libcdio' 'libcec-rpi' 'libgl' 'mariadb-libs' 'libmicrohttpd'
'libmodplug' 'libmpeg2' 'libnfs' 'libplist' 'libpulse' 'libva'
'libvdpau' 'libxrandr' 'libxslt' 'lirc' 'lzo' 'mesa' 'nasm'
'python2-pycryptodomex' 'python2-pillow6' 'python2-pybluez' 'python2-simplejson'
'shairplay' 'smbclient' 'taglib' 'tinyxml' 'swig'
'upower' 'giflib' 'rapidjson' 'ghostscript'
'libinput' 'libxkbcommon'
)
# leia_rpi4 branch contains patches to enable hardware decoding on rpi4
# expect kodi v19 to not to use MMAL but to use ffmpeg+v4l2
# https://github.com/popcornmix/xbmc/commits/leia_pi4
source=(
# popcornmix branch
"xbmc-$pkgver-$_codename.tar.gz::https://github.com/popcornmix/xbmc/archive/leia_pi4_$pkgver-Leia.tar.gz"
kodi.service
99-kodi.rules
polkit.rules
"libdvdcss-$_libdvdcss_version.tar.gz::https://github.com/xbmc/libdvdcss/archive/$_libdvdcss_version.tar.gz"
"libdvdnav-$_libdvdnav_version.tar.gz::https://github.com/xbmc/libdvdnav/archive/$_libdvdnav_version.tar.gz"
"libdvdread-$_libdvdread_version.tar.gz::https://github.com/xbmc/libdvdread/archive/$_libdvdread_version.tar.gz"
"ffmpeg-$_ffmpeg_version.tar.gz::https://github.com/xbmc/FFmpeg/archive/$_ffmpeg_version.tar.gz"
"http://mirrors.kodi.tv/build-deps/sources/fmt-$_fmt_version.tar.gz"
"http://mirrors.kodi.tv/build-deps/sources/crossguid-$_crossguid_version.tar.gz"
"http://mirrors.kodi.tv/build-deps/sources/fstrcmp-$_fstrcmp_version.tar.gz"
"http://mirrors.kodi.tv/build-deps/sources/flatbuffers-$_flatbuffers_version.tar.gz"
01-fix.in-tree.ffmpeg.paths.for.makechrootpkg.hack.patch
sysusers.conf
tmpfiles.conf
# use newer ffmpeg
000-PR17300.patch::https://patch-diff.githubusercontent.com/raw/xbmc/xbmc/pull/17300.patch
)
noextract=(
"libdvdcss-$_libdvdcss_version.tar.gz"
"libdvdnav-$_libdvdnav_version.tar.gz"
"libdvdread-$_libdvdread_version.tar.gz"
"ffmpeg-$_ffmpeg_version.tar.gz"
"fmt-$_fmt_version.tar.gz"
"crossguid-$_crossguid_version.tar.gz"
"fstrcmp-$_fstrcmp_version.tar.gz"
"flatbuffers-$_flatbuffers_version.tar.gz"
)
sha256sums=('9a17ae7ff4ab036539ebd19223b65974fd4b0e5c2bb3eea96674efa6ee2fb22b'
'91dd278d46eed0cb05ba733647c99379330f197daa87d33bf2b18032e5af5055'
'8e14cf455898246d11edd4ff7f4ed11a44c729fb40c34455a5b336a90ccc1f7b'
'5d38a895ee7b93689fab79124a3aad23a5e3e643abd08878d778d04066c8d26f'
'38816f8373e243bc5950449b4f3b18938c4e1c59348e3411e23f31db4072e40d'
'071e414e61b795f2ff9015b21a85fc009dde967f27780d23092643916538a57a'
'a30b6aa0aad0f2c505bc77948af2d5531a80b6e68112addb4c123fca24d5d3bf'
'0dba571f9809588cfbdc29d6a551dab4cd5736701653d9263847c9ac67bcde86'
'73d4cab4fa8a3482643d8703de4d9522d7a56981c938eca42d929106ff474b44'
'3d77d09a5df0de510aeeb940df4cb534787ddff3bb1828779753f5dfa1229d10'
'e4018e850f80700acee8da296e56e15b1eef711ab15157e542e7d7e1237c3476'
'5ca5491e4260cacae30f1a5786d109230db3f3a6e5a0eb45d0d0608293d247e3'
'dddf376c59367dc6ec728723cc5aa0f77f7a25497a508127b03d0e9985fd8d56'
'f521b98232e5035b7cada46cf03975b8d753e93d0802bf22913fceed769f9d96'
'9c5e79ed8719cd032a3b17dac585aeff28a198e37af1da9af68ef1b86bab4d18'
'3aaca3630689b76e7a7f35656a4ada3fb18ecd7e3fe199634264ccf76b96c0f0')
prepare() {
# Must use MMAL headers and pc files rather than opengl ones so we copy the
# contents of raspberrypi-firmware dependency to $srcdir and delete the offending
# directories therein as well as redirect cmake
mkdir -p "$srcdir/opt"
cp -a /opt/vc "$srcdir/opt"
rm -rf "$srcdir"/opt/vc/include/{EGL,GLES,GLES2}
# Just these three are needed in a directory all by themselves
# to which we point cmake via PKG_CONFIG_PATH
mkdir "$srcdir/pkgconfig"
for i in bcm_host.pc mmal.pc vcsm.pc; do
cp "$srcdir/opt/vc/lib/pkgconfig/$i" "$srcdir/pkgconfig"
done
# force python 'binary' as python2
[[ -d "$srcdir/path" ]] && rm -rf "$srcdir/path"
mkdir "$srcdir/path"
ln -s /usr/bin/python2 "$srcdir/path/python"
cd "xbmc-leia_pi4_$pkgver-$_codename"
[[ -d kodi-build ]] && rm -rf kodi-build
mkdir "$srcdir/kodi-build"
# Big thanks to asavah for helpful advice here and in the cmake step
patch -Np1 -i ../01-fix.in-tree.ffmpeg.paths.for.makechrootpkg.hack.patch
patch -Np1 -i ../000-PR17300.patch
}
build() {
export PATH="$srcdir/path:$PATH"
cd "$srcdir/kodi-build"
# exporting PKG_CONFIG_PATH and building with the extra lib definitions
# are part of the workaround discussed above
export PKG_CONFIG_PATH="$srcdir/pkgconfig"
_rootopt="$srcdir/opt/vc"
_libdir="$_rootopt/lib"
cmake -DCMAKE_INSTALL_PREFIX=/usr \
-DCMAKE_INSTALL_LIBDIR=/usr/lib \
-DMMAL_INCLUDE_DIR="$_rootopt/include" \
-DMMAL_LIBRARY="$_libdir/libmmal.so" \
-DMMALCORE_LIBRARY="$_libdir/libmmal_core.so" \
-DMMALUTIL_LIBRARY="$_libdir/libmmal_util.so" \
-DMMALCLIENT_LIBRARY="$_libdir/libmmal_vc_client.so" \
-DMMALCOMPONENT_LIBRARY="$_libdir/libmmal_components.so" \
-DBCM_LIBRARY="$_libdir/libbcm_host.so" \
-DVCHIQ_LIBRARY="$_libdir/libvchiq_arm.so" \
-DVCHOSTIF_LIBRARY="$_libdir/libvchostif.a" \
-DVCILCS_LIBRARY="$_libdir/libvcilcs.a" \
-DVCOS_LIBRARY="$_libdir/libvcos.so" \
-DVCSM_LIBRARY="$_libdir/libvcsm.so" \
-DCONTAINER_LIBRARY="$_libdir/libcontainers.so" \
-DVERBOSE=ON \
-DENABLE_INTERNAL_FFMPEG=ON \
-DENABLE_INTERNAL_FMT=ON \
-DENABLE_INTERNAL_CROSSGUID=ON \
-DENABLE_INTERNAL_FSTRCMP=ON \
-DENABLE_INTERNAL_FLATBUFFERS=ON \
-DENABLE_EVENTCLIENTS=ON \
-DENABLE_VAAPI=OFF \
-DENABLE_VDPAU=OFF \
-DENABLE_OPENGL=OFF \
-DENABLE_MYSQLCLIENT=ON \
-Dlibdvdcss_URL="$srcdir/libdvdcss-$_libdvdcss_version.tar.gz" \
-Dlibdvdnav_URL="$srcdir/libdvdnav-$_libdvdnav_version.tar.gz" \
-Dlibdvdread_URL="$srcdir/libdvdread-$_libdvdread_version.tar.gz" \
-DFFMPEG_URL="$srcdir/ffmpeg-$_ffmpeg_version.tar.gz" \
-DFMT_URL="$srcdir/fmt-$_fmt_version.tar.gz" \
-DCROSSGUID_URL="$srcdir/crossguid-$_crossguid_version.tar.gz" \
-DFSTRCMP_URL="$srcdir/fstrcmp-$_fstrcmp_version.tar.gz" \
-DFLATBUFFERS_URL="$srcdir/flatbuffers-$_flatbuffers_version.tar.gz" \
-DCORE_PLATFORM_NAME=gbm \
-DGBM_RENDER_SYSTEM=gles \
../"xbmc-leia_pi4_$pkgver-$_codename"
make
make preinstall
}
package_kodi-rpi() {
pkgdesc="A software media player and entertainment hub for digital media (Raspberry Pi)"
depends=(
'desktop-file-utils' 'hicolor-icon-theme' 'mesa' 'python2-pycryptodomex'
'python2-pillow6' 'python2-simplejson' 'xorg-xdpyinfo'
'bluez-libs' 'curl' 'lcms2' 'libass' 'libbluray' 'libcdio' 'libcec-rpi'
'libinput' 'libmicrohttpd' 'libnfs' 'libpulse' 'libva' 'libxkbcommon'
'libxslt' 'lirc' 'mariadb-libs' 'python2' 'smbclient' 'taglib'
'tinyxml' 'polkit' 'linux>=5.4.35'
)
optdepends=(
'afpfs-ng: Apple shares support'
'bluez: Blutooth support'
'python2-pybluez: Bluetooth support'
'libplist: Limited AirPlay support'
'pulseaudio: PulseAudio support'
'shairplay: Limited AirPlay support'
'upower: Display battery level'
)
install='kodi.install'
provides=('xbmc' 'kodi')
conflicts=('xbmc' 'kodi' 'arm-mem-git' 'shairplay-git' 'kodi-rbp' 'kodi-rbp3' 'kodi-rbp4')
replaces=('xbmc-rbp-git' 'kodi-rbp' 'kodi-rbp3' 'kodi-rbp4')
_components=('kodi' 'kodi-bin')
export PATH="$srcdir/path:$PATH"
cd kodi-build
for _cmp in ${_components[@]}; do
DESTDIR="$pkgdir" /usr/bin/cmake \
-DCMAKE_INSTALL_COMPONENT="$_cmp" \
-P cmake_install.cmake
done
# python2 is being used
cd "$pkgdir"
grep -lR '#!.*python' * | \
while read file; do sed -s 's/\(#!.*python\)/\12/g' -i "$file"; done
install -Dm755 "$srcdir/kodi-build/kodi-gbm" "$pkgdir/usr/lib/kodi/kodi-gbm"
# fix permissions necessary for accelerated video playback
install -Dm0644 "$srcdir/99-kodi.rules" "$pkgdir/etc/udev/rules.d/99-kodi.rules"
# systemd manages kodi user
install -Dm644 "$srcdir"/sysusers.conf "$pkgdir/usr/lib/sysusers.d/kodi.conf"
install -Dm644 "$srcdir"/tmpfiles.conf "$pkgdir/usr/lib/tmpfiles.d/kodi.conf"
# systemd service and polkit rules
install -Dm0644 "$srcdir/kodi.service" "$pkgdir/usr/lib/systemd/system/kodi.service"
install -Dm0644 "$srcdir/polkit.rules" "$pkgdir/usr/share/polkit-1/rules.d/10-kodi.rules"
chmod 0750 "$pkgdir/usr/share/polkit-1/rules.d/"
}
package_kodi-rpi-eventclients() {
pkgdesc="Kodi Event Clients (Raspberry Pi)"
provides=('kodi-eventclients')
conflicts=('kodi-rbp-eventclients' 'kodi-rbp3-eventclients' 'kodi-rbp4-eventclients')
replaces=('kodi-rbp-eventclients' 'kodi-rbp3-eventclients' 'kodi-rbp4-eventclients')
optdepends=('python2: most eventclients are implemented in python2')
_components=(
'kodi-eventclients-common'
'kodi-eventclients-ps3'
'kodi-eventclients-kodi-send'
)
export PATH="$srcdir/path:$PATH"
cd kodi-build
for _cmp in ${_components[@]}; do
DESTDIR="$pkgdir" /usr/bin/cmake \
-DCMAKE_INSTALL_COMPONENT="$_cmp" \
-P cmake_install.cmake
done
# python2 is being used
cd "$pkgdir"
grep -lR '#!.*python' * | \
while read file; do sed -s 's/\(#!.*python\)/\12/g' -i "$file"; done
}
package_kodi-rpi-tools-texturepacker() {
pkgdesc="Kodi Texturepacker tool (Raspberry Pi)"
depends=('libpng' 'giflib' 'libjpeg-turbo' 'lzo')
conflicts=('kodi-rbp-tools-texturepacker' 'kodi-rbp3-tools-texturepacker' 'kodi-rbp4-tools-texturepacker')
replaces=('kodi-rbp-tools-texturepacker' 'kodi-rbp3-tools-texturepacker' 'kodi-rbp4-tools-texturepacker')
_components=('kodi-tools-texturepacker')
export PATH="$srcdir/path:$PATH"
cd kodi-build
for _cmp in ${_components[@]}; do
DESTDIR="$pkgdir" /usr/bin/cmake \
-DCMAKE_INSTALL_COMPONENT="$_cmp" \
-P cmake_install.cmake
done
}
package_kodi-rpi-dev() {
pkgdesc="Kodi dev files (Raspberry Pi)"
depends=('kodi')
conflicts=('kodi-rbp-dev' 'kodi-rbp3-dev' 'kodi-rbp4-dev')
replaces=('kodi-rbp-dev' 'kodi-rbp3-dev' 'kodi-rbp4-dev')
provides=('kodi-dev')
_components=('kodi-addon-dev'
'kodi-audio-dev'
'kodi-eventclients-dev'
'kodi-game-dev'
'kodi-inputstream-dev'
'kodi-peripheral-dev'
'kodi-pvr-dev'
'kodi-screensaver-dev'
'kodi-visualization-dev')
export PATH="$srcdir/path:$PATH"
cd kodi-build
for _cmp in ${_components[@]}; do
DESTDIR="$pkgdir" /usr/bin/cmake \
-DCMAKE_INSTALL_COMPONENT="$_cmp" \
-P cmake_install.cmake
done
# python2 is being used
cd "$pkgdir"
grep -lR '#!.*python' * | \
while read file; do sed -s 's/\(#!.*python\)/\12/g' -i "$file"; done
}

View file

@ -0,0 +1,9 @@
post_install() {
echo "-> Make sure the following lines are added to /boot/config.txt"
echo " gpu_mem=320"
echo " dtoverlay=vc4-fkms-v3d"
}
post_remove() {
echo "==> Optionally remove /var/lib/kodi/"
}

View file

@ -0,0 +1,20 @@
[Unit]
Description=Kodi standalone (GBM)
After=remote-fs.target systemd-user-sessions.service network-online.target nss-lookup.target sound.target bluetooth.target polkit.service upower.service mysqld.service
Wants=network-online.target polkit.service upower.service
Conflicts=getty@tty1.service
[Service]
User=kodi
Group=kodi
PAMName=login
TTYPath=/dev/tty1
Environment=WINDOWING=gbm
ExecStart=/usr/bin/kodi-standalone
ExecStop=/usr/bin/killall --user kodi --exact --wait kodi-gbm
Restart=on-abort
StandardInput=tty
StandardOutput=journal
[Install]
Alias=display-manager.service

View file

@ -0,0 +1,15 @@
polkit.addRule(function(action, subject) {
if (subject.user == "kodi") {
polkit.log("action=" + action);
polkit.log("subject=" + subject);
if (action.id.indexOf("org.freedesktop.login1.") == 0) {
return polkit.Result.YES;
}
if (action.id.indexOf("org.freedesktop.udisks.") == 0) {
return polkit.Result.YES;
}
if (action.id.indexOf("org.freedesktop.udisks2.") == 0) {
return polkit.Result.YES;
}
}
});

View file

@ -0,0 +1,16 @@
# override these settings by copying this to /etc/sysusers.d/ and modifying it therein
#Type Name ID GECOS Home directory Shell
g kodi - -
u kodi - "Kodi User" /var/lib/kodi
# supplemental groups
m kodi audio
m kodi disk
m kodi input
m kodi network
m kodi optical
m kodi power
m kodi storage
m kodi tty
m kodi video

View file

@ -0,0 +1,3 @@
#Type Path Mode User Group Age Argument
d /var/lib/kodi 0750 kodi kodi - -
Z /var/lib/kodi - kodi kodi - -