# Contributor: Timo Teras # Maintainer: Timo Teras pkgname=asterisk pkgver=11.6.1 pkgrel=2 pkgdesc="Asterisk: A Module Open Source PBX System" pkgusers="asterisk" pkggroups="asterisk" url="http://www.asterisk.org/" arch="all" license="GPL" depends= makedepends="autoconf automake libtool ncurses-dev popt-dev newt-dev zlib-dev postgresql-dev unixodbc-dev dahdi-tools-dev libpri-dev tar freetds-dev openssl-dev lua-dev alsa-lib-dev spandsp-dev tiff-dev libresample sqlite-dev wget speex-dev libogg-dev bluez-dev curl-dev libedit-dev util-linux-dev" install="$pkgname.pre-install $pkgname.pre-upgrade" subpackages="$pkgname-dev $pkgname-doc $pkgname-pgsql $pkgname-odbc $pkgname-tds $pkgname-fax $pkgname-sample-config:sample $pkgname-sounds-moh:sound_moh $pkgname-sounds-en:sound_en $pkgname-mobile $pkgname-curl:_curl" _download="http://downloads.asterisk.org/pub/telephony/asterisk/releases" _z=${pkgver##*.} _xy=${pkgver%.$_z} _patches="" while [ $_z -gt 0 ]; do _patches="$_download/asterisk-$_xy.$_z-patch.gz $_patches" _z=$((_z-1)) done source="$_download/asterisk-$_xy.0.tar.gz $_patches http://downloads.asterisk.org/pub/security/AST-2014-001-11.diff http://downloads.asterisk.org/pub/security/AST-2014-002-11.diff AST-2014-006-11.6.diff 100-uclibc-daemon.patch 101-caps-uclibc.patch ASTERISK-18995.patch ASTERISK-19109.patch ASTERISK-20527.patch asterisk.initd asterisk.confd asterisk.logrotate" _builddir="$srcdir/$pkgname-${pkgver/_/-}" prepare() { cd "$srcdir" if [ -n "$_patches" ]; then mv "$pkgname-$_xy.0" "$pkgname-${pkgver/_/-}" fi cd "$_builddir" for i in $source; do case $i in *.diff) msg "$i"; patch -p0 -i "$srcdir"/${i##*/} || return 1;; *.patch) msg "$i"; patch -p1 -i "$srcdir"/${i##*/} || return 1;; *-patch.gz) msg "${i##*/}"; gunzip < "$srcdir"/${i##*/} | patch -p0 || return 1;; esac done sed -i -e 's:lua5.1/::' pbx/pbx_lua.c sed -i -e 's/PBX_ICONV=1/PBX_ICONV=0/g' configure.ac sed -i -e 's/int foo = res_ninit(NULL);/res_ninit_is_not_really_here();/g' configure.ac ./bootstrap.sh } build() { cd "$_builddir" SHA1SUM="$PWD"/build_tools/sha1sum-sh ./configure \ --build=$CBUILD \ --host=$CHOST \ --prefix=/usr \ --sysconfdir=/etc \ --mandir=/usr/share/man \ --infodir=/usr/share/info \ --libdir=/usr/lib \ --localstatedir=/var \ --disable-xmldoc \ --with-gsm=internal \ --without-iconv \ --with-popt \ --with-z \ --with-newt \ --with-unixodbc \ --with-postgres \ --with-tds \ --with-dahdi \ --with-pri \ --with-tonezone \ --with-resample \ --with-sqlite3 \ --with-speex \ --with-asound \ --without-x11 \ --with-spandsp \ --with-bluetooth \ --with-libcurl \ --with-libedit \ || return 1 # and figure out which modules to build rm menuselect.makeopts make menuselect.makeopts # enable chan_mobile sed -i -e '/^MENUSELECT_ADDONS=/s/chan_mobile//' menuselect.makeopts make ASTCFLAGS="$CFLAGS" ASTLDFLAGS="$LDFLAGS" LDCONFIG_FLAGS="-n" || return 1 } package() { cd "$_builddir" make -j1 DESTDIR="$pkgdir" LDCONFIG_FLAGS="-n" install install -d "$pkgdir"/var/run/asterisk install -d "$pkgdir"/var/lib/asterisk install -m755 -D "$srcdir"/$pkgname.initd "$pkgdir"/etc/init.d/$pkgname install -m644 -D "$srcdir"/$pkgname.confd "$pkgdir"/etc/conf.d/$pkgname install -m644 -D "$srcdir"/$pkgname.logrotate \ "$pkgdir"/etc/logrotate.d/$pkgname chown -R asterisk:asterisk "$pkgdir"/var/*/asterisk chown -R asterisk:asterisk "$pkgdir"/etc/asterisk chmod -R u=rwX,g=rX,o= "$pkgdir"/etc/asterisk } _move_dir() { for DIR in "$@"; do local dest=`dirname "$subpkgdir/$DIR"` echo mkdir -p $dest mkdir -p "$dest" echo mv "$pkgdir"/$DIR $dest mv "$pkgdir"/"$DIR" "$dest" done } _find_and_move() { local pattern="$1" cd "$pkgdir" || return 1 find -name "$pattern" -type f | while read f; do local dest="$subpkgdir/${f%/*}" mkdir -p "$dest" mv "$f" "$dest" done } doc() { default_doc } dev() { default_dev depends="asterisk" } pgsql() { depends= install= _find_and_move '*_pgsql*' } odbc() { depends= install= _find_and_move '*odbc*' } tds() { depends= install= _find_and_move '*_tds*' } fax() { depends= install= _find_and_move '*_fax*' } mobile() { depends= install= _find_and_move '*_mobile*' } _curl() { depends= install= _find_and_move '*_curl*' } sample() { arch="noarch" pkgdesc="Sample configuration files for asterisk" cd "$_builddir" mkdir -p "$subpkgdir"/var/lib/asterisk/phoneprov make -j1 samples DESTDIR="$subpkgdir" chown -R asterisk:asterisk "$subpkgdir"/var/*/asterisk chown -R asterisk:asterisk "$subpkgdir"/etc/asterisk chmod -R u=rwX,g=rX,o= "$subpkgdir"/etc/asterisk } sound_moh() { arch="noarch" pkgdesc="Default on-hold music files for asterisk" depends= install= _move_dir var/lib/asterisk/moh chown -R asterisk:asterisk "$subpkgdir"/var/*/asterisk } sound_en() { arch="noarch" pkgdesc="English sound files for asterisk" depends= install= _move_dir var/lib/asterisk/sounds/en chown -R asterisk:asterisk "$subpkgdir"/var/*/asterisk } md5sums="698acb491e20990e87bbbcf1462c8538 asterisk-11.6.0.tar.gz 23b7d9325fdd1827c2414f40e818087d asterisk-11.6.1-patch.gz 3e9a5e5968a633e58b709a146751fa90 AST-2014-001-11.diff 78d3243be174884a294405e97daedd97 AST-2014-002-11.diff 10b1acf7b1d176e67263a566f672ca1f AST-2014-006-11.6.diff 837fc3bc835699462a8d2a7a16b9b6a3 100-uclibc-daemon.patch 6e1129e30c4fd2c25c86c81685a485a9 101-caps-uclibc.patch bc6713f5434e07b79d3afdd155461d72 ASTERISK-18995.patch 146befabe95798a67c58d8ac00d397a6 ASTERISK-19109.patch 676ca42ee1859d8a7bae4345ede5eb89 ASTERISK-20527.patch 74cd25a5638a94ef51e9f4ede2fd28f2 asterisk.initd ed31d7ba37bcf8b0346dcf8593c395f0 asterisk.confd 3e65172275684373e1a25c8a11224411 asterisk.logrotate" sha256sums="80aa523bdaab71ce419022d8c851aaeda718dc5bbf5fe8cb99786da546dd8cee asterisk-11.6.0.tar.gz 86e738f2f9cf9debe7c59feca44d99752627df789804678df84bd430c7b5cdca asterisk-11.6.1-patch.gz bd469f665c1a4fb65811542170a91922e935faac4b816ef302f41ddafb7604fa AST-2014-001-11.diff 85d5345a3ed8f6e993e418bffe5d991d5d04c762156274e2c5924c3045037105 AST-2014-002-11.diff d1e08d53425083ada3364646e6cfe797a0241239b09d00113fd8ba836bb298e3 AST-2014-006-11.6.diff 6f56ea997513c10fa39835e8dd11fbfb4ec0bb23f4b771963e56691b15a5c003 100-uclibc-daemon.patch c2ef786e9a8082fe8ba7b4eb2f130925cb823d100ec567909ad465c279e335bf 101-caps-uclibc.patch 7a7140156ae7fc7e833035db1e428db8d90159579cd2678c4b5cc829ded47485 ASTERISK-18995.patch d657634d4c96f42ac1a8b7103104185e8cd9d5a59e5214cc1658e01805975ce8 ASTERISK-19109.patch 1f822e618554e9962fe4599975bdcc24413e087dbd7ea4ce0305ecb7ea9bef94 ASTERISK-20527.patch 13bcc98f2a78d4dd41e810232979eb83044e9166302bfb5b971315f2a82af36f asterisk.initd d221148583b57f9c37d7160f2493f0d204ad11f7abb17e3a3534e108ad5452d7 asterisk.confd 77b253b6db71460acf9a51e87ad4c8582027a46db01a4c50fb048bada58c19d1 asterisk.logrotate" sha512sums="8f7bc0428f45ab32ba03a3e047fa95da2ab04eb701b0262c393aef1ce618df45b360a59f5d84939309ab3f68284ceb8a59eef94901e897cd688d8a3296b27886 asterisk-11.6.0.tar.gz d52b20c3ac2959a84b1879c4a697c36b46982538126b3bff1efbb0986a6eba906bab66b1b72a48ab6d21238778e0369d49f923451e0f200455a0430acca867c0 asterisk-11.6.1-patch.gz f1e53346687fbb444fb4f532c43bd156161ba79b2461d040d19e78410e2d265e305365380b77523359fb1c559bd6851d725001fffe68596b732ba69f14b1b2e2 AST-2014-001-11.diff cdf711e1e6e663eed66560956f1d85b80035339ece24f4ecb165144f0e51f7979f551aeb10e60bb9f7350b055e66305d906f230ab36e82c7ba3f05f1c4ef5e96 AST-2014-002-11.diff c3b35dbd6a32762645627f25e156e36b33fe51475025e4160efb63ba39e1dd6c6d8ce5aaf3b87883497b42c4b4e15170ae5279b890bc4f08c9d2c36f6b61346f AST-2014-006-11.6.diff 24a0d3c0ae86117ead8d2e35fc9a5945e04b9f80f3baf122337c8361c015e5ad904c206579962aefe3eb35a1fbf269515228ae5f34a801d7725d73dc235cf831 100-uclibc-daemon.patch 601681b9a33e77b33a0393a494c4140aa6c1f174c514093242a4081661bb7f78b6af867100996c97f3bf12e8dd10873dd3e116b61e2a0e04832f4ee470664368 101-caps-uclibc.patch 42b2385d88e72473fe34c63e1be8cdf7f37688649fe5bf033b5ba17627008b771aec8f0a583e9ad483a20f9e1f7c33922cb42bf5b73adc68aa43fd46c5da1daa ASTERISK-18995.patch a9a0a4199291a6ef5ebdf07daee07293d96a16a38116f6afdea61d68b167235d63b5a54e3ae45b7e11be0b9dc82863fdced1ad45110dcac29b353ddcc1d6337a ASTERISK-19109.patch 6edd8e0a1dce326aadf659c8bf8ed34083e8247b6c0f032d097c77df25feb93107375ba505e9076c084fe80676336d6c863e04c3c6808a850e24257fd7a7702d ASTERISK-20527.patch e29477aa57d88fedc96d13751f68f302d3892c70b5ea5b5a8cc85d0439335fc1a6847648447b443a074c0877718f23295e3752056a108301d340d1e2919465b1 asterisk.initd ab6b6f08ff43268cbb1abb7ed7d678949991ba495682a644bbaeb017d6adbff0a43297905fd73ae8db1786a28d5b5904f1bc253209a0e388c8a27f26c6ce14ed asterisk.confd 7591d2faf539d05d9ee4e431c78a5e20686721fd79221ad94dffeeaff9282220b09cb9aec214bd7a8d12affaec0276c9c91e6e21af8b6712c0a9502b60b02f2b asterisk.logrotate"