aboutsummaryrefslogblamecommitdiffstats
path: root/main/asterisk/APKBUILD
blob: 836d368935a1fd725113e3dce78852d28b0a3df1 (plain) (tree)
1
2
3
4
5
6
7
8
9
                                                   


                                             
              
        
                                                   

                    
                              
          
              
        
                                                                            




                                                                            
                                       
                                                   
                                                                                
                                                               
                                                                 
                                                                        
                                                                  

                                                                         
                                          
                                                                           

                         
                              
                             
                            
                            
                      

                           
 
                                          

           
                    


                                                             
 
                       


                                                                          
                                                                                                
                    

            



                                                                                                                                
                                             
                                                                                               
                                     

                      



                       

                                                       



                                                           




                                           

                                     








                                 

                                 
                              
                               
                               
                                
                                  
                                
                                
                             
                        

                           
                                      

                                




                                                 
                                    


                                   
                                                                            



                       
                                                                          
 

                                             
 

                                                                               

                                                       
 
                                                           

                                                         

 









                                                      


                                
                                                          





                                               

                   






                          
         
                




                                 
                




                               
                



                               





                               





                                  
         




                                





                                    



                                      
 
          
                     

                                                         

                                                        



                                                              


             
                     



                                                          
                                                              


            
                     



                                                  
                                                              

 
                                                                  
                                                                  
                                                   
                                                        
                                                       

                                                      
                                                

                                                     
                                                                                                     
                                                                                                  
                                                                                   
                                                                                        
                                                                                       

                                                                                      
                                                                                

                                                                                     
                                                                                                                                                                     
                                                                                                                                                                  
                                                                                                                                                   
                                                                                                                                                        
                                                                                                                                                       

                                                                                                                                                      
                                                                                                                                                

                                                                                                                                                     
# Contributor: Łukasz Jendrysik <scadu@yandex.com>
# Contributor: Timo Teras <timo.teras@iki.fi>
# Maintainer: Timo Teras <timo.teras@iki.fi>
pkgname=asterisk
pkgver=13.11.1
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 findutils 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 libxml2-dev imap-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"
source="$_download/asterisk-$pkgver.tar.gz
	http://dev.alpinelinux.org/~tteras/asterisk-addon-mp3-r201.patch.gz

	musl-libcap.patch
	musl-glob-compat.patch
	musl-mutex-init.patch
	ASTERISK-18995.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"
	# cannot build with imap on aarch64
	[ "$CARCH" = "aarch64" ] || _imap="--with-imap"
	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 \
		$_imap \
		|| 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="7c27d278533c5936348a412e9df5982d  asterisk-13.11.1.tar.gz
126dd4fba66f4cf9aa94dfd7034e0ec4  asterisk-addon-mp3-r201.patch.gz
7b699961171a93d7788420f518c5931e  musl-libcap.patch
9b3e6cb75464a6ef4c40d191bdfdf7ea  musl-glob-compat.patch
1ca5e8326dc03c963a7ce5455d0f21ba  musl-mutex-init.patch
120deda3ccd21c905ac51fda1f696931  ASTERISK-18995.patch
a91bf5c4fea24b3e04f02e41751aaa88  ASTERISK-20527.patch
4bdc82ba3d6bdfdedc71e5da2fde5ec2  asterisk.initd
ed31d7ba37bcf8b0346dcf8593c395f0  asterisk.confd
3e65172275684373e1a25c8a11224411  asterisk.logrotate"
sha256sums="d1dc61b78b5e2c51a3c7b65300f2cb29470c88552fc6c30aa9ea426fef385748  asterisk-13.11.1.tar.gz
d32a5a695cee1699011d0e9ad02eb43af612def06f92017627194099edf98e3f  asterisk-addon-mp3-r201.patch.gz
f23aa2c03f9be1eb3c4c0ceac79ddcce7381aae46d6e6853ad20b1de5ac125d9  musl-libcap.patch
c6a5c32646b767f09ebffccc49cac6a4ff9181498499e4453300775e75284b52  musl-glob-compat.patch
a5205ed44b57a72934baf8cde543ddb179f277494181818905110bfdcccfe7d9  musl-mutex-init.patch
76ba70d0df5f4a788294854cf3a40c3adea711ea70fdb7750ee208afc0b13b12  ASTERISK-18995.patch
790af610fe147d8add270e7e7e0d998e265ed78374f597844beaedd270d44b07  ASTERISK-20527.patch
10454553733e6cc52c6e9db508768a638655d99c095c5b39fb043858c088f21f  asterisk.initd
d221148583b57f9c37d7160f2493f0d204ad11f7abb17e3a3534e108ad5452d7  asterisk.confd
77b253b6db71460acf9a51e87ad4c8582027a46db01a4c50fb048bada58c19d1  asterisk.logrotate"
sha512sums="23bb5b8997426ae952017bdc6c7630ff1ca4ca401879557f14b26fd5fb83014577b487e2e0a52cc46d15b691c4e5a732aaf7baba47d566bfb676e9c5f7f472c0  asterisk-13.11.1.tar.gz
aacef3f4796fb1abd33266998b53909cb4b36e7cc5ad2f7bac68bdc43e9a9072d9a4e2e7e681bddfa31f3d04575eb248afe6ea95da780c67e4829c1e22adfe1b  asterisk-addon-mp3-r201.patch.gz
31bdf1323155a9fbedf8c05183167903ff83bef4d408848368d3fab78e6c6265228ceece54375d68df6a99b9c1879431033d0a8cec875244c61ccc1f8e37fc5d  musl-libcap.patch
edf65eba44e8f1f0e78671aba312bcff2090134cf94e89ebb4b6beef7b2d57b24381ae9511cbf9fffe6b555e695a3dbe2cedcd04f1d237df822fa742bd5092ac  musl-glob-compat.patch
f72c2e04de80d3ed9ce841308101383a1655e6da7a3c888ad31fffe63d1280993e08aefcf8e638316d439c68b38ee05362c87503fca1f36343976a01af9d6eb1  musl-mutex-init.patch
e6becba58f73ffeac7831092135e9cfd5ca9029b9471061b6f20d6e98c9c4d4dcaea7d69a53c079fb5baf03963809740e5feaf8b595072229a04912bff9ff41a  ASTERISK-18995.patch
0c9f643b2b5548753bf5228ea17a2a55753ea4fdcd32c3ef105f4f27a762a0f93a4a02ba0b88d969fad8729048d357959d3f7d0fa166c2935170f0753b08d8a4  ASTERISK-20527.patch
cd5bd1c1d7db0a44b14eb10e6d098af0c6474c8fe1a57395090d6795ac00e9243d004b7d24eba2cfd5bd6d6407c271913e794551a8dfcf3cf93e89fc91349e12  asterisk.initd
ab6b6f08ff43268cbb1abb7ed7d678949991ba495682a644bbaeb017d6adbff0a43297905fd73ae8db1786a28d5b5904f1bc253209a0e388c8a27f26c6ce14ed  asterisk.confd
7591d2faf539d05d9ee4e431c78a5e20686721fd79221ad94dffeeaff9282220b09cb9aec214bd7a8d12affaec0276c9c91e6e21af8b6712c0a9502b60b02f2b  asterisk.logrotate"