summaryrefslogtreecommitdiff
blob: e3c4a87c18c95c1b2da1c562d6f7e7b13c37551a (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
# Copyright 1999-2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=7

inherit toolchain-funcs

DESCRIPTION="Lightweight, native, lazy evaluating multithreading library"
HOMEPAGE="https://github.com/LuaLanes/lanes"
SRC_URI="https://github.com/LuaLanes/lanes/archive/v${PV}.tar.gz -> ${P}.tar.gz"

LICENSE="MIT"
SLOT="0"
KEYWORDS="~amd64 ~arm ~arm64 ~x86"
IUSE="luajit test"
RESTRICT="!test? ( test )"

RDEPEND="
	luajit? ( dev-lang/luajit:2 )
	!luajit? ( dev-lang/lua:0 )
"

DEPEND="${RDEPEND}"

BDEPEND="
	virtual/pkgconfig
	test? ( ${RDEPEND} )
"

HTML_DOCS=( "docs/." )

PATCHES=( "${FILESDIR}/${PN}-3.13.0-makefile.patch" )

src_compile() {
	local myemakeargs=(
		"CC=$(tc-getCC)"
		"LUA=$(usex luajit 'luajit' 'lua')"
		"LUA_FLAGS=-I$($(tc-getPKG_CONFIG) --variable $(usex luajit 'includedir' 'INSTALL_INC') $(usex luajit 'luajit' 'lua'))"
		"LUA_LIBS="
		"OPT_FLAGS=${CFLAGS}"
	)

	emake "${myemakeargs[@]}"
}

src_test() {
	emake LUA=$(usex luajit 'luajit' 'lua') test
}

src_install() {
	local myemakeargs=(
		"LUA_LIBDIR=${ED}/$($(tc-getPKG_CONFIG) --variable INSTALL_CMOD $(usex luajit 'luajit' 'lua'))"
		"LUA_SHAREDIR=${ED}/$($(tc-getPKG_CONFIG) --variable INSTALL_LMOD $(usex luajit 'luajit' 'lua'))"
	)

	emake "${myemakeargs[@]}" install

	einstalldocs
}