aboutsummaryrefslogtreecommitdiffstats
path: root/main/freeswitch/APKBUILD
blob: 7fba691170dfa946a248603502421a21458238cd (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
# Contributor: Michael Mason <ms13sp@gmail.com>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=freeswitch
pkgver=1.0.7_p20110602
_ver=${pkgver%_p*}
_snapshot=${pkgver#*_p}
pkgrel=4
pkgdesc="A communications platform written in C from the ground up"
url="http://www.freeswitch.org"
arch="all"
license="GPL"
depends=""
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
	jpeg-dev"
install="$pkgname.pre-install $pkgname.post-install $pkgname.pre-upgrade"
subpackages="$pkgname-dev $pkgname-flite $pkgname-sample-config:conf $pkgname-freetdm"
source="saveas-http://latest.freeswitch.org/freeswitch-$_ver.tar.gz/freeswitch-$pkgver.tar.gz
	freeswitch-mod_shout-textrels.patch
	0001-mod_sofia-update-mod_sofia_globals.guess_ip-on-addre.patch
	0002-mod_lua-alpine-module-search-path.patch
	0003-mod_conference_no_hangup.patch
	modules.conf
	freeswitch.confd
	freeswitch.initd
	"

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

prepare() {
	cd "$_builddir"
	for i in $source; do
		case $i in
		*.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;;
		esac
	done
	sed -i 's,freetdm.h,../src/include/freetdm.h,' libs/freetdm/mod_freetdm/mod_freetdm.c
}

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

	sed -i -e 's#^dbdir="${prefix}/db"#dbdir="/var/lib/freeswitch"#' configure.in || return 1
	./bootstrap.sh
	
	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
	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
	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
	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
}


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

conf() {
	pkgdesc="Freeswitch sample configureation"
	arch="noarch"
	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="813edb2192d1cc0fe224d9ef0492de4f  freeswitch-1.0.7_p20110602.tar.gz
11883affe0839a8e15fe680aeb11b86e  freeswitch-mod_shout-textrels.patch
5aed9ec61d7ac1f3758a89db159328c4  0001-mod_sofia-update-mod_sofia_globals.guess_ip-on-addre.patch
769eaa127d4dbae687dc4aa961a8cc70  0002-mod_lua-alpine-module-search-path.patch
74c3cdd3ce8474e8d084f475fa4f92c1  0003-mod_conference_no_hangup.patch
691fa3aca967203848bbb2a617545265  modules.conf
c608cca8ad773acebf201f581438c7e7  freeswitch.confd
aa358c9ca0d8b93fabb6a36a5ed4c469  freeswitch.initd"