#! /bin/bash
#-------------------------------------------------------------------------------

## project tree definitions.
OSM_DIR=${HOME}/osm-build


## bail immediately if error exists.
set -e


## check for limutil
if [ ! -d ${OSM_DIR} ]; then
    if [ ! -d ../limutil* ]; then
	echo "limutil not found, unknown source tree layout!" ;
	exit -1 ;
    else
	pushd .
	cd ../limutil* ;
	./osm ;
	popd
    fi
fi


## so that we can find the limoi-core package.
export PKG_CONFIG_PATH=${OSM_DIR}/lib/pkgconfig


## config and build OpenMAX IL
echo
echo "config and build OpenMAX limoi core package ..."
echo
autoreconf -i
./configure --prefix=${OSM_DIR}
make all install
make check


echo
echo "CONGRATULATIONS, you've successfully made the limoi core package."
echo "liblimoi-core has been installed to ${OSM_DIR}."
echo
