#!/bin/sh

set -e

destdir=$1

for d in libsrtp $destdir; do
    if [ -e $d ]; then
        rm -rf $d
    fi
done

git clone https://github.com/cisco/libsrtp/
cd libsrtp
git checkout -qf v2.4.2

cmake . -DCMAKE_INSTALL_PREFIX=$destdir -DCMAKE_POSITION_INDEPENDENT_CODE=ON
make
make install
