asterisk/asterisk.spec

Tue, 28 Aug 2012 18:32:05 +0200

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Tue, 28 Aug 2012 18:32:05 +0200
changeset 552
e568963742d6
parent 415
dd7b2195ce6f
child 669
dc764d5d565d
permissions
-rw-r--r--

Correct detection of GCC sync_fetch_and_add atomic builtins, update the
version, modernize packaging, add new prompts, and correct sound paths.
The vendor configure script checks for sync_fetch_and_add and reports
success because strangely GCC only fails when returning the return value
of the builtin function in the consumer function.

     1 ##
     2 ##  asterisk.spec -- OpenPKG RPM Package Specification
     3 ##  Copyright (c) 2000-2009 OpenPKG Foundation e.V. <http://openpkg.net/>
     4 ##
     5 ##  Permission to use, copy, modify, and distribute this software for
     6 ##  any purpose with or without fee is hereby granted, provided that
     7 ##  the above copyright notice and this permission notice appear in all
     8 ##  copies.
     9 ##
    10 ##  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
    11 ##  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
    12 ##  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
    13 ##  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
    14 ##  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
    15 ##  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
    16 ##  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
    17 ##  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
    18 ##  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
    19 ##  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
    20 ##  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
    21 ##  SUCH DAMAGE.
    22 ##
    24 #   package version
    25 %define       V_opkg                     1.8.15.0
    26 %define       V_asterisk                 1.8.15.0
    27 %define       V_asterisk_fax_subdir      1.8.4
    28 %define       V_asterisk_fax_digium      1.8.4_1.3.1
    29 %define       V_asterisk_sounds_core     1.4.22
    30 %define       V_asterisk_sounds_extra    1.4.11
    31 %define       V_asterisk_sounds_amoogab  1.4
    32 %define       V_asterisk_sounds_amootts  current
    33 %define       V_asterisk_sounds_custom   1.0
    34 %define       V_asterisk_sounds_mohop    2.03
    35 %define       V_asterisk_sounds_newpro   july_2012
    36 %define       V_asterisk_addons_mp3dec   1
    37 %define       V_fswitch_sounds_en        1.0.20
    38 %define       V_fswitch_sounds_fr        1.0.16
    39 %define       V_fswitch_sounds_ru        1.0.13
    40 %define       V_fswitch_music            1.0.8
    41 %define       V_asterisk_codecs_ilbc     20110104
    42 %define       V_chan_capi                1.1.5.20120615
    44 #   package information
    45 Name:         asterisk
    46 Summary:      Private Branch Exchange (PBX)
    47 URL:          http://www.asterisk.org/
    48 Vendor:       Mark Spencer et al.
    49 Packager:     OpenPKG Foundation e.V.
    50 Distribution: OpenPKG Community
    51 Class:        BASE
    52 Group:        VoIP
    53 License:      GPL
    54 Version:      %{V_opkg}
    55 Release:      20120800
    57 #   package options
    58 %option       with_dahdi   no
    59 %option       with_capi    no
    60 %option       with_ogg     no
    61 %option       with_mp3     no
    62 %option       with_fax     no
    63 %option       with_avcodec no
    64 %option       with_ldap    no
    65 %option       with_radius  no
    66 %option       with_sqlite  no
    67 %option       with_srtp    no
    68 %option       with_pgsql   no
    69 %option       with_lua     no
    70 %option       with_gtalk   no
    71 %option       with_jabber  no
    72 %option       with_imap    no
    73 %option       with_odbc    no
    74 %option       with_libpri  no
    75 %option       with_esounds no
    76 %option       with_xfersips yes
    77 %option       with_proxymwi yes
    78 %option       with_smdipoll 10
    80 #   list of sources
    81 Source0:      http://downloads.asterisk.org/pub/telephony/asterisk/releases/asterisk-%{V_asterisk}.tar.gz
    82 Source1:      ftp://ftp.chan-capi.org/chan-capi/chan_capi-%{V_chan_capi}.tar.gz
    83 Source2:      ftp://ftp.europalab.com/pub/sfw/machsnds/asterisk-moh-freeplay-sln16.tar.gz
    84 Source3:      http://downloads.asterisk.org/pub/telephony/sounds/releases/asterisk-moh-opsound-sln16-%{V_asterisk_sounds_mohop}.tar.gz
    85 Source4:      http://downloads.asterisk.org/pub/telephony/sounds/releases/asterisk-core-sounds-en-sln16-%{V_asterisk_sounds_core}.tar.gz
    86 Source5:      http://downloads.asterisk.org/pub/telephony/sounds/releases/asterisk-core-sounds-es-sln16-%{V_asterisk_sounds_core}.tar.gz
    87 Source6:      http://downloads.asterisk.org/pub/telephony/sounds/releases/asterisk-core-sounds-en_AU-sln16-%{V_asterisk_sounds_core}.tar.gz
    88 Source7:      http://downloads.asterisk.org/pub/telephony/sounds/releases/asterisk-core-sounds-fr-sln16-%{V_asterisk_sounds_core}.tar.gz
    89 Source8:      http://downloads.asterisk.org/pub/telephony/sounds/releases/asterisk-core-sounds-ru-sln16-%{V_asterisk_sounds_core}.tar.gz
    90 Source9:      http://downloads.asterisk.org/pub/telephony/sounds/releases/asterisk-extra-sounds-en-sln16-%{V_asterisk_sounds_extra}.tar.gz
    91 Source10:     http://downloads.asterisk.org/pub/telephony/sounds/releases/asterisk-extra-sounds-fr-sln16-%{V_asterisk_sounds_extra}.tar.gz
    92 Source11:     http://www.asterisk.org/files/new_prompts_%{V_asterisk_sounds_newpro}.zip
    93 Source12:     http://www.amooma.de/asterisk/sprachbausteine/asterisk-%{V_asterisk_sounds_amoogab}-de-prompts.tar.gz
    94 Source13:     http://www.amooma.de/asterisk/sprachbausteine/asterisk-core-sounds-de-gsm-current.tar.gz
    95 Source14:     ftp://ftp.europalab.com/pub/sfw/machsnds/de-digits/de-digits-%{V_asterisk_sounds_custom}.tar.bz2
    96 Source15:     ftp://ftp.europalab.com/pub/sfw/machsnds/de-sounds/astmultisnds-de-sln16-%{V_asterisk_sounds_custom}.tar.bz2
    97 Source16:     ftp://ftp.europalab.com/pub/sfw/machsnds/msvbsnds-sln16-%{V_asterisk_sounds_custom}.tar.bz2
    98 Source17:     http://files.freeswitch.org/freeswitch-sounds-en-us-callie-48000-%{V_fswitch_sounds_en}.tar.gz
    99 Source18:     http://files.freeswitch.org/freeswitch-sounds-es-mx-maria-44100.tar.gz
   100 Source19:     http://files.freeswitch.org/freeswitch-sounds-fr-ca-june-48000-%{V_fswitch_sounds_fr}.tar.gz
   101 Source20:     http://files.freeswitch.org/freeswitch-sounds-ru-RU-elena-48000-%{V_fswitch_sounds_ru}.tar.gz
   102 Source21:     http://files.freeswitch.org/freeswitch-sounds-music-48000-%{V_fswitch_music}.tar.gz
   103 Source22:     http://svn.digium.com/svn/thirdparty/mp3/trunk/addons/mp3-%{V_asterisk_addons_mp3dec}.tar.gz
   104 Source23:     http://downloads.digium.com/pub/telephony/fax/res_fax_digium/asterisk-%{V_asterisk_fax_subdir}/x86-64/res_fax_digium-%{V_asterisk_fax_digium}-generic_64.tar.gz
   105 Source24:     http://downloads.digium.com/pub/telephony/fax/res_fax_digium/asterisk-%{V_asterisk_fax_subdir}/x86-32/res_fax_digium-%{V_asterisk_fax_digium}-generic_32.tar.gz
   106 Source25:     ilbc-%{V_asterisk_codecs_ilbc}.tar.gz
   107 Source26:     asterisk.txt
   108 Source27:     rc.asterisk
   109 Source28:     wakeup.agi
   110 Patch0:       asterisk.patch
   111 Patch1:       asterisk.patch.xfersips
   112 Patch2:       asterisk.patch.proxymwi
   114 #   build information
   115 BuildPreReq:  OpenPKG, openpkg >= 20100101, bison, gcc, make, grep, pkgconfig
   116 PreReq:       OpenPKG, openpkg >= 20100101, MTA
   117 BuildPreReq:  zlib, curl, openssl, ncurses, speex, sox, popt, gmime, libxml
   118 PreReq:       zlib, curl, openssl, ncurses, speex, sox, popt, gmime, libxml
   119 %if "%{with_ogg}" == "yes"
   120 BuildPreReq:  vorbis-libs
   121 PreReq:       vorbis-libs
   122 %endif
   123 %if "%{with_mp3}" == "yes"
   124 PreReq:       mpg123
   125 %endif
   126 %if "%{with_imap}" == "yes"
   127 BuildPreReq:  imap
   128 PreReq:       imap
   129 %endif
   130 %if "%{with_sqlite}" == "yes"
   131 BuildPreReq:  sqlite
   132 PreReq:       sqlite
   133 %endif
   134 %if "%{with_srtp}" == "yes"
   135 BuildPreReq:  srtp
   136 PreReq:       srtp
   137 %endif
   138 %if "%{with_pgsql}" == "yes"
   139 BuildPreReq:  postgresql
   140 PreReq:       postgresql
   141 %endif
   142 %if "%{with_lua}" == "yes"
   143 BuildPreReq:  lua
   144 PreReq:       lua
   145 %endif
   146 %if "%{with_avcodec}" == "yes"
   147 BuildPreReq:  ffmpeg
   148 PreReq:       ffmpeg
   149 %endif
   150 %if "%{with_ldap}" == "yes"
   151 BuildPreReq:  openldap
   152 PreReq:       openldap
   153 %endif
   154 %if "%{with_radius}" == "yes"
   155 BuildPreReq:  radiusclient
   156 PreReq:       radiusclient
   157 %endif
   158 %if "%{with_gtalk}" == "yes"
   159 %define       with_jabber yes
   160 %endif
   161 %if "%{with_jabber}" == "yes"
   162 BuildPreReq:  iksemel
   163 PreReq:       iksemel
   164 %endif
   165 %if "%{with_odbc}" == "yes"
   166 BuildPreReq:  unixodbc, sqlite, sqlite::with_odbc = yes
   167 PreReq:       unixodbc, sqlite, sqlite::with_odbc = yes
   168 %endif
   169 %if "%{with_libpri}" == "yes"
   170 BuildPreReq:  libpri > 1.4.11.5
   171 PreReq:       libpri > 1.4.11.5
   172 %endif
   173 %if "%{with_esounds}" == "yes"
   174 BuildPreReq:  sox, infozip
   175 %endif
   177 %description
   178     Asterisk is a complete Private Branch Exchange (PBX) in software.
   179     It provides more than the features normally expected from a PBX,
   180     and can transceive Voice over IP (VoIP) in many protocols. Asterisk
   181     provides voicemail services with directory, call conferencing,
   182     interactive voice response and call queuing as well. It has support
   183     for three way calling, caller ID, ADSI, and SIP, and requires no
   184     additional hardware for VoIP applications.
   186     This copy of Asterisk is optionally patched to allow the asterisk
   187     server to respond to SIP/TLS transfer requests using the Transfer()
   188     application. Should this option be chosen, the asterisk server
   189     successfully dispatches all transfer destinations using 'SIPS'
   190     technology by means of the standard SIP/2.0 302 Moved Temporarily
   191     message, with a URI resembling <sips:extension@hostname.tld:port>.
   193     This copy of Asterisk is optionally patched as well to enclose the
   194     correct user name in NOTIFY messages when MWI logic detects changes
   195     in the state of Messages-Waiting. Asterisk will send NOTIFY messages
   196     with the URI 'user@hostname' instead of simply 'hostname'. This can
   197     be used by a external SIP proxy to route the MWI to the correct phone.
   199 %track
   200     prog asterisk = {
   201         version   = %{V_asterisk}
   202         url       = http://downloads.asterisk.org/pub/telephony/asterisk/releases/
   203         regex     = asterisk-(\d+\.\d+(\.\d+)+)\.tar\.gz
   204     }
   205     prog asterisk:fax_digium_32 = {
   206         version   = %{V_asterisk_fax_digium}
   207         url       = http://downloads.digium.com/pub/telephony/fax/res_fax_digium/asterisk-1.8.0/x86-32/
   208         regex     = res_fax_digium-(__VER__)-generic_32.tar.gz\.tar\.gz
   209     }
   210     prog asterisk:fax_digium_64 = {
   211         version   = %{V_asterisk_fax_digium}
   212         url       = http://downloads.digium.com/pub/telephony/fax/res_fax_digium/asterisk-1.8.0/x86-64/
   213         regex     = res_fax_digium-(__VER__)-generic_64.tar.gz\.tar\.gz
   214     }
   215     prog asterisk:sounds_core = {
   216         version   = %{V_asterisk_sounds_core}
   217         url       = http://downloads.asterisk.org/pub/telephony/sounds/releases/
   218         regex     = asterisk-core-sounds-en-sln16-(\d+\.\d+(\.\d+)+)\.tar\.gz
   219     }
   220     prog asterisk:sounds_newpro = {
   221         version   = %{V_asterisk_sounds_newpro}
   222         url       = http://www.asterisk.org/files/
   223         regex     = new_prompts_(__VER__)\.zip
   224     }
   225     prog asterisk:sounds_extra = {
   226         version   = %{V_asterisk_sounds_extra}
   227         url       = http://downloads.asterisk.org/pub/telephony/sounds/releases/
   228         regex     = asterisk-extra-sounds-en-sln16-(\d+\.\d+(\.\d+)+)\.tar\.gz
   229     }
   230     prog asterisk:sounds_amootts = {
   231         version   = %{V_asterisk_sounds_amootts}
   232         url       = http://www.amooma.de/asterisk/sprachbausteine/
   233         regex     = asterisk-core-sounds-de-gsm-(__VER__)\.tar\.gz
   234     }
   235     prog asterisk:sounds_amoogab = {
   236         version   = %{V_asterisk_sounds_amoogab}
   237         url       = http://www.amooma.de/asterisk/sprachbausteine/
   238         regex     = asterisk-(__VER__)-de-prompts\.tar\.gz
   239     }
   240     prog asterisk:sounds_digits = {
   241         version   = %{V_asterisk_sounds_custom}
   242         url       = ftp://ftp.europalab.com/pub/sfw/machsnds/de-digits/
   243         regex     = de-digits-(__VER__)\.tar\.bz2
   244     }
   245     prog asterisk:sounds_custom = {
   246         version   = %{V_asterisk_sounds_custom}
   247         url       = ftp://ftp.europalab.com/pub/sfw/machsnds/de-sounds/
   248         regex     = astmultisnds-de-sln16-(__VER__)\.tar\.bz2
   249     }
   250     prog asterisk:sounds_mohop = {
   251         version   = %{V_asterisk_sounds_mohop}
   252         url       = http://downloads.asterisk.org/pub/telephony/sounds/releases/
   253         regex     = asterisk-moh-opsound-sln16-(__VER__)\.tar\.gz
   254     }
   255     prog asterisk:chan_capi = {
   256         version   = %{V_chan_capi}
   257         url       = ftp://ftp.chan-capi.org/chan-capi/
   258         regex     = chan_capi-(__VER__)\.tar\.gz
   259     }
   261 %prep
   262 %if "%{with_capi}" == "yes"
   263     ( echo "Note that the system header files capi20.h, capicmd.h, and capiutils.h might"
   264       echo "need adjusting in accordance withthe CAPI hardware vendor's kernel driver."
   265     ) | %{l_rpmtool} msg -b -t warn
   266 %endif
   267     %setup -q -n asterisk-%{V_asterisk}
   268     %setup -q -n asterisk-%{V_asterisk} -D -T -a 1
   269     %setup -q -n asterisk-%{V_asterisk} -D -T -a 2
   270 %if "%{with_fax}" == "yes"
   271     %setup -q -n asterisk-%{V_asterisk} -D -T -a 23
   272     %setup -q -n asterisk-%{V_asterisk} -D -T -a 24
   273 %endif
   274     ( cd addons
   275       %{l_tar} zxf %{_sourcedir}/mp3-%{V_asterisk_addons_mp3dec}.tar.gz
   276     ) || exit $?
   277     ( cd codecs
   278       %{l_tar} zxf %{_sourcedir}/ilbc-%{V_asterisk_codecs_ilbc}.tar.gz
   279       mv ilbc-%{V_asterisk_codecs_ilbc}/* ilbc/
   280       rmdir ilbc-%{V_asterisk_codecs_ilbc}
   281     ) || exit $?
   282     %patch -p0
   283 %if "%{with_xfersips}" == "yes"
   284     %patch -p0 -P 1
   285 %endif
   286 %if "%{with_proxymwi}" == "yes"
   287     %patch -p0 -P 2
   288 %endif
   289     %{l_shtool} subst \
   290         -e 's;\(astdatadir=.*\)\${astvarlibdir};\1${datadir};' \
   291         -e 's;\(astvarlibdir=.*\)/lib/asterisk;\1/asterisk/lib;' \
   292         -e 's;\(astdbdir=.*\)\${astvarlibdir};\1${localstatedir}/asterisk/db;' \
   293         -e 's;\(dir=.*{localstatedir}\)/\([^/][^/]*\)/asterisk;\1/asterisk/\2;g' \
   294         configure
   295     %{l_shtool} subst \
   296         -e 's;ffmpeg/avcodec\.h;libavcodec/avcodec.h;' \
   297         -e 's;\(sqlite\)\(_exec\);\13\2;g' \
   298         -e 's;-lradiusclient-ng;-lradiusclient;g' \
   299         -e 's;radiusclient-ng\.h;radiusclient.h;g' \
   300         -e 's;lua5\.1;lua;g' \
   301         -e 's;-I${IMAP_TK_DIR}/c-client;-DUSE_SYSTEM_IMAP -I${IMAP_TK_DIR}/include/imap;g' \
   302         -e 's;${IMAP_TK_DIR}/c-client/c-client\.a;-limap -lssl -lcrypto -lcrypt;g' \
   303         -e 's;LIBXML2_INCLUDE="-I\${LIBXML2_DIR}/include";echo "Removing really buggy hard coded LibXML include defs.";' \
   304         -e 's;\(for ver in 2\.0 2\.2 2\.4\);\1 2.6;' \
   305         -e 's;\(\-lpq.*\-lz.*\)";\1 ${PTHREAD_LIBS}";g'\
   306         configure
   307     %{l_shtool} subst \
   308         -e 's;\(sh\) \(bash\) ksh sh5;\2 \1;' \
   309         configure
   310     %{l_shtool} subst \
   311         -e 's/int foo2 = \(__sync_fetch_and_add(\&foo1, 1);\)/return \1/' \
   312         configure
   313     %{l_shtool} subst \
   314         -e 's;^\(#define DEFAULT_DB .*\${ASTDBDIR}\)/astdb;\1/asterisk.db;' \
   315         build_tools/make_defaults_h
   316     %{l_shtool} subst \
   317         -e 's;^\(_all:.* *\)cleantest *;\1;' \
   318         -e 's; *-I/usr/local/ssl/include;;g' \
   319         -e 's;/opt/ssl/include;%{l_prefix}/include;g' \
   320         -e 's;/usr/local;%{l_prefix};g' \
   321         Makefile
   322     %{l_shtool} subst \
   323         -e 's;\$(SUBMAKE);$(MAKE);g' \
   324         -e 's;\$(SILENTMAKE);$(MAKE) --quiet --no-print-directory;g' \
   325         -e 's;\$(MAKE_MENUSELECT); $(MAKE) -C menuselect;g' \
   326         -e 's;-march=\$(PROC);-march=native;g' \
   327         Makefile
   328     %{l_shtool} subst \
   329         -e 's; *-L/usr/local/ssl/lib;;g' \
   330         -e 's;/opt/ssl/lib;%{l_prefix}/lib;g' \
   331         -e 's;/usr/local;%{l_prefix};g' \
   332         -e 's;\(ASTLINK=\)$;\1-Wl,--export-dynamic;g' \
   333         -e 's;\( CFLAGS=\)"[^"]+";"%{l_cflags -O}";g' \
   334         main/Makefile
   335     %{l_shtool} subst \
   336         -e 's;\(<defaultenabled>\)no\(</defaultenabled>\);\1yes\2;g' \
   337         apps/app_ivrdemo.c \
   338         apps/app_saycounted.c \
   339         utils/utils.xml \
   340         agi/agi.xml
   341     %{l_shtool} subst \
   342         -e 's;\(-DSOLARIS\);\1 -D__EXTENSIONS__=1;g' \
   343         main/editline/Makefile.in \
   344         main/db1-ast/Makefile
   345     %{l_shtool} subst \
   346         -e 's;^\(install:\).*;\1;' \
   347         sounds/Makefile
   348     %{l_shtool} subst \
   349         -e 's;%s/astdb;%s/asterisk.db;g' \
   350         main/asterisk.c
   351     %{l_shtool} subst \
   352         -e 's;u_int\([0-9]*\)_t;uint\1_t;g' \
   353         main/db1-ast/hash/hash.h
   354     %{l_shtool} subst \
   355         -e 's;if \(((tmp = strchr(name\);while \1;g' \
   356         main/abstract_jb.c
   357     %{l_shtool} subst \
   358         -e 's;if.*SSL_CTX_use_certificate_file.*;if (SSL_CTX_use_certificate_chain_file(cfg->ssl_ctx, cfg->certfile) == 0) {;' \
   359         main/tcptls.c
   360     %{l_shtool} subst \
   361         -e 's;ast_random();rand();' \
   362         main/strcompat.c
   363     %{l_shtool} subst \
   364         -e 's;\(/etc/radiusclient-ng/radiusclient.conf\);%{l_prefix}\1;g' \
   365         -e 's;\(radiusclient\)-ng;\1;g' \
   366         cdr/cdr_radius.c \
   367         cel/cel_radius.c
   368     %{l_shtool} subst \
   369         -e 's;\(sqlite\)\(\.h\);\13\2;g' \
   370         cdr/cdr_sqlite.c
   371     %{l_shtool} subst \
   372         -e 's;\(#define DEFAULT_POLLING_INTERVAL\) .*;\1 %{with_smdipoll};' \
   373         res/res_smdi.c
   374     %{l_shtool} subst \
   375         -e 's;\(ASTERISK_HEADER_DIR=\).*;\1%{l_prefix}/include;g' \
   376         -e 's;\(MODULES_DIR=\).*;\1%{l_prefix}/lib/asterisk/modules;g' \
   377         -e 's;\(CONFIG_DIR=\).*;\1%{l_prefix}/etc/asterisk;g' \
   378         -e 's;\(\$(MODULES_DIR)\);$(DESTDIR)\1;g' \
   379         -e 's;\${CONFIG_DIR};$(DESTDIR)$(CONFIG_DIR);g' \
   380         -e 's;^\(USE_OWN_LIBCAPI\)=yes;\1=no;' \
   381         chan_capi-%{V_chan_capi}/Makefile
   382     case "%{l_platform -t}" in
   383         *-sunos* )
   384             %{l_shtool} subst \
   385                 -e 's;SO_SUPPRESS_SYMBOLS=-Wl,--version-script,[a-zA-Z0-9@\-_,\.()\$ ][a-zA-Z0-9@\-_,\.()\$ ]*;LOCAL_NOOP=0;' \
   386                 -e 's;ASTLINK+=-Wl,--version-script,[a-zA-Z0-9\-_\.,][a-zA-Z0-9\-_\.,]*;LOCAL_NOOP=0;' \
   387                 -e 's;-Wl,--version-script=[^ ][^ ]* *;;' \
   388                 Makefile.rules \
   389                 main/Makefile \
   390                 main/db1-ast/Makefile
   391             ;;
   392     esac
   394 %build
   395     #   sanity check operating system
   396 %if "%{with_dahdi}" == "yes"
   397     dahdi_prefix=""
   398     case "%{l_platform -t}" in
   399         *-linux* )
   400             if [ ! -f /usr/include/dahdi/user.h ]; then
   401                 echo "option \"with_dahdi\" requires DAHDI Linux drivers installed" 1>&2; exit 1
   402             fi
   403             dahdi_prefix=/usr
   404             ;;
   405         *-freebsd* )
   406             if [ ! -f /usr/local/include/dahdi/user.h ]; then
   407                 echo "option \"with_dahdi\" requires DAHDI FreeBSD drivers installed" 1>&2; exit 1
   408             fi
   409             dahdi_prefix=/usr/local
   410             ;;
   411         * ) echo "option \"with_dahdi\" supported under Linux and FreeBSD only" 1>&2; exit 1 ;;
   412     esac
   413 %endif
   414     #   correct platform dependent build configuration
   415     extflg=
   416     loclibs="-lssl -lcrypto"
   417     case "%{l_platform -t}" in
   418         *-linux* )
   419             pthlibflg='-lpthread'
   420             ;;
   421         *-sunos* )
   422             loclibs="$loclibs -lsocket -lnsl"
   423             ;;
   424     esac
   426     #   adapt buildconf to find mpg123 (for music on hold)
   427 %if "%{with_mp3}" == "yes"
   428     mpg123="%{l_prefix}/bin/mpg123"
   429 %else
   430     mpg123="`which false`"
   431 %endif
   432     %{l_shtool} subst \
   433         -e "s;/usr/local/bin/mpg123;$mpg123;" \
   434         -e "s;/usr/bin/mpg123;$mpg123;" \
   435         res/res_musiconhold.c apps/app_mp3.c
   437     #   configure program
   438     cflags="%{l_cflags -O}"
   439     cppflags="%{l_cppflags ncurses lua}"
   440     ldflags="%{l_ldflags}"
   441     cppflags="$cppflags"
   442     ldflags="$ldflags"
   443 %if "%{with_ogg}" == "yes"
   444     loclibs="$loclibs -logg -lm"
   445 %endif
   446 %if "%{with_avcodec}" == "yes"
   447     loclibs="$loclibs -lavcodec -lavutil"
   448 %endif
   449 %if "%{with_ldap}" == "yes"
   450     loclibs="$loclibs -lldap -llber"
   451 %endif
   452 %if "%{with_dahdi}" == "yes"
   453     cppflags="$cppflags -I$dahdi_prefix/include"
   454     ldflags="$ldflags -L$dahdi_prefix/lib"
   455 %endif
   456     CC="%{l_cc}" \
   457     CFLAGS="$cflags" \
   458     CPPFLAGS="$cppflags" \
   459     LDFLAGS="$ldflags" \
   460     LIBS="$loclibs" \
   461     INSTALL="%{l_shtool} install -c" \
   462     PTHREAD_LIBS="$pthlibflg" \
   463     ./configure \
   464         --cache-file=./config.cache \
   465         --prefix=%{l_prefix} \
   466         --mandir=%{l_prefix}/man \
   467         --sysconfdir=%{l_prefix}/etc \
   468         --localstatedir=%{l_prefix}/var \
   469         --datarootdir=%{l_prefix}/share/asterisk \
   470         --with-crypto=%{l_prefix} \
   471         --with-libcurl=%{l_prefix} \
   472         --with-ncurses=%{l_prefix} \
   473         --with-gsm="internal" \
   474         --with-popt=%{l_prefix} \
   475 %if "%{with_sqlite}" == "yes"
   476         --with-sqlite3=%{l_prefix} \
   477 %else
   478         --without-sqlite3 \
   479 %endif
   480 %if "%{with_srtp}" == "yes"
   481         --with-srtp=%{l_prefix} \
   482 %else
   483         --without-srtp \
   484 %endif
   485 %if "%{with_pgsql}" == "yes"
   486         --with-postgres=%{l_prefix} \
   487 %else
   488         --with-postgres=no \
   489 %endif
   490         --with-speex=%{l_prefix} \
   491         --with-speexdsp=%{l_prefix} \
   492         --with-ssl=%{l_prefix} \
   493         --with-gmime=%{l_prefix} \
   494         --with-z=%{l_prefix} \
   495 %if "%{with_ogg}" == "yes"
   496         --with-ogg=%{l_prefix} \
   497         --with-vorbis=%{l_prefix} \
   498 %else
   499         --without-ogg \
   500         --without-vorbis \
   501 %endif
   502 %if "%{with_jabber}" == "yes"
   503         --with-iksemel=%{l_prefix} \
   504 %else
   505         --without-iksemel \
   506 %endif
   507 %if "%{with_lua}" == "yes"
   508         --with-lua=%{l_prefix} \
   509 %else
   510         --without-lua \
   511 %endif
   512 %if "%{with_dahdi}" == "yes"
   513         --with-dahdi=$dahdi_prefix \
   514         --with-tonezone=$dahdi_prefix \
   515 %else
   516         --without-dahdi \
   517         --without-tonezone \
   518 %endif
   519 %if "%{with_avcodec}" == "yes"
   520         --with-avcodec=%{l_prefix} \
   521 %else
   522         --without-avcodec \
   523 %endif
   524 %if "%{with_ldap}" == "yes"
   525         --with-ldap=%{l_prefix} \
   526 %else
   527         --without-ldap \
   528 %endif
   529 %if "%{with_radius}" == "yes"
   530         --with-radius=%{l_prefix} \
   531 %else
   532         --without-radius \
   533 %endif
   534 %if "%{with_imap}" == "yes"
   535         --with-imap=%{l_prefix} \
   536         --disable-largefile \
   537 %else
   538         --without-imap \
   539 %endif
   540         --without-iodbc \
   541 %if "%{with_odbc}" == "yes"
   542         --with-unixodbc=%{l_prefix} \
   543 %else
   544         --without-unixodbc \
   545 %endif
   546 %if "%{with_libpri}" == "yes"
   547         --with-pri=%{l_prefix} \
   548 %else
   549         --without-pri \
   550 %endif
   551         --with-sounds-cache=%_sourcedir \
   552         --with-libxml2=%{l_prefix} \
   553         --without-netsnmp \
   554         --without-isdnnet \
   555         --without-misdn \
   556         --without-nbs \
   557         --without-newt \
   558         --without-asound \
   559         --without-oss \
   560         --without-sqlite \
   561         --without-tds \
   562         --without-osptk \
   563         --without-suppserv \
   564         --without-vpb \
   565         --without-sdl \
   566         --without-x11 \
   567         --without-gtk2
   569     #   build menuselect
   570     %{l_make} %{l_mflags -O} menuselect.makeopts
   571     menuselect/menuselect \
   572         --enable format_mp3 --enable app_fax --enable codec_ilbc \
   573         --enable RADIO_RELAX --enable G711_NEW_ALGORITHM \
   574         --enable G711_REDUCED_BRANCHING --enable CORE-SOUNDS-EN-SLN16 \
   575         --enable CORE-SOUNDS-ES-SLN16 --enable CORE-SOUNDS-FR-SLN16 \
   576         --enable CORE-SOUNDS-EN_AU-SLN16 --enable CORE-SOUNDS-RU-SLN16 \
   577         --enable MOH-OPSOUND-SLN16 --enable EXTRA-SOUNDS-EN-SLN16 \
   578         --enable EXTRA-SOUNDS-FR-SLN16 \
   579         menuselect.makeopts
   580     menuselect/menuselect \
   581         --disable CORE-SOUNDS-EN-GSM \
   582         --disable MOH-OPSOUND-WAV \
   583         menuselect.makeopts
   584 %if "%{with_imap}" == "yes"
   585     menuselect/menuselect --enable IMAP_STORAGE menuselect.makeopts
   586 %endif
   588     #   build program
   589     %{l_make} %{l_mflags -O} \
   590         CC="%{l_cc} $cflags -I../include $cppflags" NOISY_BUILD=yes
   592 %if "%{with_capi}" == "yes"
   593     #   build capi channel
   594     ( cd chan_capi-*
   595       ln -s ../include/asterisk .
   596       ln -s ../include/asterisk.h .
   597       %{l_make} %{l_mflags -O} V=1 \
   598           INSTALL_PREFIX=%{l_prefix} \
   599           ASTERISK_HEADER_DIR="`pwd`" \
   600     ) || exit $?
   601 %endif
   603 %install
   604     #   install program
   605     %{l_make} %{l_mflags} install \
   606         DESTDIR=$RPM_BUILD_ROOT \
   607         INSTALL_PREFIX=%{l_prefix}
   609 %if "%{with_capi}" == "yes"
   610     #   install capi channel
   611     ( cd chan_capi-*
   612       %{l_make} %{l_mflags} install \
   613           INSTALL_PREFIX=$RPM_BUILD_ROOT%{l_prefix} \
   614           INSTALL="%{l_shtool} install -c" \
   615           MODULES_DIR='$(INSTALL_PREFIX)/lib/asterisk/modules'
   616     ) || exit $?
   617 %endif
   619 %if "%{with_fax}" == "yes"
   620     #   install fax support
   621     case "%{l_platform -t}" in
   622         amd64*-* )
   623             %{l_shtool} install -c -m 755 \
   624                 res_fax_digium-%{V_asterisk_fax_digium}-generic_64/res_*.so \
   625                 $RPM_BUILD_ROOT%{l_prefix}/lib/asterisk/modules/
   626             %{l_shtool} install -c -m 640 \
   627                 res_fax_digium-%{V_asterisk_fax_digium}-generic_64/*.conf \
   628                 $RPM_BUILD_ROOT%{l_prefix}/etc/asterisk/
   629             ;;
   630         i?86-* )
   631             %{l_shtool} install -c -m 755 \
   632                 res_fax_digium-%{V_asterisk_fax_digium}-generic_32/res_*.so \
   633                 $RPM_BUILD_ROOT%{l_prefix}/lib/asterisk/modules/
   634             %{l_shtool} install -c -m 640 \
   635                 res_fax_digium-%{V_asterisk_fax_digium}-generic_32/*.conf \
   636                 $RPM_BUILD_ROOT%{l_prefix}/etc/asterisk/
   637             ;;
   638         *-* )
   639             echo "Error determining hardware architecture." \
   640                 | %{l_rpmtool} msg -b -t warn
   641             exit 1;
   642             ;;
   643     esac
   644 %endif
   646     ( echo 'Start of sound installation block (OpenPKG)'
   647       #   create main sound directory hierarchy
   648       ( cd $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds
   649         %{l_shtool} mkdir -f -p -m 755 en es fr en_AU
   650       ) || exit $?
   651 %if "%{with_esounds}" == "yes"
   652       #   create extra sound directory hierarchy
   653       %{l_shtool} mkdir -f -p -m 755 \
   654           $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds/ru
   655           $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds/moh
   657       #   install humorous 'new' prompts
   658       cd $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds/en
   659       %{l_prefix}/bin/unzip %{_sourcedir}/new_prompts_%{V_asterisk_sounds_newpro}.zip
   661       #   install freeswitch sound prompt files, expecting
   662       #   identical sound filenames to be overwritten later
   663       cd $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds/en
   664       %{l_tar} zxf %{_sourcedir}/freeswitch-sounds-en-us-callie-48000-%{V_fswitch_sounds_en}.tar.gz
   665       subs=`( cd en/us/callie && find * -type d -prune )`
   666       for subdir in $subs; do
   667           mkdir $subdir
   668           mv -f en/us/callie/$subdir/*/* ${subdir}/
   669       done
   670       rm -rf en
   671       cd $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds/es
   672       %{l_tar} zxf %{_sourcedir}/freeswitch-sounds-es-mx-maria-44100.tar.gz
   673       subs=`( cd es/mx/maria && find * -type d -prune )`
   674       for subdir in $subs; do
   675           mkdir $subdir
   676           mv -f es/mx/maria/$subdir/*/* ${subdir}/
   677       done
   678       rm -rf es
   679       cd $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds/ru
   680       %{l_tar} zxf %{_sourcedir}/freeswitch-sounds-ru-RU-elena-48000-%{V_fswitch_sounds_ru}.tar.gz
   681       subs=`( cd ru/RU/elena && find * -type d -prune )`
   682       for subdir in $subs; do
   683           mkdir $subdir
   684           mv -f ru/RU/elena/$subdir/*/* ${subdir}/
   685       done
   686       rm -rf ru
   688       #   install freeswitch music on hold files
   689       cd $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/moh
   690       %{l_tar} zxf %{_sourcedir}/freeswitch-sounds-music-48000-%{V_fswitch_music}.tar.gz
   691       mv -f music/48000/* . && rm -rf music
   693       #   convert freeswitch 48000 and 441000 KHz to 8000 Khz
   694       #   ffmpeg -i <in> -ar 8000 -ac 1 -acodec pcm_s16le -f s16le <out>
   695       cd $RPM_BUILD_ROOT%{l_prefix}/share/asterisk
   696       for highfile in `find . -name '*.wav'`; do
   697           lowfile=`echo $highfile | sed -e 's;\(.*\)\.wav;\1.sln16;'`
   698           %{l_prefix}/bin/sox $highfile -t raw -r 16000 -s -2 -c 1 $lowfile
   699           rm $highfile
   700       done
   701 %endif
   703       #   install main sound prompt files
   704       #for codec in alaw ulaw g722 g729 gsm; do
   705       for lang in en en_AU es fr; do
   706           cd $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds/${lang}
   707           %{l_tar} zxf %{_sourcedir}/asterisk-core-sounds-${lang}-sln16-%{V_asterisk_sounds_core}.tar.gz
   708       done
   709       for lang in en fr; do
   710           cd $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds/${lang}
   711           %{l_tar} zxf %{_sourcedir}/asterisk-extra-sounds-${lang}-sln16-%{V_asterisk_sounds_extra}.tar.gz
   712       done
   714       #   install special case sound files
   715       cd $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds
   716       #%{l_tar} jxf %{SOURCE de-digits-%{V_asterisk_sounds_custom}.tar.bz2}
   717       #( cd de && %{l_tar} zxf %{SOURCE asterisk-core-sounds-de-gsm-%{V_asterisk_sounds_amootts}.tar.gz} ) || exit $?
   718       #%{l_tar} zxf %{SOURCE asterisk-%{V_asterisk_sounds_amoogab}-de-prompts.tar.gz}
   719       #mv -f dictate/de/* de/dictate/ && rm -rf dictate/de
   720       #mv -f digits/de/* de/digits/ && rm -rf digits/de
   721       #mv -f letters/de/* de/letters/ && rm -rf letters/de
   722       #mv -f phonetic/de/* de/phonetic/ && rm -rf phonetic/de
   723       %{l_tar} jxf %{SOURCE astmultisnds-de-sln16-%{V_asterisk_sounds_custom}.tar.bz2}
   724       %{l_tar} jxf %{SOURCE msvbsnds-sln16-%{V_asterisk_sounds_custom}.tar.bz2}
   725       mv msvbsnds-sln16-%{V_asterisk_sounds_custom} msvb
   727       #   install additional asterisk music on hold
   728       cd $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/moh
   729       %{l_tar} zxf %{_sourcedir}/asterisk-moh-freeplay-sln16.tar.gz
   730       %{l_tar} zxf %{_sourcedir}/asterisk-moh-opsound-sln16-%{V_asterisk_sounds_mohop}.tar.gz
   732       #   correct sound permissions
   733       find $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds/ -type f \
   734           | xargs chmod 644
   735       find $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds/ -type d \
   736           | xargs chmod 755
   738       #   apply provisional workaround for bug 0016104
   739       #   https://issues.asterisk.org/view.php?id=16104
   740       cd $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds
   741       cd en && ln -s vm-INBOX.sln16 vm-Voicemail.sln16
   742       cd ../es && ln -s vm-INBOX.sln16 vm-Voicemail.sln16
   743       cd ../de && ln -s vm-INBOX.sln16 vm-Voicemail.sln16
   744       cd ../fr && ln -s vm-INBOX.sln16 vm-Voicemail.sln16
   746 #      #   install nonstandard voicemail prompts
   747 #      %{l_shtool} mkdir -f -p -m 755 \
   748 #          $RPM_BUILD_ROOT%{l_prefix}/var/asterisk/spool/voicemail/default/%{exten}/unavail
   749 #      %{l_shtool} install -c -m 660 \
   750 #          %{_sourcedir}/ansage-%{V_ansage}.wav} \
   751 #          $RPM_BUILD_ROOT%{l_prefix}/var/asterisk/spool/voicemail/default/%{exten}/unavail.wav
   752     ) || exit $?  # End of sound installation block (RPM)
   754     #   strip down installation
   755     rm -f $RPM_BUILD_ROOT%{l_prefix}/sbin/autosupport >/dev/null 2>&1 || true
   756     rm -f $RPM_BUILD_ROOT%{l_prefix}/sbin/safe_asterisk >/dev/null 2>&1 || true
   757     rm -f $RPM_BUILD_ROOT%{l_prefix}/man/man8/autosupport.8 >/dev/null 2>&1 || true
   758     rm -f $RPM_BUILD_ROOT%{l_prefix}/man/man8/safe_asterisk.8 >/dev/null 2>&1 || true
   759     rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/images >/dev/null 2>&1 || true
   760     rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/moh/.asterisk* >/dev/null 2>&1 || true
   761     rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/moh/CREDIT* >/dev/null 2>&1 || true
   762     rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/moh/CHANGES* >/dev/null 2>&1 || true
   763     rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/moh/LICENSE* >/dev/null 2>&1 || true
   764     rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds/*/CREDIT* >/dev/null 2>&1 || true
   765     rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds/*/CHANGES* >/dev/null 2>&1 || true
   766     rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds/*/.asterisk* >/dev/null 2>&1 || true
   768     #   create additional directories
   769     %{l_shtool} mkdir -f -p -m 755 \
   770         $RPM_BUILD_ROOT%{l_prefix}/var/asterisk/db \
   771         $RPM_BUILD_ROOT%{l_prefix}/var/asterisk/spool/facsimile/rx \
   772         $RPM_BUILD_ROOT%{l_prefix}/var/asterisk/spool/facsimile/tx \
   773         $RPM_BUILD_ROOT%{l_prefix}/var/asterisk/spool/outgoing \
   774         $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/licenses
   776     #   postadjust installation
   777     strip $RPM_BUILD_ROOT%{l_prefix}/sbin/* \
   778           $RPM_BUILD_ROOT%{l_prefix}/lib/asterisk/modules/* \
   779           $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/agi-bin/* \
   780           >/dev/null 2>&1 || true
   781     mv  $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/agi-bin \
   782         $RPM_BUILD_ROOT%{l_prefix}/lib/asterisk/agi-bin
   784     #   install AGI progs
   785     ( cd agi
   786       %{l_shtool} install -c -m 755 %{l_value -s -a} \
   787           DialAnMp3.agi fastagi-test numeralize %{SOURCE wakeup.agi} \
   788           $RPM_BUILD_ROOT%{l_prefix}/lib/asterisk/agi-bin/
   789     ) || exit $?
   790     for bin in $RPM_BUILD_ROOT%{l_prefix}/lib/asterisk/agi-bin/*.*; do
   791         mv $bin `echo $bin | sed -e 's;\.[^.]*$;;'`
   792     done
   794     #   install default configuration
   795     for name in `grep "^<file" %{SOURCE asterisk.txt} | sed -e 's;^.*name=";;' -e 's;".*$;;'`; do
   796 %if "%{with_dahdi}" == "no"
   797         [ ".$name" = ".chan_dahdi.conf" ] && continue
   798 %endif
   799 %if "%{with_capi}" == "no"
   800         [ ".$name" = ".capi.conf" ] && continue
   801 %endif
   802 %if "%{with_gtalk}" == "no"
   803         [ ".$name" = ".gtalk.conf" ] && continue
   804 %endif
   805 %if "%{with_jabber}" == "no"
   806         [ ".$name" = ".jabber.conf" ] && continue
   807 %endif
   808 %if "%{with_sqlite}" == "no"
   809         [ ".$name" = ".cdr_sqlite3_custom.conf" ] && continue
   810 %endif
   811 %if "%{with_odbc}" == "no"
   812         [ ".$name" = ".res_odbc.conf" ] && continue
   813         [ ".$name" = ".func_odbc.conf" ] && continue
   814 %endif
   815         (echo ""; cat %{SOURCE asterisk.txt}; echo "") |\
   816             sed -e "1,/^<file name=\"$name\">/d" -e "/<\/file>/,\$d" >$name
   817         %{l_shtool} install -c -m 644 %{l_value -s -a} \
   818             $name $RPM_BUILD_ROOT%{l_prefix}/etc/asterisk/
   819     done
   821     #   install runcommand script
   822     %{l_shtool} mkdir -f -p -m 755 \
   823         $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
   824     %{l_shtool} install -c -m 755 %{l_value -s -a} \
   825         %{SOURCE rc.asterisk} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
   827     #   determine installation files
   828     %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
   829         %{l_files_std} \
   830         '%config %attr(640,%{l_mgrp},%{l_rgrp}) %{l_prefix}/etc/asterisk/*' \
   831         '%config %attr(-,%{l_mgrp},%{l_mgrp}) %{l_prefix}/share/asterisk/licenses' \
   832         '%attr(750,%{l_rgrp},%{l_rgrp}) %{l_prefix}/var/asterisk/spool/facsimile' \
   833         '%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/asterisk'
   835 #        '%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/share/asterisk/sounds/es/vm-Voicemail.sln16' \
   836 #        '%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/share/asterisk/sounds/de/vm-Voicemail.sln16' \
   837 #        '%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/share/asterisk/sounds/fr/vm-Voicemail.sln16' \
   839 %files -f files
   841 %clean
   843 %post
   844 %if "%{with_dahdi}" == "yes"
   845     if [ $1 -eq 1 ]; then
   846         case "%{l_platform -t}" in
   847             *-freebsd* )
   848                 ( echo "To allow Asterisk to use the DAHDI /dev/dahdi/pseudo device(s)"
   849                   echo "you have add the following entry to /etc/devfs.rules:"
   850                   echo ""
   851                   echo "[openpkg_asterisk=10]"
   852                   echo "add path 'dahdi/pseudo*' mode 0664 user %{l_rusr} group %{l_rgrp}"
   853                   echo ""
   854                 ) | %{l_rpmtool} msg -b -t notice
   855                 ;;
   856         esac
   857     fi
   858 %endif
   859 %if "%{with_odbc}" == "yes"
   860     #   after install, optionally link into ODBC and create database
   861     if $RPM_INSTALL_PREFIX/bin/odbcinst -q -s -n "asterisk-sqlite" >/dev/null 2>&1; then
   862         :
   863     else
   864         ( echo "[asterisk-sqlite]"
   865           echo "Description = Asterisk SQLite Database"
   866           echo "Driver      = SQLite3"
   867           echo "Database    = $RPM_INSTALL_PREFIX/var/asterisk/db/asterisk.sqlite"
   868           echo "Timeout     = 2000"
   869         ) | $RPM_INSTALL_PREFIX/bin/odbcinst -i -s -l -n "asterisk-sqlite" -r >/dev/null 2>&1 || true
   870     fi
   871     if [ ! -f $RPM_INSTALL_PREFIX/var/asterisk/run/asterisk.db ]; then
   872         ( umask 007
   873           echo "CREATE TABLE map (key TEXT, val TEXT);" | $RPM_INSTALL_PREFIX/bin/isql "asterisk-sqlite" -b
   874           chown %{l_rusr}:%{l_rgrp} $RPM_INSTALL_PREFIX/var/asterisk/db/asterisk.sqlite >/dev/null 2>&1 || true
   875         ) || exit $?
   876     fi
   877 %endif
   878 %if "%{with_fax}" == "yes"
   879     ( echo "Asterisk has been installed with proprietary Digium fax support."
   880       echo "The responsible module is called res_fax_digium and requires a"
   881       echo "valid license. The license must be found in the directory"
   882       echo "'licenses' which in turn must be found in %{l_prefix}/share/asterisk"
   883       echo "or wherever astvarlibdir has been configured in 'asterisk.conf'."
   884       echo ""
   885       echo "Please see http://downloads.digium.com/pub/telephony/fax/ for information."
   886     ) | %{l_rpmtool} msg -b -t notice
   887 %endif
   888     #   after upgrade, restart service
   889     [ $1 -eq 2 ] || exit 0
   890     eval `%{l_rc} asterisk status 2>/dev/null`
   891     [ ".$asterisk_active" = .yes ] && %{l_rc} asterisk restart
   892     exit 0
   894 %preun
   895     #   before erase, stop service and remove log files
   896     [ $1 -eq 0 ] || exit 0
   897     %{l_rc} asterisk stop 2>/dev/null
   898     rm -f $RPM_INSTALL_PREFIX/var/asterisk/log/*       >/dev/null 2>&1 || true
   899     rm -f $RPM_INSTALL_PREFIX/var/asterisk/log/cdr-*/* >/dev/null 2>&1 || true
   900     rm -f $RPM_INSTALL_PREFIX/var/asterisk/run/*       >/dev/null 2>&1 || true
   901     rm -f $RPM_INSTALL_PREFIX/var/asterisk/spool/*/*   >/dev/null 2>&1 || true
   902     rm -f $RPM_INSTALL_PREFIX/var/asterisk/lib/*       >/dev/null 2>&1 || true
   903     rm -f $RPM_INSTALL_PREFIX/var/asterisk/db/*        >/dev/null 2>&1 || true
   904 %if "%{with_odbc}" == "yes"
   905     #   before erase, optionally unlink from ODBC and destroy database
   906     $RPM_INSTALL_PREFIX/bin/odbcinst -u -s -l -n "asterisk-sqlite" >/dev/null 2>&1 || true
   907 %endif
   908     exit 0

mercurial