mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-08-04 16:32:39 +00:00
feat:[#272] add flatpak packaging
- add flatpak manifest - add build dirs to gitignore - add flatpak build workflow job - add update support for flatpak package Co-authored-by: Quang Ngô <ngoquang2708@users.noreply.github.com>
This commit is contained in:
parent
fe389e560a
commit
a7ed259f01
23
.github/workflows/build.yml
vendored
23
.github/workflows/build.yml
vendored
@ -384,9 +384,30 @@ jobs:
|
|||||||
name: shadps4-linux-qt-${{ needs.get-info.outputs.date }}-${{ needs.get-info.outputs.shorthash }}
|
name: shadps4-linux-qt-${{ needs.get-info.outputs.date }}-${{ needs.get-info.outputs.shorthash }}
|
||||||
path: Shadps4-qt.AppImage
|
path: Shadps4-qt.AppImage
|
||||||
|
|
||||||
|
linux-flatpak:
|
||||||
|
runs-on: ubuntu-24.04
|
||||||
|
needs: get-info
|
||||||
|
container:
|
||||||
|
image: bilelmoussaoui/flatpak-github-actions:kde-6.7
|
||||||
|
options: --privileged
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
submodules: recursive
|
||||||
|
- uses: flatpak/flatpak-github-actions/flatpak-builder@master
|
||||||
|
with:
|
||||||
|
manifest-path: net.shadps4.shadPS4.yaml
|
||||||
|
cache-key: flatpak-builder-${{ github.sha }}
|
||||||
|
bundle: shadps4.flatpak
|
||||||
|
upload-artifact: false
|
||||||
|
- uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
path: shadps4.flatpak
|
||||||
|
name: shadps4-linux-flatpak-${{ needs.get-info.outputs.date }}-${{ needs.get-info.outputs.shorthash }}
|
||||||
|
|
||||||
pre-release:
|
pre-release:
|
||||||
if: github.ref == 'refs/heads/main' && github.repository == 'shadps4-emu/shadPS4' && github.event_name == 'push'
|
if: github.ref == 'refs/heads/main' && github.repository == 'shadps4-emu/shadPS4' && github.event_name == 'push'
|
||||||
needs: [get-info, windows-sdl, windows-qt, macos-sdl, macos-qt, linux-sdl, linux-qt]
|
needs: [get-info, windows-sdl, windows-qt, macos-sdl, macos-qt, linux-sdl, linux-qt, linux-flatpak]
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Download all artifacts
|
- name: Download all artifacts
|
||||||
|
6
.gitignore
vendored
6
.gitignore
vendored
@ -414,3 +414,9 @@ FodyWeavers.xsd
|
|||||||
|
|
||||||
# for macOS
|
# for macOS
|
||||||
**/.DS_Store
|
**/.DS_Store
|
||||||
|
|
||||||
|
# flatpak build
|
||||||
|
builddir
|
||||||
|
.flatpak-builder
|
||||||
|
repo
|
||||||
|
*.flatpak
|
||||||
|
68
net.shadps4.shadPS4.yaml
Normal file
68
net.shadps4.shadPS4.yaml
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
# SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||||
|
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
|
id: net.shadps4.shadPS4
|
||||||
|
runtime: org.kde.Platform
|
||||||
|
runtime-version: '6.8'
|
||||||
|
sdk: org.kde.Sdk
|
||||||
|
command: shadps4
|
||||||
|
rename-icon: shadps4
|
||||||
|
rename-desktop-file: shadps4.desktop
|
||||||
|
rename-appdata-file: shadps4.metainfo.xml
|
||||||
|
separate-locales: false
|
||||||
|
finish-args:
|
||||||
|
- --share=network
|
||||||
|
- --socket=pulseaudio
|
||||||
|
- --socket=wayland
|
||||||
|
- --socket=fallback-x11
|
||||||
|
- --allow=bluetooth
|
||||||
|
- --filesystem=home
|
||||||
|
- --device=dri
|
||||||
|
- --device=input
|
||||||
|
- --filesystem=/media
|
||||||
|
- --filesystem=/run/media
|
||||||
|
- --talk-name=org.kde.StatusNotifierWatcher
|
||||||
|
add-extensions:
|
||||||
|
org.freedesktop.Platform.ffmpeg-full:
|
||||||
|
directory: lib/ffmpeg
|
||||||
|
add-ld-path: .
|
||||||
|
version: '24.08'
|
||||||
|
autodownload: true
|
||||||
|
autodelete: false
|
||||||
|
cleanup-commands:
|
||||||
|
- mkdir -p ${FLATPAK_DEST}/lib/ffmpeg
|
||||||
|
modules:
|
||||||
|
- name: rapidjson
|
||||||
|
buildsystem: cmake
|
||||||
|
config-opts:
|
||||||
|
- -DRAPIDJSON_BUILD_CXX11=OFF
|
||||||
|
- -DRAPIDJSON_BUILD_TESTS=OFF
|
||||||
|
sources:
|
||||||
|
- type: git
|
||||||
|
url: https://github.com/Tencent/rapidjson.git
|
||||||
|
commit: 858451e5b7d1c56cf8f6d58f88cf958351837e53
|
||||||
|
cleanup:
|
||||||
|
- '*'
|
||||||
|
- name: libfmt
|
||||||
|
buildsystem: cmake
|
||||||
|
config-opts:
|
||||||
|
- -DFMT_TEST=OFF
|
||||||
|
sources:
|
||||||
|
- type: git
|
||||||
|
url: https://github.com/fmtlib/fmt.git
|
||||||
|
commit: 56ce41ef6368dfbe7d6aefe19d20365bd601a3b0
|
||||||
|
cleanup:
|
||||||
|
- '*'
|
||||||
|
- name: shadPS4
|
||||||
|
buildsystem: cmake
|
||||||
|
builddir: true
|
||||||
|
config-opts:
|
||||||
|
- -DCMAKE_BUILD_TYPE=Release
|
||||||
|
- -DENABLE_QT_GUI=ON
|
||||||
|
build-options:
|
||||||
|
env:
|
||||||
|
CMAKE_C_COMPILER: clang
|
||||||
|
CMAKE_CXX_COMPILER: clang++
|
||||||
|
sources:
|
||||||
|
- type: dir
|
||||||
|
path: .
|
@ -91,7 +91,11 @@ void CheckUpdate::CheckForUpdates(const bool showMessage) {
|
|||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
platformString = "win64-qt";
|
platformString = "win64-qt";
|
||||||
#elif defined(Q_OS_LINUX)
|
#elif defined(Q_OS_LINUX)
|
||||||
platformString = "linux-qt";
|
if (std::getenv("container")) {
|
||||||
|
platformString = "linux-flatpak";
|
||||||
|
} else if (std::getenv("APPIMAGE")) {
|
||||||
|
platformString = "linux-qt";
|
||||||
|
}
|
||||||
#elif defined(Q_OS_MAC)
|
#elif defined(Q_OS_MAC)
|
||||||
platformString = "macos-qt";
|
platformString = "macos-qt";
|
||||||
#endif
|
#endif
|
||||||
@ -462,23 +466,53 @@ void CheckUpdate::Install() {
|
|||||||
" exit 1\n"
|
" exit 1\n"
|
||||||
" fi\n"
|
" fi\n"
|
||||||
"}\n"
|
"}\n"
|
||||||
|
"set_package_type() {\n"
|
||||||
|
" if pgrep -f \"Shadps4-qt.AppImage\" > /dev/null; then\n"
|
||||||
|
" TYPE=\"appimage\"\n"
|
||||||
|
" else\n"
|
||||||
|
" TYPE=\"flatpak\"\n"
|
||||||
|
" fi\n"
|
||||||
|
"}\n"
|
||||||
|
"kill_process() {\n"
|
||||||
|
" if [ \"$TYPE\" == \"appimage\" ]; then\n"
|
||||||
|
" pkill -f \"Shadps4-qt.AppImage\"\n"
|
||||||
|
" sleep 2\n"
|
||||||
|
" else\n"
|
||||||
|
" pkill -f \"Shadps4\"\n"
|
||||||
|
" sleep 2\n"
|
||||||
|
" fi\n"
|
||||||
|
"}\n"
|
||||||
|
"update_package() {\n"
|
||||||
|
" if [ \"$TYPE\" == \"appimage\" ]; then\n"
|
||||||
|
" cp -r \"$1/\"* \"$2/\"\n"
|
||||||
|
" chmod +x \"$2/Shadps4-qt.AppImage\"\n"
|
||||||
|
" else\n"
|
||||||
|
" flatpak install -u \"$2/shadps4.flatpak\"\n"
|
||||||
|
" fi\n"
|
||||||
|
"}\n"
|
||||||
|
"restart_app() {\n"
|
||||||
|
" if [ \"$TYPE\" == \"appimage\" ]; then\n"
|
||||||
|
" cd \"$1\" && ./Shadps4-qt.AppImage\n"
|
||||||
|
" else\n"
|
||||||
|
" flatpak run -u net.shadps4.shadPS4\n"
|
||||||
|
" fi\n"
|
||||||
|
"}\n"
|
||||||
"main() {\n"
|
"main() {\n"
|
||||||
" check_unzip\n"
|
" check_unzip\n"
|
||||||
" echo \"%1\"\n"
|
" echo \"%1\"\n"
|
||||||
" sleep 2\n"
|
" sleep 2\n"
|
||||||
" extract_file\n"
|
" extract_file\n"
|
||||||
" sleep 2\n"
|
" sleep 2\n"
|
||||||
" if pgrep -f \"Shadps4-qt.AppImage\" > /dev/null; then\n"
|
" set_package_type\n"
|
||||||
" pkill -f \"Shadps4-qt.AppImage\"\n"
|
|
||||||
" sleep 2\n"
|
|
||||||
" fi\n"
|
|
||||||
" cp -r \"%2/\"* \"%3/\"\n"
|
|
||||||
" sleep 2\n"
|
" sleep 2\n"
|
||||||
|
" kill_process\n"
|
||||||
|
" sleep 2\n"
|
||||||
|
" update_package \"%2\" \"%3\"\n"
|
||||||
|
" sleep 2\n"
|
||||||
|
" restart_app \"%3\"\n"
|
||||||
" rm \"%3/update.sh\"\n"
|
" rm \"%3/update.sh\"\n"
|
||||||
" rm \"%3/temp_download_update.zip\"\n"
|
" rm \"%3/temp_download_update.zip\"\n"
|
||||||
" chmod +x \"%3/Shadps4-qt.AppImage\"\n"
|
|
||||||
" rm -r \"%2\"\n"
|
" rm -r \"%2\"\n"
|
||||||
" cd \"%3\" && ./Shadps4-qt.AppImage\n"
|
|
||||||
"}\n"
|
"}\n"
|
||||||
"main\n");
|
"main\n");
|
||||||
arguments << scriptFileName;
|
arguments << scriptFileName;
|
||||||
|
Loading…
Reference in New Issue
Block a user