summaryrefslogtreecommitdiff
path: root/net-libs/tox/tox-9999.ebuild
blob: fc7d1f4089bbfbe4710bea57c506c5f4525c7e69 (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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# Copyright 1999-2015 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

EAPI=5

inherit autotools eutils git-2 user systemd

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

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

RDEPEND="
	>=dev-libs/libsodium-0.6.1[urandom,asm]
	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 !log ; then
			ewarn "Logging disabled, but log level set,"
			ewarn "it will have no effect."
		else
			use log-trace && loglevel=" TRACE"
			use log-debug && loglevel="${loglevel} DEBUG"
			use log-info && loglevel="${loglevel} INFO"
			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 log) \
		$(usex log "--with-log-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
		insinto /etc
		doins "${FILESDIR}"/tox-bootstrapd.conf
		systemd_dounit "${FILESDIR}"/tox-bootstrapd.service ; }
	prune_libtool_files
}

pkg_postinst() {
	use daemon && {	enewgroup ${PN}
	enewuser ${PN} -1 -1 -1 ${PN}
	ewarn "Backwards compatability with the bootstrap daemon"
	ewarn "might have been broken a while ago."
	ewarn "To resolve this issue, REMOVE the following files:"
	ewarn "/var/lib/tox-dht-bootstrap/key"
	ewarn "/etc/tox-bootstrapd.conf"
	ewarn "/run/tox-dht-bootstrap/tox-dht-bootstrap.pid"
	ewarn "Then just re-emerge net-libs/tox" ; }
}