KDE neon extensions
The KDE neon extensions help authors create snaps that use Qt ,
with or without the KDE Frameworks
libraries. This page covers the architecture of the extension and its effect on project
files during build.
This a family of extensions for two versions of KDE neon paired with Qt:
KDE neon 6, internally named kde-neon-6
KDE neon 5, internally named kde-neon
Compatibility
The KDE neon 6 extension is supported with the core24 and core22 bases.
The KDE neon 5 extension is supported with the core22 base. An older version of
the extension is also available for core20.
Important
As of February 2024, KDE no longer supports KDE neon 5.
The extensions are designed for C++ based Qt/KDE Frameworks apps. They don’t provide the
bindings needed for PySide2 (Qt for Python) or PyQt apps. The extensions also don’t
provide all of the optional Qt libraries. For example, they don’t include Qt3D,
QtCharts, QtDataVisualization or QtGamepad.
Included interfaces
The KDE neon 6 extension connects the snap to the following runtime content snaps:
The snaps for Qt and KDE Frameworks
run-time libraries.
The gtk-common-themes snap for common
icon, cursor and sound themes.
The extension automatically includes the required plugs for these runtime libraries.
Included interfaces from KDE neon 6
snapcraft.yaml
plugs :
desktop :
mount-host-font-cache : false
gtk-2-themes :
interface : content
target : $SNAP/data-dir/themes
default-provider : gtk-common-themes
gtk-3-themes :
interface : content
target : $SNAP/data-dir/themes
default-provider : gtk-common-themes
icon-themes :
interface : content
target : $SNAP/data-dir/icons
default-provider : gtk-common-themes
sound-themes :
interface : content
target : $SNAP/data-dir/sounds
default-provider : gtk-common-themes
kf6-core24 :
content : kf6-core24-all
interface : content
target : $SNAP/kf6
default-provider : kf6-core24
gpu-2404 :
interface : content
target : $SNAP/gpu-2404
default-provider : mesa-2404
In addition, the extension adds the following plugs to each app that uses it:
Included plugs for apps from KDE neon 6
snapcraft.yaml
plugs :
- desktop
- desktop-legacy
- opengl
- wayland
- x11
- audio-playback
- unity7
- network
- network-bind
Included packages
The KDE neon 6 extension depends on two separate snaps – a build snap and a combination
platform-content snap.
The build snap ensures that the relevant Qt and KDE Frameworks development libraries and
supporting files are available during the build process. These libraries are sourced
from the KDE neon project , which provides more recent versions
of Qt and the KDE Frameworks.
The platform snap makes the corresponding run-time libraries available to the snap when
it’s launched by the user. If the platform snap isn’t already present on a user’s
machine, then it will be installed automatically and simultaneously with the KDE neon
extension-based snap.
By relying on a standalone platform snap, authors can avoid bundling the Qt and KDE
Frameworks libraries in their snap, keeping the file size of the snap to a minimum. The
same installation of the platform snap can be used by multiple snaps that rely on the
KDE neon extensions.
Included build environment variables
The KDE neon 6 extension sets environment variables so the project’s parts can build
correctly. The project’s main part receives the following variables.
Included build environment variables from KDE neon 6
snapcraft.yaml
build-environment :
- PATH : /snap/kde-qt6-core24-sdk/current/usr/bin:/snap/kf6-core24-sdk/current/usr/bin${PATH::$PATH}
- XDG_DATA_DIRS : $CRAFT_STAGE/usr/share:/snap/kde-qt6-core24-sdk/current/usr/share:/snap/kf6-core24-sdk/current/usr/share:/usr/share${XDG_DATA_DIRS::$XDG_DATA_DIRS}
- XDG_CONFIG_HOME : $CRAFT_STAGE/etc/xdg:/snap/kde-qt6-core24-sdk/current/etc/xdg:/snap/kf6-core24-sdk/current/etc/xdg:/etc/xdg${XDG_CONFIG_HOME::$XDG_CONFIG_HOME}
- LD_LIBRARY_PATH : /snap/kde-qt6-core24-sdk/current/usr/lib/${CRAFT_ARCH_TRIPLET_BUILD_FOR}:/snap/kde-qt6-core24-sdk/current/usr/lib:/snap/kf6-core24-sdk/current/usr/lib/${CRAFT_ARCH_TRIPLET_BUILD_FOR}:/snap/kf6-core24-sdk/current/usr/lib/${CRAFT_ARCH_TRIPLET_BUILD_FOR}/blas:/snap/kf6-core24-sdk/current/usr/lib/${CRAFT_ARCH_TRIPLET_BUILD_FOR}/lapack:/snap/kf6-core24-sdk/current/usr/lib/${CRAFT_ARCH_TRIPLET_BUILD_FOR}/libproxy:/snap/kf6-core24-sdk/current/usr/lib:$CRAFT_STAGE/usr/lib/${CRAFT_ARCH_TRIPLET_BUILD_FOR}:$CRAFT_STAGE/usr/lib:$CRAFT_STAGE/lib/${LD_LIBRARY_PATH::$LD_LIBRARY_PATH}
- CMAKE_PREFIX_PATH : $CRAFT_STAGE;/snap/kde-qt6-core24-sdk/current;/snap/kf6-core24-sdk/current;/usr${CMAKE_PREFIX_PATH:;$CMAKE_PREFIX_PATH}
- CMAKE_FIND_ROOT_PATH : $CRAFT_STAGE;/snap/kde-qt6-core24-sdk/current;/snap/kf6-core24-sdk/current;/usr${CMAKE_FIND_ROOT_PATH:;$CMAKE_FIND_ROOT_PATH}
Included runtime environment variables
The KDE neon 6 extension also set various runtime environment variables for apps.
The main runtime variables apply to the whole snap.
Included snap-wide runtime variables from KDE neon 6
snapcraft.yaml
environment :
SNAP_DESKTOP_RUNTIME : $SNAP/kf6
GTK_USE_PORTAL : "1"
QT_VERSION : "6"
The rest of the runtime variables are set at launch by a command-chain
shell script
included by a configure hook :
Included configure hook from KDE neon 6
snapcraft.yaml
hooks :
configure :
command-chain :
- snap/command-chain/hooks-configure-desktop
The KDE neon 6 extension adds this shell script to the snap through a special part.
Included SDK build part from KDE neon 6
snapcraft.yaml
parts :
...
kde-neon-6/sdk :
source : /snap/snapcraft/current/share/snapcraft/extensions/desktop/command-chain-kde
The part assembles the shell script from shared scripts in Snapcraft’s source:
Included layouts
The KDE neon 6 extension adds the following layouts .
Included layouts
snapcraft.yaml
layout :
/usr/share/X11 :
symlink : $SNAP/kf6/usr/share/X11
/usr/share/qt6 :
symlink : $SNAP/kf6/usr/share/qt6
/usr/share/libdrm :
bind : $SNAP/gpu-2404/libdrm
/usr/share/drirc.d :
symlink : $SNAP/gpu-2404/drirc.d
Included hooks
The KDE neon 6 extension adds a hook that
sets runtime environment variables.
Example expanded project files
Here are examples of the result of a project file that uses the KDE neon
extensions. They demonstrate the added plugs, packages, variables, and layouts
that the extensions add to project files immediately prior to build.
These examples contain the difference between the original files and the output of the
snapcraft expand-extensions command. Some of the
text has been altered for ease of reading.
KDE neon 6 KDE neon 5
The original is a project file
for a snapped version of Keysmith .
Expanded project file for Keysmith name: keysmith
base: core24
adopt-info: keysmith
confinement: strict
grade: stable
-build-packages:
- - libsodium-dev
- - libssl-dev
- - libproxy1v5
parts:
keysmith:
- parse-info:
- - usr/share/metainfo/org.kde.keysmith.appdata.xml
plugin: cmake
source: .
source-type: local
cmake-parameters:
- -DCMAKE_INSTALL_PREFIX=/usr
- -DCMAKE_BUILD_TYPE=Release
- -DQT_MAJOR_VERSION=6
- -DBUILD_WITH_QT6=ON
- -DBUILD_TESTING=OFF
- -DCMAKE_INSTALL_SYSCONFDIR=/etc
- -DCMAKE_INSTALL_LOCALSTATEDIR=/var
- -DCMAKE_EXPORT_NO_PACKAGE_REGISTRY=ON
- -DCMAKE_FIND_USE_PACKAGE_REGISTRY=OFF
- -DCMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY=ON
- -DCMAKE_INSTALL_RUNSTATEDIR=/run
- -DCMAKE_SKIP_INSTALL_ALL_DEPENDENCY=ON
- -DCMAKE_VERBOSE_MAKEFILE=ON
- -DCMAKE_INSTALL_LIBDIR=lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR
- --log-level=STATUS
- -DCMAKE_LIBRARY_PATH=lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR
prime:
- -usr/lib/*/cmake/*
- -usr/include/*
- -usr/share/ECM/*
- -usr/share/man/*
- -usr/bin/X11
- -usr/lib/gcc/$CRAFT_ARCH_TRIPLET_BUILD_FOR/6.0.0
- -usr/lib/aspell/*
- -usr/share/lintian
+ build-environment:
+ - PATH: /snap/kde-qt6-core24-sdk/current/usr/bin:/snap/kf6-core24-sdk/current/usr/bin${PATH:+:$PATH}
+ - XDG_DATA_DIRS: $CRAFT_STAGE/usr/share:/snap/kde-qt6-core24-sdk/current/usr/share:/snap/kf6-core24-sdk/current/usr/share:/usr/share${XDG_DATA_DIRS:+:$XDG_DATA_DIRS}
+ - XDG_CONFIG_HOME: $CRAFT_STAGE/etc/xdg:/snap/kde-qt6-core24-sdk/current/etc/xdg:/snap/kf6-core24-sdk/current/etc/xdg:/etc/xdg${XDG_CONFIG_HOME:+:$XDG_CONFIG_HOME}
+ - LD_LIBRARY_PATH: /snap/kde-qt6-core24-sdk/current/usr/lib/${CRAFT_ARCH_TRIPLET_BUILD_FOR}:/snap/kde-qt6-core24-sdk/current/usr/lib:/snap/kf6-core24-sdk/current/usr/lib/${CRAFT_ARCH_TRIPLET_BUILD_FOR}:/snap/kf6-core24-sdk/current/usr/lib/${CRAFT_ARCH_TRIPLET_BUILD_FOR}/blas:/snap/kf6-core24-sdk/current/usr/lib/${CRAFT_ARCH_TRIPLET_BUILD_FOR}/lapack:/snap/kf6-core24-sdk/current/usr/lib/${CRAFT_ARCH_TRIPLET_BUILD_FOR}/libproxy:/snap/kf6-core24-sdk/current/usr/lib:$CRAFT_STAGE/usr/lib/${CRAFT_ARCH_TRIPLET_BUILD_FOR}:$CRAFT_STAGE/usr/lib:$CRAFT_STAGE/lib/${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}
+ - CMAKE_PREFIX_PATH: $CRAFT_STAGE;/snap/kde-qt6-core24-sdk/current;/snap/kf6-core24-sdk/current;/usr${CMAKE_PREFIX_PATH:+;$CMAKE_PREFIX_PATH}
+ - CMAKE_FIND_ROOT_PATH: $CRAFT_STAGE;/snap/kde-qt6-core24-sdk/current;/snap/kf6-core24-sdk/current;/usr${CMAKE_FIND_ROOT_PATH:+;$CMAKE_FIND_ROOT_PATH}
cleanup:
after:
- keysmith
plugin: nil
build-snaps:
- core24
- kf6-core24
- qt-common-themes
override-prime: |
# Remove duplicate files in the dependent snaps from the final snap.
for snap in "core24" "kf6-core24" "qt-common-themes"; do
cd "/snap/$snap/current" && find . -type f,l -print | sed 's|^./|/root/prime/|' | xargs rm -f
done
+ build-environment:
+ - PATH: /snap/kde-qt6-core24-sdk/current/usr/bin:/snap/kf6-core24-sdk/current/usr/bin${PATH:+:$PATH}
+ - XDG_DATA_DIRS: $CRAFT_STAGE/usr/share:/snap/kde-qt6-core24-sdk/current/usr/share:/snap/kf6-core24-sdk/current/usr/share:/usr/share${XDG_DATA_DIRS:+:$XDG_DATA_DIRS}
+ - XDG_CONFIG_HOME: $CRAFT_STAGE/etc/xdg:/snap/kde-qt6-core24-sdk/current/etc/xdg:/snap/kf6-core24-sdk/current/etc/xdg:/etc/xdg${XDG_CONFIG_HOME:+:$XDG_CONFIG_HOME}
+ - LD_LIBRARY_PATH: /snap/kde-qt6-core24-sdk/current/usr/lib/${CRAFT_ARCH_TRIPLET_BUILD_FOR}:/snap/kde-qt6-core24-sdk/current/usr/lib:/snap/kf6-core24-sdk/current/usr/lib/${CRAFT_ARCH_TRIPLET_BUILD_FOR}:/snap/kf6-core24-sdk/current/usr/lib/${CRAFT_ARCH_TRIPLET_BUILD_FOR}/blas:/snap/kf6-core24-sdk/current/usr/lib/${CRAFT_ARCH_TRIPLET_BUILD_FOR}/lapack:/snap/kf6-core24-sdk/current/usr/lib/${CRAFT_ARCH_TRIPLET_BUILD_FOR}/libproxy:/snap/kf6-core24-sdk/current/usr/lib:$CRAFT_STAGE/usr/lib/${CRAFT_ARCH_TRIPLET_BUILD_FOR}:$CRAFT_STAGE/usr/lib:$CRAFT_STAGE/lib/${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}
+ - CMAKE_PREFIX_PATH: $CRAFT_STAGE;/snap/kde-qt6-core24-sdk/current;/snap/kf6-core24-sdk/current;/usr${CMAKE_PREFIX_PATH:+;$CMAKE_PREFIX_PATH}
+ - CMAKE_FIND_ROOT_PATH: $CRAFT_STAGE;/snap/kde-qt6-core24-sdk/current;/snap/kf6-core24-sdk/current;/usr${CMAKE_FIND_ROOT_PATH:+;$CMAKE_FIND_ROOT_PATH}
+ snapcraft/core:
+ build-packages:
+ - libsodium-dev
+ - libssl-dev
+ - libproxy1v5
+ plugin: nil
+ build-environment:
+ - PATH: /snap/kde-qt6-core24-sdk/current/usr/bin:/snap/kf6-core24-sdk/current/usr/bin${PATH:+:$PATH}
+ - XDG_DATA_DIRS: $CRAFT_STAGE/usr/share:/snap/kde-qt6-core24-sdk/current/usr/share:/snap/kf6-core24-sdk/current/usr/share:/usr/share${XDG_DATA_DIRS:+:$XDG_DATA_DIRS}
+ - XDG_CONFIG_HOME: $CRAFT_STAGE/etc/xdg:/snap/kde-qt6-core24-sdk/current/etc/xdg:/snap/kf6-core24-sdk/current/etc/xdg:/etc/xdg${XDG_CONFIG_HOME:+:$XDG_CONFIG_HOME}
+ - LD_LIBRARY_PATH: /snap/kde-qt6-core24-sdk/current/usr/lib/${CRAFT_ARCH_TRIPLET_BUILD_FOR}:/snap/kde-qt6-core24-sdk/current/usr/lib:/snap/kf6-core24-sdk/current/usr/lib/${CRAFT_ARCH_TRIPLET_BUILD_FOR}:/snap/kf6-core24-sdk/current/usr/lib/${CRAFT_ARCH_TRIPLET_BUILD_FOR}/blas:/snap/kf6-core24-sdk/current/usr/lib/${CRAFT_ARCH_TRIPLET_BUILD_FOR}/lapack:/snap/kf6-core24-sdk/current/usr/lib/${CRAFT_ARCH_TRIPLET_BUILD_FOR}/libproxy:/snap/kf6-core24-sdk/current/usr/lib:$CRAFT_STAGE/usr/lib/${CRAFT_ARCH_TRIPLET_BUILD_FOR}:$CRAFT_STAGE/usr/lib:$CRAFT_STAGE/lib/${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}
+ - CMAKE_PREFIX_PATH: $CRAFT_STAGE;/snap/kde-qt6-core24-sdk/current;/snap/kf6-core24-sdk/current;/usr${CMAKE_PREFIX_PATH:+;$CMAKE_PREFIX_PATH}
+ - CMAKE_FIND_ROOT_PATH: $CRAFT_STAGE;/snap/kde-qt6-core24-sdk/current;/snap/kf6-core24-sdk/current;/usr${CMAKE_FIND_ROOT_PATH:+;$CMAKE_FIND_ROOT_PATH}
+ kde-neon-6/sdk:
+ source: /snap/snapcraft/current/share/snapcraft/extensions/desktop/command-chain-kde
+ plugin: make
+ build-snaps:
+ - kde-qt6-core24-sdk
+ - kf6-core24-sdk
+ build-packages:
+ - gettext
+ - doxygen
+ - graphviz
+ - libxml2-utils
+ - docbook-xml
+ - docbook-xsl
+ - libglx-dev
+ - libgl-dev
+ - libglvnd-dev
+ make-parameters:
+ - GPU_WRAPPER=gpu-2404-wrapper
+compression: lzo
+layout:
+ /usr/share/X11:
+ symlink: $SNAP/kf6/usr/share/X11
+ /usr/share/qt6:
+ symlink: $SNAP/kf6/usr/share/qt6
+ /usr/share/libdrm:
+ bind: $SNAP/gpu-2404/libdrm
+ /usr/share/drirc.d:
+ symlink: $SNAP/gpu-2404/drirc.d
+assumes:
+ - snapd2.58.3
+hooks:
+ configure:
+ command-chain:
+ - snap/command-chain/hooks-configure-desktop
+ plugs:
+ - desktop
apps:
keysmith:
command: usr/bin/keysmith
common-id: org.kde.keysmith.desktop
desktop: usr/share/applications/org.kde.keysmith.desktop
plugs:
+ - desktop
+ - desktop-legacy
+ - opengl
+ - wayland
+ - x11
+ - audio-playback
+ - unity7
+ - network
+ - network-bind
- home
+ command-chain:
+ - snap/command-chain/gpu-2404-wrapper
+ - snap/command-chain/desktop-launch
+plugs:
+ desktop:
+ mount-host-font-cache: false
+ gtk-2-themes:
+ interface: content
+ target: $SNAP/data-dir/themes
+ default-provider: gtk-common-themes
+ gtk-3-themes:
+ interface: content
+ target: $SNAP/data-dir/themes
+ default-provider: gtk-common-themes
+ icon-themes:
+ interface: content
+ target: $SNAP/data-dir/icons
+ default-provider: gtk-common-themes
+ sound-themes:
+ interface: content
+ target: $SNAP/data-dir/sounds
+ default-provider: gtk-common-themes
+ kf6-core24:
+ content: kf6-core24-all
+ interface: content
+ target: $SNAP/kf6
+ default-provider: kf6-core24
+ gpu-2404:
+ interface: content
+ target: $SNAP/gpu-2404
+ default-provider: mesa-2404
slots:
session-dbus-interface:
interface: dbus
name: org.kde.keysmith
bus: session
+environment:
+ SNAP_DESKTOP_RUNTIME: $SNAP/kf6
+ GTK_USE_PORTAL: "1"
+ QT_VERSION: "6"
The original project file comes from the KCalc snap .
We provide a review of the unmodified file in Example Qt5 KDE app .
Expanded project file for KCalc name: kcalc
version: "19.08.0"
grade: stable
adopt-info: kcalc
confinement: strict
base: core18
apps:
kcalc:
command: kcalc
- extensions: [kde-neon]
common-id: org.kde.kcalc.desktop
plugs:
+ - desktop
+ - desktop-legacy
+ - opengl
+ - wayland
+ - x11
- kde-frameworks-5-plug
- home
- - opengl
- network
- network-bind
- pulseaudio
+ command-chain:
+ - snap/command-chain/desktop-launch
slots:
session-dbus-interface:
interface: dbus
name: org.kde.kcalc.desktop
bus: session
parts:
kcalc:
plugin: cmake
source: https://download.kde.org/stable/applications/19.08.0/src/kcalc-19.08.0.tar.xz
parse-info:
- usr/share/metainfo/org.kde.kcalc.appdata.xml
build-snaps:
- kde-frameworks-5-core18-sdk
- kde-frameworks-5-core18
build-packages:
- libmpfr-dev
- libgmp-dev
- kdoctools-dev
stage-packages:
- libmpfr6
- libgmp10
configflags:
- - "-DKDE_INSTALL_USE_QT_SYS_PATHS=ON"
- - "-DCMAKE_INSTALL_PREFIX=/usr"
- - "-DCMAKE_BUILD_TYPE=Release"
- - "-DENABLE_TESTING=OFF"
- - "-DBUILD_TESTING=OFF"
- - "-DKDE_SKIP_TEST_SETTINGS=ON"
+ - -DKDE_INSTALL_USE_QT_SYS_PATHS=ON
+ - -DCMAKE_INSTALL_PREFIX=/usr
+ - -DCMAKE_BUILD_TYPE=Release
+ - -DENABLE_TESTING=OFF
+ - -DBUILD_TESTING=OFF
+ - -DKDE_SKIP_TEST_SETTINGS=ON
+ kde-neon-extension:
+ build-packages:
+ - g++
+ build-snaps:
+ - kde-frameworks-5-core18-sdk/latest/stable
+ make-parameters:
+ - PLATFORM_PLUG=kde-frameworks-5-core18
+ plugin: make
+ source: $SNAPCRAFT_EXTENSIONS_DIR/desktop
+ source-subdir: kde-neon
+assumes:
+ - snapd2.43
+compression: lzo
+plugs:
+ desktop:
+ mount-host-font-cache: false
+ icon-themes:
+ default-provider: gtk-common-themes
+ interface: content
+ target: $SNAP/data-dir/icons
+ kde-frameworks-5-core18:
+ content: kde-frameworks-5-core18-all
+ default-provider: kde-frameworks-5-core18
+ interface: content
+ target: $SNAP/kf5
+ sound-themes:
+ default-provider: gtk-common-themes
+ interface: content
+ target: $SNAP/data-dir/sounds
+environment:
+ SNAP_DESKTOP_RUNTIME: $SNAP/kf5
+hooks:
+ configure:
+ command-chain:
+ - snap/command-chain/hooks-configure-desktop
+ plugs:
+ - desktop
+layout:
+ /usr/share/X11:
+ symlink: $SNAP/kf5/usr/share/X11