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.
This commit is contained in:
Dexter Reed 2024-06-22 16:24:57 +01:00
parent 8b05ee6ace
commit be37a3af8e
No known key found for this signature in database
GPG Key ID: A107897231BE5854
5 changed files with 118 additions and 29 deletions

3
.gitignore vendored
View File

@ -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

View File

@ -0,0 +1,3 @@
#!/bin/sh
mkdir -p ${XDG_DATA_HOME}/ClassiCube
cd ${XDG_DATA_HOME}/ClassiCube && exec ClassiCube $@

View File

@ -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"
}
]
}
]
}

View File

@ -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"
}
]
}
]
}

View File

@ -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 "$@"