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

commit 23cfe46670acd7487eccd3e931bcf572dab05c58
Author: Liliana Marie Prikler <[email protected]>
AuthorDate: Fri Mar 6 08:28:41 2026 +0100

    gnu: lua-lgi: Fix build.
    
    * gnu/packages/patches/lua-lgi-fix-pango.patch: New file.
    * gnu/packages/patches/lua-lgi-fix-ref.patch: New file.
    * gnu/local.mk (dist_patch_DATA): Register them here.
    * gnu/packages/lua.scm (make-lua-lgi)[patches]: Add them here.
---
 gnu/local.mk                                 |  2 ++
 gnu/packages/lua.scm                         |  2 ++
 gnu/packages/patches/lua-lgi-fix-pango.patch | 19 ++++++++++++
 gnu/packages/patches/lua-lgi-fix-ref.patch   | 44 ++++++++++++++++++++++++++++
 4 files changed, 67 insertions(+)

diff --git a/gnu/local.mk b/gnu/local.mk
index a837e97dd4..2c64b96bf2 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1869,6 +1869,8 @@ dist_patch_DATA =                                         
\
   %D%/packages/patches/lua-5.4-liblua-so.patch                 \
   %D%/packages/patches/lua-5.4-search-paths.patch              \
   %D%/packages/patches/lua-5.x-search-path-helpers.patch       \
+  %D%/packages/patches/lua-lgi-fix-pango.patch                 \
+  %D%/packages/patches/lua-lgi-fix-ref.patch                   \
   %D%/packages/patches/luanti-paths.patch                      \
   %D%/packages/patches/lugaru-fix-sound.patch                  \
   %D%/packages/patches/luit-posix.patch                                \
diff --git a/gnu/packages/lua.scm b/gnu/packages/lua.scm
index 4079780589..6a09a83814 100644
--- a/gnu/packages/lua.scm
+++ b/gnu/packages/lua.scm
@@ -982,6 +982,8 @@ describing the commented declarations and functions.")
              (url "https://github.com/pavouk/lgi";)
              (commit version)))
        (file-name (git-file-name name version))
+       (patches (search-patches "lua-lgi-fix-ref.patch"
+                                "lua-lgi-fix-pango.patch"))
        (sha256
         (base32 "03rbydnj411xpjvwsyvhwy4plm96481d7jax544mvk7apd8sd5jj"))))
     (build-system gnu-build-system)
diff --git a/gnu/packages/patches/lua-lgi-fix-pango.patch 
b/gnu/packages/patches/lua-lgi-fix-pango.patch
new file mode 100644
index 0000000000..d8ffe00eb0
--- /dev/null
+++ b/gnu/packages/patches/lua-lgi-fix-pango.patch
@@ -0,0 +1,19 @@
+Upstream-Status: https://github.com/lgi-devs/lgi/pull/342
+---
+ tests/pango.lua | 3 +--
+ 1 file changed, 1 insertion(+), 2 deletions(-)
+
+diff --git a/tests/pango.lua b/tests/pango.lua
+index e20a6799..ea00b903 100644
+--- a/tests/pango.lua
++++ b/tests/pango.lua
+@@ -35,7 +35,6 @@ function pango.glyphstring()
+       local offset = items[i].offset
+       local length = items[i].length
+       local analysis = items[i].analysis
+-      local pgs = Pango.GlyphString()
+-      Pango.shape(string.sub(s,1+offset), length, analysis, pgs)
++      local pgs = Pango.shape(string.sub(s,1+offset), length, analysis)
+       -- Pull out individual glyphs with pgs.glyphs
+       local glyphs = pgs.glyphs
+       check(type(glyphs) == 'table')
\ No newline at end of file
diff --git a/gnu/packages/patches/lua-lgi-fix-ref.patch 
b/gnu/packages/patches/lua-lgi-fix-ref.patch
new file mode 100644
index 0000000000..23814c7d06
--- /dev/null
+++ b/gnu/packages/patches/lua-lgi-fix-ref.patch
@@ -0,0 +1,44 @@
+GLib 2.86 removed the GObject.TypeClass.ref() function, replacing it
+with GObject.TypeClass.get()—this commit makes it so .get() is used in
+GLib >= 2.86, while still preserving the old behaviour on GLib < 2.86.
+
+Upstream-Status: known issue <https://github.com/lgi-devs/lgi/issues/346>
+---
+ LuaGObject/ffi.lua | 15 ++++++++++++---
+ 1 file changed, 12 insertions(+), 3 deletions(-)
+
+diff --git a/LuaGObject/ffi.lua b/LuaGObject/ffi.lua
+index 799f68e5..0695b0be 100644
+--- a/lgi/ffi.lua
++++ b/lgi/ffi.lua
+@@ -76,18 +76,27 @@ end
+ 
+ -- Creates new enum/flags table with all values from specified gtype.
+ function ffi.load_enum(gtype, name)
+-   local GObject = core.repo.GObject
++   local GLib, GObject = core.repo.GLib, core.repo.GObject
+    local is_flags = GObject.Type.is_a(gtype, GObject.Type.FLAGS)
+    local enum_component = component.create(
+       gtype, is_flags and enum.bitflags_mt or enum.enum_mt, name)
+-   local type_class = GObject.TypeClass.ref(gtype)
++   local type_class
++   -- GLib >= 2.86 deprecates GObject.TypeClass.ref() in favour of .get()
++   if GLib.check_version(2, 86, 0) then
++      type_class = GObject.TypeClass.ref(gtype)
++   else
++      type_class = GObject.TypeClass.get(gtype)
++   end
+    local enum_class = core.record.cast(
+       type_class, is_flags and GObject.FlagsClass or GObject.EnumClass)
+    for i = 0, enum_class.n_values - 1 do
+       local val = core.record.fromarray(enum_class.values, i)
+       enum_component[core.upcase(val.value_nick):gsub('%-', '_')] = val.value
+    end
+-   type_class:unref()
++   -- For GLib versions below 2.86, type_class was ref'd and needs to be 
unref'd
++   if GLib.check_version(2, 86, 0) then
++      type_class:unref()
++   end
+    return enum_component
+ end
+ 
\ No newline at end of file

Reply via email to