summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Knoblich <stkn@gentoo.org>2006-06-07 18:08:56 +0000
committerStefan Knoblich <stkn@gentoo.org>2006-06-07 18:08:56 +0000
commit8832d5a93b2f9338668fff216d9fdfc56c3fcba5 (patch)
tree0b56aa51ba54cb18314df18c28ca6d6efeff73be /net-misc/asterisk
parentRemove unused ssl and ipv6 use flags, use use_enable, truncate useless docs, ... (diff)
downloadgentoo-2-8832d5a93b2f9338668fff216d9fdfc56c3fcba5.tar.gz
gentoo-2-8832d5a93b2f9338668fff216d9fdfc56c3fcba5.tar.bz2
gentoo-2-8832d5a93b2f9338668fff216d9fdfc56c3fcba5.zip
Security bump (bug #135680). bristuff update, genericjb removed from 1.2.9_p1 (see ChangeLog for more information).
(Portage version: 2.1_rc4-r3)
Diffstat (limited to 'net-misc/asterisk')
-rw-r--r--net-misc/asterisk/ChangeLog11
-rw-r--r--net-misc/asterisk/asterisk-1.0.11_p1.ebuild509
-rw-r--r--net-misc/asterisk/asterisk-1.2.9_p1.ebuild531
-rw-r--r--net-misc/asterisk/files/digest-asterisk-1.0.11_p19
-rw-r--r--net-misc/asterisk/files/digest-asterisk-1.2.9_p112
5 files changed, 1071 insertions, 1 deletions
diff --git a/net-misc/asterisk/ChangeLog b/net-misc/asterisk/ChangeLog
index f9772dedca67..9e1eb6fc35a8 100644
--- a/net-misc/asterisk/ChangeLog
+++ b/net-misc/asterisk/ChangeLog
@@ -1,6 +1,15 @@
# ChangeLog for net-misc/asterisk
# Copyright 2002-2006 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/net-misc/asterisk/ChangeLog,v 1.116 2006/05/06 14:48:07 stkn Exp $
+# $Header: /var/cvsroot/gentoo-x86/net-misc/asterisk/ChangeLog,v 1.117 2006/06/07 18:08:56 stkn Exp $
+
+*asterisk-1.2.9_p1 (07 Jun 2006)
+*asterisk-1.0.11_p1 (07 Jun 2006)
+
+ 07 Jun 2006; Stefan Knoblich <stkn@gentoo.org> +asterisk-1.0.11_p1.ebuild,
+ +asterisk-1.2.9_p1.ebuild:
+ Security bump (bug #135680), genericjb dropped from 1.2.9_p1 for now
+ (latest patch does not apply), 1.0.11_p1 updated to use bristuff-0.2.0-PRE8r,
+ 1.2.9_p1 updated to use bristuff-0.3.0-PRE-1p.
*asterisk-1.2.7_p1-r1 (06 May 2006)
diff --git a/net-misc/asterisk/asterisk-1.0.11_p1.ebuild b/net-misc/asterisk/asterisk-1.0.11_p1.ebuild
new file mode 100644
index 000000000000..5f75898e3525
--- /dev/null
+++ b/net-misc/asterisk/asterisk-1.0.11_p1.ebuild
@@ -0,0 +1,509 @@
+# Copyright 1999-2006 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/net-misc/asterisk/asterisk-1.0.11_p1.ebuild,v 1.1 2006/06/07 18:08:56 stkn Exp $
+
+inherit eutils perl-app
+
+ADDONS_VERSION="1.0.9"
+BRI_VERSION="0.2.0-RC8r"
+
+MY_P="${P/_p/.}"
+
+DESCRIPTION="Asterisk: A Modular Open Source PBX System"
+HOMEPAGE="http://www.asterisk.org/"
+SRC_URI="http://ftp1.digium.com/pub/telephony/${PN}/releases/${MY_P}.tar.gz
+ http://ftp1.digium.com/pub/telephony/${PN}/old-releases/${PN}-addons-${ADDONS_VERSION}.tar.gz
+ bri? ( http://www.junghanns.net/downloads/bristuff-${BRI_VERSION}.tar.gz )"
+
+S_ADDONS="${WORKDIR}/${PN}-addons-${ADDONS_VERSION}"
+S_BRI="${WORKDIR}/bristuff-${BRI_VERSION}"
+S="${WORKDIR}/${MY_P}"
+
+
+IUSE="alsa bri debug doc gtk hardened mmx mysql mysqlfriends postgres pri resperl speex ukcid vmdbmysql vmdbpostgres zaptel"
+SLOT="0"
+LICENSE="GPL-2"
+KEYWORDS="~amd64 ~hppa ~ppc sparc ~x86"
+
+DEPEND="dev-libs/newt
+ dev-libs/openssl
+ media-sound/mpg123
+ media-sound/sox
+ doc? ( app-doc/doxygen )
+ gtk? ( =x11-libs/gtk+-1.2* )
+ pri? ( <net-libs/libpri-1.2* )
+ bri? ( <net-libs/libpri-1.2*
+ <net-misc/zaptel-1.2* )
+ alsa? ( media-libs/alsa-lib )
+ mysql? ( dev-db/mysql )
+ speex? ( media-libs/speex )
+ zaptel? ( <net-misc/zaptel-1.2* )
+ postgres? ( dev-db/postgresql )
+ vmdbmysql? ( dev-db/mysql )
+ mysqlfriends? ( dev-db/mysql )
+ vmdbpostgres? ( dev-db/postgresql )
+ resperl? ( dev-lang/perl
+ <net-misc/zaptel-1.2* )"
+
+pkg_setup() {
+ local n
+
+ #
+ # Warning about security changes...
+ #
+ ewarn "****************** Important changes warning! *********************"
+ ewarn
+ ewarn "- Asterisk runs as user asterisk, group asterisk by default"
+ ewarn
+ ewarn "- Permissions of /etc/asterisk have been changed to root:asterisk"
+ ewarn " 750 (directories) / 640 (files)"
+ ewarn
+ ewarn "- Permissions of /var/{log,lib,run,spool}/asterisk have been changed"
+ ewarn " to asterisk:asterisk 750 (directories) / 640 (files)"
+ ewarn
+ ewarn "- Asterisk's unix socket and pidfile are now in /var/run/asterisk"
+ ewarn
+ ewarn "- More information at the end of this emerge"
+ ewarn
+ ewarn " http://bugs.gentoo.org/show_bug.cgi?id=88732"
+ ewarn " http://www.voip-info.org/wiki-Asterisk+non-root"
+ ewarn
+ einfo "Press Ctrl+C to abort"
+ echo
+ ebeep
+
+ n=15
+ while [[ $n -gt 0 ]]; do
+ echo -en " Waiting $n seconds...\r"
+ sleep 1
+ (( n-- ))
+ done
+
+ #
+ # Regular checks
+ #
+ einfo "Running some pre-flight checks..."
+ if use resperl; then
+ # res_perl pre-flight check...
+ if ! $(perl -V | grep -q "usemultiplicity=define") ||\
+ ! built_with_use dev-lang/perl ithreads || ! built_with_use sys-devel/libperl ithreads
+ then
+ eerror "Embedded perl add-on needs Perl and libperl with built-in threads support"
+ eerror "(rebuild perl and libperl with ithreads use-flag enabled)"
+ die "Perl w/o threads support..."
+ fi
+ einfo "Perl with ithreads support found"
+ fi
+
+
+ # mysql and postgres voicemail support are mutually exclusive..
+ if use vmdbmysql && use vmdbpostgres; then
+ eerror "MySQL and PostgreSQL Voicemail support are mutually exclusive... choose one!"
+ die "Conflicting use-flags"
+ fi
+
+ # check if zaptel and libpri have been built with bri enabled
+ if use bri; then
+ if ! built_with_use net-misc/zaptel bri; then
+ eerror "Re-emerge zaptel with bri use-flag enabled!"
+ die "Zaptel without bri support detected"
+ fi
+
+ if ! built_with_use net-libs/libpri bri; then
+ eerror "Re-emerge libpri with bri use-flag enabled!"
+ die "Libpri without bri support detected"
+ fi
+ fi
+
+ # check if zaptel has been built with ukcid
+ if use ukcid && ! built_with_use net-misc/zaptel ukcid; then
+ eerror "Re-emerge zaptel with ukcid useflag enabled!"
+ die "Zaptel missing ukcid support"
+ fi
+}
+
+src_unpack() {
+ unpack ${A}
+ cd ${S}
+
+ # set cflags & mmx optimization
+ sed -i -e "s:^\(OPTIMIZE+=\).*:\1 ${CFLAGS}:" \
+ -e "s:^\(CFLAGS+=\$(shell if \$(CC)\):#\1:" \
+ Makefile
+
+ # hppa patch for gsm codec
+ epatch ${FILESDIR}/1.0.0/${PN}-1.0.8-hppa.patch
+
+ # mark adsi functions as weak references, things will blow
+ # on hardened otherwise (bug #100697 and #85655)
+ epatch ${FILESDIR}/1.0.0/${PN}-1.0.10-weak-references.diff
+
+ # gsm codec still uses -fomit-frame-pointer, and other codecs have their
+ # own flags. We only change the arch.
+ sed -i -e "s:^OPTIMIZE+=.*:OPTIMIZE=${CFLAGS}:" \
+ -e "s:^CFLAGS[\t ]\++=:CFLAGS =:" \
+ codecs/gsm/Makefile
+
+ if use mmx; then
+ if ! use hardened; then
+ einfo "Enabling mmx optimization"
+ sed -i -e "s:^#\(K6OPT[\t ]\+= -DK6OPT\):\1:" \
+ codecs/gsm/Makefile
+ else
+ ewarn "Hardened use-flag is set, not enabling mmx optimization for codec_gsm!"
+
+ fi
+ fi
+ if ! use mmx || use hardened; then
+ # don't build + link asm mmx object file
+ # without this codec_gsm.so will include text relocations
+ sed -i -e "/k6opt\.\(s\|o\)/ d" \
+ codecs/gsm/Makefile
+ fi
+
+ if ! use debug; then
+ einfo "Disabling debugging"
+ sed -i -e "s:^\(DEBUG=\):#\1:" Makefile
+ fi
+
+ # change image path in voicemail cgi
+ sed -i -e "s:^\(\$astpath = \).*:\1 \"/asterisk\";:" contrib/scripts/vmail.cgi
+
+ #
+ # embedded perl
+ #
+ if use resperl; then
+ einfo "Patching asterisk for embedded perl support..."
+ epatch ${S_ADDONS}/res_perl/astmake.diff
+
+ # create necessary .c file
+ /usr/bin/perl -MExtUtils::Embed -e xsinit || die "Could not create perlxsi.c"
+
+ cd ${S_ADDONS}
+
+ # fix perl path, source location and remove res_musiconhold
+ sed -i -e "s:/usr/local/bin/perl:/usr/bin/perl:" \
+ res_perl/Makefile \
+ ${S}/Makefile \
+ res_perl/INC/*.pm
+ sed -i -e "s:^ASTSRC.*:ASTSRC = ${S}:" \
+ -e "s:\$(ASTLIBDIR)/modules/res_musiconhold.so::" \
+ res_perl/Makefile
+
+ if use bri; then
+ epatch ${FILESDIR}/1.0.0/res_perl-1.0.7-bristuff-0.2.0.diff
+ fi
+
+ cd ${S}
+ fi
+
+ #
+ # uclibc patch
+ #
+ if use elibc_uclibc; then
+ einfo "Patching asterisk for uclibc..."
+ epatch ${FILESDIR}/1.0.0/${PN}-1.0.5-uclibc-dns.diff
+ fi
+
+ #
+ # other patches
+ #
+
+ # fix lpc10 Makefile, remove the
+ # CFLAGS+=-march=$(shell uname -m) part
+ epatch ${FILESDIR}/1.0.0/${PN}-1.0.5-lpc10flags.diff
+
+ # asterisk-config
+ epatch ${FILESDIR}/1.0.0/${PN}-1.0.5-astcfg-0.0.2.diff
+
+ #
+ # database voicemail support
+ #
+ if use postgres; then
+ sed -i -e "s:^#\(APPS+=app_sql_postgres.so\):\1:" \
+ -e "s:/usr/local/pgsql/include:/usr/include/postgresql/pgsql:" \
+ -e "s:/usr/local/pgsql/lib:/usr/lib/postgresql:" \
+ apps/Makefile
+ fi
+
+ if use vmdbpostgres; then
+ einfo "Enabling PostgreSQL voicemail support"
+ sed -i -e "s:^\(USE_POSTGRES_VM_INTERFACE\).*:\1=1:" \
+ -e "s:/usr/local/pgsql/include:/usr/include/postgresql/pgsql:" \
+ -e "s:/usr/local/pgsql/lib:/usr/lib/postgresql:" \
+ apps/Makefile
+
+ # patch app_voicemail.c
+ sed -i -e "s:^#include <postgresql/libpq-fe\.h>:#include \"libpq-fe\.h\":" \
+ apps/app_voicemail.c
+
+ elif use vmdbmysql; then
+ einfo "Enabling MySQL voicemail support"
+ sed -i -e "s:^\(USE_MYSQL_VM_INTERFACE\).*:\1=1:" \
+ -e "s:^\(CFLAGS+=-DUSEMYSQLVM\):\1 -I${S_ADDONS}:" \
+ apps/Makefile
+ fi
+
+ #
+ # MySQL friends support
+ #
+ if use mysqlfriends; then
+ einfo "Enabling MySQL friends support for SIP and IAX"
+ sed -i -e "s:^\(USE_MYSQL_FRIENDS\)=.*:\1=1:" \
+ -e "s:^\(USE_SIP_MYSQL_FRIENDS\)=.*:\1=1:" \
+ channels/Makefile
+ fi
+
+ #
+ # asterisk add-ons
+ #
+ cd ${S_ADDONS}
+ sed -i -e "s:-I../asterisk:-I${S} -I${S}/include:" Makefile
+ sed -i -e "s:^OPTIMIZE+=.*:OPTIMIZE+=${CFLAGS}:" \
+ -e "s:^\(CFLAGS=\)\(.*\):\1-I${S}/include -fPIC \2:" \
+ format_mp3/Makefile
+
+
+ #
+ # BRI patches
+ #
+ if use bri; then
+ cd ${S}
+ einfo "Patching asterisk w/ BRI stuff"
+
+ # remove after new patch has been released
+ sed -i -e "s:^\([+-]\)1\.0\.10:\11.0.11.1:" \
+ ${S_BRI}/patches/asterisk.patch
+
+ epatch ${S_BRI}/patches/asterisk.patch
+ fi
+
+ #
+ # Revived snmp plugin support
+ #
+# if use snmp; then
+# cd ${S}
+# einfo "Patching snmp plugin helper functions"
+# epatch ${FILESDIR}/1.0.0/ast-ax-snmp-1.0.6.diff
+# fi
+
+ # fix path for non-root
+ cd ${S}
+ sed -i -e "s:^\(ASTVARRUNDIR=\).*:\1\$(INSTALL_PREFIX)/var/run/asterisk:" \
+ Makefile
+
+ # fix contrib scripts for non-root
+ epatch ${FILESDIR}/1.0.0/${PN}-1.0.7-scripts.diff
+
+ # add initgroups support to asterisk, this is needed
+ # to support supplementary groups for the asterisk
+ # user (start-stop-daemons --chguid breaks realtime priority support)
+ epatch ${FILESDIR}/1.0.0/${PN}-1.0.8-initgroups.diff
+
+ # UK callerid patch, adds support for british-telecoms callerid to x100p cards
+ # see http://www.lusyn.com/asterisk/patches.html for more information
+ use ukcid && \
+ epatch ${FILESDIR}/1.0.0/${PN}-1.0.9-ukcid.patch
+
+ # needed for >=freetds-0.63
+ if has_version ">=dev-db/freetds-0.63"; then
+ epatch ${FILESDIR}/1.0.0/${PN}-1.0.9-freetds.diff
+ fi
+
+ # security fix, bug #111836
+ epatch ${FILESDIR}/1.0.0/${PN}-1.0.10-vmail.cgi.patch
+
+ # patch for mISDN
+ epatch ${FILESDIR}/1.0.0/${PN}-1.0.10-misdn.patch
+
+ # CVE-2006-1827: integer signedness error in format_jpeg (#131096)
+ epatch ${FILESDIR}/1.0.0/${PN}-1.0-CVE-2006-1827.patch
+}
+
+src_compile() {
+ # build asterisk first...
+ einfo "Building Asterisk..."
+ cd ${S}
+ emake -j1 || die "Make failed"
+
+ # create api docs
+ use doc && \
+ emake -j1 progdocs
+
+ #
+ # add-ons
+ #
+ einfo "Building additional stuff..."
+ cd ${S_ADDONS}
+ emake -j1 || die "Make failed"
+
+ if use resperl; then
+ cd ${S_ADDONS}/res_perl
+ emake -j1 || die "Building embedded perl failed"
+ fi
+}
+
+src_install() {
+ make DESTDIR=${D} install || die "Make install failed"
+ make DESTDIR=${D} samples || die "Make install samples failed"
+
+ # install astconf.h, a lot of external modules need this
+ insinto /usr/include/asterisk
+ doins astconf.h
+
+ # install addmailbox and astgenkey
+ dosbin contrib/scripts/addmailbox
+ dosbin contrib/scripts/astgenkey
+
+ newinitd ${FILESDIR}/1.0.0/asterisk.rc6.sec asterisk
+ newconfd ${FILESDIR}/1.0.0/asterisk.confd.sec asterisk
+
+ # don't delete these, even if they are empty
+ keepdir /var/spool/asterisk/voicemail/default/1234/INBOX
+ keepdir /var/spool/asterisk/tmp
+ keepdir /var/log/asterisk/cdr-csv
+ keepdir /var/run/asterisk
+
+ # install standard docs...
+ dodoc BUGS CREDITS LICENSE ChangeLog HARDWARE README README.fpm
+ dodoc SECURITY doc/CODING-GUIDELINES doc/linkedlists.README
+ dodoc doc/README.*
+ dodoc doc/*.txt
+
+ docinto scripts
+ dodoc contrib/scripts/*
+ docinto firmware/iax
+ dodoc contrib/firmware/iax/*
+
+ # install api docs
+ if use doc; then
+ insinto /usr/share/doc/${PF}/api/html
+ doins doc/api/html/*
+ fi
+
+ insinto /usr/share/doc/${PF}/cgi
+ doins contrib/scripts/vmail.cgi
+ doins images/*.gif
+
+ #
+ # add-ons
+ #
+
+ # install additional modules...
+ einfo "Installing additional modules..."
+ cd ${S_ADDONS}
+ make INSTALL_PREFIX=${D} install || die "Make install failed"
+
+ if use resperl; then
+ perlinfo
+
+ cd ${S_ADDONS}/res_perl
+ make INSTALL_PREFIX=${D} install || die "Installation of perl AST_API failed"
+
+ # move AstApiBase.so to a proper place
+ dodir ${VENDOR_LIB}/auto/AstAPIBase
+ mv ${D}/etc/asterisk/perl/AstAPIBase.so ${D}${VENDOR_LIB}/auto/AstAPIBase
+
+ # move *.pm files to other location
+ dodir ${VENDOR_LIB}/AstAPI
+ dodir ${VENDOR_LIB}/AstAPIBase
+ for x in AstAPI.pm AstConfig.pm LoadFile.pm PerlSwitch.pm WebServer.pm; do
+ mv ${D}/etc/asterisk/perl/${x} ${D}${VENDOR_LIB}/AstAPI
+ dosed "s/^use[\t ]\+${x/.pm/};/use AstAPI::${x/.pm/};/" /etc/asterisk/perl/asterisk_init.pm
+ done
+ mv ${D}/etc/asterisk/perl/AstAPIBase.pm ${D}${VENDOR_LIB}/AstAPIBase
+ dosed "s/^use[\t ]\+AstAPI;/use AstAPI::AstAPI;/" /etc/asterisk/perl/asterisk_init.pm
+ dosed "s/^use[\t ]\+AstAPIBase;/use AstAPIBase::AstAPIBase;/" ${VENDOR_LIB}/AstAPI/AstAPI.pm
+
+ # move apps + htdocs to a proper place
+ dodir /var/lib/asterisk/perl
+ mv ${D}/etc/asterisk/perl/{apps,htdocs} ${D}/var/lib/asterisk/perl
+
+ # fix locations
+ sed -i -e "s:/etc/asterisk/perl:/var/lib/asterisk/perl:" \
+ ${D}${VENDOR_LIB}/AstAPI/LoadFile.pm ${D}${VENDOR_LIB}/AstAPI/WebServer.pm
+ fi
+}
+
+pkg_preinst() {
+ einfo "Adding asterisk user and group"
+ enewgroup asterisk
+ enewuser asterisk -1 -1 /var/lib/asterisk asterisk
+}
+
+pkg_postinst() {
+ #
+ # Change permissions and ownerships of asterisk
+ # directories and files
+ #
+ einfo "Fixing permissions and ownerships"
+ # fix permissions in /var/...
+ for x in spool run lib log; do
+ chown -R asterisk:asterisk ${ROOT}var/${x}/asterisk
+ chmod -R u=rwX,g=rX,o= ${ROOT}var/${x}/asterisk
+ done
+
+ chown -R root:asterisk ${ROOT}etc/asterisk
+ chmod -R u=rwX,g=rX,o= ${ROOT}etc/asterisk
+
+ #
+ # Fix locations for old installations (pre-non-root versions)
+ #
+ if [[ -z "$(grep "/var/run/asterisk" ${ROOT}etc/asterisk/asterisk.conf)" ]]
+ then
+ einfo "Fixing astrundir in ${ROOT}etc/asterisk/asterisk.conf"
+ mv -f ${ROOT}etc/asterisk/asterisk.conf \
+ ${ROOT}etc/asterisk/asterisk.conf.bak
+ sed -e "s:^\(astrundir[\t ]=>\).*:\1 /var/run/asterisk:" \
+ ${ROOT}etc/asterisk/asterisk.conf.bak >\
+ ${ROOT}etc/asterisk/asterisk.conf
+ einfo "Backup has been saved as ${ROOT}etc/asterisk/asterisk.conf.bak"
+ fi
+
+ #
+ # Some messages
+ #
+ einfo "Asterisk has been installed"
+ einfo ""
+ einfo "to add new Mailboxes use: /usr/sbin/addmailbox"
+ einfo ""
+ einfo "If you want to know more about asterisk, visit these sites:"
+ einfo "http://www.asteriskdocs.org/"
+ einfo "http://www.voip-info.org/wiki-Asterisk"
+ echo
+ einfo "http://asterisk.xvoip.com/"
+ einfo "http://junghanns.net/asterisk/"
+ einfo "http://www.automated.it/guidetoasterisk.htm"
+ echo
+ einfo "Gentoo VoIP IRC Channel:"
+ einfo "#gentoo-voip @ irc.freenode.net"
+
+ #
+ # Warning about security changes...
+ #
+ ewarn "*********************** Important changes **************************"
+ ewarn
+ ewarn "- Asterisk runs as user asterisk, group asterisk by default"
+ ewarn
+ ewarn "- Make sure the asterisk user is a member of the proper groups if you want it"
+ ewarn " to have access to hardware devices, e.g. \"audio\" for Alsa and OSS sound or"
+ ewarn " \"dialout\" for zaptel!"
+ ewarn
+ ewarn "- Permissions of /etc/asterisk have been changed to root:asterisk"
+ ewarn " 750 (rwxr-x--- directories) / 640 (rw-r----- files)"
+ ewarn
+ ewarn "- Permissions of /var/{log,lib,run,spool}/asterisk have been changed"
+ ewarn " to asterisk:asterisk 750 / 640"
+ ewarn
+ ewarn "- Asterisk's unix socket and pidfile are now in /var/run/astrisk"
+ ewarn
+ ewarn "- Asterisk cannot set the IP ToS bits when run as user,"
+ ewarn " use something like this to make iptables set them for you:"
+ ewarn " \"iptables -A OUTPUT -t mangle -p udp -m udp --dport 5060 -j DSCP --set-dscp 0x28\""
+ ewarn " \"iptables -A OUTPUT -t mangle -p udp -m udp --sport 10000:20000 -j DSCP --set-dscp 0x28\""
+ ewarn " (taken from voip-info.org comments (see below), thanks andrewid)"
+ ewarn
+ ewarn "For more details:"
+ ewarn " http://bugs.gentoo.org/show_bug.cgi?id=88732"
+ ewarn " http://www.voip-info.org/wiki-Asterisk+non-root"
+}
diff --git a/net-misc/asterisk/asterisk-1.2.9_p1.ebuild b/net-misc/asterisk/asterisk-1.2.9_p1.ebuild
new file mode 100644
index 000000000000..fd5647cba1da
--- /dev/null
+++ b/net-misc/asterisk/asterisk-1.2.9_p1.ebuild
@@ -0,0 +1,531 @@
+# Copyright 1999-2006 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/net-misc/asterisk/asterisk-1.2.9_p1.ebuild,v 1.1 2006/06/07 18:08:56 stkn Exp $
+
+inherit eutils
+
+IUSE="alsa bri curl debug doc gtk h323 hardened lowmem mmx mysql \
+ nosamples odbc osp postgres pri speex sqlite ssl ukcid zaptel"
+
+#IUSE="alsa bri curl debug doc gtk genericjb h323 hardened lowmem mmx mysql \
+# nosamples odbc osp postgres pri speex sqlite ssl t38 ukcid zaptel"
+
+BRI_VERSION="0.3.0-PRE-1p"
+AST_PATCHES="1.2.9.1-patches-1.0"
+#T38_PATCHES="1.2.8-t38-20060423"
+#JB_PATCHES="1.2.5-genericjb-20060228"
+
+## NOTE:
+#
+# - genericjb dropped for now, latest patch doesn't apply
+# - t.38 support disabled in main tree (untested, probably needs current spandsp)
+
+MY_P="${P/_p/.}"
+
+DESCRIPTION="Asterisk: A Modular Open Source PBX System"
+HOMEPAGE="http://www.asterisk.org/"
+SRC_URI="http://ftp.digium.com/pub/asterisk/${MY_P}.tar.gz
+ http://www.netdomination.org/pub/asterisk/${PN}-${AST_PATCHES}.tar.bz2
+ bri? ( http://www.netdomination.org/pub/asterisk/${MY_P}-bristuff-${BRI_VERSION}.diff.gz
+ http://www.junghanns.net/downloads/bristuff-${BRI_VERSION}.tar.gz )"
+
+# t38? ( http://www.netdomination.org/pub/asterisk/${PN}-${T38_PATCHES}.tar.bz2 )"
+# bri? ( http://www.junghanns.net/downloads/bristuff-${BRI_VERSION}.tar.gz )"
+# genericjb? ( http://www.netdomination.org/pub/asterisk/${PN}-${JB_PATCHES}.patch.gz )
+
+
+S="${WORKDIR}/${MY_P}"
+S_BRI="${WORKDIR}/bristuff-${BRI_VERSION}"
+
+SLOT="0"
+LICENSE="GPL-2"
+KEYWORDS="~alpha ~amd64 ~hppa ~ppc ~sparc ~x86"
+
+RDEPEND="dev-libs/newt
+ media-sound/sox
+ media-sound/mpg123
+ ssl? ( dev-libs/openssl )
+ gtk? ( =x11-libs/gtk+-1.2* )
+ pri? ( >=net-libs/libpri-1.2.3 )
+ h323? ( >=dev-libs/pwlib-1.8.3
+ >=net-libs/openh323-1.15.0 )
+ alsa? ( media-libs/alsa-lib )
+ curl? ( net-misc/curl )
+ odbc? ( dev-db/unixODBC )
+ mysql? ( dev-db/mysql )
+ speex? ( media-libs/speex )
+ sqlite? ( <dev-db/sqlite-3.0.0 )
+ zaptel? ( >=net-misc/zaptel-1.2.6 )
+ postgres? ( dev-db/postgresql )
+ osp? ( >=net-libs/osptoolkit-3.3.4 )
+ bri? ( >=net-libs/libpri-1.2.3
+ >=net-misc/zaptel-1.2.6 )"
+
+DEPEND="${RDEPEND}
+ sys-devel/flex
+ sys-devel/bison
+ doc? ( app-doc/doxygen )"
+
+
+#
+# List of modules to ignore during scan (because they have been removed in 1.2.x)
+#
+SCAN_IGNORE_MODS="
+ app_qcall
+ chan_modem
+ chan_modem_i4l
+ chan_modem_bestdata
+ chan_modme_aopen"
+
+#
+# shortcuts
+#
+is_ast10update() {
+ return $(has_version "=net-misc/asterisk-1.0*")
+}
+
+is_astupdate() {
+ if ! is_ast10update; then
+ return $(has_version "<net-misc/asterisk-${PV}")
+ fi
+ return 0
+}
+
+#
+# Display a nice countdown...
+#
+countdown() {
+ local n
+
+ ebeep
+
+ n=${1:-10}
+ while [[ $n -gt 0 ]]; do
+ echo -en " Waiting $n second(s)...\r"
+ sleep 1
+ (( n-- ))
+ done
+}
+
+#
+# Scan for asterisk-1.0.x modules that will have to be updated
+#
+scan_modules() {
+ local modules_list=""
+ local n
+
+ for x in $(ls -1 ${ROOT}usr/lib/asterisk/modules/*.so); do
+ echo -en "Scanning.... $(basename ${x}) \r"
+
+ # skip blacklisted modules
+ hasq $(basename ${x//.so}) ${SCAN_IGNORE_MODS} && continue
+
+ if $(readelf -s "${x}" | grep -q "\(ast_load\|ast_destroy\)$"); then
+ modules_list="${modules_list} $(basename ${x//.so})"
+ fi
+ done
+
+ if [[ -n "${modules_list}" ]]; then
+ echo " ========================================================"
+ ewarn "Please update or unmerge the following modules:"
+ echo
+
+ n=0
+ for x in ${modules_list}; do
+ ewarn " - ${x}"
+ (( n++ ))
+ done
+
+ echo
+ ewarn "Warning: $n outdated module(s) found!"
+ ewarn "Warning: asterisk may not work if you don't update them!"
+ echo " ========================================================"
+ echo
+ einfo "You can use the \"asterisk-updater\" script to update the modules"
+ echo
+ countdown
+ echo
+ return 1
+ else
+ einfo "No asterisk-1.0.x modules found!"
+ return 0
+ fi
+}
+
+pkg_setup() {
+ local checkfailed=0 waitaftermsg=0
+
+ if is_ast10update; then
+ ewarn " Asterisk UPGRADE Warning"
+ ewarn ""
+ ewarn "- Please read ${ROOT}usr/share/doc/${PF}/UPGRADE.txt.gz after the installation!"
+ ewarn ""
+ ewarn " Asterisk UPGRADE Warning"
+ echo
+ waitaftermsg=1
+ fi
+
+ if use t38; then
+ ewarn "********************** Experimental Feature **************************"
+ ewarn "Please note that T.38 pass-through support is experimental and may not"
+ ewarn "be included in newer versions!"
+ echo
+ waitaftermsg=1
+ fi
+
+# if use genericjb; then
+# ewarn "********************** Experimental Feature **************************"
+# ewarn "Please note that generic jitterbuffer support is experimental and may not"
+# ewarn "be included in newer versions!"
+# echo
+# waitaftermsg=1
+# fi
+
+ if [[ $waitaftermsg -eq 1 ]]; then
+ einfo "Press Ctrl+C to abort"
+ echo
+ countdown
+ fi
+
+ #
+ # Regular checks
+ #
+ einfo "Running some pre-flight checks..."
+ echo
+
+ # check if zaptel has been compiled with ukcid too
+ if use ukcid; then
+ if ! built_with_use net-misc/zaptel ukcid; then
+ eerror "- ukcid: Re-emerge zaptel with \"ukcid\" useflag enabled!"
+ checkfailed=1
+ fi
+ fi
+
+ # check if zaptel and libpri have been built with bri enabled
+ if use bri; then
+ if ! built_with_use net-misc/zaptel bri; then
+ eerror "- bri: Re-emerge zaptel with \"bri\" useflag enabled!"
+ heckfailed=1
+ fi
+
+ if ! built_with_use net-libs/libpri bri; then
+ eerror "- bri: Re-emerge libpri with \"bri\" useflag enabled!"
+ checkfailed=1
+ fi
+ fi
+
+ # stop here if checks failed
+ [[ $checkfailed -eq 1 ]] && \
+ die "Pre-flight check failed, see messages for more information!"
+}
+
+src_unpack() {
+ unpack ${A}
+ cd ${S}
+
+ #
+ # gentoo patchset
+ #
+ for x in $(grep -v "^#\| \+" ${WORKDIR}/patches/patches.list); do
+ epatch ${WORKDIR}/patches/${x}
+ done
+
+ if use mmx; then
+ if ! use hardened; then
+ einfo "Enabling mmx optimization"
+ sed -i -e "s:^#\(K6OPT[\t ]\+= -DK6OPT\):\1:" \
+ Makefile
+ else
+ ewarn "Hardened use-flag is set, not enabling mmx optimization for codec_gsm!"
+ fi
+ fi
+
+ if ! use debug; then
+ einfo "Disabling debug support"
+ sed -i -e "s:^\(DEBUG=\):#\1:" \
+ Makefile
+ fi
+
+ if ! use ssl; then
+ einfo "Disabling crypto support"
+ sed -i -e "s:^#\(NOCRYPTO=yes\):\1:" \
+ Makefile
+ fi
+
+ #
+ # uclibc patch
+ #
+ if use elibc_uclibc; then
+ einfo "Patching asterisk for uclibc..."
+ epatch ${FILESDIR}/1.0.0/${PN}-1.0.5-uclibc-dns.diff
+ epatch ${FILESDIR}/1.2.0/${PN}-1.2.1-uclibc-getloadavg.diff
+ fi
+
+ #
+ # ukcid patch from http://www.lusyn.com/asterisk/
+ #
+ if use ukcid; then
+ einfo "Patching asterisk for UK Callerid..."
+ epatch ${FILESDIR}/1.2.0/${PN}-1.2.0_beta-ukcid.patch
+ fi
+
+ #
+ # BRI patches
+ #
+ if use bri; then
+ einfo "Patching asterisk w/ BRI stuff"
+
+ epatch ${WORKDIR}/${MY_P}-bristuff-${BRI_VERSION}.diff
+# epatch ${S_BRI}/patches/asterisk.patch
+ fi
+
+ #
+ # T.38 pass-through patch (asterisk bug #5090)
+ #
+# if use t38; then
+# einfo "T.38 experimental pass-through support (ast #5090)"
+# epatch ${WORKDIR}/asterisk-${T38_PATCHES}.patch
+#
+# if use bri; then
+# epatch ${WORKDIR}/asterisk-${T38_PATCHES}-bri.patch
+# else
+# epatch ${WORKDIR}/asterisk-${T38_PATCHES}-nobri.patch
+# fi
+# fi
+
+ #
+ # Generic jitterbuffer (asterisk bug #3854)
+ #
+# if use genericjb; then
+# einfo "Generic jitterbuffer (ast #3854)"
+# epatch ${WORKDIR}/${PN}-${JB_PATCHES}.patch
+#
+# sed -i -e "s:^\(GENERIC_JB = \)#-DAST_JB:\1 -DAST_JB:" \
+# Makefile
+# fi
+}
+
+src_compile() {
+ local myopts
+
+ use lowmem && \
+ myopts="-DLOW_MEMORY"
+
+ if use h323; then
+ einfo "Building H.323 wrapper lib..."
+ make -C channels/h323 \
+ NOTRACE=1 \
+ PWLIBDIR=/usr/share/pwlib \
+ OPENH323DIR=/usr/share/openh323 \
+ libchanh323.a Makefile.ast || die "Make h323 failed"
+ fi
+
+ einfo "Building Asterisk..."
+ make \
+ NOTRACE=1 \
+ OPTIMIZE="${CFLAGS}" \
+ PWLIBDIR=/usr/share/pwlib \
+ OPENH323DIR=/usr/share/openh323 \
+ OPTIONS="${myopts}" || die "Make failed"
+
+ # create api docs
+ use doc && \
+ make progdocs
+
+ # build bristuff's ISDNguard
+ use bri && \
+ make -C ${S_BRI}/ISDNguard
+}
+
+src_install() {
+
+ # install asterisk
+ make DESTDIR=${D} install || die "Make install failed"
+ make DESTDIR=${D} samples || die "Failed to create sample files"
+
+ # remove bristuff capi
+ use bri && \
+ rm -f ${D}usr/lib/asterisk/modules/{app,chan}_capi*.so 2>/dev/null
+
+ # remove installed sample files if nosamples flag is set
+ if use nosamples; then
+ einfo "Skipping installation of sample files..."
+ rm -rf ${D}var/spool/asterisk/voicemail/default
+ rm -f ${D}var/lib/asterisk/mohmp3/*
+ rm -f ${D}var/lib/asterisk/sounds/demo-*
+ rm -f ${D}var/lib/asterisk/agi-bin/*
+ else
+ einfo "Sample files have been installed"
+ keepdir /var/spool/asterisk/voicemail/default/1234/INBOX
+ fi
+
+ # move sample configuration files to doc directory
+ if is_ast10update; then
+ einfo "Updating from old (pre-1.2) asterisk version, new configuration files have been installed"
+ einfo "into ${ROOT}etc/asterisk, use etc-update or dispatch-conf to update them"
+ elif has_version "net-misc/asterisk"; then
+ einfo "Configuration samples have been moved to: $ROOT/usr/share/doc/${PF}/conf"
+ insinto /usr/share/doc/${PF}/conf
+ doins ${D}etc/asterisk/*.conf* /usr/share/doc/${PF}/conf
+ rm -f ${D}etc/asterisk/*.conf* 2>/dev/null
+ fi
+
+ # don't delete these directories, even if they are empty
+ for x in voicemail meetme system dictate monitor tmp; do
+ keepdir /var/spool/asterisk/${x}
+ done
+ keepdir /var/lib/asterisk/sounds/priv-callerintros
+ keepdir /var/lib/asterisk/mohmp3
+ keepdir /var/lib/asterisk/agi-bin
+ keepdir /var/log/asterisk/cdr-csv
+ keepdir /var/log/asterisk/cdr-custom
+ keepdir /var/run/asterisk
+
+ # install asterisk.h, a lot of external modules need this
+ insinto /usr/include/asterisk
+ doins include/asterisk.h
+
+ # install astgenkey, astxs, safe_asterisk and manpages
+ dobin contrib/scripts/astxs
+ dosbin contrib/scripts/astgenkey
+ dosbin contrib/scripts/safe_asterisk
+ doman contrib/scripts/safe_asterisk.8
+ doman contrib/scripts/astgenkey.8
+
+ newinitd ${FILESDIR}/1.2.0/asterisk.rc6 asterisk
+ newconfd ${FILESDIR}/1.2.0/asterisk.confd asterisk
+
+ # install standard docs...
+ dodoc BUGS CREDITS LICENSE ChangeLog HARDWARE README README.fpm
+ dodoc SECURITY doc/CODING-GUIDELINES doc/linkedlists.README UPGRADE.txt
+ dodoc doc/README.*
+ dodoc doc/*.txt
+
+ docinto scripts
+ dodoc contrib/scripts/*
+
+ docinto utils
+ dodoc contrib/utils/*
+
+ docinto configs
+ dodoc configs/*
+
+ # install api docs
+ if use doc; then
+ insinto /usr/share/doc/${PF}/api/html
+ doins doc/api/html/*
+ fi
+
+ # install ISDNguard
+ if use bri; then
+ cd ${S_BRI}/ISDNguard
+ dosbin ISDNguard
+
+ docinto ISDNguard
+ dodoc INSTALL.ISDNguard
+
+ cd ${S}
+ fi
+
+ insinto /usr/share/doc/${PF}/cgi
+ doins contrib/scripts/vmail.cgi
+ doins images/*.gif
+
+ # install asterisk-updater
+ dosbin ${FILESDIR}/1.2.0/asterisk-updater
+}
+
+pkg_preinst() {
+ enewgroup asterisk
+ enewuser asterisk -1 -1 /var/lib/asterisk asterisk
+}
+
+pkg_postinst() {
+ einfo "Fixing permissions"
+ for x in spool run lib log; do
+ chown -R asterisk:asterisk ${ROOT}var/${x}/asterisk
+ chmod -R u=rwX,g=rX,o= ${ROOT}var/${x}/asterisk
+ done
+
+ chown -R root:asterisk ${ROOT}etc/asterisk
+ chmod -R u=rwX,g=rX,o= ${ROOT}etc/asterisk
+ echo
+
+ #
+ # Announcements, warnings, reminders...
+ #
+ einfo "Asterisk has been installed"
+ einfo ""
+ einfo "If you want to know more about asterisk, visit these sites:"
+ einfo "http://www.asteriskdocs.org/"
+ einfo "http://www.voip-info.org/wiki-Asterisk"
+ echo
+ einfo "http://asterisk.xvoip.com/"
+ einfo "http://junghanns.net/asterisk/"
+ einfo "http://www.automated.it/guidetoasterisk.htm"
+ echo
+ einfo "Gentoo VoIP IRC Channel:"
+ einfo "#gentoo-voip @ irc.freenode.net"
+ echo
+ echo
+
+ #
+ # Warning about 1.0 -> 1.2 changes...
+ #
+ if is_ast10update; then
+ ewarn ""
+ ewarn "- Please read ${ROOT}usr/share/doc/${PF}/UPGRADE.txt.gz before continuing"
+ ewarn ""
+ fi
+
+ if is_astupdate; then
+ ewarn ""
+ ewarn " - The initgroups patch has been dropped, please update your"
+ ewarn " \"conf.d/asterisk\" and \"init.d/asterisk\" file!"
+ ewarn ""
+ fi
+
+# if use t38; then
+# ewarn "********************** Experimental Feature **************************"
+# ewarn "Please note that T.38 pass-through support is experimental and may not"
+# ewarn "be included in newer versions!"
+# echo
+# fi
+# if use genericjb; then
+# ewarn "********************** Experimental Feature **************************"
+# ewarn "Please note that generic jitterbuffer support is experimental and may not"
+# ewarn "be included in newer versions!"
+# echo
+# fi
+
+ # scan for old modules
+ if is_ast10update; then
+ einfo "Asterisk has been updated from pre-1.2.x, scanning for old modules"
+ scan_modules
+ fi
+}
+
+pkg_config() {
+ einfo "Do you want to reset file permissions and ownerships (y/N)?"
+
+ read tmp
+ tmp="$(echo $tmp | tr [:upper:] [:lower:])"
+
+ if [[ "$tmp" = "y" ]] ||\
+ [[ "$tmp" = "yes" ]]
+ then
+ einfo "Resetting permissions to defaults..."
+
+ for x in spool run lib log; do
+ chown -R asterisk:asterisk ${ROOT}var/${x}/asterisk
+ chmod -R u=rwX,g=rX,o= ${ROOT}var/${x}/asterisk
+ done
+
+ chown -R root:asterisk ${ROOT}etc/asterisk
+ chmod -R u=rwX,g=rX,o= ${ROOT}etc/asterisk
+
+ einfo "done"
+ else
+ einfo "skipping"
+ fi
+}
diff --git a/net-misc/asterisk/files/digest-asterisk-1.0.11_p1 b/net-misc/asterisk/files/digest-asterisk-1.0.11_p1
new file mode 100644
index 000000000000..03337645f3c0
--- /dev/null
+++ b/net-misc/asterisk/files/digest-asterisk-1.0.11_p1
@@ -0,0 +1,9 @@
+MD5 8186db9d5dd9d3918d0f8092e5772821 asterisk-1.0.11.1.tar.gz 9642342
+RMD160 052732640d4e7aac61a03443affaa348bd7002c8 asterisk-1.0.11.1.tar.gz 9642342
+SHA256 7290dc98ffba348eeecf98d01a8939d72fee03737af2cefb0fb851a48c47c061 asterisk-1.0.11.1.tar.gz 9642342
+MD5 2b6e1da3ff097f9792d3123e7e5a0059 asterisk-addons-1.0.9.tar.gz 73716
+RMD160 98156861f790987fb4bf86b14c902aeca90b380b asterisk-addons-1.0.9.tar.gz 73716
+SHA256 4c878a4e5b5aabbdd93116ccbca5cf6465d55f480f4aa1e6438e9fc49c1f11fe asterisk-addons-1.0.9.tar.gz 73716
+MD5 4306e18c195e6b1a37af02fedd4a153e bristuff-0.2.0-RC8r.tar.gz 194888
+RMD160 d5dd31b9e4dcf30af6d2a62deb285a83f8a54019 bristuff-0.2.0-RC8r.tar.gz 194888
+SHA256 99f9da320d6335413384d12310e5ae9815572281c99d5908706022b6a4d6cb03 bristuff-0.2.0-RC8r.tar.gz 194888
diff --git a/net-misc/asterisk/files/digest-asterisk-1.2.9_p1 b/net-misc/asterisk/files/digest-asterisk-1.2.9_p1
new file mode 100644
index 000000000000..2b8d87f81880
--- /dev/null
+++ b/net-misc/asterisk/files/digest-asterisk-1.2.9_p1
@@ -0,0 +1,12 @@
+MD5 1a48e3fd9acd853645806dbc15bd4fda asterisk-1.2.9.1-patches-1.0.tar.bz2 7146
+RMD160 b7a0ba75ccfdae1364b44dc1f40f32f95451c10c asterisk-1.2.9.1-patches-1.0.tar.bz2 7146
+SHA256 f5ab925d76da82c3952b3c86f615a6cec08adfdc1b60985b6b86f5d4d7aab1b2 asterisk-1.2.9.1-patches-1.0.tar.bz2 7146
+MD5 1322e2b2d6df9d26e8fe14009c9e389a asterisk-1.2.9.1-bristuff-0.3.0-PRE-1p.diff.gz 101646
+RMD160 d36f6cd71d7442e8c8e2c9d3c2d28d4d0460b9a0 asterisk-1.2.9.1-bristuff-0.3.0-PRE-1p.diff.gz 101646
+SHA256 70a7ab0cb1480254015802c296ce370b6c28d84a5e961422dc8be7e33ef29c54 asterisk-1.2.9.1-bristuff-0.3.0-PRE-1p.diff.gz 101646
+MD5 d98fc3dc5ee8df691ca2b0bd309bb251 asterisk-1.2.9.1.tar.gz 10568287
+RMD160 d512d3560812bc267a4d372cc96f989e26d7042a asterisk-1.2.9.1.tar.gz 10568287
+SHA256 6569080ee10a6dd9b554fc04a33641bc0964abc0502f797cdfefadafe2b6e71d asterisk-1.2.9.1.tar.gz 10568287
+MD5 842636e711ff9d9977099db5af091fd7 bristuff-0.3.0-PRE-1p.tar.gz 254003
+RMD160 e87c0289bc598b52b962d192bc54008edc9b38a9 bristuff-0.3.0-PRE-1p.tar.gz 254003
+SHA256 d7dbb352ac68d64458919b94f815c8c97418c54fa8ae5411084370325528c164 bristuff-0.3.0-PRE-1p.tar.gz 254003