net-im/bitlbee: fix dependencies in live ebuild
[gentoo.git] / net-im / bitlbee / bitlbee-3.6.ebuild
1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=7
5
6 inherit systemd toolchain-funcs
7
8 if [[ ${PV} == "9999" ]]; then
9         EGIT_REPO_URI="https://github.com/bitlbee/bitlbee.git"
10         inherit git-r3
11 else
12         SRC_URI="https://get.bitlbee.org/src/${P}.tar.gz"
13         KEYWORDS="~amd64 ~ppc ~ppc64 ~x86"
14 fi
15
16 DESCRIPTION="irc to IM gateway that support multiple IM protocols"
17 HOMEPAGE="https://www.bitlbee.org/"
18
19 LICENSE="GPL-2"
20 SLOT="0"
21 IUSE_PROTOCOLS="msn oscar purple twitter +xmpp"
22 IUSE="debug +gnutls ipv6 libevent libressl nss otr +plugins selinux test xinetd
23         ${IUSE_PROTOCOLS}"
24 RESTRICT="!test? ( test )"
25
26 REQUIRED_USE="
27         || ( purple xmpp msn oscar )
28         xmpp? ( !nss )
29         test? ( plugins )
30 "
31
32 COMMON_DEPEND="
33         acct-group/bitlbee
34         acct-user/bitlbee
35         >=dev-libs/glib-2.16
36         purple? ( net-im/pidgin )
37         libevent? ( dev-libs/libevent:= )
38         otr? ( >=net-libs/libotr-4 )
39         gnutls? ( net-libs/gnutls:= )
40         !gnutls? (
41                 nss? ( dev-libs/nss )
42                 !nss? (
43                         libressl? ( dev-libs/libressl:= )
44                         !libressl? ( dev-libs/openssl:0= )
45                 )
46         )
47 "
48 DEPEND="${COMMON_DEPEND}
49         virtual/pkgconfig
50         selinux? ( sec-policy/selinux-bitlbee )
51         test? ( dev-libs/check )"
52
53 RDEPEND="${COMMON_DEPEND}
54         xinetd? ( sys-apps/xinetd )"
55
56 PATCHES=(
57         "${FILESDIR}"/${PN}-3.5-systemd-user.patch
58         "${FILESDIR}"/${PN}-3.5-libcheck.patch
59         "${FILESDIR}"/${PN}-3.5-libevent.patch
60 )
61
62 src_configure() {
63         local myconf
64
65         # setup plugins, protocol, ipv6 and debug
66         myconf+=( --jabber=$(usex xmpp 1 0) )
67         for flag in debug ipv6 plugins ${IUSE_PROTOCOLS/+xmpp/} ; do
68                 myconf+=( --${flag}=$(usex ${flag} 1 0) )
69         done
70
71         # set otr
72         if use otr && use plugins ; then
73                 myconf+=( --otr=plugin )
74         else
75                 if use otr ; then
76                         ewarn "OTR support has been disabled automatically because it"
77                         ewarn "requires the plugins USE flag."
78                 fi
79                 myconf+=( --otr=0 )
80         fi
81
82         # setup ssl use flags
83         if use gnutls ; then
84                 myconf+=( --ssl=gnutls )
85                 einfo "Using gnutls for SSL support"
86         else
87                 ewarn "Only gnutls is officially supported by upstream."
88                 if use nss ; then
89                         myconf+=( --ssl=nss )
90                         einfo "Using nss for SSL support"
91                 else
92                         myconf+=( --ssl=openssl )
93                         einfo "Using openssl for SSL support"
94                 fi
95         fi
96
97         # set event handler
98         if use libevent ; then
99                 myconf+=( --events=libevent )
100         else
101                 myconf+=( --events=glib )
102         fi
103
104         # not autotools-based
105         ./configure \
106                 --prefix=/usr \
107                 --datadir=/usr/share/bitlbee \
108                 --etcdir=/etc/bitlbee \
109                 --plugindir=/usr/$(get_libdir)/bitlbee \
110                 --pcdir=/usr/$(get_libdir)/pkgconfig \
111                 --systemdsystemunitdir=$(systemd_get_systemunitdir) \
112                 --doc=1 \
113                 --strip=0 \
114                 --verbose=1 \
115                 "${myconf[@]}" || die
116
117         sed -i \
118                 -e "/^EFLAGS/s:=:&${LDFLAGS} :" \
119                 Makefile.settings || die
120 }
121
122 src_compile() {
123         emake CC="$(tc-getCC)" LD="$(tc-getLD)"
124 }
125
126 src_install() {
127         emake DESTDIR="${D}" install install-etc install-doc install-dev install-systemd
128
129         keepdir /var/lib/bitlbee
130         fperms 700 /var/lib/bitlbee
131         fowners bitlbee:bitlbee /var/lib/bitlbee
132
133         dodoc doc/{AUTHORS,CHANGES,CREDITS,FAQ,README}
134
135         if use xinetd ; then
136                 insinto /etc/xinetd.d
137                 newins doc/bitlbee.xinetd bitlbee
138         fi
139
140         newinitd "${FILESDIR}"/bitlbee.initd-r2 bitlbee
141         newconfd "${FILESDIR}"/bitlbee.confd-r2 bitlbee
142
143         exeinto /usr/share/bitlbee
144         doexe utils/{convert_purple.py,bitlbee-ctl.pl}
145 }
146
147 pkg_postinst() {
148         chown -R bitlbee:bitlbee "${ROOT}"/var/lib/bitlbee
149 }