# Contributor: Ɓukasz Jendrysik # Contributor: Timo Teras # Maintainer: Timo Teras pkgname=asterisk pkgver=13.3.2 pkgrel=0 pkgdesc="Asterisk: A Module Open Source PBX System" pkgusers="asterisk" pkggroups="asterisk" url="http://www.asterisk.org/" arch="all" license="GPL2" depends= makedepends="autoconf automake libtool tar wget bsd-compat-headers ncurses-dev popt-dev newt-dev zlib-dev libedit-dev tiff-dev curl-dev openssl-dev lua-dev libcap-dev jansson-dev util-linux-dev sqlite-dev postgresql-dev unixodbc-dev freetds-dev mariadb-dev alsa-lib-dev pjproject-dev dahdi-tools-dev libpri-dev libsrtp-dev spandsp-dev libresample speex-dev speexdsp-dev libogg-dev bluez-dev" install="$pkgname.pre-install $pkgname.pre-upgrade" subpackages="$pkgname-dbg $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 $pkgname-srtp $pkgname-dahdi $pkgname-speex $pkgname-alsa $pkgname-cdr-mysql:cdr_mysql" _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://dev.alpinelinux.org/~tteras/asterisk-addon-mp3-r201.patch.gz musl-libcap.patch musl-includes.patch musl-glob-compat.patch musl-outofmem-handling.patch musl-mutex-init.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 *.patch) msg "$i"; patch -p1 -i "$srcdir"/$i || return 1;; *patch.gz) msg "${i##*/}"; gunzip < "$srcdir"/${i##*/} | patch -p0 || return 1;; esac done # asteriskssl does not have direct references to libssl, but looks up # symbols from it using dlsym(RTLD_NEXT), so use --no-as-needed for it. sed -i -e 's/ASTSSL_LIBS:=$(OPENSSL_LIB)/ASTSSL_LIBS:=-Wl,--no-as-needed $(OPENSSL_LIB) -Wl,--as-needed/g' main/Makefile sed -i -e 's:lua5.1/::' pbx/pbx_lua.c sed -i -e 's/int foo = res_ninit(NULL);/res_ninit_is_not_really_here();/g' configure.ac update_config_sub || return 1 ./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 \ --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 \ --with-srtp \ || return 1 # get default modules to build rm menuselect.makeopts make menuselect.makeopts # and add the non-default modules we need ./menuselect/menuselect \ --enable chan_mobile \ --enable app_meetme \ --enable cdr_mysql \ menuselect.makeopts # build make ASTCFLAGS="$CFLAGS" ASTLDFLAGS="$LDFLAGS" LDCONFIG= || return 1 } package() { cd "$_builddir" make -j1 DESTDIR="$pkgdir" LDCONFIG_FLAGS="-n" install || return 1 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*' } cdr_mysql() { depends= install= _find_and_move '*cdr_mysql*' } srtp() { _find_and_move '*_srtp*'; } dahdi() { _find_and_move '*_dahdi*'; } speex() { _find_and_move '*_speex*'; } alsa() { _find_and_move '*_alsa*'; } 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="95b4850668b8880e6c4bfefae4fb427c asterisk-13.3.0.tar.gz 608f55942e82194a742634ddfd03cd2e asterisk-13.3.1-patch.gz 756c24ef3b2bb638246308093ea15910 asterisk-13.3.2-patch.gz 126dd4fba66f4cf9aa94dfd7034e0ec4 asterisk-addon-mp3-r201.patch.gz 9a2444cd3d06f394e06a1e90ef508420 musl-libcap.patch 1147c81ac5e49c36a5d264019480bec0 musl-includes.patch 9b3e6cb75464a6ef4c40d191bdfdf7ea musl-glob-compat.patch 10b84632764a6f05ec9973c31f5e82fb musl-outofmem-handling.patch 1ca5e8326dc03c963a7ce5455d0f21ba musl-mutex-init.patch 5535ecf893134fd341cfbd9f8e1249d2 ASTERISK-18995.patch ba0944d05570a1076f826807598c5752 ASTERISK-19109.patch 018f2fb1ebd31dc28bfb49919b2a0a81 ASTERISK-20527.patch 74cd25a5638a94ef51e9f4ede2fd28f2 asterisk.initd ed31d7ba37bcf8b0346dcf8593c395f0 asterisk.confd 3e65172275684373e1a25c8a11224411 asterisk.logrotate" sha256sums="88b1eaab1b2d45722f89f51e1fa47883a8fab283bc1dc2ffd7d7c6a0e4411d57 asterisk-13.3.0.tar.gz 5e9fbd1b1e3ee0790fee65bc01e790cdfed8b01683eff99110d0a262d97a0740 asterisk-13.3.1-patch.gz ee2353b1cb9b7c7fa17d8c5220ad2a7f6adbc8b3e013312ebb745ab5aea80267 asterisk-13.3.2-patch.gz d32a5a695cee1699011d0e9ad02eb43af612def06f92017627194099edf98e3f asterisk-addon-mp3-r201.patch.gz 1cd2405504ffddf0473d69849825bdf87a1029818bf4800707d82f2b0efd4899 musl-libcap.patch 354596949399ac38f245e03a0833ca4cf6aa664e28ef92d79715c654465aa5fe musl-includes.patch c6a5c32646b767f09ebffccc49cac6a4ff9181498499e4453300775e75284b52 musl-glob-compat.patch 235b9c339793c02d1d80ac37d308cf14dc3e86fe8ccbe757e9855b186d9c164b musl-outofmem-handling.patch a5205ed44b57a72934baf8cde543ddb179f277494181818905110bfdcccfe7d9 musl-mutex-init.patch d3f1304ddcce48f2c09cb81e924052f7eb2d36829aa1a0bf6a2e0be476333ee7 ASTERISK-18995.patch 6e0e023b83cd197ea4ff2a536d83dcce3675c094c47d195a39d809d64199b713 ASTERISK-19109.patch 84d21c9ef2d3a21d8cdef12034c5dcf57eb08a6a7fb76367bc839b60f7d24713 ASTERISK-20527.patch 13bcc98f2a78d4dd41e810232979eb83044e9166302bfb5b971315f2a82af36f asterisk.initd d221148583b57f9c37d7160f2493f0d204ad11f7abb17e3a3534e108ad5452d7 asterisk.confd 77b253b6db71460acf9a51e87ad4c8582027a46db01a4c50fb048bada58c19d1 asterisk.logrotate" sha512sums="2751608b35e21f4ea8d9b053a8dcaaf532bd16d7a1105550c1d44ea121a700ee1499e1fcf864a08d8103a2de433caccfbb7ae6e666f82760b981082a1f3ce0a7 asterisk-13.3.0.tar.gz 7591c244e9971bbc76669e19b155e983461789fed8213e27b6f085b7b95c8a6d50a07aa28cc54672c4b6d46a939070bd18d929795f7a4279f0adc4947b15adfe asterisk-13.3.1-patch.gz 707495ec3862b8448e6bf09d188a368e8732ae0d3de246d00943d7391da825ba91a3692d69da68e6561efcffe631340146c27cce534e6260b0f5f4f7814e2b45 asterisk-13.3.2-patch.gz aacef3f4796fb1abd33266998b53909cb4b36e7cc5ad2f7bac68bdc43e9a9072d9a4e2e7e681bddfa31f3d04575eb248afe6ea95da780c67e4829c1e22adfe1b asterisk-addon-mp3-r201.patch.gz 8826ab6b7d17f3b3292854b4c35f4b51dc456484e4325f743821b5d6099bfe59810f43c173d011c4cb018c2de789462403b6f378492e37293bc4bbff643c4448 musl-libcap.patch 7eb3c1f3207d8f7c58fbc3b30e7b9193e7498da09d53d7e907f3d9d79ffc86fa6f83b593dc4c1b0007d7e62565cb8618dc415d1a9ee61affa10e6a64b146967a musl-includes.patch edf65eba44e8f1f0e78671aba312bcff2090134cf94e89ebb4b6beef7b2d57b24381ae9511cbf9fffe6b555e695a3dbe2cedcd04f1d237df822fa742bd5092ac musl-glob-compat.patch 7cbbad2c16d89b0b4ea45257a44c25ea96ca6ecb1f5bf7707656dfa3957cae34d1dca404b3d62baca8b55cea6f9fa39819bef48a1f4dad0124da95d6c80a294e musl-outofmem-handling.patch f72c2e04de80d3ed9ce841308101383a1655e6da7a3c888ad31fffe63d1280993e08aefcf8e638316d439c68b38ee05362c87503fca1f36343976a01af9d6eb1 musl-mutex-init.patch f6c1b0030225638a20e374a6f14dca23fce88e1953bec0e399e8ee2e18241f6fdebc6be0404d7ae46359f66cdb7aa9240f2a4be17d5046aedf5aa72235e9da5d ASTERISK-18995.patch 28b2e4cc87aa94353795d6ef1f878a32d8d881e77f683ca19891fe7932c5505347b9c6fae9ea14de05d6fe4da4cb9a72fa219e40bf8365c7a0b4c5a2294af5d0 ASTERISK-19109.patch cdc41b50827f79194bf641782f82e5e0f15866788824002fe456e9e32bc37921ee2525baa476219c357ec35891a194ed00515a17b0ccab3a6bc4479ec52bc175 ASTERISK-20527.patch e29477aa57d88fedc96d13751f68f302d3892c70b5ea5b5a8cc85d0439335fc1a6847648447b443a074c0877718f23295e3752056a108301d340d1e2919465b1 asterisk.initd ab6b6f08ff43268cbb1abb7ed7d678949991ba495682a644bbaeb017d6adbff0a43297905fd73ae8db1786a28d5b5904f1bc253209a0e388c8a27f26c6ce14ed asterisk.confd 7591d2faf539d05d9ee4e431c78a5e20686721fd79221ad94dffeeaff9282220b09cb9aec214bd7a8d12affaec0276c9c91e6e21af8b6712c0a9502b60b02f2b asterisk.logrotate"