#!/bin/sh

help () {
    echo "supported options are:"
    echo "--help - print this help and exit"
    echo "--prefix=<PATH> specify installation prefix. "
    echo "       <PATH>/bin - will hold all executables"
    echo "       <PATH>/share/pyNeighborhood - pyNeighborhood source and other stuff"
    echo "       default <PATH> is /usr/local"
}

PREFIX="/usr/local"
while [ $# -gt 0 ]; do
    case $1 in
        --help)
            help
            exit 0
            ;;
        --prefix=*)
            PREFIX=`echo $1 | sed 's/--prefix=//'`
            ;;
        *)
            echo "unknwon option $1"
            help
            exit 1
            ;;
    esac
    shift
done

echo "creating pyNeighborhood script"
sed -e s,@prefix@,$PREFIX, pyNeighborhood.in > pyNeighborhood

echo "creating config.py"
sed -e s,@prefix@,$PREFIX, config.py.in > config.py

echo "creating pyNeighborhood.desktop"
sed -e s,@prefix@,$PREFIX, pyNeighborhood.desktop.in > pyNeighborhood.desktop

echo "creating Makefile"
sed -e s,@prefix@,$PREFIX, Makefile.in > Makefile
echo "Installation prefix is $PREFIX"

