summaryrefslogtreecommitdiff
blob: 80eb7b64bc8001b519976592e4169c6fc34666ff (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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
# Copyright 1999-2009 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

EAPI="2"

inherit eutils flag-o-matic

DESCRIPTION="Network focused portable C++ class library providing high level functions"
HOMEPAGE="http://www.opalvoip.org/"
SRC_URI="mirror://sourceforge/opalvoip/${P}.tar.bz2
	doc? ( mirror://sourceforge/opalvoip/${P}-htmldoc.tar.gz )"

LICENSE="MPL-1.0"
SLOT="0"
KEYWORDS="~ppc"
# default enabled are features from 'minsize', the most used according to ptlib
IUSE="alsa +asn +audio config-file debug doc esd examples ftp +http http-forms
http-server ieee1394 ipv6 jabber odbc oss pch pipechan +plugins qos ldap
resolver sasl sdl shmvideo snmp soap ssl tts +url v4l v4l2 +video +video-file
vxml wav xml xmlrpc"

RDEPEND="alsa? ( media-libs/alsa-lib )
	esd? ( media-sound/esound )
	ieee1394? ( media-libs/libdv
		sys-libs/libavc1394
		media-libs/libdc1394:1 )
	ldap? ( net-nds/openldap )
	odbc? ( dev-db/unixODBC )
	sasl? ( dev-libs/cyrus-sasl:2 )
	sdl? ( media-libs/libsdl )
	ssl? ( dev-libs/openssl )
	v4l2? ( media-libs/libv4l )
	xml? ( dev-libs/expat )"
DEPEND="${RDEPEND}
	dev-util/pkgconfig
	sys-devel/bison
	sys-devel/flex
	v4l? ( sys-kernel/linux-headers )
	v4l2? ( sys-kernel/linux-headers )
	!!dev-libs/pwlib"

# NOTES:
# media-libs/libdc1394:2 should be supported but headers location have changed
# looks to have an auto-magic dep with medialibs, but not in the tree so...
# tools/ directory seems to be only for windows

pkg_setup() {
	local warning=false

	# ekiga can't use, at least, alsa plugin with --as-needed
	# users where experiencing issues with --as-needed, see bug 238617
	# TODO: should be re-tested and, if possible, fixed in a cleanier way
	append-ldflags -Wl,--no-as-needed

	# warn user about use flag that are gonna override other ones

	if ! use plugins; then
		ewarn "disabling plugins will remove a lot of ptlib features"
		ewarn "it is _not_ recommended"
		warning=true
	fi

	if ! use audio; then
		ewarn "disabling audio will remove all audio support"
		ewarn "even if other audio features have been enabled"
		warning=true
	fi

	if ! use video; then
		ewarn "disabling video will remove all video support"
		ewarn "even if other video features have been enabled"
		warning=true
	fi

	if use jabber && ! use xml; then
		ewarn "jabber support needs xml support: jabber has been disabled"
		ewarn "enable xml support if you want to use the jabber protocol"
		warning=true
	fi

	if use http && ! use url; then
		ewarn "http support needs url support: http support has been disabled"
		ewarn "enable url support if you want to use the http protocol"
		warning=true
	fi

	if use http-forms; then
		if ! use http; then
			ewarn "http-forms support needs http support: http-forms support has been disabled"
			ewarn "enable http support if you want to use http-forms"
			warning=true
		fi
		if ! use config-file; then
			ewarn "http-forms support needs config-file support: http-forms support has been disabled"
			ewarn "enable config-file support if you want to use http-forms"
			warning=true
		fi
	fi

	if use http-server && ! use http-forms; then
		ewarn "http-server support needs http-forms support: http-server support has been disabled"
		ewarn "enable http-forms support if you want to use http-server"
		warning=true
	fi

	if use vxml; then
		if ! use xml; then
			ewarn "vxml support needs xml support: vxml support has been disabled"
			ewarn "enable xml support if you want to use vxml"
			warning=true
		fi
		if ! use http; then
			ewarn "vxml support needs http support: vxml support has been disabled"
			ewarn "enable http support if you want to use vxml"
			warning=true
		fi
	fi

	if use xmlrpc; then
		if ! use xml; then
			ewarn "xmlrpc support needs xml support: xmlrpc support has been disabled"
			ewarn "enable xml support if you want to use xmlrpc"
			warning=true
		fi
		if ! use http; then
			ewarn "xmlrpc support needs http support: xmlrpc support has been disabled"
			ewarn "enable http support if you want to use xmlrpc"
			warning=true
		fi
	fi

	if use soap; then
		if ! use xml; then
			ewarn "soap support needs xml support: soap support has been disabled"
			ewarn "enable xml support if you want to use soap"
			warning=true
		fi
		if ! use http; then
			ewarn "soap support needs http support: soap support has been disabled"
			ewarn "enable http support if you want to use soap"
			warning=true
		fi
	fi

	if ${warning}; then
		echo
		ewarn "If one of the warnings above is not volunteer, hit Ctrl+C now"
		ewarn "and re-emerge ${PN} with the desired USE flags"
		echo
		ebeep
		epause
	fi
}

src_prepare() {
	# move files from ${P}-htmldoc.tar.gz
	if use doc; then
		mv ../html . || die "moving doc files failed"
	fi

	# remove visual studio related files from samples/
	if use examples; then
		rm -f samples/*/*.vcproj
		rm -f samples/*/*.sln
		rm -f samples/*/*.dsp
		rm -f samples/*/*.dsw
	fi

	# this patch fixes bug 145424
	# upstream have been contacted, see bug 2657924 in upstream bugtracker
	epatch "${FILESDIR}"/${PN}-asm.patch
}

src_configure() {
	# minsize, openh323, opal: presets of features (overwritten by use flags)
	# ansi-bool, atomicity: there is no reason to disable those features
	# internalregex: we want to use external one
	# appshare, vfw: only for windows
	# sunaudio and bsdvideo are respectively for SunOS and BSD's
	# dtmf, pop3smtp, remconn, serial, sock, sockagg, stun, telnet
	# 	all seem useless (TODO: check when new versions)
	econf \
		--disable-minsize \
		--disable-openh323 \
		--disable-opal \
		--enable-ansi-bool \
		--enable-atomicity \
		--disable-internalregex \
		--disable-appshare \
		--disable-vfw \
		--disable-sunaudio \
		--disable-bsdvideo \
		--disable-dtmf \
		--disable-pop3smtp \
		--disable-remconn \
		--disable-serial \
		--disable-socks \
		--disable-sockagg \
		--disable-stun \
		--disable-telnet \
		$(use_enable audio) \
		$(use_enable alsa) \
		$(use_enable asn) \
		$(use_enable config-file configfile) \
		$(use_enable debug exceptions) \
		$(use_enable debug memcheck) \
		$(use_enable debug tracing) \
		$(use_enable esd) \
		$(use_enable ftp) \
		$(use_enable http) \
		$(use_enable http-forms httpforms) \
		$(use_enable http-server httpsvc) \
		$(use_enable ieee1394 avc) \
		$(use_enable ieee1394 dc) \
		$(use_enable ipv6) \
		$(use_enable jabber) \
		$(use_enable ldap openldap) \
		$(use_enable odbc) \
		$(use_enable oss) \
		$(use_enable pch) \
		$(use_enable pipechan) \
		$(use_enable plugins) \
		$(use_enable qos) \
		$(use_enable resolver) \
		$(use_enable sasl) \
		$(use_enable sdl) \
		$(use_enable shmvideo) \
		$(use_enable snmp) \
		$(use_enable soap) \
		$(use_enable ssl openssl) \
		$(use_enable tts) \
		$(use_enable url) \
		$(use_enable v4l) \
		$(use_enable v4l2) \
		$(use_enable video) \
		$(use_enable video-file vidfile) \
		$(use_enable vxml) \
		$(use_enable wav wavfile) \
		$(use_enable xml expat) \
		$(use_enable xmlrpc)
}

src_compile() {
	local makeopts=""

	use debug && makeopts="debug"

	emake ${makeopts} || die "emake failed"
}

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

	if use doc; then
		dohtml -r html/* || die "dohtml failed"
	fi

	dodoc ReadMe.txt ReadMe_QOS.txt History.txt || die "dodoc failed"

	# ChangeLog is splitted and other branches ChangeLogs are in the tarball
	docinto ChangeLogs/
	dodoc ChangeLog-${PN}-v2_{0,1,2,3,4}_*.txt || die "dodoc failed"

	if use examples; then
		local exampledir="/usr/share/doc/${PF}/examples"
		local basedir="samples"
		local sampledirs="`ls samples --hide=Makefile`"

		# first, install Makefile
		insinto ${exampledir}/
		doins ${basedir}/Makefile || die "doins failed"

		# now, all examples
		for x in ${sampledirs}; do
			insinto ${exampledir}/${x}/
			doins ${basedir}/${x}/* || die "doins failed"
		done
	fi
}

pkg_postinst() {
	if use examples; then
		ewarn "all examples have been installed, some of them will not work on your system"
		ewarn "it will depend of the enabled use flags"
		ewarn "to test examples, you have to run PTLIBDIR=/usr/share/ptlib make"
	fi
}