summaryrefslogtreecommitdiff
blob: 2eb9fa97c1585b2ec17fb8d4c54b123658beeea3 (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-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=7

LUA_COMPAT=( lua5-{1..3} )
inherit lua-single autotools

DESCRIPTION="Universal configuration library parser"
HOMEPAGE="https://github.com/vstakhov/libucl"

if [[ ${PV} == 9999 ]]; then
	inherit git-r3
	EGIT_REPO_URI="https://github.com/vstakhov/libucl.git"
else
	SRC_URI="https://github.com/vstakhov/libucl/archive/${PV}.tar.gz -> ${P}.tar.gz"
	KEYWORDS="~amd64 ~x86"
fi

LICENSE="BSD-2"
SLOT="0"
IUSE="lua +regex sign urls +utils static-libs test"
REQUIRED_USE="lua? ( ${LUA_REQUIRED_USE} )"
RESTRICT="!test? ( test )"

DEPEND="!!dev-libs/ucl
	lua? ( ${LUA_DEPS} )
	urls? ( net-misc/curl )
	sign? ( dev-libs/openssl:0= )
"
BDEPEND="${DEPEND}
	virtual/pkgconfig
"
RDEPEND="${DEPEND}"

DOCS=( README.md doc/api.md )

src_prepare() {
	default
	rm tests/schema/{definitions,ref{,Remote}}.json || die
	eautoreconf
}

src_configure() {
	use lua && lua_setup

	local myeconfargs=(
		"$(use_enable lua)"
		"$(use_enable regex)"
		"$(use_enable sign signatures)"
		"$(use_enable urls)"
		"$(use_enable utils)"
	)
	use lua && myeconfargs+=(
		LUA_INCLUDE="$(lua_get_CFLAGS)"
		LIB_LIBS="$(lua_get_LIBS)"
	)
	econf "${myeconfargs[@]}"
}

src_test() {
	emake check
}

src_install() {
	default
	use lua && DOCS+=( "doc/lua_api.md" )
	einstalldocs
	if ! use static-libs; then
		find "${ED}" \( -name "*.a" -o -name "*.la" \) -delete || \
			die "error while deleting static library"
	fi
}