]> Pileus Git - ~andy/sunrise/blob - net-im/ekg2/ekg2-0.3_pre20100701.ebuild
net-im/ekg2: Version bump for new snapshot.
[~andy/sunrise] / net-im / ekg2 / ekg2-0.3_pre20100701.ebuild
1 # Copyright 1999-2010 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: $
4
5 EAPI=2
6
7 inherit flag-o-matic multilib perl-module
8
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"
12
13 LICENSE="GPL-2"
14 SLOT="0"
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"
20
21 # -- non-obvious plugin mappings --
22 # extra     -> autoresponder, polchat, rivchat, rot13, xmsg
23 # !minimal  -> ioctld, logs, rc
24 # any sound -> pcm
25 # web       -> httprc_xajax
26
27 RDEPEND="
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 ) )
50         !minimal? (
51                 zlib? ( sys-libs/zlib ) )
52         ncurses? ( sys-libs/ncurses[unicode?]
53                 gpm? ( sys-libs/gpm )
54                 spell? ( app-text/aspell ) )
55         sqlite3? ( dev-db/sqlite:3 )
56         !sqlite3? ( sqlite? ( dev-db/sqlite:0 ) )"
57
58 DEPEND="dev-util/scons
59         || ( app-arch/xz-utils app-arch/lzma-utils )
60         ${RDEPEND}"
61
62 pkg_setup() {
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.'
67         fi
68
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
71 }
72
73 use_plug() {
74         use $1 && echo -n ,${2:-$1}
75 }
76
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
79
80 build_plugin_list() {
81         echo '@none' \
82         $(use_plug dbus) \
83         $(use_plug extra autoresponder,polchat,rivchat,rot13,xmsg) \
84         $(use_plug gadu gg) \
85         $(use_plug gpg) \
86         $(use_plug gsm) \
87         $(use_plug gtk) \
88         $(use_plug icq) \
89         $(use_plug irc) \
90         $(use_plug jabber jabber) \
91         $(use_plug jogger jogger) \
92         $(use_plug mail) \
93         $(use_plug !minimal ioctld,logs,rc) \
94         $(use_plug ncurses) \
95         $(use_plug nntp feed) \
96         $(use_plug oracle logsoracle) \
97         $(use_plug oss oss,pcm) \
98         $(use_plug pcap sniff) \
99         $(use_plug perl) \
100         $(use_plug python) \
101         $(use_plug readline) \
102         $(use_plug remote) \
103         $(use_plug rss feed) \
104         $(use_plug ruby) \
105         $(use_plug sim) \
106         $(use_plug sms) \
107         $(use_plug sqlite logsqlite) \
108         $(use_plug sqlite3 logsqlite) \
109         $(use_plug web httprc_xajax) \
110         $(use_plug xosd) \
111                 | tr -d '[[:space:]]'
112 }
113
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
119
120 make_deps() {
121         local spls spll flag fopt out
122
123         echo -n " $1_DEPS="
124         shift
125
126         # loop over different opts
127         while [ -n "$1" ]; do
128                 spls=$1
129                 out=
130                 # loop over one-of opts
131                 while true; do
132                         # get next one-of, make sure spls gets empty if last
133                         spll=${spls%%|*}
134                         spls=${spls:$(( ${#spll} + 1 ))}
135                         # parse use:opt, if no :opt specified fopt=flag
136                         flag=${spll%:*}
137                         fopt=${spll#*:}
138
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}-
142                         out=${out}${fopt}
143
144                         # got more one-of opts? parse them only if this didn't match
145                         if [ -n "${spls}" ] && ! use ${flag}; then
146                                 out=${out},
147                                 continue
148                         fi
149
150                         echo -n ${out}
151                         shift
152                         [ -n "$1" ] && echo -n ,
153                         break
154                 done
155         done
156 }
157
158 # create all DEPS lists
159
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'
169 }
170
171 # SCons doesn't build perl modules, perl-module.eclass does it better
172
173 foreach_perl_module() {
174         if use perl; then
175                 cd plugins/perl || die 'cd plugins/perl failed'
176                 for DIR in */; do
177                         cd "${DIR}" || die "cd ${DIR} (perl module) failed"
178                         $1
179                         cd ..
180
181                         # workaround perl-module.eclass
182                         unset SRC_PREP
183                 done
184                 cd ../..
185         fi
186 }
187
188 use_var() {
189         echo -n "${2:-$1}=" | tr 'a-z' 'A-Z'
190         use $1 && echo -n '1' || echo -n '0'
191 }
192
193 src_configure() {
194         # HARDDEPS -> build should fail if some dep is unsatisfied
195         # DISTNOTES -> are displayed with /version, helpful for upstream bug reports
196
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"
205
206         foreach_perl_module perl-module_src_configure
207 }
208
209 src_compile() {
210         # SKIPCONF -> no need to reconfigure
211
212         scons SKIPCONF=1 ${MAKEOPTS} || die "scons failed"
213
214         foreach_perl_module perl-module_src_compile
215 }
216
217 src_test() {
218         foreach_perl_module perl-module_src_test
219 }
220
221 src_install() {
222         scons DESTDIR="${D}" ${MAKEOPTS} install || die "scons install failed"
223
224         foreach_perl_module perl-module_src_install
225
226         use perl && fixlocalpod
227         prepalldocs
228 }
229
230 pkg_postinst() {
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."
234         elog
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."
238         elog
239         elog "How to get backtraces:"
240         elog "  http://www.gentoo.org/proj/en/qa/backtraces.xml"
241         elog
242         elog "Thank you and have fun."
243 }