#!/bin/sh
#######################################################################
# Installation script for DrunkenList 1.0
# by Rezine
#######################################################################

#set this to your display directory
GFXDIR="display/iso/"

if [ -z $DAYDREAM ]; then
  echo "***ERROR***"
  echo "DAYDREAM variable not set!"
  exit
fi

if [ ! -x $DAYDREAM/bin/daydream-config ]; then
  echo "***ERROR***"
  echo "Couldn't find or execute $DAYDREAM/bin/daydream-config !"
  echo "Ensure you have DayDream V2.11 or higher installed, or"
  echo "check the permissions of the script daydream-config!!"
  exit
fi

echo "Copying some files..."
cp mydd.h /usr/include
cp *.h $DAYDREAM/include

echo "Now, please watch for error msgs in compiling... good luck ;)"
echo "Btw, you can ignore all WARNINGS"
gcc $($DAYDREAM/bin/daydream-config --libs) $($DAYDREAM/bin/daydream-config --cflags) -Wall -O2 -o mlist -ldd mlist.c

if [ -f mlist ]; then
  echo "Copying binary to $DAYDREAM/doors..."
  cp mlist $DAYDREAM/doors
  echo "Copying display files to $DAYDREAM/$GFXDIR..."
  cp *.gfx $DAYDREAM/$GFXDIR
  echo
  echo "ph3w... done"
else
  echo "Uhh some error occured.. plz check"
fi