Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

flatpak support - Enhancement #172

Open
stavpup opened this issue Apr 17, 2018 · 4 comments
Open

flatpak support - Enhancement #172

stavpup opened this issue Apr 17, 2018 · 4 comments

Comments

@stavpup
Copy link

stavpup commented Apr 17, 2018

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.

@NagyD
Copy link
Owner

NagyD commented Apr 22, 2018

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

@stavpup
Copy link
Author

stavpup commented Apr 22, 2018

@Alexander-Wilms
Copy link

Alexander-Wilms commented Jul 7, 2018

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 ~.

@tinywrkb
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants