asterisk/asterisk.spec

changeset 202
f29abea29121
child 310
73d852a30c9a
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/asterisk/asterisk.spec	Mon Apr 27 12:19:05 2009 +0200
     1.3 @@ -0,0 +1,544 @@
     1.4 +##
     1.5 +##  asterisk.spec -- OpenPKG RPM Package Specification
     1.6 +##  Copyright (c) 2000-2007 OpenPKG Foundation e.V. <http://openpkg.net/>
     1.7 +##  Copyright (c) 2000-2007 Ralf S. Engelschall <http://engelschall.com/>
     1.8 +##
     1.9 +##  Permission to use, copy, modify, and distribute this software for
    1.10 +##  any purpose with or without fee is hereby granted, provided that
    1.11 +##  the above copyright notice and this permission notice appear in all
    1.12 +##  copies.
    1.13 +##
    1.14 +##  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
    1.15 +##  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
    1.16 +##  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
    1.17 +##  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
    1.18 +##  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
    1.19 +##  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
    1.20 +##  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
    1.21 +##  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
    1.22 +##  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
    1.23 +##  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
    1.24 +##  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
    1.25 +##  SUCH DAMAGE.
    1.26 +##
    1.27 +
    1.28 +#   package component versions
    1.29 +%define       V_langsounds    1.4.12
    1.30 +%define       V_extrasounds   1.4.9
    1.31 +%define       V_amoomasounds  1.4
    1.32 +%define       V_customsounds  1.0
    1.33 +%define       V_chan_capi     1.1.2
    1.34 +
    1.35 +#   package information
    1.36 +Name:         asterisk
    1.37 +Summary:      Private Branch Exchange (PBX) for VoIP
    1.38 +URL:          http://www.asterisk.org/
    1.39 +Vendor:       Mark Spencer et al.
    1.40 +Packager:     Michael Schloh von Bennewitz
    1.41 +Distribution: Michael Schloh von Bennewitz
    1.42 +Class:        EVAL
    1.43 +Group:        VoIP
    1.44 +License:      GPL
    1.45 +Version:      1.4.24.1
    1.46 +Release:      20090422
    1.47 +
    1.48 +#   package options
    1.49 +%option       with_libpri     yes
    1.50 +%option       with_xfersips   yes
    1.51 +%option       with_proxymwi   yes
    1.52 +%option       with_parseavp   yes
    1.53 +%option       with_radius     no
    1.54 +%option       with_sqlite     no
    1.55 +%option       with_pgsql      no
    1.56 +%option       with_curl       no
    1.57 +%option       with_imap       no
    1.58 +%option       with_astman     no
    1.59 +%option       with_capi       no
    1.60 +%option       with_zaptel     no
    1.61 +%option       with_smdipoll   10
    1.62 +
    1.63 +#   list of sources
    1.64 +Source0:      http://downloads.digium.com/pub/asterisk/releases/asterisk-%{version}.tar.gz
    1.65 +Source1:      ftp://ftp.chan-capi.org/chan-capi/chan_capi-%{V_chan_capi}.tar.gz
    1.66 +Source2:      http://downloads.digium.com/pub/telephony/sounds/releases/asterisk-moh-freeplay-alaw.tar.gz
    1.67 +Source3:      http://downloads.digium.com/pub/telephony/sounds/releases/asterisk-moh-freeplay-g722.tar.gz
    1.68 +Source4:      http://downloads.digium.com/pub/telephony/sounds/releases/asterisk-moh-freeplay-g729.tar.gz
    1.69 +Source5:      http://downloads.digium.com/pub/telephony/sounds/releases/asterisk-moh-freeplay-gsm.tar.gz
    1.70 +Source6:      http://downloads.digium.com/pub/telephony/sounds/releases/asterisk-moh-freeplay-ulaw.tar.gz
    1.71 +Source7:      http://downloads.digium.com/pub/telephony/sounds/releases/asterisk-extra-sounds-en-alaw-%{V_extrasounds}.tar.gz
    1.72 +Source8:      http://downloads.digium.com/pub/telephony/sounds/releases/asterisk-extra-sounds-en-g722-%{V_extrasounds}.tar.gz
    1.73 +Source9:      http://downloads.digium.com/pub/telephony/sounds/releases/asterisk-extra-sounds-en-g729-%{V_extrasounds}.tar.gz
    1.74 +Source10:      http://downloads.digium.com/pub/telephony/sounds/releases/asterisk-extra-sounds-en-gsm-%{V_extrasounds}.tar.gz
    1.75 +Source11:     http://downloads.digium.com/pub/telephony/sounds/releases/asterisk-extra-sounds-en-ulaw-%{V_extrasounds}.tar.gz
    1.76 +Source12:     http://downloads.digium.com/pub/telephony/sounds/releases/asterisk-core-sounds-en-alaw-%{V_langsounds}.tar.gz
    1.77 +Source13:     http://downloads.digium.com/pub/telephony/sounds/releases/asterisk-core-sounds-en-g722-%{V_langsounds}.tar.gz
    1.78 +Source14:     http://downloads.digium.com/pub/telephony/sounds/releases/asterisk-core-sounds-en-g729-%{V_langsounds}.tar.gz
    1.79 +Source15:     http://downloads.digium.com/pub/telephony/sounds/releases/asterisk-core-sounds-en-gsm-%{V_langsounds}.tar.gz
    1.80 +Source16:     http://downloads.digium.com/pub/telephony/sounds/releases/asterisk-core-sounds-en-ulaw-%{V_langsounds}.tar.gz
    1.81 +Source17:     http://downloads.digium.com/pub/telephony/sounds/releases/asterisk-core-sounds-es-alaw-%{V_langsounds}.tar.gz
    1.82 +Source18:     http://downloads.digium.com/pub/telephony/sounds/releases/asterisk-core-sounds-es-g722-%{V_langsounds}.tar.gz
    1.83 +Source19:     http://downloads.digium.com/pub/telephony/sounds/releases/asterisk-core-sounds-es-g729-%{V_langsounds}.tar.gz
    1.84 +Source20:     http://downloads.digium.com/pub/telephony/sounds/releases/asterisk-core-sounds-es-gsm-%{V_langsounds}.tar.gz
    1.85 +Source21:     http://downloads.digium.com/pub/telephony/sounds/releases/asterisk-core-sounds-es-ulaw-%{V_langsounds}.tar.gz
    1.86 +Source22:     http://downloads.digium.com/pub/telephony/sounds/releases/asterisk-core-sounds-fr-alaw-%{V_langsounds}.tar.gz
    1.87 +Source23:     http://downloads.digium.com/pub/telephony/sounds/releases/asterisk-core-sounds-fr-g722-%{V_langsounds}.tar.gz
    1.88 +Source24:     http://downloads.digium.com/pub/telephony/sounds/releases/asterisk-core-sounds-fr-g729-%{V_langsounds}.tar.gz
    1.89 +Source25:     http://downloads.digium.com/pub/telephony/sounds/releases/asterisk-core-sounds-fr-gsm-%{V_langsounds}.tar.gz
    1.90 +Source26:     http://downloads.digium.com/pub/telephony/sounds/releases/asterisk-core-sounds-fr-ulaw-%{V_langsounds}.tar.gz
    1.91 +Source27:     http://www.amooma.de/asterisk/sprachbausteine/asterisk-%{V_amoomasounds}-de-prompts.tar.gz
    1.92 +Source28:     http://www.amooma.de/asterisk/sprachbausteine/asterisk-core-sounds-de-gsm-current.tar.gz
    1.93 +Source29:     ftp://ftp.europalab.com/pub/sfw/machsnds/de-digits/de-digits-%{V_customsounds}.tar.bz2
    1.94 +Source30:     asterisk.conf
    1.95 +Source31:     amd.conf
    1.96 +Source32:     capi.conf
    1.97 +Source33:     cdr.conf
    1.98 +Source34:     cdr_custom.conf
    1.99 +Source35:     codecs.conf
   1.100 +Source36:     dundi.conf
   1.101 +Source37:     enum.conf
   1.102 +Source38:     extensions.conf
   1.103 +Source39:     features.conf
   1.104 +Source40:     festival.conf
   1.105 +Source41:     followme.conf
   1.106 +Source42:     indications.conf
   1.107 +Source33:     logger.conf
   1.108 +Source34:     manager.conf
   1.109 +Source45:     meetme.conf
   1.110 +Source46:     misdn.conf
   1.111 +Source47:     modules.conf
   1.112 +Source48:     musiconhold.conf
   1.113 +Source49:     privacy.conf
   1.114 +Source50:     rpt.conf
   1.115 +Source51:     rtp.conf
   1.116 +Source52:     say.conf
   1.117 +Source53:     sip.conf
   1.118 +Source54:     sip_notify.conf
   1.119 +Source55:     sla.conf
   1.120 +Source56:     voicemail.conf
   1.121 +Source57:     zapata.conf
   1.122 +Source58:     rc.asterisk
   1.123 +Source59:     wakeup.agi
   1.124 +Patch0:       asterisk.patch
   1.125 +Patch1:       asterisk.patch.xfersips
   1.126 +Patch2:       asterisk.patch.proxymwi
   1.127 +Patch3:       asterisk.patch.parseavp
   1.128 +
   1.129 +#   build information
   1.130 +Prefix:       %{l_prefix}
   1.131 +BuildRoot:    %{l_buildroot}
   1.132 +BuildPreReq:  OpenPKG, openpkg >= 20040130, pkgconfig, awk, grep
   1.133 +PreReq:       OpenPKG, openpkg >= 20040130
   1.134 +BuildPreReq:  ncurses, openssl, zlib
   1.135 +PreReq:       ncurses, openssl, zlib
   1.136 +BuildPreReq:  speex, vorbis-libs, sox
   1.137 +PreReq:       speex, vorbis-libs, sox
   1.138 +%if "%{with_libpri}" == "yes"
   1.139 +BuildPreReq:  libpri
   1.140 +PreReq:       libpri
   1.141 +%endif
   1.142 +%if "%{with_radius}" == "yes"
   1.143 +BuildPreReq:  radiusclient
   1.144 +PreReq:       radiusclient
   1.145 +%endif
   1.146 +%if "%{with_sqlite}" == "yes"
   1.147 +BuildPreReq:  sqlite
   1.148 +PreReq:       sqlite
   1.149 +%endif
   1.150 +%if "%{with_pgsql}" == "yes"
   1.151 +BuildPreReq:  postgresql
   1.152 +PreReq:       postgresql
   1.153 +%endif
   1.154 +%if "%{with_curl}" == "yes"
   1.155 +BuildPreReq:  curl
   1.156 +PreReq:       curl
   1.157 +%endif
   1.158 +%if "%{with_imap}" == "yes"
   1.159 +BuildPreReq:  imap
   1.160 +PreReq:       imap
   1.161 +%endif
   1.162 +%if "%{with_astman}" == "yes"
   1.163 +BuildPreReq:  newt
   1.164 +PreReq:       newt
   1.165 +%endif
   1.166 +AutoReq:      no
   1.167 +AutoReqProv:  no
   1.168 +
   1.169 +%description
   1.170 +    Asterisk is a complete Private Branch Exchange (PBX) in software.
   1.171 +    It provides all of the features you would expect from a PBX and
   1.172 +    more. Asterisk does Voice over IP (VoIP) in many protocols. Asterisk
   1.173 +    provides Voicemail services with Directory, Call Conferencing,
   1.174 +    Interactive Voice Response and Call Queuing. It has support for
   1.175 +    three-way calling, caller ID services, ADSI, SIP, etc. Asterisk
   1.176 +    needs no additional hardware for VoIP.
   1.177 +
   1.178 +    This copy of Asterisk is optionally patched to allow the asterisk
   1.179 +    server to respond to SIP/TLS transfer requests using the Transfer()
   1.180 +    application. Should this option be chosen, the asterisk server
   1.181 +    successfully dispatches all transfer destinations using 'SIPS'
   1.182 +    technology by means of the standard SIP/2.0 302 Moved Temporarily
   1.183 +    message, with a URI resembling <sips:extension@hostname.tld:port>.
   1.184 +
   1.185 +    This copy of Asterisk is optionally patched as well to enclose the
   1.186 +    correct user name in NOTIFY messages when MWI logic detects changes
   1.187 +    in the state of Messages-Waiting. Asterisk will send NOTIFY messages
   1.188 +    with the URI 'user@hostname' instead of simply 'hostname'. This can
   1.189 +    be used by a external SIP proxy to route the MWI to the correct phone.
   1.190 +
   1.191 +%track
   1.192 +    prog asterisk = {
   1.193 +        version   = %{version}
   1.194 +        url       = http://downloads.digium.com/pub/asterisk/releases/
   1.195 +        regex     = asterisk-(__VER__)\.tar\.gz
   1.196 +    }
   1.197 +
   1.198 +%prep
   1.199 +    %setup -q -n asterisk-%{version}
   1.200 +    %setup -q -n asterisk-%{version} -D -T -a 1
   1.201 +    %patch -p0
   1.202 +%if "%{with_xfersips}" == "yes"
   1.203 +    %patch -p0 -P 1
   1.204 +%endif
   1.205 +%if "%{with_proxymwi}" == "yes"
   1.206 +    %patch -p0 -P 2
   1.207 +%endif
   1.208 +%if "%{with_parseavp}" == "yes"
   1.209 +    %patch -p0 -P 3
   1.210 +%endif
   1.211 +
   1.212 +    #   link install-sh to where Makefiles expect it
   1.213 +    for dir in agi utils res channels pbx apps codecs formats cdr funcs main; do
   1.214 +        ( cd $dir && ln -s ../install-sh ) || exit $?
   1.215 +    done
   1.216 +
   1.217 +    #   apply corrections
   1.218 +    case "%{l_platform -t}" in
   1.219 +        *-sunos* )
   1.220 +            %{l_shtool} subst \
   1.221 +                -e 's|\(tmp->tm_gmtoff = ttisp->tt_gmtoff;\)|/*\1*/|' \
   1.222 +                main/stdtime/localtime.c
   1.223 +            ;;
   1.224 +    esac
   1.225 +    %{l_shtool} subst \
   1.226 +        -e 's;sysconfdir=/etc;true;' \
   1.227 +        -e 's;mandir=/usr/share/man;true;' \
   1.228 +        -e 's;localstatedir=/var;true;' \
   1.229 +        -e 's;\(radiusclient\)-ng;\1;g' \
   1.230 +        -e 's;\(\-lsqlite\);\13;g' \
   1.231 +        -e 's;\(sqlite\)\(\.h\);\13\2;g' \
   1.232 +        -e 's;\(sqlite\)\(_exec\);\13\2;g' \
   1.233 +        -e 's;^\(LIBS="-lvorbis\);\1 ${OGG_LIB};' \
   1.234 +        -e 's;\(#include <\${NCURSES_DIR}/include\);\1/ncurses;' \
   1.235 +        -e 's;-I${IMAP_TK_DIR}/c-client;-I${IMAP_TK_DIR}/include/imap;g' \
   1.236 +        -e 's;${IMAP_TK_DIR}/c-client/c-client\.a;-limap -lssl -lcrypto -lcrypt;g' \
   1.237 +        configure
   1.238 +    %{l_shtool} subst \
   1.239 +        -e 's; *-I/usr/local/ssl/include;;g' \
   1.240 +        -e 's;/opt/ssl/include;%{l_prefix}/include;g' \
   1.241 +        -e 's;/usr/local;%{l_prefix};g' \
   1.242 +        -e 's;^\(MOD_SUBDIR_CFLAGS=.*\ *\)$;\1 -I%{l_prefix}/include;' \
   1.243 +        -e 's;^\( *ASTETCDIR\)=.*;\1=$(sysconfdir)/asterisk;g' \
   1.244 +        -e 's;^\( *ASTLIBDIR\)=.*;\1=$(libdir)/asterisk;g' \
   1.245 +        -e 's;^\( *ASTHEADERDIR\)=.*;\1=$(includedir)/asterisk;g' \
   1.246 +        -e 's;^\( *ASTBINDIR\)=.*;\1=$(bindir);g' \
   1.247 +        -e 's;^\( *ASTSBINDIR\)=.*;\1=$(sbindir);g' \
   1.248 +        -e 's;^\( *ASTSPOOLDIR\)=.*;\1=$(localstatedir)/asterisk/spool;g' \
   1.249 +        -e 's;^\( *ASTLOGDIR\)=.*;\1=$(localstatedir)/asterisk/log;g' \
   1.250 +        -e 's;^\( *ASTVARRUNDIR\)=.*;\1=$(localstatedir)/asterisk/run;g' \
   1.251 +        -e 's;^\( *ASTMANDIR\)=.*;\1=$(mandir);g' \
   1.252 +        -e 's;^\( *ASTVARLIBDIR\)=.*;\1=$(localstatedir)/asterisk/lib;g' \
   1.253 +        -e 's;^\( *ASTVARRUNDIR\)=.*;\1=$(localstatedir)/asterisk/run;g' \
   1.254 +        -e 's;^\( *ASTDATADIR\):*=.*;\1=$(datadir)/asterisk;g' \
   1.255 +        -e 's/\(for f in\) \(\$(OLDMODS); do \\\)$/\1 "warning:" \2/' \
   1.256 +        Makefile
   1.257 +        #-e 's;\(ASTSPOOLDIR=\$(localstatedir)\)\(/spool\)\(/asterisk\);\1\3\2;' \
   1.258 +        #-e 's;\(ASTLOGDIR=\$(localstatedir)\)\(/log\)\(/asterisk\);\1\3\2;' \
   1.259 +        #-e 's;\(ASTVARRUNDIR=\$(localstatedir)\)\(/run\);\1/asterisk\2;' \
   1.260 +        #-e 's;\(ASTVARRUNDIR=\$(localstatedir)\)\(/run\)\(/asterisk\);\1\3\2;' \
   1.261 +        #-e 's;\(ASTVARLIBDIR=\$(localstatedir)\)\(/lib\)\(/asterisk\);\1\3\2;' \
   1.262 +        #-e 's;\(ASTDATADIR:=\)\$(ASTVARLIBDIR);\1$(prefix)/share/asterisk;' \
   1.263 +        #Makefile
   1.264 +    %{l_shtool} subst \
   1.265 +        -e 's; *-L/usr/local/ssl/lib;;g' \
   1.266 +        -e 's;/opt/ssl/lib;%{l_prefix}/lib;g' \
   1.267 +        -e 's;/usr/local;%{l_prefix};g' \
   1.268 +        -e 's;\(ASTLINK=\)$;\1-Wl,--export-dynamic;g' \
   1.269 +        main/Makefile
   1.270 +    %{l_shtool} subst \
   1.271 +        -e 's;LOG_WARNING\(, "Failed to perform seek\);LOG_DEBUG\1;g' \
   1.272 +        main/channel.c
   1.273 +    %{l_shtool} subst \
   1.274 +        -e 's;LOG_WARNING\(, "[^ ][^ ]* is not supported\);LOG_DEBUG\1;g' \
   1.275 +        formats/format_ogg_vorbis.c
   1.276 +    %{l_shtool} subst \
   1.277 +        -e 's;\(/etc/radiusclient-ng/radiusclient.conf\);%{l_prefix}\1;g' \
   1.278 +        -e 's;\(radiusclient\)-ng;\1;g' \
   1.279 +        cdr/cdr_radius.c
   1.280 +    %{l_shtool} subst \
   1.281 +        -e 's;\(sqlite\)\(\.h\);\13\2;g' \
   1.282 +        cdr/cdr_sqlite.c
   1.283 +    %{l_shtool} subst \
   1.284 +        -e 's;\(#define DEFAULT_POLLING_INTERVAL\)  *.*;\1 %{with_smdipoll};' \
   1.285 +        res/res_smdi.c
   1.286 +    %{l_shtool} subst \
   1.287 +        -e 's;\(ASTERISK_HEADER_DIR=\).*;\1%{l_prefix}/include;g' \
   1.288 +        -e 's;\(MODULES_DIR=\).*;\1%{l_prefix}/lib/asterisk/modules;g' \
   1.289 +        -e 's;\(CONFIG_DIR=\).*;\1%{l_prefix}/etc/asterisk;g' \
   1.290 +        -e 's;\(\$(MODULES_DIR)\);$(DESTDIR)\1;g' \
   1.291 +        -e 's;\${CONFIG_DIR};$(DESTDIR)$(CONFIG_DIR);g' \
   1.292 +        chan_capi-%{V_chan_capi}/Makefile
   1.293 +
   1.294 +#    #   optionally specify CPU
   1.295 +#    %{l_shtool} subst \
   1.296 +#        -e 's;build_cpu=\$1;build_cpu=i586;' \
   1.297 +#        -e 's;host_cpu=\$1;host_cpu=i586;' \
   1.298 +#        configure
   1.299 +
   1.300 +%build
   1.301 +    #   apply platform build rules
   1.302 +    libs="`pkg-config openssl speex --libs-only-l`"
   1.303 +%if "%{with_curl}" == "yes"
   1.304 +    libs="$libs `pkg-config libcurl --libs-only-l`"
   1.305 +%endif
   1.306 +%if "%{with_sqlite}" == "yes"
   1.307 +    libs="$libs `pkg-config sqlite3 --libs-only-l`"
   1.308 +%endif
   1.309 +%if "%{with_pgsql}" == "yes"
   1.310 +    libs="-lpq $libs"
   1.311 +%endif
   1.312 +%if "%{with_radius}" == "yes"
   1.313 +    libs="$libs -lradiusclient"
   1.314 +%endif
   1.315 +%if "%{with_libpri}" == "yes"
   1.316 +    libs="$libs -lpri"
   1.317 +%endif
   1.318 +    case "%{l_platform -t}" in
   1.319 +        *-linux*    ) libs="$libs -lrt" ;;
   1.320 +        *-sunos*    ) libs="$libs -lrt" ;;
   1.321 +    esac
   1.322 +
   1.323 +    #   configure package
   1.324 +    CC="%{l_cc}" \
   1.325 +    CFLAGS="%{l_cflags -O}" \
   1.326 +%if "%{with_imap}" == "yes"
   1.327 +    CPPFLAGS="%{l_cppflags imap ncurses}" \
   1.328 +%else
   1.329 +    CPPFLAGS="%{l_cppflags ncurses}" \
   1.330 +%endif
   1.331 +    LDFLAGS="%{l_ldflags}" \
   1.332 +    LIBS="$libs" \
   1.333 +    ./configure \
   1.334 +        --prefix=%{l_prefix} \
   1.335 +        --mandir=%{l_prefix}/man \
   1.336 +        --with-ncurses=%{l_prefix} \
   1.337 +%if "%{with_libpri}" == "yes"
   1.338 +        --with-pri=%{l_prefix} \
   1.339 +%else
   1.340 +        --with-pri=no \
   1.341 +%endif
   1.342 +        --with-ssl=%{l_prefix} \
   1.343 +%if "%{with_radius}" == "yes"
   1.344 +        --with-radius=%{l_prefix} \
   1.345 +%else
   1.346 +        --with-radius=no \
   1.347 +%endif
   1.348 +%if "%{with_sqlite}" == "yes"
   1.349 +        --with-sqlite=%{l_prefix} \
   1.350 +%else
   1.351 +        --with-sqlite=no \
   1.352 +%endif
   1.353 +%if "%{with_postgresql}" == "yes"
   1.354 +        --with-postgres=%{l_prefix} \
   1.355 +%else
   1.356 +        --with-postgres=no \
   1.357 +%endif
   1.358 +%if "%{with_curl}" == "yes"
   1.359 +        --with-curl=%{l_prefix} \
   1.360 +%else
   1.361 +        --with-curl=no \
   1.362 +%endif
   1.363 +%if "%{with_imap}" == "yes"
   1.364 +        --with-imap=%{l_prefix} \
   1.365 +        --disable-largefile \
   1.366 +%else
   1.367 +        --with-imap=no \
   1.368 +%endif
   1.369 +%if "%{with_astman}" == "yes"
   1.370 +        --with-newt=%{l_prefix} \
   1.371 +%else
   1.372 +        --with-newt=no \
   1.373 +%endif
   1.374 +        --with-speex=%{l_prefix} \
   1.375 +        --with-speexdsp=%{l_prefix} \
   1.376 +        --with-ogg=%{l_prefix} \
   1.377 +        --with-vorbis=%{l_prefix} \
   1.378 +        --with-z=%{l_prefix}
   1.379 +
   1.380 +    #   build package
   1.381 +    %{l_make} %{l_mflags -O} menuselect/menuselect menuselect-tree
   1.382 +    menuselect/menuselect --check-deps menuselect.makeopts
   1.383 +    %{l_shtool} subst \
   1.384 +        -e 's;\(MENUSELECT_MOH=\).*;\1;' \
   1.385 +        -e 's;\(MENUSELECT_CORE_SOUNDS=\).*;\1;' \
   1.386 +        -e 's;\(MENUSELECT_EXTRA_SOUNDS=\).*;\1;' \
   1.387 +        menuselect.makeopts
   1.388 +%if "%{with_imap}" == "yes"
   1.389 +    %{l_shtool} subst \
   1.390 +        -e 's;\(MENUSELECT_OPTS_app_voicemail=\)$;\1IMAP_STORAGE;' \
   1.391 +        menuselect.makeopts
   1.392 +%endif
   1.393 +    %{l_make} %{l_mflags -O} EXTLIBS="$libs" NOISY_BUILD=yes
   1.394 +%if "%{with_capi}" == "yes"
   1.395 +    ( cd chan_capi-%{V_chan_capi}
   1.396 +      %{l_make} %{l_mflags -O}
   1.397 +    ) || exit $?
   1.398 +%endif
   1.399 +
   1.400 +%install
   1.401 +    rm -rf $RPM_BUILD_ROOT
   1.402 +
   1.403 +    #   install package
   1.404 +    %{l_make} %{l_mflags} install DESTDIR=$RPM_BUILD_ROOT
   1.405 +%if "%{with_capi}" == "yes"
   1.406 +    ( cd chan_capi-%{V_chan_capi}
   1.407 +      %{l_make} %{l_mflags} install samples DESTDIR=$RPM_BUILD_ROOT
   1.408 +    ) || exit $?
   1.409 +%endif
   1.410 +
   1.411 +    #   install all sound prompt files
   1.412 +    for codec in alaw ulaw g722 g729 gsm; do
   1.413 +        for lang in es fr; do
   1.414 +            ( cd $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds/${lang}
   1.415 +              %{l_tar} zxf %{_sourcedir}/asterisk-core-sounds-${lang}-${codec}-%{V_langsounds}.tar.gz
   1.416 +            ) || exit $?
   1.417 +        done
   1.418 +        ( cd $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds
   1.419 +          %{l_tar} zxf %{_sourcedir}/asterisk-extra-sounds-en-${codec}-%{V_extrasounds}.tar.gz
   1.420 +          %{l_tar} zxf %{_sourcedir}/asterisk-core-sounds-en-${codec}-%{V_langsounds}.tar.gz
   1.421 +        ) || exit $?
   1.422 +    done
   1.423 +
   1.424 +    #   install special case sound files
   1.425 +    ( cd $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds
   1.426 +      %{l_tar} jxf %{SOURCE de-digits-%{V_customsounds}.tar.bz2}
   1.427 +      %{l_tar} zxf %{SOURCE asterisk-core-sounds-de-gsm-current.tar.gz}
   1.428 +      cd de
   1.429 +      %{l_tar} zxf %{_sourcedir}/asterisk-%{V_amoomasounds}-de-prompts.tar.gz
   1.430 +      mv -f de/* . && rm -rf de
   1.431 +      mv -f dictate/de/* letters/ && rm -rf dictate/de
   1.432 +      mv -f digits/de/* letters/ && rm -rf digits/de
   1.433 +      mv -f letters/de/* letters/ && rm -rf letters/de
   1.434 +      mv -f phonetic/de/* letters/ && rm -rf phonetic/de
   1.435 +    ) || exit $?
   1.436 +
   1.437 +    #   install additional music on hold files
   1.438 +    ( cd $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/moh
   1.439 +      for codec in alaw ulaw g722 g729 gsm; do
   1.440 +          %{l_tar} zxf %{_sourcedir}/asterisk-moh-freeplay-${codec}.tar.gz
   1.441 +      done
   1.442 +    ) || exit $?
   1.443 +
   1.444 +#    #   install nonstandard voicemail prompts
   1.445 +#    %{l_shtool} mkdir -f -p -m 755 \
   1.446 +#        $RPM_BUILD_ROOT%{l_prefix}/var/asterisk/spool/voicemail/default/%{exten}/unavail
   1.447 +#    %{l_shtool} install -c -m 660 \
   1.448 +#        %{_sourcedir}/ansage-%{V_ansage}.wav} \
   1.449 +#        $RPM_BUILD_ROOT%{l_prefix}/var/asterisk/spool/voicemail/default/%{exten}/unavail.wav
   1.450 +
   1.451 +    #   install default configuration
   1.452 +    %{l_shtool} install -c -m 660 %{l_value -s -a} \
   1.453 +        %{SOURCE asterisk.conf} \
   1.454 +        %{SOURCE amd.conf} \
   1.455 +        %{SOURCE cdr.conf} \
   1.456 +        %{SOURCE codecs.conf} \
   1.457 +        %{SOURCE extensions.conf} \
   1.458 +        %{SOURCE features.conf} \
   1.459 +        %{SOURCE festival.conf} \
   1.460 +        %{SOURCE followme.conf} \
   1.461 +        %{SOURCE indications.conf} \
   1.462 +        %{SOURCE logger.conf} \
   1.463 +        %{SOURCE manager.conf} \
   1.464 +        %{SOURCE meetme.conf} \
   1.465 +        %{SOURCE modules.conf} \
   1.466 +        %{SOURCE musiconhold.conf} \
   1.467 +        %{SOURCE rtp.conf} \
   1.468 +        %{SOURCE sip.conf} \
   1.469 +        %{SOURCE sla.conf} \
   1.470 +        %{SOURCE voicemail.conf} \
   1.471 +        %{SOURCE zapata.conf} \
   1.472 +        $RPM_BUILD_ROOT%{l_prefix}/etc/asterisk/
   1.473 +
   1.474 +    #   install runcommand script
   1.475 +    %{l_shtool} mkdir -f -p -m 755 \
   1.476 +        $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
   1.477 +    %{l_shtool} install -c -m 755 %{l_value -s -a} \
   1.478 +        %{SOURCE rc.asterisk} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
   1.479 +
   1.480 +    #   install additional AGI scripts
   1.481 +    %{l_shtool} install -c -m 755 %{l_value -s -a} \
   1.482 +        %{SOURCE wakeup.agi} $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/agi-bin/
   1.483 +
   1.484 +    #   correct installation hierarchy
   1.485 +    %{l_shtool} mkdir -f -p -m 755 \
   1.486 +        $RPM_BUILD_ROOT%{l_prefix}/var/asterisk/lib \
   1.487 +        $RPM_BUILD_ROOT%{l_prefix}/var/asterisk/spool/outgoing
   1.488 +
   1.489 +    #   remove unused components
   1.490 +    rm -rf \
   1.491 +        $RPM_BUILD_ROOT%{l_prefix}/bin \
   1.492 +        $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/images \
   1.493 +        $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds/de/.DS_Store \
   1.494 +        $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds/de/autogen.sh \
   1.495 +        >/dev/null 2>&1 || true
   1.496 +
   1.497 +    #   adjust inconsistent names
   1.498 +    for bin in $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/agi-bin/*.*; do
   1.499 +        mv $bin `echo $bin | sed -e 's;\.[^.]*$;;'`
   1.500 +    done
   1.501 +
   1.502 +    #   strip down installation
   1.503 +    strip $RPM_BUILD_ROOT%{l_prefix}/bin/* \
   1.504 +          $RPM_BUILD_ROOT%{l_prefix}/sbin/* \
   1.505 +          $RPM_BUILD_ROOT%{l_prefix}/lib/asterisk/modules/* \
   1.506 +          $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/agi-bin/* \
   1.507 +          >/dev/null 2>&1 || true
   1.508 +
   1.509 +    #   determine installation files
   1.510 +    %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT %{l_files_std} \
   1.511 +        '%config %attr(660,%{l_musr},%{l_rgrp}) %{l_prefix}/etc/asterisk/*' \
   1.512 +        '%config %attr(644,%{l_musr},%{l_mgrp}) %{l_prefix}/share/asterisk/sounds/de/*' \
   1.513 +        '%config %attr(755,%{l_musr},%{l_mgrp}) %{l_prefix}/share/asterisk/sounds/de/dictate' \
   1.514 +        '%config %attr(755,%{l_musr},%{l_mgrp}) %{l_prefix}/share/asterisk/sounds/de/digits' \
   1.515 +        '%config %attr(755,%{l_musr},%{l_mgrp}) %{l_prefix}/share/asterisk/sounds/de/followme' \
   1.516 +        '%config %attr(755,%{l_musr},%{l_mgrp}) %{l_prefix}/share/asterisk/sounds/de/letters' \
   1.517 +        '%config %attr(755,%{l_musr},%{l_mgrp}) %{l_prefix}/share/asterisk/sounds/de/phonetic' \
   1.518 +        '%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/asterisk/*' \
   1.519 +        '%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/asterisk/*/*'
   1.520 +
   1.521 +%files -f files
   1.522 +
   1.523 +%clean
   1.524 +    rm -rf $RPM_BUILD_ROOT
   1.525 +
   1.526 +%post
   1.527 +    #   after upgrade, restart service
   1.528 +    [ $1 -eq 2 ] || exit 0
   1.529 +    eval `%{l_rc} asterisk status 2>/dev/null`
   1.530 +    [ ".$asterisk_active" = .yes ] && %{l_rc} asterisk restart
   1.531 +    exit 0
   1.532 +
   1.533 +%preun
   1.534 +    #   before erase, stop service and remove log files
   1.535 +    [ $1 -eq 0 ] || exit 0
   1.536 +    %{l_rc} asterisk stop 2>/dev/null
   1.537 +    rm  -f $RPM_INSTALL_PREFIX/var/asterisk/lib/*       >/dev/null 2>&1 || true
   1.538 +    rm  -f $RPM_INSTALL_PREFIX/var/asterisk/log/*       >/dev/null 2>&1 || true
   1.539 +    rm  -f $RPM_INSTALL_PREFIX/var/asterisk/log/cdr-*/* >/dev/null 2>&1 || true
   1.540 +    rm  -f $RPM_INSTALL_PREFIX/var/asterisk/run/*       >/dev/null 2>&1 || true
   1.541 +    for deldir in meetme outgoing system tmp; do
   1.542 +        rm -rf \
   1.543 +            $RPM_INSTALL_PREFIX/var/asterisk/spool/$deldir \
   1.544 +            >/dev/null 2>&1 || true
   1.545 +    done
   1.546 +    exit 0
   1.547 +

mercurial