aboutsummaryrefslogtreecommitdiff
path: root/system/freeswitch
diff options
context:
space:
mode:
Diffstat (limited to 'system/freeswitch')
-rw-r--r--system/freeswitch/README26
-rw-r--r--system/freeswitch/doinst.sh31
-rw-r--r--system/freeswitch/freeswitch.SlackBuild181
-rw-r--r--system/freeswitch/freeswitch.info26
-rw-r--r--system/freeswitch/logrotate.freeswitch9
-rw-r--r--system/freeswitch/rc.freeswitch71
-rw-r--r--system/freeswitch/slack-desc19
7 files changed, 363 insertions, 0 deletions
diff --git a/system/freeswitch/README b/system/freeswitch/README
new file mode 100644
index 0000000000000..5567ede0be1bf
--- /dev/null
+++ b/system/freeswitch/README
@@ -0,0 +1,26 @@
+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. It was created in 2006 to
+fill the void left by proprietary commercial solutions. FreeSWITCH also
+provides a stable telephony platform on which many telephony applications
+can be developed using a wide range of free tools.
+
+Unlike other SlackBuilds which have a /usr installation prefix, this
+script will install FreeSWITCH to /opt/freeswitch instatead. This is done
+to simplify the build process since FreeSWITCH attemps to install itself
+into many non-standard directories in the prefix directory. Therefore, it
+is installed as a self-contained and easily-removable location in /opt.
+
+This script also expects there to be a user and group called "freeswitch",
+with uid and gid of 269 (see http://slackbuilds.org/uid_gid.txt):
+# groupadd -g 269 freeswitch
+# useradd -u 269 -d /opt/freeswitch -s /bin/bash -g freeswitch freeswitch
+
+If you execute the script without creating this user and group, it won't
+build the FreeSWITCH package.
+
+To enable building with PostgreSQL support, use:
+# PGSQL=yes ./freeswitch.SlackBuild
+
+To disable building with Python support, use:
+# PYTHON=no ./freeswitch.SlackBuild
diff --git a/system/freeswitch/doinst.sh b/system/freeswitch/doinst.sh
new file mode 100644
index 0000000000000..e9bc581d41917
--- /dev/null
+++ b/system/freeswitch/doinst.sh
@@ -0,0 +1,31 @@
+config() {
+ NEW="$1"
+ OLD="$(dirname $NEW)/$(basename $NEW .new)"
+ # If there's no config file by that name, mv it over:
+ if [ ! -r $OLD ]; then
+ mv $NEW $OLD
+ elif [ "$(cat $OLD | md5sum)" = "$(cat $NEW | md5sum)" ]; then
+ # toss the redundant copy
+ rm $NEW
+ fi
+ # Otherwise, we leave the .new copy for the admin to consider...
+}
+
+preserve_perms() {
+ NEW="$1"
+ OLD="$(dirname $NEW)/$(basename $NEW .new)"
+ if [ -e $OLD ]; then
+ cp -a $OLD ${NEW}.incoming
+ cat $NEW > ${NEW}.incoming
+ mv ${NEW}.incoming $NEW
+ fi
+ config $NEW
+}
+
+preserve_perms etc/rc.d/rc.freeswitch.new
+config etc/logrotate.d/freeswitch.new
+
+for i in $(find opt/freeswitch/conf -type f -name '*.new'); do
+ config $i
+done
+
diff --git a/system/freeswitch/freeswitch.SlackBuild b/system/freeswitch/freeswitch.SlackBuild
new file mode 100644
index 0000000000000..057c9867f2f7a
--- /dev/null
+++ b/system/freeswitch/freeswitch.SlackBuild
@@ -0,0 +1,181 @@
+#!/bin/sh
+
+# Slackware build script for FreeSWITCH
+
+# Copyright 2013, mario <mario@slackverse.org>
+# All rights reserved.
+#
+# Redistribution and use of this script, with or without modification, is
+# permitted provided that the following conditions are met:
+#
+# 1. Redistributions of this script must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
+# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
+# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+PRGNAM=freeswitch
+VERSION=${VERSION:-20130414}
+BUILD=${BUILD:-1}
+TAG=${TAG:-_SBo}
+
+if [ -z "$ARCH" ]; then
+ case "$( uname -m )" in
+ i?86) ARCH=i486 ;;
+ arm*) ARCH=arm ;;
+ *) ARCH=$( uname -m ) ;;
+ esac
+fi
+
+CWD=$(pwd)
+TMP=${TMP:-/tmp/SBo}
+PKG=$TMP/package-$PRGNAM
+OUTPUT=${OUTPUT:-/tmp}
+
+if [ "$ARCH" = "i486" ]; then
+ SLKCFLAGS="-O2 -march=i486 -mtune=i686"
+ LIBDIRSUFFIX=""
+elif [ "$ARCH" = "i686" ]; then
+ SLKCFLAGS="-O2 -march=i686 -mtune=i686"
+ LIBDIRSUFFIX=""
+elif [ "$ARCH" = "x86_64" ]; then
+ SLKCFLAGS="-O2 -fPIC"
+ LIBDIRSUFFIX="64"
+else
+ SLKCFLAGS="-O2"
+ LIBDIRSUFFIX=""
+fi
+
+# Allow building with Python support
+PYTHON=${PYTHON:-yes}
+case "$PYTHON" in
+ yes) PYTHON="yes" ;;
+ *) PYTHON="no" ;;
+esac
+
+# Allow building with PostgreSQL support
+PGSQL=${PGSQL:-no}
+case "$PGSQL" in
+ yes) PGSQL="--with-pgsql --enable-core-pgsql-support" ;;
+ *) PGSQL="--without-pgsql --disable-core-pgsql-support" ;;
+esac
+
+set -e
+
+# Bail if user or group isn't valid on your system
+if ! grep ^freeswitch: /etc/passwd 2>&1 > /dev/null; then
+
+cat << EOF
+
+ You must have a freeswitch user to run this script
+
+ # groupadd -g 269 freeswitch
+ # useradd -u 269 -d /opt/freeswitch -s /bin/bash -g freeswitch freeswitch
+
+EOF
+
+ exit
+elif ! grep ^freeswitch: /etc/group 2>&1 > /dev/null; then
+
+cat << EOF
+
+ You must have a freeswitch group to run this script
+
+ # groupadd -g 269 freeswitch
+
+EOF
+
+ exit
+fi
+
+rm -rf $PKG
+mkdir -p $TMP $PKG $OUTPUT
+cd $TMP
+rm -rf $PRGNAM-$VERSION
+tar xvf $CWD/$PRGNAM-$VERSION.tar.bz2
+cd $PRGNAM-$VERSION
+chown -R root:root .
+find . \
+ \( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \
+ -exec chmod 755 {} \; -o \
+ \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
+ -exec chmod 644 {} \;
+
+# Prepare some things
+./bootstrap.sh
+
+# Disable Cluecon registration annoyance
+touch noreg
+
+# Enable Python module if needed
+if [ "$PYTHON" == "yes" ]; then
+ sed -i 's:#\(languages/mod_python\):\1:' modules.conf
+fi
+
+CFLAGS="$SLKCFLAGS" \
+CXXFLAGS="$SLKCFLAGS" \
+./configure \
+ --prefix=/opt/freeswitch \
+ --exec-prefix=/opt/freeswitch \
+ --libdir=/opt/freeswitch/lib${LIBDIRSUFFIX} \
+ --localstatedir=/var \
+ $PGSQL \
+ --build=$ARCH-slackware-linux
+
+make
+make install DESTDIR=$PKG
+make samples DESTDIR=$PKG
+
+find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \
+ | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
+
+# Installing additional sounds can be done with:
+# make cd-sounds-install DESTDIR=$PKG; make cd-moh-install DESTDIR=$PKG
+# Since we preffer pre-downloaded tarballs, versions can be checked with:
+# cat build/{sounds_version.txt,moh_version.txt}
+mkdir -p $PKG/opt/freeswitch/sounds
+for i in $CWD/freeswitch-sounds-*; do
+ echo "Installing sounds from: ${i##*\/}"
+ tar -C $PKG/opt/freeswitch/sounds -xf $i
+done
+
+# Don't clobber configuration
+find $PKG/opt/freeswitch/conf -type f -exec mv {} {}.new \;
+
+# Copy init script
+install -D -m0755 -oroot -groot $CWD/rc.freeswitch $PKG/etc/rc.d/rc.freeswitch.new
+
+# Logrotate script
+mkdir -p $PKG/etc/logrotate.d
+install -m 0644 $CWD/logrotate.freeswitch $PKG/etc/logrotate.d/freeswitch.new
+
+# Put docs into opt aswell, symlink later
+mkdir -p $PKG/opt/freeswitch/doc/$PRGNAM-$VERSION
+cp -a \
+ AUTHORS COPYING ChangeLog INSTALL \
+ $PKG/opt/freeswitch/doc/$PRGNAM-$VERSION
+cat $CWD/$PRGNAM.SlackBuild > $PKG/opt/freeswitch/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
+
+# Change ownership for some dirs
+chown -R freeswitch:freeswitch $PKG/var/log/freeswitch $PKG/var/run/freeswitch \
+ $PKG/opt/freeswitch
+
+# Symlink some stuff back to the system
+mkdir -p $PKG/usr/{bin,doc}
+( cd $PKG/usr/doc ; ln -s /opt/freeswitch/doc/$PRGNAM-$VERSION )
+( cd $PKG/usr/bin ; ln -s /opt/freeswitch/bin/fs_cli )
+
+mkdir -p $PKG/install
+cat $CWD/slack-desc > $PKG/install/slack-desc
+cat $CWD/doinst.sh > $PKG/install/doinst.sh
+
+cd $PKG
+/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}
diff --git a/system/freeswitch/freeswitch.info b/system/freeswitch/freeswitch.info
new file mode 100644
index 0000000000000..71f61bbc50ea5
--- /dev/null
+++ b/system/freeswitch/freeswitch.info
@@ -0,0 +1,26 @@
+PRGNAM="freeswitch"
+VERSION="20130414"
+HOMEPAGE="http://www.freeswitch.org/"
+DOWNLOAD="http://mirror.slackverse.org/sources/freeswitch/freeswitch-20130414.tar.bz2 \
+ http://files.freeswitch.org/freeswitch-sounds-en-us-callie-8000-1.0.22.tar.gz \
+ http://files.freeswitch.org/freeswitch-sounds-en-us-callie-16000-1.0.22.tar.gz \
+ http://files.freeswitch.org/freeswitch-sounds-en-us-callie-32000-1.0.22.tar.gz \
+ http://files.freeswitch.org/freeswitch-sounds-en-us-callie-48000-1.0.22.tar.gz \
+ http://files.freeswitch.org/freeswitch-sounds-music-8000-1.0.8.tar.gz \
+ http://files.freeswitch.org/freeswitch-sounds-music-16000-1.0.8.tar.gz \
+ http://files.freeswitch.org/freeswitch-sounds-music-32000-1.0.8.tar.gz \
+ http://files.freeswitch.org/freeswitch-sounds-music-48000-1.0.8.tar.gz"
+MD5SUM="c80247919dfefc57bb1a550dc045b731 \
+ cff509d878708ce5e6e7fedac7f683ef \
+ d9f7b0da8e2251ac6ab786fb18e52df6 \
+ 3d266ef251a48d00db6f3851c53240d8 \
+ fa2dfe8f03c6cba79d0c7f843c1b5d36 \
+ f63ef3cc3507af079ae5c7b8b8a01e42 \
+ 7fd0ca9a9e3878783baa39b8187743bf \
+ 7e03932ea81b8d0bf6d686f838b060b4 \
+ d06cd2a80379f224affab21f5180e4c6"
+DOWNLOAD_x86_64=""
+MD5SUM_x86_64=""
+REQUIRES=""
+MAINTAINER="mario"
+EMAIL="mario@slackverse.org"
diff --git a/system/freeswitch/logrotate.freeswitch b/system/freeswitch/logrotate.freeswitch
new file mode 100644
index 0000000000000..19c57ee2e180e
--- /dev/null
+++ b/system/freeswitch/logrotate.freeswitch
@@ -0,0 +1,9 @@
+/var/log/freeswitch/freeswitch.log {
+ missingok
+ rotate 5
+ weekly
+ notifempty
+ postrotate
+ /opt/freeswitch/bin/fs_cli -x 'fsctl send_sighup' > /dev/null 2> /dev/null
+ endscript
+}
diff --git a/system/freeswitch/rc.freeswitch b/system/freeswitch/rc.freeswitch
new file mode 100644
index 0000000000000..fd3925dff40d8
--- /dev/null
+++ b/system/freeswitch/rc.freeswitch
@@ -0,0 +1,71 @@
+#!/bin/sh
+#
+# Start/stop/restart FreeSWITCH for Slackware
+#
+# Copyright 2013, mario <mario@slackverse.org>
+
+USER=freeswitch
+GROUP=freeswitch
+BIN_FILE=/opt/freeswitch/bin/freeswitch
+PID_FILE=/var/run/freeswitch/freeswitch.pid
+RUN_ARGS="-nc -rp -nonat"
+
+set_limits() {
+ ulimit -c unlimited
+ ulimit -d unlimited
+ ulimit -f unlimited
+ ulimit -i unlimited
+ ulimit -n 999999
+ ulimit -q unlimited
+ ulimit -u unlimited
+ ulimit -v unlimited
+ ulimit -x unlimited
+ ulimit -s 240
+ ulimit -l unlimited
+}
+
+start() {
+ echo -n "Starting FreeSWITCH: "
+ if [ -e $PID_FILE ] && [ -e /proc/$(cat $PID_FILE) ]; then
+ echo "Already running."
+ else
+ set_limits
+ $BIN_FILE $RUN_ARGS -u $USER -g $GROUP >/dev/null 2>&1
+ if [ $? -eq 0 ]; then
+ echo "Started."
+ else
+ echo "Failed starting."
+ fi
+ fi
+}
+
+stop() {
+ echo -n "Stopping FreeSWITCH: "
+ if [ -e $PID_FILE ] && [ -e /proc/$(cat $PID_FILE) ]; then
+ $BIN_FILE -stop >/dev/null 2>&1
+ if [ $? -eq 0 ]; then
+ echo "Stopped."
+ else
+ echo "Failed stopping."
+ fi
+ else
+ echo "Not running."
+ fi
+}
+
+case "$1" in
+ start)
+ start
+ ;;
+ stop)
+ stop
+ ;;
+ restart)
+ stop
+ sleep 5
+ start
+ ;;
+ *)
+ echo "USAGE: $0 {start|stop|restart}"
+ ;;
+esac
diff --git a/system/freeswitch/slack-desc b/system/freeswitch/slack-desc
new file mode 100644
index 0000000000000..65660ed070afb
--- /dev/null
+++ b/system/freeswitch/slack-desc
@@ -0,0 +1,19 @@
+# HOW TO EDIT THIS FILE:
+# The "handy ruler" below makes it easier to edit a package description.
+# Line up the first '|' above the ':' following the base package name, and
+# the '|' on the right side marks the last column you can put a character in.
+# You must make exactly 11 lines for the formatting to be correct. It's also
+# customary to leave one space after the ':' except on otherwise blank lines.
+
+ |-----handy-ruler------------------------------------------------------|
+freeswitch: FreeSWITCH (Open source telephony platform)
+freeswitch:
+freeswitch: FreeSWITCH is a scalable open source cross-platform telephony
+freeswitch: platform designed to route and interconnect popular communication
+freeswitch: protocols using audio, video, text or any other form of media.
+freeswitch:
+freeswitch: Homepage: http://www.freeswitch.org/
+freeswitch:
+freeswitch:
+freeswitch:
+freeswitch: