asterisk/asterisk.spec

Tue, 29 Mar 2011 19:46:35 +0200

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Tue, 29 Mar 2011 19:46:35 +0200
changeset 333
4ecfc2416fd8
parent 315
75d162df42e8
child 347
10bd406e1c51
permissions
-rw-r--r--

Correct and introduce slightly needed logic, leading to better reliability:
Update bash(1) patch logic, correct several buildconf make location
errors, correct failed bash(1) configure invocation, enable perl(1) to
build with unpathed make(1), patch rpm(1) to correctly link with
internal libdb(3), and lastly unsuscessfully try to reorganize rpm patch
hunks.

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

mercurial