# Contributor: Ɓukasz Jendrysik # Contributor: Michael Mason # Contributor: Leonardo Arena # Maintainer: Nathan Angelacos pkgname=kamailio # If building from a git snapshot, specify the gitcommit # abuild snapshot, then abuild as normal # If building a proper release, leave gitcommit blank #_gitcommit=f9c248a6 _giturl="git://github.com/$pkgname/$pkgname.git" _gittag=HEAD pkgver=4.2.3 pkgrel=4 [ -z "${_gitcommit}" ] && _suffix="_src" || _suffix="-${_gitcommit}" pkgdesc="Open Source SIP Server" url="http://www.kamailio.org/" arch="all" pkgusers="kamailio" pkggroups="kamailio" arch="all" license="GPL2+" depends="" makedepends="bison flex expat-dev postgresql-dev pcre-dev mariadb-dev libxml2-dev curl-dev unixodbc-dev confuse-dev ncurses-dev sqlite-dev lua-dev openldap-dev openssl-dev net-snmp-dev libuuid libev-dev json-c-dev libevent-dev linux-headers libmemcached-dev hiredis-dev" install="$pkgname.pre-install $pkgname.pre-upgrade" # See Makefile.groups for the list of recommended modules for # each package. What follows is a simplified version of Makefile.groups # # Alpine specific changes: # # _mod_list_debugger is not defined in the orginal # # Move avp from _mod_list_extras to _mod_list_basic, so that we can create # a kamailio-extras 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 gzcompress 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 rtpengine stun sipt" # - extra used modules, with no extra dependency _mod_list_extras="auth_diameter call_control cnxcc dmq domainpolicy msrp pdb \ qos sca seas sms sst timer tmrec tsilo uac_redirect xhttp \ xhttp_rpc xprint nosip" # - 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 mohqueue 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 ndb_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 libval-threads libcrypto libsres libpthread _mod_list_dnssec="dnssec" # - modules depending on libsctp _mod_list_sctp="sctp" # - modules depending on openssl library _mod_list_authephemeral="auth_ephemeral" # - 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 jsonrpc-s" # - 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 ims_charging" # - 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" # - modules depending on gzip library _mod_list_gzcompress="gzcompress" # - modules depending on uuid library _mod_list_uuid="uuid" # - modules depending on ev library _mod_list_ev="evapi" # - modules depending on kazoo/rabbitmq _mod_list_kazoo="kazoo" # - modules depending on mongodb _mod_list_mongodb="db_mongodb ndb_mongodb" # Alpine Specific _mod_list_debugger="$_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 $pkgname-dbg" _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 debugger \ extras json websocket authephemeral \ uuid ev memcached redis; do subpackages="$subpackages $pkgname-$_i" eval "_modules=\"\$_modules \$_mod_list_$_i\"" done source="http://www.kamailio.org/pub/kamailio/$pkgver/src/kamailio-${pkgver}${_suffix}.tar.gz kamailio-4.2-backslash.patch 0001-musl-fixes.patch kamailio-4.2-ipops-srv-query.patch DMQ-multi-notify.patch default_ctl.patch kamctl_build.patch kamailio.cfg kamailio.initd " _builddir="$srcdir"/${pkgname}-fb-${_ver} snapshot() { mkdir -p "$srcdir" cd "${SRCDEST:-$srcdir}" if ! [ -d $pkgname.git ]; then git clone --bare $_giturl || return 1 cd $pkgname.git else cd $pkgname.git git fetch || return 1 fi git archive --prefix=$pkgname-$pkgver/ -o "$SRCDEST"/$pkgname-$_ver.tar.gz $_gittag } _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 \ CC_EXTRA_OPTS="$CFLAGS -D_GNU_SOURCE" \ cfg_target=/etc/kamailio/ \ include_modules="$_modules" \ LIBDIR=lib \ DESTDIR="$pkgdir" \ cfg_prefix="$pkgdir" \ cfg make all EMBEDDED_UTF8_DECODE=1 || return 1 } package() { cd "$_builddir" make -j1 install EMBEDDED_UTF8_DECODE=1 || 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 # kamdbctl.dbtext is a python script - but we will not make python # a dependency because kamdbctl is not normaly used depends="$depends" mkdir -p "$subpkgdir"/usr/lib/kamailio/kamctl || return 1 mv "$pkgdir"/usr/lib/kamailio/kamctl/dbtextdb \ "$subpkgdir"/usr/lib/kamailio/kamctl/ || return 1 } 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 support" \ "$_mod_list_outbound" } debugger() { _generic_pkg "debugging modules" \ "$_mod_list_debugger" } extras() { _generic_pkg "extra modules" \ "$_mod_list_extras" } websocket() { _generic_pkg "websocket support" \ "$_mod_list_websocket" } authephemeral() { _generic_pkg "auth ephemeral (webrtc)" \ "$_mod_list_authephemeral" } json() { _generic_pkg "Operations on json strings" \ "$_mod_list_json" } #geoip() { # _generic_pkg "MaxMind GeoIP lookup support" \ # "$_mod_list_geoip" #} ev() { _generic_pkg "Network event broadcast API" \ "$_mod_list_ev" } uuid() { _generic_pkg "UUID generator using libuuid" \ "$_mod_list_uuid" } memcached() { _generic_pkg "memcached support" \ "$_mod_list_memcached" } redis() { _generic_pkg "Redis NoSQL support" \ "$_mod_list_redis" } md5sums="f94eb1db3820dba22bd3fdae464e93b3 kamailio-4.2.3_src.tar.gz bad1ac2d4c95043df271d2ea6d37627a kamailio-4.2-backslash.patch 4685288dc54680597b00f956dc95d4d6 0001-musl-fixes.patch 5b7ecf5c4ae06420c028e03721cb9e89 kamailio-4.2-ipops-srv-query.patch 7df723eb9e14df28adfff8643d99a1a9 DMQ-multi-notify.patch 841fa62c432c5d8aeb57ad70d2ec3030 default_ctl.patch d0052e6054884b9cec955af4480c7c85 kamctl_build.patch 299706d97e30a4f0d9b4c873df422866 kamailio.cfg 0e0a271fd3ddb7e87c01c26c7d041d59 kamailio.initd" sha256sums="7dbbca4a515778d3e903380adcc49f727ddc4853238cb905e14c811a5671ed80 kamailio-4.2.3_src.tar.gz d7e59be721ed0ad4621d404493b9a519708d801e9d4914b0164b819fa1abcd13 kamailio-4.2-backslash.patch b98555ff304b51b82c6cf7e01d757b15ea4f05bd2e603c84d4384df6a6be62b6 0001-musl-fixes.patch cfe645fc80eaed8a9e4bd56047f75555b2a9e3edcb3e2b6c6cece1547ab0a574 kamailio-4.2-ipops-srv-query.patch 384eeaa5b253228341dc7a74ec61314db4b8f2f1c9c2f3bdf9ba189d2d56911d DMQ-multi-notify.patch 755efa4ad126c672bc67c53268260b57f7da1f454cdc1a1601778ed7c7d5f0e5 default_ctl.patch e00eefed792acbc1ee6eca8fa7389f9973bd53b68fa7abc573f19f1ff26812a1 kamctl_build.patch 8b742ff710ef67ff59ec07a260690ebcdda24fb6f0b7b64dc50433a1bacf99f2 kamailio.cfg a90d3ab09a3ed58892e94710a1f80492a61ffad1ccf7ccb5b851bb8f538d32c4 kamailio.initd" sha512sums="2f42499fe84eefac236fe3d4aa3c7bc424944236f00b95a7071feaa816b3df5764f84076d57b2137908dab7ff06a2440cc7a53a799216befd9511f8718a2eee5 kamailio-4.2.3_src.tar.gz a9bb1e8f9f373264b8351ddae099a36a46ddd46fdec09e468d297ba4f64bb4896e7d6e599da70a424e8a28695ab3f3b4ac940afab534593a6b9d08ae462f001a kamailio-4.2-backslash.patch dea7ef2ccf01357576045ba375d41301e2447b4454324007c7ca1862322835c57045852017192ca5434b32dd1b7a2e9669209b7111889dab335b74f042d0f11f 0001-musl-fixes.patch 3a9bb5d05b4628f6146b824b8916db259f1da51415398ba420900311d73986d21cab653079080c0e8c55ef512909f542279ca7da944b5ef14520331584ca958f kamailio-4.2-ipops-srv-query.patch 7ddf6444c15f7338e7aab779ea5b75f4fd936b51cf5d9ba0d09e813566e527f74e59e100661d2b27db99e5fa042614c83e8145e999a8b6bfcfab71c9595bb626 DMQ-multi-notify.patch 2321d8afe29b53057ce21e0552dfb80fd6a0e7dc0caf3c4798a8b253518f4c8c546797302933373f4b055a4531329a36ee2d7117b0a88fe39cf153bfef91a656 default_ctl.patch 4c2c9bde3a4c44feca2863bb03cb031aa55e1c3df21dc7c0acb3a392c34cb36d9a132bcbdf451a0624f8ec202152f1cf238c89280c32f1c04312ce80427a18c6 kamctl_build.patch c1abf69b48847dc8c7ab0d11ef9adb531aa4635f9d44db6933981edc5a47df374664fb24867b19aa64abbcc9777bf1cd0360d9aea54e27b081065928c61e0f0b kamailio.cfg 5ddaa059cdef10462c904f061f7bb085e62ad7501e2ed41f797d9e68822bce4e0e5ca09c1586c3901c920f8ce563c8c3ede860752c2b9bdb8f09908388ef337f kamailio.initd"