1 |
commit: 370d960c1d6725cf89e35ea7e542405e532d6059 |
2 |
Author: Marek Szuba <marecki <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sat Nov 28 22:14:40 2020 +0000 |
4 |
Commit: Marek Szuba <marecki <AT> gentoo <DOT> org> |
5 |
CommitDate: Sat Nov 28 22:28:24 2020 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=370d960c |
7 |
|
8 |
dev-lua/mpack: migrate to lua.eclass |
9 |
|
10 |
Had to suppress tests for the luajit target (one of the tests |
11 |
checks for memory leaks and LuaJIT does leak memory) as well as prevent |
12 |
the module from being unnecessarily linked against liblua (upstream have |
13 |
already fixed this, unfortunately a bump to a recent version would not be |
14 |
trivial). Otherwise, simple enough. |
15 |
|
16 |
Closes: https://bugs.gentoo.org/752906 |
17 |
Signed-off-by: Marek Szuba <marecki <AT> gentoo.org> |
18 |
|
19 |
dev-lua/mpack/mpack-1.0.4-r100.ebuild | 86 +++++++++++++++++++++++++++++++++++ |
20 |
profiles/package.mask | 1 + |
21 |
2 files changed, 87 insertions(+) |
22 |
|
23 |
diff --git a/dev-lua/mpack/mpack-1.0.4-r100.ebuild b/dev-lua/mpack/mpack-1.0.4-r100.ebuild |
24 |
new file mode 100644 |
25 |
index 00000000000..7aca1045a87 |
26 |
--- /dev/null |
27 |
+++ b/dev-lua/mpack/mpack-1.0.4-r100.ebuild |
28 |
@@ -0,0 +1,86 @@ |
29 |
+# Copyright 1999-2020 Gentoo Authors |
30 |
+# Distributed under the terms of the GNU General Public License v2 |
31 |
+ |
32 |
+EAPI=7 |
33 |
+ |
34 |
+LUA_COMPAT=( lua5-{1..3} luajit ) |
35 |
+ |
36 |
+inherit lua toolchain-funcs |
37 |
+ |
38 |
+DESCRIPTION="Lua bindings for libmpack" |
39 |
+HOMEPAGE="https://github.com/libmpack/libmpack/" |
40 |
+SRC_URI="https://github.com/libmpack/libmpack/archive/${PV}.tar.gz -> ${P}.tar.gz" |
41 |
+S="${WORKDIR}/libmpack-${PV}/binding/lua" |
42 |
+ |
43 |
+LICENSE="MIT" |
44 |
+SLOT="0" |
45 |
+KEYWORDS="~amd64 ~arm ~arm64 ~x86" |
46 |
+IUSE="test" |
47 |
+RESTRICT="!test? ( test )" |
48 |
+ |
49 |
+RDEPEND="${LUA_DEPS}" |
50 |
+DEPEND="${RDEPEND}" |
51 |
+BDEPEND="virtual/pkgconfig |
52 |
+ test? ( |
53 |
+ ${RDEPEND} |
54 |
+ dev-lua/busted[${LUA_USEDEP}] |
55 |
+ )" |
56 |
+ |
57 |
+lua_src_compile() { |
58 |
+ # Make sure we have got no leftovers from other implementations. |
59 |
+ # There is no 'clean' target in the makefile, though. |
60 |
+ rm -f ${PN}.so |
61 |
+ |
62 |
+ # We set LUA_LIB to an empty string while building version 1.0.4 because |
63 |
+ # compiled Lua modules must not link against liblua. This has already been |
64 |
+ # fixed upstream. |
65 |
+ emake \ |
66 |
+ CC="$(tc-getCC)" \ |
67 |
+ USE_SYSTEM_LUA=yes \ |
68 |
+ LUA_INCLUDE="$(lua_get_CFLAGS)" \ |
69 |
+ LUA_LIB="" |
70 |
+ |
71 |
+ # Tag the result with current implementation and move it out of the way. |
72 |
+ mv ${PN}.so ${PN}-${ELUA}.so || die |
73 |
+} |
74 |
+ |
75 |
+src_compile() { |
76 |
+ lua_foreach_impl lua_src_compile |
77 |
+} |
78 |
+ |
79 |
+lua_src_test() { |
80 |
+ # "[ FAILED ] test.lua @ 279: mpack should not leak memory" |
81 |
+ # It doesn't seem upstream actually support LuaJIT so were this up to me |
82 |
+ # I would drop it from LUA_COMPAT, unfortunately there are packages in the |
83 |
+ # tree which currently expect it to be supported. |
84 |
+ if [[ ${ELUA} == "luajit" ]]; then |
85 |
+ ewarn "Not running tests under ${ELUA} because they are known to fail" |
86 |
+ return |
87 |
+ fi |
88 |
+ |
89 |
+ # The test suite must be able to find the module under its original name. |
90 |
+ rm -f ${PN}.so |
91 |
+ ln -s ${PN}-${ELUA}.so ${PN}.so || die |
92 |
+ busted --lua="${ELUA}" -o gtest test.lua || die |
93 |
+} |
94 |
+ |
95 |
+src_test() { |
96 |
+ lua_foreach_impl lua_src_test |
97 |
+} |
98 |
+ |
99 |
+lua_src_install() { |
100 |
+ # This time we move the correct library file back in order not to risk |
101 |
+ # confusing make with symlinks. |
102 |
+ mv ${PN}-${ELUA}.so ${PN}.so || die |
103 |
+ |
104 |
+ emake \ |
105 |
+ DESTDIR="${ED}" \ |
106 |
+ USE_SYSTEM_LUA=yes \ |
107 |
+ LUA_CMOD_INSTALLDIR="$(lua_get_cmod_dir)" \ |
108 |
+ install |
109 |
+} |
110 |
+ |
111 |
+src_install() { |
112 |
+ lua_foreach_impl lua_src_install |
113 |
+ einstalldocs |
114 |
+} |
115 |
|
116 |
diff --git a/profiles/package.mask b/profiles/package.mask |
117 |
index 9946a628585..ef27778a2a2 100644 |
118 |
--- a/profiles/package.mask |
119 |
+++ b/profiles/package.mask |
120 |
@@ -527,6 +527,7 @@ dev-lua/luacrypto |
121 |
>=dev-lua/luv-1.32.0.0-r100 |
122 |
>=dev-lua/mediator_lua-1.1.2_p0-r100 |
123 |
>=dev-lua/messagepack-0.3.2-r100 |
124 |
+>=dev-lua/mpack-1.0.4-r100 |
125 |
>=dev-lua/penlight-1.9.2-r100 |
126 |
>=dev-lua/say-1.3_p1-r100 |
127 |
>=dev-lua/toluapp-1.0.93_p20190513-r100 |