I took a sample project and built/exported it as a “Linux/X11” application and build a snap as follows.
snap install snapcraft --candidate --classic
snap install multipass --beta --classic
I then made a godot_game
directory and within it snap/snapcraft.yaml
and gamefiles
folder. Inside the gamefiles
folder which contains the export of the game. Here’s the output of tree
so it makes sense.
alan@hal:~/Source/godot_game$ tree
.
├── gamefiles
│ ├── Isometric Game.pck
│ └── Isometric Game.x86_64
├── isometric-game_1.0_amd64.snap
└── snap
└── snapcraft.yaml
2 directories, 4 files
Here’s the snap/snapcraft.yaml
which references the gamefiles/
directory and dumps that into the snap. It also stages the minimum necessary packages.
name: isometric-game
base: core18
version: '1.0'
summary: Isometric Game
description: |
A simple game made in Godot
grade: stable
confinement: strict
apps:
isometric-game:
command: desktop-launch "$SNAP/Isometric Game.x86_64"
environment:
LD_LIBRARY_PATH: "$LD_LIBRARY_PATH:/usr/lib/$SNAPCRAFT_ARCH_TRIPLET/pulseaudio"
plugs:
- opengl
- network
- network-bind
- pulseaudio
- x11
- desktop
- joystick
parts:
game:
plugin: dump
source: gamefiles/
after: [desktop-glib-only]
stage-packages:
- libgl1-mesa-dri
- libglu1-mesa
- libgl1-mesa-glx
- libpulse0
- libxcursor1
- libxinerama1
- libxrandr2
- libxi6
- libasound2
desktop-glib-only:
build-packages:
- libglib2.0-dev
plugin: make
source: https://github.com/ubuntu/snapcraft-desktop-helpers.git
source-subdir: glib-only
stage-packages:
- libglib2.0-bin
Once all that is done just run snapcraft
from within the godot_game
folder and it should produce a snap which ends like this:
Priming game
Snapping 'isometric-game' \
Snapped isometric-game_1.0_amd64.snap
Install the snap:-
sudo snap install isometric-game_1.0_amd64.snap --dangerous
Run it with:-
isometric-game
And it should launch fine. There’s further work to do to add a desktop file and icon, but that should get you started. Let us know how you get on.