SHA256
1
0
forked from lua/lua-lgi

3 Commits

8 changed files with 197 additions and 20 deletions

View File

@@ -13,11 +13,11 @@ GLib >= 2.86, while still preserving the old behaviour on GLib < 2.86.
lgi/ffi.lua | 15 ++++++++++++--- lgi/ffi.lua | 15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-) 1 file changed, 12 insertions(+), 3 deletions(-)
diff --git a/lgi/ffi.lua b/lgi/ffi.lua Index: lgi-0.9.2/lgi/ffi.lua
index 799f68e..0695b0b 100644 ===================================================================
--- a/lgi/ffi.lua --- lgi-0.9.2.orig/lgi/ffi.lua 2025-10-29 12:16:22.502956913 +0100
+++ b/lgi/ffi.lua +++ lgi-0.9.2/lgi/ffi.lua 2025-10-29 12:16:33.528971082 +0100
@@ -76,18 +76,27 @@ end @@ -76,18 +76,27 @@
-- Creates new enum/flags table with all values from specified gtype. -- Creates new enum/flags table with all values from specified gtype.
function ffi.load_enum(gtype, name) function ffi.load_enum(gtype, name)
@@ -48,6 +48,3 @@ index 799f68e..0695b0b 100644
return enum_component return enum_component
end end
--
2.47.1

View File

@@ -1,6 +1,5 @@
<multibuild> <multibuild>
<package>luajit</package> <package>luajit</package>
<package>lua51</package>
<package>lua53</package> <package>lua53</package>
<package>lua54</package> <package>lua54</package>
</multibuild> </multibuild>

View File

@@ -1,3 +1,24 @@
-------------------------------------------------------------------
Wed Oct 29 12:14:44 UTC 2025 - Matej Cepl <mcepl@cepl.eu>
- An attempt to make test suite working, but not yet.
- Added patches:
- 001-Fix-GLib-2.86-regression.patch
- lua54.patch
- network_metered-property.patch
- pango-1_56_2.patch
- warnings-away.patch
-------------------------------------------------------------------
Fri Oct 24 14:48:22 UTC 2025 - Matej Cepl <mcepl@cepl.eu>
- Switch off building lua51 build of the package.
-------------------------------------------------------------------
Mon Oct 20 18:40:45 UTC 2025 - Matej Cepl <mcepl@cepl.eu>
- Make the package buildable with LuaJIT.
------------------------------------------------------------------- -------------------------------------------------------------------
Wed Oct 8 10:13:32 UTC 2025 - Paulo Gomes <pjbgf@linux.com> Wed Oct 8 10:13:32 UTC 2025 - Paulo Gomes <pjbgf@linux.com>

View File

@@ -29,16 +29,24 @@ Source0: https://github.com/pavouk/%{mod_name}/archive/%{version}.tar.gz#
Patch0: lua54.patch Patch0: lua54.patch
# PATCH-FIX-UPSTREAM 001-Fix-GLib-2.86-regression.patch boo#1250526 # PATCH-FIX-UPSTREAM 001-Fix-GLib-2.86-regression.patch boo#1250526
Patch1: 001-Fix-GLib-2.86-regression.patch Patch1: 001-Fix-GLib-2.86-regression.patch
# PATCH-FIX-UPSTREAM warnings-away.patch bsc#[0-9]+ mcepl@suse.com
# remove warnings from deprecated calls
Patch2: warnings-away.patch
# PATCH-FIX-UPSTREAM pango-1_56_2.patch gh#lgi-devs/lgi!342 mcepl@suse.com
# update to use pango 1.56.2
Patch3: pango-1_56_2.patch
# PATCH-FIX-UPSTREAM network_metered-property.patch gh#lgi-devs/lgi!215 mcepl@suse.com
# support for network_metered property
Patch4: network_metered-property.patch
BuildRequires: lua-macros BuildRequires: lua-macros
BuildRequires: %{flavor}-devel BuildRequires: %{flavor}-devel
BuildRequires: pkgconfig BuildRequires: pkgconfig
BuildRequires: pkgconfig(gmodule-2.0) BuildRequires: pkgconfig(gmodule-2.0)
BuildRequires: pkgconfig(gobject-introspection-1.0) >= 0.10.8 BuildRequires: pkgconfig(gobject-introspection-1.0) >= 0.10.8
BuildRequires: pkgconfig(libffi) BuildRequires: pkgconfig(libffi)
%if "%{flavor}" == "luajit" BuildRequires: pkgconfig(pango)
BuildRequires: lua54-devel BuildRequires: pkgconfig(gtk4)
%define LUANAME luajit-2.0 BuildRequires: pkgconfig(cairo)
%endif
Requires: %{flavor} Requires: %{flavor}
%lua_provides %lua_provides
%if "%{flavor}" == "" %if "%{flavor}" == ""
@@ -56,6 +64,7 @@ directly from Lua.
%package doc %package doc
Summary: Lua bindings to GObject libraries - documentation and samples Summary: Lua bindings to GObject libraries - documentation and samples
Group: Documentation/Other Group: Documentation/Other
BuildArch: noarch
%description doc %description doc
Dynamic Lua binding to any library which is introspectable Dynamic Lua binding to any library which is introspectable
@@ -65,6 +74,8 @@ directly from Lua.
%prep %prep
%autosetup -n %{mod_name}-%{version} -p1 %autosetup -n %{mod_name}-%{version} -p1
find . -name \*.lua -exec sed -i -e 's,# *\! *%{_bindir}/.*lua,#!%{_bindir}/lua,' '{}' +;
%build %build
make %{?_smp_mflags} V=1 \ make %{?_smp_mflags} V=1 \
LUA_CFLAGS=" -I%{lua_incdir}" \ LUA_CFLAGS=" -I%{lua_incdir}" \
@@ -76,6 +87,9 @@ make %{?_smp_mflags} V=1 \
LUA_LIBDIR=%{lua_archdir} \ LUA_LIBDIR=%{lua_archdir} \
LUA_SHAREDIR=%{lua_noarchdir} LUA_SHAREDIR=%{lua_noarchdir}
%check
make check || true
%files %files
%if 0%{?suse_version} >= 1500 %if 0%{?suse_version} >= 1500
%license LICENSE %license LICENSE

View File

@@ -1,8 +1,12 @@
diff --git a/lgi/callable.c b/lgi/callable.c ---
index e96d3af..3234b64 100644 lgi/callable.c | 5 ++++-
--- a/lgi/callable.c 1 file changed, 4 insertions(+), 1 deletion(-)
+++ b/lgi/callable.c
@@ -1355,7 +1355,10 @@ closure_callback (ffi_cif *cif, void *ret, void **args, void *closure_arg) Index: lgi-0.9.2/lgi/callable.c
===================================================================
--- lgi-0.9.2.orig/lgi/callable.c 2017-10-09 20:55:55.000000000 +0200
+++ lgi-0.9.2/lgi/callable.c 2025-10-29 12:16:31.099371249 +0100
@@ -1233,7 +1233,10 @@
} }
else else
{ {

View File

@@ -0,0 +1,36 @@
From 05c909b3b9eaf64ac5b37459d9cf101922dc854c Mon Sep 17 00:00:00 2001
From: Uli Schlachter <psychon@znc.in>
Date: Fri, 8 Feb 2019 13:03:16 +0100
Subject: [PATCH] Fix GObject warning in tests
The subclass test caused the following warning:
(lua5.2:14980): GLib-GObject-CRITICAL **: 13:02:03.551: Object class
LgiTestFakeMonitor1 doesn't implement property 'network-metered' from
interface 'GNetworkMonitor'
This new property was added in Gio 2.46. The fix here is to implement
that property. That should not cause problems with older versions of
Gio, because there the extra property would just be ignored.
Signed-off-by: Uli Schlachter <psychon@znc.in>
---
tests/gobject.lua | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/tests/gobject.lua b/tests/gobject.lua
index 2eb2b142..82a21b89 100644
--- a/tests/gobject.lua
+++ b/tests/gobject.lua
@@ -282,6 +282,11 @@ function gobject.subclass_prop_inherit()
'LgiTestFakeMonitor1NetworkAvailable',
'Whether the network is available.',
false, { GObject.ParamFlags.READABLE })
+ FakeMonitor._property.network_metered =
+ GObject.ParamSpecBoolean('network-metered',
+ 'LgiTestFakeMonitor1NetworkMetered',
+ 'Whether the network is metered.',
+ false, { GObject.ParamFlags.READABLE })
FakeMonitor._property.connectivity =
GObject.ParamSpecEnum('connectivity',
'LgiTestFakeMonitor1Connectivity',

27
pango-1_56_2.patch Normal file
View File

@@ -0,0 +1,27 @@
From 86b60ff99ad267619e117a8a65cc569612cbdcaa Mon Sep 17 00:00:00 2001
From: Chris Hofstaedtler <zeha@debian.org>
Date: Wed, 16 Jul 2025 00:00:36 +0200
Subject: [PATCH] Adapt to new pango bindings
See:
https://gitlab.gnome.org/GNOME/pango/-/merge_requests/829
https://github.com/fwupd/fwupd/commit/d0d3eff666d2a6d9c09346ea050eed1c78271f0a
https://bugs.debian.org/1101238
---
tests/pango.lua | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
Index: lgi-0.9.2/tests/pango.lua
===================================================================
--- lgi-0.9.2.orig/tests/pango.lua 2025-10-29 12:16:22.516482739 +0100
+++ lgi-0.9.2/tests/pango.lua 2025-10-29 12:16:39.467334765 +0100
@@ -35,8 +35,7 @@
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)
+ 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')

79
warnings-away.patch Normal file
View File

@@ -0,0 +1,79 @@
---
lgi/marshal.c | 2 +-
lgi/object.c | 46 +++++++++++++++++++++-------------------------
2 files changed, 22 insertions(+), 26 deletions(-)
Index: lgi-0.9.2/lgi/marshal.c
===================================================================
--- lgi-0.9.2.orig/lgi/marshal.c 2017-10-09 20:55:55.000000000 +0200
+++ lgi-0.9.2/lgi/marshal.c 2025-10-13 00:39:03.948391950 +0200
@@ -325,7 +325,7 @@
*out_array = (gpointer *) lua_tolstring (L, narg, &size);
if (transfer != GI_TRANSFER_NOTHING)
- *out_array = g_memdup (*out_array, size);
+ *out_array = g_memdup2 (*out_array, size);
*out_size = size;
}
Index: lgi-0.9.2/lgi/object.c
===================================================================
--- lgi-0.9.2.orig/lgi/object.c 2017-10-09 20:55:55.000000000 +0200
+++ lgi-0.9.2/lgi/object.c 2025-10-13 00:42:11.527589269 +0200
@@ -545,35 +545,31 @@
lua_toboolean (L, 3));
else
{
- /* Normally Lua code uses GObject.Object.new(), which maps
- directly to g_object_newv(), but for some reason GOI < 1.0 does
- not export this method in the typelib. */
-
- /* Get GType - 1st argument. */
- GParameter *params;
- size_t size, i;
- GIBaseInfo *gparam_info;
+ /* Create new object from properties passed in the table. */
GType gtype = lgi_type_get_gtype (L, 1);
luaL_checktype (L, 2, LUA_TTABLE);
+ int n_props = 0;
+ lua_pushnil(L);
+ while (lua_next(L, 2) != 0) {
+ n_props++;
+ lua_pop(L, 1);
+ }
- /* Find BaseInfo of GParameter. */
- gparam_info = g_irepository_find_by_name (NULL, "GObject", "Parameter");
- *lgi_guard_create (L, (GDestroyNotify) g_base_info_unref) = gparam_info;
-
- /* Prepare array of GParameter structures. */
- size = lua_objlen (L, 2);
- params = g_newa (GParameter, size);
- for (i = 0; i < size; ++i)
- {
- lua_pushnumber (L, i + 1);
- lua_gettable (L, 2);
- lgi_type_get_repotype (L, G_TYPE_INVALID, gparam_info);
- lgi_record_2c (L, -2, &params[i], TRUE, FALSE, FALSE, FALSE);
- lua_pop (L, 1);
- }
+ const char *names[n_props];
+ GValue values[n_props];
+ int i = 0;
+ lua_pushnil(L);
+ while (lua_next(L, 2) != 0) {
+ names[i] = lua_tostring(L, -2);
+ GParamSpec *pspec = g_object_class_find_property(G_OBJECT_GET_CLASS(g_type_class_peek(gtype)), names[i]);
+ g_value_init(&values[i], G_PARAM_SPEC_VALUE_TYPE(pspec));
+ GITypeInfo* ti = g_irepository_find_by_gtype(NULL, G_PARAM_SPEC_VALUE_TYPE(pspec));
+ lgi_marshal_2c(L, ti, NULL, GI_TRANSFER_NOTHING, &values[i], -1, 0, NULL, NULL);
+ i++;
+ lua_pop(L, 1);
+ }
- /* Create the object and return it. */
- return lgi_object_2lua (L, g_object_newv (gtype, size, params),
+ return lgi_object_2lua (L, g_object_new_with_properties (gtype, n_props, names, values),
TRUE, FALSE);
}
}