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

echo "We need GTK+/GLIB (which will be statically linked) "
echo "but DO NOT have GNOME around... need a clean box. ;)"
sleep 7

if [ -L /usr/lib/libglib.so ]; then
  mv /usr/lib/libglib.so /tmp
fi

CWD=`pwd` 
cd /tmp
tar xzvf $CWD/mc-4.5.51.tar.gz
cd mc-4.5.51
zcat $CWD/mc.shadow.diff.gz | patch -p1 --verbose --backup --suffix=.orig -E
( cd vfs/samba ; zcat $CWD/samba.codepages.diff.gz | patch -p0 )
zcat $CWD/mc.security.diff.gz | patch -p1 --verbose --backup --suffix=.orig -E
CFLAGS=-O2 ./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
make install
mkdir -p /usr/doc/mc-4.5.51
cp -a FAQ COPYING NEWS README /usr/doc/mc-4.5.51
chown -R root.root /usr/doc/mc-4.5.51

if [ -L /tmp/libglib.so ]; then
  mv /tmp/libglib.so /usr/lib
fi
