#!/bin/sh
# Since GTK+/GLIB are (at this time) found in the XAP series, we don't want
# to require a shared glib for the lite version of MC in ap1/mc.tgz.

echo "Don't have GNOME around... need a clean box. ;)"
sleep 5

if [ -L /usr/lib/libglib.so ]; then
  mv /usr/lib/libglib.so /tmp
fi
CWD=`pwd` 
cd /tmp
tar fxvz $CWD/mc-4.5.39.tar.gz
cd mc-4.5.39
( cd vfs/samba ; zcat $CWD/samba.codepages.diff.gz | patch -p0 )
./configure --prefix=/usr \
	    --with-catgets \
	    --with-samba \
            --with-gpm-mouse=/usr \
            --with-ncurses=/usr \
	    --with-slang \
            --with-ext2undel \
            --localstatedir=/var \
            --with-x=no \
            i386-slackware-linux
make -j 3
make install
mkdir -p /usr/doc/mc-4.5.39
cp -a FAQ COPYING NEWS README /usr/doc/mc-4.5.39
chown -R root.root /usr/doc/mc-4.5.39

# Replace link.
if [ -L /tmp/libglib.so -a ! -L /usr/lib/libglib.so ]; then
  mv /tmp/libglib.so /usr/lib
fi
