Skip to content

Commit

Permalink
Update baresip-setup.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewwebster-hso authored Jun 5, 2023
1 parent 2fb856f commit d1f1fc8
Showing 1 changed file with 57 additions and 37 deletions.
94 changes: 57 additions & 37 deletions baresip/baresip-setup.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,38 @@

# Determine package manager for installing packages
DNF_CMD=$(which dnf) > /dev/null 2>&1
YUM_CMD=$(which yum) > /dev/null 2>&1
APT_CMD=$(which apt-get) > /dev/null 2>&1
APK_CMD=$(which apk) > /dev/null 2>&1
# ${CMD_INSTALL} package
if [[ ! -z $DNF_CMD ]] ; then
export CMD_INSTALL="sudo dnf install -y"
export CMD_UPGRADE="sudo dnf upgrade -y"
export CMD_UPDATE="sudo dnf upgrade"
export CMD_CLEAN=$"sudo dnf clean all && sudo rm -rf /tmp/* /var/tmp/*"
elif [[ ! -z $YUM_CMD ]] ; then
export CMD_INSTALL="sudo yum install -y"
export CMD_UPGRADE="sudo yum upgrade -y"
export CMD_UPDATE="sudo yum update"
export CMD_CLEAN=$"sudo yum clean all && sudo rm -rf /tmp/* /var/tmp/*"
elif [[ ! -z $APT_CMD ]] ; then
export CMD_INSTALL="sudo apt-get install -y"
export CMD_UPGRADE="sudo apt-get upgrade -y"
export CMD_UPDATE="sudo apt-get update"
export CMD_CLEAN=$"sudo apt-get clean && sudo rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*"
elif [[ ! -z $APK_CMD ]] ; then
export CMD_INSTALL="sudo apk add -y"
export CMD_UPGRADE="sudo apk upgrade -y"
export CMD_UPDATE="sudo apk update"
export CMD_CLEAN=$"sudo apk clean && sudo rm -rf /tmp/* /var/tmp/*"
else
echo "error: can't find a package manager"
exit 1;
fi
echo "Package Manager (Install) : ${CMD_INSTALL}"
echo "Package Manager (Update) : ${CMD_UPDATE}"
echo "Package Manager (Upgrade) : ${CMD_UPGRADE}"

# build/development dependencies
if [ -d /usr/local/src ] ; then sudo rm -rf /usr/local/src ; fi
sudo mkdir -p /usr/local/src && sudo chown ${USER} /usr/local/src && chmod 744 /usr/local/src
Expand Down Expand Up @@ -32,53 +67,38 @@ $INSTALL_CMD gdb
$INSTALL_CMD libasound2-dev libasound2 libasound2-data module-init-tools libsndfile1-dev
sudo modprobe snd-dummy
sudo modprobe snd-aloop
# need more - to hear sound under WSL you need the pulse daemon running (on Windows)

rm -rf ~/git
mkdir ~/git
if [ -d /usr/src ] ; them
rm -rf /usr/src
fi

# An example of multi-repository C project that is updated regularly
$INSTALL_CMD pkg-config alsa-utils libasound2-dev
${INSTALL_CMD} pkg-config alsa-utils libasound2-dev
# Gstreamer bits, so the baresip gstreamer module will be built
$INSTALL_CMD gstreamer1.0-alsa gstreamer1.0-plugins-base gstreamer1.0-plugins-good gstreamer1.0-tools gstreamer1.0-x
$INSTALL_CMD libgstreamer-plugins-base1.0-0 libgstreamer-plugins-base1.0-dev libgstreamer1.0-0 libgstreamer1.0-dev

## LIBRE
git clone https://github.com/baresip/re /usr/src/baresip/re
${INSTALL_CMD} gstreamer1.0-alsa gstreamer1.0-plugins-base gstreamer1.0-plugins-good gstreamer1.0-tools gstreamer1.0-x
${INSTALL_CMD} libgstreamer-plugins-base1.0-0 libgstreamer-plugins-base1.0-dev libgstreamer1.0-0 libgstreamer1.0-dev

On some distributions, /usr/local/lib may not be included in ld.so.conf. You can check with grep "/usr/local/lib" /etc/ld.so.conf.d/*.conf and add if necessary:

$ echo "/usr/local/lib" | sudo tee /etc/ld.so.conf.d/libc.conf
$ sudo ldconfig
if [ !( grep "/usr/local/lib" /etc/ld.so.conf.d/*.conf ) ] ; then
echo "/usr/local/lib" | sudo tee /etc/ld.so.conf.d/libc.conf
sudo ldconfig
fi

# Clone baresip repositories
git clone https://github.com/baresip/baresip /usr/src/baresip/baresip
git clone https://github.com/baresip/re /usr/src/baresip/re
git clone https://github.com/openssl/openssl /usr/src/openssl

## baresip: debug build
cd /usr/src/baresip/baresip
## baresip static build
# cmake -B build -DSTATIC=ON
cmake -B build
cmake --build build -j
sudo cmake --install build
sudo ldconfig






## debug
$ cmake -B build
$ cmake --build build -j
$ cmake --install build

## release
$ cmake -B build -DCMAKE_BUILD_TYPE=Release
$ cmake --build build -j

## baresip: release build
#cmake -B build -DCMAKE_BUILD_TYPE=Release
## release with modules
cmake -B build -DMODULES="menu;account;g711"
$ cmake --build build -j

## static release
cmake -B build -DSTATIC=ON
$ cmake --build build -j
#cmake -B build -DMODULES="menu;account;g711"
cmake --build build -j
cmake --install build

# Install & Build Libre
cd ~/git/openssl && make && sudo make install && sudo ldconfig
Expand Down

0 comments on commit d1f1fc8

Please sign in to comment.