Line 0
Link Here
|
|
|
1 |
# Copyright 1999-2016 Gentoo Foundation |
2 |
# Distributed under the terms of the GNU General Public License v2 |
3 |
# $Id$ |
4 |
|
5 |
EAPI=5 |
6 |
PYTHON_COMPAT=( python2_7 ) |
7 |
|
8 |
inherit eutils multilib user python-single-r1 systemd |
9 |
|
10 |
if [[ ${PV} == "9999" ]]; then |
11 |
EGIT_REPO_URI="https://github.com/bitlbee/bitlbee.git" |
12 |
inherit git-r3 |
13 |
else |
14 |
SRC_URI="http://get.bitlbee.org/src/${P}.tar.gz" |
15 |
KEYWORDS="~amd64 ~ppc ~ppc64 ~x86 ~x86-fbsd" |
16 |
fi |
17 |
|
18 |
DESCRIPTION="irc to IM gateway that support multiple IM protocols" |
19 |
HOMEPAGE="http://www.bitlbee.org/" |
20 |
|
21 |
LICENSE="GPL-2" |
22 |
SLOT="0" |
23 |
IUSE_PROTOCOLS="xmpp msn oscar purple skype twitter yahoo" |
24 |
IUSE="debug +gnutls ipv6 libevent libressl nss otr +plugins selinux test xinetd |
25 |
${IUSE_PROTOCOLS}" |
26 |
|
27 |
COMMON_DEPEND=" |
28 |
>=dev-libs/glib-2.16 |
29 |
purple? ( net-im/pidgin ) |
30 |
libevent? ( dev-libs/libevent:= ) |
31 |
otr? ( >=net-libs/libotr-4 ) |
32 |
gnutls? ( net-libs/gnutls:= ) |
33 |
!gnutls? ( |
34 |
nss? ( dev-libs/nss ) |
35 |
!nss? ( |
36 |
libressl? ( dev-libs/libressl:= ) |
37 |
!libressl? ( dev-libs/openssl:0= ) |
38 |
) |
39 |
) |
40 |
" |
41 |
DEPEND="${COMMON_DEPEND} |
42 |
dev-lang/python |
43 |
virtual/pkgconfig |
44 |
selinux? ( sec-policy/selinux-bitlbee ) |
45 |
test? ( dev-libs/check )" |
46 |
|
47 |
RDEPEND="${COMMON_DEPEND} |
48 |
virtual/logger |
49 |
skype? ( |
50 |
dev-python/skype4py[${PYTHON_USEDEP}] |
51 |
net-im/skype |
52 |
) |
53 |
xinetd? ( sys-apps/xinetd )" |
54 |
|
55 |
pkg_pretend() { |
56 |
if [[ -z "${I_KNOW_WHAT_I_AM_DOING}" ]]; then |
57 |
local chat_enabled |
58 |
for flag in "${IUSE_PROTOCOLS}"; do |
59 |
use $flag && chat_enabled=1 |
60 |
done |
61 |
if [[ -z "${chat_enabled}" ]]; then |
62 |
die "Please enable at least one chat protocol." |
63 |
fi |
64 |
fi |
65 |
} |
66 |
|
67 |
pkg_setup() { |
68 |
use skype && python-single-r1_pkg_setup |
69 |
|
70 |
enewgroup bitlbee |
71 |
enewuser bitlbee -1 -1 /var/lib/bitlbee bitlbee |
72 |
} |
73 |
|
74 |
src_prepare() { |
75 |
sed -i \ |
76 |
-e "s@/usr/local/sbin/bitlbee@/usr/sbin/bitlbee@" \ |
77 |
-e "s/nobody/bitlbee/" \ |
78 |
-e "s/}/ disable = yes\n}/" \ |
79 |
doc/bitlbee.xinetd || die "sed failed in xinetd" |
80 |
|
81 |
sed -i \ |
82 |
-e "s@mozilla-nss@nss@g" \ |
83 |
configure || die "sed failed in configure" |
84 |
|
85 |
use skype && python_fix_shebang protocols/skype/skyped.py |
86 |
|
87 |
[[ ${PV} != "9999" ]] && epatch "${FILESDIR}"/${PN}-3.2.1-configure.patch |
88 |
epatch "${FILESDIR}"/${PN}-service-user-bitlbee.patch |
89 |
epatch_user |
90 |
} |
91 |
|
92 |
src_configure() { |
93 |
# setup plugins, protocol, ipv6 and debug |
94 |
myconf="--jabber=$(usex xmpp 1 0)" |
95 |
for flag in debug ipv6 plugins ${IUSE_PROTOCOLS/xmpp/} ; do |
96 |
myconf="${myconf} --${flag}=$(usex ${flag} 1 0)" |
97 |
done |
98 |
|
99 |
# set otr |
100 |
if use otr && use plugins ; then |
101 |
myconf="${myconf} --otr=plugin" |
102 |
else |
103 |
if use otr ; then |
104 |
ewarn "OTR support has been disabled automatically because it" |
105 |
ewarn "requires the plugins USE flag." |
106 |
fi |
107 |
myconf="${myconf} --otr=0" |
108 |
fi |
109 |
|
110 |
# setup ssl use flags |
111 |
if use gnutls ; then |
112 |
myconf="${myconf} --ssl=gnutls" |
113 |
einfo "Using gnutls for SSL support" |
114 |
else |
115 |
ewarn "Only gnutls is officially supported by upstream." |
116 |
if use nss ; then |
117 |
myconf="${myconf} --ssl=nss" |
118 |
einfo "Using nss for SSL support" |
119 |
else |
120 |
myconf="${myconf} --ssl=openssl" |
121 |
einfo "Using openssl for SSL support" |
122 |
fi |
123 |
fi |
124 |
|
125 |
# set event handler |
126 |
if use libevent ; then |
127 |
myconf="${myconf} --events=libevent" |
128 |
else |
129 |
myconf="${myconf} --events=glib" |
130 |
fi |
131 |
|
132 |
# NOTE: bitlbee's configure script is not an autotool creation, |
133 |
# so that is why we don't use econf. |
134 |
./configure \ |
135 |
--prefix=/usr --datadir=/usr/share/bitlbee \ |
136 |
--etcdir=/etc/bitlbee --plugindir=/usr/$(get_libdir)/bitlbee \ |
137 |
--systemdsystemunitdir=$(systemd_get_unitdir) \ |
138 |
--doc=1 --strip=0 ${myconf} || die "econf failed" |
139 |
|
140 |
sed -i \ |
141 |
-e "/^EFLAGS/s:=:&${LDFLAGS} :" \ |
142 |
Makefile.settings || die "sed failed" |
143 |
} |
144 |
|
145 |
src_install() { |
146 |
emake install install-etc install-doc install-dev install-systemd DESTDIR="${D}" |
147 |
|
148 |
keepdir /var/lib/bitlbee |
149 |
fperms 700 /var/lib/bitlbee |
150 |
fowners bitlbee:bitlbee /var/lib/bitlbee |
151 |
|
152 |
dodoc doc/{AUTHORS,CHANGES,CREDITS,FAQ,README} |
153 |
|
154 |
if use skype ; then |
155 |
newdoc protocols/skype/NEWS NEWS-skype |
156 |
newdoc protocols/skype/README README-skype |
157 |
fi |
158 |
|
159 |
if use xinetd ; then |
160 |
insinto /etc/xinetd.d |
161 |
newins doc/bitlbee.xinetd bitlbee |
162 |
fi |
163 |
|
164 |
newinitd "${FILESDIR}"/bitlbee.initd-r1 bitlbee |
165 |
newconfd "${FILESDIR}"/bitlbee.confd-r1 bitlbee |
166 |
|
167 |
exeinto /usr/share/bitlbee |
168 |
doexe utils/{convert_purple.py,bitlbee-ctl.pl} |
169 |
} |
170 |
|
171 |
pkg_postinst() { |
172 |
chown -R bitlbee:bitlbee "${ROOT}"/var/lib/bitlbee |
173 |
[[ -d "${ROOT}"/var/run/bitlbee ]] && |
174 |
chown -R bitlbee:bitlbee "${ROOT}"/var/run/bitlbee |
175 |
|
176 |
if [[ -z ${REPLACING_VERSIONS} ]]; then |
177 |
einfo |
178 |
elog "The bitlbee init script will now attempt to stop all processes owned by the" |
179 |
elog "bitlbee user, including per-client forks." |
180 |
elog |
181 |
elog "Tell the init script not to touch anything besides the main bitlbee process" |
182 |
elog "by changing the BITLBEE_STOP_ALL variable in" |
183 |
elog " /etc/conf.d/bitlbee" |
184 |
einfo |
185 |
fi |
186 |
} |