mirror of
https://github.com/ciphervance/supercell-wx.git
synced 2025-10-30 06:10:04 +00:00
Merge pull request #460 from AdenKoperczak/flatpak_build
Add a Flatpak Builld
This commit is contained in:
commit
fbacb7dc13
4 changed files with 91 additions and 1 deletions
38
.github/workflows/ci.yml
vendored
38
.github/workflows/ci.yml
vendored
|
|
@ -129,6 +129,8 @@ jobs:
|
||||||
wayland-protocols \
|
wayland-protocols \
|
||||||
libwayland-dev \
|
libwayland-dev \
|
||||||
libwayland-egl-backend-dev \
|
libwayland-egl-backend-dev \
|
||||||
|
flatpak \
|
||||||
|
flatpak-builder \
|
||||||
${{ matrix.compiler_packages }}
|
${{ matrix.compiler_packages }}
|
||||||
|
|
||||||
- name: Setup Python Environment
|
- name: Setup Python Environment
|
||||||
|
|
@ -261,7 +263,8 @@ jobs:
|
||||||
- name: Build AppImage (Linux)
|
- name: Build AppImage (Linux)
|
||||||
if: ${{ startsWith(matrix.os, 'ubuntu') }}
|
if: ${{ startsWith(matrix.os, 'ubuntu') }}
|
||||||
env:
|
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_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
|
LDAI_OUTPUT: supercell-wx-${{ env.SCWX_VERSION }}-${{ matrix.appimage_arch }}.AppImage
|
||||||
LINUXDEPLOY_OUTPUT_APP_NAME: supercell-wx
|
LINUXDEPLOY_OUTPUT_APP_NAME: supercell-wx
|
||||||
|
|
@ -272,6 +275,7 @@ jobs:
|
||||||
chmod +x linuxdeploy-${{ matrix.appimage_arch }}.AppImage
|
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/icons/scwx-256.png" supercell-wx.png
|
||||||
cp "${{ github.workspace }}/source/scwx-qt/res/linux/supercell-wx.desktop" .
|
cp "${{ github.workspace }}/source/scwx-qt/res/linux/supercell-wx.desktop" .
|
||||||
|
cp -r "${{ env.INSTALL_DIR }}" "${{ env.APPIMAGE_DIR }}"
|
||||||
pushd "${{ env.APPIMAGE_DIR }}"
|
pushd "${{ env.APPIMAGE_DIR }}"
|
||||||
mkdir -p usr/
|
mkdir -p usr/
|
||||||
mv bin/ usr/
|
mv bin/ usr/
|
||||||
|
|
@ -289,6 +293,38 @@ jobs:
|
||||||
name: supercell-wx-appimage-${{ matrix.artifact_suffix }}
|
name: supercell-wx-appimage-${{ matrix.artifact_suffix }}
|
||||||
path: ${{ github.workspace }}/*-${{ matrix.appimage_arch }}.AppImage*
|
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
|
- name: Test Supercell Wx
|
||||||
working-directory: ${{ github.workspace }}/build
|
working-directory: ${{ github.workspace }}/build
|
||||||
env:
|
env:
|
||||||
|
|
|
||||||
7
scwx-qt/res/linux/net.supercellwx.app.desktop
Normal file
7
scwx-qt/res/linux/net.supercellwx.app.desktop
Normal file
|
|
@ -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;
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
#include <scwx/qt/manager/log_manager.hpp>
|
#include <scwx/qt/manager/log_manager.hpp>
|
||||||
#include <scwx/util/logger.hpp>
|
#include <scwx/util/logger.hpp>
|
||||||
|
|
||||||
|
#include <cstdlib>
|
||||||
|
#include <ctime>
|
||||||
#include <filesystem>
|
#include <filesystem>
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <ranges>
|
#include <ranges>
|
||||||
|
|
@ -57,6 +59,14 @@ void LogManager::InitializeLogFile()
|
||||||
QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation)
|
QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation)
|
||||||
.toStdString();
|
.toStdString();
|
||||||
p->pid_ = boost::this_process::get_id();
|
p->pid_ = boost::this_process::get_id();
|
||||||
|
if (p->pid_ == 2)
|
||||||
|
{
|
||||||
|
// The pid == 2 means that this is likely a flatpak. We assign a random
|
||||||
|
// number in this case to avoid overlap, scince it is always 2 in a
|
||||||
|
// flatpak
|
||||||
|
std::srand(std::time({}));
|
||||||
|
p->pid_ = std::rand();
|
||||||
|
}
|
||||||
p->logFile_ = fmt::format("{}/supercell-wx.{}.log", p->logPath_, p->pid_);
|
p->logFile_ = fmt::format("{}/supercell-wx.{}.log", p->logPath_, p->pid_);
|
||||||
|
|
||||||
// Create log directory if it doesn't exist
|
// Create log directory if it doesn't exist
|
||||||
|
|
|
||||||
37
tools/net.supercellwx.app.yml
Normal file
37
tools/net.supercellwx.app.yml
Normal file
|
|
@ -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=all
|
||||||
|
# Needs to talk to the network:
|
||||||
|
- --share=network
|
||||||
|
# Needs to save files locally
|
||||||
|
- --filesystem=xdg-documents
|
||||||
Loading…
Add table
Add a link
Reference in a new issue