From f30d32a90858edffd1db2b94676ec7a6f3b33123 Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Fri, 24 Jul 2026 18:08:16 +0200 Subject: [PATCH] Add AppImage build script and workflow. --- .github/workflows/appimage.yml | 43 ++++++++++++++++++++ .github/workflows/release.yml | 12 +++++- profiler/appimage/build.sh | 73 ++++++++++++++++++++++++++++++++++ 3 files changed, 127 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/appimage.yml create mode 100755 profiler/appimage/build.sh diff --git a/.github/workflows/appimage.yml b/.github/workflows/appimage.yml new file mode 100644 index 00000000..8074d93e --- /dev/null +++ b/.github/workflows/appimage.yml @@ -0,0 +1,43 @@ +name: appimage + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + workflow_dispatch: + workflow_call: + +env: + CPM_SOURCE_CACHE: ${{ github.workspace }}/cpm-cache + +jobs: + build-appimage: + runs-on: ubuntu-latest + container: ubuntu:24.04 + steps: + - name: Install dependencies + run: | + apt-get update + DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ + build-essential cmake ninja-build meson pkg-config git ca-certificates \ + curl file desktop-file-utils nodejs \ + libegl-dev libxkbcommon-dev libdbus-1-dev libssl-dev \ + libffi-dev libexpat1-dev + - name: Trust git repo + run: git config --global --add safe.directory '*' + - uses: actions/checkout@v4 + - name: Cache CPM packages + uses: actions/cache@v4 + with: + path: ${{ env.CPM_SOURCE_CACHE }} + key: ${{ runner.os }}-cpm-${{ hashFiles('**/vendor.cmake', '**/CMakeLists.txt') }} + restore-keys: ${{ runner.os }}-cpm- + - name: Build AppImage + run: profiler/appimage/build.sh + env: + GIT_REV: ${{ github.sha }} + - uses: actions/upload-artifact@v4 + with: + name: appimage + path: profiler/build-appimage/tracy-profiler-x86_64.AppImage diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 2ff7cc39..450b6beb 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -14,8 +14,11 @@ jobs: release-build-manual: uses: ./.github/workflows/latex.yml + release-build-appimage: + uses: ./.github/workflows/appimage.yml + attach-to-release: - needs: [release-build-windows, release-build-macos, release-build-manual] + needs: [release-build-windows, release-build-macos, release-build-manual, release-build-appimage] runs-on: ubuntu-latest permissions: contents: write @@ -34,9 +37,16 @@ jobs: cd macos chmod +x tracy-* tracy-profiler.app/Contents/MacOS/* zip -r ../macos-$VERSION_NO_V.zip . + - name: Create versioned AppImage + run: | + VERSION="${{ github.event.release.tag_name }}" + VERSION_NO_V="${VERSION#v}" + mv appimage/tracy-profiler-x86_64.AppImage tracy-profiler-$VERSION_NO_V-x86_64.AppImage + chmod +x tracy-profiler-$VERSION_NO_V-x86_64.AppImage - uses: softprops/action-gh-release@v2 with: files: | windows-*.zip macos-*.zip + tracy-profiler-*.AppImage manual/tracy.pdf diff --git a/profiler/appimage/build.sh b/profiler/appimage/build.sh new file mode 100755 index 00000000..f438c1cc --- /dev/null +++ b/profiler/appimage/build.sh @@ -0,0 +1,73 @@ +#!/bin/sh +set -eu + +# Builds the profiler as an AppImage. The Wayland client libraries are built +# from a pinned release and bundled, so the core protocol version does not +# depend on what the build host provides. Everything else that is host-coupled +# (glibc, EGL, dbus, xkbcommon, OpenSSL) is left to the target system, which +# is expected to be reasonably current. The build host sets the glibc floor, +# so this should run on the oldest distro release that is still supported. + +ROOT=$(cd "$(dirname "$0")/../.." && pwd) +BUILD="$ROOT/profiler/build-appimage" +PREFIX="$BUILD/wayland" +APPDIR="$BUILD/AppDir" + +WAYLAND_VERSION=1.25.0 +APPIMAGETOOL_URL="https://github.com/AppImage/appimagetool/releases/download/continuous/appimagetool-x86_64.AppImage" + +mkdir -p "$BUILD" + +if [ ! -e "$PREFIX/lib/pkgconfig/wayland-client.pc" ]; then + git clone --depth 1 --branch $WAYLAND_VERSION https://gitlab.freedesktop.org/wayland/wayland.git "$BUILD/wayland-src" + meson setup "$BUILD/wayland-build" "$BUILD/wayland-src" \ + --prefix "$PREFIX" --libdir lib --buildtype release \ + -Ddocumentation=false -Dtests=false -Ddtd_validation=false + meson install -C "$BUILD/wayland-build" +fi +export PKG_CONFIG_PATH="$PREFIX/lib/pkgconfig" +export PATH="$PREFIX/bin:$PATH" + +cmake -B "$BUILD/profiler" -S "$ROOT/profiler" -G Ninja \ + -DCMAKE_BUILD_TYPE=Release \ + -DNO_ISA_EXTENSIONS=ON \ + -DCMAKE_BUILD_RPATH='$ORIGIN/../lib' \ + -DDOWNLOAD_CAPSTONE=ON \ + -DDOWNLOAD_FREETYPE=ON \ + -DDOWNLOAD_LIBCURL=ON \ + -DDOWNLOAD_PUGIXML=ON \ + ${GIT_REV:+-DGIT_REV=$GIT_REV} +cmake --build "$BUILD/profiler" --parallel "$(nproc)" + +rm -rf "$APPDIR" +mkdir -p "$APPDIR/usr/bin" "$APPDIR/usr/lib" \ + "$APPDIR/usr/share/applications" \ + "$APPDIR/usr/share/mime/packages" \ + "$APPDIR/usr/share/icons/hicolor/scalable/apps" \ + "$APPDIR/usr/share/icons/hicolor/scalable/mimetypes" + +cp "$BUILD/profiler/tracy-profiler" "$APPDIR/usr/bin/" +strip "$APPDIR/usr/bin/tracy-profiler" +cp "$PREFIX/lib/libwayland-client.so.0" \ + "$PREFIX/lib/libwayland-cursor.so.0" \ + "$PREFIX/lib/libwayland-egl.so.1" \ + "$APPDIR/usr/lib/" +# The Exec path must not be absolute, the profiler is not in /usr/bin here +sed 's|^Exec=.*|Exec=tracy-profiler %f|' "$ROOT/extra/desktop/tracy.desktop" \ + > "$APPDIR/usr/share/applications/tracy.desktop" +cp "$ROOT/extra/desktop/application-tracy.xml" "$APPDIR/usr/share/mime/packages/" +cp "$ROOT/icon/icon.svg" "$APPDIR/usr/share/icons/hicolor/scalable/apps/tracy.svg" +cp "$ROOT/icon/application-tracy.svg" "$APPDIR/usr/share/icons/hicolor/scalable/mimetypes/" +ln -s usr/share/applications/tracy.desktop "$APPDIR/tracy.desktop" +ln -s usr/share/icons/hicolor/scalable/apps/tracy.svg "$APPDIR/tracy.svg" +ln -s tracy.svg "$APPDIR/.DirIcon" +ln -s usr/bin/tracy-profiler "$APPDIR/AppRun" + +ldd "$APPDIR/usr/bin/tracy-profiler" + +if [ ! -x "$BUILD/appimagetool" ]; then + curl -Lf -o "$BUILD/appimagetool" "$APPIMAGETOOL_URL" + chmod +x "$BUILD/appimagetool" +fi +ARCH=x86_64 "$BUILD/appimagetool" --appimage-extract-and-run \ + "$APPDIR" "$BUILD/tracy-profiler-x86_64.AppImage"