summaryrefslogtreecommitdiffstats
path: root/main/freeswitch/APKBUILD
blob: f839e897a09a295e7a914c863036e49eaf3e4997 (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
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
# Contributor: Michael Mason <ms13sp@gmail.com>
# Contributor: Cameron Banta <cbanta@gmail.com>
pkgname=freeswitch
pkgver=1.4.0
pkgrel=0
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"
install="$pkgname.pre-install $pkgname.pre-upgrade"
subpackages="$pkgname-dev $pkgname-flite $pkgname-timezones
	$pkgname-sample-config:conf $pkgname-freetdm $pkgname-sangoma"
source="http://files.freeswitch.org/$pkgname-$pkgver.latest.tar.bz2
	freeswitch-mod_shout-textrels.patch
	0002-mod_lua-alpine-module-search-path.patch
	modules.conf
	freeswitch.confd
	freeswitch.initd
	"

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

prepare() {
	cd "$_builddir"
	for i in $source; do
		case $i in
		*.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;;
		esac
	done
}

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

	# remove -Werror since gcc-4.5 is more strict
	sed -i -e 's/-Werror//g' configure || return 1
	[ "$ALPINE_LIBC" != "eglibc" ] && export LDFLAGS="$LDFLAGS -liconv"
	CFLAGS="-Wno-unused-but-set-variable" ./configure \
		--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
}

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="fe7156cad3b37479de8da236a2d3653a  freeswitch-1.4.0.latest.tar.bz2
e3912aa52a4d8f8cb3b4e38c2668116d  freeswitch-mod_shout-textrels.patch
769eaa127d4dbae687dc4aa961a8cc70  0002-mod_lua-alpine-module-search-path.patch
0eb382f73ed393f28b8a797ebbfa608b  modules.conf
c608cca8ad773acebf201f581438c7e7  freeswitch.confd
b48a5dbaa455bbe0bba4880cc06e6ff8  freeswitch.initd"
sha256sums="e08731d5d30e3ddde5b1d7030636c4e0d6a121f318aecf9a88274d4b6cefd75e  freeswitch-1.4.0.latest.tar.bz2
ecb80df356c1a5e825eeff7327f15e6a5dd745610d6224d3785f851c30b99f15  freeswitch-mod_shout-textrels.patch
ec1eb0cc516533893d56afe8ad95e7f2c886522540b7b443c6d60a05207ed081  0002-mod_lua-alpine-module-search-path.patch
f83f9680d243eb254bf045571f971a6c5cf716367444cd48ed26d4c3367f4c41  modules.conf
846a29a361ef6eecd77876963b5c0133699c40fa8b34c68df42d5f8a1a1915b1  freeswitch.confd
4c3d4db15afe51c6a29f13fded2821e3390dc21953fa7f9bcb238626a40d8037  freeswitch.initd"
sha512sums="34b8038f9b42ed1b035a57c2057f34d78da31cc9ab38792fd5d7dad7eb8e1ebbca924cd487643714c4b25a1e126fe5d65147af948769e529c4f1640d90e3a490  freeswitch-1.4.0.latest.tar.bz2
082ee8e5daec0b2bbdd125f1a9270a77f244fb5b27ca816959311602acc0f68ed82bb568d7545b1da90b7a67ec444738ac70cc2a262b30d74ff5b985a0ce43ea  freeswitch-mod_shout-textrels.patch
61574226372574066d7a005f68dd90ad59af7950ec689c0899affc0afcde0d7801e6b0d571af0f2911d9f2953c8b87d2473170cbea9a527f23134a33721c78b6  0002-mod_lua-alpine-module-search-path.patch
6330e47cd3dcfdb4f5c99e91c9c725c7c8aa4f1691d83817d7600e510b5a586f3312bab84df3766448bbdab78cd1feebecf64b8280626b3f751f6e787f145e23  modules.conf
a585f6411185a26206137a1ad97a06fd6c73e80c5439e9be45eabfa70e7a83120169ba882971fcd328436c8e0242cbd664170b80754ea2846021689baf1f1595  freeswitch.confd
7792217db47a8f0d3d89a9c27090b9feefa8fd6e6b6651fa960be733fba9a22ac0e46f65fd6c24e489791bc0e4f42f1c5b89271541d024f1bbd593bb3b89666f  freeswitch.initd"