You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
freeswitch/debian/bootstrap.sh

1516 lines
48 KiB

#!/bin/bash
##### -*- mode:shell-script; indent-tabs-mode:nil; sh-basic-offset:2 -*-
##### Author: Travis Cross <tc@traviscross.com>
codename="sid"
modulelist_opt=""
modules_add=""
use_sysvinit=""
while getopts "a:c:m:p:v" o; do
case "$o" in
a) avoid_mods_arch="$OPTARG" ;;
c) codename="$OPTARG" ;;
m) modulelist_opt="$OPTARG" ;;
p) modules_add="$modules_add $OPTARG";;
v) use_sysvinit="true";;
esac
done
shift $(($OPTIND-1))
if [ x${use_sysvinit} = x ]; then
case "$codename" in
wheezy|trusty|utopic|xenial) use_sysvinit="true";;
*) use_sysvinit="false";;
esac
fi
mod_dir="../src/mod"
conf_dir="../conf"
lang_dir="../conf/vanilla/lang"
fs_description="FreeSWITCH is a scalable open source cross-platform telephony platform designed to route and interconnect popular communication protocols using audio, video, text or any other form of media."
mod_build_depends="." mod_depends="." mod_recommends="." mod_suggests="."
supported_debian_distros="wheezy jessie stretch buster sid"
supported_ubuntu_distros="trusty utopic xenial"
supported_distros="$supported_debian_distros $supported_ubuntu_distros"
avoid_mods=(
applications/mod_sms_flowroute
applications/mod_limit
applications/mod_mongo
applications/mod_mp4
applications/mod_mp4v2
applications/mod_osp
applications/mod_rad_auth
applications/mod_skel
applications/mod_cluechoo
asr_tts/mod_cepstral
codecs/mod_com_g729
codecs/mod_ilbc
codecs/mod_openh264
codecs/mod_siren
codecs/mod_sangoma_codec
codecs/mod_skel_codec
endpoints/mod_gsmopen
endpoints/mod_h323
endpoints/mod_khomp
endpoints/mod_opal
endpoints/mod_reference
endpoints/mod_skypopen
endpoints/mod_unicall
event_handlers/mod_smpp
event_handlers/mod_event_zmq
formats/mod_webm
sdk/autotools
xml_int/mod_xml_ldap
xml_int/mod_xml_radius
)
avoid_mods_armhf=(
languages/mod_v8
)
avoid_mods_sid=(
directories/mod_ldap
)
avoid_mods_jessie=(
directories/mod_ldap
)
avoid_mods_wheezy=(
event_handlers/mod_amqp
languages/mod_java
languages/mod_managed
applications/mod_av
applications/mod_cv
applications/mod_hiredis
formats/mod_shout
applications/mod_sonar
applications/mod_soundtouch
formats/mod_vlc
)
avoid_mods_trusty=(
event_handlers/mod_amqp
loggers/mod_raven
)
avoid_mods_utopic=(
directories/mod_ldap
loggers/mod_raven
)
avoid_mods_xenial=(
event_handlers/mod_ldap
event_handlers/mod_amqp
asr_tts/mod_flite
loggers/mod_raven
)
manual_pkgs=(
freeswitch-all
freeswitch
libfreeswitch1
freeswitch-meta-bare
freeswitch-meta-default
freeswitch-meta-vanilla
freeswitch-meta-sorbet
freeswitch-meta-all
freeswitch-meta-codecs
freeswitch-meta-conf
freeswitch-meta-lang
freeswitch-meta-mod-say
freeswitch-all-dbg
freeswitch-dbg
libfreeswitch1-dbg
libfreeswitch-dev
freeswitch-doc
freeswitch-lang
freeswitch-timezones
)
if [ ${use_sysvinit} = "true" ]; then
manual_pkgs=( "${manual_pkgs[@]}" "freeswitch-sysvinit" )
else
manual_pkgs=( "${manual_pkgs[@]}" "freeswitch-systemd" )
fi
err () {
echo "$0 error: $1" >&2
exit 1
}
xread () {
local xIFS="$IFS"
IFS=''
read $@
local ret=$?
IFS="$xIFS"
return $ret
}
intersperse () {
local sep="$1"
awk "
BEGIN {
first=1;
sep=\"${sep}\";
}"'
/.*/ {
if (first == 0) {
printf "%s%s", sep, $0;
} else {
printf "%s", $0;
}
first=0;
}
END { printf "\n"; }'
}
postfix () {
local px="$1"
awk "
BEGIN { px=\"${px}\"; }"'
/.*/ { printf "%s%s\n", $0, px; }'
}
avoid_mod_filter () {
local x="avoid_mods_$codename[@]"
local y="avoid_mods_$avoid_mods_arch[@]"
local -a mods=("${avoid_mods[@]}" "${!x}" "${!y}")
for x in "${mods[@]}"; do
if [ "$1" = "$x" ]; then
[ "$2" = "show" ] && echo "excluding module $x" >&2
return 1
fi
done
return 0
}
modconf_filter () {
while xread l; do
if [ "$1" = "$l" ]; then
[ "$2" = "show" ] && echo "including module $l" >&2
return 0
fi
done < modules.conf
return 1
}
mod_filter () {
if test -f modules.conf; then
modconf_filter $@
else
avoid_mod_filter $@
fi
}
mod_filter_show () {
mod_filter "$1" show
}
map_fs_modules () {
local filterfn="$1" percatfns="$2" permodfns="$3"
for x in $mod_dir/*; do
test -d $x || continue
test ! ${x##*/} = legacy || continue
category=${x##*/} category_path=$x
for f in $percatfns; do $f; done
for y in $x/*; do
module_name=${y##*/} module_path=$y
module=$category/$module_name
if $filterfn $category/$module; then
[ -f ${y}/module ] && . ${y}/module
for f in $permodfns; do $f; done
fi
unset module_name module_path module
done
unset category category_path
done
}
map_modules () {
local filterfn="$1" percatfns="$2" permodfns="$3"
for x in $parse_dir/*; do
test -d $x || continue
category=${x##*/} category_path=$x
for f in $percatfns; do $f; done
for y in $x/*; do
test -f $y || continue
module=${y##*/} module_path=$y
$filterfn $category/$module || continue
module="" category="" module_name=""
section="" description="" long_description=""
build_depends="" depends="" recommends="" suggests=""
distro_conflicts=""
distro_vars=""
for x in $supported_distros; do
distro_vars="$distro_vars build_depends_$x"
eval build_depends_$x=""
done
. $y
[ -n "$description" ] || description="$module_name"
[ -n "$long_description" ] || description="Adds ${module_name}."
for f in $permodfns; do $f; done
unset \
module module_name module_path \
section description long_description \
build_depends depends recommends suggests \
distro_conflicts $distro_vars
done
unset category category_path
done
}
map_confs () {
local fs="$1"
for x in $conf_dir/*; do
test ! -d $x && continue
conf=${x##*/} conf_dir=$x
for f in $fs; do $f; done
unset conf conf_dir
done
}
map_langs () {
local fs="$1"
for x in $lang_dir/*; do
test ! -d $x && continue
lang=${x##*/} lang_dir=$x
for f in $fs; do $f; done
unset lang lang_dir
done
}
map_pkgs () {
local fsx="$1"
for x in "${manual_pkgs[@]}"; do
$fsx $x
done
map_pkgs_confs () { $fsx "freeswitch-conf-${conf//_/-}"; }
map_confs map_pkgs_confs
map_pkgs_langs () { $fsx "freeswitch-lang-${lang//_/-}"; }
map_langs map_pkgs_langs
map_pkgs_mods () {
$fsx "freeswitch-${module//_/-}"
$fsx "freeswitch-${module//_/-}-dbg"; }
map_modules map_pkgs_mods
}
list_pkgs () {
list_pkgs_thunk () { printf '%s\n' "$1"; }
map_pkgs list_pkgs_thunk
}
print_source_control () {
local libtool_dep="libtool, libtool-bin"
case "$codename" in
wheezy|trusty) libtool_dep="libtool" ;;
esac
local debhelper_dep="debhelper (>= 8.0.0)"
if [ ${use_sysvinit} = "false" ]; then
debhelper_dep=${debhelper_dep}", dh-systemd"
fi
cat <<EOF
Source: freeswitch
Section: comm
Priority: optional
Maintainer: FreeSWITCH Solutions, LLC <support@freeswitch.com>
Build-Depends:
# for debian
${debhelper_dep},
# bootstrapping
automake (>= 1.9), autoconf, ${libtool_dep},
# core build
10 years ago
dpkg-dev (>= 1.15.8.12), gcc (>= 4:4.4.5), g++ (>= 4:4.4.5),
libc6-dev (>= 2.11.3), make (>= 3.81),
libpcre3-dev,
libedit-dev (>= 2.11),
libsqlite3-dev,
libtiff5-dev,
wget, pkg-config,
yasm,
# core codecs
libogg-dev, libspeex-dev, libspeexdsp-dev,
# configure options
libssl1.0-dev | libssl-dev, unixodbc-dev, libpq-dev,
libncurses5-dev, libjpeg62-turbo-dev | libjpeg-turbo8-dev | libjpeg62-dev | libjpeg8-dev,
python-dev, python-all-dev, python-support (>= 0.90) | dh-python, erlang-dev, libtpl-dev (>= 1.5),
# documentation
doxygen,
# for APR (not essential for build)
uuid-dev, libexpat1-dev, libgdbm-dev, libdb-dev,
# used by many modules
libcurl4-openssl-dev | libcurl4-gnutls-dev | libcurl-dev,
bison, zlib1g-dev,
# module build-depends
$(debian_wrap "${mod_build_depends}")
Standards-Version: 3.9.3
Homepage: https://freeswitch.org/
Vcs-Git: https://freeswitch.org/stash/scm/fs/freeswitch.git
Vcs-Browser: https://freeswitch.org/stash/projects/FS/repos/freeswitch/browse
EOF
}
print_core_control () {
cat <<EOF
Package: freeswitch-all
Architecture: amd64 armhf
Depends: freeswitch-meta-all (= \${binary:Version}), freeswitch-meta-all-dbg (= \${binary:Version})
Conflicts: freeswitch-all (<= 1.6.7)
Description: Cross-Platform Scalable Multi-Protocol Soft Switch
$(debian_wrap "${fs_description}")
.
This is a package which depends on all packaged FreeSWITCH modules.
Package: freeswitch
Architecture: amd64 armhf
Depends: \${shlibs:Depends}, \${perl:Depends}, \${misc:Depends},
libfreeswitch1 (= \${binary:Version})
Recommends:
Suggests: freeswitch-dbg
Conflicts: freeswitch-all (<= 1.6.7)
Description: Cross-Platform Scalable Multi-Protocol Soft Switch
$(debian_wrap "${fs_description}")
.
This package contains the FreeSWITCH core.
Package: libfreeswitch1
Architecture: amd64 armhf
Depends: \${shlibs:Depends}, \${misc:Depends}
Recommends:
Suggests: libfreeswitch1-dbg
Conflicts: freeswitch-all (<= 1.6.7)
Description: Cross-Platform Scalable Multi-Protocol Soft Switch
$(debian_wrap "${fs_description}")
.
This package contains the FreeSWITCH core library.
Package: python-esl
Section: python
Architecture: amd64 armhf
Depends: \${shlibs:Depends}, \${misc:Depends}, \${python:Depends}
Description: Cross-Platform Scalable Multi-Protocol Soft Switch
$(debian_wrap "${fs_description}")
.
This package contains the Python binding for FreeSWITCH Event Socket Library (ESL).
Package: libesl-perl
Section: perl
Architecture: amd64 armhf
Depends: \${shlibs:Depends}, \${misc:Depends}, \${perl:Depends}
Description: Cross-Platform Scalable Multi-Protocol Soft Switch
$(debian_wrap "${fs_description}")
.
This package contains the Perl binding for FreeSWITCH Event Socket Library (ESL).
Package: freeswitch-meta-bare
Architecture: amd64 armhf
Depends: \${misc:Depends}, freeswitch (= \${binary:Version})
Recommends:
freeswitch-doc (= \${binary:Version}),
freeswitch-mod-commands (= \${binary:Version}),
freeswitch-init,
freeswitch-lang (= \${binary:Version}),
freeswitch-timezones (= \${binary:Version}),
freeswitch-music,
freeswitch-sounds
Suggests:
Description: Cross-Platform Scalable Multi-Protocol Soft Switch
$(debian_wrap "${fs_description}")
.
This is a metapackage which depends on the packages needed for a very
bare FreeSWITCH install.
Package: freeswitch-meta-default
Architecture: amd64 armhf
Depends: \${misc:Depends}, freeswitch (= \${binary:Version}),
freeswitch-mod-commands (= \${binary:Version}),
freeswitch-mod-conference (= \${binary:Version}),
freeswitch-mod-db (= \${binary:Version}),
freeswitch-mod-dptools (= \${binary:Version}),
freeswitch-mod-fifo (= \${binary:Version}),
freeswitch-mod-hash (= \${binary:Version}),
freeswitch-mod-pgsql (= \${binary:Version}),
freeswitch-mod-spandsp (= \${binary:Version}),
freeswitch-mod-voicemail (= \${binary:Version}),
freeswitch-mod-dialplan-xml (= \${binary:Version}),
freeswitch-mod-loopback (= \${binary:Version}),
freeswitch-mod-sofia (= \${binary:Version}),
freeswitch-mod-local-stream (= \${binary:Version}),
freeswitch-mod-native-file (= \${binary:Version}),
freeswitch-mod-sndfile (= \${binary:Version}),
freeswitch-mod-tone-stream (= \${binary:Version}),
freeswitch-mod-lua (= \${binary:Version}),
freeswitch-mod-console (= \${binary:Version}),
freeswitch-mod-say-en (= \${binary:Version})
Recommends:
freeswitch-init,
freeswitch-lang (= \${binary:Version}),
freeswitch-timezones (= \${binary:Version}),
freeswitch-meta-codecs (= \${binary:Version}),
freeswitch-music,
freeswitch-sounds
Suggests:
freeswitch-mod-cidlookup (= \${binary:Version}),
freeswitch-mod-curl (= \${binary:Version}),
freeswitch-mod-directory (= \${binary:Version}),
freeswitch-mod-enum (= \${binary:Version}),
freeswitch-mod-spy (= \${binary:Version}),
freeswitch-mod-valet-parking (= \${binary:Version})
Description: Cross-Platform Scalable Multi-Protocol Soft Switch
$(debian_wrap "${fs_description}")
.
This is a metapackage which depends on the packages needed for a
reasonably basic FreeSWITCH install.
Package: freeswitch-meta-vanilla
Architecture: amd64 armhf
Depends: \${misc:Depends}, freeswitch (= \${binary:Version}),
freeswitch-init,
freeswitch-mod-console (= \${binary:Version}),
freeswitch-mod-logfile (= \${binary:Version}),
freeswitch-mod-enum (= \${binary:Version}),
freeswitch-mod-cdr-csv (= \${binary:Version}),
freeswitch-mod-event-socket (= \${binary:Version}),
freeswitch-mod-sofia (= \${binary:Version}),
freeswitch-mod-loopback (= \${binary:Version}),
freeswitch-mod-commands (= \${binary:Version}),
freeswitch-mod-conference (= \${binary:Version}),
freeswitch-mod-db (= \${binary:Version}),
freeswitch-mod-dptools (= \${binary:Version}),
freeswitch-mod-expr (= \${binary:Version}),
freeswitch-mod-fifo (= \${binary:Version}),
freeswitch-mod-hash (= \${binary:Version}),
freeswitch-mod-pgsql (= \${binary:Version}),
freeswitch-mod-voicemail (= \${binary:Version}),
freeswitch-mod-esf (= \${binary:Version}),
freeswitch-mod-fsv (= \${binary:Version}),
freeswitch-mod-valet-parking (= \${binary:Version}),
freeswitch-mod-httapi (= \${binary:Version}),
freeswitch-mod-dialplan-xml (= \${binary:Version}),
freeswitch-mod-dialplan-asterisk (= \${binary:Version}),
freeswitch-mod-spandsp (= \${binary:Version}),
freeswitch-mod-g723-1 (= \${binary:Version}),
freeswitch-mod-g729 (= \${binary:Version}),
freeswitch-mod-amr (= \${binary:Version}),
freeswitch-mod-h26x (= \${binary:Version}),
freeswitch-mod-sndfile (= \${binary:Version}),
freeswitch-mod-native-file (= \${binary:Version}),
freeswitch-mod-local-stream (= \${binary:Version}),
freeswitch-mod-tone-stream (= \${binary:Version}),
freeswitch-mod-lua (= \${binary:Version}),
freeswitch-mod-say-en (= \${binary:Version}),
Recommends:
freeswitch-lang (= \${binary:Version}),
freeswitch-timezones (= \${binary:Version}),
freeswitch-music,
freeswitch-sounds,
freeswitch-conf-vanilla (= \${binary:Version}),
Description: Cross-Platform Scalable Multi-Protocol Soft Switch
$(debian_wrap "${fs_description}")
.
This is a metapackage which depends on the packages needed for
running the FreeSWITCH vanilla example configuration.
Package: freeswitch-meta-sorbet
Architecture: amd64 armhf
Depends: \${misc:Depends}, freeswitch (= \${binary:Version}),
Recommends:
freeswitch-init,
freeswitch-lang (= \${binary:Version}),
freeswitch-timezones (= \${binary:Version}),
freeswitch-meta-codecs (= \${binary:Version}),
freeswitch-music,
freeswitch-sounds,
freeswitch-mod-abstraction (= \${binary:Version}),
freeswitch-mod-avmd (= \${binary:Version}),
freeswitch-mod-blacklist (= \${binary:Version}),
freeswitch-mod-callcenter (= \${binary:Version}),
freeswitch-mod-cidlookup (= \${binary:Version}),
freeswitch-mod-commands (= \${binary:Version}),
freeswitch-mod-conference (= \${binary:Version}),
freeswitch-mod-curl (= \${binary:Version}),
freeswitch-mod-db (= \${binary:Version}),
freeswitch-mod-directory (= \${binary:Version}),
freeswitch-mod-distributor (= \${binary:Version}),
freeswitch-mod-dptools (= \${binary:Version}),
freeswitch-mod-easyroute (= \${binary:Version}),
freeswitch-mod-enum (= \${binary:Version}),
freeswitch-mod-esf (= \${binary:Version}),
freeswitch-mod-esl (= \${binary:Version}),
freeswitch-mod-expr (= \${binary:Version}),
freeswitch-mod-fifo (= \${binary:Version}),
freeswitch-mod-fsk (= \${binary:Version}),
freeswitch-mod-fsv (= \${binary:Version}),
freeswitch-mod-hash (= \${binary:Version}),
freeswitch-mod-httapi (= \${binary:Version}),
freeswitch-mod-http-cache (= \${binary:Version}),
freeswitch-mod-lcr (= \${binary:Version}),
freeswitch-mod-nibblebill (= \${binary:Version}),
freeswitch-mod-oreka (= \${binary:Version}),
freeswitch-mod-pgsql (= \${binary:Version}),
freeswitch-mod-redis (= \${binary:Version}),
freeswitch-mod-rss (= \${binary:Version}),
freeswitch-mod-sms (= \${binary:Version}),
freeswitch-mod-snapshot (= \${binary:Version}),
freeswitch-mod-snom (= \${binary:Version}),
freeswitch-mod-sonar (= \${binary:Version}),
freeswitch-mod-soundtouch (= \${binary:Version}),
freeswitch-mod-spandsp (= \${binary:Version}),
freeswitch-mod-spy (= \${binary:Version}),
freeswitch-mod-stress (= \${binary:Version}),
freeswitch-mod-valet-parking (= \${binary:Version}),
freeswitch-mod-vmd (= \${binary:Version}),
freeswitch-mod-voicemail (= \${binary:Version}),
freeswitch-mod-voicemail-ivr (= \${binary:Version}),
freeswitch-mod-flite (= \${binary:Version}),
freeswitch-mod-pocketsphinx (= \${binary:Version}),
freeswitch-mod-tts-commandline (= \${binary:Version}),
freeswitch-mod-dialplan-xml (= \${binary:Version}),
freeswitch-mod-loopback (= \${binary:Version}),
freeswitch-mod-rtmp (= \${binary:Version}),
freeswitch-mod-skinny (= \${binary:Version}),
freeswitch-mod-sofia (= \${binary:Version}),
freeswitch-mod-cdr-csv (= \${binary:Version}),
freeswitch-mod-cdr-sqlite (= \${binary:Version}),
freeswitch-mod-event-socket (= \${binary:Version}),
freeswitch-mod-json-cdr (= \${binary:Version}),
freeswitch-mod-local-stream (= \${binary:Version}),
freeswitch-mod-native-file (= \${binary:Version}),
freeswitch-mod-shell-stream (= \${binary:Version}),
freeswitch-mod-sndfile (= \${binary:Version}),
freeswitch-mod-tone-stream (= \${binary:Version}),
freeswitch-mod-lua (= \${binary:Version}),
freeswitch-mod-console (= \${binary:Version}),
freeswitch-mod-logfile (= \${binary:Version}),
freeswitch-mod-syslog (= \${binary:Version}),
freeswitch-mod-say-en (= \${binary:Version}),
freeswitch-mod-posix-timer (= \${binary:Version}),
freeswitch-mod-timerfd (= \${binary:Version}),
freeswitch-mod-xml-cdr (= \${binary:Version}),
freeswitch-mod-xml-curl (= \${binary:Version}),
Description: Cross-Platform Scalable Multi-Protocol Soft Switch
$(debian_wrap "${fs_description}")
.
This is a metapackage which recommends most packaged FreeSWITCH
modules except a few which aren't recommended.
Package: freeswitch-meta-all
Architecture: amd64 armhf
Depends: \${misc:Depends}, freeswitch (= \${binary:Version}),
freeswitch-init,
freeswitch-lang (= \${binary:Version}),
freeswitch-timezones (= \${binary:Version}),
freeswitch-meta-codecs (= \${binary:Version}),
freeswitch-meta-conf (= \${binary:Version}),
freeswitch-meta-lang (= \${binary:Version}),
freeswitch-meta-mod-say (= \${binary:Version}),
freeswitch-music,
freeswitch-sounds,
freeswitch-mod-abstraction (= \${binary:Version}),
freeswitch-mod-avmd (= \${binary:Version}),
freeswitch-mod-av (= \${binary:Version}),
freeswitch-mod-blacklist (= \${binary:Version}),
freeswitch-mod-callcenter (= \${binary:Version}),
freeswitch-mod-cidlookup (= \${binary:Version}),
freeswitch-mod-commands (= \${binary:Version}),
freeswitch-mod-conference (= \${binary:Version}),
freeswitch-mod-curl (= \${binary:Version}),
freeswitch-mod-db (= \${binary:Version}),
freeswitch-mod-directory (= \${binary:Version}),
freeswitch-mod-distributor (= \${binary:Version}),
freeswitch-mod-dptools (= \${binary:Version}),
freeswitch-mod-easyroute (= \${binary:Version}),
freeswitch-mod-enum (= \${binary:Version}),
freeswitch-mod-esf (= \${binary:Version}),
freeswitch-mod-esl (= \${binary:Version}),
freeswitch-mod-expr (= \${binary:Version}),
freeswitch-mod-fifo (= \${binary:Version}),
freeswitch-mod-fsk (= \${binary:Version}),
freeswitch-mod-fsv (= \${binary:Version}),
freeswitch-mod-hash (= \${binary:Version}),
freeswitch-mod-httapi (= \${binary:Version}),
freeswitch-mod-http-cache (= \${binary:Version}),
freeswitch-mod-lcr (= \${binary:Version}),
freeswitch-mod-memcache (= \${binary:Version}),
freeswitch-mod-nibblebill (= \${binary:Version}),
freeswitch-mod-oreka (= \${binary:Version}),
freeswitch-mod-mariadb (= \${binary:Version}),
freeswitch-mod-pgsql (= \${binary:Version}),
freeswitch-mod-png (= \${binary:Version}),
freeswitch-mod-redis (= \${binary:Version}),
freeswitch-mod-rss (= \${binary:Version}),
freeswitch-mod-signalwire (= \${binary:Version}),
freeswitch-mod-shout (= \${binary:Version}),
freeswitch-mod-sms (= \${binary:Version}),
<