CWD=`pwd`

if xlsfonts 1> /dev/null 2> /dev/null ; then
  true
else
  echo "This is one of those wacky things that requires X"
  echo "programs during the build.  Try again under X."
  sleep 100
fi

if ls /usr/lib/libast.so.5.? 1> /dev/null ; then
  cat << EOF
It seems your machine has /usr/lib/libast.so.5 (aka
The Real libast) which has long been part of the Korn
Shell distribution.  You'll need to remove ksh93 from
your machine which Eterm is built.

Don't worry, we will not allow this "fake" libast to take
over the libast.so link.  :-)
EOF
  sleep 100
fi

cd /tmp
tar xzvf $CWD/imlib2-1.0.6.tar.gz
cd imlib2-1.0.6
chown -R root.root .
CFLAGS="-O2 -march=i386 -mcpu=i686" \
./configure \
--prefix=/usr \
--disable-mmx \
--disable-static \
i386-slackware-linux
make
make install
ldconfig
mkdir -p /usr/doc/imlib2-1.0.6
cp -a AUTHORS COPYING README TODO \
  /usr/doc/imlib2-1.0.6

# Because of the already-used libast name, this must
# be built in /usr/local and then mostly thrown out
# at packaging time...  we'll keep only the shared
# library itself.
cd /tmp
tar xzvf $CWD/libast-0.4.tar.gz
cd libast-0.4
chown -R root.root .
CFLAGS="-O2 -march=i386 -mcpu=i686" \
./configure \
--prefix=/usr/local \
--disable-mmx \
--disable-static \
i386-slackware-linux
make
make install
cp -a /usr/local/lib/libast.so.* /usr/lib
ldconfig
mkdir -p /usr/doc/libast-0.4
cp -a README /usr/doc/libast-0.4

cd /tmp
tar xzvf $CWD/Eterm-0.9.1.tar.gz
cd Eterm-0.9.1
chown -R root.root .
CFLAGS="-O2 -march=i386 -mcpu=i686" \
./configure \
--prefix=/usr \
--disable-mmx \
--disable-static \
i386-slackware-linux
make
make install
mkdir -p /usr/doc/Eterm-0.9.1
cp -a \
  CVS-README README ReleaseNotes bg/README.backgrounds doc/Eterm_reference.html \
  /usr/doc/Eterm-0.9.1

mkdir -p /install
cat $CWD/slack-desc > /install/slack-desc
