commit:     86ec2f36b390c8de96fea533005a3568c5ee3689
Author:     Nicolas PARLANT <nicolas.parlant <AT> parhuet <DOT> fr>
AuthorDate: Mon Jan  5 14:01:25 2026 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Jan  5 23:31:10 2026 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=86ec2f36

dev-lua/lgi: add 0.9.2_p20251219

update EAPI 7 -> 8
fix redirect HOMEPAGE/gh_repo

add snapshot with meson, bugfixes, gtk4 support

add missing sys-apps/dbus (dbus-run-session), x11-misc/xvfb-run for tests

patch to fix pango_test and progress_test

always install examples (~460k)

Closes: https://bugs.gentoo.org/836839
Signed-off-by: Nicolas PARLANT <nicolas.parlant <AT> parhuet.fr>
Part-of: https://github.com/gentoo/gentoo/pull/45262
Closes: https://github.com/gentoo/gentoo/pull/45262
Signed-off-by: Sam James <sam <AT> gentoo.org>

 dev-lua/lgi/Manifest                             |   1 +
 dev-lua/lgi/files/lgi-0.9.2-fix_tests.patch      |  36 +++++++
 dev-lua/lgi/files/lgi-0.9.2-multi_lua_impl.patch |  32 ++++++
 dev-lua/lgi/lgi-0.9.2_p20251219.ebuild           | 131 +++++++++++++++++++++++
 dev-lua/lgi/metadata.xml                         |   2 +-
 5 files changed, 201 insertions(+), 1 deletion(-)

diff --git a/dev-lua/lgi/Manifest b/dev-lua/lgi/Manifest
index efb51f2dc859..928e937d7383 100644
--- a/dev-lua/lgi/Manifest
+++ b/dev-lua/lgi/Manifest
@@ -1 +1,2 @@
 DIST lgi-0.9.2.tar.gz 291463 BLAKE2B 
d89752e7c56f9a695f97f90680515fd9acab57991121ec3455fcd88aa0b64828f060d9bf222fb1ab14bdfc956ec3ad296af848168532d09694a0cacbb55dac71
 SHA512 
755a96b78530f42da6d4e2664f8e37cb07a356419e7e6448003c3f841c9d98ad18b851715d9eb203ea7eb27b13ec46223fa8a1c90a99fd12960ce85b0a695335
+DIST lgi-0.9.2_p20251219.tar.gz 305320 BLAKE2B 
d60a873873eec2784e3cc90c59eb0264502a4ad60363a04bdf7b81a5bc5850b230a80923f30602a0f6b57d653854563897a9a671ef884c0e3a8ed6f4371c2192
 SHA512 
92dd53f441601deff970eb02a002d763c69fcba82b3067d92fd69e92042e4f6e4e5f98c22e0a044a9b34d62799880af858c3454018f46ae071e93aecedb0cbdf

diff --git a/dev-lua/lgi/files/lgi-0.9.2-fix_tests.patch 
b/dev-lua/lgi/files/lgi-0.9.2-fix_tests.patch
new file mode 100644
index 000000000000..be6527ceb79a
--- /dev/null
+++ b/dev-lua/lgi/files/lgi-0.9.2-fix_tests.patch
@@ -0,0 +1,36 @@
+#1 PR pending https://github.com/lgi-devs/lgi/pull/342.patch
+fix test with pango >= 1.56.2
+--- a/tests/pango.lua
++++ b/tests/pango.lua
+@@ -35,8 +35,7 @@ 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)
++      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')
+
+#2 failing progress.lua, see https://github.com/lgi-devs/lgi/issues/348
+fixed by a fork 
https://github.com/vtrlx/LuaGObject/commit/cd261460f275ea07a4b47cc0c9d0113e17f98b11.patch
+--- a/tests/progress.lua
++++ b/tests/progress.lua
+@@ -11,6 +11,7 @@
+ local lgi = require 'lgi'
+ local Gio = lgi.Gio
+ local GLib = lgi.GLib
++local GObject = lgi.GObject
+ 
+ local check = testsuite.check
+ 
+@@ -46,6 +47,7 @@ function progress.file_copy()
+     end
+ 
+     src:copy_async(dst, flags, priority, cancellable,
+-                 progress_callback, finish_callback)
++                 GObject.Closure (progress_callback),
++                 GObject.Closure (finish_callback))
+     loop:run()
+ end

diff --git a/dev-lua/lgi/files/lgi-0.9.2-multi_lua_impl.patch 
b/dev-lua/lgi/files/lgi-0.9.2-multi_lua_impl.patch
new file mode 100644
index 000000000000..728d5068db19
--- /dev/null
+++ b/dev-lua/lgi/files/lgi-0.9.2-multi_lua_impl.patch
@@ -0,0 +1,32 @@
+allow lua multi-implementation
+@GENTOO_LUA_VERSION@ will be replaced after sources copied for each lua 
implementation
+--- a/lgi/core.c
++++ b/lgi/core.c
+@@ -697,7 +697,7 @@ set_resident (lua_State *L)
+ }
+ 
+ G_MODULE_EXPORT int
+-luaopen_lgi_corelgilua51 (lua_State* L)
++luaopen_lgi_corelgi@GENTOO_LUA_VERSION@ (lua_State* L)
+ {
+   LgiStateMutex *mutex;
+   gint state_id;
+--- a/lgi/core.lua
++++ b/lgi/core.lua
+@@ -11,7 +11,7 @@
+ -- This module decides what kind of core routines should be loaded.
+ -- Currently only one implementation exists, standard-Lua C-side
+ -- implementation, LuaJIT-FFI-based one is planned.
+-local core = require 'lgi.corelgilua51'
++local core = require 'lgi.corelgi@GENTOO_LUA_VERSION@'
+ 
+ -- Helper methods for converting between CamelCase and uscore_delim
+ -- names.
+--- a/lgi/meson.build
++++ b/lgi/meson.build
+@@ -1,4 +1,4 @@
+-liblgi = shared_module('corelgilua51',
++liblgi = shared_module('corelgi@GENTOO_LUA_VERSION@',
+   sources: [
+     'buffer.c',
+     'callable.c',

diff --git a/dev-lua/lgi/lgi-0.9.2_p20251219.ebuild 
b/dev-lua/lgi/lgi-0.9.2_p20251219.ebuild
new file mode 100644
index 000000000000..2ced8e9f984b
--- /dev/null
+++ b/dev-lua/lgi/lgi-0.9.2_p20251219.ebuild
@@ -0,0 +1,131 @@
+# Copyright 1999-2026 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+VIRTUALX_REQUIRED="manual"
+LUA_COMPAT=( lua5-{1..4} luajit )
+inherit lua meson virtualx
+
+DESCRIPTION="Lua bindings using gobject-introspection"
+HOMEPAGE="https://github.com/lgi-devs/lgi";
+if [[ ${PV} == *_p* ]]; then
+       HASH_COMMIT="a1308b23b07a787d21fad86157b0b60eb3079f64"
+       SRC_URI="https://github.com/lgi-devs/lgi/archive/${HASH_COMMIT}.tar.gz 
-> ${P}.tar.gz"
+       S="${WORKDIR}/${PN}-${HASH_COMMIT}"
+else
+       SRC_URI="https://github.com/lgi-devs/lgi/archive/${PV}.tar.gz -> 
${P}.tar.gz"
+fi
+
+LICENSE="MIT"
+SLOT="0"
+KEYWORDS="~amd64 ~arm ~arm64 ~loong ~ppc ~ppc64 ~riscv ~x86"
+IUSE="test"
+RESTRICT="!test? ( test )"
+REQUIRED_USE="${LUA_REQUIRED_USE}"
+
+BDEPEND="
+       ${LUA_DEPS}
+       virtual/pkgconfig
+       test? (
+               ${VIRTUALX_DEPEND}
+               sys-apps/dbus
+               x11-misc/xvfb-run
+       )
+"
+RDEPEND="
+       ${LUA_DEPS}
+       >=dev-libs/gobject-introspection-1.82.0-r2
+       dev-libs/glib:2
+       dev-libs/libffi:0=
+"
+DEPEND="
+       ${RDEPEND}
+       test? (
+               x11-libs/cairo[glib,X]
+               || (
+                       x11-libs/gtk+:3[introspection,X]
+                       gui-libs/gtk:4[introspection,X]
+               )
+       )
+"
+
+PATCHES=(
+       "${FILESDIR}"/${PN}-0.9.2-multi_lua_impl.patch
+       "${FILESDIR}"/${PN}-0.9.2-fix_tests.patch
+)
+
+lua_src_prepare() {
+       pushd "${BUILD_DIR}" || die
+       #  lgi/meson.build & several source files use the LUA version as part 
of the
+       # direct filename, dynamically created, and we respect that.
+
+       # replace @GENTOO_LUA_VERSION@ with lua version in patched files:
+       # lgi/core.c:luaopen_lgi_corelgilua51 (lua_State* L)
+       # lgi/core.lua:local core = require 'lgi.corelgilua51'
+       # lgi/meson.build: liblgi = shared_module('corelgilua51'
+       sed -i \
+               -e "s/@GENTOO_LUA_VERSION@/${ELUA/.}/" \
+               lgi/core.c \
+               lgi/core.lua \
+               lgi/meson.build \
+               || die "sed failed"
+
+       popd
+}
+
+src_prepare() {
+       default
+       lua_copy_sources
+       lua_foreach_impl lua_src_prepare
+}
+
+lua_src_configure() {
+       local emesonargs=(
+               -Dlua-pc="${ELUA}"
+               -Dlua-bin="${LUA}"
+               $(meson_use test tests)
+       )
+       EMESON_SOURCE="${BUILD_DIR}" \
+       BUILD_DIR="${BUILD_DIR}-meson" \
+       meson_src_configure
+}
+
+src_configure() {
+       lua_foreach_impl lua_src_configure
+}
+
+lua_src_compile() {
+       EMESON_SOURCE="${BUILD_DIR}" \
+       BUILD_DIR="${BUILD_DIR}-meson" \
+       meson_src_compile
+}
+
+src_compile() {
+       lua_foreach_impl lua_src_compile
+}
+
+lua_src_test() {
+       if [[ ${ELUA} == luajit ]]; then
+               einfo "Tests are currently not supported on LuaJIT"
+       else
+               BUILD_DIR="${BUILD_DIR}-meson" \
+               virtx meson_src_test
+       fi
+}
+
+src_test() {
+       lua_foreach_impl lua_src_test
+}
+
+lua_src_install() {
+       BUILD_DIR="${BUILD_DIR}-meson" \
+       meson_install
+}
+
+src_install() {
+       lua_foreach_impl lua_src_install
+       local DOCS=( README.md docs/. samples )
+       docompress -x /usr/share/doc/${PF}/samples
+       einstalldocs
+}

diff --git a/dev-lua/lgi/metadata.xml b/dev-lua/lgi/metadata.xml
index 7ba0b6fbaa30..c4f09fac82f4 100644
--- a/dev-lua/lgi/metadata.xml
+++ b/dev-lua/lgi/metadata.xml
@@ -5,6 +5,6 @@
     <email>[email protected]</email>
   </maintainer>
   <upstream>
-    <remote-id type="github">pavouk/lgi</remote-id>
+    <remote-id type="github">lgi-devs/lgi</remote-id>
   </upstream>
 </pkgmetadata>

Reply via email to