1 # Copyright 1999-2010 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
7 inherit flag-o-matic multilib perl-module
9 DESCRIPTION="Text-based, multi-protocol instant messenger"
10 HOMEPAGE="http://www.ekg2.org"
11 SRC_URI="http://qwpx.net/~mgorny/${PN}-scons/${P}.tar.lzma"
15 KEYWORDS="~amd64 ~x86"
16 IUSE="dbus extra gadu gif gnutls gpg gpm gsm gtk icq idn inotify irc
17 jabber jogger jpeg mail minimal ncurses nls nntp oracle oss pcap
18 perl python readline remote rss ruby sim sms spell
19 sqlite sqlite3 srv ssl static unicode web xosd zlib"
21 # -- non-obvious plugin mappings --
22 # extra -> autoresponder, polchat, rivchat, rot13, xmsg
23 # !minimal -> ioctld, logs, rc
28 dbus? ( sys-apps/dbus )
29 gpg? ( app-crypt/gpgme )
30 gsm? ( media-sound/gsm )
31 gtk? ( x11-libs/gtk+:2 )
32 idn? ( net-dns/libidn )
33 nls? ( virtual/libintl )
34 oracle? ( dev-db/oracle-instantclient-basic )
35 pcap? ( net-libs/libpcap )
36 perl? ( dev-lang/perl )
37 python? ( dev-lang/python )
38 readline? ( sys-libs/readline )
39 rss? ( dev-libs/expat )
40 ruby? ( dev-lang/ruby )
41 sim? ( dev-libs/openssl )
42 xosd? ( x11-libs/xosd )
43 gadu? ( net-libs/libgadu
44 gif? ( media-libs/giflib )
45 jpeg? ( media-libs/jpeg ) )
46 jabber? ( dev-libs/expat
47 gnutls? ( net-libs/gnutls )
48 !gnutls? ( ssl? ( dev-libs/openssl ) )
49 zlib? ( sys-libs/zlib ) )
51 zlib? ( sys-libs/zlib ) )
52 ncurses? ( sys-libs/ncurses[unicode?]
54 spell? ( app-text/aspell ) )
55 sqlite3? ( dev-db/sqlite:3 )
56 !sqlite3? ( sqlite? ( dev-db/sqlite:0 ) )"
58 DEPEND="dev-util/scons
59 || ( app-arch/xz-utils app-arch/lzma-utils )
63 if ! use gtk && ! use ncurses && ! use readline && ! use remote && ! use web; then
64 ewarn 'ekg2 is being compiled without any frontend, you should consider'
65 ewarn 'enabling at least one of following USEflags:'
66 ewarn ' gtk, ncurses, readline, remote, web.'
69 # workaround for largefile-enabled gpgme (bug #302097)
70 use gpg && has_version '>=app-crypt/gpgme-1.2' && append-flags -D_FILE_OFFSET_BITS=64
74 use $1 && echo -n ,${2:-$1}
77 # Build comma-separated plugin list based on USE
78 # We can put the same plugin few times if it's referenced by more than one flag
83 $(use_plug extra autoresponder,polchat,rivchat,rot13,xmsg) \
90 $(use_plug jabber jabber) \
91 $(use_plug jogger jogger) \
93 $(use_plug !minimal ioctld,logs,rc) \
95 $(use_plug nntp feed) \
96 $(use_plug oracle logsoracle) \
97 $(use_plug oss oss,pcm) \
98 $(use_plug pcap sniff) \
101 $(use_plug readline) \
103 $(use_plug rss feed) \
107 $(use_plug sqlite logsqlite) \
108 $(use_plug sqlite3 logsqlite) \
109 $(use_plug web httprc_xajax) \
111 | tr -d '[[:space:]]'
114 # create DEPS list for plugin
115 # + means dep forced (fail if unavailable, prioritize over other one-of)
116 # - means dep disabled (don't even check for it)
117 # use:opt maps USEflag to specified opt
118 # usea|useb|usec makes one-of opt
121 local spls spll flag fopt out
126 # loop over different opts
127 while [ -n "$1" ]; do
130 # loop over one-of opts
132 # get next one-of, make sure spls gets empty if last
134 spls=${spls:$(( ${#spll} + 1 ))}
135 # parse use:opt, if no :opt specified fopt=flag
139 # if one of one-of opt matches, we output only it
140 # else we need to output all of them disabled
141 use ${flag} && out=+ || out=${out}-
144 # got more one-of opts? parse them only if this didn't match
145 if [ -n "${spls}" ] && ! use ${flag}; then
152 [ -n "$1" ] && echo -n ,
158 # create all DEPS lists
160 build_addopts_list() {
161 use extra && make_deps XMSG inotify
162 use gadu && make_deps GG gif jpeg
163 use jabber && make_deps JABBER zlib 'gnutls|ssl:openssl'
164 use mail && make_deps MAIL inotify
165 use !minimal && make_deps LOGS zlib
166 use ncurses && make_deps NCURSES gpm spell:aspell
167 use rss || use nntp && make_deps FEED rss:expat
168 use sqlite3 || use sqlite && make_deps LOGSQLITE 'sqlite3|sqlite'
171 # SCons doesn't build perl modules, perl-module.eclass does it better
173 foreach_perl_module() {
175 cd plugins/perl || die 'cd plugins/perl failed'
177 cd "${DIR}" || die "cd ${DIR} (perl module) failed"
181 # workaround perl-module.eclass
189 echo -n "${2:-$1}=" | tr 'a-z' 'A-Z'
190 use $1 && echo -n '1' || echo -n '0'
194 # HARDDEPS -> build should fail if some dep is unsatisfied
195 # DISTNOTES -> are displayed with /version, helpful for upstream bug reports
197 scons PLUGINS=$(build_plugin_list) $(build_addopts_list) \
198 HARDDEPS=1 SKIPCHECKS=1 RELPLUGINS=0 \
199 $(use_var unicode) $(use_var nls) $(use_var static) \
200 $(use_var idn) $(use_var srv RESOLV) \
201 PREFIX=/usr LIBDIR="\$EPREFIX/$(get_libdir)" \
202 DOCDIR="\$DATAROOTDIR/doc/${PF}" \
203 DISTNOTES="Sunrise ebuild ${PVR}, USE=${USE}" \
204 ${MAKEOPTS} conf || die "scons conf failed"
206 foreach_perl_module perl-module_src_configure
210 # SKIPCONF -> no need to reconfigure
212 scons SKIPCONF=1 ${MAKEOPTS} || die "scons failed"
214 foreach_perl_module perl-module_src_compile
218 foreach_perl_module perl-module_src_test
222 scons DESTDIR="${D}" ${MAKEOPTS} install || die "scons install failed"
224 foreach_perl_module perl-module_src_install
226 use perl && fixlocalpod
231 elog "EKG2 is still considered very experimental. Please do report all issues"
232 elog "to mailing list ekg2-users@lists.ziew.org (you can write in English)."
233 elog "Please do not file bugs to Gentoo Bugzilla."
235 elog "Before reporting a bug, please check if it's reproducible and get"
236 elog "complete backtrace of it. Even if you can't reproduce it, you may let us"
237 elog "know that something like that happened."
239 elog "How to get backtraces:"
240 elog " http://www.gentoo.org/proj/en/qa/backtraces.xml"
242 elog "Thank you and have fun."