#!/bin/sh

# edit this if necessary
if [ -d /usr/X11 ]; then
  X11BASE=/usr/X11
fi
if [ -d /usr/X11R6 ]; then
  X11R6BASE=/usr/X11R6
fi
if [ -d /usr/local/X11 ]; then
  X11BASE=/usr/local/X11
fi
if [ -d /usr/local/X11R6 ]; then
  X11BASE=/usr/local/X11R6
fi

# compile & install imlib
cd imlib
cp imlib.h $X11BASE/include/X11/
chmod a+r $X11BASE/include/X11/imlib.h
xmkmf
make
cp libIm.so.1.0 $X11BASE/lib/
chmod a+r+x $X11BASE/lib/libIm.so.1.0
ldconfig $X11BASE/lib
cd ..

# compile & install enlightenment
xmkmf
make
if [ -d /usr/local/enlightenment ]; then
  mv /usr/local/enlightenment /usr/local/OLD_enlightenment
fi
mkdir /usr/local/enlightenment
mkdir /usr/local/enlightenment/bin
mkdir /usr/local/enlightenment/system_config
mkdir /usr/local/enlightenment/images
mkdir /usr/local/enlightenment/images/default
chmod -R a+r+x /usr/local/enlightenment
cp ./enlightenment /usr/local/enlightenment/bin
ln -s /usr/local/enlightenment/bin/enlightenment /usr/local/bin/enlightenment
chmod a+r+x /usr/local/enlightenment/bin/enlightenment/
cp ./pixmaps/* /usr/local/enlightenment/images/default/
chmod a+r /usr/local/enlightenment/images/default/*
cp ./sys_conf/imrc /etc/
chmod a+r /etc/imrc
cp ./sys_conf/im_palette.pal /etc/
chmod a+r /etc/im_palette.pal
cp ./sys_conf/windowstyles /usr/local/enlightenment/system_config/
chmod a+r /usr/local/enlightenment/system_config/windowstyles

echo "DONE!"
echo "Now all you have to do is edit your .xinitrc, or .xsession file"
echo "so that it runs /usr/local/enlightenment/bin/enlightenment"
echo "as the windowmanager. It is VERY advisable that you also run an rxvt"
echo "or xterm before you run enlightenment, as the current development"
echo "version does not have the execute facilities enabled yet."
echo "so at a minimum your .xsession or .xinit file should look like this:"
echo " "
echo "--8<-------------------------------------------------------------------"
echo " "
echo "/usr/X11/bin/rxvt"
echo "/usr/local/enlightenment/bin/enlightenment"
echo " "
echo "--8<-------------------------------------------------------------------"
echo " "
echo "note: you do NOT need to run xv or any other program to set the root"
echo "window background. Enlightenment will do this all for you."
echo " "
echo "Also please note. This is a project that is *** IN DEVELOPMENT ***"
echo "dont send bug reports. I know it has bagus and i know what they are."
echo "I have developed this under linux, and for linux. It can run on other"
echo "Unicies, but you will have to install the shared library yourself"
echo "(Imlib is located int he imlib directory. If it didnt compile, you"
echo "may have to edit the Imake file manually. dont ask me what you have"
echo "to do.... figure it out... :) )"
echo "under linux, ldconfig will create the necessary symlinks for you, and"
echo "this script runs that. under systems without ldconfig you will have to"
echo "copy imlib/libIm.so.1.0 to the X11/lib directory and in that directory"
echo "make symliks to it like:"
echo " "
echo " cd /usr/X11/lib"
echo " ln -s libIm.so.1.0 libIm.so.1"
echo " ln -s libIm.so.1.0 limIm.so"
echo " "
echo "In the dot_files directory you will find a .imrc and .im_palette.pal"
echo "and a .enlightenment directory"
echo "If you want to customise your own users setup, copy these files into"
echo "your home directory, edit the .imrc so it points to the corect palette"
echo "file, and if you want edit the palette file. it has a simple format."
echo "each line contains a color cell entry on hexadecimal:"
echo "0xRR 0xGG 0xBB"
echo "corresponding to red, green and blue per colorcell."
echo "Now copy the .enlightenment directory and its contents into your home"
echo "direcotry, and edit the windowstyles file as necessary."
echo "--------------------------------------"
echo " have fun and enjoy......."
echo " The Rasterman"
echo "--------------------------------------"






