Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Kodi image #199

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions compose/apps/kodi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#########################
# kodi.yml
#########################
#
# This container runs kodi

services:
####################
kodi:
build:
context: ./images/kodi
args:
BASE_IMAGE: ${BUILD_BASE_IMAGE}
BASE_APP_IMAGE: ${BUILD_BASE_APP_IMAGE}
runtime: ${DOCKER_RUNTIME}
privileged: true
network_mode: ${UDEVD_NETWORK}
volumes:
# Followings are needed in order to get joystick support
- /dev/input:/dev/input:ro
- udev:/run/udev/:ro
# Xorg socket in order to get the screen
- ${XORG_SOCKET}:/tmp/.X11-unix
# Pulse socket, audio
- ${PULSE_SOCKET_HOST}:${PULSE_SOCKET_GUEST}
# Home directory:
- ${LOCAL_STATE}/:/home:rw
# some emulators need more than 64 MB of shared memory - see https://github.com/libretro/dolphin/issues/222
# TODO: why shm_size doesn't work ??????
- type: tmpfs
target: /dev/shm
tmpfs:
size: ${SHM_SIZE}
ipc: ${SHARED_IPC} # Needed for MIT-SHM, removing this should cause a performance hit see https://github.com/jessfraz/dockerfiles/issues/359
env_file:
- config/common.env
- config/xorg.env
# run-gow: gpu_env

environment:
# Which devices does GoW need to be able to use? The docker user will be
# added to the groups that own these devices, to help with permissions
# issues
# These values are the defaults, but you can add others if needed
GOW_REQUIRED_DEVICES: /dev/uinput /dev/input/event* /dev/dri/* /dev/snd/*
73 changes: 73 additions & 0 deletions images/kodi/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
ARG BASE_APP_IMAGE

# hadolint ignore=DL3006
FROM ${BASE_APP_IMAGE}

ARG DEBIAN_FRONTEND=noninteractive

# TODO: Build this madness in a multi-step Dockerfile and just copy the needed binary
# Required packages are listed here:
# - https://github.com/xbmc/xbmc/blob/master/docs/README.Ubuntu.md#32-get-build-dependencies-manually
ARG REQUIRED_PACKAGES=" \
debhelper autoconf autoconf automake \
autopoint gettext autotools-dev cmake \
curl default-jre doxygen gawk gcc gdc \
gperf libasound2-dev libass-dev \
libavahi-client-dev libavahi-common-dev \
libbluetooth-dev libbluray-dev libbz2-dev \
libcdio-dev libp8-platform-dev libcrossguid-dev \
libcurl4-openssl-dev libcwiid-dev libdbus-1-dev \
libdrm-dev libegl1-mesa-dev libenca-dev \
libexiv2-dev libflac-dev libfmt-dev \
libfontconfig-dev libfreetype6-dev \
libfribidi-dev libfstrcmp-dev \
libgcrypt-dev libgif-dev libgles2-mesa-dev \
libgl1-mesa-dev libglu1-mesa-dev libgnutls28-dev \
libgpg-error-dev libgtest-dev libiso9660-dev \
libjpeg-dev liblcms2-dev libltdl-dev liblzo2-dev \
libmicrohttpd-dev libmysqlclient-dev libnfs-dev \
libogg-dev libpcre2-dev libplist-dev libpng-dev \
libpulse-dev libshairplay-dev libsmbclient-dev \
libspdlog-dev libsqlite3-dev libssl-dev libtag1-dev \
libtiff5-dev libtinyxml-dev libtinyxml2-dev libtool \
libudev-dev libunistring-dev libva-dev libvdpau-dev \
libvorbis-dev libxmu-dev libxrandr-dev libxslt1-dev \
libxt-dev lsb-release meson nasm ninja-build \
python3-dev python3-pil python3-pip rapidjson-dev \
swig unzip uuid-dev zip zlib1g-dev git \
libflatbuffers-dev libglew-dev libwayland-dev \
libxkbcommon-dev waylandpp-dev wayland-protocols \
"

# Build Kodi from source
RUN apt-get update && \
apt-get install -y $REQUIRED_PACKAGES && \
git clone https://github.com/xbmc/xbmc kodi && \
apt-get update && \
mkdir kodi-build && \
cd kodi-build && \
cmake ../kodi -DCMAKE_INSTALL_PREFIX=/usr/local -DCORE_PLATFORM_NAME=wayland -DAPP_RENDER_SYSTEM=gl && \
cmake --build . -- VERBOSE=1 -j$(getconf _NPROCESSORS_ONLN) && \
make install

# Build controller addon; !!! Add needed Addons HERE !!!
RUN cd kodi && \
make -j$(getconf _NPROCESSORS_ONLN) -C tools/depends/target/binary-addons PREFIX=/usr/local ADDONS="peripheral.joystick" && \
#clean up
cd .. && \
rm -R kodi/ && \
rm -R kodi-build/ && \
apt-get autoremove -y --purge


COPY --chmod=777 scripts/startup.sh /opt/gow/startup-app.sh
COPY --chmod=777 scripts/startup-10-create-dirs.sh /opt/gow/startup.d/10-create-dirs.sh
COPY configs/Xbox_controller.xml /opt/gow/Xbox_controller.xml
COPY configs/Switch_controller.xml /opt/gow/Switch_controller.xml
COPY configs/PS_controller.xml /opt/gow/PS_controller.xml
COPY configs/settings.xml /opt/gow/settings.xml

ENV XDG_RUNTIME_DIR=/tmp/.X11-unix

ARG IMAGE_SOURCE
LABEL org.opencontainers.image.source=$IMAGE_SOURCE
40 changes: 40 additions & 0 deletions images/kodi/configs/PS_controller.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?xml version="1.0" ?>
<buttonmap>
<device name="Wolf DualSense (virtual) pad" provider="linux" buttoncount="13" axiscount="8">
<configuration>
<axis index="2" center="-1" range="2" />
<axis index="5" center="-1" range="2" />
</configuration>
<controller id="game.controller.default">
<feature name="a" button="0" />
<feature name="b" button="1" />
<feature name="back" button="8" />
<feature name="down" axis="+7" />
<feature name="guide" button="10" />
<feature name="left" axis="-6" />
<feature name="leftbumper" button="4" />
<feature name="leftstick">
<up axis="-1" />
<down axis="+1" />
<right axis="+0" />
<left axis="-0" />
</feature>
<feature name="leftthumb" button="11" />
<feature name="lefttrigger" axis="+2" />
<feature name="right" axis="+6" />
<feature name="rightbumper" button="5" />
<feature name="rightstick">
<up axis="-4" />
<down axis="+4" />
<right axis="+3" />
<left axis="-3" />
</feature>
<feature name="rightthumb" button="12" />
<feature name="righttrigger" axis="+5" />
<feature name="start" button="9" />
<feature name="up" axis="-7" />
<feature name="x" button="3" />
<feature name="y" button="2" />
</controller>
</device>
</buttonmap>
37 changes: 37 additions & 0 deletions images/kodi/configs/Switch_controller.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?xml version="1.0" ?>
<buttonmap>
<device name="Wolf Nintendo (virtual) pad" provider="linux" buttoncount="14" axiscount="6">
<configuration />
<controller id="game.controller.default">
<feature name="a" button="0" />
<feature name="b" button="1" />
<feature name="back" button="9" />
<feature name="down" axis="+5" />
<feature name="guide" button="11" />
<feature name="left" axis="-4" />
<feature name="leftbumper" button="5" />
<feature name="leftstick">
<up axis="-1" />
<down axis="+1" />
<right axis="+0" />
<left axis="-0" />
</feature>
<feature name="leftthumb" button="12" />
<feature name="lefttrigger" button="7" />
<feature name="right" axis="+4" />
<feature name="rightbumper" button="6" />
<feature name="rightstick">
<up axis="-3" />
<down axis="+3" />
<right axis="+2" />
<left axis="-2" />
</feature>
<feature name="rightthumb" button="13" />
<feature name="righttrigger" button="8" />
<feature name="start" button="10" />
<feature name="up" axis="-5" />
<feature name="x" button="3" />
<feature name="y" button="2" />
</controller>
</device>
</buttonmap>
40 changes: 40 additions & 0 deletions images/kodi/configs/Xbox_controller.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?xml version="1.0" ?>
<buttonmap>
<device name="Wolf X-Box One (virtual) pad" provider="linux" buttoncount="11" axiscount="8">
<configuration>
<axis index="2" center="-1" range="2" />
<axis index="5" center="-1" range="2" />
</configuration>
<controller id="game.controller.default">
<feature name="a" button="0" />
<feature name="b" button="1" />
<feature name="back" button="6" />
<feature name="down" axis="+7" />
<feature name="guide" button="8" />
<feature name="left" axis="-6" />
<feature name="leftbumper" button="4" />
<feature name="leftstick">
<up axis="-1" />
<down axis="+1" />
<right axis="+0" />
<left axis="-0" />
</feature>
<feature name="leftthumb" button="9" />
<feature name="lefttrigger" axis="+2" />
<feature name="right" axis="+6" />
<feature name="rightbumper" button="5" />
<feature name="rightstick">
<up axis="-4" />
<down axis="+4" />
<right axis="+3" />
<left axis="-3" />
</feature>
<feature name="rightthumb" button="10" />
<feature name="righttrigger" axis="+5" />
<feature name="start" button="7" />
<feature name="up" axis="-7" />
<feature name="x" button="2" />
<feature name="y" button="3" />
</controller>
</device>
</buttonmap>
3 changes: 3 additions & 0 deletions images/kodi/configs/settings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<settings version="2">
<setting id="driver_linux" default="true">0</setting>
</settings>
16 changes: 16 additions & 0 deletions images/kodi/scripts/startup-10-create-dirs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash -e

gow_log "[start-create-dirs] Begin"

# configure the controller.
if [ ! -d "${HOME}/.kodi/userdata/addon_data/peripheral.joystick/resources/buttonmaps/xml/linux" ]
then
gow_log "[start-create-dirs] Creating controller config file."
mkdir -p "${HOME}/.kodi/userdata/addon_data/peripheral.joystick/resources/buttonmaps/xml/linux/"
cp "/opt/gow/Xbox_controller.xml" "${HOME}/.kodi/userdata/addon_data/peripheral.joystick/resources/buttonmaps/xml/linux/Wolf_X-Box_One__virtual__pad_11b_8a.xml"
cp "/opt/gow/Switch_controller.xml" "${HOME}/.kodi/userdata/addon_data/peripheral.joystick/resources/buttonmaps/xml/linux/Wolf_Nintendo__virtual__pad_14b_6a.xml"
cp "/opt/gow/PS_controller.xml" "${HOME}/.kodi/userdata/addon_data/peripheral.joystick/resources/buttonmaps/xml/linux/Wolf_DualSense__virtual__pad_13b_8a.xml"
cp "/opt/gow/settings.xml" "${HOME}/.kodi/userdata/addon_data/peripheral.joystick/settings.xml"
fi

gow_log "[start-create-dirs] End"
18 changes: 18 additions & 0 deletions images/kodi/scripts/startup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/bash
set -e

source /opt/gow/bash-lib/utils.sh

# Run additional startup scripts
for file in /opt/gow/startup.d/* ; do
if [ -f "$file" ] ; then
gow_log "[start] Sourcing $file"
source $file
fi
done

gow_log "Starting Kodi"

source /opt/gow/launch-comp.sh
launcher kodi
#launcher jstest-gtk