public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] repo/gentoo:master commit in: profiles/, dev-lua/mpack/
@ 2020-11-28 22:29 Marek Szuba
  0 siblings, 0 replies; only message in thread
From: Marek Szuba @ 2020-11-28 22:29 UTC (permalink / raw
  To: gentoo-commits

commit:     370d960c1d6725cf89e35ea7e542405e532d6059
Author:     Marek Szuba <marecki <AT> gentoo <DOT> org>
AuthorDate: Sat Nov 28 22:14:40 2020 +0000
Commit:     Marek Szuba <marecki <AT> gentoo <DOT> org>
CommitDate: Sat Nov 28 22:28:24 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=370d960c

dev-lua/mpack: migrate to lua.eclass

Had to suppress tests for the luajit target (one of the tests
checks for memory leaks and LuaJIT does leak memory) as well as prevent
the module from being unnecessarily linked against liblua (upstream have
already fixed this, unfortunately a bump to a recent version would not be
trivial). Otherwise, simple enough.

Closes: https://bugs.gentoo.org/752906
Signed-off-by: Marek Szuba <marecki <AT> gentoo.org>

 dev-lua/mpack/mpack-1.0.4-r100.ebuild | 86 +++++++++++++++++++++++++++++++++++
 profiles/package.mask                 |  1 +
 2 files changed, 87 insertions(+)

diff --git a/dev-lua/mpack/mpack-1.0.4-r100.ebuild b/dev-lua/mpack/mpack-1.0.4-r100.ebuild
new file mode 100644
index 00000000000..7aca1045a87
--- /dev/null
+++ b/dev-lua/mpack/mpack-1.0.4-r100.ebuild
@@ -0,0 +1,86 @@
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+LUA_COMPAT=( lua5-{1..3} luajit )
+
+inherit lua toolchain-funcs
+
+DESCRIPTION="Lua bindings for libmpack"
+HOMEPAGE="https://github.com/libmpack/libmpack/"
+SRC_URI="https://github.com/libmpack/libmpack/archive/${PV}.tar.gz -> ${P}.tar.gz"
+S="${WORKDIR}/libmpack-${PV}/binding/lua"
+
+LICENSE="MIT"
+SLOT="0"
+KEYWORDS="~amd64 ~arm ~arm64 ~x86"
+IUSE="test"
+RESTRICT="!test? ( test )"
+
+RDEPEND="${LUA_DEPS}"
+DEPEND="${RDEPEND}"
+BDEPEND="virtual/pkgconfig
+	test? (
+		${RDEPEND}
+		dev-lua/busted[${LUA_USEDEP}]
+	)"
+
+lua_src_compile() {
+	# Make sure we have got no leftovers from other implementations.
+	# There is no 'clean' target in the makefile, though.
+	rm -f ${PN}.so
+
+	# We set LUA_LIB to an empty string while building version 1.0.4 because
+	# compiled Lua modules must not link against liblua. This has already been
+	# fixed upstream.
+	emake \
+		CC="$(tc-getCC)" \
+		USE_SYSTEM_LUA=yes \
+		LUA_INCLUDE="$(lua_get_CFLAGS)" \
+		LUA_LIB=""
+
+	# Tag the result with current implementation and move it out of the way.
+	mv ${PN}.so ${PN}-${ELUA}.so || die
+}
+
+src_compile() {
+	lua_foreach_impl lua_src_compile
+}
+
+lua_src_test() {
+	# "[  FAILED  ] test.lua @ 279: mpack should not leak memory"
+	# It doesn't seem upstream actually support LuaJIT so were this up to me
+	# I would drop it from LUA_COMPAT, unfortunately there are packages in the
+	# tree which currently expect it to be supported.
+	if [[ ${ELUA} == "luajit" ]]; then
+		ewarn "Not running tests under ${ELUA} because they are known to fail"
+		return
+	fi
+
+	# The test suite must be able to find the module under its original name.
+	rm -f ${PN}.so
+	ln -s ${PN}-${ELUA}.so ${PN}.so || die
+	busted --lua="${ELUA}" -o gtest test.lua || die
+}
+
+src_test() {
+	lua_foreach_impl lua_src_test
+}
+
+lua_src_install() {
+	# This time we move the correct library file back in order not to risk
+	# confusing make with symlinks.
+	mv ${PN}-${ELUA}.so ${PN}.so || die
+
+	emake \
+		DESTDIR="${ED}" \
+		USE_SYSTEM_LUA=yes \
+		LUA_CMOD_INSTALLDIR="$(lua_get_cmod_dir)" \
+		install
+}
+
+src_install() {
+	lua_foreach_impl lua_src_install
+	einstalldocs
+}

diff --git a/profiles/package.mask b/profiles/package.mask
index 9946a628585..ef27778a2a2 100644
--- a/profiles/package.mask
+++ b/profiles/package.mask
@@ -527,6 +527,7 @@ dev-lua/luacrypto
 >=dev-lua/luv-1.32.0.0-r100
 >=dev-lua/mediator_lua-1.1.2_p0-r100
 >=dev-lua/messagepack-0.3.2-r100
+>=dev-lua/mpack-1.0.4-r100
 >=dev-lua/penlight-1.9.2-r100
 >=dev-lua/say-1.3_p1-r100
 >=dev-lua/toluapp-1.0.93_p20190513-r100


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2020-11-28 22:29 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-11-28 22:29 [gentoo-commits] repo/gentoo:master commit in: profiles/, dev-lua/mpack/ Marek Szuba

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox