To get started snapping an application against the KDE Frameworks 5 content snap you'll ideally want to start from a pre-existing snap.
KF5 snaps are distinct in that they contain some bits of very important boilerplate. None of this requires changes really, but it is helpful to understand what is going on.
They define a plug linking to kf5
plugs:
kde-frameworks-5-plug:
content: kde-frameworks-5-all
interface: content
default-provider: kde-frameworks-5
target: kf5
And each C++ part
that has a build requirement on KF5 needs to pull in the
development component
parts:
babe:
after:
- kde-frameworks-5-dev
One part
(ideally the one producing the app in question) needs
to pull in the environment launcher.
parts:
babe:
after:
- kde-frameworks-5-env
Lastly the relevant application defintions need to use the custom plug and start themselves through the environment launcher.
apps:
babe:
command: kf5-launch babe
plugs:
- kde-frameworks-5-plug
- Put snapcraft.yaml in a directory. For neon builds it should be in the main directory of the packaging repo.
- Relative to the snapcraft.yaml you'll want to put the icon and desktop file
# paths to copy from vary of course
mkdir -pv snap/gui/
cp -v /usr/share/icons/breeze/apps/48/babe.svg snap/gui/babe.svg
cp -v /usr/share/applications/org.kde.babe.desktop snap/gui/
To build snaps you want to use snapcraft
. Currently this requires a special
parts file to build. To use it simply
export SNAPCRAFT_PARTS_URI=https://metadata.neon.kde.org/snap/parts.yaml
.
To build simply run snapcraft
and to clean the tree snapcraft clean
.
To test a newly built snap it's easiest to simply snap try
it (note: once you
have a snap try-mounted you do not need to try on subsequent builds, you can
change stuff in the prime dir as necessary).
snap remove babe
snap try ./prime/
/snap/bin/babe
On first start the snap will throw an error on CLI about not being able to find the framework and tell you a command to run to connect the plug.
For additional information please check out https://docs.snapcraft.io/