summaryrefslogtreecommitdiff
path: root/dev-lua/lua-psl/lua-psl-0.3_p20201126.ebuild
blob: 38a44848e0ef6d5296a6c0463e538fdfda288314 (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
# Copyright 2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

LUA_COMPAT=( lua5-{1,3,4} luajit )

inherit edo lua toolchain-funcs

DESCRIPTION="Lua bindings to libpsl"
HOMEPAGE="https://github.com/daurnimator/lua-psl"
EGIT_COMMIT="25f9c32336aea171ea1bdb715d755bc25b18887a"
SRC_URI="https://github.com/daurnimator/${PN}/archive/${EGIT_COMMIT}.tar.gz -> ${P}.tar.gz"

S="${WORKDIR}/${PN}-${EGIT_COMMIT}"

LICENSE="MIT"
SLOT="0"
KEYWORDS="~amd64"

IUSE="doc"
REQUIRED_USE="${LUA_REQUIRED_USE}"

DEPEND="
	${LUA_DEPS}
	net-libs/libpsl
"
RDEPEND="${DEPEND}"
BDEPEND="doc? ( virtual/pandoc )"

lua_enable_tests busted "${BUILD_DIR}"

src_prepare() {
	default
	lua_copy_sources
}

lua_src_compile() {
	cd "${BUILD_DIR}" || die
	edo $(tc-getCC) -shared -fPIC \
	${CPPFLAGS} \
	${CFLAGS} $(lua_get_CFLAGS) \
	${LDFLAGS} $(lua_get_LIBS) \
	${SOFLAGS} \
	-o psl.so psl/psl.c -lpsl
}

src_compile() {
	use doc && emake -C doc lua-psl.html
	lua_foreach_impl lua_src_compile
}

lua_src_test() {
	cd "${BUILD_DIR}" || die
	busted --lua="${ELUA}" --output="plainTerminal" "${BUILD_DIR}" || die "Tests fail with ${ELUA}"
}

src_test() {
	lua_foreach_impl lua_src_test
}

lua_src_install() {
	exeinto $(lua_get_cmod_dir)/
	doexe "${BUILD_DIR}"/psl.so
}

src_install() {
	lua_foreach_impl lua_src_install
	use doc && local HTML_DOCS=( doc/lua-psl.html )
	doman "${FILESDIR}"/lua-psl.3
	einstalldocs
}