aboutsummaryrefslogtreecommitdiffstats
path: root/main/freeswitch/APKBUILD
blob: 1a2745357376d696a181624a601f88e4771d298a (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
# Contributor: Michael Mason <ms13sp@gmail.com>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=freeswitch
pkgver=1.0.6
pkgrel=13
pkgdesc="A communications platform written in C from the ground up"
url="http://www.freeswitch.org"
license="GPL"
depends=""
makedepends="curl-dev unixodbc-dev zlib-dev openssl-dev ncurses-dev
	autoconf automake libtool"
install="$pkgname.pre-install $pkgname.post-install"
subpackages="$pkgname-dev $pkgname-flite $pkgname-sample-config:conf"
source="http://files.freeswitch.org/freeswitch-$pkgver.tar.gz
	modules.conf
	freeswitch.confd
	freeswitch.initd
	"

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

build() {
	     cd "$_builddir"
	cp -f "$srcdir/modules.conf" modules.conf || return 1

	# 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

	./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 \
		|| return 1

	# flite does not work with parallel builds
	# first build libfreeswitch (in parallel)
	make libfreeswitch.la || return 1
	# then we build mod_flite, disabling parallel builds
	( cd src/mod/asr_tts/mod_flite && make -j1 ) || return 1
	# finally we build the rest
	make all || return 1
}
package(){
	cd "$srcdir/$pkgname-$pkgver"
	make -j1 DESTDIR="$pkgdir" install || return 1
	# 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
	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"/usr/share/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
}


_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"
        depends="freeswitch"
        install=
        _mv_mod mod_flite mod_say_de mod_say_en mod_say_es mod_say_fr \
		mod_say_it mod_say_nl mod_say_zh
}

conf() {
	pkgdesc="Freeswitch sample configureation"
	depends="freeswitch"
	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
}

md5sums="388effee587887a81fe7f411b7350590  freeswitch-1.0.6.tar.gz
1f9ed1daf9a1fb910571857c27b933ad  modules.conf
c608cca8ad773acebf201f581438c7e7  freeswitch.confd
6973e15d72e5876152b160bd9e8d282b  freeswitch.initd"