asterisk/asterisk.spec

Mon, 01 Sep 2014 21:57:20 +0200

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Mon, 01 Sep 2014 21:57:20 +0200
changeset 798
4ef5d37e8bb2
parent 760
bafc40b5f634
permissions
-rw-r--r--

Update to new vendor version and adjust patch logic accordingly.

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

mercurial