# the first time use:
#  git clone https://github.com/OpenShot/libopenshot-audio.git

# once you have cloned the repository you can use
cd libopenshot-audio
git stash
git pull

[ ! -e build ] && mkdir build

[ ! -e include/zmq.hpp ] && wget https://raw.githubusercontent.com/zeromq/cppzmq/014628c/zmq.hpp -O include/zmq.hpp

cd build

VER0=$( grep 'define OPENSHOT_AUDIO_VERSION_MAJOR' ../include/Version.h | grep -v STRING | awk '{print $3}' | sed -es/\;// )
VER1=$( grep 'define OPENSHOT_AUDIO_VERSION_MINOR' ../include/Version.h | grep -v STRING | awk '{print $3}' | sed -es/\;// )
VER2=$( grep 'define OPENSHOT_AUDIO_VERSION_BUILD' ../include/Version.h | grep -v STRING | awk '{print $3}' | sed -es/\;// )
VERSION=${VER0}.${VER1}.${VER2}

[ -e Makefile ] && make clean
[ -e CMakeCache.txt ] && mv CMakeCache.txt CMakeCache.$(date +%s)

PYTHON3=yes   cmake     -DCMAKE_C_FLAGS:STRING="-O2 -fPIC"     -DCMAKE_CXX_FLAGS:STRING="-O2 -fPIC"     -DCMAKE_INSTALL_PREFIX=/usr     -DLIB_SUFFIX=64     -DZMQ_INCLUDE_DIR=$(pwd)/../include -DENABLE_RUBY=0    -DCMAKE_BUILD_TYPE=Release ..

make -j4

PKG=/tmp/libopenshot-audio-${VERSION}

make install 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

mkdir -p $PKG/usr/doc/libopenshot-audio-$VERSION
wget https://slackbuilds.org/slackbuilds/14.2/libraries/libopenshot-audio/README -O $PKG/usr/doc/libopenshot-audio-${VERSION}/README
mkdir -p $PKG/install
wget https://slackbuilds.org/slackbuilds/14.2/libraries/libopenshotaudio-/slack-desc -O $PKG/install/slack-desc

cd $PKG
/sbin/makepkg -l y -c n /tmp/libopenshot-audio-$VERSION-x86_64-1airaghi.txz




