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

            

                                

                    
             
        
                                                                   
                                                      
                                                    
                                                                        
                                                                
                                                                                          
                    
                      
                                
         
 
           
                                           

                                                                   
                                                              

                                                                             
                  

                                                                              
                                    




                                                                                    
                           
 
 

                                           
                          
                                        




                                   
                                                                                   
                               



                                           
                          
                                        




                                   
                                                                                   
                                                     
 
                                                                            
 




                                                    
                                                                               
                                                         






































                                                                            

 





                                                 





                                               
                                                                          
                                              
                                                
                                                           
# Contributor: Michael Mason <ms13sp@gmail.com>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=kamailio
pkgver=1.5.4
pkgrel=0
pkgdesc="Open Source SIP Server"
url="http://www.kamailio.org/"
pkgusers="kamailio"
pkggroups="kamailio"
license="GPL"
depends=
makedepends="bison flex expat-dev postgresql-dev mysql-dev pcre-dev
	libxml2-dev curl-dev unixodbc-dev confuse-dev"
install="$pkgname.pre-install $pkgname.post-install"
subpackages="$pkgname-doc $pkgname-mysql $pkgname-postgres $pkgname-pcre
	$pkgname-presence $pkgname-mediaproxy $pkgname-unixodbc"
source="http://www.kamailio.org/pub/kamailio/$pkgver/src/$pkgname-$pkgver-notls_src.tar.gz
	kamailio.cfg
	kamailio.initd
	kamailio-backslash.patch
	"

prepare() {
	cd "$srcdir/$pkgname-$pkgver-notls"
	patch -p1 -i "$srcdir"/kamailio-backslash.patch || return 1

	sed -i -e 's:^cfg-target.*:cfg-target = $(cfg-dir):' \
		-e 's:^cfg-prefix.*:cfg-prefix = $(basedir):' Makefile.defs \
		|| return 1
	cd scripts
	sed -i -e 's:/var/run/kamailio.pid:/var/run/kamailio/kamailio.pid:g' \
		kamctl.base kamctlrc || return 1
	# we actually dont need bash
	sed -i -e 's:/bin/bash:/bin/sh:' kamctl kamdbctl \
		|| return 1
	# Set email_address field as not required field (could be null)
	cd dbtext/kamailio
	sed -i -e 's:email_address(string):email_address(string,null):' subscriber \
		|| return 1
}

build() {
	cd "$srcdir/$pkgname-$pkgver-notls"
	make prefix=/usr \
		cfg-dir=/etc/kamailio/ \
		MODS_MYSQL=yes \
		MODS_PCRE=yes \
		MODS_PRESENCE=yes \
		MODS_RADIUS= \
		TLS= \
		include_modules="db_postgres mediaproxy db_unixodbc carrierroute" \
		all || return 1
}

package() {
	cd "$srcdir/$pkgname-$pkgver-notls"
	make prefix=/usr \
		cfg-dir=/etc/kamailio/ \
		MODS_MYSQL=yes \
		MODS_PCRE=yes \
		MODS_PRESENCE=yes \
		MODS_RADIUS= \
		TLS= \
		include_modules="db_postgres mediaproxy db_unixodbc carrierroute" \
		basedir="$pkgdir" install || return 1

	# move default config to -doc package and use our own default config

	mv "$pkgdir"/etc/kamailio/kamailio.cfg \
		"$pkgdir"/usr/share/doc/kamailio/
	install -m644 -D "$srcdir"/kamailio.cfg \
		"$pkgdir"/etc/kamailio/kamailio.cfg 

	install -m755 -D "$srcdir"/$pkgname.initd "$pkgdir"/etc/init.d/$pkgname
	install -d -o kamailio "$pkgdir"/var/run/kamailio
}

_mv_mod() {
	local moddir=usr/lib/kamailio/modules i=
	mkdir -p "$subpkgdir"/$moddir
	for i in $@; do
		mv "$pkgdir"/$moddir/$i.so "$subpkgdir"/$moddir/ || return 1
	done
}


mysql() {
	pkgdesc="MySQL support for kamailio"
	depends="kamailio mysql-client"
	_mv_mod db_mysql
	mkdir -p "$subpkgdir"/usr/share/kamailio
	mv "$pkgdir"/usr/share/kamailio/mysql \
		"$subpkgdir"/usr/share/kamailio/
}

postgres() {
	pkgdesc="PostgreSQL support for kamailio"
	depends="kamailio postgresql-client"
	_mv_mod db_postgres
	mkdir -p "$subpkgdir"/usr/share/kamailio
	mv "$pkgdir"/usr/share/kamailio/postgres \
		"$subpkgdir"/usr/share/kamailio/
}

pcre() {
	pkgdesc="Regular expressions support for kamailio"
	_mv_mod dialplan lcr regex
}

presence() {
	pkgdesc="Precense support for kamailio"
	_mv_mod presence presence_xml presence_mwi pua pua_bla pua_mi \
		pua_usrloc pua_xmpp rls xcap_client presence_dialoginfo \
		pua_dialoginfo
}

mediaproxy() {
	pkgdesc="Mediaproxy support for kamailio"
	depends="kamailio"
	_mv_mod mediaproxy
}

unixodbc() {
	pkgdesc="UnixODBC support for kamailio"
	depends="kamailio"
	_mv_mod db_unixodbc
}

md5sums="127233aff2f20566b54f84555602132d  kamailio-1.5.4-notls_src.tar.gz
eb665248ee39cf755a247286affc5cbb  kamailio.cfg
8ac6c260f090aea0ca344f18f9a2a904  kamailio.initd
3259980a45d9ad3fc6fca83414021d07  kamailio-backslash.patch"