# 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="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="~amd64 ~ppc ~x86" IUSE="+audio capi debug dns doc dtmf examples fax ffmpeg g711plc h224 +h323 iax ipv6 ivr ixj java ldap lid +plugins rfc4103 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/jdk ) plugins? ( media-sound/gsm capi? ( net-dialup/capi4k-utils ) fax? ( media-libs/spandsp ) 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] ) )" # NOTES: # needs speexdsp, that means >=speex-1.2 # ffmpeg[encode] is for h263 and mpeg4 # fax enable fax, t38 and spandsp support # h323 auto-enables h450, h460 and h501 wich provide supplementary services # h224 auto-enables h281 # 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, if a package still need it, create it # TODO: merge some use-flags or force their values ? # candidates are: sipim, rfc4103 and any other without a dep # TODO: celt use flag can't be set because celt is not in portage, add it # needs to have ptlib url use flag enabled, see bug 2715377 (upstream) # needs to have ptlib stun use flag enabled, see bug 2721404 (upstream) # h323 needs ptlib[asn] but not required by opal, see bug 2721707 (upstream) # TODO: msrp has been disabled because build breaks, see bug 2722818 (upstream) pkg_setup() { local warning=false # opal can't be built with --as-needed # users where experiencing issues with --as-needed, see bug 238610 # 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 automatialy disable a lot of ${PN} features" ewarn "like gsm, capi, spandsp, ffmpeg, ixj, theora and x264" ewarn "it is _not_ recommended" warning=true fi if use rfc4175 && ! use video; then ewarn "rfc4175 support needs video support: rfc4175 support has been disabled" ewarn "enable video support if you want to use the rfc4175 support" warning=true fi if use x264-static && ! use x264; then ewarn "x264-static has been enabled but x264 support has been disabled" 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 # disable srtp if srtp is not enabled (prevent auto magic dep) # upstream has been contacted, bug 2686485 in their bugtracker #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 has been contacted, bug 2686488 in their bugtracker # disable mpeg4 and h263p if ffmpeg is not enabled (prevent auto magic dep) # upstream has been contacted, bug 2686495 in their bugtracker # fix gsm wav49 support check # upstream has been contacted, bug 2686500 in their bugtracker 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 has been contacted, bug 2712521 in their bugtracker if ! use swig; then sed -i -e "/^SWIG=/d" configure || die "patching configure failed" fi # remove plugins install when plugins are disabled # upstream has been contacted, bug 2715354 in their bugtracker # there is a stupid bug that shown when disabling statistics # upstream has been contacted, bug 2686504 in their bugtracker } 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 # zrtp doesn't depend on net-libs/libzrtpcpp but on libzrtp from # http://zfoneproject.com/ wich is not in portage # localspeex, localspeexdsp, localgsm: 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 # celt: not in the portage tree nor in the voip overlay # msrp: disabled because breaking the build econf \ --enable-versioncheck \ --enable-shared \ --disable-zrtp \ --disable-localspeex \ --disable-localspeexdsp \ --disable-localgsm \ --disable-samples \ --disable-libavcodec-stackalign-hack \ --enable-default-to-full-capabilties \ --enable-aec \ --disable-celt \ --disable-msrp \ $(use_enable debug) \ $(use_enable capi) \ $(use_enable fax) \ $(use_enable fax spandsp) \ $(use_enable fax t38) \ $(use_enable ffmpeg ffmpeg-h263) \ $(use_enable g711plc) \ $(use_enable h224) \ $(use_enable h224 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 rfc4103) \ $(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 }