# Contributor: Michael Mason # Maintainer: Nathan Angelacos pkgname=kamailio pkgver=4.0.3 pkgrel=1 pkgdesc="Open Source SIP Server" 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 net-snmp-dev libunistring-dev" install="$pkgname.pre-install $pkgname.pre-upgrade" # See sip-router/Makfile.groups for the list of recommended modules for # each package. What follows is a simplified version of Makefile.groups # # Alpine specific changes: # # _mod_list_dbg is not defined in the orginal # # 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_extras="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_xml="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_tls="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_perl="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" # Alpine Specific _mod_list_dbg="$_mod_list_devel benchmark debugger" # Standard modules in main pkg _module_group_kstandard="$_mod_list_basic $_mod_list_dbuid $_mod_list_pcre" # END Makefile.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 \ extras websocket; do subpackages="$subpackages $pkgname-$_i" eval "_modules=\"\$_modules \$_mod_list_$_i\"" done source="http://www.kamailio.org/pub/kamailio/$pkgver/src/kamailio-${pkgver}_src.tar.gz fix-sql-module-loading-order.patch kamailio-4.0-backslash.patch sca.patch kamailio.cfg kamailio.initd " _builddir="$srcdir"/$pkgname-$pkgver 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 STUN=1 \ PREFIX=/usr \ cfg_target=/etc/kamailio/ \ include_modules="$_modules" \ LIBDIR=lib \ DESTDIR="$pkgdir" \ cfg_prefix="$pkgdir" \ cfg make 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 } _generic_pkg() { pkgdesc="Kamailio $1" depends="$pkgname" _mv_mod $2 } _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/$3 \ "$subpkgdir"/usr/share/kamailio/ || return 1 mv "$pkgdir"/usr/lib/kamailio/kamctl/*.$4 \ "$subpkgdir"/usr/lib/kamailio/kamctl/ || return 1 } db() { _generic_pkg "modules using a database backend" "$_mod_list_db" } postgres() { _db_driver Postgres postgres postgres pgsql } mysql() { _db_driver Mysql mysql mysql mysql } sqlite() { _db_driver SQlite sqlite db_sqlite sqlite } 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/ } cpl() { _generic_pkg "CPL (Call Processing Language) interpreter" \ "$_mod_list_cpl" } xml() { _generic_pkg "XML related modules: $_mod_list_xml" \ "$_mod_list_xml" || 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() { _generic_pkg "Database drivers for unixodbc" \ "$_mod_list_unixodbc" } snmpstats() { _generic_pkg "SNMP statistics support" \ "$_mod_list_snmpstats" || 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" \ "$_mod_list_xmpp" } carrierroute() { _generic_pkg "carrier grade routing functions" \ "$_mod_list_carrierroute" } ldap() { _generic_pkg "LDAP search functions" \ "$_mod_list_ldap" } utils() { _generic_pkg "miscelaneous utility functions" \ "$_mod_list_utils" } tls() { _generic_pkg "TLS support" \ "$_mod_list_tls" } presence() { _generic_pkg "SIP Notify (Presence) support" \ "$_mod_list_presence" } lua() { _generic_pkg "Lua script support" \ "$_mod_list_lua" } ims() { _generic_pkg "IP Multimedia Subsystem (IMS) support" \ "$_mod_list_ims" } outbound() { _generic_pkg "RFC 5626 section 5 Outbound suppport" \ "$_mod_list_outbound" } dbg() { _generic_pkg "debugging modules" \ "$_mod_list_dbg" } extras() { _generic_pkg "extra modules" \ "$_mod_list_extra" } websocket() { _generic_pkg "websocket support" \ "$_mod_list_websocket" } md5sums="60fdf7fa2f1343f029de499a43dc093a kamailio-4.0.3_src.tar.gz 53cca39c47399eb2df20a1044d1e29eb fix-sql-module-loading-order.patch 7ca9394c4987c83a27f492c5b6b055f0 kamailio-4.0-backslash.patch 17c056707b20cbb57c193b233e2a625c sca.patch a3c959ec568c43a905710e7d25cd8c25 kamailio.cfg 9c190575e28772a784c4172216d85333 kamailio.initd" sha256sums="5d19fe3a76f1a75303ae75321b5bda80633fdd3f0a3eb5e097cb9e5054311c57 kamailio-4.0.3_src.tar.gz d2b5518e31e9bfaf4b3f4b38f9c69f5c201255eae1a46e860afd471d123d274b fix-sql-module-loading-order.patch 2cb24070809718deac1a32fd4de73eaea47c685d9608fd06ae6531bd34fe4604 kamailio-4.0-backslash.patch 35a306ea472d55ea2a06348e175b6a08c3fa08e39380b9d6c4dd330e072d8f47 sca.patch 8024266849033a917147827c3579a382f10f3796989bebc6de3d7c80c965fb72 kamailio.cfg 82612cc107e51de6968568a266de25b98e57257926defab7261fd81cbd624e00 kamailio.initd" sha512sums="4d712e1aaec54d832fbcc9b4c32a19e61bf19ddc871800d422ca2716a82616424d4a4d66858f923c9129bbe289766892755c191cb2b5ef2d7c110573fffb39af kamailio-4.0.3_src.tar.gz 8aeb1d6eb0d83c20b0ad31e74ca68cfa868a215a12b7029167c8913aeb84afa06e1bbc8b43dd3f84ce864a9ca6f04177d73401f99d37d9087c06a8d8431d18fd fix-sql-module-loading-order.patch f83ca7e4feaa02ba4c97fe8b3ff72857b334b6ba27f90b1cc4a2819c77bf40a1d6b77cc8d9b9afa045da5a1a4706b737b73f93c39c0cdb57c14088ca691afbf9 kamailio-4.0-backslash.patch 7aaf315c45e44c300772f98602f769ca2a161107fb82b91b2b4bebd39b4321a7b5c5f79f66fba3185c22def70c2ffaca472328630f4c579ec40868cb44903650 sca.patch 0b666bfa10fd0af97b62749f8691cb3f76d9b40d1abe0a33e810e367bd733d2e8189c89f7f23010ec591116aada6e1a8a403b17449fe775038917617f281ad4d kamailio.cfg babec2a230daea3c579dc581f9a945c70bd1736cdacaaa7a183d902c8d9fbd4f7958cce03424fb65cdf7a1f6aa077ad8aec7e53525e270f88f856caa374505e7 kamailio.initd"