APKBUILD 3.06 KB
Newer Older
1
# Contributor: Michael Mason <ms13sp@gmail.com>
2
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
3
pkgname=kamailio
4 5
pkgver=1.5.3
pkgrel=0
6 7
pkgdesc="Open Source SIP Server"
url="http://www.kamailio.org/"
8 9
pkgusers="kamailio"
pkggroups="kamailio"
10
license="GPL"
Natanael Copa's avatar
Natanael Copa committed
11
depends=
12 13
makedepends="bison flex expat-dev postgresql-dev mysql-dev pcre-dev
	libxml2-dev curl-dev"
14
install=
15
subpackages="$pkgname-doc $pkgname-mysql $pkgname-postgres $pkgname-pcre
16
	$pkgname-presence $pkgname-mediaproxy"
17
source="http://www.kamailio.org/pub/kamailio/$pkgver/src/$pkgname-$pkgver-notls_src.tar.gz
18
	kamailio.cfg
19 20 21
	kamailio.initd
	kamailio.pre-install
	kamailio.post-install"
22 23 24

build() {
	cd "$srcdir/$pkgname-$pkgver-notls"
25
	sed -i -e 's:^cfg-target.*:cfg-target = $(cfg-dir):' \
Natanael Copa's avatar
Natanael Copa committed
26 27
		-e 's:^cfg-prefix.*:cfg-prefix = $(basedir):' Makefile.defs \
		|| return 1
28 29

	cd scripts
Natanael Copa's avatar
Natanael Copa committed
30 31
	sed -i -e 's:/var/run/kamailio.pid:/var/run/kamailio/kamailio.pid:g' \
		kamctl.base kamctlrc || return 1
32 33 34
	# we actually dont need bash
	sed -i -e '1s:/bin/bash:/bin/sh:' kamctl kamdbctl \
		|| return 1
35
	cd ..
36

37
	make prefix=/usr \
Natanael Copa's avatar
Natanael Copa committed
38
		cfg-dir=/etc/kamailio/ \
39 40 41 42 43
		MODS_MYSQL=yes \
		MODS_PCRE=yes \
		MODS_PRESENCE=yes \
		MODS_RADIUS= \
		TLS= \
44
		include_modules="db_postgres mediaproxy" \
45 46
		all || return 1
	make prefix=/usr \
47
		cfg-dir=/etc/kamailio/ \
48 49 50 51 52
		MODS_MYSQL=yes \
		MODS_PCRE=yes \
		MODS_PRESENCE=yes \
		MODS_RADIUS= \
		TLS= \
53
		include_modules="db_postgres mediaproxy" \
54
		basedir="$pkgdir" install || return 1
55

56 57 58 59 60 61
	# 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 

Natanael Copa's avatar
Natanael Copa committed
62
	install -m755 -D "$srcdir"/$pkgname.initd "$pkgdir"/etc/init.d/$pkgname
63
	install -d -o kamailio "$pkgdir"/var/run/kamailio
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102
}

_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
103 104
}

105 106 107 108 109 110
mediaproxy() {
	pkgdesc="Mediaproxy support for kamailio"
	depends="kamailio"
	_mv_mod mediaproxy
}

111
md5sums="17eeea5cdc2fdd28b2f9a1bad6598de2  kamailio-1.5.3-notls_src.tar.gz
112
eb665248ee39cf755a247286affc5cbb  kamailio.cfg
Natanael Copa's avatar
Natanael Copa committed
113
81100c479890a2a8c2628db22fdd1a0c  kamailio.initd
114 115
c646af2dd31f5c4289a2f802c873d98f  kamailio.pre-install
3fbaf633ff1620d0d526fc4047c7bed9  kamailio.post-install"