From be37a3af8eb7b62949a4f9f5dcf9a95090b3654c Mon Sep 17 00:00:00 2001 From: Dexter Reed Date: Sat, 22 Jun 2024 16:24:57 +0100 Subject: [PATCH] flatpak: Use JSON, add X11 and SDL3 manifests I have chosen to use JSON and move the script into a file so it is possible to use GNOME Builder to test/run. The reason for the gitignore change is so the ClassiCubeLauncher file is not ignored. Also, ClassiCube using SDL3 launches on GNOME now. --- .gitignore | 3 + misc/linux/flatpak/ClassiCubeLauncher | 3 + .../net.classicube.flatpak.client.SDL3.json | 78 +++++++++++++++++++ .../net.classicube.flatpak.client.X11.json | 34 ++++++++ .../flatpak/net.classicube.flatpak.client.yml | 29 ------- 5 files changed, 118 insertions(+), 29 deletions(-) create mode 100644 misc/linux/flatpak/ClassiCubeLauncher create mode 100644 misc/linux/flatpak/net.classicube.flatpak.client.SDL3.json create mode 100644 misc/linux/flatpak/net.classicube.flatpak.client.X11.json delete mode 100644 misc/linux/flatpak/net.classicube.flatpak.client.yml diff --git a/.gitignore b/.gitignore index 988066e31..3e903a1a6 100644 --- a/.gitignore +++ b/.gitignore @@ -95,6 +95,9 @@ fontscache.txt # Android source files need to be included !android/app/src/main/java/com/classicube +# Flatpak wrapper which needs to be included +!misc/linux/flatpak/ClassiCubeLauncher + # CMake files CMakeFiles/ CMakeCache.txt diff --git a/misc/linux/flatpak/ClassiCubeLauncher b/misc/linux/flatpak/ClassiCubeLauncher new file mode 100644 index 000000000..104e37ac2 --- /dev/null +++ b/misc/linux/flatpak/ClassiCubeLauncher @@ -0,0 +1,3 @@ +#!/bin/sh +mkdir -p ${XDG_DATA_HOME}/ClassiCube +cd ${XDG_DATA_HOME}/ClassiCube && exec ClassiCube $@ \ No newline at end of file diff --git a/misc/linux/flatpak/net.classicube.flatpak.client.SDL3.json b/misc/linux/flatpak/net.classicube.flatpak.client.SDL3.json new file mode 100644 index 000000000..5c75fad61 --- /dev/null +++ b/misc/linux/flatpak/net.classicube.flatpak.client.SDL3.json @@ -0,0 +1,78 @@ +{ + "id": "net.classicube.flatpak.client", + "runtime": "org.freedesktop.Platform", + "runtime-version": "23.08", + "sdk": "org.freedesktop.Sdk", + "command": "ClassiCubeLauncher", + "finish-args": [ + "--socket=wayland", + "--socket=fallback-x11", + "--device=dri", + "--share=network", + "--share=ipc", + "--socket=pulseaudio" + ], + "modules": [ + { + "name": "SDL3", + "buildsystem": "cmake-ninja", + "builddir": true, + "sources": [ + { + "type": "git", + "url": "https://github.com/libsdl-org/SDL.git", + "branch": "main" + } + ], + "cleanup": [ + "/bin/sdl3-config", + "/include", + "/lib/libSDL3.la", + "/lib/libSDL3main.a", + "/lib/libSDL3main.la", + "/lib/libSDL3_test.a", + "/lib/libSDL3_test.la", + "/lib/cmake", + "/share/aclocal", + "/lib/pkgconfig" + ], + "modules": [ + { + "name": "libdecor", + "buildsystem": "meson", + "config-opts": [ + "-Ddemo=false" + ], + "sources": [ + { + "type": "git", + "url": "https://gitlab.freedesktop.org/libdecor/libdecor.git" + } + ], + "cleanup": [ + "/include", + "/lib/pkgconfig" + ] + } + ] + }, + { + "name": "ClassiCube", + "buildsystem": "simple", + "build-commands": [ + "gcc -fno-math-errno src/*.c -o src/ClassiCube -rdynamic -lpthread -lGL -DCC_WIN_BACKEND=CC_WIN_BACKEND_SDL3 -DCC_GFX_BACKEND=CC_GFX_BACKEND_GL2 -DCC_BUILD_FLATPAK -L /app/lib -lSDL3", + "install -Dm755 src/ClassiCube -t ${FLATPAK_DEST}/bin", + "install -Dm755 misc/linux/flatpak/ClassiCubeLauncher -t ${FLATPAK_DEST}/bin", + "install -Dm644 misc/linux/flatpak/net.classicube.flatpak.client.svg ${FLATPAK_DEST}/share/icons/hicolor/scalable/apps/net.classicube.flatpak.client.svg", + "install -Dm644 misc/linux/flatpak/net.classicube.flatpak.client.desktop ${FLATPAK_DEST}/share/applications/net.classicube.flatpak.client.desktop", + "install -Dm644 misc/linux/flatpak/net.classicube.flatpak.client.metainfo.xml ${FLATPAK_DEST}/share/metainfo/net.classicube.flatpak.client.metainfo.xml" + ], + "sources": [ + { + "type": "git", + "url": "https://github.com/ClassiCube/ClassiCube.git" + } + ] + } + ] +} \ No newline at end of file diff --git a/misc/linux/flatpak/net.classicube.flatpak.client.X11.json b/misc/linux/flatpak/net.classicube.flatpak.client.X11.json new file mode 100644 index 000000000..e064afac8 --- /dev/null +++ b/misc/linux/flatpak/net.classicube.flatpak.client.X11.json @@ -0,0 +1,34 @@ +{ + "id": "net.classicube.flatpak.client", + "runtime": "org.freedesktop.Platform", + "runtime-version": "23.08", + "sdk": "org.freedesktop.Sdk", + "command": "ClassiCubeLauncher", + "finish-args": [ + "--socket=x11", + "--device=dri", + "--share=network", + "--share=ipc", + "--socket=pulseaudio" + ], + "modules": [ + { + "name": "ClassiCube", + "buildsystem": "simple", + "build-commands": [ + "gcc -fno-math-errno src/*.c -o src/ClassiCube -O1 -DCC_BUILD_FLATPAK -DCC_GFX_BACKEND=CC_GFX_BACKEND_GL2 -rdynamic -lm -lpthread -lX11 -lXi -lGL -ldl", + "install -Dm755 src/ClassiCube -t ${FLATPAK_DEST}/bin", + "install -Dm755 misc/linux/flatpak/ClassiCubeLauncher -t ${FLATPAK_DEST}/bin", + "install -Dm644 misc/linux/flatpak/net.classicube.flatpak.client.svg ${FLATPAK_DEST}/share/icons/hicolor/scalable/apps/net.classicube.flatpak.client.svg", + "install -Dm644 misc/linux/flatpak/net.classicube.flatpak.client.desktop ${FLATPAK_DEST}/share/applications/net.classicube.flatpak.client.desktop", + "install -Dm644 misc/linux/flatpak/net.classicube.flatpak.client.metainfo.xml ${FLATPAK_DEST}/share/metainfo/net.classicube.flatpak.client.metainfo.xml" + ], + "sources": [ + { + "type": "git", + "url": "https://github.com/ClassiCube/ClassiCube.git" + } + ] + } + ] +} \ No newline at end of file diff --git a/misc/linux/flatpak/net.classicube.flatpak.client.yml b/misc/linux/flatpak/net.classicube.flatpak.client.yml deleted file mode 100644 index 760e8b9d2..000000000 --- a/misc/linux/flatpak/net.classicube.flatpak.client.yml +++ /dev/null @@ -1,29 +0,0 @@ -id: net.classicube.flatpak.client -runtime: org.freedesktop.Platform -runtime-version: '23.08' -sdk: org.freedesktop.Sdk -command: ClassiCubeLauncher -finish-args: - - --socket=x11 - - --device=dri - - --share=network - - --share=ipc - - --socket=pulseaudio -modules: - - name: ClassiCube - buildsystem: simple - build-commands: - - gcc -fno-math-errno src/*.c -o src/ClassiCube -O1 -DCC_BUILD_FLATPAK -DCC_BUILD_GLMODERN -rdynamic -lm -lpthread -lX11 -lXi -lGL -ldl - - install -Dm755 src/ClassiCube -t ${FLATPAK_DEST}/bin - - install -Dm755 ClassiCubeLauncher -t ${FLATPAK_DEST}/bin - - install -Dm644 misc/linux/flatpak/net.classicube.flatpak.client.svg ${FLATPAK_DEST}/share/icons/hicolor/scalable/apps/net.classicube.flatpak.client.svg - - install -Dm644 misc/linux/flatpak/net.classicube.flatpak.client.desktop ${FLATPAK_DEST}/share/applications/net.classicube.flatpak.client.desktop - - install -Dm644 misc/linux/flatpak/net.classicube.flatpak.client.metainfo.xml ${FLATPAK_DEST}/share/metainfo/net.classicube.flatpak.client.metainfo.xml - sources: - - type: dir - path: ../../../ - - type: script - dest-filename: ClassiCubeLauncher - commands: - - mkdir -p ${XDG_DATA_HOME}/ClassiCube - - cd ${XDG_DATA_HOME}/ClassiCube && exec /app/bin/ClassiCube "$@"