2021-08-13 18:53:18 +08:00
|
|
|
#!/bin/bash -ex
|
|
|
|
|
|
|
|
TARGET=`basename $(pwd)`
|
|
|
|
|
|
|
|
|
|
|
|
PACKAGE=$(echo $TARGET | cut -d'_' -f1)
|
|
|
|
VERSION=$(echo $TARGET | cut -d'_' -f2)
|
|
|
|
DISTRO=$(echo $TARGET | cut -d'_' -f3)
|
|
|
|
|
2021-10-28 07:57:18 +08:00
|
|
|
BUILDDIR=$PWD
|
|
|
|
DESTDIR=$BUILDDIR/staging
|
|
|
|
CONFDIR=$DESTDIR/opt/freeswitch/etc/freeswitch
|
|
|
|
|
2021-08-13 18:53:18 +08:00
|
|
|
#
|
|
|
|
# Clear staging directory for build
|
|
|
|
|
2021-10-28 07:57:18 +08:00
|
|
|
rm -rf $DESTDIR
|
|
|
|
mkdir -p $DESTDIR
|
2021-08-13 18:53:18 +08:00
|
|
|
|
|
|
|
##
|
|
|
|
|
|
|
|
. ./opts-$DISTRO.sh
|
|
|
|
|
2021-10-28 07:57:18 +08:00
|
|
|
cp modules.conf $BUILDDIR/freeswitch
|
|
|
|
cd $BUILDDIR/freeswitch
|
2021-08-13 18:53:18 +08:00
|
|
|
|
|
|
|
pushd .
|
2021-10-18 08:24:54 +08:00
|
|
|
|
|
|
|
# sofia-sip start
|
2021-08-13 18:53:18 +08:00
|
|
|
if [ ! -d sofia-sip ]; then
|
|
|
|
git clone https://github.com/freeswitch/sofia-sip.git
|
|
|
|
fi
|
|
|
|
cd sofia-sip/
|
2024-01-03 03:09:50 +08:00
|
|
|
git checkout v1.13.17
|
2021-08-13 18:53:18 +08:00
|
|
|
./bootstrap.sh
|
|
|
|
./configure
|
2021-10-18 08:24:54 +08:00
|
|
|
|
2021-08-13 18:53:18 +08:00
|
|
|
make -j $(nproc)
|
|
|
|
make install
|
|
|
|
cd ..
|
2021-10-18 08:24:54 +08:00
|
|
|
# sofia-sip end
|
2021-08-13 18:53:18 +08:00
|
|
|
|
2021-10-18 08:24:54 +08:00
|
|
|
# spandsp start
|
2021-08-13 18:53:18 +08:00
|
|
|
if [ ! -d spandsp ]; then
|
|
|
|
git clone https://github.com/freeswitch/spandsp.git
|
|
|
|
fi
|
|
|
|
cd spandsp/
|
2022-02-03 12:01:19 +08:00
|
|
|
git checkout e59ca8fb8b1591e626e6a12fdc60a2ebe83435ed
|
2021-08-13 18:53:18 +08:00
|
|
|
./bootstrap.sh
|
|
|
|
./configure
|
|
|
|
|
|
|
|
make -j $(nproc)
|
|
|
|
make install
|
|
|
|
|
|
|
|
popd
|
2021-10-18 08:24:54 +08:00
|
|
|
# spandsp end
|
2021-08-13 18:53:18 +08:00
|
|
|
|
2021-10-26 02:35:11 +08:00
|
|
|
|
|
|
|
|
|
|
|
# libks start
|
|
|
|
if [ ! -d libks ]; then
|
|
|
|
git clone https://github.com/signalwire/libks.git
|
|
|
|
fi
|
|
|
|
cd libks/
|
2024-01-03 03:09:50 +08:00
|
|
|
git checkout v2.0.3
|
2021-10-26 02:35:11 +08:00
|
|
|
|
|
|
|
cmake .
|
|
|
|
make
|
|
|
|
|
|
|
|
make install
|
|
|
|
cd ..
|
|
|
|
# libks end
|
|
|
|
|
2021-08-13 18:53:18 +08:00
|
|
|
ldconfig
|
|
|
|
|
2022-12-23 05:07:17 +08:00
|
|
|
# libwebsockets start
|
|
|
|
# mod_audio_fork needs it (used in built-in speech transcription)
|
|
|
|
if [ ! -d libwebsockets ]; then
|
|
|
|
git clone https://github.com/warmcat/libwebsockets.git
|
|
|
|
fi
|
|
|
|
cd libwebsockets/
|
|
|
|
git checkout v3.2.3
|
|
|
|
|
|
|
|
mkdir -p build
|
|
|
|
cd build
|
|
|
|
|
2023-07-19 02:57:35 +08:00
|
|
|
cmake .. -DCMAKE_C_FLAGS="-Wno-error" -DCMAKE_CXX_FLAGS="-Wno-error"
|
2022-12-23 05:07:17 +08:00
|
|
|
make -j $(nproc)
|
|
|
|
make install
|
|
|
|
cd ../../
|
|
|
|
|
|
|
|
ldconfig
|
|
|
|
# libwebsockets end
|
|
|
|
|
|
|
|
# mod_audio_fork start
|
|
|
|
# copy mod_audio_fork into place (used in built-in speech transcription)
|
|
|
|
if [ ! -d drachtio-freeswitch-modules ]; then
|
|
|
|
git clone https://github.com/drachtio/drachtio-freeswitch-modules.git
|
|
|
|
fi
|
|
|
|
|
|
|
|
cd drachtio-freeswitch-modules
|
|
|
|
git checkout 4198b1c114268829627069afeea7eb40c86a81af
|
|
|
|
cp -r modules/mod_audio_fork $BUILDDIR/freeswitch/src/mod/applications/mod_audio_fork
|
|
|
|
cd ..
|
|
|
|
# mod_audio_fork end
|
|
|
|
|
2021-10-27 05:14:21 +08:00
|
|
|
# we already cloned the FS repo in freeswitch.placeholder.sh and selected tag/branch
|
2021-08-13 18:53:18 +08:00
|
|
|
|
2021-10-28 07:57:18 +08:00
|
|
|
cd $BUILDDIR/freeswitch
|
|
|
|
|
|
|
|
patch -p0 < $BUILDDIR/floor.patch
|
2022-02-16 04:47:28 +08:00
|
|
|
patch -p0 --ignore-whitespace < $BUILDDIR/audio.patch # Provisional patch for https://github.com/signalwire/freeswitch/pull/1531
|
2022-12-23 05:07:17 +08:00
|
|
|
# Enables mod_audio_fork in the build process (used in built-in speech transcription)
|
|
|
|
patch -p1 < $BUILDDIR/mod_audio_fork_build.patch
|
2021-08-13 18:53:18 +08:00
|
|
|
|
2023-07-06 00:23:13 +08:00
|
|
|
./bootstrap.sh
|
2021-08-13 18:53:18 +08:00
|
|
|
|
|
|
|
./configure --disable-core-odbc-support --disable-core-pgsql-support \
|
2022-12-23 05:07:17 +08:00
|
|
|
--without-python --without-erlang --without-java --with-lws=yes \
|
2023-07-19 00:22:20 +08:00
|
|
|
--prefix=/opt/freeswitch CFLAGS="-Wno-error" CXXFLAGS="-Wno-error"
|
2022-03-14 04:39:42 +08:00
|
|
|
|
|
|
|
# Overrides for generating debug version
|
|
|
|
# --prefix=/opt/freeswitch CFLAGS="-Wno-error -Og -ggdb" CXXFLAGS="-Wno-error -Og -ggdb"
|
2021-08-13 18:53:18 +08:00
|
|
|
|
|
|
|
make -j $(nproc)
|
|
|
|
make install
|
|
|
|
|
|
|
|
mkdir -p $DESTDIR/opt
|
2021-10-28 07:57:18 +08:00
|
|
|
cp -r /opt/freeswitch $DESTDIR/opt
|
2021-08-13 18:53:18 +08:00
|
|
|
|
2021-10-28 07:57:18 +08:00
|
|
|
cd $BUILDDIR
|
2021-08-13 18:53:18 +08:00
|
|
|
|
|
|
|
mkdir -p $DESTDIR/lib/systemd/system
|
|
|
|
cp freeswitch.service.${DISTRO} $DESTDIR/lib/systemd/system/freeswitch.service
|
|
|
|
|
|
|
|
mkdir -p $DESTDIR/lib/systemd/system
|
|
|
|
cp freeswitch.conf $DESTDIR/lib/systemd/system
|
|
|
|
|
|
|
|
mkdir -p $DESTDIR/var/freeswitch/meetings
|
|
|
|
echo "This directory holds *.wav files for FreeSWITCH" > $DESTDIR/var/freeswitch/meetings/readme.txt
|
|
|
|
|
|
|
|
rm -rf $CONFDIR/*
|
2021-10-28 04:15:26 +08:00
|
|
|
cp -r bbb-voice-conference/config/freeswitch/conf/* $CONFDIR
|
2021-08-13 18:53:18 +08:00
|
|
|
|
|
|
|
pushd $DESTDIR/opt/freeswitch
|
|
|
|
ln -s ./etc/freeswitch conf
|
|
|
|
ln -s ./var/log/freeswitch log
|
|
|
|
popd
|
|
|
|
|
|
|
|
# Install libraries for sofia-sip and spandsp
|
|
|
|
mkdir -p $DESTDIR/etc/ld.so.conf.d
|
|
|
|
cat > $DESTDIR/etc/ld.so.conf.d/freeswitch.conf << HERE
|
|
|
|
/opt/freeswitch/lib
|
|
|
|
HERE
|
|
|
|
|
|
|
|
files="sip-date sip-dig sip-options stunc addrinfo localinfo"
|
|
|
|
for file in $files; do
|
|
|
|
cp /usr/local/bin/$file $DESTDIR/opt/freeswitch/bin
|
|
|
|
done
|
|
|
|
|
|
|
|
cp -P /usr/local/lib/lib* $DESTDIR/opt/freeswitch/lib
|
|
|
|
|
2022-02-03 12:01:19 +08:00
|
|
|
if [ -f /etc/system-release ]; then
|
|
|
|
cp /usr/lib64/libopusfile.so.0.4.4 $DESTDIR/opt/freeswitch/lib
|
|
|
|
cp /usr/lib64/libopusurl.so.0.4.4 $DESTDIR/opt/freeswitch/lib
|
|
|
|
pushd $DESTDIR/opt/freeswitch/lib
|
|
|
|
ln -s libopusfile.so.0.4.4 libopusfile.so
|
|
|
|
ln -s libopusurl.so.0.4.4 libopusurl.so
|
|
|
|
popd
|
|
|
|
fi
|
2021-08-13 18:53:18 +08:00
|
|
|
|
2022-02-03 12:01:19 +08:00
|
|
|
mkdir -p $DESTDIR/usr/local/bin
|
2021-08-13 18:53:18 +08:00
|
|
|
cp fs_clibbb $DESTDIR/usr/local/bin
|
|
|
|
chmod +x $DESTDIR/usr/local/bin/fs_clibbb
|
|
|
|
|
|
|
|
rm -rf $DESTDIR/usr/lib/tmpfiles.d
|
|
|
|
|
|
|
|
fpm -s dir -C $DESTDIR -n $PACKAGE \
|
|
|
|
--version $VERSION --epoch 2 \
|
|
|
|
--before-install before-install.sh \
|
|
|
|
--after-install after-install.sh \
|
|
|
|
--before-remove before-remove.sh \
|
|
|
|
--after-remove after-remove.sh \
|
|
|
|
--description "BigBlueButton build of FreeSWITCH" \
|
|
|
|
$DIRECTORIES \
|
|
|
|
$OPTS
|