Subject: [alpine-devel] [PATCH] main/kamailio:

From: Nathan Angelacos <[email-masked]>
Date: Thu, 25 Apr 2013 16:13:09 +0000

- upgrade to 4.0.1
- add kamailio.groups file to build packages similar to other distros
- add additional packages to the Alpine set (e.g. ldap, snmpstats)
---
 main/kamailio/APKBUILD        | 215 +++++++++++++++--------------
 main/kamailio/kamailio.groups | 305 ++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 423 insertions(+), 97 deletions(-)
 create mode 100644 main/kamailio/kamailio.groups

diff --git a/main/kamailio/APKBUILD b/main/kamailio/APKBUILD
index 797240c..13b03c6 100644
--- a/main/kamailio/APKBUILD
+++ b/main/kamailio/APKBUILD
@@ -1,9 +1,9 @@
 # Contributor: Michael Mason <[email-masked]>
 # Maintainer: Nathan Angelacos <[email-masked]>
 pkgname=kamailio
-pkgver=3.3.3
+pkgver=4.0.1
 pkgrel=0
-pkgdesc="Open Source SIP Proxy"
+pkgdesc="Open Source SIP Server"
 url="http://www.kamailio.org/"
 pkgusers="kamailio"
 pkggroups="kamailio"
@@ -13,36 +13,33 @@ depends=
 arch=all
 makedepends="bison flex expat-dev postgresql-dev pcre-dev mysql-dev
 	libxml2-dev curl-dev unixodbc-dev confuse-dev ncurses-dev sqlite-dev
-	lua-dev openldap-dev openssl-dev"
+	lua-dev openldap-dev openssl-dev net-snmp-dev"
 install="$pkgname.pre-install $pkgname.pre-upgrade"
-subpackages="$pkgname-doc $pkgname-postgres $pkgname-presence $pkgname-pcre
-	$pkgname-mediaproxy $pkgname-unixodbc $pkgname-mysql $pkgname-sqlite
-	$pkgname-lua $pkgname-ldap $pkgname-sipcapture $pkgname-tls"
+
+# Source the kamailio.groups file for the definition of all the various modules
+. ./kamailio.groups
+
+subpackages="$pkgname-doc"
+_modules="$module_group_kstandard"
+for i in db postgres sqlite dbtext mysql \
+    cpl xml unixodbc snmpstats xmpp carrierroute \
+    ldap utils tls presence lua ims outbound dbg \
+    extra; do
+   
+   subpackages="$subpackages $pkgname-$i"
+   _modules="$_modules `eval echo $\module_group_k$i`"
+done
+
 source="http://www.kamailio.org/pub/kamailio/$pkgver/src/kamailio-${pkgver}_src.tar.gz
 	fix-sql-module-loading-order.patch
-	kamailio-3.2-backslash.patch
 	kamailio.cfg
 	kamailio.initd
+    kamailio.groups
 	"
 
 _builddir="$srcdir"/$pkgname-$pkgver

-_default="carrierroute xmlrpc tm"
-_presence="presence presence_xml presence_mwi pua pua_bla pua_mi pua_usrloc pua_xmpp rls xcap_server xcap_client presence_dialoginfo pua_dialoginfo presence_reginfo pua_reginfo"
-_sipcapture="sipcapture"
-_pcre="dialplan lcr regex"
-_postgres="db_postgres"
-_mysql="db_mysql"
-_mediaproxy="mediaproxy"
-_odbc="db_unixodbc"
-_sqlite="db_sqlite"
-_lua="app_lua"
-_ldap="ldap"
-_tls="tls"
-
-# Makefile does not handle newline
-_modules="$_default $_postgres $_mediaproxy $_odbc $_presence $_mysql $_pcre $_lua $_sqlite $_ldap $_sipcapture async $_tls"

 prepare() {
@@ -79,7 +76,7 @@ prepare() {
 
 build() {
 	cd "$_builddir"
-	make FLAVOUR=kamailio \
+	make FLAVOUR=kamailio STUN=1 \
 		PREFIX=/usr \
 		cfg_target=/etc/kamailio/ \
 		include_modules="$_modules" \
@@ -87,7 +84,7 @@ build() {
 		DESTDIR="$pkgdir" \
 		cfg_prefix="$pkgdir" \
 		cfg
-	make -j1 all || return 1
+	make all || return 1
 }
 
 package() {
@@ -113,113 +110,137 @@ _mv_mod() {
 	done
 }
 
-_mv_mod_k() {
-	local moddir=usr/lib/kamailio/modules_k i=
-	mkdir -p "$subpkgdir"/$moddir
-	for i in $@; do
-		mv "$pkgdir"/$moddir/$i.so "$subpkgdir"/$moddir/ || return 1
-	done
+_generic_pkg() {
+	pkgdesc="Kamailio $1"
+	depends="$pkgname"
+	_mv_mod $2
 }
 
-_mv_mod_s() {
-	local moddir=usr/lib/kamailio/modules_s i=
-	mkdir -p "$subpkgdir"/$moddir
-	for i in $@; do
-		mv "$pkgdir"/$moddir/$i.so "$subpkgdir"/$moddir/ || return 1
-	done
-}
 
-lua() {
-	pkgdesc="Lua script support for kamailio"
-	_mv_mod app_lua
-}
-
-mysql() {
-	pkgdesc="MySQL support for kamailio"
-	depends="kamailio mysql-client"
-	replaces="kamailio"
-	_mv_mod db_mysql
+_db_driver() {
+	pkgdesc="Database drivers for $1"
+	depends="$pkgname $pkgname-db"
+	_mv_mod db_$2 || return 1
 	mkdir -p "$subpkgdir"/usr/share/kamailio \
 		"$subpkgdir"/usr/lib/kamailio/kamctl
-	mv "$pkgdir"/usr/share/kamailio/mysql \
+	mv "$pkgdir"/usr/share/kamailio/$3 \
 		"$subpkgdir"/usr/share/kamailio/ || return 1
-	mv "$pkgdir"/usr/lib/kamailio/kamctl/*.mysql \
+	mv "$pkgdir"/usr/lib/kamailio/kamctl/*.$4 \
 		"$subpkgdir"/usr/lib/kamailio/kamctl/ || return 1
 }
 
+db() {
+    _generic_pkg "modules using a database backend" "$module_group_db"
+}
+
 postgres() {
-	pkgdesc="PostgreSQL support for kamailio"
-	depends="kamailio postgresql-client"
-	replaces="kamailio"
-	_mv_mod db_postgres
-	mkdir -p "$subpkgdir"/usr/share/kamailio \
-		"$subpkgdir"/usr/lib/kamailio/kamctl
-	mv "$pkgdir"/usr/share/kamailio/postgres \
-		"$subpkgdir"/usr/share/kamailio/
-	mv "$pkgdir"/usr/lib/kamailio/kamctl/*.pgsql \
-		"$subpkgdir"/usr/lib/kamailio/kamctl/ || return 1
+    _db_driver Postgres postgres postgres pgsql
+}
+
+mysql() {
+    _db_driver Mysql mysql mysql mysql
 }
 
 sqlite() {
-	pkgdesc="Sqlite support for kamailio"
-	depends="kamailio sqlite"
-	replaces="kamailio"
-	_mv_mod_k db_sqlite || return 1
-	mkdir -p "$subpkgdir"/usr/share/kamailio \
-		"$subpkgdir"/usr/lib/kamailio/kamctl
-	mv "$pkgdir"/usr/share/kamailio/db_sqlite \
-		"$subpkgdir"/usr/share/kamailio/ || return 1
-	mv "$pkgdir"/usr/lib/kamailio/kamctl/*.sqlite \
-		"$subpkgdir"/usr/lib/kamailio/kamctl/ || return 1
+    _db_driver SQlite sqlite db_sqlite sqlite
 }
 
-pcre() {
-	pkgdesc="Regular expressions support for kamailio"
-	_mv_mod dialplan lcr
-	_mv_mod_k regex
+dbtext() {
+    _db_driver DBText text dbtext dbtext || return 1
+    depends="$depends python"
+    mkdir -p "$subpkgdir"/usr/lib/kamailio/kamctl
+    mv "$pkgdir"/usr/lib/kamailio/kamctl/dbtextdb \
+        "$subpkgdir"/usr/lib/kamailio/kamctl/
 }
 
-presence() {
-	pkgdesc="Presence support for kamailio"
-	_mv_mod_k $_presence
+
+cpl() {
+    _generic_pkg "CPL (Call Processing Language) interpreter" \
+        "$module_group_kcpl"
 }
 
-mediaproxy() {
-	pkgdesc="Mediaproxy support for kamailio"
-	depends="kamailio"
-	_mv_mod $_mediaproxy
+xml() {
+    _generic_pkg "XML related modules: $module_group_kxml" \
+        "$module_group_kxml" || return 1
+    mkdir -p "$subpkgdir"/usr/share/kamailio
+    mv "$pkgdir"/usr/share/kamailio/xhttp_pi \
+        "$subpkgdir"/usr/share/kamailio || return 1
+    mkdir -p "$subpkgdir"/etc/kamailio/
+    mv "$pkgdir"/etc/kamailio/pi_framework.xml \
+        "$subpkgdir"/etc/kamailio || return 1
 }
 
 unixodbc() {
-	pkgdesc="UnixODBC support for kamailio"
-	depends="kamailio"
-	_mv_mod_k $_odbc
+    _generic_pkg "Database drivers for unixodbc" \
+        "$module_group_kunixodbc"
+}
+
+snmpstats() {
+    _generic_pkg "SNMP statistics support" \
+        "$module_group_ksnmpstats" || return 1
+    mkdir -p "$subpkgdir"/usr/share/snmp
+    mv "$_builddir"/modules/snmpstats/mibs \
+       "$subpkgdir"/usr/share/snmp/ || return 1
+}
+
+xmpp() {
+    _generic_pkg "XMPP (Jabber) gateway" \
+        "$module_group_kxmpp"
+}
+
+carrierroute() {
+    _generic_pkg "carrier grade routing functions" \
+        "$module_group_kcarrierroute"
 }
 
 ldap() {
-	pkgdesc="LDAP support for kamailio"
-	depends="kamailio"
-	_mv_mod_k ldap
-	_mv_mod_s ldap
+    _generic_pkg "LDAP search functions" \
+        "$module_group_kldap"
 }
 
+utils() {
+    _generic_pkg "miscelaneous utility functions" \
+        "$module_group_kutils"
+}
 
 tls() {
-	pkgdesc="TLS support for kamailio"
-	depends="kamailio"
-	_mv_mod tls
+    _generic_pkg "TLS support" \
+        "$module_group_ktls"
+}
+
+presence() {
+    _generic_pkg "SIP Notify (Presence) support" \
+        "$module_group_kpresence"
+}
+
+lua() {
+	_generic_pkg "Lua script support" \
+        "$module_group_klua"
+}
+
+ims() {
+    _generic_pkg "IP Multimedia Subsystem (IMS) support" \
+        "$module_group_kims"
 }
 
+outbound() {
+    _generic_pkg "RFC 5626 section 5 Outbound suppport" \
+        "$module_group_koutbound"
+}
+
+dbg() {
+    _generic_pkg "debugging modules" \
+        "$module_group_kdbg"
+}
 
-sipcapture() {
-	pkgdesc="HOMER sipcapture support for kamailio"
-	depends="kamailio"
-	_mv_mod $_sipcapture
+extra() {
+    _generic_pkg "extra modules" \
+        "$mod_list_extra"
 }

-md5sums="98c082b70048d2e9a9c4acfaa6cf556d  kamailio-3.3.3_src.tar.gz
+md5sums="ab57fcb1eb1195fa45f5c0935810e42a  kamailio-4.0.1_src.tar.gz
 53cca39c47399eb2df20a1044d1e29eb  fix-sql-module-loading-order.patch
-b0100ca0ad52b725b92e3b409e036d47  kamailio-3.2-backslash.patch
 a3c959ec568c43a905710e7d25cd8c25  kamailio.cfg
-9c190575e28772a784c4172216d85333  kamailio.initd"
+9c190575e28772a784c4172216d85333  kamailio.initd
+56a85be6c8e1b2c30d72a9b4acbdb5da  kamailio.groups"
diff --git a/main/kamailio/kamailio.groups b/main/kamailio/kamailio.groups
new file mode 100644
index 0000000..f91a475
--- /dev/null
+++ b/main/kamailio/kamailio.groups
@@ -0,0 +1,305 @@
+# This is taken from sip-router/Makefile.groups
+
+
+# Alpine specific changes:
+
+# module_groug_kdbg (at the end of this file) is not defined in the orginale
+
+# Move avp from mod_list_extra to mod_list_basic, so that we can create
+# a kamailio-extra package
+
+# Remove db_text from mod_list_db because we create a separate dbtext package
+
+# - basic used modules, with no extra dependency (widespread usage)
+mod_list_basic="avp async auth benchmark blst cfg_rpc cfgutils corex counters \
+                ctl debugger diversion enum exec ipops kex mangler maxfwd \
+                mediaproxy mi_datagram mi_fifo mi_rpc mqueue \
+                nat_traversal nathelper path pike pv ratelimit rr rtimer \
+                rtpproxy sanity sdpops siputils sl statistics textops \
+                textopsx tm tmx topoh xlog"
+
+# - extra used modules, with no extra dependency
+mod_list_extra="auth_diameter call_control dmq domainpolicy msrp pdb \
+                qos sca seas sms sst timer tmrec uac_redirect xhttp \
+		        xhttp_rpc xprint"
+
+# - common modules depending on database
+mod_list_db="acc alias_db auth_db avpops cfg_db db_flatstore \
+                db_cluster dialog dispatcher domain drouting group \
+                htable imc matrix msilo mtree p_usrloc pdt permissions \
+                pipelimit prefix_route registrar sipcapture siptrace speeddial \
+                sqlops uac uri_db userblacklist usrloc"
+
+
+# - common modules depending on database, using UID db schema
+mod_list_dbuid="db2_ops uid_auth_db uid_avp_db uid_domain uid_gflags \
+                uid_uri_db"
+
+# - modules for devel purposes
+mod_list_devel="malloc_test print print_lib"
+
+# - modules depending on pcre3 library
+mod_list_pcre="dialplan lcr regex"
+
+# - modules depending on radius client library
+mod_list_radius="acc_radius auth_radius misc_radius peering"
+
+# - modules depending on ldap client library
+mod_list_ldap="db2_ldap h350 ldap"
+
+# - modules depending on mysql client library
+mod_list_mysql="db_mysql"
+
+# - modules depending on postgres client library
+mod_list_postgres="db_postgres"
+
+# - modules depending on unixodbc library
+mod_list_unixodbc="db_unixodbc"
+
+# - modules depending on mysql cassandra library
+mod_list_cassandra="db_cassandra"
+
+# - modules depending on xml2 library
+mod_list_cpl="cpl-c"
+
+# - modules depending on xml2 library
+mod_list_xmldeps="xhttp_pi xmlrpc xmlops"
+
+# - modules depending on xml c rpc library
+mod_list_mi_xmlrpc="mi_xmlrpc"
+
+# - modules depending on net-snmp library
+mod_list_snmpstats="snmpstats"
+
+# - modules depending on expat library
+mod_list_xmpp="xmpp"
+
+# - modules depending on confuse library
+mod_list_carrierroute="carrierroute"
+
+# - modules depending on bdb (db4) library
+mod_list_berkeley="db_berkeley"
+
+# - modules depending on curl library
+mod_list_utils="utils"
+
+# - modules depending on purple library
+mod_list_purple="purple"
+
+# - modules depending on memcache library
+mod_list_memcached="memcached"
+
+# - modules depending on openssl library
+mod_list_tlsdeps="auth_identity tls"
+
+# - modules depending on openssl library
+mod_list_outbound="outbound"
+
+# - modules depending on unistring library
+mod_list_websocket="websocket"
+
+# - modules depending on openssl library
+mod_list_stun="stun"
+
+# - modules depending on libval-threads libcrypto libsres libpthread
+mod_list_dnssec="dnssec"
+
+# - modules related to SIMPLE presence extensions
+mod_list_presence="presence presence_conference presence_dialoginfo \
+                    presence_mwi presence_profile presence_reginfo \
+                    presence_xml \
+                    pua pua_bla pua_dialoginfo pua_mi pua_reginfo \
+                    pua_usrloc pua_xmpp \
+                    rls xcap_client xcap_server"
+
+# - modules depending on lua library
+mod_list_lua="app_lua"
+
+# - modules depending on perl library
+mod_list_perldeps="app_perl db_perlvdb"
+
+# - modules depending on python library
+mod_list_python="app_python"
+
+# - modules depending on geoip library
+mod_list_geoip="geoip"
+
+# - modules depending on sqlite library
+mod_list_sqlite="db_sqlite"
+
+# - modules depending on oracle library
+mod_list_oracle="db_oracle"
+
+# - modules depending on json library
+mod_list_json="json jsonrpc-c"
+
+# - modules depending on redis library
+mod_list_redis="ndb_redis"
+
+# - modules depending on mono library
+mod_list_mono="app_mono"
+
+# - modules related to IMS extensions
+mod_list_ims="cdp cdp_avp dialog_ng ims_auth ims_isc ims_icscf ims_qos \
+                ims_registrar_pcscf ims_registrar_scscf ims_usrloc_pcscf \
+                ims_usrloc_scscf"
+
+# - modules depending on osp toolkit library
+mod_list_osp="osp"
+
+# - modules depending on java library
+mod_list_java="app_java"
+
+# - modules depending on iptables library
+mod_list_iptrtpproxy="iptrtpproxy"
+
+### --- Groups defined for source code compilation ###
+
+# groups are sets of modules selected by compile target interest (should be
+# built by combining lists)
+
+# Modules in this group are the default compiled modules due to
+# no external compile or link dependencies
+module_group_default="$mod_list_basic $mod_list_extra \
+                        $mod_list_db $mod_list_dbuid \
+                        $mod_list_devel"
+
+# Modules in this group are the default compiled modules due to
+# no internal/external compile or link dependencies
+module_group_standard="$mod_list_basic $mod_list_extra \
+                        $mod_list_devel"
+
+# Modules in this group are considered a standard part due to
+# widespread usage, but they have dependencies that must be satisfied for 
+# compilation (e.g., lcr, radius, presence, tls, ...).
+module_group_common="$mod_list_db $mod_list_dbuid \
+					$mod_list_pcre $mod_list_radius \
+                    $mod_list_xmldeps $mod_list_presence \
+                    $mod_list_tlsdeps"
+
+# For db use (db modules, excluding drivers)
+module_group_db=$mod_list_db
+
+# For mysql
+module_group_mysql_driver=db_mysql
+module_group_mysql="$module_group_mysql_driver $module_group_db"
+
+# For postgress
+module_group_postgres_driver=db_postgres
+module_group_postgres="$module_group_postgres_driver $module_group_db"
+
+# For radius
+module_group_radius=$mod_list_radius
+
+# For presence
+# kamailio modules
+module_group_presence=$mod_list_presence
+
+# For cassandra
+#module_group_cassandra_driver=$(mod_list_cassandra)
+#module_group_cassandra=$(module_group_cassandra_driver) $(module_group_db)
+
+
+### --- Groups defined for pacKaging ###
+
+# Standard modules in main pkg
+module_group_kstandard="$mod_list_basic $mod_list_extra \
+                        $mod_list_db $mod_list_dbuid \
+                        $mod_list_pcre"
+
+# pkg mysql module
+module_group_kmysql=$mod_list_mysql
+
+# pkg postgress module
+module_group_kpostgres=$mod_list_postgres
+
+# pkg cpl module
+module_group_kcpl=$mod_list_cpl
+
+# pkg xml modules
+module_group_kxml=$mod_list_xmldeps
+
+# pkg mi_xmlrpc modules
+module_group_kmi_xmlrpc=$mod_list_mi_xmlrpc
+
+# pkg radius modules
+module_group_kradius=$mod_list_radius
+
+# pkg unixodbc module
+module_group_kunixodbc=$mod_list_unixodbc
+
+# pkg perl module
+module_group_kperl=$mod_list_perldeps
+
+# pkg snmpstats module
+module_group_ksnmpstats=$mod_list_snmpstats
+
+# pkg xmpp module
+module_group_kxmpp=$mod_list_xmpp
+
+# pkg carrierroute module
+module_group_kcarrierroute=$mod_list_carrierroute
+
+# pkg berkeley module
+module_group_kberkeley=$mod_list_berkeley
+
+# pkg ldap modules
+module_group_kldap=$mod_list_ldap
+
+# pkg utils module
+module_group_kutils=$mod_list_utils
+
+# pkg purple module
+module_group_kpurple=$mod_list_purple
+
+# pkg memcached module
+module_group_kmemcached=$mod_list_memcached
+
+# pkg tls module
+module_group_ktls=$mod_list_tlsdeps
+
+# pkg websocket module
+module_group_kwebsocket=$mod_list_websocket
+
+# pkg presence modules
+module_group_kpresence=$mod_list_presence
+
+# pkg lua module
+module_group_klua=$mod_list_lua
+
+# pkg python module
+module_group_kpython=$mod_list_python
+
+# pkg geoip module
+module_group_kgeoip=$mod_list_geoip
+
+# pkg sqlite module
+module_group_ksqlite=$mod_list_sqlite
+
+# K json modules
+module_group_kjson=$mod_list_json
+
+# pkg redis module
+module_group_kredis=$mod_list_redis
+
+# pkg mono module
+module_group_kmono=$mod_list_mono
+
+# pkg IMS modules
+module_group_kims=$mod_list_ims
+
+# pkg outbound module
+module_group_koutbound=$mod_list_outbound
+
+# pkg java module
+module_group_kjava=$mod_list_java
+
+# pkg stun module
+module_group_kstun=$mod_list_stun
+
+# pkg dnssec module
+module_group_kdnssec=$mod_list_dnssec
+
+# Alpine Specific
+module_group_kdbg="$mod_list_devel benchmark debugger"
+
-- 
1.8.0

---
Unsubscribe:  [email-masked]
Help:         [email-masked]
---