Fri, 22 Oct 2010 19:54:57 +0200
Correct dependencies and use a canonical package name.
michael@202 | 1 | ## |
michael@202 | 2 | ## asterisk.spec -- OpenPKG RPM Package Specification |
michael@202 | 3 | ## Copyright (c) 2000-2007 OpenPKG Foundation e.V. <http://openpkg.net/> |
michael@202 | 4 | ## Copyright (c) 2000-2007 Ralf S. Engelschall <http://engelschall.com/> |
michael@202 | 5 | ## |
michael@202 | 6 | ## Permission to use, copy, modify, and distribute this software for |
michael@202 | 7 | ## any purpose with or without fee is hereby granted, provided that |
michael@202 | 8 | ## the above copyright notice and this permission notice appear in all |
michael@202 | 9 | ## copies. |
michael@202 | 10 | ## |
michael@202 | 11 | ## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED |
michael@202 | 12 | ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF |
michael@202 | 13 | ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
michael@202 | 14 | ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR |
michael@202 | 15 | ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
michael@202 | 16 | ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
michael@202 | 17 | ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF |
michael@202 | 18 | ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
michael@202 | 19 | ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
michael@202 | 20 | ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT |
michael@202 | 21 | ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
michael@202 | 22 | ## SUCH DAMAGE. |
michael@202 | 23 | ## |
michael@202 | 24 | |
michael@202 | 25 | # package component versions |
michael@202 | 26 | %define V_langsounds 1.4.12 |
michael@202 | 27 | %define V_extrasounds 1.4.9 |
michael@202 | 28 | %define V_amoomasounds 1.4 |
michael@202 | 29 | %define V_customsounds 1.0 |
michael@202 | 30 | %define V_chan_capi 1.1.2 |
michael@202 | 31 | |
michael@202 | 32 | # package information |
michael@202 | 33 | Name: asterisk |
michael@202 | 34 | Summary: Private Branch Exchange (PBX) for VoIP |
michael@202 | 35 | URL: http://www.asterisk.org/ |
michael@202 | 36 | Vendor: Mark Spencer et al. |
michael@202 | 37 | Packager: Michael Schloh von Bennewitz |
michael@202 | 38 | Distribution: Michael Schloh von Bennewitz |
michael@202 | 39 | Class: EVAL |
michael@202 | 40 | Group: VoIP |
michael@202 | 41 | License: GPL |
michael@202 | 42 | Version: 1.4.24.1 |
michael@202 | 43 | Release: 20090422 |
michael@202 | 44 | |
michael@202 | 45 | # package options |
michael@202 | 46 | %option with_libpri yes |
michael@202 | 47 | %option with_xfersips yes |
michael@202 | 48 | %option with_proxymwi yes |
michael@202 | 49 | %option with_parseavp yes |
michael@202 | 50 | %option with_radius no |
michael@202 | 51 | %option with_sqlite no |
michael@202 | 52 | %option with_pgsql no |
michael@202 | 53 | %option with_curl no |
michael@202 | 54 | %option with_imap no |
michael@202 | 55 | %option with_astman no |
michael@202 | 56 | %option with_capi no |
michael@202 | 57 | %option with_zaptel no |
michael@202 | 58 | %option with_smdipoll 10 |
michael@202 | 59 | |
michael@202 | 60 | # list of sources |
michael@202 | 61 | Source0: http://downloads.digium.com/pub/asterisk/releases/asterisk-%{version}.tar.gz |
michael@202 | 62 | Source1: ftp://ftp.chan-capi.org/chan-capi/chan_capi-%{V_chan_capi}.tar.gz |
michael@202 | 63 | Source2: http://downloads.digium.com/pub/telephony/sounds/releases/asterisk-moh-freeplay-alaw.tar.gz |
michael@202 | 64 | Source3: http://downloads.digium.com/pub/telephony/sounds/releases/asterisk-moh-freeplay-g722.tar.gz |
michael@202 | 65 | Source4: http://downloads.digium.com/pub/telephony/sounds/releases/asterisk-moh-freeplay-g729.tar.gz |
michael@202 | 66 | Source5: http://downloads.digium.com/pub/telephony/sounds/releases/asterisk-moh-freeplay-gsm.tar.gz |
michael@202 | 67 | Source6: http://downloads.digium.com/pub/telephony/sounds/releases/asterisk-moh-freeplay-ulaw.tar.gz |
michael@202 | 68 | Source7: http://downloads.digium.com/pub/telephony/sounds/releases/asterisk-extra-sounds-en-alaw-%{V_extrasounds}.tar.gz |
michael@202 | 69 | Source8: http://downloads.digium.com/pub/telephony/sounds/releases/asterisk-extra-sounds-en-g722-%{V_extrasounds}.tar.gz |
michael@202 | 70 | Source9: http://downloads.digium.com/pub/telephony/sounds/releases/asterisk-extra-sounds-en-g729-%{V_extrasounds}.tar.gz |
michael@202 | 71 | Source10: http://downloads.digium.com/pub/telephony/sounds/releases/asterisk-extra-sounds-en-gsm-%{V_extrasounds}.tar.gz |
michael@202 | 72 | Source11: http://downloads.digium.com/pub/telephony/sounds/releases/asterisk-extra-sounds-en-ulaw-%{V_extrasounds}.tar.gz |
michael@202 | 73 | Source12: http://downloads.digium.com/pub/telephony/sounds/releases/asterisk-core-sounds-en-alaw-%{V_langsounds}.tar.gz |
michael@202 | 74 | Source13: http://downloads.digium.com/pub/telephony/sounds/releases/asterisk-core-sounds-en-g722-%{V_langsounds}.tar.gz |
michael@202 | 75 | Source14: http://downloads.digium.com/pub/telephony/sounds/releases/asterisk-core-sounds-en-g729-%{V_langsounds}.tar.gz |
michael@202 | 76 | Source15: http://downloads.digium.com/pub/telephony/sounds/releases/asterisk-core-sounds-en-gsm-%{V_langsounds}.tar.gz |
michael@202 | 77 | Source16: http://downloads.digium.com/pub/telephony/sounds/releases/asterisk-core-sounds-en-ulaw-%{V_langsounds}.tar.gz |
michael@202 | 78 | Source17: http://downloads.digium.com/pub/telephony/sounds/releases/asterisk-core-sounds-es-alaw-%{V_langsounds}.tar.gz |
michael@202 | 79 | Source18: http://downloads.digium.com/pub/telephony/sounds/releases/asterisk-core-sounds-es-g722-%{V_langsounds}.tar.gz |
michael@202 | 80 | Source19: http://downloads.digium.com/pub/telephony/sounds/releases/asterisk-core-sounds-es-g729-%{V_langsounds}.tar.gz |
michael@202 | 81 | Source20: http://downloads.digium.com/pub/telephony/sounds/releases/asterisk-core-sounds-es-gsm-%{V_langsounds}.tar.gz |
michael@202 | 82 | Source21: http://downloads.digium.com/pub/telephony/sounds/releases/asterisk-core-sounds-es-ulaw-%{V_langsounds}.tar.gz |
michael@202 | 83 | Source22: http://downloads.digium.com/pub/telephony/sounds/releases/asterisk-core-sounds-fr-alaw-%{V_langsounds}.tar.gz |
michael@202 | 84 | Source23: http://downloads.digium.com/pub/telephony/sounds/releases/asterisk-core-sounds-fr-g722-%{V_langsounds}.tar.gz |
michael@202 | 85 | Source24: http://downloads.digium.com/pub/telephony/sounds/releases/asterisk-core-sounds-fr-g729-%{V_langsounds}.tar.gz |
michael@202 | 86 | Source25: http://downloads.digium.com/pub/telephony/sounds/releases/asterisk-core-sounds-fr-gsm-%{V_langsounds}.tar.gz |
michael@202 | 87 | Source26: http://downloads.digium.com/pub/telephony/sounds/releases/asterisk-core-sounds-fr-ulaw-%{V_langsounds}.tar.gz |
michael@202 | 88 | Source27: http://www.amooma.de/asterisk/sprachbausteine/asterisk-%{V_amoomasounds}-de-prompts.tar.gz |
michael@202 | 89 | Source28: http://www.amooma.de/asterisk/sprachbausteine/asterisk-core-sounds-de-gsm-current.tar.gz |
michael@202 | 90 | Source29: ftp://ftp.europalab.com/pub/sfw/machsnds/de-digits/de-digits-%{V_customsounds}.tar.bz2 |
michael@202 | 91 | Source30: asterisk.conf |
michael@202 | 92 | Source31: amd.conf |
michael@202 | 93 | Source32: capi.conf |
michael@202 | 94 | Source33: cdr.conf |
michael@202 | 95 | Source34: cdr_custom.conf |
michael@202 | 96 | Source35: codecs.conf |
michael@202 | 97 | Source36: dundi.conf |
michael@202 | 98 | Source37: enum.conf |
michael@202 | 99 | Source38: extensions.conf |
michael@202 | 100 | Source39: features.conf |
michael@202 | 101 | Source40: festival.conf |
michael@202 | 102 | Source41: followme.conf |
michael@202 | 103 | Source42: indications.conf |
michael@202 | 104 | Source33: logger.conf |
michael@202 | 105 | Source34: manager.conf |
michael@202 | 106 | Source45: meetme.conf |
michael@202 | 107 | Source46: misdn.conf |
michael@202 | 108 | Source47: modules.conf |
michael@202 | 109 | Source48: musiconhold.conf |
michael@202 | 110 | Source49: privacy.conf |
michael@202 | 111 | Source50: rpt.conf |
michael@202 | 112 | Source51: rtp.conf |
michael@202 | 113 | Source52: say.conf |
michael@202 | 114 | Source53: sip.conf |
michael@202 | 115 | Source54: sip_notify.conf |
michael@202 | 116 | Source55: sla.conf |
michael@202 | 117 | Source56: voicemail.conf |
michael@202 | 118 | Source57: zapata.conf |
michael@202 | 119 | Source58: rc.asterisk |
michael@202 | 120 | Source59: wakeup.agi |
michael@202 | 121 | Patch0: asterisk.patch |
michael@202 | 122 | Patch1: asterisk.patch.xfersips |
michael@202 | 123 | Patch2: asterisk.patch.proxymwi |
michael@202 | 124 | Patch3: asterisk.patch.parseavp |
michael@202 | 125 | |
michael@202 | 126 | # build information |
michael@202 | 127 | Prefix: %{l_prefix} |
michael@202 | 128 | BuildRoot: %{l_buildroot} |
michael@202 | 129 | BuildPreReq: OpenPKG, openpkg >= 20040130, pkgconfig, awk, grep |
michael@202 | 130 | PreReq: OpenPKG, openpkg >= 20040130 |
michael@202 | 131 | BuildPreReq: ncurses, openssl, zlib |
michael@202 | 132 | PreReq: ncurses, openssl, zlib |
michael@202 | 133 | BuildPreReq: speex, vorbis-libs, sox |
michael@202 | 134 | PreReq: speex, vorbis-libs, sox |
michael@202 | 135 | %if "%{with_libpri}" == "yes" |
michael@202 | 136 | BuildPreReq: libpri |
michael@202 | 137 | PreReq: libpri |
michael@202 | 138 | %endif |
michael@202 | 139 | %if "%{with_radius}" == "yes" |
michael@202 | 140 | BuildPreReq: radiusclient |
michael@202 | 141 | PreReq: radiusclient |
michael@202 | 142 | %endif |
michael@202 | 143 | %if "%{with_sqlite}" == "yes" |
michael@202 | 144 | BuildPreReq: sqlite |
michael@202 | 145 | PreReq: sqlite |
michael@202 | 146 | %endif |
michael@202 | 147 | %if "%{with_pgsql}" == "yes" |
michael@202 | 148 | BuildPreReq: postgresql |
michael@202 | 149 | PreReq: postgresql |
michael@202 | 150 | %endif |
michael@202 | 151 | %if "%{with_curl}" == "yes" |
michael@202 | 152 | BuildPreReq: curl |
michael@202 | 153 | PreReq: curl |
michael@202 | 154 | %endif |
michael@202 | 155 | %if "%{with_imap}" == "yes" |
michael@202 | 156 | BuildPreReq: imap |
michael@202 | 157 | PreReq: imap |
michael@202 | 158 | %endif |
michael@202 | 159 | %if "%{with_astman}" == "yes" |
michael@202 | 160 | BuildPreReq: newt |
michael@202 | 161 | PreReq: newt |
michael@202 | 162 | %endif |
michael@202 | 163 | AutoReq: no |
michael@202 | 164 | AutoReqProv: no |
michael@202 | 165 | |
michael@202 | 166 | %description |
michael@202 | 167 | Asterisk is a complete Private Branch Exchange (PBX) in software. |
michael@202 | 168 | It provides all of the features you would expect from a PBX and |
michael@202 | 169 | more. Asterisk does Voice over IP (VoIP) in many protocols. Asterisk |
michael@202 | 170 | provides Voicemail services with Directory, Call Conferencing, |
michael@202 | 171 | Interactive Voice Response and Call Queuing. It has support for |
michael@202 | 172 | three-way calling, caller ID services, ADSI, SIP, etc. Asterisk |
michael@202 | 173 | needs no additional hardware for VoIP. |
michael@202 | 174 | |
michael@202 | 175 | This copy of Asterisk is optionally patched to allow the asterisk |
michael@202 | 176 | server to respond to SIP/TLS transfer requests using the Transfer() |
michael@202 | 177 | application. Should this option be chosen, the asterisk server |
michael@202 | 178 | successfully dispatches all transfer destinations using 'SIPS' |
michael@202 | 179 | technology by means of the standard SIP/2.0 302 Moved Temporarily |
michael@202 | 180 | message, with a URI resembling <sips:extension@hostname.tld:port>. |
michael@202 | 181 | |
michael@202 | 182 | This copy of Asterisk is optionally patched as well to enclose the |
michael@202 | 183 | correct user name in NOTIFY messages when MWI logic detects changes |
michael@202 | 184 | in the state of Messages-Waiting. Asterisk will send NOTIFY messages |
michael@202 | 185 | with the URI 'user@hostname' instead of simply 'hostname'. This can |
michael@202 | 186 | be used by a external SIP proxy to route the MWI to the correct phone. |
michael@202 | 187 | |
michael@202 | 188 | %track |
michael@202 | 189 | prog asterisk = { |
michael@202 | 190 | version = %{version} |
michael@202 | 191 | url = http://downloads.digium.com/pub/asterisk/releases/ |
michael@202 | 192 | regex = asterisk-(__VER__)\.tar\.gz |
michael@202 | 193 | } |
michael@202 | 194 | |
michael@202 | 195 | %prep |
michael@202 | 196 | %setup -q -n asterisk-%{version} |
michael@202 | 197 | %setup -q -n asterisk-%{version} -D -T -a 1 |
michael@202 | 198 | %patch -p0 |
michael@202 | 199 | %if "%{with_xfersips}" == "yes" |
michael@202 | 200 | %patch -p0 -P 1 |
michael@202 | 201 | %endif |
michael@202 | 202 | %if "%{with_proxymwi}" == "yes" |
michael@202 | 203 | %patch -p0 -P 2 |
michael@202 | 204 | %endif |
michael@202 | 205 | %if "%{with_parseavp}" == "yes" |
michael@202 | 206 | %patch -p0 -P 3 |
michael@202 | 207 | %endif |
michael@202 | 208 | |
michael@202 | 209 | # link install-sh to where Makefiles expect it |
michael@202 | 210 | for dir in agi utils res channels pbx apps codecs formats cdr funcs main; do |
michael@202 | 211 | ( cd $dir && ln -s ../install-sh ) || exit $? |
michael@202 | 212 | done |
michael@202 | 213 | |
michael@202 | 214 | # apply corrections |
michael@202 | 215 | case "%{l_platform -t}" in |
michael@202 | 216 | *-sunos* ) |
michael@202 | 217 | %{l_shtool} subst \ |
michael@202 | 218 | -e 's|\(tmp->tm_gmtoff = ttisp->tt_gmtoff;\)|/*\1*/|' \ |
michael@202 | 219 | main/stdtime/localtime.c |
michael@202 | 220 | ;; |
michael@202 | 221 | esac |
michael@202 | 222 | %{l_shtool} subst \ |
michael@202 | 223 | -e 's;sysconfdir=/etc;true;' \ |
michael@202 | 224 | -e 's;mandir=/usr/share/man;true;' \ |
michael@202 | 225 | -e 's;localstatedir=/var;true;' \ |
michael@202 | 226 | -e 's;\(radiusclient\)-ng;\1;g' \ |
michael@202 | 227 | -e 's;\(\-lsqlite\);\13;g' \ |
michael@202 | 228 | -e 's;\(sqlite\)\(\.h\);\13\2;g' \ |
michael@202 | 229 | -e 's;\(sqlite\)\(_exec\);\13\2;g' \ |
michael@202 | 230 | -e 's;^\(LIBS="-lvorbis\);\1 ${OGG_LIB};' \ |
michael@202 | 231 | -e 's;\(#include <\${NCURSES_DIR}/include\);\1/ncurses;' \ |
michael@202 | 232 | -e 's;-I${IMAP_TK_DIR}/c-client;-I${IMAP_TK_DIR}/include/imap;g' \ |
michael@202 | 233 | -e 's;${IMAP_TK_DIR}/c-client/c-client\.a;-limap -lssl -lcrypto -lcrypt;g' \ |
michael@202 | 234 | configure |
michael@202 | 235 | %{l_shtool} subst \ |
michael@202 | 236 | -e 's; *-I/usr/local/ssl/include;;g' \ |
michael@202 | 237 | -e 's;/opt/ssl/include;%{l_prefix}/include;g' \ |
michael@202 | 238 | -e 's;/usr/local;%{l_prefix};g' \ |
michael@202 | 239 | -e 's;^\(MOD_SUBDIR_CFLAGS=.*\ *\)$;\1 -I%{l_prefix}/include;' \ |
michael@202 | 240 | -e 's;^\( *ASTETCDIR\)=.*;\1=$(sysconfdir)/asterisk;g' \ |
michael@202 | 241 | -e 's;^\( *ASTLIBDIR\)=.*;\1=$(libdir)/asterisk;g' \ |
michael@202 | 242 | -e 's;^\( *ASTHEADERDIR\)=.*;\1=$(includedir)/asterisk;g' \ |
michael@202 | 243 | -e 's;^\( *ASTBINDIR\)=.*;\1=$(bindir);g' \ |
michael@202 | 244 | -e 's;^\( *ASTSBINDIR\)=.*;\1=$(sbindir);g' \ |
michael@202 | 245 | -e 's;^\( *ASTSPOOLDIR\)=.*;\1=$(localstatedir)/asterisk/spool;g' \ |
michael@202 | 246 | -e 's;^\( *ASTLOGDIR\)=.*;\1=$(localstatedir)/asterisk/log;g' \ |
michael@202 | 247 | -e 's;^\( *ASTVARRUNDIR\)=.*;\1=$(localstatedir)/asterisk/run;g' \ |
michael@202 | 248 | -e 's;^\( *ASTMANDIR\)=.*;\1=$(mandir);g' \ |
michael@202 | 249 | -e 's;^\( *ASTVARLIBDIR\)=.*;\1=$(localstatedir)/asterisk/lib;g' \ |
michael@202 | 250 | -e 's;^\( *ASTVARRUNDIR\)=.*;\1=$(localstatedir)/asterisk/run;g' \ |
michael@202 | 251 | -e 's;^\( *ASTDATADIR\):*=.*;\1=$(datadir)/asterisk;g' \ |
michael@202 | 252 | -e 's/\(for f in\) \(\$(OLDMODS); do \\\)$/\1 "warning:" \2/' \ |
michael@202 | 253 | Makefile |
michael@202 | 254 | #-e 's;\(ASTSPOOLDIR=\$(localstatedir)\)\(/spool\)\(/asterisk\);\1\3\2;' \ |
michael@202 | 255 | #-e 's;\(ASTLOGDIR=\$(localstatedir)\)\(/log\)\(/asterisk\);\1\3\2;' \ |
michael@202 | 256 | #-e 's;\(ASTVARRUNDIR=\$(localstatedir)\)\(/run\);\1/asterisk\2;' \ |
michael@202 | 257 | #-e 's;\(ASTVARRUNDIR=\$(localstatedir)\)\(/run\)\(/asterisk\);\1\3\2;' \ |
michael@202 | 258 | #-e 's;\(ASTVARLIBDIR=\$(localstatedir)\)\(/lib\)\(/asterisk\);\1\3\2;' \ |
michael@202 | 259 | #-e 's;\(ASTDATADIR:=\)\$(ASTVARLIBDIR);\1$(prefix)/share/asterisk;' \ |
michael@202 | 260 | #Makefile |
michael@202 | 261 | %{l_shtool} subst \ |
michael@202 | 262 | -e 's; *-L/usr/local/ssl/lib;;g' \ |
michael@202 | 263 | -e 's;/opt/ssl/lib;%{l_prefix}/lib;g' \ |
michael@202 | 264 | -e 's;/usr/local;%{l_prefix};g' \ |
michael@202 | 265 | -e 's;\(ASTLINK=\)$;\1-Wl,--export-dynamic;g' \ |
michael@202 | 266 | main/Makefile |
michael@202 | 267 | %{l_shtool} subst \ |
michael@202 | 268 | -e 's;LOG_WARNING\(, "Failed to perform seek\);LOG_DEBUG\1;g' \ |
michael@202 | 269 | main/channel.c |
michael@202 | 270 | %{l_shtool} subst \ |
michael@202 | 271 | -e 's;LOG_WARNING\(, "[^ ][^ ]* is not supported\);LOG_DEBUG\1;g' \ |
michael@202 | 272 | formats/format_ogg_vorbis.c |
michael@202 | 273 | %{l_shtool} subst \ |
michael@202 | 274 | -e 's;\(/etc/radiusclient-ng/radiusclient.conf\);%{l_prefix}\1;g' \ |
michael@202 | 275 | -e 's;\(radiusclient\)-ng;\1;g' \ |
michael@202 | 276 | cdr/cdr_radius.c |
michael@202 | 277 | %{l_shtool} subst \ |
michael@202 | 278 | -e 's;\(sqlite\)\(\.h\);\13\2;g' \ |
michael@202 | 279 | cdr/cdr_sqlite.c |
michael@202 | 280 | %{l_shtool} subst \ |
michael@202 | 281 | -e 's;\(#define DEFAULT_POLLING_INTERVAL\) *.*;\1 %{with_smdipoll};' \ |
michael@202 | 282 | res/res_smdi.c |
michael@202 | 283 | %{l_shtool} subst \ |
michael@202 | 284 | -e 's;\(ASTERISK_HEADER_DIR=\).*;\1%{l_prefix}/include;g' \ |
michael@202 | 285 | -e 's;\(MODULES_DIR=\).*;\1%{l_prefix}/lib/asterisk/modules;g' \ |
michael@202 | 286 | -e 's;\(CONFIG_DIR=\).*;\1%{l_prefix}/etc/asterisk;g' \ |
michael@202 | 287 | -e 's;\(\$(MODULES_DIR)\);$(DESTDIR)\1;g' \ |
michael@202 | 288 | -e 's;\${CONFIG_DIR};$(DESTDIR)$(CONFIG_DIR);g' \ |
michael@202 | 289 | chan_capi-%{V_chan_capi}/Makefile |
michael@202 | 290 | |
michael@202 | 291 | # # optionally specify CPU |
michael@202 | 292 | # %{l_shtool} subst \ |
michael@202 | 293 | # -e 's;build_cpu=\$1;build_cpu=i586;' \ |
michael@202 | 294 | # -e 's;host_cpu=\$1;host_cpu=i586;' \ |
michael@202 | 295 | # configure |
michael@202 | 296 | |
michael@202 | 297 | %build |
michael@202 | 298 | # apply platform build rules |
michael@202 | 299 | libs="`pkg-config openssl speex --libs-only-l`" |
michael@202 | 300 | %if "%{with_curl}" == "yes" |
michael@202 | 301 | libs="$libs `pkg-config libcurl --libs-only-l`" |
michael@202 | 302 | %endif |
michael@202 | 303 | %if "%{with_sqlite}" == "yes" |
michael@202 | 304 | libs="$libs `pkg-config sqlite3 --libs-only-l`" |
michael@202 | 305 | %endif |
michael@202 | 306 | %if "%{with_pgsql}" == "yes" |
michael@202 | 307 | libs="-lpq $libs" |
michael@202 | 308 | %endif |
michael@202 | 309 | %if "%{with_radius}" == "yes" |
michael@202 | 310 | libs="$libs -lradiusclient" |
michael@202 | 311 | %endif |
michael@202 | 312 | %if "%{with_libpri}" == "yes" |
michael@202 | 313 | libs="$libs -lpri" |
michael@202 | 314 | %endif |
michael@202 | 315 | case "%{l_platform -t}" in |
michael@202 | 316 | *-linux* ) libs="$libs -lrt" ;; |
michael@202 | 317 | *-sunos* ) libs="$libs -lrt" ;; |
michael@202 | 318 | esac |
michael@202 | 319 | |
michael@202 | 320 | # configure package |
michael@202 | 321 | CC="%{l_cc}" \ |
michael@202 | 322 | CFLAGS="%{l_cflags -O}" \ |
michael@202 | 323 | %if "%{with_imap}" == "yes" |
michael@202 | 324 | CPPFLAGS="%{l_cppflags imap ncurses}" \ |
michael@202 | 325 | %else |
michael@202 | 326 | CPPFLAGS="%{l_cppflags ncurses}" \ |
michael@202 | 327 | %endif |
michael@202 | 328 | LDFLAGS="%{l_ldflags}" \ |
michael@202 | 329 | LIBS="$libs" \ |
michael@202 | 330 | ./configure \ |
michael@202 | 331 | --prefix=%{l_prefix} \ |
michael@202 | 332 | --mandir=%{l_prefix}/man \ |
michael@202 | 333 | --with-ncurses=%{l_prefix} \ |
michael@202 | 334 | %if "%{with_libpri}" == "yes" |
michael@202 | 335 | --with-pri=%{l_prefix} \ |
michael@202 | 336 | %else |
michael@202 | 337 | --with-pri=no \ |
michael@202 | 338 | %endif |
michael@202 | 339 | --with-ssl=%{l_prefix} \ |
michael@202 | 340 | %if "%{with_radius}" == "yes" |
michael@202 | 341 | --with-radius=%{l_prefix} \ |
michael@202 | 342 | %else |
michael@202 | 343 | --with-radius=no \ |
michael@202 | 344 | %endif |
michael@202 | 345 | %if "%{with_sqlite}" == "yes" |
michael@202 | 346 | --with-sqlite=%{l_prefix} \ |
michael@202 | 347 | %else |
michael@202 | 348 | --with-sqlite=no \ |
michael@202 | 349 | %endif |
michael@202 | 350 | %if "%{with_postgresql}" == "yes" |
michael@202 | 351 | --with-postgres=%{l_prefix} \ |
michael@202 | 352 | %else |
michael@202 | 353 | --with-postgres=no \ |
michael@202 | 354 | %endif |
michael@202 | 355 | %if "%{with_curl}" == "yes" |
michael@202 | 356 | --with-curl=%{l_prefix} \ |
michael@202 | 357 | %else |
michael@202 | 358 | --with-curl=no \ |
michael@202 | 359 | %endif |
michael@202 | 360 | %if "%{with_imap}" == "yes" |
michael@202 | 361 | --with-imap=%{l_prefix} \ |
michael@202 | 362 | --disable-largefile \ |
michael@202 | 363 | %else |
michael@202 | 364 | --with-imap=no \ |
michael@202 | 365 | %endif |
michael@202 | 366 | %if "%{with_astman}" == "yes" |
michael@202 | 367 | --with-newt=%{l_prefix} \ |
michael@202 | 368 | %else |
michael@202 | 369 | --with-newt=no \ |
michael@202 | 370 | %endif |
michael@202 | 371 | --with-speex=%{l_prefix} \ |
michael@202 | 372 | --with-speexdsp=%{l_prefix} \ |
michael@202 | 373 | --with-ogg=%{l_prefix} \ |
michael@202 | 374 | --with-vorbis=%{l_prefix} \ |
michael@202 | 375 | --with-z=%{l_prefix} |
michael@202 | 376 | |
michael@202 | 377 | # build package |
michael@202 | 378 | %{l_make} %{l_mflags -O} menuselect/menuselect menuselect-tree |
michael@202 | 379 | menuselect/menuselect --check-deps menuselect.makeopts |
michael@202 | 380 | %{l_shtool} subst \ |
michael@202 | 381 | -e 's;\(MENUSELECT_MOH=\).*;\1;' \ |
michael@202 | 382 | -e 's;\(MENUSELECT_CORE_SOUNDS=\).*;\1;' \ |
michael@202 | 383 | -e 's;\(MENUSELECT_EXTRA_SOUNDS=\).*;\1;' \ |
michael@202 | 384 | menuselect.makeopts |
michael@202 | 385 | %if "%{with_imap}" == "yes" |
michael@202 | 386 | %{l_shtool} subst \ |
michael@202 | 387 | -e 's;\(MENUSELECT_OPTS_app_voicemail=\)$;\1IMAP_STORAGE;' \ |
michael@202 | 388 | menuselect.makeopts |
michael@202 | 389 | %endif |
michael@202 | 390 | %{l_make} %{l_mflags -O} EXTLIBS="$libs" NOISY_BUILD=yes |
michael@202 | 391 | %if "%{with_capi}" == "yes" |
michael@202 | 392 | ( cd chan_capi-%{V_chan_capi} |
michael@202 | 393 | %{l_make} %{l_mflags -O} |
michael@202 | 394 | ) || exit $? |
michael@202 | 395 | %endif |
michael@202 | 396 | |
michael@202 | 397 | %install |
michael@202 | 398 | rm -rf $RPM_BUILD_ROOT |
michael@202 | 399 | |
michael@202 | 400 | # install package |
michael@202 | 401 | %{l_make} %{l_mflags} install DESTDIR=$RPM_BUILD_ROOT |
michael@202 | 402 | %if "%{with_capi}" == "yes" |
michael@202 | 403 | ( cd chan_capi-%{V_chan_capi} |
michael@202 | 404 | %{l_make} %{l_mflags} install samples DESTDIR=$RPM_BUILD_ROOT |
michael@202 | 405 | ) || exit $? |
michael@202 | 406 | %endif |
michael@202 | 407 | |
michael@202 | 408 | # install all sound prompt files |
michael@202 | 409 | for codec in alaw ulaw g722 g729 gsm; do |
michael@202 | 410 | for lang in es fr; do |
michael@202 | 411 | ( cd $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds/${lang} |
michael@202 | 412 | %{l_tar} zxf %{_sourcedir}/asterisk-core-sounds-${lang}-${codec}-%{V_langsounds}.tar.gz |
michael@202 | 413 | ) || exit $? |
michael@202 | 414 | done |
michael@202 | 415 | ( cd $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds |
michael@202 | 416 | %{l_tar} zxf %{_sourcedir}/asterisk-extra-sounds-en-${codec}-%{V_extrasounds}.tar.gz |
michael@202 | 417 | %{l_tar} zxf %{_sourcedir}/asterisk-core-sounds-en-${codec}-%{V_langsounds}.tar.gz |
michael@202 | 418 | ) || exit $? |
michael@202 | 419 | done |
michael@202 | 420 | |
michael@202 | 421 | # install special case sound files |
michael@202 | 422 | ( cd $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds |
michael@202 | 423 | %{l_tar} jxf %{SOURCE de-digits-%{V_customsounds}.tar.bz2} |
michael@202 | 424 | %{l_tar} zxf %{SOURCE asterisk-core-sounds-de-gsm-current.tar.gz} |
michael@202 | 425 | cd de |
michael@202 | 426 | %{l_tar} zxf %{_sourcedir}/asterisk-%{V_amoomasounds}-de-prompts.tar.gz |
michael@202 | 427 | mv -f de/* . && rm -rf de |
michael@202 | 428 | mv -f dictate/de/* letters/ && rm -rf dictate/de |
michael@202 | 429 | mv -f digits/de/* letters/ && rm -rf digits/de |
michael@202 | 430 | mv -f letters/de/* letters/ && rm -rf letters/de |
michael@202 | 431 | mv -f phonetic/de/* letters/ && rm -rf phonetic/de |
michael@202 | 432 | ) || exit $? |
michael@202 | 433 | |
michael@202 | 434 | # install additional music on hold files |
michael@202 | 435 | ( cd $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/moh |
michael@202 | 436 | for codec in alaw ulaw g722 g729 gsm; do |
michael@202 | 437 | %{l_tar} zxf %{_sourcedir}/asterisk-moh-freeplay-${codec}.tar.gz |
michael@202 | 438 | done |
michael@202 | 439 | ) || exit $? |
michael@202 | 440 | |
michael@202 | 441 | # # install nonstandard voicemail prompts |
michael@202 | 442 | # %{l_shtool} mkdir -f -p -m 755 \ |
michael@202 | 443 | # $RPM_BUILD_ROOT%{l_prefix}/var/asterisk/spool/voicemail/default/%{exten}/unavail |
michael@202 | 444 | # %{l_shtool} install -c -m 660 \ |
michael@202 | 445 | # %{_sourcedir}/ansage-%{V_ansage}.wav} \ |
michael@202 | 446 | # $RPM_BUILD_ROOT%{l_prefix}/var/asterisk/spool/voicemail/default/%{exten}/unavail.wav |
michael@202 | 447 | |
michael@202 | 448 | # install default configuration |
michael@202 | 449 | %{l_shtool} install -c -m 660 %{l_value -s -a} \ |
michael@202 | 450 | %{SOURCE asterisk.conf} \ |
michael@202 | 451 | %{SOURCE amd.conf} \ |
michael@202 | 452 | %{SOURCE cdr.conf} \ |
michael@202 | 453 | %{SOURCE codecs.conf} \ |
michael@202 | 454 | %{SOURCE extensions.conf} \ |
michael@202 | 455 | %{SOURCE features.conf} \ |
michael@202 | 456 | %{SOURCE festival.conf} \ |
michael@202 | 457 | %{SOURCE followme.conf} \ |
michael@202 | 458 | %{SOURCE indications.conf} \ |
michael@202 | 459 | %{SOURCE logger.conf} \ |
michael@202 | 460 | %{SOURCE manager.conf} \ |
michael@202 | 461 | %{SOURCE meetme.conf} \ |
michael@202 | 462 | %{SOURCE modules.conf} \ |
michael@202 | 463 | %{SOURCE musiconhold.conf} \ |
michael@202 | 464 | %{SOURCE rtp.conf} \ |
michael@202 | 465 | %{SOURCE sip.conf} \ |
michael@202 | 466 | %{SOURCE sla.conf} \ |
michael@202 | 467 | %{SOURCE voicemail.conf} \ |
michael@202 | 468 | %{SOURCE zapata.conf} \ |
michael@202 | 469 | $RPM_BUILD_ROOT%{l_prefix}/etc/asterisk/ |
michael@202 | 470 | |
michael@202 | 471 | # install runcommand script |
michael@202 | 472 | %{l_shtool} mkdir -f -p -m 755 \ |
michael@202 | 473 | $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d |
michael@202 | 474 | %{l_shtool} install -c -m 755 %{l_value -s -a} \ |
michael@202 | 475 | %{SOURCE rc.asterisk} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/ |
michael@202 | 476 | |
michael@202 | 477 | # install additional AGI scripts |
michael@202 | 478 | %{l_shtool} install -c -m 755 %{l_value -s -a} \ |
michael@202 | 479 | %{SOURCE wakeup.agi} $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/agi-bin/ |
michael@202 | 480 | |
michael@202 | 481 | # correct installation hierarchy |
michael@202 | 482 | %{l_shtool} mkdir -f -p -m 755 \ |
michael@202 | 483 | $RPM_BUILD_ROOT%{l_prefix}/var/asterisk/lib \ |
michael@202 | 484 | $RPM_BUILD_ROOT%{l_prefix}/var/asterisk/spool/outgoing |
michael@202 | 485 | |
michael@202 | 486 | # remove unused components |
michael@202 | 487 | rm -rf \ |
michael@202 | 488 | $RPM_BUILD_ROOT%{l_prefix}/bin \ |
michael@202 | 489 | $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/images \ |
michael@202 | 490 | $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds/de/.DS_Store \ |
michael@202 | 491 | $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds/de/autogen.sh \ |
michael@202 | 492 | >/dev/null 2>&1 || true |
michael@202 | 493 | |
michael@202 | 494 | # adjust inconsistent names |
michael@202 | 495 | for bin in $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/agi-bin/*.*; do |
michael@202 | 496 | mv $bin `echo $bin | sed -e 's;\.[^.]*$;;'` |
michael@202 | 497 | done |
michael@202 | 498 | |
michael@202 | 499 | # strip down installation |
michael@202 | 500 | strip $RPM_BUILD_ROOT%{l_prefix}/bin/* \ |
michael@202 | 501 | $RPM_BUILD_ROOT%{l_prefix}/sbin/* \ |
michael@202 | 502 | $RPM_BUILD_ROOT%{l_prefix}/lib/asterisk/modules/* \ |
michael@202 | 503 | $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/agi-bin/* \ |
michael@202 | 504 | >/dev/null 2>&1 || true |
michael@202 | 505 | |
michael@202 | 506 | # determine installation files |
michael@202 | 507 | %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT %{l_files_std} \ |
michael@202 | 508 | '%config %attr(660,%{l_musr},%{l_rgrp}) %{l_prefix}/etc/asterisk/*' \ |
michael@202 | 509 | '%config %attr(644,%{l_musr},%{l_mgrp}) %{l_prefix}/share/asterisk/sounds/de/*' \ |
michael@202 | 510 | '%config %attr(755,%{l_musr},%{l_mgrp}) %{l_prefix}/share/asterisk/sounds/de/dictate' \ |
michael@202 | 511 | '%config %attr(755,%{l_musr},%{l_mgrp}) %{l_prefix}/share/asterisk/sounds/de/digits' \ |
michael@202 | 512 | '%config %attr(755,%{l_musr},%{l_mgrp}) %{l_prefix}/share/asterisk/sounds/de/followme' \ |
michael@202 | 513 | '%config %attr(755,%{l_musr},%{l_mgrp}) %{l_prefix}/share/asterisk/sounds/de/letters' \ |
michael@202 | 514 | '%config %attr(755,%{l_musr},%{l_mgrp}) %{l_prefix}/share/asterisk/sounds/de/phonetic' \ |
michael@202 | 515 | '%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/asterisk/*' \ |
michael@202 | 516 | '%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/asterisk/*/*' |
michael@202 | 517 | |
michael@202 | 518 | %files -f files |
michael@202 | 519 | |
michael@202 | 520 | %clean |
michael@202 | 521 | rm -rf $RPM_BUILD_ROOT |
michael@202 | 522 | |
michael@202 | 523 | %post |
michael@202 | 524 | # after upgrade, restart service |
michael@202 | 525 | [ $1 -eq 2 ] || exit 0 |
michael@202 | 526 | eval `%{l_rc} asterisk status 2>/dev/null` |
michael@202 | 527 | [ ".$asterisk_active" = .yes ] && %{l_rc} asterisk restart |
michael@202 | 528 | exit 0 |
michael@202 | 529 | |
michael@202 | 530 | %preun |
michael@202 | 531 | # before erase, stop service and remove log files |
michael@202 | 532 | [ $1 -eq 0 ] || exit 0 |
michael@202 | 533 | %{l_rc} asterisk stop 2>/dev/null |
michael@202 | 534 | rm -f $RPM_INSTALL_PREFIX/var/asterisk/lib/* >/dev/null 2>&1 || true |
michael@202 | 535 | rm -f $RPM_INSTALL_PREFIX/var/asterisk/log/* >/dev/null 2>&1 || true |
michael@202 | 536 | rm -f $RPM_INSTALL_PREFIX/var/asterisk/log/cdr-*/* >/dev/null 2>&1 || true |
michael@202 | 537 | rm -f $RPM_INSTALL_PREFIX/var/asterisk/run/* >/dev/null 2>&1 || true |
michael@202 | 538 | for deldir in meetme outgoing system tmp; do |
michael@202 | 539 | rm -rf \ |
michael@202 | 540 | $RPM_INSTALL_PREFIX/var/asterisk/spool/$deldir \ |
michael@202 | 541 | >/dev/null 2>&1 || true |
michael@202 | 542 | done |
michael@202 | 543 | exit 0 |
michael@202 | 544 |