aboutsummaryrefslogtreecommitdiffstats
path: root/main/freeswitch/APKBUILD
blob: 1c9f89109f11bf66bcbda4047ba3a1c9f0694bab (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
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
# Contributor: Michael Mason <ms13sp@gmail.com>
# Contributor: Cameron Banta <cbanta@gmail.com>
pkgname=freeswitch
pkgver=1.4.6
pkgrel=1
pkgdesc="A communications platform written in C from the ground up"
url="http://www.freeswitch.org"
arch="all"
license="GPL"
depends=""
pkgusers="freeswitch"
options="!configsub"
pkggroups="freeswitch"
makedepends="curl-dev unixodbc-dev zlib-dev openssl-dev ncurses-dev
	autoconf automake libtool libpri-dev bash net-snmp-dev postgresql-dev
	libiconv-dev subversion flac-dev libogg-dev libvorbis-dev
	libjpeg-turbo-dev sngtc_client-dev gnutls-dev util-linux-dev
	sqlite-dev pcre-dev speex-dev ldns-dev libedit-dev lua5.2-dev"
install="$pkgname.pre-install $pkgname.pre-upgrade"
subpackages="$pkgname-dev $pkgname-flite $pkgname-timezones
	$pkgname-sample-config:conf $pkgname-freetdm $pkgname-sangoma
	$pkgname-snmp $pkgname-pgsql"

_json_c="json-c-0.9.tar.gz"
_flite="flite-1.5.4-current.tar.bz2"
_lame="lame-3.98.4.tar.gz"
_libshout="libshout-2.2.2.tar.gz"
_mpg123="mpg123-1.13.2.tar.gz"
_libsources="
	freeswitch-$_json_c::http://files.freeswitch.org/downloads/libs/$_json_c
	freeswitch-$_flite::http://files.freeswitch.org/downloads/libs/$_flite
	freeswitch-$_lame::http://files.freeswitch.org/downloads/libs/$_lame
	freeswitch-$_libshout::http://files.freeswitch.org/downloads/libs/$_libshout
	freeswitch-$_mpg123::http://files.freeswitch.org/downloads/libs/$_mpg123
	"

source="http://files.freeswitch.org/$pkgname-$pkgver.tar.xz
	$_libsources
	getlib.patch
	modules.conf
	freeswitch.confd
	freeswitch.initd
	libshout-disable-examples.patch
	0002-mod_lua-alpine-module-search-path.patch
	freeswitch-mod_shout-textrels.patch
	system-lua.patch
	"

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

prepare() {
	cd "$_builddir"/libs
	for i in $_libsources; do
		local f=${i##*/}
		ln -s ../../${f%.tar*} . || return 1
	done
	cd "$_builddir"
	for i in $source; do
		case $i in
		libshout-disable-examples.patch) msg $i; cd "$srcdir"; patch -p0 -i "$srcdir"/$i || return 1;;
		*.patch) msg $i; cd "$_builddir"; patch -p1 -i "$srcdir"/$i || return 1;;
		esac
	done
	./rebootstrap.sh || return 1
	cd "$srcdir"
	update_config_sub || return 1
}

build() {
	cd "$_builddir"

	# i think our max cmd len is 32768
	# by specifying it here we save our selves from some CPU cycles
	export lt_cv_sys_max_cmd_len=8192

	cp -f "$srcdir/modules.conf" modules.conf || return 1

	CFLAGS="-Wno-unused-but-set-variable" ./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc/freeswitch \
		--with-modinstdir=/usr/lib/freeswitch \
		--with-rundir=/var/run/freeswitch \
		--mandir=/usr/share/man \
		--infodir=/usr/share/info \
		--with-devrandom=/dev/urandom \
		--with-libpri \
		--disable-debug \
		|| return 1

	# first build libfreeswitch (in parallel)
	make src/include/switch_version.h src/include/switch_swigable_cpp.h
	(cd libs/portaudio && make SHELL=/bin/bash) || return 1
	make libfreeswitch.la || return 1
	# finally we build the rest
	make -j1 all || return 1
}
package(){
	cd "$_builddir"
	make -j1 DESTDIR="$pkgdir" install || return 1
	find "$pkgdir" -name '*.la' -delete

	# we need to do some moving/cleanup to allow some... kind of FHS
	mkdir -p "$pkgdir"/var/run/freeswitch
	mkdir -p "$pkgdir"/var/lib/freeswitch
	mkdir -p "$pkgdir"/var/log
	mkdir -p "$pkgdir"/usr/share/freeswitch/sounds
	mv "$pkgdir"/usr/db "$pkgdir"/var/lib/freeswitch/
	mv "$pkgdir"/usr/grammar "$pkgdir"/var/lib/freeswitch/
	mv "$pkgdir"/usr/htdocs "$pkgdir"/usr/share/freeswitch/
	mv "$pkgdir"/usr/recordings "$pkgdir"/var/lib/freeswitch/
	mv "$pkgdir"/usr/scripts "$pkgdir"/etc/freeswitch/
	mv "$pkgdir"/usr/log "$pkgdir"/var/log/freeswitch
	install -m755 -D "$srcdir"/$pkgname.initd "$pkgdir"/etc/init.d/$pkgname
	install -m644 -D "$srcdir"/$pkgname.confd "$pkgdir"/etc/conf.d/$pkgname
	chown -R freeswitch:freeswitch "$pkgdir"/var/*/freeswitch
}


_mv_mod() {
	local moddir=usr/lib/freeswitch i=
	mkdir -p "$subpkgdir"/$moddir
	for i in $@; do
		mv "$pkgdir"/$moddir/$i.so "$subpkgdir"/$moddir/ || return 1
	done
}


flite() {
        pkgdesc="Freeswitch Text To Speech Module"
        install=
        _mv_mod mod_flite
##
## The mod_say_xx modules can be used with out flite (for numbers, etc using
## sound files). So they shouldn't be in the flite package -cB
##
#	_mv_mod mod_say_de mod_say_en mod_say_es mod_say_fr \
#		mod_say_it mod_say_nl mod_say_zh mod_say_hu mod_say_ru \
#		mod_say_th mod_say_he
}

freetdm() {
	pkgdesc="Freeswitch FreeTDM Module"
	install=
	_mv_mod mod_freetdm ftmod_analog ftmod_analog_em ftmod_libpri \
		ftmod_skel ftmod_zt
	mv "$pkgdir"/usr/lib/libfreetdm.so* "$subpkgdir"/usr/lib/
}

sangoma() {
	pkgdesc="Freeswitch Sangoma Media Transcode Codec Module"
	install=
	_mv_mod mod_sangoma_codec
}

timezones() {
	pkgdesc="Freeswitch timezone configuration"
	arch="noarch"
	install=
	replaces="freeswitch-sample-config"
	mkdir -p "$subpkgdir"/etc/freeswitch/autoload_configs
	mv "$pkgdir"/etc/freeswitch/autoload_configs/timezones.conf.xml \
		"$subpkgdir"/etc/freeswitch/autoload_configs
}

snmp() {
	pkgdesc="Freeswitch SNMP module"
	install=
	_mv_mod mod_snmp
}

pgsql() {
	pkgdesc="Freeswitch PostgreSQL Module"
	install=
	_mv_mod mod_cdr_pg_csv
}

conf() {
	pkgdesc="Freeswitch sample configureation"
	arch="noarch"
	depends="freeswitch-timezones"
	install=
	mkdir -p "$subpkgdir"/etc/freeswitch
	# move all configs except freeswitch.xml
	for i in "$pkgdir"/etc/freeswitch/*; do
		[ "$i" = "$pkgdir"/etc/freeswitch/freeswitch.xml ] && continue
		mv "$i" "$subpkgdir"/etc/freeswitch/ || return 1
	done
	mkdir -p "$pkgdir"/etc/freeswitch/scripts
}

md5sums="0c5d130f990d61812503510e08c21e59  freeswitch-1.4.6.tar.xz
4653b3b9c568bb9c782178abfaac128d  freeswitch-json-c-0.9.tar.gz
f3a2d88b1059f6f4ff3c20a8169bc0f4  freeswitch-flite-1.5.4-current.tar.bz2
8e9866ad6b570c6c95c8cba48060473f  freeswitch-lame-3.98.4.tar.gz
e409b006b5dad6d8668c3e429bf20159  freeswitch-libshout-2.2.2.tar.gz
452fd875cb5e4d16f77c757371836fff  freeswitch-mpg123-1.13.2.tar.gz
1e7f335ee00f589825ecc9affa779346  getlib.patch
0eb382f73ed393f28b8a797ebbfa608b  modules.conf
c608cca8ad773acebf201f581438c7e7  freeswitch.confd
b48a5dbaa455bbe0bba4880cc06e6ff8  freeswitch.initd
90b133b14a42c86d53d5e54dcbfbaf58  libshout-disable-examples.patch
448ce737698753ec23283cb11725a62b  0002-mod_lua-alpine-module-search-path.patch
4cd4923463c89bed053e6295b5a4ec40  freeswitch-mod_shout-textrels.patch
70a2a4d6021988cf40f23a4ede3c464c  system-lua.patch"
sha256sums="dcb489241dcbe54a80619565123545cc28bd44039684ce9dc5cb93108618732a  freeswitch-1.4.6.tar.xz
816fb2d4baab09e2f51a7c1be75bc9e03ed09d4cf3c2cd03c183f433bb9b565f  freeswitch-json-c-0.9.tar.gz
e98c54307954f406ef59a354f9ec274436b95be53f785e27191f19569af0ed7e  freeswitch-flite-1.5.4-current.tar.bz2
ac3144c76617223a9be4aaa3e28a66b51bcab28141050c3af04cb06836f772c8  freeswitch-lame-3.98.4.tar.gz
38701125cb0e0349f4394dd3254d6037eeb8af0747c0942ff433ffbcd48d2367  freeswitch-libshout-2.2.2.tar.gz
b3a855acc96e0061a0c2b1162e8aff80b6b1a03849e3756786db2fcacfc9a9bd  freeswitch-mpg123-1.13.2.tar.gz
ab437c92149b6fc88bc2fc8a228d6a5f8af574e2c90469a6dc4c753d13972c34  getlib.patch
f83f9680d243eb254bf045571f971a6c5cf716367444cd48ed26d4c3367f4c41  modules.conf
846a29a361ef6eecd77876963b5c0133699c40fa8b34c68df42d5f8a1a1915b1  freeswitch.confd
4c3d4db15afe51c6a29f13fded2821e3390dc21953fa7f9bcb238626a40d8037  freeswitch.initd
db0d3c252b5664ecb071bcf6868eff77c85dd7943a63fcfcac7e19db6a0ff61f  libshout-disable-examples.patch
0f867ea9bc20766728968523da7aac21b1def34d3f825db26d89fbc93c11d2ca  0002-mod_lua-alpine-module-search-path.patch
be1009327de615f04956ba0b0f44183f31c263e380af8027f94b976a84bcb09a  freeswitch-mod_shout-textrels.patch
c0225fc7141da701b6233771c79b1ffb134d1c8e8318c8306c2d6045d7811ab5  system-lua.patch"
sha512sums="466eab73fd006052ba40019cca8c03502475c059844b709b3bb179a5e020793fe5cd1ec41d48aa3c263c8297fc61367ccb65b2b6f8bb4f73d7d09f04e6e1da6d  freeswitch-1.4.6.tar.xz
38b8729275bbfebaee783e703d19481f3d32b50cfdeb338644b8db2742573ea025702c789b5ce8d5067dcde23c5a16b46231eaadf0b9c5dbff392d410912c772  freeswitch-json-c-0.9.tar.gz
e239e5730d7cbbae8a2985445e49156ffc92489d9fac655d0a9db617ac63c2fc522e4c086a6afced26daa383c269c546ff7e62227ae8bdc998024a85991fb55d  freeswitch-flite-1.5.4-current.tar.bz2
cf6cff914c06c2d65470c577eed2bfa226e9017cdfd26aa3e95c3b3b76c40568151ca223327859d6dacb982c80c06b672ba4e9f32ce1e452363c95126edb301b  freeswitch-lame-3.98.4.tar.gz
d517d1d6a79dfd4819c42603faafc051c69270831f4894c01f6bd38e877eb008f8458534857641fd8d653fd437fb41ee1c558ff2a76339c3a8a579f4d5a26baf  freeswitch-libshout-2.2.2.tar.gz
1940b6bf1c7167a7718ac0972e9c8cf9a49cf8c7a4a062052d00ead282cf4ae63214bfc317f2ccb424f6f3f26c602e91300d45635ba2d4f8da992c94b3ed0885  freeswitch-mpg123-1.13.2.tar.gz
4ceb48f64d2bc26a02cc0846276506241bfd30c156422b0a1d608fd172c099feb5c121a763652e9a45046dcdd0ba0eb71eab240e0c6ce2ad63ff781719e135a4  getlib.patch
6330e47cd3dcfdb4f5c99e91c9c725c7c8aa4f1691d83817d7600e510b5a586f3312bab84df3766448bbdab78cd1feebecf64b8280626b3f751f6e787f145e23  modules.conf
a585f6411185a26206137a1ad97a06fd6c73e80c5439e9be45eabfa70e7a83120169ba882971fcd328436c8e0242cbd664170b80754ea2846021689baf1f1595  freeswitch.confd
7792217db47a8f0d3d89a9c27090b9feefa8fd6e6b6651fa960be733fba9a22ac0e46f65fd6c24e489791bc0e4f42f1c5b89271541d024f1bbd593bb3b89666f  freeswitch.initd
91a6d7c8456de65855930b371f568f0230c28422e667453aa48fababd185b47677c06ff0c79f94c2a02182439b012d48cb54548cbde3d12b8d0e1ffbb9b229cc  libshout-disable-examples.patch
65c3d1fb08824fbdec3d9d3b332007a7847463bba272d9ba2df23ac218a2ede84eeb5a77a1a667c3dd370fe406bd2ebf8687d198a01519f4a09168418fbf39bc  0002-mod_lua-alpine-module-search-path.patch
5f085254ca9f5dc196afd39fc55e083b1998e776d9de2428e5657d99077526c33c1fc13f12432598184ce63138447fed7c318c384b743681703f5682dc8e1e50  freeswitch-mod_shout-textrels.patch
099e8e966e65fb480b00f20294c6c7ba02562f62af96482b72044f8efc79f45e42a82260099d8d1e5c1afdd4aa0946afa3fd6f323ab2781c899a5a18f082d7a7  system-lua.patch"