|
|
|
##
|
|
|
|
## asterisk.spec -- OpenPKG RPM Package Specification
|
|
|
|
## Copyright (c) 2000-2008 OpenPKG Foundation e.V. <http://openpkg.net/>
|
|
|
|
##
|
|
|
|
## Permission to use, copy, modify, and distribute this software for
|
|
|
|
## any purpose with or without fee is hereby granted, provided that
|
|
|
|
## the above copyright notice and this permission notice appear in all
|
|
|
|
## copies.
|
|
|
|
##
|
|
|
|
## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
|
|
|
|
## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
|
|
|
## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
|
|
|
## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
|
|
|
|
## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
|
|
## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
|
|
## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
|
|
|
|
## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
|
|
|
## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
|
|
## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
|
|
|
## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
## SUCH DAMAGE.
|
|
|
|
##
|
|
|
|
|
|
|
|
# package version
|
|
|
|
%define V_asterisk 1.2.14
|
|
|
|
%define V_asterisk_addons 1.2.5
|
|
|
|
%define V_asterisk_sounds 1.2.1
|
|
|
|
%define V_asterisk_libiax 0.2.2
|
|
|
|
%define V_app_conference 20051216
|
|
|
|
%define V_asterisk_perl 0.10
|
|
|
|
%define V_chan_capi 1_6_1
|
|
|
|
|
|
|
|
# package information
|
|
|
|
Name: asterisk
|
|
|
|
Summary: Private Branch Exchange (PBX) for VoIP
|
|
|
|
URL: http://www.asterisk.org/
|
|
|
|
Vendor: Mark Spencer et al.
|
|
|
|
Packager: OpenPKG Foundation e.V.
|
|
|
|
Distribution: OpenPKG Community
|
|
|
|
Class: BASE
|
|
|
|
Group: VoIP
|
|
|
|
License: GPL
|
|
|
|
Version: %{V_asterisk}
|
|
|
|
Release: 20080101
|
|
|
|
|
|
|
|
# package options
|
|
|
|
%option with_zaptel no
|
|
|
|
%option with_capi no
|
|
|
|
%option with_mp3 no
|
|
|
|
|
|
|
|
# list of sources
|
|
|
|
Source0: ftp://ftp.digium.com/pub/asterisk/releases/asterisk-%{V_asterisk}.tar.gz
|
|
|
|
Source1: ftp://ftp.digium.com/pub/asterisk/releases/asterisk-addons-%{V_asterisk_addons}.tar.gz
|
|
|
|
Source2: ftp://ftp.digium.com/pub/asterisk/releases/asterisk-sounds-%{V_asterisk_sounds}.tar.gz
|
|
|
|
Source3: ftp://ftp.digium.com/pub/libiax/iax-%{V_asterisk_libiax}.tar.gz
|
|
|
|
Source4: ftp://ftp.openpkg.org/sources/CPY/VERSIONED/asterisk/app_conference-%{V_app_conference}.tar.gz
|
|
|
|
Source5: http://asterisk.gnuinter.net/files/asterisk-perl-%{V_asterisk_perl}.tar.gz
|
|
|
|
Source6: http://www.turbocat.net/~hselasky/capi4pbx/releases/chan_capi_%{V_chan_capi}.tar.bz2
|
|
|
|
Source7: asterisk.txt
|
|
|
|
Source8: rc.asterisk
|
|
|
|
Patch0: asterisk.patch
|
|
|
|
|
|
|
|
# build information
|
|
|
|
Prefix: %{l_prefix}
|
|
|
|
BuildRoot: %{l_buildroot}
|
|
|
|
BuildPreReq: OpenPKG, openpkg >= 20040130, bison, gcc, make, grep
|
|
|
|
PreReq: OpenPKG, openpkg >= 20040130
|
|
|
|
BuildPreReq: zlib, curl, openssl, ncurses, speex
|
|
|
|
PreReq: zlib, curl, openssl, ncurses, speex
|
|
|
|
BuildPreReq: perl, perl-openpkg
|
|
|
|
PreReq: perl
|
|
|
|
%if "%{with_mp3}" == "yes"
|
|
|
|
PreReq: mpg123
|
|
|
|
%endif
|
|
|
|
AutoReq: no
|
|
|
|
AutoReqProv: no
|
|
|
|
|
|
|
|
%description
|
|
|
|
Asterisk is a complete Private Branch Exchange (PBX) in software.
|
|
|
|
It provides all of the features you would expect from a PBX and
|
|
|
|
more. Asterisk does Voice over IP (VoIP) in many protocols. Asterisk
|
|
|
|
provides Voicemail services with Directory, Call Conferencing,
|
|
|
|
Interactive Voice Response and Call Queuing. It has support for
|
|
|
|
three-way calling, caller ID services, ADSI, SIP, etc. Asterisk
|
|
|
|
needs no additional hardware for VoIP.
|
|
|
|
|
|
|
|
NOTICE: This OpenPKG packaging of Asterisk is special according to
|
|
|
|
the following aspects: 1. for full portability this package does
|
|
|
|
NOT include Asterisk support for any telephony hardware, 2. this
|
|
|
|
package uses a stripped down default configuration which provides
|
|
|
|
an out-of-the-box VoIP configuration for a small organisation,
|
|
|
|
3. this package includes the add-on Asterisk application module
|
|
|
|
"app_conference" for hardware-timer independent conferencing, and 4.
|
|
|
|
this package includes the Perl Asterisk::AGI module.
|
|
|
|
|
|
|
|
%track
|
|
|
|
prog asterisk = {
|
|
|
|
version = %{V_asterisk}
|
|
|
|
url = ftp://ftp.digium.com/pub/asterisk/releases/
|
|
|
|
regex = asterisk-(\d+\.\d+(\.\d+)+)\.tar\.gz
|
|
|
|
}
|
|
|
|
prog asterisk:addons = {
|
|
|
|
version = %{V_asterisk_addons}
|
|
|
|
url = ftp://ftp.digium.com/pub/asterisk/releases/
|
|
|
|
regex = asterisk-addons-(\d+\.\d+(\.\d+)+)\.tar\.gz
|
|
|
|
}
|
|
|
|
prog asterisk:sounds = {
|
|
|
|
version = %{V_asterisk_sounds}
|
|
|
|
url = ftp://ftp.digium.com/pub/asterisk/releases/
|
|
|
|
regex = asterisk-sounds-(\d+\.\d+(\.\d+)+)\.tar\.gz
|
|
|
|
}
|
|
|
|
prog asterisk:libiax = {
|
|
|
|
version = %{V_asterisk_libiax}
|
|
|
|
url = ftp://ftp.digium.com/pub/libiax/
|
|
|
|
regex = iax-(\d+\.\d+(\.\d+)+)\.tar\.gz
|
|
|
|
}
|
|
|
|
prog asterisk:agi = {
|
|
|
|
version = %{V_asterisk_perl}
|
|
|
|
url = http://asterisk.gnuinter.net/files/
|
|
|
|
regex = asterisk-perl-(__VER__)\.tar\.gz
|
|
|
|
}
|
|
|
|
prog asterisk:chan_capi = {
|
|
|
|
version = %{V_chan_capi}
|
|
|
|
url = http://www.turbocat.net/~hselasky/capi4pbx/releases/
|
|
|
|
regex = chan_capi_(__VER__)\.tar\.bz2
|
|
|
|
}
|
|
|
|
|
|
|
|
%prep
|
|
|
|
%setup -q
|
|
|
|
%setup -q -D -T -a 1
|
|
|
|
%setup -q -D -T -a 2
|
|
|
|
%setup -q -D -T -a 3
|
|
|
|
%setup -q -D -T -a 4
|
|
|
|
%setup -q -D -T -a 5
|
|
|
|
%setup -q -D -T -a 6
|
|
|
|
%patch -p0
|
|
|
|
|
|
|
|
%build
|
|
|
|
# sanity check
|
|
|
|
%if "%{with_zaptel}" == "yes"
|
|
|
|
case "%{l_platform -t}" in
|
|
|
|
*-linux* )
|
|
|
|
if [ ! -f /usr/include/linux/zaptel.h ]; then
|
|
|
|
echo "option \"with_zaptel\" requires Zaptel Linux drivers installed" 1>&2; exit 1
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
*-freebsd* )
|
|
|
|
if [ ! -f /usr/local/include/zaptel.h ]; then
|
|
|
|
echo "option \"with_zaptel\" requires Zaptel FreeBSD drivers installed" 1>&2; exit 1
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
* ) echo "option \"with_zaptel\" supported under Linux and FreeBSD only" 1>&2; exit 1 ;;
|
|
|
|
esac
|
|
|
|
%endif
|
|
|
|
%if "%{with_capi}" == "yes"
|
|
|
|
case "%{l_platform -t}" in
|
|
|
|
*-freebsd* | *-netbsd* )
|
|
|
|
if [ ! -f /usr/include/i4b/include/capi20.h ]; then
|
|
|
|
echo "option \"with_chan_capi\" requires I4B 1.6 or newer installed" 1>&2; exit 1
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
* ) echo "option \"with_capi\" supported under FreeBSD and NetBSD only" 1>&2; exit 1 ;;
|
|
|
|
esac
|
|
|
|
%endif
|
|
|
|
|
|
|
|
# re-configure music-on-hold to find mpg123
|
|
|
|
%if "%{with_mp3}" == "yes"
|
|
|
|
mpg123="%{l_prefix}/bin/mpg123"
|
|
|
|
%else
|
|
|
|
mpg123="`which false`"
|
|
|
|
%endif
|
|
|
|
%{l_shtool} subst \
|
|
|
|
-e "s;/usr/local/bin/mpg123;$mpg123;" \
|
|
|
|
-e "s;/usr/bin/mpg123;$mpg123;" \
|
|
|
|
res/res_musiconhold.c apps/app_mp3.c
|
|
|
|
|
|
|
|
# build program
|
|
|
|
%{l_make} %{l_mflags} \
|
|
|
|
%if "%{with_zaptel}" == "no"
|
|
|
|
WITHOUT_ZAPTEL=1 \
|
|
|
|
%endif
|
|
|
|
CC="%{l_cc}" \
|
|
|
|
INSTALL_PREFIX=%{l_prefix}
|
|
|
|
|
|
|
|
# build addon modules
|
|
|
|
( cd app_conference
|
|
|
|
%{l_make} %{l_mflags} \
|
|
|
|
INSTALL_PREFIX=%{l_prefix}
|
|
|
|
) || exit $?
|
|
|
|
%if "%{with_capi}" == "yes"
|
|
|
|
( cd chan_capi_*
|
|
|
|
%{l_make} %{l_mflags} \
|
|
|
|
INSTALL_PREFIX=%{l_prefix}
|
|
|
|
) || exit $?
|
|
|
|
%endif
|
|
|
|
|
|
|
|
# build libiax
|
|
|
|
( cd iax-%{V_asterisk_libiax}
|
|
|
|
CC="%{l_cc}" \
|
|
|
|
CFLAGS="%{l_cflags -O}" \
|
|
|
|
./configure \
|
|
|
|
--prefix=%{l_prefix} \
|
|
|
|
--disable-shared
|
|
|
|
%{l_make} %{l_mflags -O}
|
|
|
|
) || exit $?
|
|
|
|
|
|
|
|
# build Perl API
|
|
|
|
%{l_prefix}/bin/perl-openpkg prepare
|
|
|
|
%{l_prefix}/bin/perl-openpkg -d asterisk-perl-%{V_asterisk_perl} configure build
|
|
|
|
|
|
|
|
%install
|
|
|
|
# install program
|
|
|
|
rm -rf $RPM_BUILD_ROOT
|
|
|
|
%{l_make} %{l_mflags} install \
|
|
|
|
DESTDIR=$RPM_BUILD_ROOT \
|
|
|
|
INSTALL_PREFIX=%{l_prefix}
|
|
|
|
|
|
|
|
# install additional sounds
|
|
|
|
( cd asterisk-sounds-%{V_asterisk_sounds}
|
|
|
|
%{l_make} %{l_mflags} install \
|
|
|
|
DESTDIR=$RPM_BUILD_ROOT \
|
|
|
|
ASTVARLIBDIR=%{l_prefix}/share/asterisk \
|
|
|
|
INSTALL="%{l_shtool} install -c"
|
|
|
|
) || exit $?
|
|
|
|
%if "%{with_mp3}" == "yes"
|
|
|
|
%{l_shtool} install -c -m 644 %{l_value -s -a} \
|
|
|
|
sounds/*.mp3 $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/mohmp3/
|
|
|
|
%endif
|
|
|
|
|
|
|
|
# install addon modules
|
|
|
|
( cd app_conference
|
|
|
|
%{l_make} %{l_mflags} install \
|
|
|
|
INSTALL_PREFIX=$RPM_BUILD_ROOT%{l_prefix} \
|
|
|
|
INSTALL="%{l_shtool} install -c"
|
|
|
|
) || exit $?
|
|
|
|
%if "%{with_capi}" == "yes"
|
|
|
|
( cd chan_capi_*
|
|
|
|
%{l_make} %{l_mflags} install \
|
|
|
|
INSTALL_PREFIX=$RPM_BUILD_ROOT%{l_prefix} \
|
|
|
|
INSTALL="%{l_shtool} install -c"
|
|
|
|
) || exit $?
|
|
|
|
%endif
|
|
|
|
|
|
|
|
# install libiax
|
|
|
|
( cd iax-%{V_asterisk_libiax}
|
|
|
|
%{l_make} %{l_mflags} install DESTDIR=$RPM_BUILD_ROOT
|
|
|
|
) || exit $?
|
|
|
|
|
|
|
|
# install Perl API
|
|
|
|
%{l_prefix}/bin/perl-openpkg -d asterisk-perl-%{V_asterisk_perl} install
|
|
|
|
%{l_shtool} install -c -m 644 %{l_value -s -a} \
|
|
|
|
-e 's;/usr/bin/perl;%{l_prefix}/bin/perl;' \
|
|
|
|
asterisk-perl-%{V_asterisk_perl}/examples/* \
|
|
|
|
$RPM_BUILD_ROOT%{l_prefix}/lib/asterisk/agi-bin/
|
|
|
|
%{l_prefix}/bin/perl-openpkg -F perl-openpkg-files fixate cleanup
|
|
|
|
|
|
|
|
# strip down installation
|
|
|
|
rm -f $RPM_BUILD_ROOT%{l_prefix}/sbin/autosupport >/dev/null 2>&1 || true
|
|
|
|
rm -f $RPM_BUILD_ROOT%{l_prefix}/sbin/safe_asterisk >/dev/null 2>&1 || true
|
|
|
|
rm -f $RPM_BUILD_ROOT%{l_prefix}/man/man8/autosupport.8 >/dev/null 2>&1 || true
|
|
|
|
rm -f $RPM_BUILD_ROOT%{l_prefix}/man/man8/safe_asterisk.8 >/dev/null 2>&1 || true
|
|
|
|
rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/firmware >/dev/null 2>&1 || true
|
|
|
|
rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/images >/dev/null 2>&1 || true
|
|
|
|
|
|
|
|
# post-adjust installation
|
|
|
|
strip $RPM_BUILD_ROOT%{l_prefix}/sbin/* >/dev/null 2>&1 || true
|
|
|
|
for bin in $RPM_BUILD_ROOT%{l_prefix}/lib/asterisk/agi-bin/*.*; do
|
|
|
|
mv $bin `echo $bin | sed -e 's;\.[^.]*$;;'`
|
|
|
|
done
|
|
|
|
|
|
|
|
# install default configuration
|
|
|
|
for name in `grep "^<file" %{SOURCE asterisk.txt} | sed -e 's;^.*name=";;' -e 's;".*$;;'`; do
|
|
|
|
%if "%{with_zaptel}" == "no"
|
|
|
|
[ ".$name" = ".zapata.conf" ] && continue
|
|
|
|
%endif
|
|
|
|
%if "%{with_capi}" == "no"
|
|
|
|
[ ".$name" = ".capi.conf" ] && continue
|
|
|
|
%endif
|
|
|
|
(echo ""; cat %{SOURCE asterisk.txt}; echo "") |\
|
|
|
|
sed -e "1,/^<file name=\"$name\">/d" -e "/<\/file>/,\$d" >$name
|
|
|
|
%{l_shtool} install -c -m 644 %{l_value -s -a} \
|
|
|
|
$name $RPM_BUILD_ROOT%{l_prefix}/etc/asterisk/
|
|
|
|
done
|
|
|
|
|
|
|
|
# install run-command script
|
|
|
|
%{l_shtool} mkdir -f -p -m 755 \
|
|
|
|
$RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
|
|
|
|
%{l_shtool} install -c -m 755 %{l_value -s -a} \
|
|
|
|
%{SOURCE rc.asterisk} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
|
|
|
|
|
|
|
|
# determine installation files
|
|
|
|
%{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
|
|
|
|
%{l_files_std} `cat perl-openpkg-files` \
|
|
|
|
'%config %attr(640,%{l_mgrp},%{l_rgrp}) %{l_prefix}/etc/asterisk/*' \
|
|
|
|
'%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/asterisk/*' \
|
|
|
|
'%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/asterisk/*/*'
|
|
|
|
|
|
|
|
%files -f files
|
|
|
|
|
|
|
|
%clean
|
|
|
|
rm -rf $RPM_BUILD_ROOT
|
|
|
|
|
|
|
|
%post
|
|
|
|
# after upgrade, restart service
|
|
|
|
[ $1 -eq 2 ] || exit 0
|
|
|
|
eval `%{l_rc} asterisk status 2>/dev/null`
|
|
|
|
[ ".$asterisk_active" = .yes ] && %{l_rc} asterisk restart
|
|
|
|
exit 0
|
|
|
|
|
|
|
|
%preun
|
|
|
|
# before erase, stop service and remove log files
|
|
|
|
[ $1 -eq 0 ] || exit 0
|
|
|
|
%{l_rc} asterisk stop 2>/dev/null
|
|
|
|
rm -f $RPM_INSTALL_PREFIX/var/asterisk/log/* >/dev/null 2>&1 || true
|
|
|
|
rm -f $RPM_INSTALL_PREFIX/var/asterisk/log/cdr-*/* >/dev/null 2>&1 || true
|
|
|
|
rm -f $RPM_INSTALL_PREFIX/var/asterisk/run/* >/dev/null 2>&1 || true
|
|
|
|
rm -f $RPM_INSTALL_PREFIX/var/asterisk/spool/*/* >/dev/null 2>&1 || true
|
|
|
|
rm -f $RPM_INSTALL_PREFIX/var/asterisk/spool/astdb >/dev/null 2>&1 || true
|
|
|
|
exit 0
|
|
|
|
|