diff -r 2ff4e4701310 -r 73d852a30c9a asterisk/asterisk.spec --- a/asterisk/asterisk.spec Sun Mar 20 19:27:35 2011 +0100 +++ b/asterisk/asterisk.spec Sun Mar 20 20:00:02 2011 +0100 @@ -1,7 +1,6 @@ ## ## asterisk.spec -- OpenPKG RPM Package Specification -## Copyright (c) 2000-2007 OpenPKG Foundation e.V. -## Copyright (c) 2000-2007 Ralf S. Engelschall +## Copyright (c) 2000-2010 OpenPKG Foundation e.V. ## ## Permission to use, copy, modify, and distribute this software for ## any purpose with or without fee is hereby granted, provided that @@ -22,146 +21,102 @@ ## SUCH DAMAGE. ## -# package component versions -%define V_langsounds 1.4.12 -%define V_extrasounds 1.4.9 -%define V_amoomasounds 1.4 -%define V_customsounds 1.0 -%define V_chan_capi 1.1.2 +# package version +%define V_opkg 1.6.2.13 +%define V_asterisk 1.6.2.13 +%define V_asterisk_addons 1.6.2.2 +%define V_asterisk_sounds_core_en 1.4.20 +%define V_asterisk_sounds_core_de current +%define V_asterisk_sounds_extra_en 1.4.11 +%define V_chan_capi 1.1.5 # package information Name: asterisk -Summary: Private Branch Exchange (PBX) for VoIP +Summary: Private Branch Exchange (PBX) URL: http://www.asterisk.org/ Vendor: Mark Spencer et al. -Packager: Michael Schloh von Bennewitz -Distribution: Michael Schloh von Bennewitz -Class: EVAL +Packager: OpenPKG Foundation e.V. +Distribution: OpenPKG Community +Class: BASE Group: VoIP License: GPL -Version: 1.4.24.1 -Release: 20090422 +Version: %{V_opkg} +Release: 20101019 # package options -%option with_libpri yes -%option with_xfersips yes -%option with_proxymwi yes -%option with_parseavp yes -%option with_radius no -%option with_sqlite no -%option with_pgsql no -%option with_curl no -%option with_imap no -%option with_astman no -%option with_capi no -%option with_zaptel no -%option with_smdipoll 10 +%option with_dahdi no +%option with_capi no +%option with_ogg no +%option with_mp3 no +%option with_fax no +%option with_avcodec no +%option with_ldap no +%option with_radius no +%option with_sqlite no +%option with_lua no +%option with_jabber no +%option with_imap no +%option with_odbc no # list of sources -Source0: http://downloads.digium.com/pub/asterisk/releases/asterisk-%{version}.tar.gz -Source1: ftp://ftp.chan-capi.org/chan-capi/chan_capi-%{V_chan_capi}.tar.gz -Source2: http://downloads.digium.com/pub/telephony/sounds/releases/asterisk-moh-freeplay-alaw.tar.gz -Source3: http://downloads.digium.com/pub/telephony/sounds/releases/asterisk-moh-freeplay-g722.tar.gz -Source4: http://downloads.digium.com/pub/telephony/sounds/releases/asterisk-moh-freeplay-g729.tar.gz -Source5: http://downloads.digium.com/pub/telephony/sounds/releases/asterisk-moh-freeplay-gsm.tar.gz -Source6: http://downloads.digium.com/pub/telephony/sounds/releases/asterisk-moh-freeplay-ulaw.tar.gz -Source7: http://downloads.digium.com/pub/telephony/sounds/releases/asterisk-extra-sounds-en-alaw-%{V_extrasounds}.tar.gz -Source8: http://downloads.digium.com/pub/telephony/sounds/releases/asterisk-extra-sounds-en-g722-%{V_extrasounds}.tar.gz -Source9: http://downloads.digium.com/pub/telephony/sounds/releases/asterisk-extra-sounds-en-g729-%{V_extrasounds}.tar.gz -Source10: http://downloads.digium.com/pub/telephony/sounds/releases/asterisk-extra-sounds-en-gsm-%{V_extrasounds}.tar.gz -Source11: http://downloads.digium.com/pub/telephony/sounds/releases/asterisk-extra-sounds-en-ulaw-%{V_extrasounds}.tar.gz -Source12: http://downloads.digium.com/pub/telephony/sounds/releases/asterisk-core-sounds-en-alaw-%{V_langsounds}.tar.gz -Source13: http://downloads.digium.com/pub/telephony/sounds/releases/asterisk-core-sounds-en-g722-%{V_langsounds}.tar.gz -Source14: http://downloads.digium.com/pub/telephony/sounds/releases/asterisk-core-sounds-en-g729-%{V_langsounds}.tar.gz -Source15: http://downloads.digium.com/pub/telephony/sounds/releases/asterisk-core-sounds-en-gsm-%{V_langsounds}.tar.gz -Source16: http://downloads.digium.com/pub/telephony/sounds/releases/asterisk-core-sounds-en-ulaw-%{V_langsounds}.tar.gz -Source17: http://downloads.digium.com/pub/telephony/sounds/releases/asterisk-core-sounds-es-alaw-%{V_langsounds}.tar.gz -Source18: http://downloads.digium.com/pub/telephony/sounds/releases/asterisk-core-sounds-es-g722-%{V_langsounds}.tar.gz -Source19: http://downloads.digium.com/pub/telephony/sounds/releases/asterisk-core-sounds-es-g729-%{V_langsounds}.tar.gz -Source20: http://downloads.digium.com/pub/telephony/sounds/releases/asterisk-core-sounds-es-gsm-%{V_langsounds}.tar.gz -Source21: http://downloads.digium.com/pub/telephony/sounds/releases/asterisk-core-sounds-es-ulaw-%{V_langsounds}.tar.gz -Source22: http://downloads.digium.com/pub/telephony/sounds/releases/asterisk-core-sounds-fr-alaw-%{V_langsounds}.tar.gz -Source23: http://downloads.digium.com/pub/telephony/sounds/releases/asterisk-core-sounds-fr-g722-%{V_langsounds}.tar.gz -Source24: http://downloads.digium.com/pub/telephony/sounds/releases/asterisk-core-sounds-fr-g729-%{V_langsounds}.tar.gz -Source25: http://downloads.digium.com/pub/telephony/sounds/releases/asterisk-core-sounds-fr-gsm-%{V_langsounds}.tar.gz -Source26: http://downloads.digium.com/pub/telephony/sounds/releases/asterisk-core-sounds-fr-ulaw-%{V_langsounds}.tar.gz -Source27: http://www.amooma.de/asterisk/sprachbausteine/asterisk-%{V_amoomasounds}-de-prompts.tar.gz -Source28: http://www.amooma.de/asterisk/sprachbausteine/asterisk-core-sounds-de-gsm-current.tar.gz -Source29: ftp://ftp.europalab.com/pub/sfw/machsnds/de-digits/de-digits-%{V_customsounds}.tar.bz2 -Source30: asterisk.conf -Source31: amd.conf -Source32: capi.conf -Source33: cdr.conf -Source34: cdr_custom.conf -Source35: codecs.conf -Source36: dundi.conf -Source37: enum.conf -Source38: extensions.conf -Source39: features.conf -Source40: festival.conf -Source41: followme.conf -Source42: indications.conf -Source33: logger.conf -Source34: manager.conf -Source45: meetme.conf -Source46: misdn.conf -Source47: modules.conf -Source48: musiconhold.conf -Source49: privacy.conf -Source50: rpt.conf -Source51: rtp.conf -Source52: say.conf -Source53: sip.conf -Source54: sip_notify.conf -Source55: sla.conf -Source56: voicemail.conf -Source57: zapata.conf -Source58: rc.asterisk -Source59: wakeup.agi +Source0: http://downloads.asterisk.org/pub/telephony/asterisk/releases/asterisk-%{V_asterisk}.tar.gz +Source1: http://downloads.asterisk.org/pub/telephony/asterisk/releases/asterisk-addons-%{V_asterisk_addons}.tar.gz +Source2: http://downloads.asterisk.org/pub/telephony/sounds/releases/asterisk-core-sounds-en-alaw-%{V_asterisk_sounds_core_en}.tar.gz +Source3: http://downloads.asterisk.org/pub/telephony/sounds/releases/asterisk-extra-sounds-en-alaw-%{V_asterisk_sounds_extra_en}.tar.gz +Source4: http://www.amooma.de/asterisk/sprachbausteine/asterisk-core-sounds-de-gsm-%{V_asterisk_sounds_core_de}.tar.gz +Source5: ftp://ftp.chan-capi.org/chan-capi/chan_capi-%{V_chan_capi}.tar.gz +Source6: asterisk.txt +Source7: rc.asterisk Patch0: asterisk.patch -Patch1: asterisk.patch.xfersips -Patch2: asterisk.patch.proxymwi -Patch3: asterisk.patch.parseavp # build information -Prefix: %{l_prefix} -BuildRoot: %{l_buildroot} -BuildPreReq: OpenPKG, openpkg >= 20040130, pkgconfig, awk, grep -PreReq: OpenPKG, openpkg >= 20040130 -BuildPreReq: ncurses, openssl, zlib -PreReq: ncurses, openssl, zlib -BuildPreReq: speex, vorbis-libs, sox -PreReq: speex, vorbis-libs, sox -%if "%{with_libpri}" == "yes" -BuildPreReq: libpri -PreReq: libpri +BuildPreReq: OpenPKG, openpkg >= 20100101, bison, gcc, make, grep +PreReq: OpenPKG, openpkg >= 20100101, MTA +BuildPreReq: zlib, curl, openssl, ncurses, speex, popt, gmime22 +PreReq: zlib, curl, openssl, ncurses, speex, popt, gmime22 +%if "%{with_ogg}" == "yes" +BuildPreReq: vorbis-libs +PreReq: vorbis-libs +%endif +%if "%{with_mp3}" == "yes" +PreReq: mpg123 +%endif +%if "%{with_imap}" == "yes" +BuildPreReq: imap +PreReq: imap +%endif +%if "%{with_sqlite}" == "yes" +BuildPreReq: sqlite +PreReq: sqlite +%endif +%if "%{with_lua}" == "yes" +BuildPreReq: lua +PreReq: lua +%endif +%if "%{with_fax}" == "yes" +BuildPreReq: spandsp, tiff, jpeg, zlib +PreReq: spandsp, tiff, jpeg, zlib +%endif +%if "%{with_avcodec}" == "yes" +BuildPreReq: ffmpeg +PreReq: ffmpeg +%endif +%if "%{with_ldap}" == "yes" +BuildPreReq: openldap +PreReq: openldap %endif %if "%{with_radius}" == "yes" BuildPreReq: radiusclient PreReq: radiusclient %endif -%if "%{with_sqlite}" == "yes" -BuildPreReq: sqlite -PreReq: sqlite +%if "%{with_jabber}" == "yes" +BuildPreReq: iksemel +PreReq: iksemel %endif -%if "%{with_pgsql}" == "yes" -BuildPreReq: postgresql -PreReq: postgresql +%if "%{with_odbc}" == "yes" +BuildPreReq: unixodbc, sqlite, sqlite::with_odbc = yes +PreReq: unixodbc, sqlite, sqlite::with_odbc = yes %endif -%if "%{with_curl}" == "yes" -BuildPreReq: curl -PreReq: curl -%endif -%if "%{with_imap}" == "yes" -BuildPreReq: imap -PreReq: imap -%endif -%if "%{with_astman}" == "yes" -BuildPreReq: newt -PreReq: newt -%endif -AutoReq: no -AutoReqProv: no %description Asterisk is a complete Private Branch Exchange (PBX) in software. @@ -172,355 +127,374 @@ three-way calling, caller ID services, ADSI, SIP, etc. Asterisk needs no additional hardware for VoIP. - This copy of Asterisk is optionally patched to allow the asterisk - server to respond to SIP/TLS transfer requests using the Transfer() - application. Should this option be chosen, the asterisk server - successfully dispatches all transfer destinations using 'SIPS' - technology by means of the standard SIP/2.0 302 Moved Temporarily - message, with a URI resembling . - - This copy of Asterisk is optionally patched as well to enclose the - correct user name in NOTIFY messages when MWI logic detects changes - in the state of Messages-Waiting. Asterisk will send NOTIFY messages - with the URI 'user@hostname' instead of simply 'hostname'. This can - be used by a external SIP proxy to route the MWI to the correct phone. - %track prog asterisk = { - version = %{version} - url = http://downloads.digium.com/pub/asterisk/releases/ - regex = asterisk-(__VER__)\.tar\.gz + version = %{V_asterisk} + url = http://downloads.asterisk.org/pub/telephony/asterisk/releases/ + regex = asterisk-(\d+\.\d+(\.\d+)+)\.tar\.gz + } + prog asterisk:addons = { + version = %{V_asterisk_addons} + url = http://downloads.asterisk.org/pub/telephony/asterisk/releases/ + regex = asterisk-addons-(\d+\.\d+(\.\d+)+)\.tar\.gz + } + prog asterisk:sounds_core_en = { + version = %{V_asterisk_sounds_core_en} + url = http://downloads.asterisk.org/pub/telephony/sounds/releases/ + regex = asterisk-core-sounds-en-alaw-(\d+\.\d+(\.\d+)+)\.tar\.gz + } + prog asterisk:sounds_extra_en = { + version = %{V_asterisk_sounds_extra_en} + url = http://downloads.asterisk.org/pub/telephony/sounds/releases/ + regex = asterisk-extra-sounds-en-alaw-(\d+\.\d+(\.\d+)+)\.tar\.gz + } + prog asterisk:sounds_core_de = { + version = %{V_asterisk_sounds_core_de} + url = http://www.amooma.de/asterisk/sprachbausteine/ + regex = asterisk-core-sounds-de-gsm-(__VER__)\.tar\.gz + } + prog asterisk:chan_capi = { + version = %{V_chan_capi} + url = ftp://ftp.chan-capi.org/chan-capi/ + regex = chan_capi-(__VER__)\.tar\.gz } %prep - %setup -q -n asterisk-%{version} - %setup -q -n asterisk-%{version} -D -T -a 1 + %setup -q -n asterisk-%{V_asterisk} + %setup -q -n asterisk-%{V_asterisk} -D -T -a 1 + %setup -q -n asterisk-%{V_asterisk} -D -T -a 5 %patch -p0 -%if "%{with_xfersips}" == "yes" - %patch -p0 -P 1 -%endif -%if "%{with_proxymwi}" == "yes" - %patch -p0 -P 2 -%endif -%if "%{with_parseavp}" == "yes" - %patch -p0 -P 3 + exit 0 + cp %{SOURCE2} %{SOURCE3} sounds/ + %{l_shtool} subst \ + -e 's;\(CORE_SOUNDS_VERSION\):=.*$;\1:=%{V_asterisk_sounds_core_en};' \ + -e 's;\(EXTRA_SOUNDS_VERSION\):=.*$;\1:=%{V_asterisk_sounds_extra_en};' \ + sounds/Makefile + %{l_shtool} subst \ + -e 's;-lradiusclient-ng;-lradiusclient;g' \ + -e 's;radiusclient-ng\.h;radiusclient.h;g' \ + configure cdr/cdr_radius.c + +%build + # sanity check +%if "%{with_dahdi}" == "yes" + dahdi_prefix="" + case "%{l_platform -t}" in + *-linux* ) + if [ ! -f /usr/include/linux/dahdi.h ]; then + echo "option \"with_dahdi\" requires DAHDI Linux drivers installed" 1>&2; exit 1 + fi + dahdi_prefix=/usr + ;; + *-freebsd* ) + if [ ! -f /usr/local/include/dahdi/dahdi.h ]; then + echo "option \"with_dahdi\" requires DAHDI FreeBSD drivers installed" 1>&2; exit 1 + fi + dahdi_prefix=/usr/local + ;; + * ) echo "option \"with_dahdi\" supported under Linux and FreeBSD only" 1>&2; exit 1 ;; + esac %endif - # link install-sh to where Makefiles expect it - for dir in agi utils res channels pbx apps codecs formats cdr funcs main; do - ( cd $dir && ln -s ../install-sh ) || exit $? - done + # 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 - # apply corrections - case "%{l_platform -t}" in - *-sunos* ) - %{l_shtool} subst \ - -e 's|\(tmp->tm_gmtoff = ttisp->tt_gmtoff;\)|/*\1*/|' \ - main/stdtime/localtime.c - ;; - esac + # build program %{l_shtool} subst \ - -e 's;sysconfdir=/etc;true;' \ - -e 's;mandir=/usr/share/man;true;' \ - -e 's;localstatedir=/var;true;' \ - -e 's;\(radiusclient\)-ng;\1;g' \ - -e 's;\(\-lsqlite\);\13;g' \ - -e 's;\(sqlite\)\(\.h\);\13\2;g' \ - -e 's;\(sqlite\)\(_exec\);\13\2;g' \ - -e 's;^\(LIBS="-lvorbis\);\1 ${OGG_LIB};' \ - -e 's;\(#include <\${NCURSES_DIR}/include\);\1/ncurses;' \ - -e 's;-I${IMAP_TK_DIR}/c-client;-I${IMAP_TK_DIR}/include/imap;g' \ - -e 's;${IMAP_TK_DIR}/c-client/c-client\.a;-limap -lssl -lcrypto -lcrypt;g' \ + -e 's;-llua5\.1;-llua;' \ + -e 's;lua5\.1/lua\.h;lua/lua.h;' \ + -e 's;ffmpeg/avcodec\.h;libavcodec/avcodec.h;' \ configure - %{l_shtool} subst \ - -e 's; *-I/usr/local/ssl/include;;g' \ - -e 's;/opt/ssl/include;%{l_prefix}/include;g' \ - -e 's;/usr/local;%{l_prefix};g' \ - -e 's;^\(MOD_SUBDIR_CFLAGS=.*\ *\)$;\1 -I%{l_prefix}/include;' \ - -e 's;^\( *ASTETCDIR\)=.*;\1=$(sysconfdir)/asterisk;g' \ - -e 's;^\( *ASTLIBDIR\)=.*;\1=$(libdir)/asterisk;g' \ - -e 's;^\( *ASTHEADERDIR\)=.*;\1=$(includedir)/asterisk;g' \ - -e 's;^\( *ASTBINDIR\)=.*;\1=$(bindir);g' \ - -e 's;^\( *ASTSBINDIR\)=.*;\1=$(sbindir);g' \ - -e 's;^\( *ASTSPOOLDIR\)=.*;\1=$(localstatedir)/asterisk/spool;g' \ - -e 's;^\( *ASTLOGDIR\)=.*;\1=$(localstatedir)/asterisk/log;g' \ - -e 's;^\( *ASTVARRUNDIR\)=.*;\1=$(localstatedir)/asterisk/run;g' \ - -e 's;^\( *ASTMANDIR\)=.*;\1=$(mandir);g' \ - -e 's;^\( *ASTVARLIBDIR\)=.*;\1=$(localstatedir)/asterisk/lib;g' \ - -e 's;^\( *ASTVARRUNDIR\)=.*;\1=$(localstatedir)/asterisk/run;g' \ - -e 's;^\( *ASTDATADIR\):*=.*;\1=$(datadir)/asterisk;g' \ - -e 's/\(for f in\) \(\$(OLDMODS); do \\\)$/\1 "warning:" \2/' \ - Makefile - #-e 's;\(ASTSPOOLDIR=\$(localstatedir)\)\(/spool\)\(/asterisk\);\1\3\2;' \ - #-e 's;\(ASTLOGDIR=\$(localstatedir)\)\(/log\)\(/asterisk\);\1\3\2;' \ - #-e 's;\(ASTVARRUNDIR=\$(localstatedir)\)\(/run\);\1/asterisk\2;' \ - #-e 's;\(ASTVARRUNDIR=\$(localstatedir)\)\(/run\)\(/asterisk\);\1\3\2;' \ - #-e 's;\(ASTVARLIBDIR=\$(localstatedir)\)\(/lib\)\(/asterisk\);\1\3\2;' \ - #-e 's;\(ASTDATADIR:=\)\$(ASTVARLIBDIR);\1$(prefix)/share/asterisk;' \ - #Makefile - %{l_shtool} subst \ - -e 's; *-L/usr/local/ssl/lib;;g' \ - -e 's;/opt/ssl/lib;%{l_prefix}/lib;g' \ - -e 's;/usr/local;%{l_prefix};g' \ - -e 's;\(ASTLINK=\)$;\1-Wl,--export-dynamic;g' \ - main/Makefile - %{l_shtool} subst \ - -e 's;LOG_WARNING\(, "Failed to perform seek\);LOG_DEBUG\1;g' \ - main/channel.c - %{l_shtool} subst \ - -e 's;LOG_WARNING\(, "[^ ][^ ]* is not supported\);LOG_DEBUG\1;g' \ - formats/format_ogg_vorbis.c - %{l_shtool} subst \ - -e 's;\(/etc/radiusclient-ng/radiusclient.conf\);%{l_prefix}\1;g' \ - -e 's;\(radiusclient\)-ng;\1;g' \ - cdr/cdr_radius.c - %{l_shtool} subst \ - -e 's;\(sqlite\)\(\.h\);\13\2;g' \ - cdr/cdr_sqlite.c - %{l_shtool} subst \ - -e 's;\(#define DEFAULT_POLLING_INTERVAL\) *.*;\1 %{with_smdipoll};' \ - res/res_smdi.c - %{l_shtool} subst \ - -e 's;\(ASTERISK_HEADER_DIR=\).*;\1%{l_prefix}/include;g' \ - -e 's;\(MODULES_DIR=\).*;\1%{l_prefix}/lib/asterisk/modules;g' \ - -e 's;\(CONFIG_DIR=\).*;\1%{l_prefix}/etc/asterisk;g' \ - -e 's;\(\$(MODULES_DIR)\);$(DESTDIR)\1;g' \ - -e 's;\${CONFIG_DIR};$(DESTDIR)$(CONFIG_DIR);g' \ - chan_capi-%{V_chan_capi}/Makefile - -# # optionally specify CPU -# %{l_shtool} subst \ -# -e 's;build_cpu=\$1;build_cpu=i586;' \ -# -e 's;host_cpu=\$1;host_cpu=i586;' \ -# configure - -%build - # apply platform build rules - libs="`pkg-config openssl speex --libs-only-l`" -%if "%{with_curl}" == "yes" - libs="$libs `pkg-config libcurl --libs-only-l`" + ( echo "ac_cv_prog_CONFIG_GMIME=%{l_prefix}/bin/gmime-config" + ) >config.cache + cflags="%{l_cflags -O}" + cppflags="%{l_cppflags ncurses lua .}" + ldflags="%{l_ldflags}" + libs="" + cppflags="$cppflags `pkg-config gmime-2.0 --cflags-only-I`" + ldflags="$ldflags `pkg-config gmime-2.0 --libs-only-L`" + libs="$libs `pkg-config gmime-2.0 --libs-only-l`" +%if "%{with_ogg}" == "yes" + libs="$libs -logg -lm" %endif -%if "%{with_sqlite}" == "yes" - libs="$libs `pkg-config sqlite3 --libs-only-l`" +%if "%{with_avcodec}" == "yes" + libs="$libs -lavcodec -lavutil" %endif -%if "%{with_pgsql}" == "yes" - libs="-lpq $libs" +%if "%{with_ldap}" == "yes" + libs="$libs -lldap -llber -lssl -lcrypto" %endif -%if "%{with_radius}" == "yes" - libs="$libs -lradiusclient" +%if "%{with_dahdi}" == "yes" + cppflags="$cppflags -I$dahdi_prefix/include" + ldflags="$ldflags -L$dahdi_prefix/lib" %endif -%if "%{with_libpri}" == "yes" - libs="$libs -lpri" -%endif - case "%{l_platform -t}" in - *-linux* ) libs="$libs -lrt" ;; - *-sunos* ) libs="$libs -lrt" ;; - esac - - # configure package CC="%{l_cc}" \ - CFLAGS="%{l_cflags -O}" \ -%if "%{with_imap}" == "yes" - CPPFLAGS="%{l_cppflags imap ncurses}" \ -%else - CPPFLAGS="%{l_cppflags ncurses}" \ -%endif - LDFLAGS="%{l_ldflags}" \ + CFLAGS="$cflags" \ + CPPFLAGS="$cppflags" \ + LDFLAGS="$ldflags" \ LIBS="$libs" \ ./configure \ + --cache-file=./config.cache \ --prefix=%{l_prefix} \ --mandir=%{l_prefix}/man \ - --with-ncurses=%{l_prefix} \ -%if "%{with_libpri}" == "yes" - --with-pri=%{l_prefix} \ + --sysconfdir=%{l_prefix}/etc \ + --localstatedir=%{l_prefix}/var/asterisk \ + --with-curl=%{l_prefix} \ + --with-ncurses \ + --with-gsm="internal" \ + --with-popt=%{l_prefix} \ +%if "%{with_sqlite}" == "yes" + --with-sqlite3=%{l_prefix} \ %else - --with-pri=no \ + --without-sqlite3 \ %endif + --with-speex=%{l_prefix} \ + --with-speexdsp=%{l_prefix} \ --with-ssl=%{l_prefix} \ + --with-gmime=%{l_prefix} \ + --with-z=%{l_prefix} \ +%if "%{with_ogg}" == "yes" + --with-ogg=%{l_prefix} \ + --with-vorbis=%{l_prefix} \ +%else + --without-ogg \ + --without-vorbis \ +%endif +%if "%{with_jabber}" == "yes" + --with-iksemel=%{l_prefix} \ +%else + --without-iksemel \ +%endif +%if "%{with_lua}" == "yes" + --with-lua=%{l_prefix} \ +%else + --without-lua \ +%endif +%if "%{with_dahdi}" == "yes" + --with-dahdi=$dahdi_prefix \ + --with-tonezone=$dahdi_prefix \ +%else + --without-dahdi \ + --without-tonezone \ +%endif +%if "%{with_avcodec}" == "yes" + --with-avcodec=%{l_prefix} \ +%else + --without-avcodec \ +%endif +%if "%{with_ldap}" == "yes" + --with-ldap=%{l_prefix} \ +%else + --without-ldap \ +%endif %if "%{with_radius}" == "yes" --with-radius=%{l_prefix} \ %else - --with-radius=no \ -%endif -%if "%{with_sqlite}" == "yes" - --with-sqlite=%{l_prefix} \ -%else - --with-sqlite=no \ -%endif -%if "%{with_postgresql}" == "yes" - --with-postgres=%{l_prefix} \ -%else - --with-postgres=no \ -%endif -%if "%{with_curl}" == "yes" - --with-curl=%{l_prefix} \ -%else - --with-curl=no \ + --without-radius \ %endif %if "%{with_imap}" == "yes" --with-imap=%{l_prefix} \ - --disable-largefile \ %else - --with-imap=no \ + --without-imap \ %endif -%if "%{with_astman}" == "yes" - --with-newt=%{l_prefix} \ +%if "%{with_odbc}" == "yes" + --with-odbc=%{l_prefix} \ %else - --with-newt=no \ + --without-odbc \ %endif - --with-speex=%{l_prefix} \ - --with-speexdsp=%{l_prefix} \ - --with-ogg=%{l_prefix} \ - --with-vorbis=%{l_prefix} \ - --with-z=%{l_prefix} + --without-netsnmp \ + --without-isdnnet \ + --without-misdn \ + --without-kde \ + --without-nbs \ + --without-newt \ + --without-asound \ + --without-oss \ + --without-qt \ + --without-sqlite \ + --without-postgres \ + --without-tds \ + --without-osptk \ + --without-pri \ + --without-suppserv \ + --without-vpb \ + --without-sdl \ + --without-x11 \ + --without-gtk \ + --without-gtk2 + %{l_make} %{l_mflags} \ + CC="%{l_cc} $cflags -I. -I./include -I../include -I../../include $cppflags" - # build package - %{l_make} %{l_mflags -O} menuselect/menuselect menuselect-tree - menuselect/menuselect --check-deps menuselect.makeopts - %{l_shtool} subst \ - -e 's;\(MENUSELECT_MOH=\).*;\1;' \ - -e 's;\(MENUSELECT_CORE_SOUNDS=\).*;\1;' \ - -e 's;\(MENUSELECT_EXTRA_SOUNDS=\).*;\1;' \ - menuselect.makeopts -%if "%{with_imap}" == "yes" - %{l_shtool} subst \ - -e 's;\(MENUSELECT_OPTS_app_voicemail=\)$;\1IMAP_STORAGE;' \ - menuselect.makeopts + # build addon modules + ( cd asterisk-addons-* + ASTERISK_DIR="`pwd`/.." \ + CC="%{l_cc}" \ + CFLAGS="%{l_cflags -O}" \ + CPPFLAGS="%{l_cppflags ncurses tiff .}" \ + LDFLAGS="%{l_ldflags}" \ +%if "%{with_fax}" == "yes" + LIBS="-ltiff -ljpeg -lz -lm" \ +%else + LIBS="-lm" \ %endif - %{l_make} %{l_mflags -O} EXTLIBS="$libs" NOISY_BUILD=yes + ./configure \ + --prefix=%{l_prefix} \ + --mandir=%{l_prefix}/man \ + --sysconfdir=%{l_prefix}/etc \ + --localstatedir=%{l_prefix}/var/asterisk \ + --with-ncurses \ + --with-asterisk \ + --without-mysqlclient \ +%if "%{with_fax}" == "yes" + --with-spandsp=%{l_prefix} +%else + --without-spandsp +%endif + %{l_make} %{l_mflags} \ + CC="%{l_cc} %{l_cflags -O} -I. %{l_cppflags ncurses tiff .}" + ) || exit $? %if "%{with_capi}" == "yes" - ( cd chan_capi-%{V_chan_capi} - %{l_make} %{l_mflags -O} + ( cd chan_capi-* + ln -s ../include/asterisk . + ln -s ../include/asterisk.h . + %{l_make} %{l_mflags} \ + INSTALL_PREFIX=%{l_prefix} \ + ASTERISK_HEADER_DIR="`pwd`" ) || exit $? %endif %install - rm -rf $RPM_BUILD_ROOT + # install program + %{l_make} %{l_mflags} install \ + DESTDIR=$RPM_BUILD_ROOT \ + INSTALL_PREFIX=%{l_prefix} - # install package - %{l_make} %{l_mflags} install DESTDIR=$RPM_BUILD_ROOT + # install addon modules + ( cd asterisk-addons-* + %{l_make} %{l_mflags} install \ + DESTDIR=$RPM_BUILD_ROOT \ + INSTALL_PREFIX=%{l_prefix} + ) || exit $? %if "%{with_capi}" == "yes" - ( cd chan_capi-%{V_chan_capi} - %{l_make} %{l_mflags} install samples DESTDIR=$RPM_BUILD_ROOT + ( cd chan_capi-* + %{l_make} %{l_mflags} install \ + INSTALL_PREFIX=$RPM_BUILD_ROOT%{l_prefix} \ + INSTALL="%{l_shtool} install -c" \ + MODULES_DIR='$(INSTALL_PREFIX)/lib/asterisk/modules' ) || exit $? %endif - # install all sound prompt files - for codec in alaw ulaw g722 g729 gsm; do - for lang in es fr; do - ( cd $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds/${lang} - %{l_tar} zxf %{_sourcedir}/asterisk-core-sounds-${lang}-${codec}-%{V_langsounds}.tar.gz - ) || exit $? - done - ( cd $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds - %{l_tar} zxf %{_sourcedir}/asterisk-extra-sounds-en-${codec}-%{V_extrasounds}.tar.gz - %{l_tar} zxf %{_sourcedir}/asterisk-core-sounds-en-${codec}-%{V_langsounds}.tar.gz - ) || exit $? + # install addon sounds + %{l_shtool} mkdir -f -p -m 755 \ + $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds/de + ( cd $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds/de + %{l_gzip} -d -c %{SOURCE4} | %{l_tar} xf - + ) || exit $? + + # 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 + rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds/.asterisk* >/dev/null 2>&1 || true + rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds/en/CREDIT* >/dev/null 2>&1 || true + rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds/en/CHANGES* >/dev/null 2>&1 || true + rmdir $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds/es >/dev/null 2>&1 || true + rmdir $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds/fr >/dev/null 2>&1 || true + + # create additional directories + %{l_shtool} mkdir -f -p -m 755 \ + $RPM_BUILD_ROOT%{l_prefix}/var/asterisk/db + + # post-adjust installation + strip $RPM_BUILD_ROOT%{l_prefix}/sbin/* >/dev/null 2>&1 || true + mv $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/agi-bin \ + $RPM_BUILD_ROOT%{l_prefix}/lib/asterisk/agi-bin + for bin in $RPM_BUILD_ROOT%{l_prefix}/lib/asterisk/agi-bin/*.*; do + mv $bin `echo $bin | sed -e 's;\.[^.]*$;;'` done - # install special case sound files - ( cd $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds - %{l_tar} jxf %{SOURCE de-digits-%{V_customsounds}.tar.bz2} - %{l_tar} zxf %{SOURCE asterisk-core-sounds-de-gsm-current.tar.gz} - cd de - %{l_tar} zxf %{_sourcedir}/asterisk-%{V_amoomasounds}-de-prompts.tar.gz - mv -f de/* . && rm -rf de - mv -f dictate/de/* letters/ && rm -rf dictate/de - mv -f digits/de/* letters/ && rm -rf digits/de - mv -f letters/de/* letters/ && rm -rf letters/de - mv -f phonetic/de/* letters/ && rm -rf phonetic/de - ) || exit $? + # install default configuration + for name in `grep "^/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 additional music on hold files - ( cd $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/moh - for codec in alaw ulaw g722 g729 gsm; do - %{l_tar} zxf %{_sourcedir}/asterisk-moh-freeplay-${codec}.tar.gz - done - ) || exit $? - -# # install nonstandard voicemail prompts -# %{l_shtool} mkdir -f -p -m 755 \ -# $RPM_BUILD_ROOT%{l_prefix}/var/asterisk/spool/voicemail/default/%{exten}/unavail -# %{l_shtool} install -c -m 660 \ -# %{_sourcedir}/ansage-%{V_ansage}.wav} \ -# $RPM_BUILD_ROOT%{l_prefix}/var/asterisk/spool/voicemail/default/%{exten}/unavail.wav - - # install default configuration - %{l_shtool} install -c -m 660 %{l_value -s -a} \ - %{SOURCE asterisk.conf} \ - %{SOURCE amd.conf} \ - %{SOURCE cdr.conf} \ - %{SOURCE codecs.conf} \ - %{SOURCE extensions.conf} \ - %{SOURCE features.conf} \ - %{SOURCE festival.conf} \ - %{SOURCE followme.conf} \ - %{SOURCE indications.conf} \ - %{SOURCE logger.conf} \ - %{SOURCE manager.conf} \ - %{SOURCE meetme.conf} \ - %{SOURCE modules.conf} \ - %{SOURCE musiconhold.conf} \ - %{SOURCE rtp.conf} \ - %{SOURCE sip.conf} \ - %{SOURCE sla.conf} \ - %{SOURCE voicemail.conf} \ - %{SOURCE zapata.conf} \ - $RPM_BUILD_ROOT%{l_prefix}/etc/asterisk/ - - # install runcommand script + # 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/ - # install additional AGI scripts - %{l_shtool} install -c -m 755 %{l_value -s -a} \ - %{SOURCE wakeup.agi} $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/agi-bin/ - - # correct installation hierarchy - %{l_shtool} mkdir -f -p -m 755 \ - $RPM_BUILD_ROOT%{l_prefix}/var/asterisk/lib \ - $RPM_BUILD_ROOT%{l_prefix}/var/asterisk/spool/outgoing - - # remove unused components - rm -rf \ - $RPM_BUILD_ROOT%{l_prefix}/bin \ - $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/images \ - $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds/de/.DS_Store \ - $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds/de/autogen.sh \ - >/dev/null 2>&1 || true - - # adjust inconsistent names - for bin in $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/agi-bin/*.*; do - mv $bin `echo $bin | sed -e 's;\.[^.]*$;;'` - done - - # strip down installation - strip $RPM_BUILD_ROOT%{l_prefix}/bin/* \ - $RPM_BUILD_ROOT%{l_prefix}/sbin/* \ - $RPM_BUILD_ROOT%{l_prefix}/lib/asterisk/modules/* \ - $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/agi-bin/* \ - >/dev/null 2>&1 || true - # determine installation files - %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT %{l_files_std} \ - '%config %attr(660,%{l_musr},%{l_rgrp}) %{l_prefix}/etc/asterisk/*' \ - '%config %attr(644,%{l_musr},%{l_mgrp}) %{l_prefix}/share/asterisk/sounds/de/*' \ - '%config %attr(755,%{l_musr},%{l_mgrp}) %{l_prefix}/share/asterisk/sounds/de/dictate' \ - '%config %attr(755,%{l_musr},%{l_mgrp}) %{l_prefix}/share/asterisk/sounds/de/digits' \ - '%config %attr(755,%{l_musr},%{l_mgrp}) %{l_prefix}/share/asterisk/sounds/de/followme' \ - '%config %attr(755,%{l_musr},%{l_mgrp}) %{l_prefix}/share/asterisk/sounds/de/letters' \ - '%config %attr(755,%{l_musr},%{l_mgrp}) %{l_prefix}/share/asterisk/sounds/de/phonetic' \ - '%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/asterisk/*' \ - '%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/asterisk/*/*' + %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \ + %{l_files_std} \ + '%config %attr(640,%{l_mgrp},%{l_rgrp}) %{l_prefix}/etc/asterisk/*' \ + '%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/asterisk' %files -f files %clean - rm -rf $RPM_BUILD_ROOT %post +%if "%{with_dahdi}" == "yes" + if [ $1 -eq 1 ]; then + case "%{l_platform -t}" in + *-freebsd* ) + ( echo "To allow Asterisk to use the DAHDI /dev/dahdi/pseudo device(s)" + echo "you have add the following entry to /etc/devfs.rules:" + echo "" + echo "[openpkg_asterisk=10]" + echo "add path 'dahdi/pseudo*' mode 0664 user %{l_rusr} group %{l_rgrp}" + echo "" + ) | %{l_rpmtool} msg -b -t notice + ;; + esac + fi +%endif +%if "%{with_odbc}" == "yes" + # after install, optionally link into ODBC and create database + if $RPM_INSTALL_PREFIX/bin/odbcinst -q -s -n "asterisk-sqlite" >/dev/null 2>&1; then + : + else + ( echo "[asterisk-sqlite]" + echo "Description = Asterisk SQLite Database" + echo "Driver = SQLite3" + echo "Database = $RPM_INSTALL_PREFIX/var/asterisk/db/asterisk.sqlite" + echo "Timeout = 2000" + ) | $RPM_INSTALL_PREFIX/bin/odbcinst -i -s -l -n "asterisk-sqlite" -r >/dev/null 2>&1 || true + fi + if [ ! -f $RPM_INSTALL_PREFIX/var/asterisk/run/asterisk.db ]; then + ( umask 007 + echo "CREATE TABLE map (key TEXT, val TEXT);" | $RPM_INSTALL_PREFIX/bin/isql "asterisk-sqlite" -b + chown %{l_rusr}:%{l_rgrp} $RPM_INSTALL_PREFIX/var/asterisk/db/asterisk.sqlite >/dev/null 2>&1 || true + ) || exit $? + fi +%endif # after upgrade, restart service [ $1 -eq 2 ] || exit 0 eval `%{l_rc} asterisk status 2>/dev/null` @@ -531,14 +505,14 @@ # 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/lib/* >/dev/null 2>&1 || true - 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 - for deldir in meetme outgoing system tmp; do - rm -rf \ - $RPM_INSTALL_PREFIX/var/asterisk/spool/$deldir \ - >/dev/null 2>&1 || true - done + 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/db/* >/dev/null 2>&1 || true +%if "%{with_odbc}" == "yes" + # before erase, optionally unlink from ODBC and destroy database + $RPM_INSTALL_PREFIX/bin/odbcinst -u -s -l -n "asterisk-sqlite" >/dev/null 2>&1 || true +%endif exit 0