aboutsummaryrefslogtreecommitdiffstats
path: root/main/asterisk/APKBUILD
blob: cb1a7cf49e04e3bf6c347110dba21fd3b8345e3e (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
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
# Contributor: Timo Teras <timo.teras@iki.fi>
# Maintainer: Timo Teras <timo.teras@iki.fi>
pkgname=asterisk
pkgver=12.4.0
pkgrel=7
pkgdesc="Asterisk: A Module Open Source PBX System"
pkgusers="asterisk"
pkggroups="asterisk"
url="http://www.asterisk.org/"
arch="all"
license="GPL2"
depends=
makedepends="autoconf automake libtool tar wget ncurses-dev popt-dev newt-dev
	zlib-dev pjproject-dev jansson-dev libedit-dev dahdi-tools-dev libpri-dev
	sqlite-dev postgresql-dev unixodbc-dev freetds-dev openssl-dev lua-dev
	alsa-lib-dev spandsp-dev tiff-dev libresample speex-dev libogg-dev
	bluez-dev curl-dev libsrtp-dev util-linux-dev mysql-dev"
install="$pkgname.pre-install $pkgname.pre-upgrade"
subpackages="$pkgname-dbg $pkgname-dev $pkgname-doc $pkgname-pgsql $pkgname-odbc
	$pkgname-tds $pkgname-fax $pkgname-sample-config:sample
	$pkgname-sounds-moh:sound_moh $pkgname-sounds-en:sound_en
	$pkgname-mobile $pkgname-curl:_curl $pkgname-srtp $pkgname-dahdi
	$pkgname-speex $pkgname-alsa $pkgname-cdr-mysql:cdr_mysql"

_download="http://downloads.asterisk.org/pub/telephony/asterisk/releases"
_z=${pkgver##*.}
_xy=${pkgver%.$_z}
_patches=""
while [ $_z -gt 0 ]; do
	_patches="$_download/asterisk-$_xy.$_z-patch.gz $_patches"
	_z=$((_z-1))
done

source="$_download/asterisk-$_xy.0.tar.gz
	$_patches
	asterisk-addon-mp3-r201.patch.gz

	musl-libcap.patch
	musl-includes.patch
	musl-glob-compat.patch
	musl-outofmem-handling.patch
	musl-mutex-init.patch
	ASTERISK-18995.patch
	ASTERISK-19109.patch
	ASTERISK-20527.patch
	ASTERISK-23818.patch
	asterisk.initd
	asterisk.confd
	asterisk.logrotate"

_builddir="$srcdir/$pkgname-${pkgver/_/-}"

prepare() {
	cd "$srcdir"
	if [ -n "$_patches" ]; then
		mv "$pkgname-$_xy.0" "$pkgname-${pkgver/_/-}"
	fi

	cd "$_builddir"
	for i in $source; do
		case $i in
		*.patch) msg "$i"; patch -p1 -i "$srcdir"/$i || return 1;;
		*patch.gz) msg "${i##*/}"; gunzip < "$srcdir"/${i##*/} | patch -p0 || return 1;;
		esac
	done

	# asteriskssl does not have direct references to libssl, but looks up
	# symbols from it using dlsym(RTLD_NEXT), so use --no-as-needed for it.
	sed -i -e 's/ASTSSL_LIBS:=$(OPENSSL_LIB)/ASTSSL_LIBS:=-Wl,--no-as-needed $(OPENSSL_LIB) -Wl,--as-needed/g' main/Makefile

	sed -i -e 's:lua5.1/::' pbx/pbx_lua.c
	sed -i -e 's/int foo = res_ninit(NULL);/res_ninit_is_not_really_here();/g' configure.ac
	update_config_sub || return 1

	./bootstrap.sh
}

build() {
	cd "$_builddir"
	SHA1SUM="$PWD"/build_tools/sha1sum-sh ./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--infodir=/usr/share/info \
		--libdir=/usr/lib \
		--localstatedir=/var \
		--disable-xmldoc \
		--with-gsm=internal \
		--with-popt \
		--with-z \
		--with-newt \
		--with-unixodbc \
		--with-postgres \
		--with-tds \
		--with-dahdi \
		--with-pri \
		--with-tonezone \
		--with-resample \
		--with-sqlite3 \
		--with-speex \
		--with-asound \
		--without-x11 \
		--with-spandsp \
		--with-bluetooth \
		--with-libcurl \
		--with-libedit \
		--with-srtp \
		|| return 1

	# get default modules to build
	rm menuselect.makeopts
	make menuselect.makeopts

	# and add the non-default modules we need
	./menuselect/menuselect \
		--enable chan_mobile \
		--enable app_meetme \
		--enable cdr_mysql \
		menuselect.makeopts

	# build
	make ASTCFLAGS="$CFLAGS" ASTLDFLAGS="$LDFLAGS" LDCONFIG= || return 1
}

package() {
	cd "$_builddir"
	make -j1 DESTDIR="$pkgdir" LDCONFIG_FLAGS="-n" install || return 1

	install -d "$pkgdir"/var/run/asterisk
	install -d "$pkgdir"/var/lib/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

	chown -R asterisk:asterisk "$pkgdir"/var/*/asterisk
	chown -R asterisk:asterisk "$pkgdir"/etc/asterisk
	chmod -R u=rwX,g=rX,o= "$pkgdir"/etc/asterisk
}

_move_dir() {
	for DIR in "$@"; do
		local dest=`dirname "$subpkgdir/$DIR"`
		echo mkdir -p $dest
		mkdir -p "$dest"
		echo mv "$pkgdir"/$DIR $dest
		mv "$pkgdir"/"$DIR" "$dest"
	done
}

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

doc() {
	default_doc
}

dev() {
	default_dev
	depends="asterisk"
}

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*'
}

mobile() {
        depends=
        install=
        _find_and_move '*_mobile*'
}

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

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

srtp() { _find_and_move '*_srtp*'; }
dahdi() { _find_and_move '*_dahdi*'; }
speex() { _find_and_move '*_speex*'; }
alsa() { _find_and_move '*_alsa*'; }

sample() {
	arch="noarch"
	pkgdesc="Sample configuration files for asterisk"
	cd "$_builddir"
	mkdir -p "$subpkgdir"/var/lib/asterisk/phoneprov
	make -j1 samples DESTDIR="$subpkgdir"

	chown -R asterisk:asterisk "$subpkgdir"/var/*/asterisk
	chown -R asterisk:asterisk "$subpkgdir"/etc/asterisk
	chmod -R u=rwX,g=rX,o= "$subpkgdir"/etc/asterisk
}

sound_moh() {
	arch="noarch"
	pkgdesc="Default on-hold music files for asterisk"
	depends=
	install=
	_move_dir var/lib/asterisk/moh
	chown -R asterisk:asterisk "$subpkgdir"/var/*/asterisk
}

sound_en() {
	arch="noarch"
	pkgdesc="English sound files for asterisk"
	depends=
	install=
	_move_dir var/lib/asterisk/sounds/en
	chown -R asterisk:asterisk "$subpkgdir"/var/*/asterisk
}

md5sums="96af38f9d11a1ba794cd520cef842d9c  asterisk-12.4.0.tar.gz
126dd4fba66f4cf9aa94dfd7034e0ec4  asterisk-addon-mp3-r201.patch.gz
a66f192623276530eeb6d722ee35bee9  musl-libcap.patch
b4211313aae31efa8c3c1931ba47dbf9  musl-includes.patch
9b3e6cb75464a6ef4c40d191bdfdf7ea  musl-glob-compat.patch
10b84632764a6f05ec9973c31f5e82fb  musl-outofmem-handling.patch
1ca5e8326dc03c963a7ce5455d0f21ba  musl-mutex-init.patch
bc6713f5434e07b79d3afdd155461d72  ASTERISK-18995.patch
8499917c1476953cdc2f5c94c0581775  ASTERISK-19109.patch
676ca42ee1859d8a7bae4345ede5eb89  ASTERISK-20527.patch
829518608463847cb5ff00a945e45aed  ASTERISK-23818.patch
74cd25a5638a94ef51e9f4ede2fd28f2  asterisk.initd
ed31d7ba37bcf8b0346dcf8593c395f0  asterisk.confd
3e65172275684373e1a25c8a11224411  asterisk.logrotate"
sha256sums="6c72d0060d1ce7a7d09f510d91d588f269aac0032de6a4464d5449b0d5600a72  asterisk-12.4.0.tar.gz
d32a5a695cee1699011d0e9ad02eb43af612def06f92017627194099edf98e3f  asterisk-addon-mp3-r201.patch.gz
ba8334d855191af3fa662931244b6fea4ffc9eec84e40e1a52d6b3c0186d2005  musl-libcap.patch
e3b7128813d0452b152d3af5015da927b07849e7f33de9f80f1d10f65907d268  musl-includes.patch
c6a5c32646b767f09ebffccc49cac6a4ff9181498499e4453300775e75284b52  musl-glob-compat.patch
235b9c339793c02d1d80ac37d308cf14dc3e86fe8ccbe757e9855b186d9c164b  musl-outofmem-handling.patch
a5205ed44b57a72934baf8cde543ddb179f277494181818905110bfdcccfe7d9  musl-mutex-init.patch
7a7140156ae7fc7e833035db1e428db8d90159579cd2678c4b5cc829ded47485  ASTERISK-18995.patch
8970797d4812a751968c0db83816fe2bc05c8b01dba7f64f21c197807528d234  ASTERISK-19109.patch
1f822e618554e9962fe4599975bdcc24413e087dbd7ea4ce0305ecb7ea9bef94  ASTERISK-20527.patch
491cab5d61880603a4e2324d475f017d32abf78e3fe2225780a093b189aaa0d9  ASTERISK-23818.patch
13bcc98f2a78d4dd41e810232979eb83044e9166302bfb5b971315f2a82af36f  asterisk.initd
d221148583b57f9c37d7160f2493f0d204ad11f7abb17e3a3534e108ad5452d7  asterisk.confd
77b253b6db71460acf9a51e87ad4c8582027a46db01a4c50fb048bada58c19d1  asterisk.logrotate"
sha512sums="f1a58b42422efe7bca5bf39f400309d062b1f10c2918029e9b7db84dbffe38cef1712ce87537a22e4d7dcd32b3b768f057b6903d937d68593baeb5a56390f649  asterisk-12.4.0.tar.gz
aacef3f4796fb1abd33266998b53909cb4b36e7cc5ad2f7bac68bdc43e9a9072d9a4e2e7e681bddfa31f3d04575eb248afe6ea95da780c67e4829c1e22adfe1b  asterisk-addon-mp3-r201.patch.gz
d30d1be03cbc637f1d05e6897efa2e1fae560ac2c48124a9636c5ff390c81b8c07cf9cef6d930e71eb59cb932f234284a0390487ec257e0fa45ec11d294c106c  musl-libcap.patch
878b8cddc5af338a07658c388d42a7f9ddf3edcf302ca8b294adcf278b6ceacd463d279cb716b0b6b059f47eb287803bc15a7f36a403c66697f466ff3cd5a6e4  musl-includes.patch
edf65eba44e8f1f0e78671aba312bcff2090134cf94e89ebb4b6beef7b2d57b24381ae9511cbf9fffe6b555e695a3dbe2cedcd04f1d237df822fa742bd5092ac  musl-glob-compat.patch
7cbbad2c16d89b0b4ea45257a44c25ea96ca6ecb1f5bf7707656dfa3957cae34d1dca404b3d62baca8b55cea6f9fa39819bef48a1f4dad0124da95d6c80a294e  musl-outofmem-handling.patch
f72c2e04de80d3ed9ce841308101383a1655e6da7a3c888ad31fffe63d1280993e08aefcf8e638316d439c68b38ee05362c87503fca1f36343976a01af9d6eb1  musl-mutex-init.patch
42b2385d88e72473fe34c63e1be8cdf7f37688649fe5bf033b5ba17627008b771aec8f0a583e9ad483a20f9e1f7c33922cb42bf5b73adc68aa43fd46c5da1daa  ASTERISK-18995.patch
875dcd976b82b554157c5539df6fae0082b072c81d4db12827d1fc41c00e8dc0118b3bf7359f30e3b49051de27a85394ff30d08e62cde811a7c197b41f1f313a  ASTERISK-19109.patch
6edd8e0a1dce326aadf659c8bf8ed34083e8247b6c0f032d097c77df25feb93107375ba505e9076c084fe80676336d6c863e04c3c6808a850e24257fd7a7702d  ASTERISK-20527.patch
214479320e713e851fc26f730c076e2d7296a385c9abe573e0acfb277d657834d48d57ffb4a2b437fc42b9d004f867a0a1cc50aa1d39e1905b5baa6c05876056  ASTERISK-23818.patch
e29477aa57d88fedc96d13751f68f302d3892c70b5ea5b5a8cc85d0439335fc1a6847648447b443a074c0877718f23295e3752056a108301d340d1e2919465b1  asterisk.initd
ab6b6f08ff43268cbb1abb7ed7d678949991ba495682a644bbaeb017d6adbff0a43297905fd73ae8db1786a28d5b5904f1bc253209a0e388c8a27f26c6ce14ed  asterisk.confd
7591d2faf539d05d9ee4e431c78a5e20686721fd79221ad94dffeeaff9282220b09cb9aec214bd7a8d12affaec0276c9c91e6e21af8b6712c0a9502b60b02f2b  asterisk.logrotate"