Skip to content

Commit

Permalink
Package: improve AppImage (#324)
Browse files Browse the repository at this point in the history
  • Loading branch information
Samueru-sama authored Jan 20, 2025
1 parent ddaf58c commit 7f02a76
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 38 deletions.
7 changes: 4 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on: [push, pull_request]

jobs:
build-linux:
runs-on: ubuntu-20.04
runs-on: ubuntu-24.04
strategy:
matrix:
cmake_args: [-DDISCORD_RPC=ON -DDRAG_DROP=ON -DNETPLAY=ON -DVRU=ON -DUSE_ANGRYLION=ON, -DDISCORD_RPC=OFF -DDRAG_DROP=OFF -DNETPLAY=OFF -DVRU=OFF -DUSE_ANGRYLION=OFF]
Expand All @@ -17,8 +17,9 @@ jobs:
key: Linux
- name: Install Packages
run: |
sudo add-apt-repository ppa:okirby/qt6-backports --yes
sudo apt-get -y install cmake ninja-build libhidapi-dev libsamplerate0-dev libspeex-dev libminizip-dev libsdl2-dev libsdl2-net-dev libfreetype6-dev libgl1-mesa-dev libglu1-mesa-dev pkg-config zlib1g-dev binutils-dev libspeexdsp-dev qt6-base-dev libqt6svg6-dev libqt6websockets6-dev libvulkan-dev build-essential nasm git zip appstream
sudo apt-get -y install cmake ninja-build libhidapi-dev libsamplerate0-dev libspeex-dev libminizip-dev libsdl2-dev libsdl2-net-dev libfreetype6-dev \
libgl1-mesa-dev libglu1-mesa-dev pkg-config zlib1g-dev binutils-dev libspeexdsp-dev qt6-base-dev libqt6svg6-dev libqt6websockets6-dev libvulkan-dev \
build-essential nasm git zip appstream xvfb qt6ct mesa-vulkan-drivers
- name: Prepare Environment
run: |
echo "GIT_REVISION=$(git describe --tags --always)" >> $GITHUB_ENV
Expand Down
21 changes: 10 additions & 11 deletions Package/AppImage/AppRun
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
#!/usr/bin/env bash
set -e

cur_dir="$(readlink -f "$(dirname "$0")")"

exec "$cur_dir/usr/bin/RMG" \
--lib-path="$cur_dir/usr/lib/RMG" \
--core-path="$cur_dir/usr/lib/RMG/Core" \
--plugin-path="$cur_dir/usr/lib/RMG/Plugin" \
--shared-data-path="$cur_dir/usr/share/RMG" \
"$@"
#!/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" \
"${@}"
65 changes: 41 additions & 24 deletions Package/AppImage/Create.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,37 +4,54 @@ set -ex
script_dir="$(dirname "$0")"
toplvl_dir="$(realpath "$script_dir/../../")"
bin_dir="$toplvl_dir/Bin/AppImage" # RMG should be installed here
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"

export QMAKE="$(which qmake6)"
export EXTRA_QT_PLUGINS="imageformats;iconengines;"
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

if [ ! -f "$script_dir/linuxdeploy-x86_64.AppImage" ]
then
curl -L https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage \
-o "$script_dir/linuxdeploy-x86_64.AppImage"
chmod +x "$script_dir/linuxdeploy-x86_64.AppImage"
fi
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/linuxdeploy-plugin-qt-x86_64.AppImage" ]
then
curl -L https://github.com/linuxdeploy/linuxdeploy-plugin-qt/releases/download/continuous/linuxdeploy-plugin-qt-x86_64.AppImage \
-o "$script_dir/linuxdeploy-plugin-qt-x86_64.AppImage"
chmod +x "$script_dir/linuxdeploy-plugin-qt-x86_64.AppImage"
if [ ! -f "./lib4bin" ]; then
curl -L "$LIB4BN" -o ./lib4bin
chmod +x ./lib4bin
fi

"$script_dir/linuxdeploy-plugin-qt-x86_64.AppImage" --appimage-extract
"$script_dir/linuxdeploy-x86_64.AppImage" --appimage-extract
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-*/*

# delete appimages
rm "$script_dir/linuxdeploy-x86_64.AppImage" \
"$script_dir/linuxdeploy-plugin-qt-x86_64.AppImage"
# Prepare sharun
"$bin_dir"/sharun -g
cp -v "$script_dir/AppRun" "$bin_dir"
chmod +x "$bin_dir"/AppRun

"$(pwd)/squashfs-root/AppRun" \
--plugin=qt \
--appdir="$bin_dir" \
--custom-apprun="$script_dir/AppRun" \
--output=appimage \
--desktop-file="$bin_dir/usr/share/applications/com.github.Rosalie241.RMG.desktop"
# make appimage
if [ ! -f "./appimagetool" ]; then
curl -L "$APPIMAGETOOL" -o ./appimagetool
chmod +x ./appimagetool
fi
./appimagetool --comp zstd \
--mksquashfs-opt -Xcompression-level --mksquashfs-opt 22 \
-n -u "$UPINFO" "$bin_dir" "$OUTPUT"

0 comments on commit 7f02a76

Please sign in to comment.