diff --git a/Package/AppImage/AppRun b/Package/AppImage/AppRun old mode 100644 new mode 100755 index 9eac4497..f1aff966 --- a/Package/AppImage/AppRun +++ b/Package/AppImage/AppRun @@ -1,10 +1,11 @@ #!/usr/bin/env sh [ -f "$APPIMAGE".stylesheet ] && APPIMAGE_QT_THEME="$APPIMAGE.stylesheet" [ -f "$APPIMAGE_QT_THEME" ] && set -- "$@" "-stylesheet" "$APPIMAGE_QT_THEME" -HERE="$(readlink -f "$(dirname "$0")")" -exec "$HERE/bin/RMG" \ - --lib-path="$HERE/shared/lib/RMG" \ - --core-path="$HERE/shared/lib/RMG/Core" \ - --plugin-path="$HERE/shared/lib/RMG/Plugin" \ - --shared-data-path="$HERE/share/RMG" \ - "${@}" +cur_dir="$(readlink -f "$(dirname "$0")")" + +exec "$cur_dir/bin/RMG" \ + --lib-path="$cur_dir/shared/lib/RMG" \ + --core-path="$cur_dir/shared/lib/RMG/Core" \ + --plugin-path="$cur_dir/shared/lib/RMG/Plugin" \ + --shared-data-path="$cur_dir/share/RMG" \ + "$@" diff --git a/Package/AppImage/Create.sh b/Package/AppImage/Create.sh index 28b3d4ae..dc8ad046 100755 --- a/Package/AppImage/Create.sh +++ b/Package/AppImage/Create.sh @@ -4,54 +4,78 @@ set -ex script_dir="$(dirname "$0")" toplvl_dir="$(realpath "$script_dir/../../")" bin_dir="$toplvl_dir/Bin/AppImage" # RMG should be installed here +lib_dir="/usr/lib64" + +XVFB_RUN="xvfb-run -a --" UPINFO="gh-releases-zsync|$(echo "$GITHUB_REPOSITORY" | tr '/' '|')|latest|*.AppImage.zsync" -LIB4BN="https://raw.githubusercontent.com/VHSgunzo/sharun/refs/heads/main/lib4bin" -APPIMAGETOOL="https://github.com/AppImage/appimagetool/releases/download/continuous/appimagetool-x86_64.AppImage" +LIB4BIN_URL="https://raw.githubusercontent.com/VHSgunzo/sharun/refs/heads/main/lib4bin" +APPIMAGETOOL_URL="https://github.com/AppImage/appimagetool/releases/download/continuous/appimagetool-x86_64.AppImage" +SHARUN_URL="https://github.com/VHSgunzo/sharun/releases/latest/download/sharun-x86_64" -export ARCH="$(uname -m)" +export ARCH=$(uname -m) export APPIMAGE_EXTRACT_AND_RUN=1 export VERSION="$(git describe --tags --always)" export OUTPUT="$bin_dir/../RMG-Portable-Linux64-$VERSION.AppImage" -export LD_LIBRARY_PATH="$toplvl_dir/Build/AppImage/Source/RMG-Core" # hack +export SHARUN="$script_dir/sharun" -cp "$bin_dir"/usr/share/applications/com.github.Rosalie241.RMG.desktop "$bin_dir" -cp "$bin_dir"/usr/share/icons/hicolor/scalable/apps/com.github.Rosalie241.RMG.svg "$bin_dir" -ln -s ./com.github.Rosalie241.RMG.svg "$bin_dir"/.DirIcon -mv "$bin_dir"/usr/share "$bin_dir"/share -mv "$bin_dir"/usr "$bin_dir"/shared +if [[ ! -f "$script_dir/lib4bin" ]] +then + curl -L "$LIB4BIN_URL" -o "$script_dir/lib4bin" + chmod +x "$script_dir/lib4bin" +fi + +if [[ ! -f "$script_dir/appimagetool" ]] +then + curl -L "$APPIMAGETOOL_URL" -o "$script_dir/appimagetool" + chmod +x "$script_dir/appimagetool" +fi + +if [[ ! -f "$script_dir/sharun" ]] +then + curl -L "$SHARUN_URL" -o "$script_dir/sharun" + chmod +x "$script_dir/sharun" +fi + +if [[ "x$DISPLAY" != "x" ]] +then + XVFB_RUN="" +fi -if [ ! -f "./lib4bin" ]; then - curl -L "$LIB4BN" -o ./lib4bin - chmod +x ./lib4bin +if [[ -d "/usr/lib/x86_64-linux-gnu/" ]] +then + lib_dir="/usr/lib/x86_64-linux-gnu/" fi -xvfb-run -a -- ./lib4bin --dst-dir "$bin_dir" -p -v -r -s -k -e \ - "$bin_dir"/shared/bin/RMG \ - /usr/lib/x86_64-linux-gnu/libSDL* \ - /usr/lib/x86_64-linux-gnu/libGL* \ - /usr/lib/x86_64-linux-gnu/libEGL* \ - /usr/lib/x86_64-linux-gnu/libvulkan* \ - /usr/lib/x86_64-linux-gnu/dri/* \ - /usr/lib/x86_64-linux-gnu/libssl.so* \ - /usr/lib/x86_64-linux-gnu/qt6/plugins/iconengines/* \ - /usr/lib/x86_64-linux-gnu/qt6/plugins/imageformats/* \ - /usr/lib/x86_64-linux-gnu/qt6/plugins/platforms/* \ - /usr/lib/x86_64-linux-gnu/qt6/plugins/platformthemes/* \ - /usr/lib/x86_64-linux-gnu/qt6/plugins/styles/* \ - /usr/lib/x86_64-linux-gnu/qt6/plugins/xcbglintegrations/* \ - /usr/lib/x86_64-linux-gnu/qt6/plugins/tls/* \ - /usr/lib/x86_64-linux-gnu/qt6/plugins/wayland-*/* +cp "$bin_dir/usr/share/applications/com.github.Rosalie241.RMG.desktop" "$bin_dir" +cp "$bin_dir/usr/share/icons/hicolor/scalable/apps/com.github.Rosalie241.RMG.svg" "$bin_dir" +ln -s ./com.github.Rosalie241.RMG.svg "$bin_dir"/.DirIcon +mv "$bin_dir/usr/share" "$bin_dir/share" +mv "$bin_dir/usr" "$bin_dir/shared" + +$XVFB_RUN "$script_dir/lib4bin" --dst-dir "$bin_dir" \ + --hard-links --patch-rpath --strip \ + --with-hooks --strace-mode --with-sharun \ + "$bin_dir/shared/bin/RMG" \ + "$lib_dir"/libSDL* \ + "$lib_dir"/libGL* \ + "$lib_dir"/libEGL* \ + "$lib_dir"/libvulkan* \ + "$lib_dir"/dri/* \ + "$lib_dir"/libssl.so* \ + "$lib_dir"/qt6/plugins/iconengines/* \ + "$lib_dir"/qt6/plugins/imageformats/* \ + "$lib_dir"/qt6/plugins/platforms/* \ + "$lib_dir"/qt6/plugins/platformthemes/* \ + "$lib_dir"/qt6/plugins/styles/* \ + "$lib_dir"/qt6/plugins/xcbglintegrations/* \ + "$lib_dir"/qt6/plugins/tls/* \ + "$lib_dir"/qt6/plugins/wayland-*/* # Prepare sharun -"$bin_dir"/sharun -g -cp -v "$script_dir/AppRun" "$bin_dir" -chmod +x "$bin_dir"/AppRun +"$bin_dir/sharun" -g +cp "$script_dir/AppRun" "$bin_dir" # make appimage -if [ ! -f "./appimagetool" ]; then - curl -L "$APPIMAGETOOL" -o ./appimagetool - chmod +x ./appimagetool -fi -./appimagetool --comp zstd \ +"$script_dir/appimagetool" --comp zstd \ --mksquashfs-opt -Xcompression-level --mksquashfs-opt 22 \ -n -u "$UPINFO" "$bin_dir" "$OUTPUT"