summaryrefslogtreecommitdiffstats
path: root/testing/kamailio/APKBUILD
blob: 5e3a0c63936e149393d7ef245fea9154a1b92ef0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
# Contributor: Michael Mason <ms13sp@gmail.com>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=kamailio
pkgver=3.0.0
pkgrel=1
pkgdesc="Open Source SIP Server"
url="http://www.kamailio.org/"
pkgusers="kamailio"
pkggroups="kamailio"
license="GPL"
depends=
makedepends="bison flex expat-dev postgresql-dev pcre-dev
	libxml2-dev curl-dev unixodbc-dev confuse-dev"
install=
subpackages="$pkgname-doc $pkgname-postgres 
	$pkgname-mediaproxy $pkgname-unixodbc"
source="http://sip-router.org/tarballs/sr/kamailio_3.0/kamailio-${pkgver}_src_2010-01-12_6d1e9f.tar.gz
	kamailio.cfg
	kamailio.initd
	kamailio.pre-install
	kamailio.post-install
	kamailio-backslash.patch
	"

_builddir="$srcdir"/$pkgname-$pkgver
prepare() {
	cd "$_builddir"
	patch -p1 -i "$srcdir"/kamailio-backslash.patch || return 1

	sed -i -e 's:^cfg-target.*:cfg-target = $(cfg-dir):' \
		-e 's:^cfg-prefix.*:cfg-prefix = $(basedir):' \
		-e "s:-O9 -funroll-loops:$CFLAGS:g" \
		Makefile.defs \
		|| return 1

	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 prefix=/usr \
		cfg-dir=/etc/kamailio/ \
		MODS_MYSQL=yes \
		MODS_PCRE=yes \
		MODS_PRESENCE=yes \
		MODS_RADIUS= \
		TLS= \
		include_modules="db_postgres mediaproxy db_unixodbc carrierroute" \
		all || return 1
}

package() {
	cd "$_builddir"
	make prefix=/usr \
		cfg-dir=/etc/kamailio/ \
		MODS_MYSQL=yes \
		MODS_PCRE=yes \
		MODS_PRESENCE=yes \
		MODS_RADIUS= \
		TLS= \
		include_modules="db_postgres mediaproxy db_unixodbc carrierroute" \
		basedir="$pkgdir" 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
}


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
}

mediaproxy() {
	pkgdesc="Mediaproxy support for kamailio"
	depends="kamailio"
	_mv_mod mediaproxy
}

unixodbc() {
	pkgdesc="UnixODBC support for kamailio"
	depends="kamailio"
	_mv_mod_k db_unixodbc
}

md5sums="a043944e195338d56bdfdcd6c86a468b  kamailio-3.0.0_src_2010-01-12_6d1e9f.tar.gz
eb665248ee39cf755a247286affc5cbb  kamailio.cfg
81100c479890a2a8c2628db22fdd1a0c  kamailio.initd
c646af2dd31f5c4289a2f802c873d98f  kamailio.pre-install
3fbaf633ff1620d0d526fc4047c7bed9  kamailio.post-install
10f8be110985a841dd5b892f86eb6722  kamailio-backslash.patch"