Gtk: Simplify makeappimage.sh

This commit is contained in:
BearOso 2023-03-28 12:41:15 -05:00
parent 835ad39026
commit 59c48e35a7
1 changed files with 3 additions and 42 deletions

View File

@ -1,4 +1,4 @@
#!/usr/bin/env sh
#!/usr/bin/env bash
if [ ! -f appimagetool-x86_64.AppImage ]; then
wget https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage
@ -10,51 +10,12 @@ if [ ! -f linuxdeploy-x86_64.AppImage ]; then
chmod +x linuxdeploy-x86_64.AppImage
fi
if [ ! -d AppImageKit-checkrt ]; then
git clone https://github.com/darealshinji/AppImageKit-checkrt
fi
pushd AppImageKit-checkrt/src
make
popd
DESTDIR=AppDir ninja install
./linuxdeploy-x86_64.AppImage --appdir=AppDir
./linuxdeploy-x86_64.AppImage --appimage-extract-and-run --appdir=AppDir
rm AppDir/snes9x.png
rm AppDir/AppRun
mkdir AppDir/usr/optional
cp AppImageKit-checkrt/src/checkrt AppDir/usr/optional
AppDir/usr/optional/checkrt -c
pushd AppDir
rm snes9x.png
rm AppRun
ln -s usr/share/icons/hicolor/256x256/apps/snes9x.png
cat > AppRun << EOF
#!/bin/sh -e
# add your command to execute here
exec=snes9x-gtk
cd "$(dirname "$0")"
if [ "x$exec" = "x" ]; then
exec="$(sed -n 's|^Exec=||p' *.desktop | head -1)"
fi
if [ -x "./usr/optional/checkrt" ]; then
extra_libs="$(./usr/optional/checkrt)"
fi
if [ -n "$extra_libs" ]; then
export LD_LIBRARY_PATH="${extra_libs}${LD_LIBRARY_PATH}"
if [ -e "$PWD/usr/optional/exec.so" ]; then
export LD_PRELOAD="$PWD/usr/optional/exec.so:${LD_PRELOAD}"
fi
fi
#echo ">>>>> $LD_LIBRARY_PATH"
#echo ">>>>> $LD_PRELOAD"
./usr/bin/$exec "$*"
exit $?
EOF
chmod +x AppRun
popd
./appimagetool-x86_64.AppImage AppDir
./appimagetool-x86_64.AppImage --appimage-extract-and-run AppDir