#!/bin/sh

echo "====== Preparing the SDK environment ======"
cd /usr/lib/libreoffice/sdk
. ./setsdkenv_unix.sh

SRCDIR=`pwd`

# don't clobber $HOME but do it in /tmp
_old_sdk_out=$OO_SDK_OUT
WORKDIR=`mktemp -d`
export OO_SDK_OUT=$WORKDIR
export PATH=`echo $PATH | sed -e "s,$_old_sdk_out,$OO_SDK_OUT,g"`

echo "====== Building C++ example DocumentLoader ====== "
cd $SRCDIR/examples/cpp/DocumentLoader
make

echo "====== Building C++ example counter ====== "
cd $SRCDIR/examples/cpp/counter
make
echo "====== Running countermain.run ======"
make countermain.run

echo "====== Building Java DocumentHandling example ======"
cd $SRCDIR/examples/java/DocumentHandling
make

