summaryrefslogtreecommitdiff
blob: 637e5c385c2353fd1c617cb83c5951dbecfe6488 (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
# Copyright 1999-2005 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/dev-libs/pwlib/pwlib-1.8.4.ebuild,v 1.2 2005/07/10 01:11:05 swegener Exp $

inherit eutils flag-o-matic multilib

IUSE="alsa esd ieee1394 sdl ssl v4l2"

DESCRIPTION="Portable Multiplatform Class Libraries for OpenH323"
HOMEPAGE="http://www.voxgratia.org/"
SRC_URI="http://www.voxgratia.org/releases/pwlib-v${PV//./_}-src-tar.gz"

LICENSE="MPL-1.1"
SLOT="0"
KEYWORDS="~alpha ~amd64 ~ppc ~sparc ~x86"

RDEPEND="
	dev-libs/expat
	net-nds/openldap
	sdl? ( media-libs/libsdl )
	ssl? ( dev-libs/openssl )
	alsa? ( media-libs/alsa-lib )
	ieee1394? ( media-libs/libdv
		sys-libs/libavc1394
		sys-libs/libraw1394
		<media-libs/libdc1394-1.9.99
		!>=media-libs/libdc1394-2.0.0_pre1 )
	esd? ( media-sound/esound )"

DEPEND="${RDEPEND}
	>=sys-devel/bison-1.28
	>=sys-devel/flex-2.5.4a
	>=sys-apps/sed-4"

S="${WORKDIR}/${PN}_v${PV//./_}"

src_unpack() {
	tar -xzf ${DISTDIR}/${A} -C ${WORKDIR} || die "Unpacking failed"

	cd ${S}/make

	# filter out -O3 and -mcpu embedded compiler flags
	sed -i \
		-e "s:-mcpu=\$(CPUTYPE)::" \
		-e "s:-O3 -DNDEBUG:-DNDEBUG:" \
		unix.mak

	# newer esound package doesn't install libesd.a anymore,
	# use dynamic library instead (fixes #100432)
	epatch ${FILESDIR}/pwlib-1.6.3-dyn-esd.patch
}

src_compile() {
	local plugins myconf

	# may cause ICE (bug #70638)
	filter-flags -fstack-protector

	if use ssl; then
		export OPENSSLFLAG=1
		export OPENSSLDIR="/usr"
		export OPENSSLLIBS="-lssl -lcrypt"
	fi

	## gnomemeeting-1.00 requires pwlib to be built w/ IPV6 support
	## (even if itself is built without...)
	#use ipv6 \
	#	&& myconf="${myconf} --enable-ipv6" \
	#	|| myconf="${myconf} --disable-ipv6"
	myconf="--enable-ipv6"

	# plugins, oss and v4l are default
	plugins="oss v4l"

	use ieee1394 \
		&& plugins="${plugins} avc dc"

	use alsa \
		&& plugins="${plugins} alsa"

	if use v4l2; then
		myconf="${myconf} --enable-v4l2"
		plugins="${plugins} v4l2"
	fi

	if use esd; then
		# fixes bug #45059
		export ESDDIR=/usr

		# ESD includes are in /usr/include?
		# remove include path, bad things may happen if we leave it in there
		sed -i -e "s:-I\$(ESDDIR)/include::" \
			${S}/make/unix.mak
	fi

	# merge plugin options (safe way if default = "")
	plugins="$(echo ${plugins} | sed -e "y: :,:")"

	econf ${myconf} \
		--enable-plugins \
		--with-plugins="${plugins}" || die "configure failed"

	# Horrible hack to strip out -L/usr/lib to allow upgrades
	# problem is it adds -L/usr/lib before -L${S} when SSL is
	# enabled.  Same thing for -I/usr/include.
	sed -i  -e "s:^\(LDFLAGS.*\)-L/usr/lib:\1:" \
		-e "s:^\(STDCCFLAGS.*\)-I/usr/include:\1:" \
		${S}/make/ptbuildopts.mak

	sed -i  -e "s:^\(LDFLAGS[\s]*=.*\) -L/usr/lib:\1:" \
		-e "s:^\(LDFLAGS[\s]*=.*\) -I/usr/include:\1:" \
		-e "s:^\(CCFLAGS[\s]*=.*\) -I/usr/include:\1:" \
		${S}/make/ptlib-config

	emake -j1 opt || die "make failed"
}

#pkg_preinst() {
#	# remove {lib,include} directories in /usr/share/pwlib
#	# they are getting replaced by symlinks in src_install
#
#	if [[ -d ${ROOT}usr/share/pwlib/include ]]; then
#		rm -rf ${ROOT}usr/share/pwlib/include
#	fi
#	if [[ -d ${ROOT}usr/share/pwlib/$(get_libdir) ]]; then
#		rm -rf ${ROOT}usr/share/pwlib/$(get_libdir)
#	fi
#}

src_install() {
	local libdir libname

	libdir=$(get_libdir)

	# makefile doesn't create ${D}/usr/bin
	dodir /usr/bin
	make PREFIX=/usr DESTDIR=${D} install || die "install failed"

	## vv will try to fix the mess below, requires a lot of patching though...

	# update 2005/08/22:
	#
	# locations in *.mak files haven been fixed
	# directories have been replaced w/ symlinks
	# (left to not break things, doing some testing atm)

#	dosym /usr/include /usr/share/pwlib/include
#	dosym /usr/${libdir} /usr/share/pwlib/${libdir}
#
#	# just in case...
#	if [[ "${libdir}" = "lib64" ]]; then
#		dosym /usr/share/pwlib/lib64 /usr/share/pwlib/lib
#	fi

	## ^^ bad stuff

	# fix symlink
	rm ${D}/usr/${libdir}/libpt.so

	libname=$(basename `ls ${D}/usr/${libdir}/libpt_*_*_r.so.${PV}`)
	dosym /usr/${libdir}/${libname} /usr/${libdir}/libpt.so

	# strip ${S} stuff
	sed -i -e "s:^PWLIBDIR.*:PWLIBDIR=/usr/share/pwlib:" \
		${D}/usr/bin/ptlib-config \
		${D}/usr/share/pwlib/make/ptlib-config \
		${D}/usr/share/pwlib/make/ptbuildopts.mak

	# fix makefiles to use headers from /usr/include and libs from /usr/lib
	# instead of /usr/share/pwlib
	sed -i  -e "s:-I\$(PWLIBDIR)\(/include[a-zA-Z0-9_/-]\+\):-I/usr/include\1:g" \
		-e "s:-I\$(PWLIBDIR)/include::g" \
		-e "s:^\(PW_LIBDIR[ \t]\+=\).*:\1 /usr/${libdir}:" \
		${D}/usr/share/pwlib/make/*.mak

	# dodgy configure/makefiles forget to expand this
	sed -i -e "s:\${exec_prefix}:/usr:" \
		${D}/usr/bin/ptlib-config \
		${D}/usr/share/pwlib/make/ptlib-config

	# copy version.h
	insinto /usr/share/pwlib
	doins version.h

	dodoc ReadMe.txt ReadMe_QOS.txt History.txt mpl-1.0.htm
}