asterisk/asterisk.spec

changeset 310
73d852a30c9a
parent 202
f29abea29121
child 311
263143ec0fb2
     1.1 --- a/asterisk/asterisk.spec	Sun Mar 20 19:27:35 2011 +0100
     1.2 +++ b/asterisk/asterisk.spec	Sun Mar 20 20:00:02 2011 +0100
     1.3 @@ -1,7 +1,6 @@
     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 +##  Copyright (c) 2000-2010 OpenPKG Foundation e.V. <http://openpkg.net/>
     1.9  ##
    1.10  ##  Permission to use, copy, modify, and distribute this software for
    1.11  ##  any purpose with or without fee is hereby granted, provided that
    1.12 @@ -22,146 +21,102 @@
    1.13  ##  SUCH DAMAGE.
    1.14  ##
    1.15  
    1.16 -#   package component versions
    1.17 -%define       V_langsounds    1.4.12
    1.18 -%define       V_extrasounds   1.4.9
    1.19 -%define       V_amoomasounds  1.4
    1.20 -%define       V_customsounds  1.0
    1.21 -%define       V_chan_capi     1.1.2
    1.22 +#   package version
    1.23 +%define       V_opkg                     1.6.2.13
    1.24 +%define       V_asterisk                 1.6.2.13
    1.25 +%define       V_asterisk_addons          1.6.2.2
    1.26 +%define       V_asterisk_sounds_core_en  1.4.20
    1.27 +%define       V_asterisk_sounds_core_de  current
    1.28 +%define       V_asterisk_sounds_extra_en 1.4.11
    1.29 +%define       V_chan_capi                1.1.5
    1.30  
    1.31  #   package information
    1.32  Name:         asterisk
    1.33 -Summary:      Private Branch Exchange (PBX) for VoIP
    1.34 +Summary:      Private Branch Exchange (PBX)
    1.35  URL:          http://www.asterisk.org/
    1.36  Vendor:       Mark Spencer et al.
    1.37 -Packager:     Michael Schloh von Bennewitz
    1.38 -Distribution: Michael Schloh von Bennewitz
    1.39 -Class:        EVAL
    1.40 +Packager:     OpenPKG Foundation e.V.
    1.41 +Distribution: OpenPKG Community
    1.42 +Class:        BASE
    1.43  Group:        VoIP
    1.44  License:      GPL
    1.45 -Version:      1.4.24.1
    1.46 -Release:      20090422
    1.47 +Version:      %{V_opkg}
    1.48 +Release:      20101019
    1.49  
    1.50  #   package options
    1.51 -%option       with_libpri     yes
    1.52 -%option       with_xfersips   yes
    1.53 -%option       with_proxymwi   yes
    1.54 -%option       with_parseavp   yes
    1.55 -%option       with_radius     no
    1.56 -%option       with_sqlite     no
    1.57 -%option       with_pgsql      no
    1.58 -%option       with_curl       no
    1.59 -%option       with_imap       no
    1.60 -%option       with_astman     no
    1.61 -%option       with_capi       no
    1.62 -%option       with_zaptel     no
    1.63 -%option       with_smdipoll   10
    1.64 +%option       with_dahdi   no
    1.65 +%option       with_capi    no
    1.66 +%option       with_ogg     no
    1.67 +%option       with_mp3     no
    1.68 +%option       with_fax     no
    1.69 +%option       with_avcodec no
    1.70 +%option       with_ldap    no
    1.71 +%option       with_radius  no
    1.72 +%option       with_sqlite  no
    1.73 +%option       with_lua     no
    1.74 +%option       with_jabber  no
    1.75 +%option       with_imap    no
    1.76 +%option       with_odbc    no
    1.77  
    1.78  #   list of sources
    1.79 -Source0:      http://downloads.digium.com/pub/asterisk/releases/asterisk-%{version}.tar.gz
    1.80 -Source1:      ftp://ftp.chan-capi.org/chan-capi/chan_capi-%{V_chan_capi}.tar.gz
    1.81 -Source2:      http://downloads.digium.com/pub/telephony/sounds/releases/asterisk-moh-freeplay-alaw.tar.gz
    1.82 -Source3:      http://downloads.digium.com/pub/telephony/sounds/releases/asterisk-moh-freeplay-g722.tar.gz
    1.83 -Source4:      http://downloads.digium.com/pub/telephony/sounds/releases/asterisk-moh-freeplay-g729.tar.gz
    1.84 -Source5:      http://downloads.digium.com/pub/telephony/sounds/releases/asterisk-moh-freeplay-gsm.tar.gz
    1.85 -Source6:      http://downloads.digium.com/pub/telephony/sounds/releases/asterisk-moh-freeplay-ulaw.tar.gz
    1.86 -Source7:      http://downloads.digium.com/pub/telephony/sounds/releases/asterisk-extra-sounds-en-alaw-%{V_extrasounds}.tar.gz
    1.87 -Source8:      http://downloads.digium.com/pub/telephony/sounds/releases/asterisk-extra-sounds-en-g722-%{V_extrasounds}.tar.gz
    1.88 -Source9:      http://downloads.digium.com/pub/telephony/sounds/releases/asterisk-extra-sounds-en-g729-%{V_extrasounds}.tar.gz
    1.89 -Source10:      http://downloads.digium.com/pub/telephony/sounds/releases/asterisk-extra-sounds-en-gsm-%{V_extrasounds}.tar.gz
    1.90 -Source11:     http://downloads.digium.com/pub/telephony/sounds/releases/asterisk-extra-sounds-en-ulaw-%{V_extrasounds}.tar.gz
    1.91 -Source12:     http://downloads.digium.com/pub/telephony/sounds/releases/asterisk-core-sounds-en-alaw-%{V_langsounds}.tar.gz
    1.92 -Source13:     http://downloads.digium.com/pub/telephony/sounds/releases/asterisk-core-sounds-en-g722-%{V_langsounds}.tar.gz
    1.93 -Source14:     http://downloads.digium.com/pub/telephony/sounds/releases/asterisk-core-sounds-en-g729-%{V_langsounds}.tar.gz
    1.94 -Source15:     http://downloads.digium.com/pub/telephony/sounds/releases/asterisk-core-sounds-en-gsm-%{V_langsounds}.tar.gz
    1.95 -Source16:     http://downloads.digium.com/pub/telephony/sounds/releases/asterisk-core-sounds-en-ulaw-%{V_langsounds}.tar.gz
    1.96 -Source17:     http://downloads.digium.com/pub/telephony/sounds/releases/asterisk-core-sounds-es-alaw-%{V_langsounds}.tar.gz
    1.97 -Source18:     http://downloads.digium.com/pub/telephony/sounds/releases/asterisk-core-sounds-es-g722-%{V_langsounds}.tar.gz
    1.98 -Source19:     http://downloads.digium.com/pub/telephony/sounds/releases/asterisk-core-sounds-es-g729-%{V_langsounds}.tar.gz
    1.99 -Source20:     http://downloads.digium.com/pub/telephony/sounds/releases/asterisk-core-sounds-es-gsm-%{V_langsounds}.tar.gz
   1.100 -Source21:     http://downloads.digium.com/pub/telephony/sounds/releases/asterisk-core-sounds-es-ulaw-%{V_langsounds}.tar.gz
   1.101 -Source22:     http://downloads.digium.com/pub/telephony/sounds/releases/asterisk-core-sounds-fr-alaw-%{V_langsounds}.tar.gz
   1.102 -Source23:     http://downloads.digium.com/pub/telephony/sounds/releases/asterisk-core-sounds-fr-g722-%{V_langsounds}.tar.gz
   1.103 -Source24:     http://downloads.digium.com/pub/telephony/sounds/releases/asterisk-core-sounds-fr-g729-%{V_langsounds}.tar.gz
   1.104 -Source25:     http://downloads.digium.com/pub/telephony/sounds/releases/asterisk-core-sounds-fr-gsm-%{V_langsounds}.tar.gz
   1.105 -Source26:     http://downloads.digium.com/pub/telephony/sounds/releases/asterisk-core-sounds-fr-ulaw-%{V_langsounds}.tar.gz
   1.106 -Source27:     http://www.amooma.de/asterisk/sprachbausteine/asterisk-%{V_amoomasounds}-de-prompts.tar.gz
   1.107 -Source28:     http://www.amooma.de/asterisk/sprachbausteine/asterisk-core-sounds-de-gsm-current.tar.gz
   1.108 -Source29:     ftp://ftp.europalab.com/pub/sfw/machsnds/de-digits/de-digits-%{V_customsounds}.tar.bz2
   1.109 -Source30:     asterisk.conf
   1.110 -Source31:     amd.conf
   1.111 -Source32:     capi.conf
   1.112 -Source33:     cdr.conf
   1.113 -Source34:     cdr_custom.conf
   1.114 -Source35:     codecs.conf
   1.115 -Source36:     dundi.conf
   1.116 -Source37:     enum.conf
   1.117 -Source38:     extensions.conf
   1.118 -Source39:     features.conf
   1.119 -Source40:     festival.conf
   1.120 -Source41:     followme.conf
   1.121 -Source42:     indications.conf
   1.122 -Source33:     logger.conf
   1.123 -Source34:     manager.conf
   1.124 -Source45:     meetme.conf
   1.125 -Source46:     misdn.conf
   1.126 -Source47:     modules.conf
   1.127 -Source48:     musiconhold.conf
   1.128 -Source49:     privacy.conf
   1.129 -Source50:     rpt.conf
   1.130 -Source51:     rtp.conf
   1.131 -Source52:     say.conf
   1.132 -Source53:     sip.conf
   1.133 -Source54:     sip_notify.conf
   1.134 -Source55:     sla.conf
   1.135 -Source56:     voicemail.conf
   1.136 -Source57:     zapata.conf
   1.137 -Source58:     rc.asterisk
   1.138 -Source59:     wakeup.agi
   1.139 +Source0:      http://downloads.asterisk.org/pub/telephony/asterisk/releases/asterisk-%{V_asterisk}.tar.gz
   1.140 +Source1:      http://downloads.asterisk.org/pub/telephony/asterisk/releases/asterisk-addons-%{V_asterisk_addons}.tar.gz
   1.141 +Source2:      http://downloads.asterisk.org/pub/telephony/sounds/releases/asterisk-core-sounds-en-alaw-%{V_asterisk_sounds_core_en}.tar.gz
   1.142 +Source3:      http://downloads.asterisk.org/pub/telephony/sounds/releases/asterisk-extra-sounds-en-alaw-%{V_asterisk_sounds_extra_en}.tar.gz
   1.143 +Source4:      http://www.amooma.de/asterisk/sprachbausteine/asterisk-core-sounds-de-gsm-%{V_asterisk_sounds_core_de}.tar.gz
   1.144 +Source5:      ftp://ftp.chan-capi.org/chan-capi/chan_capi-%{V_chan_capi}.tar.gz
   1.145 +Source6:      asterisk.txt
   1.146 +Source7:      rc.asterisk
   1.147  Patch0:       asterisk.patch
   1.148 -Patch1:       asterisk.patch.xfersips
   1.149 -Patch2:       asterisk.patch.proxymwi
   1.150 -Patch3:       asterisk.patch.parseavp
   1.151  
   1.152  #   build information
   1.153 -Prefix:       %{l_prefix}
   1.154 -BuildRoot:    %{l_buildroot}
   1.155 -BuildPreReq:  OpenPKG, openpkg >= 20040130, pkgconfig, awk, grep
   1.156 -PreReq:       OpenPKG, openpkg >= 20040130
   1.157 -BuildPreReq:  ncurses, openssl, zlib
   1.158 -PreReq:       ncurses, openssl, zlib
   1.159 -BuildPreReq:  speex, vorbis-libs, sox
   1.160 -PreReq:       speex, vorbis-libs, sox
   1.161 -%if "%{with_libpri}" == "yes"
   1.162 -BuildPreReq:  libpri
   1.163 -PreReq:       libpri
   1.164 +BuildPreReq:  OpenPKG, openpkg >= 20100101, bison, gcc, make, grep
   1.165 +PreReq:       OpenPKG, openpkg >= 20100101, MTA
   1.166 +BuildPreReq:  zlib, curl, openssl, ncurses, speex, popt, gmime22
   1.167 +PreReq:       zlib, curl, openssl, ncurses, speex, popt, gmime22
   1.168 +%if "%{with_ogg}" == "yes"
   1.169 +BuildPreReq:  vorbis-libs
   1.170 +PreReq:       vorbis-libs
   1.171 +%endif
   1.172 +%if "%{with_mp3}" == "yes"
   1.173 +PreReq:       mpg123
   1.174 +%endif
   1.175 +%if "%{with_imap}" == "yes"
   1.176 +BuildPreReq:  imap
   1.177 +PreReq:       imap
   1.178 +%endif
   1.179 +%if "%{with_sqlite}" == "yes"
   1.180 +BuildPreReq:  sqlite
   1.181 +PreReq:       sqlite
   1.182 +%endif
   1.183 +%if "%{with_lua}" == "yes"
   1.184 +BuildPreReq:  lua
   1.185 +PreReq:       lua
   1.186 +%endif
   1.187 +%if "%{with_fax}" == "yes"
   1.188 +BuildPreReq:  spandsp, tiff, jpeg, zlib
   1.189 +PreReq:       spandsp, tiff, jpeg, zlib
   1.190 +%endif
   1.191 +%if "%{with_avcodec}" == "yes"
   1.192 +BuildPreReq:  ffmpeg
   1.193 +PreReq:       ffmpeg
   1.194 +%endif
   1.195 +%if "%{with_ldap}" == "yes"
   1.196 +BuildPreReq:  openldap
   1.197 +PreReq:       openldap
   1.198  %endif
   1.199  %if "%{with_radius}" == "yes"
   1.200  BuildPreReq:  radiusclient
   1.201  PreReq:       radiusclient
   1.202  %endif
   1.203 -%if "%{with_sqlite}" == "yes"
   1.204 -BuildPreReq:  sqlite
   1.205 -PreReq:       sqlite
   1.206 +%if "%{with_jabber}" == "yes"
   1.207 +BuildPreReq:  iksemel
   1.208 +PreReq:       iksemel
   1.209  %endif
   1.210 -%if "%{with_pgsql}" == "yes"
   1.211 -BuildPreReq:  postgresql
   1.212 -PreReq:       postgresql
   1.213 +%if "%{with_odbc}" == "yes"
   1.214 +BuildPreReq:  unixodbc, sqlite, sqlite::with_odbc = yes
   1.215 +PreReq:       unixodbc, sqlite, sqlite::with_odbc = yes
   1.216  %endif
   1.217 -%if "%{with_curl}" == "yes"
   1.218 -BuildPreReq:  curl
   1.219 -PreReq:       curl
   1.220 -%endif
   1.221 -%if "%{with_imap}" == "yes"
   1.222 -BuildPreReq:  imap
   1.223 -PreReq:       imap
   1.224 -%endif
   1.225 -%if "%{with_astman}" == "yes"
   1.226 -BuildPreReq:  newt
   1.227 -PreReq:       newt
   1.228 -%endif
   1.229 -AutoReq:      no
   1.230 -AutoReqProv:  no
   1.231  
   1.232  %description
   1.233      Asterisk is a complete Private Branch Exchange (PBX) in software.
   1.234 @@ -172,355 +127,374 @@
   1.235      three-way calling, caller ID services, ADSI, SIP, etc. Asterisk
   1.236      needs no additional hardware for VoIP.
   1.237  
   1.238 -    This copy of Asterisk is optionally patched to allow the asterisk
   1.239 -    server to respond to SIP/TLS transfer requests using the Transfer()
   1.240 -    application. Should this option be chosen, the asterisk server
   1.241 -    successfully dispatches all transfer destinations using 'SIPS'
   1.242 -    technology by means of the standard SIP/2.0 302 Moved Temporarily
   1.243 -    message, with a URI resembling <sips:extension@hostname.tld:port>.
   1.244 -
   1.245 -    This copy of Asterisk is optionally patched as well to enclose the
   1.246 -    correct user name in NOTIFY messages when MWI logic detects changes
   1.247 -    in the state of Messages-Waiting. Asterisk will send NOTIFY messages
   1.248 -    with the URI 'user@hostname' instead of simply 'hostname'. This can
   1.249 -    be used by a external SIP proxy to route the MWI to the correct phone.
   1.250 -
   1.251  %track
   1.252      prog asterisk = {
   1.253 -        version   = %{version}
   1.254 -        url       = http://downloads.digium.com/pub/asterisk/releases/
   1.255 -        regex     = asterisk-(__VER__)\.tar\.gz
   1.256 +        version   = %{V_asterisk}
   1.257 +        url       = http://downloads.asterisk.org/pub/telephony/asterisk/releases/
   1.258 +        regex     = asterisk-(\d+\.\d+(\.\d+)+)\.tar\.gz
   1.259 +    }
   1.260 +    prog asterisk:addons = {
   1.261 +        version   = %{V_asterisk_addons}
   1.262 +        url       = http://downloads.asterisk.org/pub/telephony/asterisk/releases/
   1.263 +        regex     = asterisk-addons-(\d+\.\d+(\.\d+)+)\.tar\.gz
   1.264 +    }
   1.265 +    prog asterisk:sounds_core_en = {
   1.266 +        version   = %{V_asterisk_sounds_core_en}
   1.267 +        url       = http://downloads.asterisk.org/pub/telephony/sounds/releases/
   1.268 +        regex     = asterisk-core-sounds-en-alaw-(\d+\.\d+(\.\d+)+)\.tar\.gz
   1.269 +    }
   1.270 +    prog asterisk:sounds_extra_en = {
   1.271 +        version   = %{V_asterisk_sounds_extra_en}
   1.272 +        url       = http://downloads.asterisk.org/pub/telephony/sounds/releases/
   1.273 +        regex     = asterisk-extra-sounds-en-alaw-(\d+\.\d+(\.\d+)+)\.tar\.gz
   1.274 +    }
   1.275 +    prog asterisk:sounds_core_de = {
   1.276 +        version   = %{V_asterisk_sounds_core_de}
   1.277 +        url       = http://www.amooma.de/asterisk/sprachbausteine/
   1.278 +        regex     = asterisk-core-sounds-de-gsm-(__VER__)\.tar\.gz
   1.279 +    }
   1.280 +    prog asterisk:chan_capi = {
   1.281 +        version   = %{V_chan_capi}
   1.282 +        url       = ftp://ftp.chan-capi.org/chan-capi/
   1.283 +        regex     = chan_capi-(__VER__)\.tar\.gz
   1.284      }
   1.285  
   1.286  %prep
   1.287 -    %setup -q -n asterisk-%{version}
   1.288 -    %setup -q -n asterisk-%{version} -D -T -a 1
   1.289 +    %setup -q -n asterisk-%{V_asterisk}
   1.290 +    %setup -q -n asterisk-%{V_asterisk} -D -T -a 1
   1.291 +    %setup -q -n asterisk-%{V_asterisk} -D -T -a 5
   1.292      %patch -p0
   1.293 -%if "%{with_xfersips}" == "yes"
   1.294 -    %patch -p0 -P 1
   1.295 -%endif
   1.296 -%if "%{with_proxymwi}" == "yes"
   1.297 -    %patch -p0 -P 2
   1.298 -%endif
   1.299 -%if "%{with_parseavp}" == "yes"
   1.300 -    %patch -p0 -P 3
   1.301 +    exit 0
   1.302 +    cp %{SOURCE2} %{SOURCE3} sounds/
   1.303 +    %{l_shtool} subst \
   1.304 +        -e 's;\(CORE_SOUNDS_VERSION\):=.*$;\1:=%{V_asterisk_sounds_core_en};' \
   1.305 +        -e 's;\(EXTRA_SOUNDS_VERSION\):=.*$;\1:=%{V_asterisk_sounds_extra_en};' \
   1.306 +        sounds/Makefile
   1.307 +    %{l_shtool} subst \
   1.308 +        -e 's;-lradiusclient-ng;-lradiusclient;g' \
   1.309 +        -e 's;radiusclient-ng\.h;radiusclient.h;g' \
   1.310 +        configure cdr/cdr_radius.c
   1.311 +
   1.312 +%build
   1.313 +    #   sanity check
   1.314 +%if "%{with_dahdi}" == "yes"
   1.315 +    dahdi_prefix=""
   1.316 +    case "%{l_platform -t}" in
   1.317 +        *-linux* )
   1.318 +            if [ ! -f /usr/include/linux/dahdi.h ]; then
   1.319 +                echo "option \"with_dahdi\" requires DAHDI Linux drivers installed" 1>&2; exit 1
   1.320 +            fi
   1.321 +            dahdi_prefix=/usr
   1.322 +            ;;
   1.323 +        *-freebsd* )
   1.324 +            if [ ! -f /usr/local/include/dahdi/dahdi.h ]; then
   1.325 +                echo "option \"with_dahdi\" requires DAHDI FreeBSD drivers installed" 1>&2; exit 1
   1.326 +            fi
   1.327 +            dahdi_prefix=/usr/local
   1.328 +            ;;
   1.329 +        * ) echo "option \"with_dahdi\" supported under Linux and FreeBSD only" 1>&2; exit 1 ;;
   1.330 +    esac
   1.331  %endif
   1.332  
   1.333 -    #   link install-sh to where Makefiles expect it
   1.334 -    for dir in agi utils res channels pbx apps codecs formats cdr funcs main; do
   1.335 -        ( cd $dir && ln -s ../install-sh ) || exit $?
   1.336 -    done
   1.337 +    #   re-configure music-on-hold to find mpg123
   1.338 +%if "%{with_mp3}" == "yes"
   1.339 +    mpg123="%{l_prefix}/bin/mpg123"
   1.340 +%else
   1.341 +    mpg123="`which false`"
   1.342 +%endif
   1.343 +    %{l_shtool} subst \
   1.344 +        -e "s;/usr/local/bin/mpg123;$mpg123;" \
   1.345 +        -e "s;/usr/bin/mpg123;$mpg123;" \
   1.346 +        res/res_musiconhold.c apps/app_mp3.c
   1.347  
   1.348 -    #   apply corrections
   1.349 -    case "%{l_platform -t}" in
   1.350 -        *-sunos* )
   1.351 -            %{l_shtool} subst \
   1.352 -                -e 's|\(tmp->tm_gmtoff = ttisp->tt_gmtoff;\)|/*\1*/|' \
   1.353 -                main/stdtime/localtime.c
   1.354 -            ;;
   1.355 -    esac
   1.356 +    #   build program
   1.357      %{l_shtool} subst \
   1.358 -        -e 's;sysconfdir=/etc;true;' \
   1.359 -        -e 's;mandir=/usr/share/man;true;' \
   1.360 -        -e 's;localstatedir=/var;true;' \
   1.361 -        -e 's;\(radiusclient\)-ng;\1;g' \
   1.362 -        -e 's;\(\-lsqlite\);\13;g' \
   1.363 -        -e 's;\(sqlite\)\(\.h\);\13\2;g' \
   1.364 -        -e 's;\(sqlite\)\(_exec\);\13\2;g' \
   1.365 -        -e 's;^\(LIBS="-lvorbis\);\1 ${OGG_LIB};' \
   1.366 -        -e 's;\(#include <\${NCURSES_DIR}/include\);\1/ncurses;' \
   1.367 -        -e 's;-I${IMAP_TK_DIR}/c-client;-I${IMAP_TK_DIR}/include/imap;g' \
   1.368 -        -e 's;${IMAP_TK_DIR}/c-client/c-client\.a;-limap -lssl -lcrypto -lcrypt;g' \
   1.369 +        -e 's;-llua5\.1;-llua;' \
   1.370 +        -e 's;lua5\.1/lua\.h;lua/lua.h;' \
   1.371 +        -e 's;ffmpeg/avcodec\.h;libavcodec/avcodec.h;' \
   1.372          configure
   1.373 -    %{l_shtool} subst \
   1.374 -        -e 's; *-I/usr/local/ssl/include;;g' \
   1.375 -        -e 's;/opt/ssl/include;%{l_prefix}/include;g' \
   1.376 -        -e 's;/usr/local;%{l_prefix};g' \
   1.377 -        -e 's;^\(MOD_SUBDIR_CFLAGS=.*\ *\)$;\1 -I%{l_prefix}/include;' \
   1.378 -        -e 's;^\( *ASTETCDIR\)=.*;\1=$(sysconfdir)/asterisk;g' \
   1.379 -        -e 's;^\( *ASTLIBDIR\)=.*;\1=$(libdir)/asterisk;g' \
   1.380 -        -e 's;^\( *ASTHEADERDIR\)=.*;\1=$(includedir)/asterisk;g' \
   1.381 -        -e 's;^\( *ASTBINDIR\)=.*;\1=$(bindir);g' \
   1.382 -        -e 's;^\( *ASTSBINDIR\)=.*;\1=$(sbindir);g' \
   1.383 -        -e 's;^\( *ASTSPOOLDIR\)=.*;\1=$(localstatedir)/asterisk/spool;g' \
   1.384 -        -e 's;^\( *ASTLOGDIR\)=.*;\1=$(localstatedir)/asterisk/log;g' \
   1.385 -        -e 's;^\( *ASTVARRUNDIR\)=.*;\1=$(localstatedir)/asterisk/run;g' \
   1.386 -        -e 's;^\( *ASTMANDIR\)=.*;\1=$(mandir);g' \
   1.387 -        -e 's;^\( *ASTVARLIBDIR\)=.*;\1=$(localstatedir)/asterisk/lib;g' \
   1.388 -        -e 's;^\( *ASTVARRUNDIR\)=.*;\1=$(localstatedir)/asterisk/run;g' \
   1.389 -        -e 's;^\( *ASTDATADIR\):*=.*;\1=$(datadir)/asterisk;g' \
   1.390 -        -e 's/\(for f in\) \(\$(OLDMODS); do \\\)$/\1 "warning:" \2/' \
   1.391 -        Makefile
   1.392 -        #-e 's;\(ASTSPOOLDIR=\$(localstatedir)\)\(/spool\)\(/asterisk\);\1\3\2;' \
   1.393 -        #-e 's;\(ASTLOGDIR=\$(localstatedir)\)\(/log\)\(/asterisk\);\1\3\2;' \
   1.394 -        #-e 's;\(ASTVARRUNDIR=\$(localstatedir)\)\(/run\);\1/asterisk\2;' \
   1.395 -        #-e 's;\(ASTVARRUNDIR=\$(localstatedir)\)\(/run\)\(/asterisk\);\1\3\2;' \
   1.396 -        #-e 's;\(ASTVARLIBDIR=\$(localstatedir)\)\(/lib\)\(/asterisk\);\1\3\2;' \
   1.397 -        #-e 's;\(ASTDATADIR:=\)\$(ASTVARLIBDIR);\1$(prefix)/share/asterisk;' \
   1.398 -        #Makefile
   1.399 -    %{l_shtool} subst \
   1.400 -        -e 's; *-L/usr/local/ssl/lib;;g' \
   1.401 -        -e 's;/opt/ssl/lib;%{l_prefix}/lib;g' \
   1.402 -        -e 's;/usr/local;%{l_prefix};g' \
   1.403 -        -e 's;\(ASTLINK=\)$;\1-Wl,--export-dynamic;g' \
   1.404 -        main/Makefile
   1.405 -    %{l_shtool} subst \
   1.406 -        -e 's;LOG_WARNING\(, "Failed to perform seek\);LOG_DEBUG\1;g' \
   1.407 -        main/channel.c
   1.408 -    %{l_shtool} subst \
   1.409 -        -e 's;LOG_WARNING\(, "[^ ][^ ]* is not supported\);LOG_DEBUG\1;g' \
   1.410 -        formats/format_ogg_vorbis.c
   1.411 -    %{l_shtool} subst \
   1.412 -        -e 's;\(/etc/radiusclient-ng/radiusclient.conf\);%{l_prefix}\1;g' \
   1.413 -        -e 's;\(radiusclient\)-ng;\1;g' \
   1.414 -        cdr/cdr_radius.c
   1.415 -    %{l_shtool} subst \
   1.416 -        -e 's;\(sqlite\)\(\.h\);\13\2;g' \
   1.417 -        cdr/cdr_sqlite.c
   1.418 -    %{l_shtool} subst \
   1.419 -        -e 's;\(#define DEFAULT_POLLING_INTERVAL\)  *.*;\1 %{with_smdipoll};' \
   1.420 -        res/res_smdi.c
   1.421 -    %{l_shtool} subst \
   1.422 -        -e 's;\(ASTERISK_HEADER_DIR=\).*;\1%{l_prefix}/include;g' \
   1.423 -        -e 's;\(MODULES_DIR=\).*;\1%{l_prefix}/lib/asterisk/modules;g' \
   1.424 -        -e 's;\(CONFIG_DIR=\).*;\1%{l_prefix}/etc/asterisk;g' \
   1.425 -        -e 's;\(\$(MODULES_DIR)\);$(DESTDIR)\1;g' \
   1.426 -        -e 's;\${CONFIG_DIR};$(DESTDIR)$(CONFIG_DIR);g' \
   1.427 -        chan_capi-%{V_chan_capi}/Makefile
   1.428 -
   1.429 -#    #   optionally specify CPU
   1.430 -#    %{l_shtool} subst \
   1.431 -#        -e 's;build_cpu=\$1;build_cpu=i586;' \
   1.432 -#        -e 's;host_cpu=\$1;host_cpu=i586;' \
   1.433 -#        configure
   1.434 -
   1.435 -%build
   1.436 -    #   apply platform build rules
   1.437 -    libs="`pkg-config openssl speex --libs-only-l`"
   1.438 -%if "%{with_curl}" == "yes"
   1.439 -    libs="$libs `pkg-config libcurl --libs-only-l`"
   1.440 +    ( echo "ac_cv_prog_CONFIG_GMIME=%{l_prefix}/bin/gmime-config"
   1.441 +    ) >config.cache
   1.442 +    cflags="%{l_cflags -O}"
   1.443 +    cppflags="%{l_cppflags ncurses lua .}"
   1.444 +    ldflags="%{l_ldflags}"
   1.445 +    libs=""
   1.446 +    cppflags="$cppflags `pkg-config gmime-2.0 --cflags-only-I`"
   1.447 +    ldflags="$ldflags `pkg-config gmime-2.0 --libs-only-L`"
   1.448 +    libs="$libs `pkg-config gmime-2.0 --libs-only-l`"
   1.449 +%if "%{with_ogg}" == "yes"
   1.450 +    libs="$libs -logg -lm"
   1.451  %endif
   1.452 -%if "%{with_sqlite}" == "yes"
   1.453 -    libs="$libs `pkg-config sqlite3 --libs-only-l`"
   1.454 +%if "%{with_avcodec}" == "yes"
   1.455 +    libs="$libs -lavcodec -lavutil"
   1.456  %endif
   1.457 -%if "%{with_pgsql}" == "yes"
   1.458 -    libs="-lpq $libs"
   1.459 +%if "%{with_ldap}" == "yes"
   1.460 +    libs="$libs -lldap -llber -lssl -lcrypto"
   1.461  %endif
   1.462 -%if "%{with_radius}" == "yes"
   1.463 -    libs="$libs -lradiusclient"
   1.464 +%if "%{with_dahdi}" == "yes"
   1.465 +    cppflags="$cppflags -I$dahdi_prefix/include"
   1.466 +    ldflags="$ldflags -L$dahdi_prefix/lib"
   1.467  %endif
   1.468 -%if "%{with_libpri}" == "yes"
   1.469 -    libs="$libs -lpri"
   1.470 -%endif
   1.471 -    case "%{l_platform -t}" in
   1.472 -        *-linux*    ) libs="$libs -lrt" ;;
   1.473 -        *-sunos*    ) libs="$libs -lrt" ;;
   1.474 -    esac
   1.475 -
   1.476 -    #   configure package
   1.477      CC="%{l_cc}" \
   1.478 -    CFLAGS="%{l_cflags -O}" \
   1.479 -%if "%{with_imap}" == "yes"
   1.480 -    CPPFLAGS="%{l_cppflags imap ncurses}" \
   1.481 -%else
   1.482 -    CPPFLAGS="%{l_cppflags ncurses}" \
   1.483 -%endif
   1.484 -    LDFLAGS="%{l_ldflags}" \
   1.485 +    CFLAGS="$cflags" \
   1.486 +    CPPFLAGS="$cppflags" \
   1.487 +    LDFLAGS="$ldflags" \
   1.488      LIBS="$libs" \
   1.489      ./configure \
   1.490 +        --cache-file=./config.cache \
   1.491          --prefix=%{l_prefix} \
   1.492          --mandir=%{l_prefix}/man \
   1.493 -        --with-ncurses=%{l_prefix} \
   1.494 -%if "%{with_libpri}" == "yes"
   1.495 -        --with-pri=%{l_prefix} \
   1.496 +        --sysconfdir=%{l_prefix}/etc \
   1.497 +        --localstatedir=%{l_prefix}/var/asterisk \
   1.498 +        --with-curl=%{l_prefix} \
   1.499 +        --with-ncurses \
   1.500 +        --with-gsm="internal" \
   1.501 +        --with-popt=%{l_prefix} \
   1.502 +%if "%{with_sqlite}" == "yes"
   1.503 +        --with-sqlite3=%{l_prefix} \
   1.504  %else
   1.505 -        --with-pri=no \
   1.506 +        --without-sqlite3 \
   1.507  %endif
   1.508 +        --with-speex=%{l_prefix} \
   1.509 +        --with-speexdsp=%{l_prefix} \
   1.510          --with-ssl=%{l_prefix} \
   1.511 +        --with-gmime=%{l_prefix} \
   1.512 +        --with-z=%{l_prefix} \
   1.513 +%if "%{with_ogg}" == "yes"
   1.514 +        --with-ogg=%{l_prefix} \
   1.515 +        --with-vorbis=%{l_prefix} \
   1.516 +%else
   1.517 +        --without-ogg \
   1.518 +        --without-vorbis \
   1.519 +%endif
   1.520 +%if "%{with_jabber}" == "yes"
   1.521 +        --with-iksemel=%{l_prefix} \
   1.522 +%else
   1.523 +        --without-iksemel \
   1.524 +%endif
   1.525 +%if "%{with_lua}" == "yes"
   1.526 +        --with-lua=%{l_prefix} \
   1.527 +%else
   1.528 +        --without-lua \
   1.529 +%endif
   1.530 +%if "%{with_dahdi}" == "yes"
   1.531 +        --with-dahdi=$dahdi_prefix \
   1.532 +        --with-tonezone=$dahdi_prefix \
   1.533 +%else
   1.534 +        --without-dahdi \
   1.535 +        --without-tonezone \
   1.536 +%endif
   1.537 +%if "%{with_avcodec}" == "yes"
   1.538 +        --with-avcodec=%{l_prefix} \
   1.539 +%else
   1.540 +        --without-avcodec \
   1.541 +%endif
   1.542 +%if "%{with_ldap}" == "yes"
   1.543 +        --with-ldap=%{l_prefix} \
   1.544 +%else
   1.545 +        --without-ldap \
   1.546 +%endif
   1.547  %if "%{with_radius}" == "yes"
   1.548          --with-radius=%{l_prefix} \
   1.549  %else
   1.550 -        --with-radius=no \
   1.551 -%endif
   1.552 -%if "%{with_sqlite}" == "yes"
   1.553 -        --with-sqlite=%{l_prefix} \
   1.554 -%else
   1.555 -        --with-sqlite=no \
   1.556 -%endif
   1.557 -%if "%{with_postgresql}" == "yes"
   1.558 -        --with-postgres=%{l_prefix} \
   1.559 -%else
   1.560 -        --with-postgres=no \
   1.561 -%endif
   1.562 -%if "%{with_curl}" == "yes"
   1.563 -        --with-curl=%{l_prefix} \
   1.564 -%else
   1.565 -        --with-curl=no \
   1.566 +        --without-radius \
   1.567  %endif
   1.568  %if "%{with_imap}" == "yes"
   1.569          --with-imap=%{l_prefix} \
   1.570 -        --disable-largefile \
   1.571  %else
   1.572 -        --with-imap=no \
   1.573 +        --without-imap \
   1.574  %endif
   1.575 -%if "%{with_astman}" == "yes"
   1.576 -        --with-newt=%{l_prefix} \
   1.577 +%if "%{with_odbc}" == "yes"
   1.578 +        --with-odbc=%{l_prefix} \
   1.579  %else
   1.580 -        --with-newt=no \
   1.581 +        --without-odbc \
   1.582  %endif
   1.583 -        --with-speex=%{l_prefix} \
   1.584 -        --with-speexdsp=%{l_prefix} \
   1.585 -        --with-ogg=%{l_prefix} \
   1.586 -        --with-vorbis=%{l_prefix} \
   1.587 -        --with-z=%{l_prefix}
   1.588 +        --without-netsnmp \
   1.589 +        --without-isdnnet \
   1.590 +        --without-misdn \
   1.591 +        --without-kde \
   1.592 +        --without-nbs \
   1.593 +        --without-newt \
   1.594 +        --without-asound \
   1.595 +        --without-oss \
   1.596 +        --without-qt \
   1.597 +        --without-sqlite \
   1.598 +        --without-postgres \
   1.599 +        --without-tds \
   1.600 +        --without-osptk \
   1.601 +        --without-pri \
   1.602 +        --without-suppserv \
   1.603 +        --without-vpb \
   1.604 +        --without-sdl \
   1.605 +        --without-x11 \
   1.606 +        --without-gtk \
   1.607 +        --without-gtk2
   1.608 +    %{l_make} %{l_mflags} \
   1.609 +        CC="%{l_cc} $cflags -I. -I./include -I../include -I../../include $cppflags"
   1.610  
   1.611 -    #   build package
   1.612 -    %{l_make} %{l_mflags -O} menuselect/menuselect menuselect-tree
   1.613 -    menuselect/menuselect --check-deps menuselect.makeopts
   1.614 -    %{l_shtool} subst \
   1.615 -        -e 's;\(MENUSELECT_MOH=\).*;\1;' \
   1.616 -        -e 's;\(MENUSELECT_CORE_SOUNDS=\).*;\1;' \
   1.617 -        -e 's;\(MENUSELECT_EXTRA_SOUNDS=\).*;\1;' \
   1.618 -        menuselect.makeopts
   1.619 -%if "%{with_imap}" == "yes"
   1.620 -    %{l_shtool} subst \
   1.621 -        -e 's;\(MENUSELECT_OPTS_app_voicemail=\)$;\1IMAP_STORAGE;' \
   1.622 -        menuselect.makeopts
   1.623 +    #   build addon modules
   1.624 +    ( cd asterisk-addons-*
   1.625 +      ASTERISK_DIR="`pwd`/.." \
   1.626 +      CC="%{l_cc}" \
   1.627 +      CFLAGS="%{l_cflags -O}" \
   1.628 +      CPPFLAGS="%{l_cppflags ncurses tiff .}" \
   1.629 +      LDFLAGS="%{l_ldflags}" \
   1.630 +%if "%{with_fax}" == "yes"
   1.631 +      LIBS="-ltiff -ljpeg -lz -lm" \
   1.632 +%else
   1.633 +      LIBS="-lm" \
   1.634  %endif
   1.635 -    %{l_make} %{l_mflags -O} EXTLIBS="$libs" NOISY_BUILD=yes
   1.636 +      ./configure \
   1.637 +          --prefix=%{l_prefix} \
   1.638 +          --mandir=%{l_prefix}/man \
   1.639 +          --sysconfdir=%{l_prefix}/etc \
   1.640 +          --localstatedir=%{l_prefix}/var/asterisk \
   1.641 +          --with-ncurses \
   1.642 +          --with-asterisk \
   1.643 +          --without-mysqlclient \
   1.644 +%if "%{with_fax}" == "yes"
   1.645 +          --with-spandsp=%{l_prefix}
   1.646 +%else
   1.647 +          --without-spandsp
   1.648 +%endif
   1.649 +      %{l_make} %{l_mflags} \
   1.650 +          CC="%{l_cc} %{l_cflags -O} -I. %{l_cppflags ncurses tiff .}"
   1.651 +    ) || exit $?
   1.652  %if "%{with_capi}" == "yes"
   1.653 -    ( cd chan_capi-%{V_chan_capi}
   1.654 -      %{l_make} %{l_mflags -O}
   1.655 +    ( cd chan_capi-*
   1.656 +      ln -s ../include/asterisk .
   1.657 +      ln -s ../include/asterisk.h .
   1.658 +      %{l_make} %{l_mflags} \
   1.659 +          INSTALL_PREFIX=%{l_prefix} \
   1.660 +          ASTERISK_HEADER_DIR="`pwd`"
   1.661      ) || exit $?
   1.662  %endif
   1.663  
   1.664  %install
   1.665 -    rm -rf $RPM_BUILD_ROOT
   1.666 +    #   install program
   1.667 +    %{l_make} %{l_mflags} install \
   1.668 +        DESTDIR=$RPM_BUILD_ROOT \
   1.669 +        INSTALL_PREFIX=%{l_prefix}
   1.670  
   1.671 -    #   install package
   1.672 -    %{l_make} %{l_mflags} install DESTDIR=$RPM_BUILD_ROOT
   1.673 +    #   install addon modules
   1.674 +    ( cd asterisk-addons-*
   1.675 +      %{l_make} %{l_mflags} install \
   1.676 +          DESTDIR=$RPM_BUILD_ROOT \
   1.677 +          INSTALL_PREFIX=%{l_prefix}
   1.678 +    ) || exit $?
   1.679  %if "%{with_capi}" == "yes"
   1.680 -    ( cd chan_capi-%{V_chan_capi}
   1.681 -      %{l_make} %{l_mflags} install samples DESTDIR=$RPM_BUILD_ROOT
   1.682 +    ( cd chan_capi-*
   1.683 +      %{l_make} %{l_mflags} install \
   1.684 +          INSTALL_PREFIX=$RPM_BUILD_ROOT%{l_prefix} \
   1.685 +          INSTALL="%{l_shtool} install -c" \
   1.686 +          MODULES_DIR='$(INSTALL_PREFIX)/lib/asterisk/modules'
   1.687      ) || exit $?
   1.688  %endif
   1.689  
   1.690 -    #   install all sound prompt files
   1.691 -    for codec in alaw ulaw g722 g729 gsm; do
   1.692 -        for lang in es fr; do
   1.693 -            ( cd $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds/${lang}
   1.694 -              %{l_tar} zxf %{_sourcedir}/asterisk-core-sounds-${lang}-${codec}-%{V_langsounds}.tar.gz
   1.695 -            ) || exit $?
   1.696 -        done
   1.697 -        ( cd $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds
   1.698 -          %{l_tar} zxf %{_sourcedir}/asterisk-extra-sounds-en-${codec}-%{V_extrasounds}.tar.gz
   1.699 -          %{l_tar} zxf %{_sourcedir}/asterisk-core-sounds-en-${codec}-%{V_langsounds}.tar.gz
   1.700 -        ) || exit $?
   1.701 +    #   install addon sounds
   1.702 +    %{l_shtool} mkdir -f -p -m 755 \
   1.703 +        $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds/de
   1.704 +    ( cd $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds/de
   1.705 +      %{l_gzip} -d -c %{SOURCE4} | %{l_tar} xf -
   1.706 +    ) || exit $?
   1.707 +
   1.708 +    #   strip down installation
   1.709 +    rm -f $RPM_BUILD_ROOT%{l_prefix}/sbin/autosupport >/dev/null 2>&1 || true
   1.710 +    rm -f $RPM_BUILD_ROOT%{l_prefix}/sbin/safe_asterisk >/dev/null 2>&1 || true
   1.711 +    rm -f $RPM_BUILD_ROOT%{l_prefix}/man/man8/autosupport.8 >/dev/null 2>&1 || true
   1.712 +    rm -f $RPM_BUILD_ROOT%{l_prefix}/man/man8/safe_asterisk.8 >/dev/null 2>&1 || true
   1.713 +    rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/firmware >/dev/null 2>&1 || true
   1.714 +    rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/images >/dev/null 2>&1 || true
   1.715 +    rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds/.asterisk* >/dev/null 2>&1 || true
   1.716 +    rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds/en/CREDIT* >/dev/null 2>&1 || true
   1.717 +    rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds/en/CHANGES* >/dev/null 2>&1 || true
   1.718 +    rmdir $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds/es >/dev/null 2>&1 || true
   1.719 +    rmdir $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds/fr >/dev/null 2>&1 || true
   1.720 +
   1.721 +    #   create additional directories
   1.722 +    %{l_shtool} mkdir -f -p -m 755 \
   1.723 +        $RPM_BUILD_ROOT%{l_prefix}/var/asterisk/db
   1.724 +
   1.725 +    #   post-adjust installation
   1.726 +    strip $RPM_BUILD_ROOT%{l_prefix}/sbin/* >/dev/null 2>&1 || true
   1.727 +    mv  $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/agi-bin \
   1.728 +        $RPM_BUILD_ROOT%{l_prefix}/lib/asterisk/agi-bin
   1.729 +    for bin in $RPM_BUILD_ROOT%{l_prefix}/lib/asterisk/agi-bin/*.*; do
   1.730 +        mv $bin `echo $bin | sed -e 's;\.[^.]*$;;'`
   1.731      done
   1.732  
   1.733 -    #   install special case sound files
   1.734 -    ( cd $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds
   1.735 -      %{l_tar} jxf %{SOURCE de-digits-%{V_customsounds}.tar.bz2}
   1.736 -      %{l_tar} zxf %{SOURCE asterisk-core-sounds-de-gsm-current.tar.gz}
   1.737 -      cd de
   1.738 -      %{l_tar} zxf %{_sourcedir}/asterisk-%{V_amoomasounds}-de-prompts.tar.gz
   1.739 -      mv -f de/* . && rm -rf de
   1.740 -      mv -f dictate/de/* letters/ && rm -rf dictate/de
   1.741 -      mv -f digits/de/* letters/ && rm -rf digits/de
   1.742 -      mv -f letters/de/* letters/ && rm -rf letters/de
   1.743 -      mv -f phonetic/de/* letters/ && rm -rf phonetic/de
   1.744 -    ) || exit $?
   1.745 +    #   install default configuration
   1.746 +    for name in `grep "^<file" %{SOURCE asterisk.txt} | sed -e 's;^.*name=";;' -e 's;".*$;;'`; do
   1.747 +%if "%{with_dahdi}" == "no"
   1.748 +        [ ".$name" = ".chan_dahdi.conf" ] && continue
   1.749 +%endif
   1.750 +%if "%{with_capi}" == "no"
   1.751 +        [ ".$name" = ".capi.conf" ] && continue
   1.752 +%endif
   1.753 +%if "%{with_sqlite}" == "no"
   1.754 +        [ ".$name" = ".cdr_sqlite3_custom.conf" ] && continue
   1.755 +%endif
   1.756 +%if "%{with_odbc}" == "no"
   1.757 +        [ ".$name" = ".res_odbc.conf" ] && continue
   1.758 +        [ ".$name" = ".func_odbc.conf" ] && continue
   1.759 +%endif
   1.760 +        (echo ""; cat %{SOURCE asterisk.txt}; echo "") |\
   1.761 +            sed -e "1,/^<file name=\"$name\">/d" -e "/<\/file>/,\$d" >$name
   1.762 +        %{l_shtool} install -c -m 644 %{l_value -s -a} \
   1.763 +            $name $RPM_BUILD_ROOT%{l_prefix}/etc/asterisk/
   1.764 +    done
   1.765  
   1.766 -    #   install additional music on hold files
   1.767 -    ( cd $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/moh
   1.768 -      for codec in alaw ulaw g722 g729 gsm; do
   1.769 -          %{l_tar} zxf %{_sourcedir}/asterisk-moh-freeplay-${codec}.tar.gz
   1.770 -      done
   1.771 -    ) || exit $?
   1.772 -
   1.773 -#    #   install nonstandard voicemail prompts
   1.774 -#    %{l_shtool} mkdir -f -p -m 755 \
   1.775 -#        $RPM_BUILD_ROOT%{l_prefix}/var/asterisk/spool/voicemail/default/%{exten}/unavail
   1.776 -#    %{l_shtool} install -c -m 660 \
   1.777 -#        %{_sourcedir}/ansage-%{V_ansage}.wav} \
   1.778 -#        $RPM_BUILD_ROOT%{l_prefix}/var/asterisk/spool/voicemail/default/%{exten}/unavail.wav
   1.779 -
   1.780 -    #   install default configuration
   1.781 -    %{l_shtool} install -c -m 660 %{l_value -s -a} \
   1.782 -        %{SOURCE asterisk.conf} \
   1.783 -        %{SOURCE amd.conf} \
   1.784 -        %{SOURCE cdr.conf} \
   1.785 -        %{SOURCE codecs.conf} \
   1.786 -        %{SOURCE extensions.conf} \
   1.787 -        %{SOURCE features.conf} \
   1.788 -        %{SOURCE festival.conf} \
   1.789 -        %{SOURCE followme.conf} \
   1.790 -        %{SOURCE indications.conf} \
   1.791 -        %{SOURCE logger.conf} \
   1.792 -        %{SOURCE manager.conf} \
   1.793 -        %{SOURCE meetme.conf} \
   1.794 -        %{SOURCE modules.conf} \
   1.795 -        %{SOURCE musiconhold.conf} \
   1.796 -        %{SOURCE rtp.conf} \
   1.797 -        %{SOURCE sip.conf} \
   1.798 -        %{SOURCE sla.conf} \
   1.799 -        %{SOURCE voicemail.conf} \
   1.800 -        %{SOURCE zapata.conf} \
   1.801 -        $RPM_BUILD_ROOT%{l_prefix}/etc/asterisk/
   1.802 -
   1.803 -    #   install runcommand script
   1.804 +    #   install run-command script
   1.805      %{l_shtool} mkdir -f -p -m 755 \
   1.806          $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
   1.807      %{l_shtool} install -c -m 755 %{l_value -s -a} \
   1.808          %{SOURCE rc.asterisk} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
   1.809  
   1.810 -    #   install additional AGI scripts
   1.811 -    %{l_shtool} install -c -m 755 %{l_value -s -a} \
   1.812 -        %{SOURCE wakeup.agi} $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/agi-bin/
   1.813 -
   1.814 -    #   correct installation hierarchy
   1.815 -    %{l_shtool} mkdir -f -p -m 755 \
   1.816 -        $RPM_BUILD_ROOT%{l_prefix}/var/asterisk/lib \
   1.817 -        $RPM_BUILD_ROOT%{l_prefix}/var/asterisk/spool/outgoing
   1.818 -
   1.819 -    #   remove unused components
   1.820 -    rm -rf \
   1.821 -        $RPM_BUILD_ROOT%{l_prefix}/bin \
   1.822 -        $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/images \
   1.823 -        $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds/de/.DS_Store \
   1.824 -        $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds/de/autogen.sh \
   1.825 -        >/dev/null 2>&1 || true
   1.826 -
   1.827 -    #   adjust inconsistent names
   1.828 -    for bin in $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/agi-bin/*.*; do
   1.829 -        mv $bin `echo $bin | sed -e 's;\.[^.]*$;;'`
   1.830 -    done
   1.831 -
   1.832 -    #   strip down installation
   1.833 -    strip $RPM_BUILD_ROOT%{l_prefix}/bin/* \
   1.834 -          $RPM_BUILD_ROOT%{l_prefix}/sbin/* \
   1.835 -          $RPM_BUILD_ROOT%{l_prefix}/lib/asterisk/modules/* \
   1.836 -          $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/agi-bin/* \
   1.837 -          >/dev/null 2>&1 || true
   1.838 -
   1.839      #   determine installation files
   1.840 -    %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT %{l_files_std} \
   1.841 -        '%config %attr(660,%{l_musr},%{l_rgrp}) %{l_prefix}/etc/asterisk/*' \
   1.842 -        '%config %attr(644,%{l_musr},%{l_mgrp}) %{l_prefix}/share/asterisk/sounds/de/*' \
   1.843 -        '%config %attr(755,%{l_musr},%{l_mgrp}) %{l_prefix}/share/asterisk/sounds/de/dictate' \
   1.844 -        '%config %attr(755,%{l_musr},%{l_mgrp}) %{l_prefix}/share/asterisk/sounds/de/digits' \
   1.845 -        '%config %attr(755,%{l_musr},%{l_mgrp}) %{l_prefix}/share/asterisk/sounds/de/followme' \
   1.846 -        '%config %attr(755,%{l_musr},%{l_mgrp}) %{l_prefix}/share/asterisk/sounds/de/letters' \
   1.847 -        '%config %attr(755,%{l_musr},%{l_mgrp}) %{l_prefix}/share/asterisk/sounds/de/phonetic' \
   1.848 -        '%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/asterisk/*' \
   1.849 -        '%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/asterisk/*/*'
   1.850 +    %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
   1.851 +        %{l_files_std} \
   1.852 +        '%config %attr(640,%{l_mgrp},%{l_rgrp}) %{l_prefix}/etc/asterisk/*' \
   1.853 +        '%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/asterisk'
   1.854  
   1.855  %files -f files
   1.856  
   1.857  %clean
   1.858 -    rm -rf $RPM_BUILD_ROOT
   1.859  
   1.860  %post
   1.861 +%if "%{with_dahdi}" == "yes"
   1.862 +    if [ $1 -eq 1 ]; then
   1.863 +        case "%{l_platform -t}" in
   1.864 +            *-freebsd* )
   1.865 +                ( echo "To allow Asterisk to use the DAHDI /dev/dahdi/pseudo device(s)"
   1.866 +                  echo "you have add the following entry to /etc/devfs.rules:"
   1.867 +                  echo ""
   1.868 +                  echo "[openpkg_asterisk=10]"
   1.869 +                  echo "add path 'dahdi/pseudo*' mode 0664 user %{l_rusr} group %{l_rgrp}"
   1.870 +                  echo ""
   1.871 +                ) | %{l_rpmtool} msg -b -t notice
   1.872 +                ;;
   1.873 +        esac
   1.874 +    fi
   1.875 +%endif
   1.876 +%if "%{with_odbc}" == "yes"
   1.877 +    #   after install, optionally link into ODBC and create database
   1.878 +    if $RPM_INSTALL_PREFIX/bin/odbcinst -q -s -n "asterisk-sqlite" >/dev/null 2>&1; then
   1.879 +        :
   1.880 +    else
   1.881 +        ( echo "[asterisk-sqlite]"
   1.882 +          echo "Description = Asterisk SQLite Database"
   1.883 +          echo "Driver      = SQLite3"
   1.884 +          echo "Database    = $RPM_INSTALL_PREFIX/var/asterisk/db/asterisk.sqlite"
   1.885 +          echo "Timeout     = 2000"
   1.886 +        ) | $RPM_INSTALL_PREFIX/bin/odbcinst -i -s -l -n "asterisk-sqlite" -r >/dev/null 2>&1 || true
   1.887 +    fi
   1.888 +    if [ ! -f $RPM_INSTALL_PREFIX/var/asterisk/run/asterisk.db ]; then
   1.889 +        ( umask 007
   1.890 +          echo "CREATE TABLE map (key TEXT, val TEXT);" | $RPM_INSTALL_PREFIX/bin/isql "asterisk-sqlite" -b
   1.891 +          chown %{l_rusr}:%{l_rgrp} $RPM_INSTALL_PREFIX/var/asterisk/db/asterisk.sqlite >/dev/null 2>&1 || true
   1.892 +        ) || exit $?
   1.893 +    fi
   1.894 +%endif
   1.895      #   after upgrade, restart service
   1.896      [ $1 -eq 2 ] || exit 0
   1.897      eval `%{l_rc} asterisk status 2>/dev/null`
   1.898 @@ -531,14 +505,14 @@
   1.899      #   before erase, stop service and remove log files
   1.900      [ $1 -eq 0 ] || exit 0
   1.901      %{l_rc} asterisk stop 2>/dev/null
   1.902 -    rm  -f $RPM_INSTALL_PREFIX/var/asterisk/lib/*       >/dev/null 2>&1 || true
   1.903 -    rm  -f $RPM_INSTALL_PREFIX/var/asterisk/log/*       >/dev/null 2>&1 || true
   1.904 -    rm  -f $RPM_INSTALL_PREFIX/var/asterisk/log/cdr-*/* >/dev/null 2>&1 || true
   1.905 -    rm  -f $RPM_INSTALL_PREFIX/var/asterisk/run/*       >/dev/null 2>&1 || true
   1.906 -    for deldir in meetme outgoing system tmp; do
   1.907 -        rm -rf \
   1.908 -            $RPM_INSTALL_PREFIX/var/asterisk/spool/$deldir \
   1.909 -            >/dev/null 2>&1 || true
   1.910 -    done
   1.911 +    rm -f $RPM_INSTALL_PREFIX/var/asterisk/log/*       >/dev/null 2>&1 || true
   1.912 +    rm -f $RPM_INSTALL_PREFIX/var/asterisk/log/cdr-*/* >/dev/null 2>&1 || true
   1.913 +    rm -f $RPM_INSTALL_PREFIX/var/asterisk/run/*       >/dev/null 2>&1 || true
   1.914 +    rm -f $RPM_INSTALL_PREFIX/var/asterisk/spool/*/*   >/dev/null 2>&1 || true
   1.915 +    rm -f $RPM_INSTALL_PREFIX/var/asterisk/db/*        >/dev/null 2>&1 || true
   1.916 +%if "%{with_odbc}" == "yes"
   1.917 +    #   before erase, optionally unlink from ODBC and destroy database
   1.918 +    $RPM_INSTALL_PREFIX/bin/odbcinst -u -s -l -n "asterisk-sqlite" >/dev/null 2>&1 || true
   1.919 +%endif
   1.920      exit 0
   1.921  

mercurial