forked from lua/lua-lgi
Compare commits
3 Commits
| Author | SHA256 | Date | |
|---|---|---|---|
|
1e5ed57670
|
|||
|
d474f4df7d
|
|||
|
|
ad2409b5c2 |
53
001-Fix-GLib-2.86-regression.patch
Normal file
53
001-Fix-GLib-2.86-regression.patch
Normal file
@@ -0,0 +1,53 @@
|
||||
From 54d90bfd38c4562ddd619f1f2e14130fc68ec702 Mon Sep 17 00:00:00 2001
|
||||
From: Victoria Lacroix <victoria@vtrlx.ca>
|
||||
Date: Mon, 22 Sep 2025 10:02:10 -0400
|
||||
Subject: [PATCH] Fix GLib 2.86 regression
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
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.
|
||||
---
|
||||
lgi/ffi.lua | 15 ++++++++++++---
|
||||
1 file changed, 12 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/lgi/ffi.lua b/lgi/ffi.lua
|
||||
index 799f68e..0695b0b 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
|
||||
|
||||
--
|
||||
2.47.1
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
<multibuild>
|
||||
<package>luajit</package>
|
||||
<package>lua51</package>
|
||||
<package>lua53</package>
|
||||
<package>lua54</package>
|
||||
</multibuild>
|
||||
|
||||
@@ -1,3 +1,20 @@
|
||||
-------------------------------------------------------------------
|
||||
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>
|
||||
|
||||
- Add Lua54 headers to build lua-lgi:luajit.
|
||||
- Fix GLib 2.86 regression (boo#1250526)
|
||||
Refer to https://github.com/lgi-devs/lgi/issues/346
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Wed Jan 25 11:52:07 UTC 2023 - Michal Suchanek <msuchanek@suse.de>
|
||||
|
||||
|
||||
@@ -26,7 +26,12 @@ License: MIT
|
||||
Group: Development/Languages/Other
|
||||
URL: https://github.com/pavouk/lgi
|
||||
Source0: https://github.com/pavouk/%{mod_name}/archive/%{version}.tar.gz#/%{mod_name}-%{version}.tar.gz
|
||||
Patch: lua54.patch
|
||||
Patch0: lua54.patch
|
||||
# PATCH-FIX-UPSTREAM 001-Fix-GLib-2.86-regression.patch boo#1250526
|
||||
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
|
||||
BuildRequires: lua-macros
|
||||
BuildRequires: %{flavor}-devel
|
||||
BuildRequires: pkgconfig
|
||||
@@ -50,6 +55,7 @@ directly from Lua.
|
||||
%package doc
|
||||
Summary: Lua bindings to GObject libraries - documentation and samples
|
||||
Group: Documentation/Other
|
||||
BuildArch: noarch
|
||||
|
||||
%description doc
|
||||
Dynamic Lua binding to any library which is introspectable
|
||||
@@ -58,6 +64,7 @@ directly from Lua.
|
||||
|
||||
%prep
|
||||
%autosetup -n %{mod_name}-%{version} -p1
|
||||
find . -name \*.lua -exec sed -i -e 's,# *\! *%{_bindir}/.*lua,#!%{_bindir}/lua,' '{}' +;
|
||||
|
||||
%build
|
||||
make %{?_smp_mflags} V=1 \
|
||||
|
||||
14
lua54.patch
14
lua54.patch
@@ -1,8 +1,12 @@
|
||||
diff --git a/lgi/callable.c b/lgi/callable.c
|
||||
index e96d3af..3234b64 100644
|
||||
--- a/lgi/callable.c
|
||||
+++ b/lgi/callable.c
|
||||
@@ -1355,7 +1355,10 @@ closure_callback (ffi_cif *cif, void *ret, void **args, void *closure_arg)
|
||||
---
|
||||
lgi/callable.c | 5 ++++-
|
||||
1 file changed, 4 insertions(+), 1 deletion(-)
|
||||
|
||||
Index: lgi-0.9.2/lgi/callable.c
|
||||
===================================================================
|
||||
--- lgi-0.9.2.orig/lgi/callable.c 2025-10-13 00:33:58.706698128 +0200
|
||||
+++ lgi-0.9.2/lgi/callable.c 2025-10-13 00:34:00.871294396 +0200
|
||||
@@ -1233,7 +1233,10 @@
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
79
warnings-away.patch
Normal file
79
warnings-away.patch
Normal 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, ¶ms[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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user