guix_mirror_bot pushed a commit to branch gnome-team
in repository guix.

commit 5b0d6dc1bc4132aaeff715836b05772000cabc9e
Author: Maxim Cournoyer <[email protected]>
AuthorDate: Wed Sep 2 15:48:47 2026 +0900

    gnu: appstream: More properly fix libstemmer include directory.
    
    * gnu/packages/patches/appstream-libstemmer-include-dir.patch: New file.
    * gnu/local.mk (dist_patch_DATA): Register it.
    * gnu/packages/freedesktop.scm (appstream) [source]: Apply it.
    [#:phases] {patch-libstemmer}: Delete.
    
    Signed-off-by: Liliana Marie Prikler <[email protected]>
---
 gnu/local.mk                                       |  1 +
 gnu/packages/freedesktop.scm                       | 10 +--
 .../patches/appstream-libstemmer-include-dir.patch | 90 ++++++++++++++++++++++
 3 files changed, 93 insertions(+), 8 deletions(-)

diff --git a/gnu/local.mk b/gnu/local.mk
index 896d5c544b3..ad9fffa1a9c 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1021,6 +1021,7 @@ dist_patch_DATA =                                         
\
   %D%/packages/patches/antiword-CVE-2014-8123.patch                    \
   %D%/packages/patches/antlr3-3_1-fix-java8-compilation.patch  \
   %D%/packages/patches/antlr3-3_3-fix-java8-compilation.patch  \
+  %D%/packages/patches/appstream-libstemmer-include-dir.patch   \
   %D%/packages/patches/apr-fix-atomics.patch                   \
   %D%/packages/patches/apr-skip-getservbyname-test.patch       \
   %D%/packages/patches/aria-maestosa-scons-python3.patch       \
diff --git a/gnu/packages/freedesktop.scm b/gnu/packages/freedesktop.scm
index c43df62e83c..d93f37ff0ba 100644
--- a/gnu/packages/freedesktop.scm
+++ b/gnu/packages/freedesktop.scm
@@ -174,7 +174,8 @@
                        "appstream/releases/"
                        "AppStream-" version ".tar.xz"))
        (sha256
-        (base32 "0ifblpdmvlynsc2dw66j78pm5xls9h1jdn5jzrqh4m8hi4vij6ch"))))
+        (base32 "0ifblpdmvlynsc2dw66j78pm5xls9h1jdn5jzrqh4m8hi4vij6ch"))
+       (patches (search-patches "appstream-libstemmer-include-dir.patch"))))
     (build-system meson-build-system)
     (arguments
      (list
@@ -182,13 +183,6 @@
       #:configure-flags #~(list "-Dsystemd=false")
       #:phases
       #~(modify-phases %standard-phases
-          (add-after 'unpack 'patch-libstemmer
-            (lambda* (#:key inputs #:allow-other-keys)
-              (let ((libstemmer.h (search-input-file inputs
-                                                     "include/libstemmer.h")))
-                (substitute* "meson.build"
-                  (("/usr/include")
-                   (dirname libstemmer.h))))))
           (add-before 'check 'check-setup
             (lambda _
               (setenv "HOME" (getcwd)))))))
diff --git a/gnu/packages/patches/appstream-libstemmer-include-dir.patch 
b/gnu/packages/patches/appstream-libstemmer-include-dir.patch
new file mode 100644
index 00000000000..11350da6bda
--- /dev/null
+++ b/gnu/packages/patches/appstream-libstemmer-include-dir.patch
@@ -0,0 +1,90 @@
+From 832c929031a124be07f6044d027ad2d8c35806d9 Mon Sep 17 00:00:00 2001
+From: Matthias Klumpp <[email protected]>
+Date: Sat, 5 Sep 2026 00:12:05 +0200
+Subject: [PATCH] meson: Don't use any absolute include path to find
+ libstemmer.h
+
+Resolves: #569
+---
+ meson.build      | 25 ++++++++++++++++---------
+ src/as-stemmer.c |  4 ++++
+ src/meson.build  |  5 ++---
+ 3 files changed, 22 insertions(+), 12 deletions(-)
+
+diff --git a/meson.build b/meson.build
+index b1bc44ee8..e907bace6 100644
+--- a/meson.build
++++ b/meson.build
+@@ -226,16 +226,23 @@ if get_option ('gir')
+     dependency('gobject-introspection-1.0', version: '>=1.56')
+ endif
+ 
+-stemmer_inc_dirs = include_directories()
++stemmer_dep = dependency('', required: false)
+ if get_option('stemming')
+-    stemmer_lib = cc.find_library('stemmer', required: true)
+-    stemmer_inc_dirs = include_directories(['/usr/include'])
+-    if not cc.has_header('libstemmer.h')
+-        if cc.has_header('libstemmer/libstemmer.h')
+-            stemmer_inc_dirs = include_directories('/usr/include/libstemmer')
+-        else
+-            error('Unable to find Snowball header "libstemmer.h". Please 
ensure libstemmer/Snowball is installed properly in order to continue.')
+-        endif
++    # Snowball doesn't have an upstream pkg-conf file, but some distros 
conveniently add one
++    # See https://github.com/snowballstem/snowball/issues/190
++    stemmer_dep = dependency('libstemmer', required: false)
++    if not stemmer_dep.found()
++        stemmer_dep = cc.find_library('stemmer', required: true)
++    endif
++
++    # The Snowball header is either installed directly into an include 
directory,
++    # or into a "libstemmer" subdirectory of it.
++    if cc.has_header('libstemmer.h', dependencies: [stemmer_dep])
++        conf.set('HAVE_LIBSTEMMER_SUBDIR', false)
++    elif cc.has_header('libstemmer/libstemmer.h', dependencies: [stemmer_dep])
++        conf.set('HAVE_LIBSTEMMER_SUBDIR', true)
++    else
++        error('Unable to find Snowball header "libstemmer.h". Please ensure 
libstemmer/Snowball is installed properly in order to continue.')
+     endif
+ endif
+ 
+diff --git a/src/as-stemmer.c b/src/as-stemmer.c
+index bd93065a1..22abafb81 100644
+--- a/src/as-stemmer.c
++++ b/src/as-stemmer.c
+@@ -24,8 +24,12 @@
+ #include <glib.h>
+ #include <string.h>
+ #ifdef HAVE_STEMMING
++#ifdef HAVE_LIBSTEMMER_SUBDIR
++#include <libstemmer/libstemmer.h>
++#else
+ #include <libstemmer.h>
+ #endif
++#endif
+ 
+ #include "as-utils.h"
+ #include "as-utils-private.h"
+diff --git a/src/meson.build b/src/meson.build
+index 479605848..6553fcf82 100644
+--- a/src/meson.build
++++ b/src/meson.build
+@@ -207,7 +207,7 @@ aslib_deps = [
+     coregraphics_dep,
+ ]
+ if get_option ('stemming')
+-    aslib_deps += [stemmer_lib]
++    aslib_deps += [stemmer_dep]
+ endif
+ 
+ appstream_lib = library ('appstream',
+@@ -220,8 +220,7 @@ appstream_lib = library ('appstream',
+     soversion: as_api_level,
+     version: as_version,
+     dependencies: [aslib_deps],
+-    include_directories: [stemmer_inc_dirs,
+-                          root_inc_dir],
++    include_directories: [root_inc_dir],
+     install: true
+ )
+ 

Reply via email to