--- /portdir/portage/net-misc/asterisk/asterisk-1.6.2.6.ebuild 2010-03-15 06:36:22.000000000 -0700 +++ asterisk-1.6.2.6-r1.ebuild 2010-03-24 15:23:43.000000000 -0700 @@ -7,14 +7,31 @@ MY_P="${PN}-${PV/_/-}" +# -r1: now with *really ugly hacks to build imap support* +IMAP_SRC_URI="" +MY_IMAP_PV="" +MY_IMAP_PN="" +MY_IMAP_P="" +S_IMAP="" + +if [ $( use_with imap ) ]; then + ewarn "yah we are building with imap support, loo0k out!!!" + MY_IMAP_PV=2007e + MY_IMAP_PN=imap + MY_IMAP_P="${MY_IMAP_PN}-${MY_IMAP_PV}" + S_IMAP=${WORKDIR}/${MY_IMAP_P} + + IMAP_SRC_URI="ftp://ftp.cac.washington.edu/imap/${MY_IMAP_P}.tar.Z" +fi + DESCRIPTION="Asterisk: A Modular Open Source PBX System" HOMEPAGE="http://www.asterisk.org/" -SRC_URI="http://downloads.digium.com/pub/telephony/asterisk/releases/${MY_P}.tar.gz" +SRC_URI="http://downloads.digium.com/pub/telephony/asterisk/releases/${MY_P}.tar.gz ${IMAP_SRC_URI}" LICENSE="GPL-2" SLOT="0" KEYWORDS="~amd64 ~x86" -IUSE="alsa +caps curl dahdi debug freetds iconv jabber ldap keepsrc misdn newt nosamples oss postgres radius snmp span speex ssl sqlite static vorbis" +IUSE="imap alsa +caps curl dahdi debug freetds iconv jabber ldap keepsrc misdn newt nosamples oss postgres radius snmp span speex ssl sqlite static vorbis" RDEPEND="sys-libs/ncurses dev-libs/popt @@ -74,6 +91,44 @@ src_unpack() { unpack ${A} +# this is ripped, more or less wholesale (less, actually, than is needed) +# from the ebuild for c-client. Uneeded afterward, so why depend on it? +# it would be cool to just be able to 'ebuild compile' c-client and point to it + +if [ $( use_with imap ) ]; then +pushd "${S_IMAP}" + +sed \ +-e "s:BASECFLAGS=\".*\":BASECFLAGS=:g" \ +-e 's:SSLDIR=/usr/local/ssl:SSLDIR=/usr:g' \ +-e 's:SSLCERTS=$(SSLDIR)/certs:SSLCERTS=/etc/ssl/certs:g' \ +-i src/osdep/unix/Makefile || die "Makefile sed fixing failed" + +sed -e '/^bsf:/,/^$/ s:ACTIVEFILE=.*:ACTIVEFILE=/var/lib/news/active:g' \ + -i src/osdep/unix/Makefile || die "Makefile sex fixing failed for FreeBSD" + +sed -e '/read.*exit/d' -i Makefile + +# there is more magic in c-client ebuild to steal for this! +# more testing is needed: this just "WFM" +# the list of ports and flavors is long, PASSWDTYPE is maybe what is needed +# that wasn't already there + +make -j1 lnp SSLTYPE=unix PASSWDTYPE=pam EXTRACFLAGS=" -fPIC" + +popd + +# this is the trick for changing the makeopts that is recommended by digium folks, I think: + +echo MENUSELECT_OPTS_app_voicemail=IMAP_STORAGE > "${S}/user_makeopts" + +# this is/isn't needed? + +# export USER_MAKEOPTS="${S}/user_makeopts" + +fi; + + cd "${S}" # @@ -135,7 +190,14 @@ # # start with configure # + + IMAP_EXTRAS="" + if [ $( use_with imap ) ]; then + IMAP_EXTRAS="--with-imap=${S_IMAP}" + fi + econf \ + ${IMAP_EXTRAS} \ --libdir="/usr/$(get_libdir)" \ --localstatedir="/var" \ --with-gsm=internal \ @@ -179,7 +241,7 @@ ### # run menuselect - emake menuselect.makeopts || die "emake menuselect.makeopts failed" + emake USER_MAKEOPTS="${S}/user_makeopts" menuselect.makeopts || die "emake menuselect.makeopts failed" ### # get list of modules with failed dependencies @@ -219,6 +281,17 @@ done fi +# TODO: this is where the makeopts get fixed if you don't use modules. +# it should also go up there in some clean way. I've never been able to get +# ASTERISK_MODULES to work for me, but having it set could be a precondition +# if this needs moving + + if [ $(use_with imap) ]; then + + emake USER_MAKEOPTS="${S}/user_makeopts" menuselect.makeopts || die \ + "emake menuselect.makeopts failed" + fi + ASTLDFLAGS="${LDFLAGS}" emake || die "emake failed" }