[neon/snap-packaging/kf6-core-sdk/work.core24] /: kcoreaddon: patch kcoreaddon to change the desktop file name for snaps

Soumyadeep Ghosh null at kde.org
Mon Feb 10 13:19:17 GMT 2025


Git commit 1a82a6d03a13f3078fcbcbd2c52e7826d08df1f3 by Soumyadeep Ghosh.
Committed on 06/02/2025 at 21:54.
Pushed by scarlettmoore into branch 'work.core24'.

kcoreaddon: patch kcoreaddon to change the desktop file name for snaps

A  +50   -0    patches/kcoreaddons/001_snap_window_class_fix.patch
M  +3    -0    snapcraft.yaml

https://invent.kde.org/neon/snap-packaging/kf6-core-sdk/-/commit/1a82a6d03a13f3078fcbcbd2c52e7826d08df1f3

diff --git a/patches/kcoreaddons/001_snap_window_class_fix.patch b/patches/kcoreaddons/001_snap_window_class_fix.patch
new file mode 100644
index 0000000..bc4d07a
--- /dev/null
+++ b/patches/kcoreaddons/001_snap_window_class_fix.patch
@@ -0,0 +1,50 @@
+# * Copyright 2024 Soumyadeep Ghosh (সৌম্যদীপ ঘোষ) <soumyadeepghosh2004 at zohomail.in>
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 9d5bc5ef..11b90915 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -32,6 +32,7 @@ add_feature_info(QCH ${BUILD_QCH} "API documentation in QCH format (for e.g. Qt
+ 
+ option(ENABLE_PCH "Enable precompile headers for faster builds" ON)
+ option(KCOREADDONS_USE_QML "Build the QML plugin" ON)
++option(SNAP_SUPPORT "Build with the desktop file name fix for snaps" OFF)
+ 
+ set(REQUIRED_QT_VERSION 6.6.0)
+ find_package(Qt6 ${REQUIRED_QT_VERSION} CONFIG REQUIRED Core)
+diff --git a/src/lib/CMakeLists.txt b/src/lib/CMakeLists.txt
+index 5930a0cd..ae27bcd8 100644
+--- a/src/lib/CMakeLists.txt
++++ b/src/lib/CMakeLists.txt
+@@ -388,3 +388,7 @@ if(BUILD_QCH)
+         COMPONENT Devel
+     )
+ endif()
++
++if(SNAP_SUPPORT)
++    target_compile_definitions(KF6CoreAddons PUBLIC -DSNAP_SUPPORT=1)
++endif()
+\ No newline at end of file
+diff --git a/src/lib/kaboutdata.cpp b/src/lib/kaboutdata.cpp
+index 56ed509f..e0249c61 100644
+--- a/src/lib/kaboutdata.cpp
++++ b/src/lib/kaboutdata.cpp
+@@ -560,7 +560,11 @@ KAboutData::KAboutData(const QString &_componentName,
+     std::reverse(hostComponents.begin(), hostComponents.end());
+     hostComponents.append(_componentName);
+ 
++#ifdef SNAP_SUPPORT
++    d->desktopFileName = _componentName + QLatin1Char('_') + _componentName;
++#else
+     d->desktopFileName = hostComponents.join(dotChar);
++#endif
+ }
+ 
+ KAboutData::KAboutData(const QString &_componentName, const QString &_displayName, const QString &_version)
+@@ -1003,6 +1007,7 @@ KAboutData &KAboutData::setDesktopFileName(const QString &desktopFileName)
+ 
+ QString KAboutData::desktopFileName() const
+ {
++    qDebug() << "From getter desktopFileName" << d->desktopFileName;
+     return d->desktopFileName;
+     // KF6: switch to this code and adapt API dox
+ #if 0
diff --git a/snapcraft.yaml b/snapcraft.yaml
index d6ccf3d..86bc2a9 100644
--- a/snapcraft.yaml
+++ b/snapcraft.yaml
@@ -383,6 +383,9 @@ parts:
         cmake-generator: Ninja
         cmake-parameters: *cmakeparameters
         build-environment: *buildenvironment
+        override-pull: |
+          craftctl default
+          patch -p1 < $CRAFT_PROJECT_DIR/patches/kcoreaddons/001_snap_window_class_fix.patch
     karchive:
         after:
         - extra-cmake-modules


More information about the Neon-commits mailing list