From e72faa1d2c2a194b4ec4c404ed07574efe1c7784 Mon Sep 17 00:00:00 2001 From: Filippo Scognamiglio Date: Sat, 17 Jan 2026 13:53:12 +0100 Subject: [PATCH] Set up appimage build. --- .github/workflows/appimage.yml | 98 ---------------------------- .github/workflows/build-appimage.yml | 49 ++++++++++++++ .gitignore | 5 ++ .travis.yml | 37 ----------- scripts/build-appimage.sh | 77 ++++++++++++++++++++++ 5 files changed, 131 insertions(+), 135 deletions(-) delete mode 100644 .github/workflows/appimage.yml create mode 100644 .github/workflows/build-appimage.yml delete mode 100644 .travis.yml create mode 100755 scripts/build-appimage.sh diff --git a/.github/workflows/appimage.yml b/.github/workflows/appimage.yml deleted file mode 100644 index 2627318..0000000 --- a/.github/workflows/appimage.yml +++ /dev/null @@ -1,98 +0,0 @@ -name: "ci" - -on: - push: - tags: "**" - workflow_dispatch: - -defaults: - run: - shell: bash - -jobs: - appimage: - runs-on: ubuntu-18.04 - - steps: - - name: Checkout repository - uses: actions/checkout@v2 - with: - submodules: true - - - name: Install dependencies - run: | - sudo add-apt-repository -y ppa:beineri/opt-qt-5.15.2-bionic - sudo apt-get update -qq - sudo apt-get install -y \ - build-essential make wget libgl1-mesa-dev \ - qt515declarative qt515graphicaleffects \ - qt515quickcontrols qt515quickcontrols2 - - - name: Download QT appimage builder - run: | - wget -c -O linuxdeployqt.AppImage \ - https://github.com/probonopd/linuxdeployqt/releases/download/continuous/linuxdeployqt-continuous-x86_64.AppImage - chmod a+x linuxdeployqt.AppImage - - - name: Build project - run: | - source /opt/qt*/bin/qt*-env.sh && \ - qmake -v && \ - qmake CONFIG+=release PREFIX=/usr && \ - make -j$(nproc) - - - name: Install to appdir - run: | - source /opt/qt*/bin/qt*-env.sh && \ - make INSTALL_ROOT=appdir -j$(nproc) install - - - name: Extract version number - run: | - # Extract version for linuxdeployqt to name the file. Use the tag as - # release name but remove prefix. - echo "VERSION=$(echo '${{ github.ref }}' | sed 's;.*/;;')" >> $GITHUB_ENV - - - name: Build appimage directory - run: | - mkdir -p \ - appdir/usr/bin \ - appdir/usr/lib \ - appdir/usr/share/applications \ - appdir/usr/share/metainfo \ - appdir/usr/share/icons/hicolor/128x128/apps - - cp cool-retro-term appdir/usr/bin/ - cp cool-retro-term.desktop appdir/usr/share/applications/ - cp packaging/appdata/cool-retro-term.appdata.xml appdir/usr/share/metainfo/ - cp app/icons/128x128/cool-retro-term.png appdir/usr/share/icons/hicolor/128x128/apps/ - cp -r ./app/qml appdir/usr/ - # Workaround for https://github.com/probonopd/linuxdeployqt/issues/78 - cp -r ./qmltermwidget/QMLTermWidget appdir/usr/qml/ - - find appdir | sort - - - name: Build appimage - run: | - source /opt/qt*/bin/qt*-env.sh && \ - ./linuxdeployqt.AppImage appdir/usr/share/applications/cool-retro-term.desktop \ - -verbose=1 -appimage \ - -qmldir=./app/qml/ \ - -qmldir=./qmltermwidget/ - env: - # Unset environment variables - QTDIR: - QT_PLUGIN_PATH: - LD_LIBRARY_PATH: - - - name: Upload release - uses: softprops/action-gh-release@v1 - with: - body: appimage release - files: ./**/Cool_Retro_Term-*-x86_64.AppImage - - - name: Clean up - if: always() - run: | - find appdir -executable -type f -exec ldd {} \; | grep " => /usr" | cut -d " " -f 2-3 | sort | uniq - make clean - rm -rf appdir diff --git a/.github/workflows/build-appimage.yml b/.github/workflows/build-appimage.yml new file mode 100644 index 0000000..7cd44df --- /dev/null +++ b/.github/workflows/build-appimage.yml @@ -0,0 +1,49 @@ +name: Build AppImage + +on: + workflow_dispatch: + push: + branches: + - main + pull_request: + +jobs: + build-appimage: + name: Build (Linux, AppImage) + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v4 + + - name: Install build deps + run: | + sudo apt update + sudo apt install -y build-essential rsync wget + + - name: Install Qt + uses: jurplel/install-qt-action@v4 + with: + version: 6.10.0 + dir: .. + modules: qtwayland qtshadertools + setup-python: false + cache: true + + - name: Build AppImage + run: | + ./scripts/build-appimage.sh + + - name: Collect artifact + run: | + mkdir -p release + mv ./*.AppImage release/ + + - name: Attestation + uses: actions/attest-build-provenance@v1 + with: + subject-path: ./release/* + + - name: Upload artifact + uses: actions/upload-artifact@v4 + with: + name: cool-retro-term-appimage + path: ./release/* diff --git a/.gitignore b/.gitignore index 30a7923..18807b9 100644 --- a/.gitignore +++ b/.gitignore @@ -41,10 +41,15 @@ Makefile* *.json # Excludes compiled files + imports cool-retro-term build +# Linux + +*.AppImage + # Mac OSX .DS_Store diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index ce8f803..0000000 --- a/.travis.yml +++ /dev/null @@ -1,37 +0,0 @@ -sudo: required -dist: trusty -language: c++ - -install: - - sudo add-apt-repository -y ppa:beineri/opt-qt58-trusty - - sudo apt-get update -qq - - sudo apt-get -y install build-essential qt58declarative qt58graphicaleffects qt58quickcontrols libgl1-mesa-dev - - source /opt/qt*/bin/qt*-env.sh - -script: - - qmake CONFIG+=release PREFIX=/usr - - make -j$(nproc) - - mkdir -p appdir/usr/share/metainfo appdir/usr/bin - - cp packaging/appdata/cool-retro-term.appdata.xml appdir/usr/share/metainfo/ - - cp cool-retro-term appdir/usr/bin/ - - cp ./cool-retro-term.desktop appdir/ - - cp ./app/icons/128x128/cool-retro-term.png appdir/ - - cp -r ./app/qml appdir/usr/ - - cp -r ./qmltermwidget/QMLTermWidget appdir/usr/qml/ # Workaround for https://github.com/probonopd/linuxdeployqt/issues/78 - - wget -c https://github.com/probonopd/linuxdeployqt/releases/download/continuous/linuxdeployqt-continuous-x86_64.AppImage - - chmod a+x linuxdeployqt-*.AppImage - - unset QTDIR; unset QT_PLUGIN_PATH ; unset LD_LIBRARY_PATH - - export VERSION=$(git rev-parse --short HEAD) # linuxdeployqt uses this for naming the file - - ./linuxdeployqt-*.AppImage appdir/usr/bin/cool-retro-term -qmldir=./app/qml/ -qmldir=./qmltermwidget/ # -verbose=3 2>&1 | grep "path:" -C 3 - - ./linuxdeployqt-*.AppImage appdir/usr/bin/cool-retro-term -qmldir=./app/qml/ -qmldir=./qmltermwidget/ -verbose=2 -appimage - -after_success: - - find appdir -executable -type f -exec ldd {} \; | grep " => /usr" | cut -d " " -f 2-3 | sort | uniq - - # curl --upload-file Cool*.AppImage https://transfer.sh/Cool_Retro_Term-git.$(git rev-parse --short HEAD)-x86_64.AppImage - - wget -c https://github.com/probonopd/uploadtool/raw/master/upload.sh - - bash upload.sh Cool*.AppImage* - -branches: - except: - - # Do not build tags that we create when we upload to GitHub Releases - - /^(?i:continuous)/ diff --git a/scripts/build-appimage.sh b/scripts/build-appimage.sh new file mode 100755 index 0000000..b7f5186 --- /dev/null +++ b/scripts/build-appimage.sh @@ -0,0 +1,77 @@ +#!/usr/bin/env bash +set -euo pipefail +set -x + +REPO_ROOT="$(readlink -f "$(dirname "$(dirname "$0")")")" +OLD_CWD="$(readlink -f .)" +BUILD_DIR="$REPO_ROOT/build/appimage" +TOOLS_DIR="$BUILD_DIR/tools" + +if ! command -v qmake >/dev/null; then + echo "qmake not found in PATH." >&2 + exit 1 +fi +QTDIR="$(qmake -query QT_INSTALL_PREFIX)" +QT_INSTALL_QML="$(qmake -query QT_INSTALL_QML)" + +APPDIR="$BUILD_DIR/AppDir" + +mkdir -p "$BUILD_DIR" +rm -rf "$APPDIR" +pushd "$BUILD_DIR" + +qmake "$REPO_ROOT/cool-retro-term.pro" +make -j"$(nproc)" + +# Install targets from subprojects (the top-level install only installs the desktop file). +make -C app install INSTALL_ROOT="$APPDIR" +make -C qmltermwidget install INSTALL_ROOT="$APPDIR" +make install INSTALL_ROOT="$APPDIR" + +popd + +# Relocate QMLTermWidget into the standard AppDir QML import path. +QML_ROOT="$APPDIR$QT_INSTALL_QML" +if [ -d "$QML_ROOT" ]; then + mkdir -p "$APPDIR/usr/qml" + rsync -a "$QML_ROOT/" "$APPDIR/usr/qml/" + rm -rf "$QML_ROOT" + QML_PARENT="$(dirname "$QML_ROOT")" + while [ "$QML_PARENT" != "$APPDIR" ] && rmdir "$QML_PARENT" 2>/dev/null; do + QML_PARENT="$(dirname "$QML_PARENT")" + done +fi + + +# Build AppImage using linuxdeploy and linuxdeploy-plugin-qt. +mkdir -p "$TOOLS_DIR" +LINUXDEPLOY="$TOOLS_DIR/linuxdeploy-x86_64.AppImage" +LINUXDEPLOY_QT="$TOOLS_DIR/linuxdeploy-plugin-qt-x86_64.AppImage" +if [ ! -x "$LINUXDEPLOY" ]; then + wget -c -O "$LINUXDEPLOY" https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage + chmod +x "$LINUXDEPLOY" +fi +if [ ! -x "$LINUXDEPLOY_QT" ]; then + wget -c -O "$LINUXDEPLOY_QT" https://github.com/linuxdeploy/linuxdeploy-plugin-qt/releases/download/continuous/linuxdeploy-plugin-qt-x86_64.AppImage + chmod +x "$LINUXDEPLOY_QT" +fi + +export QML_SOURCES_PATHS="$REPO_ROOT/app" + +pushd "$BUILD_DIR" + +export EXTRA_PLATFORM_PLUGINS="libqwayland.so;" +export EXTRA_QT_MODULES="sql;waylandcompositor;waylandclient" +export DEPLOY_PLATFORM_THEMES=true +export LINUXDEPLOY_EXCLUDED_LIBRARIES="libmysqlclient.so;libqsqlmimer.so;libqsqlmysql.so;libqsqlodbc.so;libqsqlpsql.so;libqsqloci.so;libqsqlibase.so" + +"$LINUXDEPLOY" \ + --appdir "$APPDIR" \ + -e "$APPDIR/usr/bin/cool-retro-term" \ + -i "$REPO_ROOT/app/icons/256x256/cool-retro-term.png" \ + -d "$REPO_ROOT/cool-retro-term.desktop" \ + --plugin qt \ + --output appimage + +mv ./*.AppImage "$OLD_CWD" +popd