dev-lua/lgi: add 0.9.2_p20260407 w/ fix for glib-2.88

new snapshot with support for lua5.5 (upstream, not Gentoo)
add a patch (adopted by Debian and Fedora) for >=glib-2.87

Closes: https://bugs.gentoo.org/973586
Signed-off-by: Nicolas PARLANT <nicolas.parlant@parhuet.fr>
Part-of: https://codeberg.org/gentoo/gentoo/pulls/821
Merges: https://codeberg.org/gentoo/gentoo/pulls/821
Signed-off-by: Sam James <sam@gentoo.org>
This commit is contained in:
Nicolas PARLANT
2026-05-04 11:11:15 +02:00
committed by Sam James
parent cf464b7205
commit 5d34eb1bf7
3 changed files with 165 additions and 0 deletions
+1
View File
@@ -1,2 +1,3 @@
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
DIST lgi-0.9.2_p20260407.tar.gz 305354 BLAKE2B ca937513a7db2a3a37926db2a7e3a31d1afdd9cb33ab312540e461f7b06453e6d8a16f98580b5f6f891ea9be39c1dbc7fbbbf62b3890c829bef78a7d2a31a3f5 SHA512 8a302d72c8faf02e89389b599e9159b36d4d89ed91db266c1c2591ce6239a4781d535965011664728f1ef588d092d35477b3cf03bcea6440b4c94d4f9e9c1580
@@ -0,0 +1,32 @@
see PR pending https://github.com/lgi-devs/lgi/pull/352.patch
fix https://bugs.gentoo.org/973586
ffi: conform load_enum to GLib 2.87.0
--- a/lgi/ffi.lua
+++ b/lgi/ffi.lua
@@ -75,16 +75,22 @@ 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 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
type_class:unref()
return enum_component
+132
View File
@@ -0,0 +1,132 @@
# 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="dfa82978d0f0f1ed1e817c9f0c5ea46824069e34"
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
"${FILESDIR}"/${PN}-0.9.2-fix_glib287.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
}