git: 5a2b826c7d67 - main - devel/lua-lgi: unbreak lua-lgi after glib 2.88.3 upgrade
Rodrigo Osorio <[email protected]>
| Newsgroups | gmane.os.freebsd.devel.cvs.ports |
|---|---|
| Message-ID | <[email protected]> |
The branch main has been updated by rodrigo: URL: https://cgit.FreeBSD.org/ports/commit/?id=5a2b826c7d67d25fca30ed286754191316a8182b commit 5a2b826c7d67d25fca30ed286754191316a8182b Author: Rodrigo Osorio <[email protected]> AuthorDate: 2026-08-19 09:51:44 +0000 Commit: Rodrigo Osorio <[email protected]> CommitDate: 2026-08-19 10:24:41 +0000 devel/lua-lgi: unbreak lua-lgi after glib 2.88.3 upgrade Minimal port of lua-lgi fix for new Glib PR: 297414 Reported by: Kan Sasaki <[email protected]> Obtained from: https://github.com/lgi-devs/lgi/pull/361 Approved by: portmgr (build and runtime fix blanket) --- devel/lua-lgi/Makefile | 2 +- devel/lua-lgi/files/patch-lua-lgi-glib_fix | 68 ++++++++++++++++++++++++++++++ 2 files changed, 69 insertions(+), 1 deletion(-) diff --git a/devel/lua-lgi/Makefile b/devel/lua-lgi/Makefile index 19c4d4c54be2..77abf74e3051 100644 --- a/devel/lua-lgi/Makefile +++ b/devel/lua-lgi/Makefile @@ -1,6 +1,6 @@ PORTNAME= lgi PORTVERSION= 0.9.2 -PORTREVISION= 3 +PORTREVISION= 4 CATEGORIES= devel PKGNAMEPREFIX= ${LUA_PKGNAMEPREFIX} diff --git a/devel/lua-lgi/files/patch-lua-lgi-glib_fix b/devel/lua-lgi/files/patch-lua-lgi-glib_fix new file mode 100644 index 000000000000..122d5010d062 --- /dev/null +++ b/devel/lua-lgi/files/patch-lua-lgi-glib_fix @@ -0,0 +1,68 @@ +Minimal port of lua-lgi fix for new Glib +https://github.com/lgi-devs/lgi/pull/361 + +diff --git lgi/ffi.lua.orig lgi/ffi.lua +index b382a97e..26f31883 100644 +--- lgi/ffi.lua.orig ++++ lgi/ffi.lua +@@ -75,18 +75,33 @@ 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 ++ if GLib.check_version(2, 87, 0) then ++ 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 ++ else ++ for _, val in ipairs(enum_class.values) do ++ enum_component[core.upcase(val.value_nick):gsub('%-', '_')] = val.value ++ end ++ end ++ -- 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 +- type_class:unref() + return enum_component + end + +diff --git tests/pango.lua.orig tests/pango.lua +index e20a6799..48e7e21a 100644 +--- tests/pango.lua.orig ++++ tests/pango.lua +@@ -35,8 +35,14 @@ 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 ++ if Pango.version_check(1, 56, 2) then ++ pgs = Pango.GlyphString() ++ Pango.shape(string.sub(s,1+offset), length, analysis, pgs) ++ else ++ pgs = Pango.shape(string.sub(s,1+offset), length, analysis) ++ end ++ + -- Pull out individual glyphs with pgs.glyphs + local glyphs = pgs.glyphs + check(type(glyphs) == 'table')