[neon/snap-packaging/snapcraft-desktop-integration/work.core24] /: Add kde-neon-qt6

Scarlett Moore null at kde.org
Tue Feb 4 15:42:24 GMT 2025


Git commit b75be2ba16fed74c833c5f33ce82aeaecc21f67d by Scarlett Moore.
Committed on 04/02/2025 at 15:41.
Pushed by scarlettmoore into branch 'work.core24'.

Add kde-neon-qt6

M  +2    -2    common/init
A  +34   -0    kde-neon-qt6/Makefile
A  +1    -0    kde-neon-qt6/desktop-exports
A  +1    -0    kde-neon-qt6/fonts
A  +1    -0    kde-neon-qt6/init
A  +51   -0    kde-neon-qt6/launcher-specific
A  +62   -0    kde-neon-qt6/locale-gen
A  +1    -0    kde-neon-qt6/mark-and-exec

https://invent.kde.org/neon/snap-packaging/snapcraft-desktop-integration/-/commit/b75be2ba16fed74c833c5f33ce82aeaecc21f67d

diff --git a/common/init b/common/init
index 456555d..8c7c8ca 100644
--- a/common/init
+++ b/common/init
@@ -79,7 +79,7 @@ export SNAP_LAUNCHER_ARCH_TRIPLET="$ARCH"
 if ! grep -qs "^\s*confinement:\s*classic\s*" "$SNAP/meta/snap.yaml"; then
   if [ -f "$SNAP/lib/$ARCH/bindtextdomain.so" ]; then
     export LD_PRELOAD="$LD_PRELOAD:$SNAP/\$LIB/bindtextdomain.so"
-  elif [ -f "$SNAP/gnome-platform/lib/$ARCH/bindtextdomain.so" ] && ! grep -qs "^\s*default-provider:\s*wine-platform-runtime*" "$SNAP/meta/snap.yaml"; then
-    export LD_PRELOAD="$LD_PRELOAD:$SNAP/gnome-platform/\$LIB/bindtextdomain.so"
+  elif [ -f "$SNAP/kde-qt6-core24/lib/$ARCH/bindtextdomain.so" ] && ! grep -qs "^\s*default-provider:\s*wine-platform-runtime*" "$SNAP/meta/snap.yaml"; then
+    export LD_PRELOAD="$LD_PRELOAD:$SNAP/kde-qt6-core24/\$LIB/bindtextdomain.so"
   fi
 fi
diff --git a/kde-neon-qt6/Makefile b/kde-neon-qt6/Makefile
new file mode 100644
index 0000000..55e32e7
--- /dev/null
+++ b/kde-neon-qt6/Makefile
@@ -0,0 +1,34 @@
+#!/usr/bin/make -f
+
+SRC_DIR ?= .
+
+DATA_DIR             := $(DESTDIR)/data-dir
+BIN_DIR              := $(DESTDIR)/snap/command-chain
+LIB_DIR              := $(DESTDIR)/lib
+DEST_LAUNCHER        := desktop-launch6
+LOCALE_GENERATOR     := locale-gen
+DEST_CONFIGURE_HOOK  := hooks-configure-desktop
+
+build: $(DEST_LAUNCHER) $(DEST_CONFIGURE_HOOK)
+
+clean:
+	rm -f $(DEST_LAUNCHER)
+	rm -f $(DEST_CONFIGURE_HOOK)
+	rm -f $(BINDTEXTDOMAIN)
+
+$(DEST_LAUNCHER):
+	@cat $(SRC_DIR)/init > $(DEST_LAUNCHER)
+         # tail -n +2 to remove the shebang
+	@tail -n +2 $(SRC_DIR)/desktop-exports | sed -e "s/%PLATFORM_PLUG%/$${PLATFORM_PLUG:?}/" -e "s/%WITH_GRAPHICS%/$(WITH_GRAPHICS)/" >> $(DEST_LAUNCHER)
+	@tail -n +2 $(SRC_DIR)/launcher-specific >> $(DEST_LAUNCHER)
+	@tail -n +2 $(SRC_DIR)/mark-and-exec >> $(DEST_LAUNCHER)
+
+$(DEST_CONFIGURE_HOOK):
+	@cat $(SRC_DIR)/fonts > $(DEST_CONFIGURE_HOOK)
+
+install: $(DEST_LAUNCHER) $(DEST_CONFIGURE_HOOK)
+	install -d $(DATA_DIR)
+	install -d $(DATA_DIR)/qt6
+	install -D -m755 $(DEST_LAUNCHER) "$(BIN_DIR)"/$(DEST_LAUNCHER)
+	install -D -m755 $(LOCALE_GENERATOR) "$(BIN_DIR)"/$(LOCALE_GENERATOR)
+	install -D -m755 $(DEST_CONFIGURE_HOOK) "$(BIN_DIR)"/$(DEST_CONFIGURE_HOOK)
diff --git a/kde-neon-qt6/desktop-exports b/kde-neon-qt6/desktop-exports
new file mode 120000
index 0000000..8013267
--- /dev/null
+++ b/kde-neon-qt6/desktop-exports
@@ -0,0 +1 @@
+../common/desktop-exports
\ No newline at end of file
diff --git a/kde-neon-qt6/fonts b/kde-neon-qt6/fonts
new file mode 120000
index 0000000..3ef54f4
--- /dev/null
+++ b/kde-neon-qt6/fonts
@@ -0,0 +1 @@
+../common/fonts
\ No newline at end of file
diff --git a/kde-neon-qt6/init b/kde-neon-qt6/init
new file mode 120000
index 0000000..350b7be
--- /dev/null
+++ b/kde-neon-qt6/init
@@ -0,0 +1 @@
+../common/init
\ No newline at end of file
diff --git a/kde-neon-qt6/launcher-specific b/kde-neon-qt6/launcher-specific
new file mode 100644
index 0000000..33b1926
--- /dev/null
+++ b/kde-neon-qt6/launcher-specific
@@ -0,0 +1,51 @@
+#!/bin/bash
+###################################
+# KDE NEON launcher specific part #
+###################################
+
+# shellcheck disable=SC2154
+if [ "$wayland_available" = true ]; then
+  export GDK_BACKEND="wayland"
+  export CLUTTER_BACKEND="wayland"
+  export QT_QPA_PLATFORM=wayland-egl
+fi
+
+# Add paths for games
+append_dir PATH "$SNAP/usr/games"
+append_dir PATH "$SNAP_DESKTOP_RUNTIME/usr/games"
+
+# Qt Libs
+prepend_dir LD_LIBRARY_PATH "$SNAP_DESKTOP_RUNTIME/usr/lib"
+prepend_dir LD_LIBRARY_PATH "$SNAP_DESKTOP_RUNTIME/usr/lib/$ARCH"
+
+# blas
+append_dir LD_LIBRARY_PATH "$SNAP_DESKTOP_RUNTIME/usr/lib/$ARCH/blas"
+# lapack
+append_dir LD_LIBRARY_PATH "$SNAP_DESKTOP_RUNTIME/usr/lib/$ARCH/lapack"
+
+
+# Add QT_PLUGIN_PATH (Qt Modules).
+append_dir QT_PLUGIN_PATH "$SNAP/usr/lib/$ARCH/qt6/plugins"
+append_dir QT_PLUGIN_PATH "$SNAP/usr/lib/$ARCH/plugins"
+append_dir QT_PLUGIN_PATH "$SNAP/usr/lib/$ARCH"
+append_dir QT_PLUGIN_PATH "$SNAP_DESKTOP_RUNTIME/usr/lib/$ARCH/qt6/plugins"
+append_dir QT_PLUGIN_PATH "$SNAP_DESKTOP_RUNTIME/usr/lib/$ARCH/plugins"
+append_dir QT_PLUGIN_PATH "$SNAP_DESKTOP_RUNTIME/usr/lib/$ARCH/"
+# And QML2_IMPORT_PATH (Qt Modules).
+append_dir QML2_IMPORT_PATH "$SNAP/usr/lib/$ARCH/qt6/qml"
+append_dir QML2_IMPORT_PATH "$SNAP_DESKTOP_RUNTIME/usr/lib/$ARCH/qt6/qml"
+append_dir QML2_IMPORT_PATH "$SNAP_DESKTOP_RUNTIME/usr/lib/$ARCH/qml"
+
+# Qt style breeze
+append_dir QT_STYLE_OVERRIDE "motif"
+
+# Fix locating the QtWebEngineProcess executable
+export QTWEBENGINEPROCESS_PATH="$SNAP_DESKTOP_RUNTIME/usr/lib/qt6/libexec/QtWebEngineProcess"
+
+# Fix sound issues with many apps.
+export ALSA_CONFIG_PATH="$SNAP_DESKTOP_RUNTIME/etc/asound.conf"
+
+# Removes Qt warning: Could not find a location
+# of the system Compose files
+export QTCOMPOSE="$SNAP_DESKTOP_RUNTIME/usr/share/X11/locale"
+export QT_XKB_CONFIG_ROOT="/usr/share/X11/xkb"
diff --git a/kde-neon-qt6/locale-gen b/kde-neon-qt6/locale-gen
new file mode 100755
index 0000000..a2d2b66
--- /dev/null
+++ b/kde-neon-qt6/locale-gen
@@ -0,0 +1,62 @@
+#!/usr/bin/perl
+
+use strict;
+
+sub uniq
+{
+    my %seen;
+    grep !$seen{$_}++, @_;
+}
+
+# TODO support for KDE's in-app language switch feature.
+sub get_languages
+{
+    # Initialize with sane defaults.
+    my @found_languages = ($ENV{'LANG'} or 'C.UTF-8');
+
+    # Go through LC_.
+    foreach (sort keys %ENV)
+    {
+        if (substr($_, 0, length("LC_")) eq "LC_")
+        {
+            push(@found_languages, $ENV{$_});
+        }
+    }
+    # And finally LANGUAGE, but normalize it.
+    if (my $language = $ENV{'LANGUAGE'})
+    {
+        foreach (split(':', $language))
+        {
+            push(@found_languages, "$_.UTF-8");
+        }
+    }
+
+    # Remove duplicates before returning.
+    @found_languages = uniq(@found_languages);
+
+    return @found_languages
+}
+
+my $env_locpath = $ENV{'LOCPATH'} or die "LOCPATH must be set";
+my @locpaths = split(/:/, $env_locpath);
+
+foreach my $lang (get_languages())
+{
+    my $found = 0;
+    foreach my $locpath (@locpaths)
+    {
+        my $loc_target = "$locpath/$lang";
+        if (-e $loc_target)
+        {
+            $found = 1;
+            last;
+        }
+    }
+    next if $found;
+    my $target = "@locpaths[0]/$lang";
+
+    # localedef will exit !0 for unknown reasons, even when everything was
+    # generated fine.
+    my ($locale, $encoding) = split(/\./, $lang);
+    system('/snap/kf6-core24/current/usr/bin/localedef', '-v', '-i', $locale, '-f', $encoding, $target);
+}
diff --git a/kde-neon-qt6/mark-and-exec b/kde-neon-qt6/mark-and-exec
new file mode 120000
index 0000000..1bf8626
--- /dev/null
+++ b/kde-neon-qt6/mark-and-exec
@@ -0,0 +1 @@
+../common/mark-and-exec
\ No newline at end of file


More information about the Neon-commits mailing list