summarylogtreecommitdiffstats
path: root/PKGBUILD
diff options
context:
space:
mode:
authorDavid Matson2016-10-30 18:22:55 -0700
committerDavid Matson2016-11-01 23:34:22 -0700
commite320dfa46cd88d2dc086dccb040bdc853b4ebc21 (patch)
tree048a73f60994361719062b2d95f15c22e98e3895 /PKGBUILD
downloadaur-e320dfa46cd88d2dc086dccb040bdc853b4ebc21.tar.gz
Add initial package.
Diffstat (limited to 'PKGBUILD')
-rw-r--r--PKGBUILD182
1 files changed, 182 insertions, 0 deletions
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 000000000000..ed68f859526d
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,182 @@
+# Maintainer: David Matson <gitcoder at outlook dot com>
+pkgname=freeswitch-core
+pkgver=1.6.12
+pkgrel=1
+pkgdesc='A scalable, open source telephony platform'
+arch=('i686' 'x86_64')
+url='https://freeswitch.org/'
+license=('MPL')
+depends=('curl' 'libedit' 'pcre' 'speex' 'sqlite' 'xz')
+makedepends=('libjpeg-turbo' 'yasm' 'nasm')
+optdepends=()
+provides=('freeswitch')
+conflicts=('freeswitch')
+source=("https://files.freeswitch.org/releases/freeswitch/freeswitch-$pkgver.tar.xz"
+ 'freeswitch.service'
+ 'modules.conf')
+sha256sums=('ae072ca2d96fd9ef59ca6f589f932048b088c7b469d46e468bb917371de24ff9'
+ '7eff153fdae3c99cd884c654335b32f484df5cb7e624bd6adc630372ea83e573'
+ 'SKIP')
+
+declare -A _mod_depends
+_mod_depends=(['postgresql-libs']='mod_cdr_pg_csv'
+ ['unixodbc']='mod_odbc_cdr')
+
+declare -A _mod_makedepends
+_mod_makedepends=(['alsa-lib']='mod_alsa'
+ ['hiredis']='mod_hiredis'
+ ['imagemagick']='mod_imagick'
+ ['ladspa']='mod_ladspa'
+ ['lua']='mod_lua'
+ ['libmemcached']='mod_memcache'
+ ['libmongoc']='mod_mongo'
+ ['libmp4v2']='mod_mp4 mod_mp4v2'
+ ['libyaml']='mod_yaml'
+ ['ptlib-stable']='mod_opal'
+ ['opal-stable']='mod_opal'
+ ['opus']='mod_opus'
+ ['portaudio']='mod_portaudio mod_portaudio_stream'
+ ['python2']='mod_python mod_v8'
+ ['libshout']='mod_shout'
+ ['mpg123']='mod_shout'
+ ['lame']='mod_shout'
+ ['libsndfile']='mod_sndfile'
+ ['soundtouch']='mod_soundtouch'
+ ['unixodbc']='mod_odbc_cdr'
+ ['vlc']='mod_vlc')
+
+declare -A _mod_optdepends
+_mod_optdepends=(['hiredis']='mod_hiredis'
+ ['imagemagick']='mod_imagick'
+ ['ldns']='mod_enum'
+ ['libjpeg-turbo']='mod_spandsp'
+ ['libmemcached']='mod_memcache'
+ ['libmongoc']='mod_mongo'
+ ['libmp4v2']='mod_mp4 mod_mp4v2'
+ ['libsndfile']='mod_sndfile'
+ ['lua']='mod_lua'
+ ['mpg123']='mod_shout'
+ ['opus']='mod_opus'
+ ['perl']='mod_perl'
+ ['portaudio']='mod_portaudio mod_portaudio_stream'
+ ['soundtouch']='mod_soundtouch'
+ ['vlc']='mod_vlc')
+
+mod_enabled() {
+ if [[ "${srcdir}" ]]; then
+ _path="${srcdir}"/modules.conf
+ else
+ _path=modules.conf
+ fi
+
+ grep -Eq "^[a-z_]+/$1$" ${_path}
+}
+
+for _dep in "${!_mod_depends[@]}"; do
+ _mods=(${_mod_depends[$_dep]})
+
+ for _mod in "${_mods[@]}"; do
+ if [[ ! " ${depends} " =~ " ${_mod} " ]] && mod_enabled "${_mod}"; then
+ depends+=("${_dep}")
+ fi
+ done
+done
+
+for _dep in "${!_mod_makedepends[@]}"; do
+ _mods=(${_mod_makedepends[$_dep]})
+
+ for _mod in "${_mods[@]}"; do
+ if [[ ! " ${makedepends} " =~ " ${_mod} " ]] && mod_enabled "${_mod}"; then
+ makedepends+=("${_dep}")
+ fi
+ done
+done
+
+for _dep in "${!_mod_optdepends[@]}"; do
+ _mods=(${_mod_optdepends[$_dep]})
+ _dep_mods=()
+
+ for _mod in "${_mods[@]}"; do
+ if mod_enabled "${_mod}"; then
+ _dep_mods+=("${_mod}")
+ fi
+ done
+
+ if [[ ${#_dep_mods[@]} -eq 1 ]]; then
+ optdepends+=("${_dep}: for ${_dep_mods[0]} module")
+ elif [[ ${#_dep_mods[@]} -gt 0 ]]; then
+ _dep_list="${_dep_mods[@]}"
+ optdepends+=("${_dep}: for ${_dep_list// / and } modules")
+ fi
+done
+
+build() {
+ cd "freeswitch-$pkgver"
+
+ _mod_options=()
+
+ if mod_enabled 'mod_cdr_pg_csv'; then
+ _mod_options+=('--enable-core-pgsql-support')
+ fi
+
+ if mod_enabled 'mod_odbc_cdr'; then
+ _mod_options+=('--enable-core-odbc-support')
+ fi
+
+ if mod_enabled 'mod_python'; then
+ _mod_options+=('--with-python=/usr/bin/python2')
+ fi
+
+ ./configure --enable-optimization --disable-debug --prefix=/usr \
+ --sysconfdir=/etc --localstatedir=/var --libdir=/usr/lib/freeswitch \
+ --includedir=/usr/include/freeswitch \
+ --with-modinstdir=/usr/lib/freeswitch/mod --with-rundir=/run \
+ --with-logfiledir=/var/log/freeswitch --with-dbdir=/var/lib/freeswitch/db \
+ --with-htdocsdir=/usr/share/freeswitch/htdocs \
+ --with-fontsdir=/usr/share/freeswitch/fonts \
+ --with-soundsdir=/usr/share/freeswitch/sounds \
+ --with-grammardir=/usr/share/freeswitch/grammar \
+ --with-certsdir=/etc/freeswitch/tls \
+ --with-scriptdir=/usr/share/freeswitch/scripts \
+ --with-recordingsdir=/var/lib/freeswitch/recordings \
+ --with-imagesdir=/usr/share/freeswitch/images \
+ --with-storagedir=/var/lib/freeswitch/storage \
+ --with-cachedir=/var/cache/freeswitch \
+ --with-pkgconfigdir=/usr/lib/pkgconfig \
+ ${_mod_options[@]}
+
+ cp "${srcdir}"/modules.conf .
+ make
+}
+
+package() {
+ cd "freeswitch-$pkgver"
+
+ make DESTDIR="$pkgdir/" install
+
+ rmdir "${pkgdir}"/run
+ rm -r "${pkgdir}"/etc/freeswitch/*
+
+ if mod_enabled 'mod_perl'; then
+ mkdir -p "${pkgdir}"/usr/lib/perl5
+ mv "${pkgdir}"/usr/perl "${pkgdir}"/usr/lib/perl5/vendor_perl
+ fi
+
+ if ! mod_enabled 'mod_xml_rpc'; then
+ rm -r "${pkgdir}"/usr/share/freeswitch/htdocs/*
+ rm -r "${pkgdir}"/usr/share/freeswitch/fonts/*
+ rm -r "${pkgdir}"/usr/share/freeswitch/images/*
+ fi
+
+ if ! mod_enabled 'mod_xml_cdr'; then
+ rmdir "${pkgdir}"/var/log/freeswitch/xml_cdr
+ fi
+
+ if [ -e "${pkgdir}"/usr/share/freeswitch/grammar/model/communicator/ ]; then
+ chown root:root \
+ "${pkgdir}"/usr/share/freeswitch/grammar/model/communicator/*
+ fi
+
+ install -Dm644 "${srcdir}"/freeswitch.service \
+ "${pkgdir}"/usr/lib/systemd/system/freeswitch.service
+}