Gentoo Archives: gentoo-commits

From: "Robin H. Johnson" <robbat2@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-lua/lgi/
Date: Sun, 29 Nov 2020 00:28:20
Message-Id: 1606609694.0e95c6e912a781a82fa7394ca5a4aa0dc92b2b8b.robbat2@gentoo
1 commit: 0e95c6e912a781a82fa7394ca5a4aa0dc92b2b8b
2 Author: Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
3 AuthorDate: Sun Nov 29 00:27:10 2020 +0000
4 Commit: Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
5 CommitDate: Sun Nov 29 00:28:14 2020 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=0e95c6e9
7
8 dev-lua/lgi: revbump with slotted lua support
9
10 Builds & passes all src_test runs with Xvfb on lua5.1..5.3.
11 Not tested with luajit, but presumed to work.
12
13 Signed-off-by: Robin H. Johnson <robbat2 <AT> gentoo.org>
14
15 dev-lua/lgi/lgi-0.9.2-r100.ebuild | 124 ++++++++++++++++++++++++++++++++++++++
16 1 file changed, 124 insertions(+)
17
18 diff --git a/dev-lua/lgi/lgi-0.9.2-r100.ebuild b/dev-lua/lgi/lgi-0.9.2-r100.ebuild
19 new file mode 100644
20 index 00000000000..908e5804dfb
21 --- /dev/null
22 +++ b/dev-lua/lgi/lgi-0.9.2-r100.ebuild
23 @@ -0,0 +1,124 @@
24 +# Copyright 1999-2020 Gentoo Authors
25 +# Distributed under the terms of the GNU General Public License v2
26 +
27 +EAPI=7
28 +
29 +VIRTUALX_REQUIRED="manual"
30 +LUA_COMPAT=( lua5-{1..3} luajit )
31 +
32 +inherit lua eutils toolchain-funcs flag-o-matic virtualx
33 +
34 +DESCRIPTION="Lua bindings using gobject-introspection"
35 +HOMEPAGE="https://github.com/pavouk/lgi"
36 +SRC_URI="https://github.com/pavouk/lgi/archive/${PV}.tar.gz -> ${P}.tar.gz"
37 +
38 +LICENSE="MIT"
39 +SLOT="0"
40 +KEYWORDS="~amd64 ~arm ~ppc ~ppc64 ~x86"
41 +IUSE="examples test"
42 +RESTRICT="!test? ( test )"
43 +REQUIRED_USE="${LUA_REQUIRED_USE}"
44 +
45 +BDEPEND="${LUA_DEPS}"
46 +RDEPEND="${LUA_DEPS}
47 + dev-libs/gobject-introspection
48 + dev-libs/glib
49 + dev-libs/libffi:0="
50 +DEPEND="${RDEPEND}
51 + test? (
52 + x11-libs/cairo[glib]
53 + x11-libs/gtk+[introspection]
54 + ${VIRTUALX_DEPEND}
55 + )"
56 +
57 +lua_src_prepare() {
58 + pushd "${BUILD_DIR}" || die
59 + # The Makefile & several source files use the LUA version as part of the
60 + # direct filename, dynamically created, and we respect that.
61 + _slug=${ELUA}
62 + _slug=${_slug/.}
63 + _slug=${_slug/-}
64 + _slug=${_slug/_}
65 +
66 + # Makefile: CORE = corelgilua51.so (and similar lines)
67 + sed -r -i \
68 + -e "/^CORE\>/s,lua5.,${_slug},g" \
69 + lgi/Makefile \
70 + || die "sed failed"
71 +
72 + # ./lgi/core.lua:local core = require 'lgi.corelgilua51'
73 + # ./lgi/core.c:luaopen_lgi_corelgilua51 (lua_State* L)
74 + sed -r -i \
75 + -e "/lgi.corelgilua5./s,lua5.,${_slug},g" \
76 + lgi/core.lua \
77 + lgi/core.c \
78 + || die "sed failed"
79 +
80 + # Verify the change as it's important!
81 + for f in lgi/core.lua lgi/core.c lgi/Makefile ; do
82 + grep -sq "corelgi${_slug}" "${f}" || die "Failed to sed .lua & .c for corelgi${_slug}: ${f}"
83 + done
84 +
85 + # Cleanup
86 + unset _slug
87 + popd
88 +}
89 +
90 +src_prepare() {
91 + default
92 + lua_copy_sources
93 + lua_foreach_impl lua_src_prepare
94 +}
95 +
96 +lgi_emake_wrapper() {
97 + emake \
98 + CC="$(tc-getCC)" \
99 + COPTFLAGS="-Wall -Wextra ${CFLAGS}" \
100 + LIBFLAG="-shared ${LDFLAGS}" \
101 + LUA_CFLAGS="$(lua_get_CFLAGS)" \
102 + LUA="${LUA}" \
103 + LUA_VERSION="${ELUA#lua}" \
104 + LUA_LIBDIR="$(lua_get_cmod_dir)" \
105 + LUA_SHAREDIR="$(lua_get_lmod_dir)" \
106 + "$@"
107 +}
108 +
109 +lua_src_compile() {
110 + pushd "${BUILD_DIR}" || die
111 + lgi_emake_wrapper all
112 + popd
113 +}
114 +
115 +src_compile() {
116 + lua_foreach_impl lua_src_compile
117 +}
118 +
119 +lua_src_test() {
120 + pushd "${BUILD_DIR}" || die
121 + virtx \
122 + lgi_emake_wrapper \
123 + check
124 + popd
125 +}
126 +
127 +src_test() {
128 + lua_foreach_impl lua_src_test
129 +}
130 +
131 +lua_src_install() {
132 + pushd "${BUILD_DIR}" || die
133 + lgi_emake_wrapper \
134 + DESTDIR="${D}" \
135 + install
136 + popd
137 +}
138 +
139 +src_install() {
140 + lua_foreach_impl lua_src_install
141 + docompress -x /usr/share/doc/${PF}
142 + dodoc README.md
143 + dodoc -r docs/*
144 + if use examples; then
145 + dodoc -r samples
146 + fi
147 +}