flatpak support - Enhancement
Flatpak is a software utility for software deployment, package management, and application virtualization for Linux desktop computers.
https://flatpak.org/
It provides a sandbox environment in which users can run applications in isolation from the rest of the system.
Is this "Flatpak" similar to "Snap"? A Princed user called "popey" posted a Snap package here: http://forum.princed.org/viewtopic.php?p=23242#p23242
yes https://en.wikipedia.org/wiki/Flatpak
Here's a preliminary Flatpak manifest:
app-id: com.github.nagyd.SDLPoP
runtime: org.freedesktop.Sdk
runtime-version: 1.6
sdk: org.freedesktop.Sdk
command: prince.sh
rename-icon: icon
finish-args:
- --socket=wayland
- --socket=x11
- --share=ipc
- --device=dri
- --socket=pulseaudio
cleanup:
- /app/include
modules:
- shared-modules/glu/glu-9.0.0.json
- shared-modules/udev/udev-175.json
- name: sdl2
sources:
- type: archive
url: https://www.libsdl.org/release/SDL2-2.0.8.tar.gz
sha256: edc77c57308661d576e843344d8638e025a7818bff73f8fbfab09c3c5fd092ec
- name: sdlpop
buildsystem: simple
subdir: src
sources:
- type: archive
url: https://github.com/NagyD/SDLPoP/archive/v1.18.1.tar.gz
sha256: 8032c47fad4b73021d636ead510bbc1ab5106cff77103e331ad0f32a49a13946
- type: file
path: com.github.nagyd.SDLPoP.appdata.xml
build-commands:
- mkdir build
- cd build && cmake -G Ninja ..
- cd build && ninja
- install -Dm744 ../prince /app/bin/prince
- mkdir /app/bin/data
- cp -r ../data/* /app/bin/data
- sed -e 's|$ROOT/prince|prince|' ../src/SDLPoP.desktop.template > ../src/SDLPoP.desktop
- sed -e 's|$ROOT/data/icon.png|icon|g' ../src/SDLPoP.desktop
- install -Dm644 ../src/SDLPoP.desktop /app/share/applications/com.github.nagyd.SDLPoP.desktop
- install -Dm644 ../com.github.nagyd.SDLPoP.appdata.xml /app/share/metainfo/com.github.nagyd.SDLPoP.appdata.xml
- install -Dm644 ../data/icon.png /app/share/icons/hicolor/32x32/apps/icon.png
- echo "cd /app/bin && prince" > /app/bin/prince.sh
- chmod +x /app/bin/prince.sh
com.github.nagyd.SDLPoP.appdata.xml:
<?xml version="1.0" encoding="UTF-8"?>
<component type="desktop-application">
<id type="desktop">com.github.nagyd.SDLPoP.desktop</id>
<metadata_licence>GPL-3.0</metadata_licence>
<project_license>GPL-3.0</project_license>
<name>SDLPoP</name>
<summary>An open-source port of Prince of Persia, based on the disassembly of the DOS version</summary>
<description>
<p>
An open-source port of Prince of Persia, based on the disassembly of the DOS version.
</p>
</description>
<screenshots>
<screenshot type="default">
<image>https://dashboard.snapcraft.io/site_media/appmedia/2018/03/Screenshot_20180330_171753.png</image>
</screenshot>
<screenshot>
<image>https://dashboard.snapcraft.io/site_media/appmedia/2018/03/Screenshot_20180330_171747.png</image>
</screenshot>
<screenshot>
<image>https://dashboard.snapcraft.io/site_media/appmedia/2018/04/Screenshot_from_2018-04-06_13-46-22.png</image>
</screenshot>
</screenshots>
<url type="homepage">https://github.com/NagyD/SDLPoP</url>
<provides>
<binary>sdlpop</binary>
</provides>
</component>
Saving the configuration & progress doesn't work yet, since AFAICT it expects the .cfg file to be placed next to the binary and not in ~.
Here is another Flatpak packaging.
Notable differences from the other example:
- No need for extra modules/libs, the runtime seems to have everything needed.
- Use of
/var/{config,data}folder that are bind-mount target for the appropriate XDG dirs.
Not tested and likely broken:
- Auto-detection of gamepads. Probably will require bind mounting the udev database. Maybe could be avoided if SDL2 will support the Device Portal.
- Saving/loading.