NAME=ekiga
VERSION=( 2.0.9  2.2.8  1.10.7  20070110 )
SOURCE=(http://www.gnomemeeting.org/admin/downloads/latest/sources/sources/ekiga-${VERSION[0]}.tar.gz
	http://www.gnomemeeting.org/admin/downloads/latest/sources/sources/opal-${VERSION[1]}.tar.gz
	http://www.gnomemeeting.org/admin/downloads/latest/sources/sources/pwlib-${VERSION[2]}.tar.gz
	ftp://ftp.openldap.org/pub/OpenLDAP/openldap-stable/openldap-stable-${VERSION[3]}.tgz )
BUILD=${BUILD:-1}
OPTIMIZE=${OPTIMIZE:-"-Os -pipe"}
ROOT_REQUIRED=1

build() {
	_explode_all
	
	############
	# OPENLDAP #
	############
	cd "$TMP/openldap-"*
        _configure \
		--disable-debug \
		--disable-syslog \
		--disable-slapd \
		--disable-bdb \
		--disable-monitor \
		--disable-slurpd \
		--enable-static \
		--disable-shared
	make depend
	make -j $MAKEJOBS
	make DESTDIR="$PKG-temp" install
	_doc 0 ekiga-$VERSION/openldap-stable-${VERSION[3]} COPYRIGHT LICENSE
	rm -f "$TMP/configure.cache"

	#########
	# PWLIB #
	#########
	cd "$TMP/pwlib-${VERSION[2]}"
	export CPLUS_INCLUDE_PATH="$PKG-temp/$INCLUDEDIR"
	export LDFLAGS="-lssl -L$PKG-temp/$LIBDIR"
	_configure \
        	--enable-opal \
		--enable-v4l2
	make -j $MAKEJOBS
	mkdir -p "$PKG/$BINDIR" "$PKG-temp/$BINDIR"
	make DESTDIR="$PKG" install
	make DESTDIR="$PKG-temp" install
	_doc 0 ekiga-$VERSION/pwlib-${VERSION[2]} ChangeLog History.txt ReadMe_QOS.txt ReadMe.txt
	_chfix
	_chgrp_bin
	_tmp_pkg "$PKG-temp"

	unset CPLUS_INCLUDE_PATH
	unset LDFLAGS
	rm -f "$TMP/configure.cache"

	###########
	#   OPAL  #
	###########
	cd "$TMP/opal-${VERSION[1]}"
        _configure
	make
	make DESTDIR="$PKG" install
	make DESTDIR="$PKG-temp" install
	_doc 0 ekiga-$VERSION/opal-${VERSION[1]} ChangeLog History.txt ReadMe_QOS.txt ReadMe.txt

	_chfix
	_chgrp_bin
	_tmp_pkg "$PKG-temp"

	###############
	#    EKIGA    #
	###############
	cd "$TMP/ekiga-$VERSION"
        _configure \
		--disable-gnome \
		--disable-schemas-install \
		--disable-howl \
		--disable-avahi
	make -j $MAKEJOBS
	make DESTDIR="$PKG" install
	_doc 0 ekiga-$VERSION AUTHORS ChangeLog COPYING FAQ NEWS TODO
	rm -rf "$PKG/$INCLUDEDIR" "$PKG/$DATADIR/pwlib/" "$PKG/$DATADIR/openh323/"

	_chfix
	_chgrp_bin
}
