Diff lgi-0.9.2-r100 with a lgi-0.9.2_p20260407

/usr/portage/dev-lua/lgi/lgi-0.9.2_p20260407.ebuild 2026-07-11 20:03:05.970342310 +0300
1
# Copyright 1999-2025 Gentoo Authors
1
# Copyright 1999-2026 Gentoo Authors
2 2
# Distributed under the terms of the GNU General Public License v2
3 3

  
4
EAPI=7
4
EAPI=8
5 5

  
6 6
VIRTUALX_REQUIRED="manual"
7 7
LUA_COMPAT=( lua5-{1..4} luajit )
8

  
9
inherit lua toolchain-funcs virtualx
8
inherit lua meson virtualx
10 9

  
11 10
DESCRIPTION="Lua bindings using gobject-introspection"
12
HOMEPAGE="https://github.com/pavouk/lgi"
13
SRC_URI="https://github.com/pavouk/lgi/archive/${PV}.tar.gz -> ${P}.tar.gz"
11
HOMEPAGE="https://github.com/lgi-devs/lgi"
12
if [[ ${PV} == *_p* ]]; then
13
	HASH_COMMIT="dfa82978d0f0f1ed1e817c9f0c5ea46824069e34"
14
	SRC_URI="https://github.com/lgi-devs/lgi/archive/${HASH_COMMIT}.tar.gz -> ${P}.tar.gz"
15
	S="${WORKDIR}/${PN}-${HASH_COMMIT}"
16
else
17
	SRC_URI="https://github.com/lgi-devs/lgi/archive/${PV}.tar.gz -> ${P}.tar.gz"
18
fi
14 19

  
15 20
LICENSE="MIT"
16 21
SLOT="0"
17 22
KEYWORDS="amd64 arm ~arm64 ~loong ppc ppc64 ~riscv x86"
18
IUSE="examples test"
23
IUSE="test"
19 24
RESTRICT="!test? ( test )"
20 25
REQUIRED_USE="${LUA_REQUIRED_USE}"
21 26

  
22
BDEPEND="${LUA_DEPS}"
23
RDEPEND="${LUA_DEPS}
24
		>=dev-libs/gobject-introspection-1.82.0-r2
25
		dev-libs/glib
26
		dev-libs/libffi:0="
27
DEPEND="${RDEPEND}
28
		test? (
29
			x11-libs/cairo[glib]
30
			x11-libs/gtk+[introspection]
31
			${VIRTUALX_DEPEND}
32
		)"
33

  
34
PATCHES=( "${FILESDIR}/${P}-lua54.patch" )
27
BDEPEND="
28
	${LUA_DEPS}
29
	virtual/pkgconfig
30
	test? (
31
		${VIRTUALX_DEPEND}
32
		sys-apps/dbus
33
		x11-misc/xvfb-run
34
	)
35
"
36
RDEPEND="
37
	${LUA_DEPS}
38
	>=dev-libs/gobject-introspection-1.82.0-r2
39
	dev-libs/glib:2
40
	dev-libs/libffi:0=
41
"
42
DEPEND="
43
	${RDEPEND}
44
	test? (
45
		x11-libs/cairo[glib,X]
46
		|| (
47
			x11-libs/gtk+:3[introspection,X]
48
			gui-libs/gtk:4[introspection,X]
49
		)
50
	)
51
"
52

  
53
PATCHES=(
54
	"${FILESDIR}"/${PN}-0.9.2-multi_lua_impl.patch
55
	"${FILESDIR}"/${PN}-0.9.2-fix_tests.patch
56
	"${FILESDIR}"/${PN}-0.9.2-fix_glib287.patch
57
	"${FILESDIR}"/${PN}-0.9.2-skip_tests_5-1.patch
58
)
35 59

  
36 60
lua_src_prepare() {
37 61
	pushd "${BUILD_DIR}" || die
38
	# The Makefile & several source files use the LUA version as part of the
62
	#  lgi/meson.build & several source files use the LUA version as part of the
39 63
	# direct filename, dynamically created, and we respect that.
40
	_slug=${ELUA}
41
	_slug=${_slug/.}
42
	_slug=${_slug/-}
43
	_slug=${_slug/_}
44

  
45
	# Makefile: CORE = corelgilua51.so (and similar lines)
46
	sed -r -i \
47
		-e "/^CORE\>/s,lua5.,${_slug},g" \
48
		lgi/Makefile \
49
		|| die "sed failed"
50 64

  
51
	# ./lgi/core.lua:local core = require 'lgi.corelgilua51'
52
	# ./lgi/core.c:luaopen_lgi_corelgilua51 (lua_State* L)
53
	sed -r -i \
54
		-e "/lgi.corelgilua5./s,lua5.,${_slug},g" \
55
		lgi/core.lua \
65
	# replace @GENTOO_LUA_VERSION@ with lua version in patched files:
66
	# lgi/core.c:luaopen_lgi_corelgilua51 (lua_State* L)
67
	# lgi/core.lua:local core = require 'lgi.corelgilua51'
68
	# lgi/meson.build: liblgi = shared_module('corelgilua51'
69
	sed -i \
70
		-e "s/@GENTOO_LUA_VERSION@/${ELUA/.}/" \
56 71
		lgi/core.c \
72
		lgi/core.lua \
73
		lgi/meson.build \
57 74
		|| die "sed failed"
58 75

  
59
	# Verify the change as it's important!
60
	for f in lgi/core.lua lgi/core.c lgi/Makefile ; do
61
		grep -sq "corelgi${_slug}" "${f}" || die "Failed to sed .lua & .c for corelgi${_slug}: ${f}"
62
	done
63

  
64
	# Cleanup
65
	unset _slug
66 76
	popd
67 77
}
68 78

  
......
72 82
	lua_foreach_impl lua_src_prepare
73 83
}
74 84

  
75
lgi_emake_wrapper() {
76
	emake \
77
	CC="$(tc-getCC)" \
78
	COPTFLAGS="-Wall -Wextra ${CFLAGS}" \
79
	LIBFLAG="-shared ${LDFLAGS}" \
80
	LUA_CFLAGS="$(lua_get_CFLAGS)" \
81
	LUA="${LUA}" \
82
	LUA_VERSION="${ELUA#lua}" \
83
	LUA_LIBDIR="$(lua_get_cmod_dir)" \
84
	LUA_SHAREDIR="$(lua_get_lmod_dir)" \
85
	"$@"
85
lua_src_configure() {
86
	local emesonargs=(
87
		-Dlua-pc="${ELUA}"
88
		-Dlua-bin="${LUA}"
89
		$(meson_use test tests)
90
	)
91
	EMESON_SOURCE="${BUILD_DIR}" \
92
	BUILD_DIR="${BUILD_DIR}-meson" \
93
	meson_src_configure
94
}
95

  
96
src_configure() {
97
	lua_foreach_impl lua_src_configure
86 98
}
87 99

  
88 100
lua_src_compile() {
89
	pushd "${BUILD_DIR}" || die
90
	lgi_emake_wrapper all
91
	popd
101
	EMESON_SOURCE="${BUILD_DIR}" \
102
	BUILD_DIR="${BUILD_DIR}-meson" \
103
	meson_src_compile
92 104
}
93 105

  
94 106
src_compile() {
......
96 108
}
97 109

  
98 110
lua_src_test() {
99
	pushd "${BUILD_DIR}" || die
100

  
101 111
	if [[ ${ELUA} == luajit ]]; then
102 112
		einfo "Tests are currently not supported on LuaJIT"
103 113
	else
104
		virtx \
105
			lgi_emake_wrapper \
106
			check
114
		BUILD_DIR="${BUILD_DIR}-meson" \
115
		virtx meson_src_test
107 116
	fi
108
	popd
109 117
}
110 118

  
111 119
src_test() {
......
113 121
}
114 122

  
115 123
lua_src_install() {
116
	pushd "${BUILD_DIR}" || die
117
	lgi_emake_wrapper \
118
		DESTDIR="${D}" \
119
		install
120
	popd
124
	BUILD_DIR="${BUILD_DIR}-meson" \
125
	meson_install
121 126
}
122 127

  
123 128
src_install() {
124 129
	lua_foreach_impl lua_src_install
125
	docompress -x /usr/share/doc/${PF}
126
	dodoc README.md
127
	dodoc -r docs/*
128
	if use examples; then
129
		dodoc -r samples
130
	fi
130
	local DOCS=( README.md docs/. samples )
131
	docompress -x /usr/share/doc/${PF}/samples
132
	einstalldocs
131 133
}
Thank you!