diff options
author | Wolfgang Schupp <w.schupp@a1.net> | 2017-11-06 10:48:20 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-11-06 10:48:20 +0100 |
commit | 9e64d1b1a77bf3b44a9f9d40ed94a672fe05b6de (patch) | |
tree | 6872fbf0b32086a32c2391c76b0c9a8e967d64b1 /tools | |
parent | dcd9d9e80ba687e02c3f20d8b0fcfcefe865dd93 (diff) | |
parent | a5d2febf632093c4d3b19a7d600a0f5aea3a430c (diff) |
Merge pull request #13004 from wsnipex/binary-names
[cmake] linux: name kodi binary according to platform name
Diffstat (limited to 'tools')
-rw-r--r-- | tools/Linux/kodi.sh.in | 44 |
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 |