Skip to content

Commit

Permalink
Merge pull request #147 from Samueru-sama/appimage
Browse files Browse the repository at this point in the history
make appimage that works on any linux system (even musl ones)
  • Loading branch information
benjamimgois authored Feb 15, 2025
2 parents 4ae6d59 + aeebdc3 commit 960f748
Show file tree
Hide file tree
Showing 2 changed files with 161 additions and 0 deletions.
81 changes: 81 additions & 0 deletions .github/workflows/appimage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
name: AppImage CI

# Controls when the action will run.
on:
push:
paths-ignore: [ '**/README.md' ]
pull_request:
paths-ignore: [ '**/README.md' ]
workflow_dispatch:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
build:
runs-on: ubuntu-latest
container: artixlinux/artixlinux:latest
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v4

- name: Get dependencies
run: |
sed -i 's/DownloadUser/#DownloadUser/g' /etc/pacman.conf
pacman -Syu --noconfirm \
base-devel \
git \
cmake \
strace \
patchelf \
curl \
wget \
git \
artix-archlinux-support \
llvm \
mesa \
mangohud \
xorg-server-xvfb \
vulkan-radeon \
vulkan-intel \
vulkan-nouveau
pacman-key --init && pacman-key --populate archlinux
printf "\n[extra]\nInclude = /etc/pacman.d/mirrorlist-arch\n" | tee -a /etc/pacman.conf
cat /etc/pacman.conf
sudo sed -i 's/NoExtract/#NoExtract/g' /etc/pacman.conf
pacman -Syu --noconfirm \
zsync \
qt6ct \
glu \
qt6pas \
vulkan-tools \
qt6-wayland \
lazarus
- name: Install debloated llvm-libs
run: |
LLVM="https://github.com/pkgforge-dev/llvm-libs-debloated/releases/download/continuous/llvm-libs-nano-x86_64.pkg.tar.zst"
wget "$LLVM" -O ./llvm-libs.pkg.tar.zst
pacman -U --noconfirm ./llvm-libs.pkg.tar.zst
# Runs a set of commands using the runners shell
- name: Build GOverlay
run: |
make LAZBUILDOPTS=--lazarusdir=/usr/lib/lazarus
make prefix=/usr libexecdir=/lib install
- name: Make AppImage
run: |
chmod +x ./appimage/goverlay-appimage.sh
./appimage/goverlay-appimage.sh
mkdir ./dist
echo "$PWD"
ls .
sha256sum *.AppImage*
mv *.AppImage* ./dist
- name: Upload artifact
uses: actions/upload-artifact@v4.4.3
with:
name: AppImage
path: 'dist'
80 changes: 80 additions & 0 deletions appimage/goverlay-appimage.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
#!/bin/sh

set -eu

# make appimage
export ARCH="$(uname -m)"
export APPIMAGE_EXTRACT_AND_RUN=1
export VERSION=git
UPINFO="gh-releases-zsync|$(echo "$GITHUB_REPOSITORY" | tr '/' '|')|latest|*$ARCH.AppImage.zsync"
LIB4BN="https://raw.githubusercontent.com/VHSgunzo/sharun/refs/heads/main/lib4bin"
URUNTIME=$(wget --retry-connrefused --tries=30 \
https://api.github.com/repos/VHSgunzo/uruntime/releases -O - \
| sed 's/[()",{} ]/\n/g' | grep -oi "https.*appimage.*dwarfs.*$ARCH$" | head -1)

# Prepare AppDir
mkdir -p ./AppDir
cd ./AppDir
cp /usr/share/applications/io.github.benjamimgois.goverlay.desktop ./
cp /usr/share/icons/hicolor/256x256/apps/goverlay.png ./
cp /usr/share/icons/hicolor/256x256/apps/goverlay.png ./.DirIcon

# ADD LIBRARIES
wget "$LIB4BN" -O ./lib4bin
chmod +x ./lib4bin
xvfb-run -a -- ./lib4bin -p -v -e -s -k \
/usr/lib/goverlay \
/usr/lib/mangohud/* \
/usr/bin/vkcube \
/usr/bin/vkcube-wayland \
/usr/lib/qt6/plugins/iconengines/* \
/usr/lib/qt6/plugins/imageformats/* \
/usr/lib/qt6/plugins/platforms/* \
/usr/lib/qt6/plugins/platformtheme/* \
/usr/lib/qt6/plugins/styles/* \
/usr/lib/qt6/plugins/xcbglintegrations/* \
/usr/lib/qt6/plugins/wayland-*

# VERY IMPORTANT!
cp -rv /usr/share/vulkan/implicit_layer.d ./share/vulkan
sed -i 's|/usr/lib/mangohud/||' ./share/vulkan/implicit_layer.d/*

echo 'MANGOHUD=1' > ./.env
echo 'libMangoHud_shim.so' > ./.preload

# Goverlay is also going to run sh -c mangohud vkcube so we need to wrap this
echo '#!/bin/sh
CURRENTDIR="$(dirname "$(readlink -f "$0")")"
if [ "$2" = "vkcube-wayland" ]; then
"$CURRENTDIR"/vkcube-wayland
else
"$CURRENTDIR"/vkcube
fi' > ./bin/mangohud
chmod +x ./bin/mangohud

ln ./sharun ./AppRun
./sharun -g

# make appimage with uruntime
cd ..
wget --retry-connrefused --tries=30 "$URUNTIME" -O ./uruntime
chmod +x ./uruntime

# Add udpate info to runtime
echo "Adding update information \"$UPINFO\" to runtime..."
printf "$UPINFO" > data.upd_info

llvm-objcopy --update-section=.upd_info=data.upd_info \
--set-section-flags=.upd_info=noload,readonly ./uruntime
printf 'AI\x02' | dd of=./uruntime bs=1 count=3 seek=8 conv=notrunc

echo "Generating AppImage..."
./uruntime --appimage-mkdwarfs -f \
--set-owner 0 --set-group 0 \
--no-history --no-create-timestamp \
--compression zstd:level=22 -S24 -B16 \
--header uruntime \
-i ./AppDir -o GOverlay-"$VERSION"-anylinux-"$ARCH".AppImage

zsyncmake *.AppImage -u *.AppImage
echo "All Done!"

0 comments on commit 960f748

Please sign in to comment.