michael@202: ##
michael@202: ## asterisk.spec -- OpenPKG RPM Package Specification
michael@311: ## Copyright (c) 2000-2009 OpenPKG Foundation e.V.
michael@202: ##
michael@202: ## Permission to use, copy, modify, and distribute this software for
michael@202: ## any purpose with or without fee is hereby granted, provided that
michael@202: ## the above copyright notice and this permission notice appear in all
michael@202: ## copies.
michael@202: ##
michael@202: ## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
michael@202: ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
michael@202: ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
michael@202: ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
michael@202: ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
michael@202: ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
michael@202: ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
michael@202: ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
michael@202: ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
michael@202: ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
michael@202: ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
michael@202: ## SUCH DAMAGE.
michael@202: ##
michael@202:
michael@310: # package version
michael@759: %define V_opkg 1.8.20.1
michael@759: %define V_asterisk 1.8.20.1
michael@347: %define V_asterisk_fax_subdir 1.8.4
michael@552: %define V_asterisk_fax_digium 1.8.4_1.3.1
michael@398: %define V_asterisk_sounds_core 1.4.22
michael@311: %define V_asterisk_sounds_extra 1.4.11
michael@311: %define V_asterisk_sounds_amoogab 1.4
michael@311: %define V_asterisk_sounds_amootts current
michael@311: %define V_asterisk_sounds_custom 1.0
michael@311: %define V_asterisk_sounds_mohop 2.03
michael@552: %define V_asterisk_sounds_newpro july_2012
michael@311: %define V_asterisk_addons_mp3dec 1
michael@552: %define V_fswitch_sounds_en 1.0.20
michael@552: %define V_fswitch_sounds_fr 1.0.16
michael@362: %define V_fswitch_sounds_ru 1.0.13
michael@311: %define V_fswitch_music 1.0.8
michael@311: %define V_asterisk_codecs_ilbc 20110104
michael@755: %define V_chan_capi 1.1.6
michael@202:
michael@202: # package information
michael@202: Name: asterisk
michael@310: Summary: Private Branch Exchange (PBX)
michael@202: URL: http://www.asterisk.org/
michael@202: Vendor: Mark Spencer et al.
michael@310: Packager: OpenPKG Foundation e.V.
michael@310: Distribution: OpenPKG Community
michael@310: Class: BASE
michael@202: Group: VoIP
michael@202: License: GPL
michael@310: Version: %{V_opkg}
michael@552: Release: 20120800
michael@202:
michael@202: # package options
michael@310: %option with_dahdi no
michael@310: %option with_capi no
michael@310: %option with_ogg no
michael@310: %option with_mp3 no
michael@310: %option with_fax no
michael@310: %option with_avcodec no
michael@310: %option with_ldap no
michael@310: %option with_radius no
michael@310: %option with_sqlite no
michael@311: %option with_srtp no
michael@311: %option with_pgsql no
michael@310: %option with_lua no
michael@399: %option with_gtalk no
michael@310: %option with_jabber no
michael@310: %option with_imap no
michael@310: %option with_odbc no
michael@311: %option with_libpri no
michael@311: %option with_esounds no
michael@311: %option with_xfersips yes
michael@311: %option with_proxymwi yes
michael@311: %option with_smdipoll 10
michael@756: %option with_motxchan phold
michael@755:
michael@756: # set implicit interdependencies default values
michael@756: %if "%{with_motxchan}" == "phold"
michael@755: %if "%{with_capi}" == "yes"
michael@755: #%define with_motxchan CAPI/ISDN1/090032669002 # Materna (Anny Way)
michael@755: %define with_motxchan CAPI/ISDN1/17094009
michael@756: %else
michael@756: %define with_motxchan Local/17094009
michael@756: %endif
michael@755: %endif
michael@202:
michael@202: # list of sources
michael@310: Source0: http://downloads.asterisk.org/pub/telephony/asterisk/releases/asterisk-%{V_asterisk}.tar.gz
michael@311: Source1: ftp://ftp.chan-capi.org/chan-capi/chan_capi-%{V_chan_capi}.tar.gz
michael@311: Source2: ftp://ftp.europalab.com/pub/sfw/machsnds/asterisk-moh-freeplay-sln16.tar.gz
michael@311: Source3: http://downloads.asterisk.org/pub/telephony/sounds/releases/asterisk-moh-opsound-sln16-%{V_asterisk_sounds_mohop}.tar.gz
michael@400: Source4: http://downloads.asterisk.org/pub/telephony/sounds/releases/asterisk-core-sounds-en-sln16-%{V_asterisk_sounds_core}.tar.gz
michael@400: Source5: http://downloads.asterisk.org/pub/telephony/sounds/releases/asterisk-core-sounds-es-sln16-%{V_asterisk_sounds_core}.tar.gz
michael@405: Source6: http://downloads.asterisk.org/pub/telephony/sounds/releases/asterisk-core-sounds-en_AU-sln16-%{V_asterisk_sounds_core}.tar.gz
michael@400: Source7: http://downloads.asterisk.org/pub/telephony/sounds/releases/asterisk-core-sounds-fr-sln16-%{V_asterisk_sounds_core}.tar.gz
michael@405: Source8: http://downloads.asterisk.org/pub/telephony/sounds/releases/asterisk-core-sounds-ru-sln16-%{V_asterisk_sounds_core}.tar.gz
michael@400: Source9: http://downloads.asterisk.org/pub/telephony/sounds/releases/asterisk-extra-sounds-en-sln16-%{V_asterisk_sounds_extra}.tar.gz
michael@400: Source10: http://downloads.asterisk.org/pub/telephony/sounds/releases/asterisk-extra-sounds-fr-sln16-%{V_asterisk_sounds_extra}.tar.gz
michael@552: Source11: http://www.asterisk.org/files/new_prompts_%{V_asterisk_sounds_newpro}.zip
michael@552: Source12: http://www.amooma.de/asterisk/sprachbausteine/asterisk-%{V_asterisk_sounds_amoogab}-de-prompts.tar.gz
michael@552: Source13: http://www.amooma.de/asterisk/sprachbausteine/asterisk-core-sounds-de-gsm-current.tar.gz
michael@552: Source14: ftp://ftp.europalab.com/pub/sfw/machsnds/de-digits/de-digits-%{V_asterisk_sounds_custom}.tar.bz2
michael@552: Source15: ftp://ftp.europalab.com/pub/sfw/machsnds/de-sounds/astmultisnds-de-sln16-%{V_asterisk_sounds_custom}.tar.bz2
michael@552: Source16: ftp://ftp.europalab.com/pub/sfw/machsnds/msvbsnds-sln16-%{V_asterisk_sounds_custom}.tar.bz2
michael@552: Source17: http://files.freeswitch.org/freeswitch-sounds-en-us-callie-48000-%{V_fswitch_sounds_en}.tar.gz
michael@552: Source18: http://files.freeswitch.org/freeswitch-sounds-es-mx-maria-44100.tar.gz
michael@552: Source19: http://files.freeswitch.org/freeswitch-sounds-fr-ca-june-48000-%{V_fswitch_sounds_fr}.tar.gz
michael@552: Source20: http://files.freeswitch.org/freeswitch-sounds-ru-RU-elena-48000-%{V_fswitch_sounds_ru}.tar.gz
michael@552: Source21: http://files.freeswitch.org/freeswitch-sounds-music-48000-%{V_fswitch_music}.tar.gz
michael@552: Source22: http://svn.digium.com/svn/thirdparty/mp3/trunk/addons/mp3-%{V_asterisk_addons_mp3dec}.tar.gz
michael@552: 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
michael@552: 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
michael@552: Source25: ilbc-%{V_asterisk_codecs_ilbc}.tar.gz
michael@552: Source26: asterisk.txt
michael@552: Source27: rc.asterisk
michael@552: Source28: wakeup.agi
michael@202: Patch0: asterisk.patch
michael@311: Patch1: asterisk.patch.xfersips
michael@311: Patch2: asterisk.patch.proxymwi
michael@202:
michael@202: # build information
michael@552: BuildPreReq: OpenPKG, openpkg >= 20100101, bison, gcc, make, grep, pkgconfig
michael@552: PreReq: OpenPKG, openpkg >= 20100101, MTA
michael@311: BuildPreReq: zlib, curl, openssl, ncurses, speex, sox, popt, gmime, libxml
michael@311: PreReq: zlib, curl, openssl, ncurses, speex, sox, popt, gmime, libxml
michael@310: %if "%{with_ogg}" == "yes"
michael@310: BuildPreReq: vorbis-libs
michael@310: PreReq: vorbis-libs
michael@310: %endif
michael@310: %if "%{with_mp3}" == "yes"
michael@310: PreReq: mpg123
michael@310: %endif
michael@310: %if "%{with_imap}" == "yes"
michael@310: BuildPreReq: imap
michael@310: PreReq: imap
michael@310: %endif
michael@310: %if "%{with_sqlite}" == "yes"
michael@310: BuildPreReq: sqlite
michael@310: PreReq: sqlite
michael@310: %endif
michael@311: %if "%{with_srtp}" == "yes"
michael@311: BuildPreReq: srtp
michael@311: PreReq: srtp
michael@311: %endif
michael@311: %if "%{with_pgsql}" == "yes"
michael@311: BuildPreReq: postgresql
michael@311: PreReq: postgresql
michael@311: %endif
michael@310: %if "%{with_lua}" == "yes"
michael@310: BuildPreReq: lua
michael@310: PreReq: lua
michael@310: %endif
michael@310: %if "%{with_avcodec}" == "yes"
michael@310: BuildPreReq: ffmpeg
michael@310: PreReq: ffmpeg
michael@310: %endif
michael@310: %if "%{with_ldap}" == "yes"
michael@310: BuildPreReq: openldap
michael@310: PreReq: openldap
michael@202: %endif
michael@202: %if "%{with_radius}" == "yes"
michael@202: BuildPreReq: radiusclient
michael@202: PreReq: radiusclient
michael@202: %endif
michael@399: %if "%{with_gtalk}" == "yes"
michael@399: %define with_jabber yes
michael@399: %endif
michael@310: %if "%{with_jabber}" == "yes"
michael@310: BuildPreReq: iksemel
michael@310: PreReq: iksemel
michael@202: %endif
michael@310: %if "%{with_odbc}" == "yes"
michael@310: BuildPreReq: unixodbc, sqlite, sqlite::with_odbc = yes
michael@310: PreReq: unixodbc, sqlite, sqlite::with_odbc = yes
michael@202: %endif
michael@311: %if "%{with_libpri}" == "yes"
michael@311: BuildPreReq: libpri > 1.4.11.5
michael@311: PreReq: libpri > 1.4.11.5
michael@311: %endif
michael@311: %if "%{with_esounds}" == "yes"
michael@552: BuildPreReq: sox, infozip
michael@311: %endif
michael@202:
michael@202: %description
michael@202: Asterisk is a complete Private Branch Exchange (PBX) in software.
michael@311: It provides more than the features normally expected from a PBX,
michael@311: and can transceive Voice over IP (VoIP) in many protocols. Asterisk
michael@311: provides voicemail services with directory, call conferencing,
michael@311: interactive voice response and call queuing as well. It has support
michael@311: for three way calling, caller ID, ADSI, and SIP, and requires no
michael@311: additional hardware for VoIP applications.
michael@311:
michael@311: This copy of Asterisk is optionally patched to allow the asterisk
michael@311: server to respond to SIP/TLS transfer requests using the Transfer()
michael@311: application. Should this option be chosen, the asterisk server
michael@311: successfully dispatches all transfer destinations using 'SIPS'
michael@311: technology by means of the standard SIP/2.0 302 Moved Temporarily
michael@311: message, with a URI resembling .
michael@311:
michael@311: This copy of Asterisk is optionally patched as well to enclose the
michael@311: correct user name in NOTIFY messages when MWI logic detects changes
michael@311: in the state of Messages-Waiting. Asterisk will send NOTIFY messages
michael@311: with the URI 'user@hostname' instead of simply 'hostname'. This can
michael@311: be used by a external SIP proxy to route the MWI to the correct phone.
michael@202:
michael@202: %track
michael@202: prog asterisk = {
michael@310: version = %{V_asterisk}
michael@310: url = http://downloads.asterisk.org/pub/telephony/asterisk/releases/
michael@310: regex = asterisk-(\d+\.\d+(\.\d+)+)\.tar\.gz
michael@310: }
michael@311: prog asterisk:fax_digium_32 = {
michael@311: version = %{V_asterisk_fax_digium}
michael@311: url = http://downloads.digium.com/pub/telephony/fax/res_fax_digium/asterisk-1.8.0/x86-32/
michael@311: regex = res_fax_digium-(__VER__)-generic_32.tar.gz\.tar\.gz
michael@310: }
michael@311: prog asterisk:fax_digium_64 = {
michael@311: version = %{V_asterisk_fax_digium}
michael@311: url = http://downloads.digium.com/pub/telephony/fax/res_fax_digium/asterisk-1.8.0/x86-64/
michael@311: regex = res_fax_digium-(__VER__)-generic_64.tar.gz\.tar\.gz
michael@311: }
michael@311: prog asterisk:sounds_core = {
michael@311: version = %{V_asterisk_sounds_core}
michael@310: url = http://downloads.asterisk.org/pub/telephony/sounds/releases/
michael@311: regex = asterisk-core-sounds-en-sln16-(\d+\.\d+(\.\d+)+)\.tar\.gz
michael@310: }
michael@552: prog asterisk:sounds_newpro = {
michael@552: version = %{V_asterisk_sounds_newpro}
michael@552: url = http://www.asterisk.org/files/
michael@552: regex = new_prompts_(__VER__)\.zip
michael@552: }
michael@311: prog asterisk:sounds_extra = {
michael@311: version = %{V_asterisk_sounds_extra}
michael@310: url = http://downloads.asterisk.org/pub/telephony/sounds/releases/
michael@311: regex = asterisk-extra-sounds-en-sln16-(\d+\.\d+(\.\d+)+)\.tar\.gz
michael@310: }
michael@311: prog asterisk:sounds_amootts = {
michael@311: version = %{V_asterisk_sounds_amootts}
michael@310: url = http://www.amooma.de/asterisk/sprachbausteine/
michael@310: regex = asterisk-core-sounds-de-gsm-(__VER__)\.tar\.gz
michael@310: }
michael@311: prog asterisk:sounds_amoogab = {
michael@311: version = %{V_asterisk_sounds_amoogab}
michael@311: url = http://www.amooma.de/asterisk/sprachbausteine/
michael@311: regex = asterisk-(__VER__)-de-prompts\.tar\.gz
michael@311: }
michael@311: prog asterisk:sounds_digits = {
michael@311: version = %{V_asterisk_sounds_custom}
michael@311: url = ftp://ftp.europalab.com/pub/sfw/machsnds/de-digits/
michael@311: regex = de-digits-(__VER__)\.tar\.bz2
michael@311: }
michael@311: prog asterisk:sounds_custom = {
michael@311: version = %{V_asterisk_sounds_custom}
michael@311: url = ftp://ftp.europalab.com/pub/sfw/machsnds/de-sounds/
michael@311: regex = astmultisnds-de-sln16-(__VER__)\.tar\.bz2
michael@311: }
michael@311: prog asterisk:sounds_mohop = {
michael@311: version = %{V_asterisk_sounds_mohop}
michael@311: url = http://downloads.asterisk.org/pub/telephony/sounds/releases/
michael@311: regex = asterisk-moh-opsound-sln16-(__VER__)\.tar\.gz
michael@311: }
michael@310: prog asterisk:chan_capi = {
michael@310: version = %{V_chan_capi}
michael@310: url = ftp://ftp.chan-capi.org/chan-capi/
michael@310: regex = chan_capi-(__VER__)\.tar\.gz
michael@202: }
michael@202:
michael@202: %prep
michael@399: %if "%{with_capi}" == "yes"
michael@399: ( echo "Note that the system header files capi20.h, capicmd.h, and capiutils.h might"
michael@399: echo "need adjusting in accordance withthe CAPI hardware vendor's kernel driver."
michael@399: ) | %{l_rpmtool} msg -b -t warn
michael@399: %endif
michael@310: %setup -q -n asterisk-%{V_asterisk}
michael@310: %setup -q -n asterisk-%{V_asterisk} -D -T -a 1
michael@311: %setup -q -n asterisk-%{V_asterisk} -D -T -a 2
michael@311: %if "%{with_fax}" == "yes"
michael@400: %setup -q -n asterisk-%{V_asterisk} -D -T -a 23
michael@552: %setup -q -n asterisk-%{V_asterisk} -D -T -a 24
michael@311: %endif
michael@311: ( cd addons
michael@311: %{l_tar} zxf %{_sourcedir}/mp3-%{V_asterisk_addons_mp3dec}.tar.gz
michael@311: ) || exit $?
michael@311: ( cd codecs
michael@311: %{l_tar} zxf %{_sourcedir}/ilbc-%{V_asterisk_codecs_ilbc}.tar.gz
michael@311: mv ilbc-%{V_asterisk_codecs_ilbc}/* ilbc/
michael@311: rmdir ilbc-%{V_asterisk_codecs_ilbc}
michael@311: ) || exit $?
michael@202: %patch -p0
michael@311: %if "%{with_xfersips}" == "yes"
michael@311: %patch -p0 -P 1
michael@311: %endif
michael@311: %if "%{with_proxymwi}" == "yes"
michael@311: %patch -p0 -P 2
michael@311: %endif
michael@310: %{l_shtool} subst \
michael@311: -e 's;\(astdatadir=.*\)\${astvarlibdir};\1${datadir};' \
michael@311: -e 's;\(astvarlibdir=.*\)/lib/asterisk;\1/asterisk/lib;' \
michael@399: -e 's;\(astdbdir=.*\)\${astvarlibdir};\1${localstatedir}/asterisk/db;' \
michael@311: -e 's;\(dir=.*{localstatedir}\)/\([^/][^/]*\)/asterisk;\1/asterisk/\2;g' \
michael@311: configure
michael@311: %{l_shtool} subst \
michael@311: -e 's;ffmpeg/avcodec\.h;libavcodec/avcodec.h;' \
michael@311: -e 's;\(sqlite\)\(_exec\);\13\2;g' \
michael@311: -e 's;-lradiusclient-ng;-lradiusclient;g' \
michael@311: -e 's;radiusclient-ng\.h;radiusclient.h;g' \
michael@398: -e 's;lua5\.1;lua;g' \
michael@311: -e 's;-I${IMAP_TK_DIR}/c-client;-DUSE_SYSTEM_IMAP -I${IMAP_TK_DIR}/include/imap;g' \
michael@311: -e 's;${IMAP_TK_DIR}/c-client/c-client\.a;-limap -lssl -lcrypto -lcrypt;g' \
michael@414: -e 's;LIBXML2_INCLUDE="-I\${LIBXML2_DIR}/include";echo "Removing really buggy hard coded LibXML include defs.";' \
michael@414: -e 's;\(for ver in 2\.0 2\.2 2\.4\);\1 2.6;' \
michael@414: -e 's;\(\-lpq.*\-lz.*\)";\1 ${PTHREAD_LIBS}";g'\
michael@311: configure
michael@311: %{l_shtool} subst \
michael@311: -e 's;\(sh\) \(bash\) ksh sh5;\2 \1;' \
michael@311: configure
michael@311: %{l_shtool} subst \
michael@552: -e 's/int foo2 = \(__sync_fetch_and_add(\&foo1, 1);\)/return \1/' \
michael@552: configure
michael@552: %{l_shtool} subst \
michael@311: -e 's;^\(#define DEFAULT_DB .*\${ASTDBDIR}\)/astdb;\1/asterisk.db;' \
michael@311: build_tools/make_defaults_h
michael@311: %{l_shtool} subst \
michael@362: -e 's;^\(_all:.* *\)cleantest *;\1;' \
michael@311: -e 's; *-I/usr/local/ssl/include;;g' \
michael@311: -e 's;/opt/ssl/include;%{l_prefix}/include;g' \
michael@311: -e 's;/usr/local;%{l_prefix};g' \
michael@311: Makefile
michael@311: %{l_shtool} subst \
michael@311: -e 's;\$(SUBMAKE);$(MAKE);g' \
michael@311: -e 's;\$(SILENTMAKE);$(MAKE) --quiet --no-print-directory;g' \
michael@311: -e 's;\$(MAKE_MENUSELECT); $(MAKE) -C menuselect;g' \
michael@414: -e 's;-march=\$(PROC);-march=native;g' \
michael@311: Makefile
michael@311: %{l_shtool} subst \
michael@311: -e 's; *-L/usr/local/ssl/lib;;g' \
michael@311: -e 's;/opt/ssl/lib;%{l_prefix}/lib;g' \
michael@311: -e 's;/usr/local;%{l_prefix};g' \
michael@311: -e 's;\(ASTLINK=\)$;\1-Wl,--export-dynamic;g' \
michael@311: -e 's;\( CFLAGS=\)"[^"]+";"%{l_cflags -O}";g' \
michael@311: main/Makefile
michael@311: %{l_shtool} subst \
michael@311: -e 's;\(\)no\(\);\1yes\2;g' \
michael@362: apps/app_ivrdemo.c \
michael@362: apps/app_saycounted.c \
michael@311: utils/utils.xml \
michael@311: agi/agi.xml
michael@311: %{l_shtool} subst \
michael@755: -e 's;\(\*motxchannel = "\)[^"][^"]*",;\1%{with_motxchan}",;' \
michael@755: -e 's;\(\*spooldir = "\)[^"][^"]*",;\1%{l_prefix}/var/asterisk/spool",;' \
michael@755: utils/smsq.c
michael@755: %{l_shtool} subst \
michael@311: -e 's;\(-DSOLARIS\);\1 -D__EXTENSIONS__=1;g' \
michael@311: main/editline/Makefile.in \
michael@311: main/db1-ast/Makefile
michael@311: %{l_shtool} subst \
michael@414: -e 's;^\(install:\).*;\1;' \
michael@414: sounds/Makefile
michael@414: %{l_shtool} subst \
michael@311: -e 's;%s/astdb;%s/asterisk.db;g' \
michael@311: main/asterisk.c
michael@311: %{l_shtool} subst \
michael@311: -e 's;u_int\([0-9]*\)_t;uint\1_t;g' \
michael@311: main/db1-ast/hash/hash.h
michael@311: %{l_shtool} subst \
michael@311: -e 's;if \(((tmp = strchr(name\);while \1;g' \
michael@311: main/abstract_jb.c
michael@311: %{l_shtool} subst \
michael@414: -e 's;if.*SSL_CTX_use_certificate_file.*;if (SSL_CTX_use_certificate_chain_file(cfg->ssl_ctx, cfg->certfile) == 0) {;' \
michael@414: main/tcptls.c
michael@414: %{l_shtool} subst \
michael@414: -e 's;ast_random();rand();' \
michael@414: main/strcompat.c
michael@414: %{l_shtool} subst \
michael@311: -e 's;\(/etc/radiusclient-ng/radiusclient.conf\);%{l_prefix}\1;g' \
michael@311: -e 's;\(radiusclient\)-ng;\1;g' \
michael@311: cdr/cdr_radius.c \
michael@311: cel/cel_radius.c
michael@311: %{l_shtool} subst \
michael@311: -e 's;\(sqlite\)\(\.h\);\13\2;g' \
michael@311: cdr/cdr_sqlite.c
michael@311: %{l_shtool} subst \
michael@311: -e 's;\(#define DEFAULT_POLLING_INTERVAL\) .*;\1 %{with_smdipoll};' \
michael@311: res/res_smdi.c
michael@311: %{l_shtool} subst \
michael@311: -e 's;\(ASTERISK_HEADER_DIR=\).*;\1%{l_prefix}/include;g' \
michael@311: -e 's;\(MODULES_DIR=\).*;\1%{l_prefix}/lib/asterisk/modules;g' \
michael@311: -e 's;\(CONFIG_DIR=\).*;\1%{l_prefix}/etc/asterisk;g' \
michael@311: -e 's;\(\$(MODULES_DIR)\);$(DESTDIR)\1;g' \
michael@311: -e 's;\${CONFIG_DIR};$(DESTDIR)$(CONFIG_DIR);g' \
michael@311: -e 's;^\(USE_OWN_LIBCAPI\)=yes;\1=no;' \
michael@311: chan_capi-%{V_chan_capi}/Makefile
michael@755: %{l_shtool} subst \
michael@755: -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' \
michael@755: chan_capi-%{V_chan_capi}/chan_capi_devstate.c
michael@414: case "%{l_platform -t}" in
michael@414: *-sunos* )
michael@414: %{l_shtool} subst \
michael@414: -e 's;SO_SUPPRESS_SYMBOLS=-Wl,--version-script,[a-zA-Z0-9@\-_,\.()\$ ][a-zA-Z0-9@\-_,\.()\$ ]*;LOCAL_NOOP=0;' \
michael@414: -e 's;ASTLINK+=-Wl,--version-script,[a-zA-Z0-9\-_\.,][a-zA-Z0-9\-_\.,]*;LOCAL_NOOP=0;' \
michael@414: -e 's;-Wl,--version-script=[^ ][^ ]* *;;' \
michael@414: Makefile.rules \
michael@414: main/Makefile \
michael@414: main/db1-ast/Makefile
michael@414: ;;
michael@414: esac
michael@310:
michael@310: %build
michael@311: # sanity check operating system
michael@310: %if "%{with_dahdi}" == "yes"
michael@310: dahdi_prefix=""
michael@310: case "%{l_platform -t}" in
michael@310: *-linux* )
michael@311: if [ ! -f /usr/include/dahdi/user.h ]; then
michael@310: echo "option \"with_dahdi\" requires DAHDI Linux drivers installed" 1>&2; exit 1
michael@310: fi
michael@310: dahdi_prefix=/usr
michael@310: ;;
michael@310: *-freebsd* )
michael@311: if [ ! -f /usr/local/include/dahdi/user.h ]; then
michael@310: echo "option \"with_dahdi\" requires DAHDI FreeBSD drivers installed" 1>&2; exit 1
michael@310: fi
michael@310: dahdi_prefix=/usr/local
michael@310: ;;
michael@310: * ) echo "option \"with_dahdi\" supported under Linux and FreeBSD only" 1>&2; exit 1 ;;
michael@310: esac
michael@202: %endif
michael@311: # correct platform dependent build configuration
michael@311: extflg=
michael@414: loclibs="-lssl -lcrypto"
michael@311: case "%{l_platform -t}" in
michael@311: *-linux* )
michael@311: pthlibflg='-lpthread'
michael@311: ;;
michael@414: *-sunos* )
michael@414: loclibs="$loclibs -lsocket -lnsl"
michael@414: ;;
michael@311: esac
michael@202:
michael@311: # adapt buildconf to find mpg123 (for music on hold)
michael@310: %if "%{with_mp3}" == "yes"
michael@310: mpg123="%{l_prefix}/bin/mpg123"
michael@310: %else
michael@310: mpg123="`which false`"
michael@310: %endif
michael@310: %{l_shtool} subst \
michael@310: -e "s;/usr/local/bin/mpg123;$mpg123;" \
michael@310: -e "s;/usr/bin/mpg123;$mpg123;" \
michael@310: res/res_musiconhold.c apps/app_mp3.c
michael@202:
michael@311: # configure program
michael@310: cflags="%{l_cflags -O}"
michael@311: cppflags="%{l_cppflags ncurses lua}"
michael@310: ldflags="%{l_ldflags}"
michael@414: cppflags="$cppflags"
michael@414: ldflags="$ldflags"
michael@310: %if "%{with_ogg}" == "yes"
michael@414: loclibs="$loclibs -logg -lm"
michael@202: %endif
michael@310: %if "%{with_avcodec}" == "yes"
michael@414: loclibs="$loclibs -lavcodec -lavutil"
michael@202: %endif
michael@310: %if "%{with_ldap}" == "yes"
michael@414: loclibs="$loclibs -lldap -llber"
michael@202: %endif
michael@310: %if "%{with_dahdi}" == "yes"
michael@310: cppflags="$cppflags -I$dahdi_prefix/include"
michael@310: ldflags="$ldflags -L$dahdi_prefix/lib"
michael@202: %endif
michael@202: CC="%{l_cc}" \
michael@310: CFLAGS="$cflags" \
michael@310: CPPFLAGS="$cppflags" \
michael@310: LDFLAGS="$ldflags" \
michael@414: LIBS="$loclibs" \
michael@311: INSTALL="%{l_shtool} install -c" \
michael@311: PTHREAD_LIBS="$pthlibflg" \
michael@202: ./configure \
michael@310: --cache-file=./config.cache \
michael@202: --prefix=%{l_prefix} \
michael@202: --mandir=%{l_prefix}/man \
michael@310: --sysconfdir=%{l_prefix}/etc \
michael@311: --localstatedir=%{l_prefix}/var \
michael@311: --datarootdir=%{l_prefix}/share/asterisk \
michael@311: --with-crypto=%{l_prefix} \
michael@362: --with-libcurl=%{l_prefix} \
michael@311: --with-ncurses=%{l_prefix} \
michael@310: --with-gsm="internal" \
michael@310: --with-popt=%{l_prefix} \
michael@310: %if "%{with_sqlite}" == "yes"
michael@310: --with-sqlite3=%{l_prefix} \
michael@202: %else
michael@310: --without-sqlite3 \
michael@202: %endif
michael@311: %if "%{with_srtp}" == "yes"
michael@311: --with-srtp=%{l_prefix} \
michael@311: %else
michael@311: --without-srtp \
michael@311: %endif
michael@311: %if "%{with_pgsql}" == "yes"
michael@311: --with-postgres=%{l_prefix} \
michael@311: %else
michael@311: --with-postgres=no \
michael@311: %endif
michael@310: --with-speex=%{l_prefix} \
michael@310: --with-speexdsp=%{l_prefix} \
michael@202: --with-ssl=%{l_prefix} \
michael@310: --with-gmime=%{l_prefix} \
michael@310: --with-z=%{l_prefix} \
michael@310: %if "%{with_ogg}" == "yes"
michael@310: --with-ogg=%{l_prefix} \
michael@310: --with-vorbis=%{l_prefix} \
michael@310: %else
michael@310: --without-ogg \
michael@310: --without-vorbis \
michael@310: %endif
michael@310: %if "%{with_jabber}" == "yes"
michael@310: --with-iksemel=%{l_prefix} \
michael@310: %else
michael@310: --without-iksemel \
michael@310: %endif
michael@310: %if "%{with_lua}" == "yes"
michael@310: --with-lua=%{l_prefix} \
michael@310: %else
michael@310: --without-lua \
michael@310: %endif
michael@310: %if "%{with_dahdi}" == "yes"
michael@310: --with-dahdi=$dahdi_prefix \
michael@310: --with-tonezone=$dahdi_prefix \
michael@310: %else
michael@310: --without-dahdi \
michael@310: --without-tonezone \
michael@310: %endif
michael@310: %if "%{with_avcodec}" == "yes"
michael@310: --with-avcodec=%{l_prefix} \
michael@310: %else
michael@310: --without-avcodec \
michael@310: %endif
michael@310: %if "%{with_ldap}" == "yes"
michael@310: --with-ldap=%{l_prefix} \
michael@310: %else
michael@310: --without-ldap \
michael@310: %endif
michael@202: %if "%{with_radius}" == "yes"
michael@202: --with-radius=%{l_prefix} \
michael@202: %else
michael@310: --without-radius \
michael@202: %endif
michael@202: %if "%{with_imap}" == "yes"
michael@202: --with-imap=%{l_prefix} \
michael@311: --disable-largefile \
michael@202: %else
michael@310: --without-imap \
michael@202: %endif
michael@362: --without-iodbc \
michael@310: %if "%{with_odbc}" == "yes"
michael@362: --with-unixodbc=%{l_prefix} \
michael@202: %else
michael@362: --without-unixodbc \
michael@202: %endif
michael@311: %if "%{with_libpri}" == "yes"
michael@311: --with-pri=%{l_prefix} \
michael@311: %else
michael@311: --without-pri \
michael@311: %endif
michael@362: --with-sounds-cache=%_sourcedir \
michael@414: --with-libxml2=%{l_prefix} \
michael@310: --without-netsnmp \
michael@310: --without-isdnnet \
michael@310: --without-misdn \
michael@310: --without-nbs \
michael@310: --without-newt \
michael@310: --without-asound \
michael@310: --without-oss \
michael@310: --without-sqlite \
michael@310: --without-tds \
michael@310: --without-osptk \
michael@310: --without-suppserv \
michael@310: --without-vpb \
michael@310: --without-sdl \
michael@310: --without-x11 \
michael@310: --without-gtk2
michael@311:
michael@311: # build menuselect
michael@311: %{l_make} %{l_mflags -O} menuselect.makeopts
michael@362: menuselect/menuselect \
michael@362: --enable format_mp3 --enable app_fax --enable codec_ilbc \
michael@362: --enable RADIO_RELAX --enable G711_NEW_ALGORITHM \
michael@362: --enable G711_REDUCED_BRANCHING --enable CORE-SOUNDS-EN-SLN16 \
michael@362: --enable CORE-SOUNDS-ES-SLN16 --enable CORE-SOUNDS-FR-SLN16 \
michael@362: --enable CORE-SOUNDS-EN_AU-SLN16 --enable CORE-SOUNDS-RU-SLN16 \
michael@362: --enable MOH-OPSOUND-SLN16 --enable EXTRA-SOUNDS-EN-SLN16 \
michael@362: --enable EXTRA-SOUNDS-FR-SLN16 \
michael@362: menuselect.makeopts
michael@362: menuselect/menuselect \
michael@362: --disable CORE-SOUNDS-EN-GSM \
michael@362: --disable MOH-OPSOUND-WAV \
michael@311: menuselect.makeopts
michael@311: %if "%{with_imap}" == "yes"
michael@362: menuselect/menuselect --enable IMAP_STORAGE menuselect.makeopts
michael@311: %endif
michael@311:
michael@311: # build program
michael@311: %{l_make} %{l_mflags -O} \
michael@414: CC="%{l_cc} $cflags -I../include $cppflags" NOISY_BUILD=yes
michael@202:
michael@202: %if "%{with_capi}" == "yes"
michael@311: # build capi channel
michael@310: ( cd chan_capi-*
michael@310: ln -s ../include/asterisk .
michael@310: ln -s ../include/asterisk.h .
michael@311: %{l_make} %{l_mflags -O} V=1 \
michael@310: INSTALL_PREFIX=%{l_prefix} \
michael@755: ASTERISK_HEADER_DIR="`pwd`"
michael@202: ) || exit $?
michael@202: %endif
michael@202:
michael@202: %install
michael@310: # install program
michael@310: %{l_make} %{l_mflags} install \
michael@310: DESTDIR=$RPM_BUILD_ROOT \
michael@310: INSTALL_PREFIX=%{l_prefix}
michael@202:
michael@202: %if "%{with_capi}" == "yes"
michael@311: # install capi channel
michael@310: ( cd chan_capi-*
michael@310: %{l_make} %{l_mflags} install \
michael@310: INSTALL_PREFIX=$RPM_BUILD_ROOT%{l_prefix} \
michael@310: INSTALL="%{l_shtool} install -c" \
michael@310: MODULES_DIR='$(INSTALL_PREFIX)/lib/asterisk/modules'
michael@202: ) || exit $?
michael@202: %endif
michael@202:
michael@311: %if "%{with_fax}" == "yes"
michael@311: # install fax support
michael@311: case "%{l_platform -t}" in
michael@311: amd64*-* )
michael@311: %{l_shtool} install -c -m 755 \
michael@311: res_fax_digium-%{V_asterisk_fax_digium}-generic_64/res_*.so \
michael@311: $RPM_BUILD_ROOT%{l_prefix}/lib/asterisk/modules/
michael@311: %{l_shtool} install -c -m 640 \
michael@311: res_fax_digium-%{V_asterisk_fax_digium}-generic_64/*.conf \
michael@311: $RPM_BUILD_ROOT%{l_prefix}/etc/asterisk/
michael@311: ;;
michael@311: i?86-* )
michael@311: %{l_shtool} install -c -m 755 \
michael@311: res_fax_digium-%{V_asterisk_fax_digium}-generic_32/res_*.so \
michael@311: $RPM_BUILD_ROOT%{l_prefix}/lib/asterisk/modules/
michael@311: %{l_shtool} install -c -m 640 \
michael@311: res_fax_digium-%{V_asterisk_fax_digium}-generic_32/*.conf \
michael@311: $RPM_BUILD_ROOT%{l_prefix}/etc/asterisk/
michael@311: ;;
michael@318: *-* )
michael@311: echo "Error determining hardware architecture." \
michael@311: | %{l_rpmtool} msg -b -t warn
michael@311: exit 1;
michael@311: ;;
michael@311: esac
michael@311: %endif
michael@311:
michael@414: ( echo 'Start of sound installation block (OpenPKG)'
michael@552: # create main sound directory hierarchy
michael@552: ( cd $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds
michael@552: %{l_shtool} mkdir -f -p -m 755 en es fr en_AU
michael@552: ) || exit $?
michael@311: %if "%{with_esounds}" == "yes"
michael@552: # create extra sound directory hierarchy
michael@552: %{l_shtool} mkdir -f -p -m 755 \
michael@552: $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds/ru
michael@552: $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds/moh
michael@552:
michael@552: # install humorous 'new' prompts
michael@552: cd $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds/en
michael@552: %{l_prefix}/bin/unzip %{_sourcedir}/new_prompts_%{V_asterisk_sounds_newpro}.zip
michael@552:
michael@311: # install freeswitch sound prompt files, expecting
michael@311: # identical sound filenames to be overwritten later
michael@311: cd $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds/en
michael@311: %{l_tar} zxf %{_sourcedir}/freeswitch-sounds-en-us-callie-48000-%{V_fswitch_sounds_en}.tar.gz
michael@311: subs=`( cd en/us/callie && find * -type d -prune )`
michael@311: for subdir in $subs; do
michael@311: mkdir $subdir
michael@311: mv -f en/us/callie/$subdir/*/* ${subdir}/
michael@311: done
michael@311: rm -rf en
michael@311: cd $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds/es
michael@311: %{l_tar} zxf %{_sourcedir}/freeswitch-sounds-es-mx-maria-44100.tar.gz
michael@311: subs=`( cd es/mx/maria && find * -type d -prune )`
michael@311: for subdir in $subs; do
michael@311: mkdir $subdir
michael@311: mv -f es/mx/maria/$subdir/*/* ${subdir}/
michael@311: done
michael@311: rm -rf es
michael@311: cd $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds/ru
michael@311: %{l_tar} zxf %{_sourcedir}/freeswitch-sounds-ru-RU-elena-48000-%{V_fswitch_sounds_ru}.tar.gz
michael@311: subs=`( cd ru/RU/elena && find * -type d -prune )`
michael@311: for subdir in $subs; do
michael@311: mkdir $subdir
michael@311: mv -f ru/RU/elena/$subdir/*/* ${subdir}/
michael@311: done
michael@311: rm -rf ru
michael@311:
michael@311: # install freeswitch music on hold files
michael@311: cd $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/moh
michael@311: %{l_tar} zxf %{_sourcedir}/freeswitch-sounds-music-48000-%{V_fswitch_music}.tar.gz
michael@311: mv -f music/48000/* . && rm -rf music
michael@311:
michael@311: # convert freeswitch 48000 and 441000 KHz to 8000 Khz
michael@347: # ffmpeg -i -ar 8000 -ac 1 -acodec pcm_s16le -f s16le
michael@311: cd $RPM_BUILD_ROOT%{l_prefix}/share/asterisk
michael@311: for highfile in `find . -name '*.wav'`; do
michael@311: lowfile=`echo $highfile | sed -e 's;\(.*\)\.wav;\1.sln16;'`
michael@311: %{l_prefix}/bin/sox $highfile -t raw -r 16000 -s -2 -c 1 $lowfile
michael@311: rm $highfile
michael@311: done
michael@311: %endif
michael@311:
michael@311: # install main sound prompt files
michael@311: #for codec in alaw ulaw g722 g729 gsm; do
michael@414: for lang in en en_AU es fr; do
michael@311: cd $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds/${lang}
michael@311: %{l_tar} zxf %{_sourcedir}/asterisk-core-sounds-${lang}-sln16-%{V_asterisk_sounds_core}.tar.gz
michael@311: done
michael@311: for lang in en fr; do
michael@311: cd $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds/${lang}
michael@311: %{l_tar} zxf %{_sourcedir}/asterisk-extra-sounds-${lang}-sln16-%{V_asterisk_sounds_extra}.tar.gz
michael@311: done
michael@311:
michael@311: # install special case sound files
michael@311: cd $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds
michael@311: #%{l_tar} jxf %{SOURCE de-digits-%{V_asterisk_sounds_custom}.tar.bz2}
michael@311: #( cd de && %{l_tar} zxf %{SOURCE asterisk-core-sounds-de-gsm-%{V_asterisk_sounds_amootts}.tar.gz} ) || exit $?
michael@311: #%{l_tar} zxf %{SOURCE asterisk-%{V_asterisk_sounds_amoogab}-de-prompts.tar.gz}
michael@311: #mv -f dictate/de/* de/dictate/ && rm -rf dictate/de
michael@311: #mv -f digits/de/* de/digits/ && rm -rf digits/de
michael@311: #mv -f letters/de/* de/letters/ && rm -rf letters/de
michael@311: #mv -f phonetic/de/* de/phonetic/ && rm -rf phonetic/de
michael@311: %{l_tar} jxf %{SOURCE astmultisnds-de-sln16-%{V_asterisk_sounds_custom}.tar.bz2}
michael@311: %{l_tar} jxf %{SOURCE msvbsnds-sln16-%{V_asterisk_sounds_custom}.tar.bz2}
michael@347: mv msvbsnds-sln16-%{V_asterisk_sounds_custom} msvb
michael@311:
michael@311: # install additional asterisk music on hold
michael@311: cd $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/moh
michael@311: %{l_tar} zxf %{_sourcedir}/asterisk-moh-freeplay-sln16.tar.gz
michael@311: %{l_tar} zxf %{_sourcedir}/asterisk-moh-opsound-sln16-%{V_asterisk_sounds_mohop}.tar.gz
michael@311:
michael@311: # correct sound permissions
michael@311: find $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds/ -type f \
michael@311: | xargs chmod 644
michael@311: find $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds/ -type d \
michael@311: | xargs chmod 755
michael@311:
michael@311: # apply provisional workaround for bug 0016104
michael@311: # https://issues.asterisk.org/view.php?id=16104
michael@311: cd $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds
michael@311: cd en && ln -s vm-INBOX.sln16 vm-Voicemail.sln16
michael@311: cd ../es && ln -s vm-INBOX.sln16 vm-Voicemail.sln16
michael@311: cd ../de && ln -s vm-INBOX.sln16 vm-Voicemail.sln16
michael@311: cd ../fr && ln -s vm-INBOX.sln16 vm-Voicemail.sln16
michael@311:
michael@311: # # install nonstandard voicemail prompts
michael@311: # %{l_shtool} mkdir -f -p -m 755 \
michael@311: # $RPM_BUILD_ROOT%{l_prefix}/var/asterisk/spool/voicemail/default/%{exten}/unavail
michael@311: # %{l_shtool} install -c -m 660 \
michael@311: # %{_sourcedir}/ansage-%{V_ansage}.wav} \
michael@311: # $RPM_BUILD_ROOT%{l_prefix}/var/asterisk/spool/voicemail/default/%{exten}/unavail.wav
michael@311: ) || exit $? # End of sound installation block (RPM)
michael@310:
michael@310: # strip down installation
michael@310: rm -f $RPM_BUILD_ROOT%{l_prefix}/sbin/autosupport >/dev/null 2>&1 || true
michael@310: rm -f $RPM_BUILD_ROOT%{l_prefix}/sbin/safe_asterisk >/dev/null 2>&1 || true
michael@310: rm -f $RPM_BUILD_ROOT%{l_prefix}/man/man8/autosupport.8 >/dev/null 2>&1 || true
michael@310: rm -f $RPM_BUILD_ROOT%{l_prefix}/man/man8/safe_asterisk.8 >/dev/null 2>&1 || true
michael@310: rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/images >/dev/null 2>&1 || true
michael@362: rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/moh/.asterisk* >/dev/null 2>&1 || true
michael@311: rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/moh/CREDIT* >/dev/null 2>&1 || true
michael@311: rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/moh/CHANGES* >/dev/null 2>&1 || true
michael@362: rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/moh/LICENSE* >/dev/null 2>&1 || true
michael@311: rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds/*/CREDIT* >/dev/null 2>&1 || true
michael@311: rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds/*/CHANGES* >/dev/null 2>&1 || true
michael@362: rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds/*/.asterisk* >/dev/null 2>&1 || true
michael@310:
michael@310: # create additional directories
michael@310: %{l_shtool} mkdir -f -p -m 755 \
michael@311: $RPM_BUILD_ROOT%{l_prefix}/var/asterisk/db \
michael@362: $RPM_BUILD_ROOT%{l_prefix}/var/asterisk/spool/facsimile/rx \
michael@362: $RPM_BUILD_ROOT%{l_prefix}/var/asterisk/spool/facsimile/tx \
michael@347: $RPM_BUILD_ROOT%{l_prefix}/var/asterisk/spool/outgoing \
michael@347: $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/licenses
michael@310:
michael@311: # postadjust installation
michael@311: strip $RPM_BUILD_ROOT%{l_prefix}/sbin/* \
michael@311: $RPM_BUILD_ROOT%{l_prefix}/lib/asterisk/modules/* \
michael@311: $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/agi-bin/* \
michael@311: >/dev/null 2>&1 || true
michael@310: mv $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/agi-bin \
michael@310: $RPM_BUILD_ROOT%{l_prefix}/lib/asterisk/agi-bin
michael@311:
michael@311: # install AGI progs
michael@311: ( cd agi
michael@311: %{l_shtool} install -c -m 755 %{l_value -s -a} \
michael@311: DialAnMp3.agi fastagi-test numeralize %{SOURCE wakeup.agi} \
michael@311: $RPM_BUILD_ROOT%{l_prefix}/lib/asterisk/agi-bin/
michael@311: ) || exit $?
michael@310: for bin in $RPM_BUILD_ROOT%{l_prefix}/lib/asterisk/agi-bin/*.*; do
michael@310: mv $bin `echo $bin | sed -e 's;\.[^.]*$;;'`
michael@202: done
michael@202:
michael@310: # install default configuration
michael@310: for name in `grep "^/d" -e "/<\/file>/,\$d" >$name
michael@310: %{l_shtool} install -c -m 644 %{l_value -s -a} \
michael@310: $name $RPM_BUILD_ROOT%{l_prefix}/etc/asterisk/
michael@310: done
michael@202:
michael@311: # install runcommand script
michael@202: %{l_shtool} mkdir -f -p -m 755 \
michael@202: $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
michael@202: %{l_shtool} install -c -m 755 %{l_value -s -a} \
michael@202: %{SOURCE rc.asterisk} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
michael@202:
michael@202: # determine installation files
michael@310: %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
michael@310: %{l_files_std} \
michael@362: '%config %attr(640,%{l_mgrp},%{l_rgrp}) %{l_prefix}/etc/asterisk/*' \
michael@347: '%config %attr(-,%{l_mgrp},%{l_mgrp}) %{l_prefix}/share/asterisk/licenses' \
michael@362: '%attr(750,%{l_rgrp},%{l_rgrp}) %{l_prefix}/var/asterisk/spool/facsimile' \
michael@310: '%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/asterisk'
michael@202:
michael@311: # '%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/share/asterisk/sounds/es/vm-Voicemail.sln16' \
michael@311: # '%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/share/asterisk/sounds/de/vm-Voicemail.sln16' \
michael@311: # '%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/share/asterisk/sounds/fr/vm-Voicemail.sln16' \
michael@311:
michael@202: %files -f files
michael@202:
michael@202: %clean
michael@202:
michael@202: %post
michael@310: %if "%{with_dahdi}" == "yes"
michael@310: if [ $1 -eq 1 ]; then
michael@310: case "%{l_platform -t}" in
michael@310: *-freebsd* )
michael@310: ( echo "To allow Asterisk to use the DAHDI /dev/dahdi/pseudo device(s)"
michael@310: echo "you have add the following entry to /etc/devfs.rules:"
michael@310: echo ""
michael@310: echo "[openpkg_asterisk=10]"
michael@310: echo "add path 'dahdi/pseudo*' mode 0664 user %{l_rusr} group %{l_rgrp}"
michael@310: echo ""
michael@310: ) | %{l_rpmtool} msg -b -t notice
michael@310: ;;
michael@310: esac
michael@310: fi
michael@310: %endif
michael@310: %if "%{with_odbc}" == "yes"
michael@310: # after install, optionally link into ODBC and create database
michael@310: if $RPM_INSTALL_PREFIX/bin/odbcinst -q -s -n "asterisk-sqlite" >/dev/null 2>&1; then
michael@310: :
michael@310: else
michael@310: ( echo "[asterisk-sqlite]"
michael@310: echo "Description = Asterisk SQLite Database"
michael@310: echo "Driver = SQLite3"
michael@310: echo "Database = $RPM_INSTALL_PREFIX/var/asterisk/db/asterisk.sqlite"
michael@310: echo "Timeout = 2000"
michael@310: ) | $RPM_INSTALL_PREFIX/bin/odbcinst -i -s -l -n "asterisk-sqlite" -r >/dev/null 2>&1 || true
michael@310: fi
michael@310: if [ ! -f $RPM_INSTALL_PREFIX/var/asterisk/run/asterisk.db ]; then
michael@310: ( umask 007
michael@310: echo "CREATE TABLE map (key TEXT, val TEXT);" | $RPM_INSTALL_PREFIX/bin/isql "asterisk-sqlite" -b
michael@310: chown %{l_rusr}:%{l_rgrp} $RPM_INSTALL_PREFIX/var/asterisk/db/asterisk.sqlite >/dev/null 2>&1 || true
michael@310: ) || exit $?
michael@310: fi
michael@310: %endif
michael@311: %if "%{with_fax}" == "yes"
michael@311: ( echo "Asterisk has been installed with proprietary Digium fax support."
michael@311: echo "The responsible module is called res_fax_digium and requires a"
michael@311: echo "valid license. The license must be found in the directory"
michael@362: echo "'licenses' which in turn must be found in %{l_prefix}/share/asterisk"
michael@311: echo "or wherever astvarlibdir has been configured in 'asterisk.conf'."
michael@311: echo ""
michael@311: echo "Please see http://downloads.digium.com/pub/telephony/fax/ for information."
michael@311: ) | %{l_rpmtool} msg -b -t notice
michael@311: %endif
michael@202: # after upgrade, restart service
michael@202: [ $1 -eq 2 ] || exit 0
michael@202: eval `%{l_rc} asterisk status 2>/dev/null`
michael@202: [ ".$asterisk_active" = .yes ] && %{l_rc} asterisk restart
michael@202: exit 0
michael@202:
michael@202: %preun
michael@202: # before erase, stop service and remove log files
michael@202: [ $1 -eq 0 ] || exit 0
michael@202: %{l_rc} asterisk stop 2>/dev/null
michael@310: rm -f $RPM_INSTALL_PREFIX/var/asterisk/log/* >/dev/null 2>&1 || true
michael@310: rm -f $RPM_INSTALL_PREFIX/var/asterisk/log/cdr-*/* >/dev/null 2>&1 || true
michael@310: rm -f $RPM_INSTALL_PREFIX/var/asterisk/run/* >/dev/null 2>&1 || true
michael@310: rm -f $RPM_INSTALL_PREFIX/var/asterisk/spool/*/* >/dev/null 2>&1 || true
michael@311: rm -f $RPM_INSTALL_PREFIX/var/asterisk/lib/* >/dev/null 2>&1 || true
michael@310: rm -f $RPM_INSTALL_PREFIX/var/asterisk/db/* >/dev/null 2>&1 || true
michael@310: %if "%{with_odbc}" == "yes"
michael@310: # before erase, optionally unlink from ODBC and destroy database
michael@310: $RPM_INSTALL_PREFIX/bin/odbcinst -u -s -l -n "asterisk-sqlite" >/dev/null 2>&1 || true
michael@310: %endif
michael@202: exit 0
michael@202: