summaryrefslogtreecommitdiff
blob: 81584f1cde723c77e6ac2abe86ec23e2278b736d (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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
# Copyright 1999-2009 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

EAPI="2"
ESVN_REPO_URI="http://toxygen.net/svn/ekg2/trunk"

inherit multilib subversion

DESCRIPTION="Remote UI client for EKG2 instant messenger"
HOMEPAGE="http://www.ekg2.org"

LICENSE="GPL-2"
SLOT="0"
KEYWORDS=""
IUSE="gnutls gpm gtk ncurses readline spell ssl static unicode"

RDEPEND="
	gtk? ( x11-libs/gtk+:2 )
	readline? ( sys-libs/readline )
	gnutls?	( net-libs/gnutls )
	!gnutls? ( ssl? ( dev-libs/openssl ) )
	ncurses? ( sys-libs/ncurses[unicode?]
		gpm? ( sys-libs/gpm )
		spell? ( app-text/aspell ) )"

DEPEND="dev-util/scons
	${RDEPEND}"

pkg_setup() {
	# ekg2-remote supports less frontends than ekg2 due to stripped down API

	if ! use gtk && ! use ncurses && ! use readline; then
		ewarn 'ekg2-remote is being compiled without any frontend, you should consider'
		ewarn 'enabling either ncurses, readline or gtk USEflag.'
	fi
}

use_plug() {
	use $1 && echo -n ,${2:-$1}
}

# Build comma-separated plugin list based on USE

build_plugin_list() {
	echo '@none' \
	$(use_plug gtk) \
	$(use_plug ncurses) \
	$(use_plug readline) \
		| tr -d '[[:space:]]'
}

# create DEPS list for plugin
# + means dep forced (fail if unavailable)
# - means dep disabled (don't even check for it)
# use:opt maps USEflag to specified opt

make_deps() {
	local flag fopt out

	echo -n " $1_DEPS="
	shift

	# loop over different opts
	while [ -n "$1" ]; do
		# parse use:opt, if no :opt specified fopt=flag
		flag=${1%:*}
		fopt=${1#*:}

		use ${flag} && out=+ || out=-
		echo -n ${out}${fopt}

		shift
		[ -n "$1" ] && echo -n ,
	done
}

# REMOTE_SSL option

make_rssl() {
	if use gnutls; then
		echo -n gnutls
	elif use openssl; then
		echo -n openssl
	else
		echo -n none
	fi
}

use_var() {
	echo -n $1= | tr a-z A-Z
	use $1 && echo -n 1 || echo -n 0
}

src_configure() {
	# HARDDEPS -> build should fail if some dep is unsatisfied
	# DISTNOTES -> are displayed with /version, helpful for upstream bug reports

	scons PLUGINS=$(build_plugin_list) REMOTE=only REMOTE_SSL=$(make_rssl) \
		$(use ncurses && make_deps NCURSES gpm spell:aspell) \
		HARDDEPS=1 SKIPCHECKS=1 $(use_var unicode) $(use_var static) \
		PREFIX=/usr LIBDIR="\$EPREFIX/$(get_libdir)" \
		PLUGINDIR='$LIBDIR/ekg2-remote/plugins' DOCDIR="\$DATAROOTDIR/doc/${PF}" \
		DISTNOTES="emdzientoo ebuild ${PVR}, USE=${USE}" \
		${MAKEOPTS} conf || die "scons conf failed"
}

src_compile() {
	# SKIPCONF -> no need to reconfigure

	scons SKIPCONF=1 ${MAKEOPTS} || die "scons failed"
}

src_install() {
	scons DESTDIR="${D}" ${MAKEOPTS} install || die "scons install failed"
}

pkg_postinst() {
	elog "EKG2 is still considered very experimental. Please do report all issues"
	elog "to mailing list ekg2-users@lists.ziew.org (you can write in English)."
	elog "Please do not file bugs to Gentoo Bugzilla."
	elog
	elog "Before reporting a bug, please check if it's reproducible and get"
	elog "complete backtrace of it. Even if you can't reproduce it, you may let us"
	elog "know that something like that happened."
	elog
	elog "How to get backtraces:"
	elog "	http://www.gentoo.org/proj/en/qa/backtraces.xml"
	elog
	elog "Thank you and have fun."
}