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:
6 # And disables the following standard modules:
7 # * mod_dialplan_asterisk
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
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
41 applications/mod_callcenter)
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
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.
66 # BUILD CONFIGURATION ENDS #
68 # CHANGE ANYTHING BELOW HERE AT YOUR OWN RISK! #
72 pkgver=1.2.0_pre_alpha
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"
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')
91 __gitroot="git://git.freeswitch.org/freeswitch.git"
92 __gitname="freeswitch"
93 __gitrev=1a1358a3914200a316978400f9298b273d1248ff
98 sed -i -e "s|^#${_fs_mod}|${_fs_mod}|" modules.conf
103 sed -i -e "s|^${_fs_mod}|#${_fs_mod}|" modules.conf
108 msg "Connecting to GIT server...."
110 if [ -d $__gitname ] ; then
112 git fetch origin HEAD
113 git checkout $__gitrev
114 msg "The local files are updated."
119 git remote add origin $__gitroot
120 git fetch origin HEAD
121 git checkout $__gitrev
124 msg "GIT checkout done or server timeout"
125 msg "Starting make..."
127 rm -rf "$srcdir/$__gitname-build"
128 cp -a "$srcdir/$__gitname" "$srcdir/$__gitname-build"
129 cd "$srcdir/$__gitname-build"
132 msg "Bootstrapping..."
133 ./bootstrap.sh ${_concurrent} > /dev/null
134 msg "Bootstrap Complete"
136 # MODULE ENABLE/DISABLE
137 for _mod in ${_enabled_modules[@]};do
142 for _mod in ${_disabled_modules[@]};do
143 msg "Disabling $_mod"
147 msg "Module Configuration Complete, Stop Now with Ctrl-C if the above is not correct"
151 ./configure --prefix=/var/lib/freeswitch ${_python:---without-python} \
152 --bindir=/usr/bin --sbindir=/usr/sbin --localstatedir=/var \
153 --sysconfdir=/etc/freeswitch --datarootdir=/usr/share \
154 --libexecdir=/usr/lib/freeswitch --libdir=/usr/lib/freeswitch \
155 --includedir=/usr/include/freeswitch ${_odbc} \
156 --with-recordingsdir=/var/spool/freeswitch/recordings \
157 --with-dbdir=/var/spool/freeswitch/db \
158 --with-pkgconfigdir=/usr/lib/pkgconfig \
159 --with-logfiledir=/var/log/freeswitch \
160 --with-modinstdir=/usr/lib/freeswitch/mod \
161 --with-rundir=/run/freeswitch
168 _fs_mod=$(basename $1)
170 if [ "x$(grep $_fs_mod $pkgdir/etc/freeswitch/autoload_configs/modules.conf.xml)" == "x" ];then
171 msg "Adding missing module ${_fs_mod} to modules.conf.xml"
172 sed -i -e "s|^\(\s*</modules>\)|\t\t<\!-- added by archlinux package -->\n\t\t<load module=\"${_fs_mod}\"/>\n\1|" \
173 "$pkgdir/etc/freeswitch/autoload_configs/modules.conf.xml"
175 msg "Enabling module ${_fs_mod} in modules.conf.xml"
176 sed -i -e "s|^\(\s*\)<\!--\s*\(<load module=\"${_fs_mod}\"/>\)\s*-->|\1\2|" \
177 "$pkgdir/etc/freeswitch/autoload_configs/modules.conf.xml"
183 _fs_mod=$(basename $1)
184 msg "Disabling module ${_fs_mod} in modules.conf.xml"
185 sed -i -e "s|^\(\s*\)\(<load module=\"${_fs_mod}\"/>\)|\1<\!-- \2 -->|" \
186 "$pkgdir/etc/freeswitch/autoload_configs/modules.conf.xml"
190 cd "$srcdir/$__gitname-build"
191 make DESTDIR="$pkgdir/" install
192 make DESTDIR="$pkgdir/" ${_sounds}moh-install
193 make DESTDIR="$pkgdir/" ${_sounds}sounds-install
195 cd "$pkgdir" # MUY IMPORTANT, $PWD is $pkgdir from here on out
196 # Mangle freeswitch's installed dirs into a more compliant structure,
197 # leaving symlinks in their place so freeswitch doesn't notice.
198 ln -s /var/log/freeswitch var/lib/freeswitch/log
199 ln -s /var/spool/freeswitch/db var/lib/freeswitch/db
200 ln -s /var/spool/freeswitch/recordings var/lib/freeswitch/recordings
201 install -D -m 0755 -d var/spool/freeswitch/storage && \
202 ln -s /var/spool/freeswitch/storage var/lib/freeswitch/storage
203 rm usr/lib/freeswitch/mod/*.la 2>/dev/null|| true
204 rm usr/lib/freeswitch/*.la 2>/dev/null || true
205 ln -s /usr/lib/freeswitch/mod var/lib/freeswitch/mod
206 install -D "$srcdir/freeswitch.rc.conf" etc/rc.d/freeswitch
207 install -D -m 0644 "$srcdir/freeswitch.conf.d" etc/conf.d/freeswitch
208 install -D -m 0644 "$srcdir/README.freeswitch" usr/share/doc/freeswitch/README
209 cp -a "$srcdir/${__gitname}-build/docs" usr/share/doc/freeswitch
210 install -D -m 0755 -d usr/share/doc/freeswitch/support-d
211 cp -a "$srcdir/${__gitname}-build/support-d" usr/share/doc/freeswitch/
212 install -D -m 0755 -d usr/share/doc/freeswitch/scripts
213 cp -a "$srcdir/${__gitname}-build/scripts" usr/share/doc/freeswitch/
214 # Copy upstream confs
215 install -D -m 0755 -d usr/share/doc/freeswitch/examples/conf.default
216 install -D -m 0755 -d usr/share/doc/freeswitch/examples/conf.archlinux
217 ln -s /etc/freeswitch var/lib/freeswitch/conf
218 cp -a etc/freeswitch/* usr/share/doc/freeswitch/examples/conf.default/
220 for _mod in ${_enabled_modules[@]};do
224 for _mod in ${_disabled_modules[@]};do
225 disable_mod_xml $_mod
228 mv etc/freeswitch/* usr/share/doc/freeswitch/examples/conf.archlinux/
230 install -D -m0755 -d usr/share/freeswitch/conf
231 install -D -m 0755 "$srcdir/run.freeswitch" etc/sv/freeswitch/run
232 install -D -m 0755 "$srcdir/run_log.freeswitch" etc/sv/freeswitch/log/run
233 install -D -m 0644 "$srcdir/conf_log.freeswitch" etc/sv/freeswitch/log/conf
235 md5sums=('f674b302edeb1895bbefcaf7bb8510ca'
236 'c83b9f557a3ad362a51b48785aa00f44'
237 'bfa0c6c70c8173bc78fd228bd42a98ef'
238 '1fc676c6eba5c38af6f77fd3e12a409b'
239 'e9f0bdde366bca6fd29a9202818f3591'
240 'e6411d793501c29ec4afd6d54018de1b')