summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--net-libs/opal/ChangeLog12
-rw-r--r--net-libs/opal/files/opal-3.6.2-as-needed.patch164
-rw-r--r--net-libs/opal/files/opal-3.6.2-jdkroot.patch15
-rw-r--r--net-libs/opal/files/opal-3.6.2-sbc.patch11
-rw-r--r--net-libs/opal/files/opal-3.6.2-system-ilbc.patch117
-rw-r--r--net-libs/opal/metadata.xml48
-rw-r--r--net-libs/opal/opal-3.6.2.ebuild287
7 files changed, 647 insertions, 7 deletions
diff --git a/net-libs/opal/ChangeLog b/net-libs/opal/ChangeLog
index afcb4be164af..79624214c536 100644
--- a/net-libs/opal/ChangeLog
+++ b/net-libs/opal/ChangeLog
@@ -1,6 +1,14 @@
# ChangeLog for net-libs/opal
-# Copyright 1999-2008 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/net-libs/opal/ChangeLog,v 1.43 2008/10/09 22:29:36 flameeyes Exp $
+# Copyright 1999-2009 Gentoo Foundation; Distributed under the GPL v2
+# $Header: /var/cvsroot/gentoo-x86/net-libs/opal/ChangeLog,v 1.44 2009/07/03 10:09:58 volkmar Exp $
+
+*opal-3.6.2 (03 Jul 2009)
+
+ 03 Jul 2009; Mounir Lamouri <volkmar@gentoo.org>
+ +files/opal-3.6.2-as-needed.patch, +files/opal-3.6.2-jdkroot.patch,
+ +files/opal-3.6.2-sbc.patch, +files/opal-3.6.2-system-ilbc.patch,
+ metadata.xml, +opal-3.6.2.ebuild:
+ Version bump to 3.6.2. Add myself as maintainer. Fix bug 238610
09 Oct 2008; Diego Pettenò <flameeyes@gentoo.org> opal-2.2.11.ebuild:
Fix build dependencies.
diff --git a/net-libs/opal/files/opal-3.6.2-as-needed.patch b/net-libs/opal/files/opal-3.6.2-as-needed.patch
new file mode 100644
index 000000000000..64ae516c0804
--- /dev/null
+++ b/net-libs/opal/files/opal-3.6.2-as-needed.patch
@@ -0,0 +1,164 @@
+--- opal.m4.old 2009-05-22 12:44:22.000000000 +0200
++++ opal.m4 2009-05-22 13:43:58.000000000 +0200
+@@ -363,13 +363,13 @@
+ AC_DEFUN([OPAL_CHECK_PTLIB],
+ [
+ old_CXXFLAGS="$CXXFLAGS"
+- old_LDFLAGS="$LDFLAGS"
++ old_LIBS="$LIBS"
+
+ CXXFLAGS="$CXXFLAGS $PTLIB_CFLAGS $PTLIB_CXXFLAGS"
+ if test "x${DEBUG_BUILD}" = xyes; then
+- LDFLAGS="$LDFLAGS $DEBUG_LIBS"
++ LIBS="$LIBS $DEBUG_LIBS"
+ else
+- LDFLAGS="$LDFLAGS $RELEASE_LIBS"
++ LIBS="$LIBS $RELEASE_LIBS"
+ fi
+
+ AC_LANG(C++)
+@@ -387,34 +387,69 @@
+ [opal_ptlib_option=no])
+
+ CXXFLAGS="$old_CXXFLAGS"
+- LDFLAGS="$old_LDFLAGS"
++ LIBS="$old_LIBS"
+
+ OPAL_MSG_CHECK([PTLIB has $1], [$opal_ptlib_option])
+- if test "x$4" = "x" ; then
+- if test "x$opal_ptlib_option" = "xno" ; then
++ $4="$opal_ptlib_option"
++ AC_SUBST($4)
++ if test "x$opal_ptlib_option" = "xyes" ; then
++ AC_DEFINE([$4], [1], [$1])
++ fi
++
++ ])
++
++dnl OPAL_CHECK_PTLIB_MANDATORY
++dnl Check if ptlib was compiled with a specific mandatory feature
++dnl Arguments: $1 Name of feature
++dnl $2 ptlib/pasn.h Header file to include
++dnl $3 Code to test the feature
++AC_DEFUN([OPAL_CHECK_PTLIB_MANDATORY],
++ [
++ old_CXXFLAGS="$CXXFLAGS"
++ old_LIBS="$LIBS"
++
++ CXXFLAGS="$CXXFLAGS $PTLIB_CFLAGS $PTLIB_CXXFLAGS"
++ if test "x${DEBUG_BUILD}" = xyes; then
++ LIBS="$LIBS $DEBUG_LIBS"
++ else
++ LIBS="$LIBS $RELEASE_LIBS"
++ fi
++
++ AC_LANG(C++)
++ AC_LINK_IFELSE([
++ #include <ptbuildopts.h>
++ #include <ptlib.h>
++ #include <$2>
++
++ int main()
++ {
++ $3
++ }
++ ],
++ [opal_ptlib_option=yes],
++ [opal_ptlib_option=no])
++
++ CXXFLAGS="$old_CXXFLAGS"
++ LIBS="$old_LIBS"
++
++ OPAL_MSG_CHECK([PTLIB has $1], [$opal_ptlib_option])
++ if test "x$opal_ptlib_option" = "xno" ; then
+ echo " ERROR: compulsory feature from PTLib disabled.";
+ exit 1;
+- fi
+- else
+- $4="$opal_ptlib_option"
+- AC_SUBST($4)
+- if test "x$opal_ptlib_option" = "xyes" ; then
+- AC_DEFINE([$4], [1], [$1])
+- fi
+ fi
+-
+- ])
++
++ ])
+
+ AC_DEFUN([OPAL_CHECK_PTLIB_EXISTS],
+ [
+ old_CXXFLAGS="$CXXFLAGS"
+- old_LDFLAGS="$LDFLAGS"
++ old_LIBS="$LIBS"
+
+ CXXFLAGS="$CXXFLAGS $PTLIB_CFLAGS $PTLIB_CXXFLAGS"
+ if test "x${DEBUG_BUILD}" = xyes; then
+- LDFLAGS="$LDFLAGS $DEBUG_LIBS"
++ LIBS="$LIBS $DEBUG_LIBS"
+ else
+- LDFLAGS="$LDFLAGS $RELEASE_LIBS"
++ LIBS="$LIBS $RELEASE_LIBS"
+ fi
+
+ AC_LANG(C++)
+@@ -424,7 +459,7 @@
+ [opal_ptlib_exists=no])
+
+ CXXFLAGS="$old_CXXFLAGS"
+- LDFLAGS="$old_LDFLAGS"
++ LIBS="$old_LIBS"
+
+
+ if test "x$opal_ptlib_exists" != "xyes" ; then
+--- configure.ac.old 2009-05-22 12:03:06.000000000 +0200
++++ configure.ac 2009-05-22 13:45:18.000000000 +0200
+@@ -291,8 +291,8 @@
+ OPAL_MSG_CHECK([ptlib version], [$PTLIB_VERSION])
+
+ OPAL_CHECK_PTLIB_EXISTS()
+-OPAL_CHECK_PTLIB([URL], [ptclib/url.h], [PURL url;], [])
+-OPAL_CHECK_PTLIB([STUN], [ptclib/pstun.h],[PSTUNClient client;], [])
++OPAL_CHECK_PTLIB_MANDATORY([URL], [ptclib/url.h], [PURL url;])
++OPAL_CHECK_PTLIB_MANDATORY([STUN], [ptclib/pstun.h],[PSTUNClient client;])
+ OPAL_CHECK_PTLIB([SSL], [ptclib/pssl.h], [PSSLContext ctx;], [OPAL_PTLIB_SSL])
+ OPAL_CHECK_PTLIB([ASN.1], [ptclib/pasn.h], [PASNInteger asnint(5);], [OPAL_PTLIB_ASN])
+ OPAL_CHECK_PTLIB([expat], [ptclib/pxml.h], [PXMLParser parser;], [OPAL_PTLIB_EXPAT])
+@@ -439,7 +439,7 @@
+ OPAL_SIMPLE_OPTION([h323],[OPAL_H323], [whether to enable H.323 protocol support])
+
+ if test "x$OPAL_H323" = "xyes" ; then
+- OPAL_CHECK_PTLIB([ASN], [ptclib/asner.h], [PPER_Stream per;], [])
++ OPAL_CHECK_PTLIB_MANDATORY([ASN], [ptclib/asner.h], [PPER_Stream per;])
+ fi
+
+ dnl MSWIN_DISPLAY iax2,IAX2 support
+--- plugins/configure.ac.old 2009-05-24 15:24:01.000000000 +0200
++++ plugins/configure.ac 2009-05-24 15:29:52.000000000 +0200
+@@ -230,6 +230,7 @@
+ AC_SUBST(LIBAVCODEC_CFLAGS)
+ AC_SUBST(LIBAVCODEC_LIBS)
+ AC_DEFINE([HAVE_LIBAVCODEC], [1], [ffmpeg])
++ AC_SUBST(LIBAVCODEC_LIB_NAME)
+ HAVE_LIBAVCODEC=yes
+ OPAL_LIBAVCODEC_HACK
+ case "$target_os" in
+@@ -240,15 +241,13 @@
+ HAVE_H264_DECODER=yes
+ ;;
+ * )
+- OPAL_GET_LIBNAME([LIBAVCODEC], [libavcodec], [$LIBAVCODEC_LIBS])
+- OPAL_CHECK_LIBAVCODEC([h263p_encoder], [HAVE_H263P=yes], [HAVE_H263P=no])
+- OPAL_CHECK_LIBAVCODEC([mpeg4_encoder], [HAVE_MPEG4=yes], [HAVE_MPEG4=no])
+- OPAL_CHECK_LIBAVCODEC([h264_decoder], [HAVE_H264_DECODER=yes], [HAVE_H264_DECODER=no])
++ AC_CHECK_LIB(avcodec, h263p_encoder, [HAVE_H263P=yes], [HAVE_H263P=no])
++ AC_CHECK_LIB(avcodec, mpeg4_encoder, [HAVE_MPEG4=yes], [HAVE_MPEG4=no])
++ AC_CHECK_LIB(avcodec, h264_decoder, [HAVE_H264_DECODER=yes], [HAVE_H264_DECODER=no])
+ ;;
+ esac
+ AC_SUBST(HAVE_H263P)
+ AC_SUBST(HAVE_MPEG4)
+- AC_SUBST(LIBAVCODEC_LIB_NAME)
+ OPAL_LIBAVCODEC_HEADER
+ ],
+ [
diff --git a/net-libs/opal/files/opal-3.6.2-jdkroot.patch b/net-libs/opal/files/opal-3.6.2-jdkroot.patch
new file mode 100644
index 000000000000..480a0eefb162
--- /dev/null
+++ b/net-libs/opal/files/opal-3.6.2-jdkroot.patch
@@ -0,0 +1,15 @@
+Index: opal.m4
+===================================================================
+--- opal.m4 (revision 22933)
++++ opal.m4 (working copy)
+@@ -996,6 +996,10 @@
+ AC_CHECK_HEADERS([jni.h], [opal_java=yes])
+
+ if test "x$opal_java" = "xno" ; then
++ if test "x${JDK_ROOT}" = "x" ; then
++ JDK_ROOT=${JDK_HOME}
++ fi
++
+ if test "x${JDK_ROOT}" != "x" ; then
+ AC_CHECK_FILE([${JDK_ROOT}/include/jni.h],
+ [
diff --git a/net-libs/opal/files/opal-3.6.2-sbc.patch b/net-libs/opal/files/opal-3.6.2-sbc.patch
new file mode 100644
index 000000000000..d4e7e4ec26ca
--- /dev/null
+++ b/net-libs/opal/files/opal-3.6.2-sbc.patch
@@ -0,0 +1,11 @@
+--- plugins/audio/SBC/Makefile.in.old 2009-05-24 13:15:46.000000000 +0200
++++ plugins/audio/SBC/Makefile.in 2009-05-24 13:16:18.000000000 +0200
+@@ -30,7 +30,7 @@
+ SRCDIR = .
+ PLUGINDIR=../..
+ SONAME = sbccodec
+-SAMPLERATELIB = -Lsamplerate
++SAMPLERATE_LIB = -lsamplerate
+
+ CC =@CC@
+ CFLAGS =@CFLAGS@
diff --git a/net-libs/opal/files/opal-3.6.2-system-ilbc.patch b/net-libs/opal/files/opal-3.6.2-system-ilbc.patch
new file mode 100644
index 000000000000..8ee423203128
--- /dev/null
+++ b/net-libs/opal/files/opal-3.6.2-system-ilbc.patch
@@ -0,0 +1,117 @@
+--- opal.m4.old 2009-05-22 19:42:30.000000000 +0200
++++ opal.m4 2009-05-22 20:07:45.000000000 +0200
+@@ -1007,3 +1007,41 @@
+ fi
+ AS_IF([test AS_VAR_GET([opal_java]) = yes], [$1], [$2])[]
+ ])
++
++dnl OPAL_DETERMINE_ILBC
++dnl Determine whether to use the system or internal iLBC (can be forced)
++dnl Arguments: none
++dnl Return: $ILBC_SYSTEM whether system or internal iLBC shall be used
++dnl $ILBC_CFLAGS system iLBC CFLAGS if using system iLBC
++dnl $ILBC_LIBS system iLBC LIBS if using system iLBC
++AC_DEFUN([OPAL_DETERMINE_ILBC],
++ [AC_ARG_ENABLE([localilbc],
++ [AC_HELP_STRING([--enable-localilbc],[Force use local version of iLBC library rather than system version])],
++ [localilbc=$enableval],
++ [localilbc=])
++
++ if test "x${localilbc}" = "xyes" ; then
++ AC_MSG_NOTICE(forcing use of local iLBC sources)
++ ILBC_SYSTEM=no
++ else
++ AC_MSG_NOTICE(checking if iLBC is installed)
++
++ saved_LIBS="$LIBS"
++ LIBS="$LIBS -lilbc"
++ AC_CHECK_LIB(ilbc, iLBC_encode, [has_ilbc=yes], [has_ilbc=no])
++ LIBS=$saved_LIBS
++
++ if test "x${has_ilbc}" = "xyes"; then
++ AC_CHECK_HEADERS([ilbc/iLBC_decode.h ilbc/iLBC_define.h ilbc/iLBC_encode.h], [has_ilbc=yes], [has_ilbc=no])
++ fi
++
++ if test "x${has_ilbc}" = "xyes"; then
++ ILBC_CFLAGS=""
++ ILBC_LIBS="-lilbc"
++ ILBC_SYSTEM=yes
++ else
++ ILBC_SYSTEM=no
++ fi
++ OPAL_MSG_CHECK([System iLBC], [$has_ilbc])
++ fi
++ ])
+--- plugins/audio/iLBC/Makefile.in.old 2009-05-22 19:25:06.000000000 +0200
++++ plugins/audio/iLBC/Makefile.in 2009-05-22 20:10:11.000000000 +0200
+@@ -78,13 +78,26 @@
+ LDFLAGS =@LDFLAGS@
+ EXTRACFLAGS =-I$(PLUGINDIR)
+
+-SRCS = ilbccodec.c $(SRCDIR)/anaFilter.c $(SRCDIR)/constants.c $(SRCDIR)/createCB.c $(SRCDIR)/doCPLC.c \
++ILBC_CFLAGS=@ILBC_CFLAGS@
++ILBC_LIBS=@ILBC_LIBS@
++ILBC_SYSTEM=@ILBC_SYSTEM@
++
++SRCS = ilbccodec.c
++
++ifeq ($(ILBC_SYSTEM),no)
++SRCS += $(SRCDIR)/anaFilter.c $(SRCDIR)/constants.c $(SRCDIR)/createCB.c $(SRCDIR)/doCPLC.c \
+ $(SRCDIR)/enhancer.c $(SRCDIR)/filter.c $(SRCDIR)/FrameClassify.c $(SRCDIR)/gainquant.c \
+ $(SRCDIR)/getCBvec.c $(SRCDIR)/helpfun.c $(SRCDIR)/hpInput.c $(SRCDIR)/hpOutput.c \
+ $(SRCDIR)/iCBConstruct.c $(SRCDIR)/iCBSearch.c $(SRCDIR)/iLBC_decode.c $(SRCDIR)/iLBC_encode.c \
+ $(SRCDIR)/LPCdecode.c $(SRCDIR)/LPCencode.c $(SRCDIR)/lsf.c $(SRCDIR)/packing.c \
+ $(SRCDIR)/StateConstructW.c $(SRCDIR)/StateSearchW.c $(SRCDIR)/syntFilter.c
+
++EXTRALIBS =
++else
++EXTRACFLAGS += $(IBLC_CFLAGS)
++EXTRALIBS = $(ILBC_LIBS)
++endif
++
+ OBJDIR = ./obj
+
+ vpath %.o $(OBJDIR)
+@@ -100,9 +113,9 @@
+
+ $(PLUGIN): $(OBJECTS)
+ ifeq (solaris,$(findstring solaris,$(target_os)))
+- $(CC) $(LDSO) $@ -o $@ $^
++ $(CC) $(LDSO) $@ -o $@ $^ $(EXTRALIBS)
+ else
+- $(CC) $(LDSO) -o $@ $^
++ $(CC) $(LDSO) -o $@ $^ $(EXTRALIBS)
+ endif
+
+ install:
+--- plugins/configure.ac.old 2009-05-22 19:39:05.000000000 +0200
++++ plugins/configure.ac 2009-05-22 19:41:25.000000000 +0200
+@@ -181,6 +181,14 @@
+ AC_SUBST(SPEEX_CFLAGS)
+ AC_SUBST(SPEEX_LIBS)
+
++dnl ########################
++dnl iLBC (system/local)
++dnl ########################
++OPAL_DETERMINE_ILBC()
++AC_SUBST(ILBC_SYSTEM)
++AC_SUBST(ILBC_CFLAGS)
++AC_SUBST(ILBC_LIBS)
++
+ dnl ########################################################################
+ dnl sbc,Bluetooth SBC for telephony with CD quality
+
+@@ -516,7 +524,12 @@
+ fi
+
+ echo " gsm-amr : yes"
+-echo " iLBC : yes"
++if test "x${ILBC_SYSTEM}" = "xyes" ; then
++echo " iLBC : yes (system)"
++else
++echo " iLBC : yes (internal)"
++fi
++
+ if test "x${SPEEX_SYSTEM}" = "xyes" ; then
+ echo " Speex : yes (system, version $SPEEX_SYSTEM_VERSION)"
+ else
diff --git a/net-libs/opal/metadata.xml b/net-libs/opal/metadata.xml
index 8ad8ef1611d3..3de6baa7f519 100644
--- a/net-libs/opal/metadata.xml
+++ b/net-libs/opal/metadata.xml
@@ -1,9 +1,47 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
<pkgmetadata>
- <herd>voip</herd>
- <use>
- <flag name="noaudio">Disable audio codecs</flag>
- <flag name="novideo">Disable video codecs</flag>
- </use>
+ <herd>voip</herd>
+ <maintainer>
+ <email>volkmar@gentoo.org</email>
+ <name>Mounir Lamouri</name>
+ </maintainer>
+ <use>
+ <flag name="audio">Enable audio support</flag>
+ <flag name="capi">Enable CAPI support</flag>
+ <flag name="dns">Enable DNS resolver support</flag>
+ <flag name="dtmf">Enable DTMF encoding/decoding support</flag>
+ <flag name="fax">Enable T.38 FAX protocol</flag>
+ <flag name="h224">Enable H.224 real time control protocol</flag>
+ <flag name="h281">Enable H.281 Far-End Camera Control protocol</flag>
+ <flag name="h323">Enable H.323 protocol</flag>
+ <flag name="iax">Enable Inter-Asterisk eXchange protocol</flag>
+ <flag name="ivr">Enable Interactive Voice Response</flag>
+ <flag name="ixj">Enable xJack cards support</flag>
+ <flag name="lid">Enable Line Interface Device</flag>
+ <flag name="plugins">Enable plugins support</flag>
+ <flag name="rfc4175">Enable RTP Payload Format for Uncompressed Video
+ </flag>
+ <flag name="sbc">Enable the Bluetooth low-complexity, SubBand Codec
+ </flag>
+ <flag name="sip">Enable Session Initiation Protocol</flag>
+ <flag name="sipim">Enable SIP Instant Messages session</flag>
+ <flag name="srtp">Enable Secure Real-time Transport Protocol</flag>
+ <flag name="stats">Enable statistic reporting</flag>
+ <flag name="swig">Use swig to generate bindings</flag>
+ <flag name="video">Enable video support</flag>
+ <flag name="vpb">Enable Voicetronics VPB card support</flag>
+ <flag name="vxml">Enable VXML support</flag>
+ <flag name="wav">Enable WAVFILE support</flag>
+ <flag name="x264-static">Install x264 plugin statically linked with x264
+ </flag>
+ <!-- for 2.* -->
+ <flag name="noaudio">Disable audio codecs</flag>
+ <flag name="novideo">Disable video codecs</flag>
+ <!-- unused atm
+ <flag name="g711plc">Enable G711 Packet Loss Concealment</flag>
+ <flag name="msrp">Enable Message Session Relay Protocol</flag>
+ <flag name="rfc4103">Enable RTP Payload for Text Conversation</flag>
+ -->
+ </use>
</pkgmetadata>
diff --git a/net-libs/opal/opal-3.6.2.ebuild b/net-libs/opal/opal-3.6.2.ebuild
new file mode 100644
index 000000000000..71534cc29ba6
--- /dev/null
+++ b/net-libs/opal/opal-3.6.2.ebuild
@@ -0,0 +1,287 @@
+# Copyright 1999-2009 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/net-libs/opal/opal-3.6.2.ebuild,v 1.1 2009/07/03 10:09:58 volkmar Exp $
+
+EAPI="2"
+
+inherit eutils autotools toolchain-funcs java-pkg-opt-2
+
+DESCRIPTION="C++ class library normalising numerous telephony protocols"
+HOMEPAGE="http://www.opalvoip.org/"
+SRC_URI="mirror://sourceforge/opalvoip/${P}.tar.bz2
+ doc? ( mirror://sourceforge/opalvoip/${P}-htmldoc.tar.bz2 )"
+
+LICENSE="MPL-1.0"
+SLOT="0"
+KEYWORDS="~ppc ~x86"
+IUSE="+audio capi debug dns doc dtmf examples fax ffmpeg h224 h281 h323 iax ipv6
+ivr ixj java ldap lid +plugins rfc4175 sbc sip sipim srtp ssl stats swig theora
++video vpb vxml wav x264 x264-static xml"
+
+RDEPEND=">=net-libs/ptlib-2.0.0[stun,url,debug=,audio?,dns?,dtmf?,ipv6?,ldap?,ssl?,video?,vxml?,wav?,xml?]
+ >=media-libs/speex-1.2_beta
+ fax? ( net-libs/ptlib[asn] )
+ h323? ( net-libs/ptlib[asn] )
+ ivr? ( net-libs/ptlib[xml,vxml] )
+ java? ( >=virtual/jre-1.4 )
+ plugins? ( dev-libs/ilbc-rfc3951
+ media-sound/gsm
+ capi? ( net-dialup/capi4k-utils )
+ ffmpeg? ( >=media-video/ffmpeg-0.4.7[encode] )
+ ixj? ( sys-kernel/linux-headers )
+ sbc? ( media-libs/libsamplerate )
+ theora? ( media-libs/libtheora )
+ x264? ( >=media-video/ffmpeg-0.4.7
+ media-libs/x264 ) )
+ srtp? ( net-libs/libsrtp )"
+DEPEND="${RDEPEND}
+ dev-util/pkgconfig
+ >=sys-devel/gcc-3
+ java? ( swig? ( dev-lang/swig[java] )
+ >=virtual/jdk-1.4 )"
+
+# NOTES:
+# ffmpeg[encode] is for h263 and mpeg4
+# ssl, xml, vxml, ipv6, dtmf, ldap, audio, wav, dns and video are use flags
+# herited from ptlib: feature is enabled if ptlib has enabled it
+# however, disabling it if ptlib has it looks hard (coz of buildopts.h)
+# forcing ptlib to disable it for opal is not a solution too
+# atm, accepting the "auto-feature" looks like a good solution
+# (asn is used for fax and config _only_ for examples)
+# OPALDIR should not be used anymore but if a package still need it, create it
+
+# TODO:
+# force or merge some non-plugin USE flags wo/ deps ?
+# celt is not in the tree and should be added
+
+conditional_use_error_msg() {
+ eerror "To enable ${1} USE flag, you need ${2} USE flag to be enabled"
+ eerror "Please, enable ${2} or disable ${1}"
+}
+
+pkg_setup() {
+ local use_error=false
+
+ if [[ $(gcc-major-version) -lt 3 ]]; then
+ eerror "You need to use gcc-3 at least."
+ eerror "Please change gcc version with 'gcc-config'."
+ die "You need to use gcc-3 at least."
+ fi
+
+ # stop emerge if a conditional use flag is not respected
+
+ if use rfc4175 && ! use video; then
+ conditional_use_error_msg "rfc4175" "video"
+ use_error=true
+ fi
+
+ if use h281 && ! use h224; then
+ conditional_use_error_msg "h281" "h224"
+ use_error=true
+ fi
+
+ if use x264-static && ! use x264; then
+ conditional_use_error_msg "x264-static" "x264"
+ use_error=true
+ fi
+
+ if ${use_error}; then
+ eerror "Please see messages above and re-emerge ${PN} accordingly."
+ die "Conditional USE flag error."
+ fi
+
+ java-pkg-opt-2_pkg_setup
+}
+
+src_prepare() {
+ # move files from doc tarball into ${S}
+ 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
+
+ # fix as-needed and aclocal, upstream patch 2795827
+ epatch "${FILESDIR}"/${P}-as-needed.patch
+
+ # use system ilbc, upstream patch 2795830
+ epatch "${FILESDIR}"/${P}-system-ilbc.patch
+
+ # fix sbc plugin link, upstream patch 2796087
+ epatch "${FILESDIR}"/${P}-sbc.patch
+
+ # upstream patch 2808915
+ epatch "${FILESDIR}"/${P}-jdkroot.patch
+
+ # h224 really needs h323 ?
+ # TODO: get a confirmation in ml
+ sed -i -e "s:\(.*HAS_H224.*\), \[OPAL_H323\]:\1:" configure.ac \
+ || die "sed failed"
+
+ eaclocal
+ eautoconf
+
+ # in plugins
+ cd plugins/
+ eaclocal
+ eautoconf
+ cd ..
+
+ # disable srtp if srtp is not enabled (prevent auto magic dep)
+ # upstream bug 2686485 (fixed in 3.7)
+ if ! use srtp; then
+ sed -i -e "s/OPAL_SRTP=yes/OPAL_SRTP=no/" configure \
+ || die "patching configure failed"
+ fi
+
+ # disable theora if theora is not enabled (prevent auto magic dep)
+ # upstream bug 2686488 (fixed in 3.7)
+ if ! use theora; then
+ sed -i -e "s/HAVE_THEORA=yes/HAVE_THEORA=no/" plugins/configure \
+ || die "patching plugins/configure failed"
+ fi
+
+ # disable mpeg4 and h263p if ffmpeg is not enabled (prevent auto magic dep)
+ # upstream bug 2686495 (fixed in 3.7)
+ if ! use ffmpeg; then
+ sed -i -e "s/HAVE_H263P=yes/HAVE_H263P=no/" plugins/configure \
+ || die "patching plugins/configure failed"
+ sed -i -e "s/HAVE_MPEG4=yes/HAVE_MPEG4=no/" plugins/configure \
+ || die "patching plugins/configure failed"
+ fi
+
+ # fix gsm wav49 support check, upstream bug 2686500 (fixed in 3.7)
+ if use plugins; then
+ sed -i -e "s:gsm\.h:gsm/gsm.h:" plugins/configure \
+ || die "patching plugins/configure failed"
+ fi
+
+ # fix automatic swig detection, upstream bug 2712521 (upstream reject it)
+ if ! use swig; then
+ sed -i -e "/^SWIG=/d" configure || die "patching configure failed"
+ fi
+
+ java-pkg-opt-2_src_prepare
+}
+
+src_configure() {
+ # --with-libavcodec-source-dir should _not_ be set, it's for trunk sources
+ # versioncheck: check for ptlib version
+ # shared: should always be enabled for a lib
+ # localspeex, localspeexdsp, localgsm, localilbc: never use bundled libs
+ # samples: only build some samples, useless
+ # libavcodec-stackalign-hack: prevent hack (default disable by upstream)
+ # default-to-full-capabilties: default enable by upstream
+ # aec: atm, only used when bundled speex, so it's painless for us
+ # zrtp doesn't depend on net-libs/libzrtpcpp but on libzrtp from
+ # http://zfoneproject.com/ wich is not in portage
+ # msrp: highly experimental
+ # spandsp: doesn't work with newest spandsp, upstream bug 2796047
+ # g711plc: force enable
+ # rfc4103: not really used, upstream bug 2795831
+ # t38, spandsp: merged in fax
+ # h450, h460, h501: merged in h323 (they are additional features of h323)
+ econf \
+ --enable-versioncheck \
+ --enable-shared \
+ --disable-zrtp \
+ --disable-localspeex \
+ --disable-localspeexdsp \
+ --disable-localgsm \
+ --disable-localilbc \
+ --disable-samples \
+ --disable-libavcodec-stackalign-hack \
+ --enable-default-to-full-capabilties \
+ --enable-aec \
+ --disable-msrp \
+ --disable-spandsp \
+ --enable-g711plc \
+ --enable-rfc4103 \
+ $(use_enable debug) \
+ $(use_enable capi) \
+ $(use_enable fax) \
+ $(use_enable fax t38) \
+ $(use_enable ffmpeg ffmpeg-h263) \
+ $(use_enable h224) \
+ $(use_enable h281) \
+ $(use_enable h323) \
+ $(use_enable h323 h450) \
+ $(use_enable h323 h460) \
+ $(use_enable h323 h501) \
+ $(use_enable iax) \
+ $(use_enable ivr) \
+ $(use_enable ixj) \
+ $(use_enable java) \
+ $(use_enable lid) \
+ $(use_enable plugins) \
+ $(use_enable rfc4175) \
+ $(use_enable sbc) \
+ $(use_enable sip) \
+ $(use_enable sipim) \
+ $(use_enable stats statistics) \
+ $(use_enable video) \
+ $(use_enable vpb) \
+ $(use_enable x264 h264) \
+ $(use_enable x264-static x264-link-static)
+}
+
+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/* docs/* || die "dohtml failed"
+ fi
+
+ # ChangeLog is not standard
+ dodoc ChangeLog-${PN}-v${PV//./_}.txt || die "dodoc failed"
+
+ if use examples; then
+ local exampledir="/usr/share/doc/${PF}/examples"
+ local basedir="samples"
+ local sampledirs="`ls ${basedir} --hide=configure* \
+ --hide=opal_samples.mak.in`"
+
+ # first, install files
+ insinto ${exampledir}/
+ doins ${basedir}/{configure*,opal_samples*} \
+ || die "doins failed"
+
+ # now, all examples
+ for x in ${sampledirs}; do
+ insinto ${exampledir}/${x}/
+ doins ${basedir}/${x}/* || die "doins failed"
+ done
+
+ # some examples need version.h
+ insinto "/usr/share/doc/${PF}/"
+ doins version.h || die "doins failed"
+ 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 in ptlib and opal"
+ fi
+
+ if ! use plugins || ! use audio || ! use video; then
+ ewarn "You have disabled audio, video or plugins USE flags."
+ ewarn "Most audio/video features or plugins have been disabled silently"
+ ewarn "even if enabled via USE flags."
+ ewarn "Having a feature enabled via USE flag but disabled can lead to issues."
+ fi
+}