From 83c5d15cdf808118c77fa2b6b2a9bfc77f353b37 Mon Sep 17 00:00:00 2001 From: AdenKoperczak Date: Sat, 31 May 2025 09:09:19 -0400 Subject: [PATCH] Working flatpak build --- .github/workflows/ci.yml | 38 ++++++++++++++++++- scwx-qt/res/linux/net.supercellwx.app.desktop | 7 ++++ tools/net.supercellwx.app.yml | 37 ++++++++++++++++++ 3 files changed, 81 insertions(+), 1 deletion(-) create mode 100644 scwx-qt/res/linux/net.supercellwx.app.desktop create mode 100644 tools/net.supercellwx.app.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ad80a89f..1d9cbd1c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -129,6 +129,8 @@ jobs: wayland-protocols \ libwayland-dev \ libwayland-egl-backend-dev \ + flatpak \ + flatpak-builder \ ${{ matrix.compiler_packages }} - name: Setup Python Environment @@ -261,7 +263,8 @@ jobs: - name: Build AppImage (Linux) if: ${{ startsWith(matrix.os, 'ubuntu') }} env: - APPIMAGE_DIR: ${{ github.workspace }}/supercell-wx/ + INSTALL_DIR: ${{ github.workspace }}/supercell-wx/ + APPIMAGE_DIR: ${{ github.workspace }}/supercell-wx-appimage/ LDAI_UPDATE_INFORMATION: gh-releases-zsync|dpaulat|supercell-wx|latest|*${{ matrix.appimage_arch }}.AppImage.zsync LDAI_OUTPUT: supercell-wx-${{ env.SCWX_VERSION }}-${{ matrix.appimage_arch }}.AppImage LINUXDEPLOY_OUTPUT_APP_NAME: supercell-wx @@ -272,6 +275,7 @@ jobs: chmod +x linuxdeploy-${{ matrix.appimage_arch }}.AppImage cp "${{ github.workspace }}/source/scwx-qt/res/icons/scwx-256.png" supercell-wx.png cp "${{ github.workspace }}/source/scwx-qt/res/linux/supercell-wx.desktop" . + cp -r "${{ env.INSTALL_DIR }}" "${{ env.APPIMAGE_DIR }}" pushd "${{ env.APPIMAGE_DIR }}" mkdir -p usr/ mv bin/ usr/ @@ -289,6 +293,38 @@ jobs: name: supercell-wx-appimage-${{ matrix.artifact_suffix }} path: ${{ github.workspace }}/*-${{ matrix.appimage_arch }}.AppImage* + - name: Build FlatPak (Linux) + if: ${{ startsWith(matrix.os, 'ubuntu') }} + env: + INSTALL_DIR: ${{ github.workspace }}/supercell-wx/ + FLATPAK_DIR: ${{ github.workspace }}/supercell-wx-flatpak/ + shell: bash + run: | + cp -r ${{ env.INSTALL_DIR }} ${{ env.FLATPAK_DIR }} + # Copy krb5 libraries to flatpak + cp /usr/lib/*/libkrb5.so* \ + /usr/lib/*/libkrb5support.so* \ + /usr/lib/*/libgssapi_krb5.so* \ + /usr/lib/*/libk5crypto.so* \ + /usr/lib/*/libkeyutils.so* \ + ${{ env.FLATPAK_DIR }}/lib + + flatpak remote-add --if-not-exists --user flathub https://dl.flathub.org/repo/flathub.flatpakrepo + flatpak-builder --force-clean \ + --user \ + --install-deps-from=flathub \ + --repo=flatpak-repo \ + --install flatpak-build \ + ${{ github.workspace }}/source/tools/net.supercellwx.app.yml + flatpak build-bundle flatpak-repo supercell-wx.flatpak net.supercellwx.app + + - name: Upload FlatPak (Linux) + if: ${{ startsWith(matrix.os, 'ubuntu') }} + uses: actions/upload-artifact@v4 + with: + name: supercell-wx-flatpak-${{ matrix.artifact_suffix }} + path: ${{ github.workspace }}/supercell-wx.flatpak + - name: Test Supercell Wx working-directory: ${{ github.workspace }}/build env: diff --git a/scwx-qt/res/linux/net.supercellwx.app.desktop b/scwx-qt/res/linux/net.supercellwx.app.desktop new file mode 100644 index 00000000..8e671522 --- /dev/null +++ b/scwx-qt/res/linux/net.supercellwx.app.desktop @@ -0,0 +1,7 @@ +[Desktop Entry] +Type=Application +Name=Supercell Wx +Comment=Weather Radar and Data Viewer +Exec=supercell-wx +Icon=net.supercellwx.app.png +Categories=Network;Science; diff --git a/tools/net.supercellwx.app.yml b/tools/net.supercellwx.app.yml new file mode 100644 index 00000000..9c4c3f72 --- /dev/null +++ b/tools/net.supercellwx.app.yml @@ -0,0 +1,37 @@ +id: net.supercellwx.app +version: '0.4.9' +runtime: "org.freedesktop.Platform" +runtime-version: "23.08" +sdk: "org.freedesktop.Sdk" +command: supercell-wx +modules: + - name: supercell-wx + buildsystem: simple + build-commands: + - install -Dm644 net.supercellwx.app.desktop /app/share/applications/${FLATPAK_ID}.desktop + - install -Dm644 scwx-256.png /app/share/icons/hicolor/256x256/apps/net.supercellwx.app.png + - install -Dm644 scwx-64.png /app/share/icons/hicolor/64x64/apps/net.supercellwx.app.png + - rm net.supercellwx.app.desktop scwx-256.png scwx-64.png + - cp -r * /app/ + sources: + - type: dir + path: ../../supercell-wx-flatpak + - type: file + path: ../scwx-qt/res/linux/net.supercellwx.app.desktop + - type: file + path: ../scwx-qt/res/icons/scwx-256.png + - type: file + path: ../scwx-qt/res/icons/scwx-64.png + +finish-args: + # X11 + XShm access + - --share=ipc + - --socket=fallback-x11 + # Wayland access + - --socket=wayland + # GPU acceleration if needed + - --device=dri + # Needs to talk to the network: + - --share=network + # Needs to save files locally + - --filesystem=xdg-documents