updated on Mon Jan 9 20:07:11 UTC 2012
[aur-mirror.git] / freeswitch-git / PKGBUILD
blobbd9526e440e2aaacbd7e7f1cd5f8b7f5103456d8
1 # This builds the FreeSWITCH open source telephone engine
2 # from the freeswitch git.  It enables the following modules
3 # not enabled in the standard freeswitch build:
4 #  * mod_callcenter
5 #  * mod_xml_curl
6 # And disables the following standard modules:
7 #  * mod_dialplan_asterisk
8 #  * mod_say_ru
9 #  * mod_spidermonkey
10 #  * mod_lua
11 # You can modify this and other options in the BUILD CONFIGURATION section below
13 # Built using http://wiki.archlinux.org/index.php/VCS_PKGBUILD_Guidelines
14 # Maintainer: TJ Vanderpoel <tj@rubyists.com>
16 # BUILD CONFIGURATION BEGINS #
18 # ENABLE THIS IF YOU WANT ODBC IN THE CORE (uncomment it)
19 # You must have unixodbc installed or the build will fail
21 #_odbc=--enable-core-odbc-support
23 # SET THIS TO GET HIGHER QUALITY SOUNDFILES
24 # Value can be "hd-", "uhd-", or "cd-" to get 16k, 32k, or 48k sounds.
25 # By default we only download the 8k sounds. If you only use g711 or
26 # 8k codecs, leave this as-is
28 _sounds=""
30 # ADDED MODULES
31 # If you don't need/want these modules remove them from _enabled_modules
32 # You can add any modules here you wish to add, make sure they're not
33 # in _disabled_modules, though
35 # xml_int/mod_xml_curl - Remote http dialplan lookups/control
36 # xml_int/mod_xml_cdr - Remote http dialplan lookups/control
37 # applications/mod_callcenter - Inbound call queueing system
38 _enabled_modules=(xml_int/mod_xml_curl
39                   xml_int/mod_xml_cdr
40                   formats/mod_shout
41                   applications/mod_callcenter)
43 # DISABLED MODULES
44 # Remove from _disabled_modules if you want to build these
46 # languages/mod_spidermonkey - server-side javascript
47 # languages/mod_lua - server-side lua
48 # say/mod_say_ru - Russian phrases
49 # dialplans/mod_dialplan_asterisk - Legacy dialplan
50 _disabled_modules=(languages/mod_spidermonkey
51                    languages/mod_lua
52                    say/mod_say_ru
53                    dialplans/mod_dialplan_asterisk)
55 # NOTE: We build --without-python due to Arch defaulting python3 as python. 
56 # Uncomment the following to attempt building it anyway
58 #_python=--with-python
60 # CONCURRENT BOOTSTRAP
61 # Uncomment this to enable backgrounded concurrent bootstrap operations.
62 # You will suffer a lot of autotools scroll from this, Fair Warning.
64 #_concurrent="-j"
66 # BUILD CONFIGURATION ENDS                     #
67 #                                              #
68 # CHANGE ANYTHING BELOW HERE AT YOUR OWN RISK! #
69 #                                              #
71 pkgname=freeswitch-git
72 pkgver=20120109
73 pkgrel=1
74 pkgdesc="Open Source soft switch (telephony engine) built from a specific, stable git commit tag"
75 arch=('i686' 'x86_64')
76 url="http://freeswitch.org"
77 license=('MPL')
78 depends=("util-linux-ng")
79 makedepends=('git' 'libjpeg' 'curl')
80 optdepends=('unixodbc: for odbc support in the core'
81             'python: for some contrib scripts')
82 provides=('freeswitch')
83 conflicts=('freeswitch')
84 install=freeswitch.install
85 source=('freeswitch.conf.d' 'freeswitch.rc.conf' 'README.freeswitch' 'run.freeswitch' 'run_log.freeswitch' 'conf_log.freeswitch')
86 changelog='ChangeLog'
88 _gitroot="git://git.freeswitch.org/freeswitch.git"
89 _gitname="freeswitch"
91 enable_module() {
92   _fs_mod=$1
93   sed -i -e "s|^#${_fs_mod}|${_fs_mod}|" modules.conf
96 disable_module() {
97   _fs_mod=$1
98   sed -i -e "s|^${_fs_mod}|#${_fs_mod}|" modules.conf
101 build() {
102   cd "$srcdir"
103   msg "Connecting to GIT server...."
105   if [ -d $_gitname ] ; then
106     cd $_gitname
107     git pull origin master
108     msg "The local files are updated."
109   else
110     git clone --depth 1 $_gitroot
111     msg "FreeSWITCH repository cloned"
112   fi
114   msg "GIT checkout done or server timeout"
115   msg "Starting make..."
117   rm -rf "$srcdir/$_gitname-build"
118   cp -a "$srcdir/$_gitname/" "$srcdir/${_gitname}-build"
119   cd "$srcdir/$_gitname-build"
121   # BUILD BEGINS
122   msg "Bootstrapping..."
123   ./bootstrap.sh ${_concurrent} > /dev/null
124   msg "Bootstrap Complete"
126   # MODULE ENABLE/DISABLE
127   for _mod in ${_enabled_modules[@]};do
128     msg "Enabling $_mod"
129     enable_module $_mod
130   done
132   for _mod in ${_disabled_modules[@]};do
133     msg "Disabling $_mod"
134     disable_module $_mod
135   done
137   msg "Module Configuration Complete, Stop Now with Ctrl-C if the above is not correct"
138   sleep 5
140   # CONFIGURE
141   ./configure --prefix=/var/lib/freeswitch ${_python:---without-python} \
142     --bindir=/usr/bin --sbindir=/usr/sbin --localstatedir=/var \
143     --sysconfdir=/etc/freeswitch --datarootdir=/usr/share \
144     --libexecdir=/usr/lib/freeswitch --libdir=/usr/lib/freeswitch \
145     --includedir=/usr/include/freeswitch ${_odbc}
147   # COMPILE
148   make
151 enable_mod_xml() {
152   _fs_mod=$(basename $1)
154   if [ "x$(grep $_fs_mod $pkgdir/etc/freeswitch/autoload_configs/modules.conf.xml)" == "x" ];then
155     msg "Adding missing module ${_fs_mod} to modules.conf.xml"
156     sed -i -e "s|^\(\s*</modules>\)|\t\t<\!-- added by archlinux package -->\n\t\t<load module=\"${_fs_mod}\"/>\n\1|" \
157       "$pkgdir/etc/freeswitch/autoload_configs/modules.conf.xml"
158   else
159     msg "Enabling module ${_fs_mod} in modules.conf.xml"
160     sed -i -e "s|^\(\s*\)<\!--\s*\(<load module=\"${_fs_mod}\"/>\)\s*-->|\1\2|" \
161       "$pkgdir/etc/freeswitch/autoload_configs/modules.conf.xml"
162   fi
166 disable_mod_xml() {
167   _fs_mod=$(basename $1)
168   msg "Disabling module ${_fs_mod} in modules.conf.xml"
169   sed -i -e "s|^\(\s*\)\(<load module=\"${_fs_mod}\"/>\)|\1<\!-- \2 -->|" \
170     "$pkgdir/etc/freeswitch/autoload_configs/modules.conf.xml"
173 package() {
174   cd "$srcdir/$_gitname-build"
175   make DESTDIR="$pkgdir/" install
176   make DESTDIR="$pkgdir/" ${_sounds}moh-install
177   make DESTDIR="$pkgdir/" ${_sounds}sounds-install
179   cd "$pkgdir" # MUY IMPORTANT, $PWD is $pkgdir from here on out
180   # Mangle freeswitch's installed dirs into a more compliant structure,
181   # leaving symlinks in their place so freeswitch doesn't notice.
182   [ -d var/spool/freeswitch ] || install -D -m 0755 -d var/spool/freeswitch
183   [ -d var/log/freeswitch ] || install -D -m 0755 -d var/log/freeswitch
184   ln -s /var/log/freeswitch var/lib/freeswitch/log
185   mv var/lib/freeswitch/db var/spool/freeswitch/ && 
186     ln -s /var/spool/freeswitch/db var/lib/freeswitch/db
187   mv var/lib/freeswitch/recordings var/spool/freeswitch/ && \
188     ln -s /var/spool/freeswitch/recordings var/lib/freeswitch/recordings
189   install -D -m 0755 -d var/spool/freeswitch/storage && \
190     ln -s /var/spool/freeswitch/storage var/lib/freeswitch/storage
191   rm var/lib/freeswitch/mod/*.la 2>/dev/null|| true
192   rm usr/lib/freeswitch/*.la 2>/dev/null|| true
193   mv var/lib/freeswitch/mod usr/lib/freeswitch/ && \
194     ln -s /usr/lib/freeswitch/mod var/lib/freeswitch/mod
195   install -D "$srcdir/freeswitch.rc.conf" etc/rc.d/freeswitch
196   install -D -m 0644 "$srcdir/freeswitch.conf.d" etc/conf.d/freeswitch
197   install -D -m 0644 "$srcdir/README.freeswitch" usr/share/doc/freeswitch/README
198   cp -a "$srcdir/${_gitname}-build/docs" usr/share/doc/freeswitch
199   install -D -m 0755 -d usr/share/doc/freeswitch/support-d
200   cp -a "$srcdir/${_gitname}-build/support-d" usr/share/doc/freeswitch/
201   install -D -m 0755 -d usr/share/doc/freeswitch/scripts
202   cp -a "$srcdir/${_gitname}-build/scripts" usr/share/doc/freeswitch/
203   # Copy upstream confs 
204   install -D -m 0755 -d usr/share/doc/freeswitch/examples/conf.default
205   install -D -m 0755 -d usr/share/doc/freeswitch/examples/conf.archlinux
206   ln -s /etc/freeswitch var/lib/freeswitch/conf
207   cp -a etc/freeswitch/* usr/share/doc/freeswitch/examples/conf.default/
209   for _mod in ${_enabled_modules[@]};do
210     enable_mod_xml $_mod
211   done
213   for _mod in ${_disabled_modules[@]};do
214     disable_mod_xml $_mod
215   done
217   cp -a etc/freeswitch/* usr/share/doc/freeswitch/examples/conf.archlinux/
218   rm etc/freeswitch/directory/default/101?.xml
219   rm etc/freeswitch/directory/default/100[1-9].xml
220   rm etc/freeswitch/directory/default/example.com.xml
221   rm etc/freeswitch/directory/default/skinny-example.xml
222   rm etc/freeswitch/directory/default/brian.xml
223   install -D -m 0755 "$srcdir/run.freeswitch" etc/sv/freeswitch/run
224   install -D -m 0755 "$srcdir/run_log.freeswitch" etc/sv/freeswitch/log/run
225   install -D -m 0644 "$srcdir/conf_log.freeswitch" etc/sv/freeswitch/log/conf
227 md5sums=('f674b302edeb1895bbefcaf7bb8510ca'
228          'c83b9f557a3ad362a51b48785aa00f44'
229          'bfa0c6c70c8173bc78fd228bd42a98ef'
230          '1fc676c6eba5c38af6f77fd3e12a409b'
231          'e9f0bdde366bca6fd29a9202818f3591'
232          'e6411d793501c29ec4afd6d54018de1b')
233 backup=("etc/freeswitch/autoload_configs/abstraction.conf.xml" "etc/freeswitch/autoload_configs/acl.conf.xml" "etc/freeswitch/autoload_configs/alsa.conf.xml" "etc/freeswitch/autoload_configs/blacklist.conf.xml"
234 "etc/freeswitch/autoload_configs/callcenter.conf.xml" "etc/freeswitch/autoload_configs/cdr_csv.conf.xml" "etc/freeswitch/autoload_configs/cdr_mongodb.conf.xml" "etc/freeswitch/autoload_configs/cdr_pg_csv.conf.xml"
235 "etc/freeswitch/autoload_configs/cdr_sqlite.conf.xml" "etc/freeswitch/autoload_configs/cepstral.conf.xml" "etc/freeswitch/autoload_configs/cidlookup.conf.xml" "etc/freeswitch/autoload_configs/conference.conf.xml"
236 "etc/freeswitch/autoload_configs/console.conf.xml" "etc/freeswitch/autoload_configs/db.conf.xml" "etc/freeswitch/autoload_configs/dialplan_directory.conf.xml" "etc/freeswitch/autoload_configs/dingaling.conf.xml"
237 "etc/freeswitch/autoload_configs/directory.conf.xml" "etc/freeswitch/autoload_configs/distributor.conf.xml" "etc/freeswitch/autoload_configs/easyroute.conf.xml" "etc/freeswitch/autoload_configs/enum.conf.xml"
238 "etc/freeswitch/autoload_configs/erlang_event.conf.xml" "etc/freeswitch/autoload_configs/event_multicast.conf.xml" "etc/freeswitch/autoload_configs/event_socket.conf.xml" "etc/freeswitch/autoload_configs/fax.conf.xml"
239 "etc/freeswitch/autoload_configs/fifo.conf.xml" "etc/freeswitch/autoload_configs/hash.conf.xml" "etc/freeswitch/autoload_configs/httapi.conf.xml" "etc/freeswitch/autoload_configs/http_cache.conf.xml"
240 "etc/freeswitch/autoload_configs/ivr.conf.xml" "etc/freeswitch/autoload_configs/java.conf.xml" "etc/freeswitch/autoload_configs/lcr.conf.xml" "etc/freeswitch/autoload_configs/local_stream.conf.xml"
241 "etc/freeswitch/autoload_configs/logfile.conf.xml" "etc/freeswitch/autoload_configs/lua.conf.xml" "etc/freeswitch/autoload_configs/memcache.conf.xml" "etc/freeswitch/autoload_configs/modules.conf.xml"
242 "etc/freeswitch/autoload_configs/mongo.conf.xml" "etc/freeswitch/autoload_configs/nibblebill.conf.xml" "etc/freeswitch/autoload_configs/opal.conf.xml" "etc/freeswitch/autoload_configs/osp.conf.xml"
243 "etc/freeswitch/autoload_configs/perl.conf.xml" "etc/freeswitch/autoload_configs/pocketsphinx.conf.xml" "etc/freeswitch/autoload_configs/portaudio.conf.xml" "etc/freeswitch/autoload_configs/post_load_modules.conf.xml"
244 "etc/freeswitch/autoload_configs/presence_map.conf.xml" "etc/freeswitch/autoload_configs/python.conf.xml" "etc/freeswitch/autoload_configs/redis.conf.xml" "etc/freeswitch/autoload_configs/rss.conf.xml"
245 "etc/freeswitch/autoload_configs/rtmp.conf.xml" "etc/freeswitch/autoload_configs/sangoma_codec.conf.xml" "etc/freeswitch/autoload_configs/shout.conf.xml" "etc/freeswitch/autoload_configs/skinny.conf.xml"
246 "etc/freeswitch/autoload_configs/sofia.conf.xml" "etc/freeswitch/autoload_configs/spandsp.conf.xml" "etc/freeswitch/autoload_configs/spidermonkey.conf.xml" "etc/freeswitch/autoload_configs/switch.conf.xml"
247 "etc/freeswitch/autoload_configs/syslog.conf.xml" "etc/freeswitch/autoload_configs/timezones.conf.xml" "etc/freeswitch/autoload_configs/tts_commandline.conf.xml" "etc/freeswitch/autoload_configs/unicall.conf.xml"
248 "etc/freeswitch/autoload_configs/unimrcp.conf.xml" "etc/freeswitch/autoload_configs/voicemail.conf.xml" "etc/freeswitch/autoload_configs/voicemail_ivr.conf.xml" "etc/freeswitch/autoload_configs/xml_cdr.conf.xml"
249 "etc/freeswitch/autoload_configs/xml_curl.conf.xml" "etc/freeswitch/autoload_configs/xml_rpc.conf.xml" "etc/freeswitch/autoload_configs/zeroconf.conf.xml" "etc/freeswitch/chatplan/default.xml"
250 "etc/freeswitch/dialplan/default/00_ladspa.xml" "etc/freeswitch/dialplan/default/01_Talking_Clock.xml" "etc/freeswitch/dialplan/default.xml" "etc/freeswitch/dialplan/features.xml"
251 "etc/freeswitch/dialplan/public/00_inbound_did.xml" "etc/freeswitch/dialplan/public.xml" "etc/freeswitch/dialplan/skinny-patterns/20-Local_extension.xml" "etc/freeswitch/dialplan/skinny-patterns/90-External.xml"
252 "etc/freeswitch/dialplan/skinny-patterns/99-Default_Drop.xml" "etc/freeswitch/dialplan/skinny-patterns.xml" "etc/freeswitch/directory/default/1000.xml" "etc/freeswitch/directory/default/default.xml"
253 "etc/freeswitch/directory/default.xml" "etc/freeswitch/extensions.conf" "etc/freeswitch/freeswitch.xml" "etc/freeswitch/fur_elise.ttml"
254 "etc/freeswitch/jingle_profiles/client.xml" "etc/freeswitch/jingle_profiles/server.xml" "etc/freeswitch/mime.types" "etc/freeswitch/mrcp_profiles/loquendo-7-mrcp-v2.xml"
255 "etc/freeswitch/mrcp_profiles/nuance-1.0.0-mrcp-v1.xml" "etc/freeswitch/mrcp_profiles/nuance-5.0-mrcp-v1.xml" "etc/freeswitch/mrcp_profiles/nuance-5.0-mrcp-v2.xml" "etc/freeswitch/mrcp_profiles/unimrcpserver-mrcp-v1.xml"
256 "etc/freeswitch/mrcp_profiles/voxeo-prophecy-8.0-mrcp-v1.xml" "etc/freeswitch/notify-voicemail.tpl" "etc/freeswitch/sip_profiles/external.xml" "etc/freeswitch/sip_profiles/internal-ipv6.xml"
257 "etc/freeswitch/sip_profiles/internal.xml" "etc/freeswitch/skinny_profiles/internal.xml" "etc/freeswitch/tetris.ttml" "etc/freeswitch/vars.xml"
258 "etc/freeswitch/voicemail.tpl" "etc/freeswitch/web-vm.tpl")