#!/bin/sh
# Copyright (c) 2006 Don Stewart - http://www.cse.unsw.edu.au/~dons
# GPL version 2 or later (see http://www.gnu.org/copyleft/gpl.html)
# preprocess the regex lib
if [ "Lib/Regex.hs" -ot "Lib/Regex.hsc" ] ; then
hsc2hs -o Lib/Regex.hs Lib/Regex.hsc
fi
# build the preprocessor
if [ -e "BotPP" ] ; then
BotPP=BotPP
elif [ -e "dist/build/BotPP/BotPP" ] ; then
BotPP=dist/build/BotPP/BotPP
else
ghc -o BotPP -package fps scripts/BotPP.hs
BotPP=BotPP
fi
# find possible .o files
if [ -e "dist/build/lambdabot/lambdabot-tmp/" ] ; then
Odir=dist/build/lambdabot/lambdabot-tmp/
else
Odir=.
fi
# run ghci with the right command line flags to launch lambdabot
ghci -Wall -Werror -fglasgow-exts -I. -pgmF ./BotPP -F -fno-warn-incomplete-patterns -fno-warn-missing-methods -fno-warn-orphans -DGHCi -hidir $Odir -odir $Odir $*