summaryrefslogtreecommitdiff
path: root/net-libs/tox/tox-9999.ebuild
blob: 3b440eeb9ef996ae62559342de3fca04ae299400 (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-2014 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

EAPI=5

inherit autotools git-2

DESCRIPTION="Encrypted P2P, messenging, and audio/video calling platform"
HOMEPAGE="https://tox.im"
SRC_URI=""
EGIT_REPO_URI="https://github.com/irungentoo/toxcore"

LICENSE="GPL-3"
SLOT="0"
KEYWORDS=""
IUSE="+av daemon logging log-debug log-error log-info log-warn ntox static-libs test"

RDEPEND="
	>=dev-libs/libsodium-1.0.0
	daemon? ( dev-libs/libconfig )
	av? ( media-libs/libvpx
		media-libs/opus )
	ntox? ( sys-libs/ncurses )"
DEPEND="${RDEPEND}
	virtual/pkgconfig
	test? ( dev-libs/check )"

pkg_setup() {
	unset loglevel

	if use log-info || use log-debug || use log-warn || use log-error ; then
		if use !logging ; then
			ewarn "Logging disabled, but log level set,"
			ewarn "it will have no effect."
		else
			use log-info && loglevel=" INFO"
			use log-debug && loglevel="${loglevel} DEBUG"
			use log-warn && loglevel="${loglevel} WARNING"
			use log-error && loglevel="${loglevel} ERROR"

			if [[ $(echo "${loglevel}" | sed 's/[A-Z]//g') =~ "  " ]] ; then
				ewarn "You have chosen multiple log levels,"
				ewarn "but only one can be applied. Picking the"
				ewarn "last one: ${loglevel##* }"
			fi
		fi
	fi
	[[ -z ${loglevel} ]] && loglevel=DEBUG
}

src_prepare() {
	epatch_user
	eautoreconf
}

src_configure() {
	econf \
		$(use_enable logging) \
		$(usex logging "--with-logger-level=${loglevel##* }" "") \
		$(use_enable av) \
		$(use_enable test tests) \
		$(use_enable ntox) \
		$(use_enable daemon) \
		$(use_enable static-libs static)
}

src_install() {
	default
	use daemon && { newinitd "${FILESDIR}"/initd tox-dht-daemon
		newconfd "${FILESDIR}"/confd tox-dht-daemon ; }
	prune_libtool_files
}