feat(Linux): Automatically build a Flatpak bundle (#125)

Co-authored-by: PartyDonut <42371342+PartyDonut@users.noreply.github.com>
This commit is contained in:
Louis-Maxence Garret 2024-11-13 17:52:26 +01:00 committed by GitHub
parent 0ec2d10ce8
commit 523476bd08
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 292 additions and 6 deletions

View file

@ -184,7 +184,7 @@ jobs:
path: build/macos/Build/Products/Release-production/macOS.dmg path: build/macos/Build/Products/Release-production/macOS.dmg
build-linux: build-linux:
runs-on: ubuntu-latest runs-on: ubuntu-24.04 # bumped from 22.04 (latest) as it would otherwise use libmpv1
needs: [fetch-info] needs: [fetch-info]
steps: steps:
@ -206,7 +206,7 @@ jobs:
- name: Get packages - name: Get packages
run: | run: |
sudo apt-get update -y sudo apt-get update -y
sudo apt-get install -y ninja-build libgtk-3-dev libmpv-dev patchelf sudo apt-get install -y ninja-build libgtk-3-dev libmpv-dev patchelf cmake clang
- name: Build Linux app - name: Build Linux app
run: flutter build linux --release --build-number=${{ github.run_number }} run: flutter build linux --release --build-number=${{ github.run_number }}
@ -225,6 +225,36 @@ jobs:
name: fladder-linux name: fladder-linux
path: build/linux/x64/release/bundle path: build/linux/x64/release/bundle
build-linux-flatpak:
name: "Flatpak"
runs-on: ubuntu-latest
needs: [fetch-info, build-linux]
container:
image: bilelmoussaoui/flatpak-github-actions:gnome-46
options: --privileged
steps:
- name: Checkout repository
uses: actions/checkout@v4.1.1
with:
submodules: true
- name: Download Artifacts Linux
uses: actions/download-artifact@v4
with:
name: fladder-linux
path: build/linux/x64/release/bundle
- uses: flatpak/flatpak-github-actions/flatpak-builder@v6
with:
bundle: Fladder-Linux.flatpak
manifest-path: flatpak/nl.jknaapen.fladder.yaml
- name: Archive Linux Flatpak bundle
uses: actions/upload-artifact@v4
with:
name: fladder-linux-flatpak
path: Fladder-Linux.flatpak
build-web: build-web:
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs: [fetch-info] needs: [fetch-info]
@ -278,7 +308,15 @@ jobs:
create_release: create_release:
name: Create Release name: Create Release
needs: [fetch-info,build-android,build-windows,build-ios,build-macos,build-linux,build-web] needs:
- fetch-info
- build-android
- build-windows
- build-ios
- build-macos
- build-linux
- build-linux-flatpak
- build-web
runs-on: ubuntu-latest runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v') if: startsWith(github.ref, 'refs/tags/v')
steps: steps:
@ -333,6 +371,15 @@ jobs:
cd fladder-linux cd fladder-linux
zip -r ../Fladder-Linux-${{needs.fetch-info.outputs.version_name}}.zip . zip -r ../Fladder-Linux-${{needs.fetch-info.outputs.version_name}}.zip .
- name: Download Artifacts Linux Flatpak
uses: actions/download-artifact@v4
with:
name: fladder-linux-flatpak
path: fladder-linux-flatpak
- name: Move Linux Flatpak
run: mv fladder-linux-flatpak/Fladder-Linux.flatpak Fladder-Linux-${{needs.fetch-info.outputs.version_name}}.flatpak
- name: Download Artifacts Web - name: Download Artifacts Web
uses: actions/download-artifact@v4 uses: actions/download-artifact@v4
with: with:
@ -355,7 +402,8 @@ jobs:
Fladder-Windows-${{needs.fetch-info.outputs.version_name}}.zip Fladder-Windows-${{needs.fetch-info.outputs.version_name}}.zip
Fladder-iOS-${{needs.fetch-info.outputs.version_name}}.ipa Fladder-iOS-${{needs.fetch-info.outputs.version_name}}.ipa
Fladder-macOS-${{needs.fetch-info.outputs.version_name}}.dmg Fladder-macOS-${{needs.fetch-info.outputs.version_name}}.dmg
Fladder-Linux-${{needs.fetch-info.outputs.version_name}}.zip
Fladder-Web-${{needs.fetch-info.outputs.version_name}}.zip Fladder-Web-${{needs.fetch-info.outputs.version_name}}.zip
Fladder-Linux-${{needs.fetch-info.outputs.version_name}}.zip
Fladder-Linux-${{needs.fetch-info.outputs.version_name}}.flatpak

6
.gitignore vendored
View file

@ -46,6 +46,10 @@ app.*.map.json
# FVM Version Cache # FVM Version Cache
.fvm/ .fvm/
# flatpak
.flatpak-builder
# Affinity lock # Affinity lock
*.afdesign~lock~ *.afdesign~lock~
*.afphoto~lock~ *.afphoto~lock~

3
.gitmodules vendored Normal file
View file

@ -0,0 +1,3 @@
[submodule "shared-modules"]
path = flatpak/shared-modules
url = https://github.com/flathub/shared-modules.git

9
flatpak/Fladder.desktop Normal file
View file

@ -0,0 +1,9 @@
[Desktop Entry]
Name=Fladder
StartupWMClass=nl.jknaapen.fladder
Comment=A Simple Jellyfin Frontend built on top of Flutter.
Exec=Fladder
Icon=nl.jknaapen.fladder
Terminal=false
Type=Application
Categories=Entertainment;

View file

@ -0,0 +1,218 @@
id: nl.jknaapen.fladder
runtime: org.gnome.Platform
runtime-version: '46'
sdk: org.gnome.Sdk
command: Fladder
finish-args:
# X11/Wayland access
- --share=ipc
- --socket=fallback-x11
- --socket=wayland
# Audio playback
- --socket=pulseaudio
# Network access for Jellyfin streaming
- --share=network
# File access for downloads/media
- --filesystem=home
# Allow access to PipeWire socket for mpv
- --filesystem=xdg-run/pipewire-0:ro
# Hardware acceleration
- --device=dri
# Allow notification access
- --talk-name=org.freedesktop.Notifications
- --talk-name=org.freedesktop.PowerManagement
- --talk-name=org.freedesktop.ScreenSaver
- --talk-name=org.freedesktop.portal.*
modules:
- name: mpv
buildsystem: meson
config-opts:
- -Dlibmpv=true
- -Dcplayer=false
- -Dbuild-date=false
- -Dmanpage-build=disabled
- -Dvaapi=enabled
- -Dcuda-hwaccel=enabled
- -Dpulse=enabled
- -Dalsa=enabled
- -Duchardet=enabled
cleanup:
- /lib/pkgconfig
- /share
- /include
sources:
- type: git
url: https://github.com/mpv-player/mpv.git
tag: v0.39.0
commit: a0fba7be57f3822d967b04f0f6b6d6341e7516e7
x-checker-data:
type: git
tag-pattern: ^v([\d.]+)$
modules:
- name: ffnvcodec
buildsystem: simple
build-commands:
- make install PREFIX=/app
cleanup:
- /lib/pkgconfig
- /include
sources:
- type: git
url: https://github.com/FFmpeg/nv-codec-headers.git
tag: n12.2.72.0
commit: c69278340ab1d5559c7d7bf0edf615dc33ddbba7
x-checker-data:
type: git
tag-pattern: ^n([\d.]+)$
- name: ffmpeg
config-opts:
- --enable-shared
- --disable-static
- --enable-gnutls
- --enable-pic
- --disable-doc
- --disable-programs
- --disable-encoders
- --disable-muxers
- --disable-devices
- --enable-vaapi
- --enable-cuvid
- --enable-libdav1d
- --enable-gpl
cleanup:
- /lib/pkgconfig
- /share
- /include
sources:
- type: git
url: https://github.com/FFmpeg/FFmpeg.git
tag: n7.1
commit: b08d7969c550a804a59511c7b83f2dd8cc0499b8
x-checker-data:
type: git
tag-pattern: ^n([\d.]+)$
- shared-modules/luajit/luajit.json
- name: libass
config-opts:
- --enable-shared
- --disable-static
cleanup:
- /lib/*.la
- /lib/pkgconfig
- /include
sources:
- type: git
url: https://github.com/libass/libass.git
tag: 0.17.3
commit: e46aedea0a0d17da4c4ef49d84b94a7994664ab5
x-checker-data:
type: git
tag-pattern: ^([\d.]+)$
- name: uchardet
buildsystem: cmake-ninja
config-opts:
- -DCMAKE_BUILD_TYPE=Release
- -DCMAKE_INSTALL_LIBDIR=lib
- -DBUILD_BINARY=OFF
cleanup:
- /lib/*.a
- /lib/pkgconfig
- /share
- /include
sources:
- type: archive
url: https://www.freedesktop.org/software/uchardet/releases/uchardet-0.0.8.tar.xz
sha256: e97a60cfc00a1c147a674b097bb1422abd9fa78a2d9ce3f3fdcc2e78a34ac5f0
x-checker-data:
type: html
url: https://www.freedesktop.org/software/uchardet/releases/
version-pattern: uchardet-(\d+\.\d+\.\d+)\.tar\.xz
url-template: https://www.freedesktop.org/software/uchardet/releases/uchardet-$version.tar.xz
- name: libplacebo
buildsystem: meson
config-opts:
- -Dvulkan=enabled
- -Dshaderc=enabled
cleanup:
- /include
- /lib/pkgconfig
sources:
- type: git
url: https://code.videolan.org/videolan/libplacebo.git
tag: v7.349.0
commit: 1fd3c7bde7b943fe8985c893310b5269a09b46c5
x-checker-data:
type: git
tag-pattern: ^v([\d.]+)$
modules:
- name: shaderc
buildsystem: cmake-ninja
builddir: true
config-opts:
- -DSHADERC_SKIP_COPYRIGHT_CHECK=ON
- -DSHADERC_SKIP_EXAMPLES=ON
- -DSHADERC_SKIP_TESTS=ON
- -DSPIRV_SKIP_EXECUTABLES=ON
- -DENABLE_GLSLANG_BINARIES=OFF
- -DCMAKE_BUILD_TYPE=Release
cleanup:
- /bin
- /include
- /lib/*.a
- /lib/cmake
- /lib/pkgconfig
sources:
- type: git
url: https://github.com/google/shaderc.git
tag: v2024.2
commit: 3ac03b8ad85a8e328a6182cddee8d05810bd5a2c
x-checker-data:
type: git
tag-pattern: ^v([\d.]+)$
- type: git
url: https://github.com/KhronosGroup/SPIRV-Tools.git
tag: v2023.2
commit: 44d72a9b36702f093dd20815561a56778b2d181e
dest: third_party/spirv-tools
- type: git
url: https://github.com/KhronosGroup/SPIRV-Headers.git
tag: sdk-1.3.250.1
commit: 268a061764ee69f09a477a695bf6a11ffe311b8d
dest: third_party/spirv-headers
- type: git
url: https://github.com/KhronosGroup/glslang.git
tag: 14.3.0
commit: fa9c3deb49e035a8abcabe366f26aac010f6cbfb
dest: third_party/glslang
x-checker-data:
type: git
tag-pattern: ^([\d.]+)$
- name: zenity
buildsystem: meson
sources:
- type: git
url: https://gitlab.gnome.org/GNOME/zenity.git
tag: 4.0.3
commit: 7f7ac1840cfd914dfac69d947f0849dc50b0f695
- name: fladder
buildsystem: simple
build-commands:
- mkdir -p /app/bin
- cp -r build/linux/x64/release/bundle/* /app/bin/
- chmod +x /app/bin/Fladder
- mkdir -p /app/share/applications
- mkdir -p /app/share/icons/hicolor/scalable/apps
- install -Dm644 flatpak/Fladder.desktop /app/share/applications/${FLATPAK_ID}.desktop
- install -Dm644 icons/fladder_icon.svg /app/share/icons/hicolor/scalable/apps/${FLATPAK_ID}.svg
sources:
- type: dir
path: ..

@ -0,0 +1 @@
Subproject commit 0529b121864669aa14fac1c67b5684a4bc6542b8

View file

@ -27,7 +27,7 @@ class SimpleVideoPlayer extends ConsumerStatefulWidget {
class _SimpleVideoPlayerState extends ConsumerState<SimpleVideoPlayer> with WindowListener, WidgetsBindingObserver { class _SimpleVideoPlayerState extends ConsumerState<SimpleVideoPlayer> with WindowListener, WidgetsBindingObserver {
final Player player = Player( final Player player = Player(
configuration: const PlayerConfiguration(libass: true), configuration: const PlayerConfiguration(title: "nl.jknaapen.fladder", libass: true),
); );
late VideoController controller = VideoController(player); late VideoController controller = VideoController(player);
late String videoUrl = ""; late String videoUrl = "";

View file

@ -48,6 +48,7 @@ class MediaControlsWrapper extends MediaPlayback implements MediaControlBase {
final newPlayer = Player( final newPlayer = Player(
configuration: PlayerConfiguration( configuration: PlayerConfiguration(
title: "nl.jknaapen.fladder",
bufferSize: 64 * 1024 * 1024, bufferSize: 64 * 1024 * 1024,
libassAndroidFont: 'assets/fonts/mp-font.ttf', libassAndroidFont: 'assets/fonts/mp-font.ttf',
libass: !kIsWeb && libass: !kIsWeb &&

View file

@ -41,6 +41,7 @@ class MediaControlsWrapper extends MediaPlayback implements MediaControlBase {
final newPlayer = Player( final newPlayer = Player(
configuration: PlayerConfiguration( configuration: PlayerConfiguration(
title: "nl.jknaapen.fladder",
bufferSize: 64 * 1024 * 1024, bufferSize: 64 * 1024 * 1024,
libassAndroidFont: 'assets/fonts/mp-font.ttf', libassAndroidFont: 'assets/fonts/mp-font.ttf',
libass: ref.read( libass: ref.read(

View file

@ -109,6 +109,7 @@ static void my_application_init(MyApplication *self) {}
MyApplication *my_application_new() MyApplication *my_application_new()
{ {
g_set_prgname(APPLICATION_ID);
return MY_APPLICATION(g_object_new(my_application_get_type(), return MY_APPLICATION(g_object_new(my_application_get_type(),
"application-id", APPLICATION_ID, "application-id", APPLICATION_ID,
"flags", G_APPLICATION_NON_UNIQUE, "flags", G_APPLICATION_NON_UNIQUE,