[neon/snap-packaging/kf6-snap] /: Patch appstream so that CMake will point to the lib in the right prefix

Benjamin Port null at kde.org
Mon Apr 22 21:01:59 BST 2024


Git commit 692cf0a8a6a97a1577a9fac7420c517663170219 by Benjamin Port, on behalf of Kevin Ottens.
Committed on 22/04/2024 at 08:29.
Pushed by bport into branch 'master'.

Patch appstream so that CMake will point to the lib in the right prefix

It was using a fixed value based on --prefix at meson setup time.
Unfortunately when using through a snap, it's not in /usr but somewhere
under /snap. CMake knows that, so let's leverage it.

A  +13   -0    patches/libappstream-qt6/01_cmake_locate_lib_based_on_package_prefix_dir
A  +1    -0    patches/libappstream-qt6/series
M  +5    -0    snapcraft.yaml

https://invent.kde.org/neon/snap-packaging/kf6-snap/-/commit/692cf0a8a6a97a1577a9fac7420c517663170219

diff --git a/patches/libappstream-qt6/01_cmake_locate_lib_based_on_package_prefix_dir b/patches/libappstream-qt6/01_cmake_locate_lib_based_on_package_prefix_dir
new file mode 100644
index 0000000..7495545
--- /dev/null
+++ b/patches/libappstream-qt6/01_cmake_locate_lib_based_on_package_prefix_dir
@@ -0,0 +1,13 @@
+diff --git a/qt/cmake/AppStreamQtConfig.cmake.in b/qt/cmake/AppStreamQtConfig.cmake.in
+index 0e3eb11..9f76c2f 100644
+--- a/qt/cmake/AppStreamQtConfig.cmake.in
++++ b/qt/cmake/AppStreamQtConfig.cmake.in
+@@ -32,7 +32,7 @@ add_library(AppStreamQt SHARED IMPORTED)
+ set_target_properties(AppStreamQt PROPERTIES
+   INTERFACE_INCLUDE_DIRECTORIES "${PACKAGE_PREFIX_DIR}/include/"
+   INTERFACE_LINK_LIBRARIES "Qt::Core"
+-  IMPORTED_LOCATION "@LIBDIR_FULL@/libAppStreamQt.so.${AppStreamQt_VERSION}"
++  IMPORTED_LOCATION "${PACKAGE_PREFIX_DIR}/.. at LIBDIR_FULL@/libAppStreamQt.so.${AppStreamQt_VERSION}"
+   IMPORTED_SONAME "libAppStreamQt.${AppStreamQt_VERSION_MAJOR}"
+ )
+ 
diff --git a/patches/libappstream-qt6/series b/patches/libappstream-qt6/series
new file mode 100644
index 0000000..281e942
--- /dev/null
+++ b/patches/libappstream-qt6/series
@@ -0,0 +1 @@
+01_cmake_locate_lib_based_on_package_prefix_dir
diff --git a/snapcraft.yaml b/snapcraft.yaml
index 4171a28..9ccafae 100644
--- a/snapcraft.yaml
+++ b/snapcraft.yaml
@@ -879,6 +879,11 @@ parts:
         after:
         - qtconf
         source: https://github.com/ximion/appstream/archive/refs/tags/v1.0.2.tar.gz
+        override-pull: |
+            craftctl default
+            while read -r PATCHFILE ; do
+                patch -p1 < "$CRAFT_PROJECT_DIR/patches/libappstream-qt6/$PATCHFILE"
+            done < $CRAFT_PROJECT_DIR/patches/libappstream-qt6/series
         plugin: meson
         build-packages:
         - meson



More information about the Neon-commits mailing list