aboutsummaryrefslogtreecommitdiff
path: root/tools/Linux
diff options
context:
space:
mode:
authorwsnipex <wsnipex@a1.net>2017-10-29 20:53:35 +0100
committerwsnipex <wsnipex@a1.net>2017-11-05 17:46:43 +0100
commita5d2febf632093c4d3b19a7d600a0f5aea3a430c (patch)
tree8c63c342adf5e2ec8497ab9ff37f526fa2d074de /tools/Linux
parent4e928ea23cce7e074f53b7b3e143041b0f621115 (diff)
[cmake] linux: name kodi binary according to platform name
and automatically select kodi-wayland binary on wayland compositors
Diffstat (limited to 'tools/Linux')
-rw-r--r--tools/Linux/kodi.sh.in44
1 files changed, 37 insertions, 7 deletions
diff --git a/tools/Linux/kodi.sh.in b/tools/Linux/kodi.sh.in
index 2a656052af..2d7497cf83 100644
--- a/tools/Linux/kodi.sh.in
+++ b/tools/Linux/kodi.sh.in
@@ -25,9 +25,10 @@ prefix="@prefix@"
exec_prefix="@exec_prefix@"
datarootdir="@datarootdir@"
LIBDIR="@libdir@"
+APP_BINARY=$LIBDIR/${bin_name}/@APP_BINARY@
CRASHLOG_DIR=${CRASHLOG_DIR:-$HOME}
USERDATA_DIR="${HOME}/.${bin_name}"
-
+WINDOWING=${WINDOWING:-"auto"}
# Workaround for high CPU load with nvidia GFX
export __GL_YIELD=USLEEP
@@ -35,7 +36,6 @@ export __GL_YIELD=USLEEP
# Fix wasting RAM due to fragmentation
export MALLOC_MMAP_THRESHOLD_=131072
-
# Check for some options used by this script
while [ "$#" -gt "0" ]
do
@@ -44,12 +44,42 @@ do
LIBDIR="$2"
shift; shift
;;
+ --windowing)
+ WINDOWING="$2"
+ echo "$SAVED_ARGS" | sed "s/--windowing[ ]*$2//g"
+ shift; shift
+ ;;
*)
shift
;;
esac
done
+# Note: by default only one of those binaries exists
+# To be able to select a different one, if has to be compiled specifically
+# Your distribution might provide extra packages for those
+if [ "$WINDOWING" = "auto" ]; then
+ # Wayland
+ if [ -n $WAYLAND_DISPLAY ] && [ -x $LIBDIR/${bin_name}/${bin_name}-wayland ]; then
+ KODI_BINARY=$LIBDIR/${bin_name}/${bin_name}-wayland
+ # X11
+ elif echo $DISPLAY | grep -qE ":[0-9]+" && [ -x $LIBDIR/${bin_name}/${bin_name}-x11 ]; then
+ KODI_BINARY=$LIBDIR/${bin_name}/${bin_name}-x11
+ # GBM/DRM
+ elif [ -z $DISPLAY ] && [ -z $WAYLAND_DISPLAY ] && [ -x $LIBDIR/${bin_name}/${bin_name}-gbm ]; then
+ KODI_BINARY=$LIBDIR/${bin_name}/${bin_name}-gbm
+ fi
+elif [ -n $WINDOWING ]; then
+ KODI_BINARY=$LIBDIR/${bin_name}/${bin_name}-${WINDOWING}
+else
+ KODI_BINARY=${APP_BINARY}
+fi
+
+if [ ! -x ${KODI_BINARY} ]; then
+ echo "Error: ${KODI_BINARY} not found"
+ exit 2
+fi
+
migrate_home()
{
[ "$(basename $0)" = "xbmc" ] && echo "WARNING: Running ${bin_name} as "xbmc" is deprecated and will be removed in later versions, please switch to using the ${bin_name} binary"
@@ -71,10 +101,10 @@ single_stacktrace()
{
# core filename is either "core.$PID" or "core"
find "$1" -maxdepth $2 -name 'core*' | while read core; do
- LC_ALL=C gdb --core="$core" --batch 2> /dev/null | grep -q "^Core was generated by \`$LIBDIR/${bin_name}/${bin_name}.bin" || continue
+ LC_ALL=C gdb --core="$core" --batch 2> /dev/null | grep -q "^Core was generated by \`${KODI_BINARY}" || continue
echo "=====> Core file: "$core" ($(stat -c%y "$core"))" >> $FILE
echo " =========================================" >> $FILE
- gdb "$LIBDIR/${bin_name}/${bin_name}.bin" --core="$core" --batch -ex "thread apply all bt" 2> /dev/null >> $FILE
+ gdb "${KODI_BINARY}" --core="$core" --batch -ex "thread apply all bt" 2> /dev/null >> $FILE
rm -f "$core"
done
}
@@ -107,9 +137,9 @@ print_crash_report()
echo "############### STACK TRACE #################" >> $FILE
if command_exists gdb; then
if command_exists systemd-coredumpctl; then
- systemd-coredumpctl dump -o core ${bin_name}.bin > /dev/null 2>&1
+ systemd-coredumpctl dump -o core $(basename ${KODI_BINARY}) > /dev/null 2>&1
elif command_exists coredumpctl; then
- coredumpctl dump -o core ${bin_name}.bin > /dev/null 2>&1
+ coredumpctl dump -o core $(basename ${KODI_BINARY}) > /dev/null 2>&1
fi
single_stacktrace "$PWD" 1
# Find in plugins directories
@@ -163,7 +193,7 @@ LOOP=1
while [ $(( $LOOP )) = "1" ]
do
LOOP=0
- "$LIBDIR/${bin_name}/${bin_name}.bin" $SAVED_ARGS
+ ${KODI_BINARY} $SAVED_ARGS
RET=$?
if [ $(( $RET == 65 )) = "1" ]
then # User requested to restart app