# Contributor: Michael Mason # Maintainer: Nathan Angelacos pkgname=kamailio pkgver=3.3.2 pkgrel=1 pkgdesc="Open Source SIP Proxy" url="http://www.kamailio.org/" pkgusers="kamailio" pkggroups="kamailio" arch="all" license="GPL" 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" 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="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 " _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() { cd "$_builddir" for i in $source; do case $i in *.patch) msg "Applying $i" patch -p1 -i "$srcdir"/$i || return 1 ;; esac done sed -i \ -e "s:-O9 -funroll-loops:$CFLAGS:g" \ Makefile.defs \ || return 1 # -e 's:^cfg-target.*:cfg-target = $(cfg-dir):' \ # -e 's:^cfg-prefix.*:cfg-prefix = $(basedir):' \ cd utils/kamctl/ 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 "$_builddir" make FLAVOUR=kamailio \ PREFIX=/usr \ cfg_target=/etc/kamailio/ \ include_modules="$_modules" \ LIBDIR=lib \ DESTDIR="$pkgdir" \ cfg_prefix="$pkgdir" \ cfg make -j1 all || return 1 } package() { cd "$_builddir" make -j1 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 } _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 } _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 mkdir -p "$subpkgdir"/usr/share/kamailio \ "$subpkgdir"/usr/lib/kamailio/kamctl mv "$pkgdir"/usr/share/kamailio/mysql \ "$subpkgdir"/usr/share/kamailio/ || return 1 mv "$pkgdir"/usr/lib/kamailio/kamctl/*.mysql \ "$subpkgdir"/usr/lib/kamailio/kamctl/ || return 1 } 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 } 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 } pcre() { pkgdesc="Regular expressions support for kamailio" _mv_mod dialplan lcr _mv_mod_k regex } presence() { pkgdesc="Presence support for kamailio" _mv_mod_k $_presence } mediaproxy() { pkgdesc="Mediaproxy support for kamailio" depends="kamailio" _mv_mod $_mediaproxy } unixodbc() { pkgdesc="UnixODBC support for kamailio" depends="kamailio" _mv_mod_k $_odbc } ldap() { pkgdesc="LDAP support for kamailio" depends="kamailio" _mv_mod_k ldap _mv_mod_s ldap } tls() { pkgdesc="TLS support for kamailio" depends="kamailio" _mv_mod tls } sipcapture() { pkgdesc="HOMER sipcapture support for kamailio" depends="kamailio" _mv_mod $_sipcapture } md5sums="7e4267fc993bf649a7e8dd5d8ea94bd7 kamailio-3.3.2_src.tar.gz 53cca39c47399eb2df20a1044d1e29eb fix-sql-module-loading-order.patch b0100ca0ad52b725b92e3b409e036d47 kamailio-3.2-backslash.patch a3c959ec568c43a905710e7d25cd8c25 kamailio.cfg 9c190575e28772a784c4172216d85333 kamailio.initd"