CWD=`pwd`

VERSION=5.34

# We need includes from this:
( cd /tmp
  tar xzvf $CWD/tcl8.3.4.tar.gz
  cd tcl8.3.4/unix
  ./configure --prefix=/usr )

# Build and install static version:
( cd /tmp
tar xzvf $CWD/expect-$VERSION.tar.gz
cd expect-$VERSION
./configure --prefix=/usr --with-tclconfig=/usr/lib \
  --with-tclinclude=/tmp/tcl8.3.4/generic
make
make install )
mv /tmp/expect-$VERSION /tmp/expect-$VERSION-static

# Build and install shared version:
( cd /tmp
tar xzvf $CWD/expect-$VERSION.tar.gz
cd expect-$VERSION
./configure --prefix=/usr --with-tclconfig=/usr/lib \
  --with-tclinclude=/tmp/tcl8.3.4/generic --enable-shared
make
make install
mkdir -p /usr/doc/expect-$VERSION
cp -a FAQ HISTORY INSTALL NEWS README example /usr/doc/expect-$VERSION
chown -R root.root /usr/doc/expect-$VERSION )

( cd /usr/lib
  rm -rf libexpect.a
  ln -sf libexpect${VERSION}.a libexpect.a
  rm -rf libexpect.so
  ln -sf libexpect${VERSION}.so libexpect.so )

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