Merge pull request #1064 from PyroDevil/master

alarm/kodi-imx Kodi 14.0-1 for IMX6 (initial package)
This commit is contained in:
pepedog 2015-01-15 17:16:01 +00:00
commit c29506bd02
8 changed files with 280 additions and 0 deletions

137
alarm/kodi-imx/PKGBUILD Normal file
View file

@ -0,0 +1,137 @@
# Contributor tomasgroth at yahoo.dk
# Contributor WarheadsSE <max@warheads.net>
# Contributor Romzetron <asromzek@gmail.com>
# Contributor Holzhaus <holthuis.jan@googlemail.com>
buildarch=4
pkgname=kodi-imx
pkgver=14.0
_codename=Helix
pkgrel=1
pkgdesc="A software media player and entertainment hub for digital media for select imx6 system"
arch=('armv7h')
url="http://kodi.tv"
license=('GPL' 'custom')
depends=(
'python2-pillow' 'python2-pybluez' 'python2-simplejson' 'fribidi'
'lzo2' 'smbclient' 'libtiff' 'libva' 'libpng' 'libcdio' 'yajl'
'libmariadbclient' 'libjpeg-turbo' 'libsamplerate' 'libssh'
'libmicrohttpd' 'sdl_image' 'python2' 'libass' 'libmpeg2' 'libmad'
'libmodplug' 'jasper' 'rtmpdump' 'unzip' 'xorg-xdpyinfo' 'libbluray'
'libnfs' 'afpfs-ng' 'avahi' 'bluez-libs' 'tinyxml' 'libcec'
'libplist' 'swig' 'taglib' 'libxslt' 'shairplay-git'
'hicolor-icon-theme' 'libfslvpuwrap' 'gpu-viv-bin-mx6q-fb'
'libva' 'libcec-imx6' 'firmware-imx')
makedepends=(
'boost' 'cmake' 'gperf' 'nasm' 'zip' 'udisks' 'upower' 'git'
'autoconf' 'java-environment')
optdepends=(
'lirc: remote controller support'
'udisks: automount external drives'
'upower: used to trigger power management functionality'
'unrar: access compressed files without unpacking them')
provides=("kodi")
conflicts=("xbmc" "kodi")
replaces=("xbmc-imx")
install="kodi.install"
source=("https://github.com/xbmc/xbmc/archive/$pkgver-$_codename.tar.gz"
'kodi.service'
'polkit.rules'
'runkodi'
'kodi.conf'
'imx-spdif.conf'
'imx-hdmi-soc.conf')
sha256sums=('11746d95cc59361f36ce6ea9d0d36bbd9ec3376e991f5ec1720f8ff740b91192'
'b8cb9bc4fd7f21e197aeed88453c037d6e688f6e353c04b1f63052b6ba1f879c'
'9ea592205023ba861603d74b63cdb73126c56372a366dc4cb7beb379073cbb96'
'b7f9ef15f774fe9ddd9fa029a2032c2d7668be1095a0561640826f16cdd1ba00'
'db6372248015fa4e663bf789e4f7121b5a9ade323f361994bbd6f135ce169123'
'0e16e4d2ec0c0e1810fe1ad6a7c4dee99d6fc0f49502f0e836210f5dd537d92d'
'6d9822d97b9e1268c04078f6c9b6316eb013f95f96f90034b51fa7473b9752ff')
_prefix=/usr
prepare() {
cd "$srcdir/xbmc-$pkgver-$_codename"
find -type f -name *.py -exec sed 's|^#!.*python$|#!/usr/bin/python2|' -i "{}" +
sed 's|^#!.*python$|#!/usr/bin/python2|' -i tools/depends/native/rpl-native/rpl
sed 's/python/python2/' -i tools/Linux/kodi.sh.in
}
build() {
cd "$srcdir/xbmc-$pkgver-$_codename"
# Bootstrapping Kodi
MAKEFLAGS=-j1 ./bootstrap
# Configuring Kodi
export PYTHON_VERSION=2 # external python v2
INCLUDES="-I/opt/fsl/include"
export CFLAGS="-Ofast -mfloat-abi=hard -mfpu=vfpv3-d16 -mtls-dialect=gnu -march=armv7-a -mtune=cortex-a9 -pipe -fstack-protector --param=ssp-buffer-size=4 -D_FORTIFY_SOURCE=2 $INCLUDES -Wl,-rpath,/opt/fsl/lib -L/opt/fsl/lib"
export CPPFLAGS="-Ofast -mfloat-abi=hard -mfpu=vfpv3-d16 -mtls-dialect=gnu -march=armv7-a -mtune=cortex-a9 -fstack-protector --param=ssp-buffer-size=4 -D_FORTIFY_SOURCE=2 $INCLUDES -Wl,-rpath,/opt/fsl/lib -L/opt/fsl/lib"
export CXXFLAGS="-Ofast -mfloat-abi=hard -mfpu=vfpv3-d16 -mtls-dialect=gnu -march=armv7-a -mtune=cortex-a9 -fstack-protector --param=ssp-buffer-size=4 -D_FORTIFY_SOURCE=2 $INCLUDES -Wl,-rpath,/opt/fsl/lib -L/opt/fsl/lib"
export LDFLAGS="$LDFLAGS -L/opt/fsl/lib"
#If build fails try uncommenting the line below first
#export MAKEFLAGS="-j1"
./configure --prefix=$_prefix --exec-prefix=$_prefix \
--disable-gl \
--enable-gles \
--disable-x11 \
--disable-sdl \
--enable-optimizations \
--disable-goom \
--disable-pulse \
--disable-vaapi \
--disable-vdpau \
--disable-xrandr \
--enable-airplay \
--enable-airtunes \
--enable-avahi \
--enable-libbluray \
--enable-dvdcss \
--disable-debug \
--disable-joystick \
--disable-mid \
--enable-nfs \
--disable-profiling \
--disable-projectm \
--enable-rsxs \
--enable-rtmp \
--disable-vaapi \
--disable-openmax \
--enable-optical-drive \
--enable-texturepacker \
--with-lirc-device=/run/lirc/lircd \
--enable-codec=imxvpu \
--enable-libcec
make
}
package() {
cd "$srcdir/xbmc-$pkgver-$_codename"
# Running make install
make DESTDIR="${pkgdir}" install
# Licenses
install -dm755 ${pkgdir}${_prefix}/share/licenses/${pkgname}
for licensef in LICENSE.GPL copying.txt; do
mv ${pkgdir}${_prefix}/share/doc/kodi/${licensef} \
${pkgdir}${_prefix}/share/licenses/${pkgname}
done
install -Dm0644 $srcdir/kodi.service $pkgdir/usr/lib/systemd/system/kodi.service
install -Dm0755 $srcdir/runkodi $pkgdir/usr/bin/runkodi
install -Dm0644 $srcdir/kodi.conf $pkgdir/etc/tmpfiles.d/kodi.conf
install -Dm0644 $srcdir/polkit.rules $pkgdir/usr/share/polkit-1/rules.d/10-kodi.rules
chmod 0700 $pkgdir/usr/share/polkit-1/rules.d/
# imx6-specific alsa conf
install -Dm0644 $srcdir/imx-spdif.conf $pkgdir/usr/share/alsa/cards/imx-spdif.conf
install -Dm0644 $srcdir/imx-hdmi-soc.conf $pkgdir/usr/share/alsa/cards/imx-hdmi-soc.conf
}

View file

@ -0,0 +1,33 @@
#
# Configuration for iMX6 HDMI output - /usr/share/alsa/cards/imx-hdmi-soc.conf
# Taken from https://github.com/OpenBricks/openbricks/blob/master/packages/sound/alsa-lib/config/imx-hdmi-soc.conf
#
<confdir:pcm/hdmi.conf>
imx-hdmi-soc.pcm.hdmi.0 {
@args [ CARD AES0 AES1 AES2 AES3 ]
@args.CARD { type string }
@args.AES0 { type integer }
@args.AES1 { type integer }
@args.AES2 { type integer }
@args.AES3 { type integer }
type hooks
slave.pcm {
type hw
card $CARD
}
hooks.0 {
type ctl_elems
hook_args [
{
interface MIXER
name "IEC958 Playback Default"
lock true
preserve true
optional true
value [ $AES0 $AES1 $AES2 $AES3 ]
}
]
}
}

View file

@ -0,0 +1,33 @@
#
# Configuration for iMX6 SPDIF output - /usr/share/alsa/cards/imx-spdif.conf
# Taken from https://github.com/OpenBricks/openbricks/blob/master/packages/sound/alsa-lib/config/imx-spdif.conf
#
<confdir:pcm/iec958.conf>
imx-spdif.pcm.iec958.0 {
@args [ CARD AES0 AES1 AES2 AES3 ]
@args.CARD { type string }
@args.AES0 { type integer }
@args.AES1 { type integer }
@args.AES2 { type integer }
@args.AES3 { type integer }
type hooks
slave.pcm {
type hw
card $CARD
}
hooks.0 {
type ctl_elems
hook_args [
{
interface MIXER
name "IEC958 Playback Default"
lock true
preserve true
optional true
value [ $AES0 $AES1 $AES2 $AES3 ]
}
]
}
}

2
alarm/kodi-imx/kodi.conf Normal file
View file

@ -0,0 +1,2 @@
m /sys/devices/virtual/graphics/fbcon/cursor_blink 0666 root root - -
m /sys/class/graphics/fb0/mode 0666 root root - -

View file

@ -0,0 +1,19 @@
post_install() {
[[ $(type -p gtk-update-icon-cache) ]] && usr/bin/gtk-update-icon-cache -qtf usr/share/icons/hicolor
[[ $(type -p update-desktop-database) ]] && usr/bin/update-desktop-database -q usr/share/applications
getent group kodi > /dev/null || groupadd -r kodi
getent passwd kodi > /dev/null || useradd -r -m -d /var/lib/kodi -g kodi -s /usr/bin/nologin kodi
usermod -a -G kodi,audio,video,power,network,optical,storage,disk kodi
mkdir -p var/lib/kodi
chown -R kodi:kodi var/lib/kodi
}
post_upgrade() {
post_install $1
}
post_remove() {
[[ $(type -p gtk-update-icon-cache) ]] && usr/bin/gtk-update-icon-cache -qtf usr/share/icons/hicolor
[[ $(type -p update-desktop-database) ]] && usr/bin/update-desktop-database -q usr/share/applications
getent passwd kodi > /dev/null && userdel kodi
}

View file

@ -0,0 +1,13 @@
[Unit]
Description = Starts an instance of Kodi
After = remote-fs.target
[Service]
User = kodi
Group = kodi
Type = simple
ExecStart = /usr/bin/runkodi
Restart = on-failure
[Install]
WantedBy = multi-user.target

View file

@ -0,0 +1,12 @@
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;
}
}
});

31
alarm/kodi-imx/runkodi Normal file
View file

@ -0,0 +1,31 @@
#!/bin/sh
#pre_umount () {
# [ -f /lib/systemd/system/automounter-nfs.service ] && systemctl stop automounter-nfs.service
# [ -f /lib/systemd/system/automounter-smb.service ] && systemctl stop automounter-smb.service
#}
echo 0 > /sys/class/graphics/fbcon/cursor_blink
[ -n "$LOGFILE" ] || LOGFILE="/dev/null"
/usr/lib/kodi/kodi.bin $@
EXIT_CODE=$?
case "$EXIT_CODE" in
64) # 64=powerdown
echo "kodi exited with EXIT_CODE=$EXIT_CODE at $(date). Shutting down..." >>$LOGFILE
# pre_umount
systemctl poweroff
exit 0
;;
66) # 66=reboot
echo "kodi exited with EXIT_CODE=$EXIT_CODE at $(date). Rebooting..." >>$LOGFILE
# pre_umount
systemctl reboot
exit 0
;;
*) # 0=quit, 65=restart-app; let systemd restart the service
echo "kodi exited with EXIT_CODE=$EXIT_CODE at $(date). Returning -1 to systemd..." >>$LOGFILE
echo 1 > /sys/class/graphics/fbcon/cursor_blink
exit 1
esac