aboutsummaryrefslogtreecommitdiffstats
path: root/main/asterisk/APKBUILD
blob: e1aec9bb7a3907a33f92710f64b5ff6187811b74 (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
# Contributor: Timo Teras <timo.teras@iki.fi>
# Maintainer: Timo Teras <timo.teras@iki.fi>
pkgname=asterisk
pkgver=1.6.2.7
pkgrel=0
pkgdesc="Asterisk: A Module Open Source PBX System"
url="http://www.asterisk.org/"
license="GPL"
depends=
makedepends="autoconf automake libtool ncurses-dev popt-dev newt-dev zlib-dev
	postgresql-dev unixodbc-dev dahdi-tools-dev libpri-dev tar
	freetds-dev openssl-dev lua-dev alsa-lib-dev spandsp-dev tiff-dev"
install="$pkgname.pre-install $pkgname.pre-upgrade $pkgname.post-install"
subpackages="$pkgname-dev $pkgname-doc $pkgname-pgsql $pkgname-odbc
	$pkgname-tds $pkgname-fax $pkgname-sample-config:sample"
source="http://downloads.digium.com/pub/asterisk/releases/$pkgname-$pkgver.tar.gz
	100-uclibc-daemon.patch
	101-caps-uclibc.patch
	400-bug-227.patch
	asterisk.initd
	asterisk.confd
	asterisk.logrotate"

_builddir="$srcdir/$pkgname-$pkgver"

prepare() {
	cd "$_builddir"
	for i in ../[1-9]*.patch; do
		msg "Apply $i"
		patch -p1 < $i || return 1
	done

	sed -i -e 's:lua5.1/::' pbx/pbx_lua.c
	sed -i -e 's/PBX_ICONV=1/PBX_ICONV=0/g' configure.ac

	./bootstrap.sh
}

build() {
	cd "$_builddir"
	./configure --prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--infodir=/usr/share/info \
		--libdir=/usr/lib \
		--localstatedir=/var \
		--disable-xmldoc --with-gsm=internal \
		--without-iconv --with-popt --with-z --with-newt \
		--with-odbc --with-postgres --with-tds \
		--with-dahdi --with-pri --with-tonezone \
		--with-asound \
		--without-x11 \
		--with-spandsp \
		|| return 1

	# and figure out which modules to build
	rm menuselect.makeopts
	make menuselect.makeopts
	make ASTLDFLAGS="$LDFLAGS" || return 1
}

package() {
	cd "$_builddir"
	make -j1 DESTDIR="$pkgdir" install

	install -d "$pkgdir"/var/run/asterisk
	install -m755 -D "$srcdir"/$pkgname.initd "$pkgdir"/etc/init.d/$pkgname
	install -m644 -D "$srcdir"/$pkgname.confd "$pkgdir"/etc/conf.d/$pkgname
	install -m644 -D "$srcdir"/$pkgname.logrotate \
		"$pkgdir"/etc/logrotate.d/$pkgname
}

_find_and_move() {
	local pattern="$1"
	cd "$pkgdir" || return 1
	find -name "$pattern" -type f | while read f; do
		local dest="$subpkgdir/${f%/*}"
		mkdir -p "$dest"
		mv "$f" "$dest"
	done
}

pgsql() {
	depends=
	install=
	_find_and_move '*_pgsql*'
}

odbc() {
	depends=
	install=
	_find_and_move '*odbc*'
}

tds() {
	depends=
	install=
	_find_and_move '*_tds*'
}

fax() {
        depends=
        install=
        _find_and_move '*_fax*'
}

sample() {
	pkgdesc="Sample configuration files for asterisk"
	cd "$_builddir"
	make samples DESTDIR="$subpkgdir"
}

md5sums="861f57ba43bfe05dc645e0679a260e41  asterisk-1.6.2.7.tar.gz
b00c9d98ce2ad445501248a197c6e436  100-uclibc-daemon.patch
6e1129e30c4fd2c25c86c81685a485a9  101-caps-uclibc.patch
79e9634b5054bceb3b8dc246654bb243  400-bug-227.patch
0ce3219e05f55af884a7dc6b99c2b276  asterisk.initd
ed31d7ba37bcf8b0346dcf8593c395f0  asterisk.confd
3e65172275684373e1a25c8a11224411  asterisk.logrotate"