summaryrefslogtreecommitdiff
blob: c6ba6f30b956b3d81b233ca0429756eab636e61c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# Copyright 1999-2017 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2

EAPI=6

GITHUB_A="tarruda"
GITHUB_PN="libmpack"

inherit lua

DESCRIPTION="Lua bindings for libmpack"
HOMEPAGE="https://github.com/tarruda/libmpack/"

#S="${WORKDIR}/all/libmpack-${PV}/binding/lua"
LUA_S="libmpack-${PV}/binding/lua"

LICENSE="MIT"
SLOT="0"
KEYWORDS="~amd64 ~x86 ~arm ~arm64"
IUSE="luajit test"

RDEPEND="
	|| (
		virtual/lua[luajit=]
		!luajit? (
			|| (
				( virtual/lua dev-lang/lua:5.1 )
				>=dev-lang/lua-5.1:0
			)
		)
		luajit? (
			|| (
				virtual/lua[luajit]
				>=dev-lang/luajit-2
			)
		)
	)
"
DEPEND="
	${RDEPEND}
	virtual/pkgconfig
	test? ( dev-lua/busted )
"

each_lua_prepare() {
	# fixed in git HEAD
	sed \
		-e '/^LUA_/d' \
		-i Makefile

	if lua_is_jit; then
		# fixed in git HEAD
		sed \
			-e '1i#define luaL_reg luaL_Reg' \
			-i "${S}/lmpack.c"
	fi
}

each_lua_compile() {
	local myemakeargs=(
		USE_SYSTEM_LUA=yes
		MPACK_LUA_VERSION_NOPATCH="$(lua_get_abi)"
	)
	lua_default
}

each_lua_test() {
	${LUA} ${EROOT}/usr/bin/busted -o gtest test.lua || die
}

each_lua_install() {
	dolua "${PN}.so"
}