#!/bin/sh

# lesstif.build
# Build lesstif for Slackware Linux
# Modified a tinsy bit for ARMedslack by Stuart Winter.

VERSION=$1

# Extract source:
cd $SLACKTRACKSCRATCHDIR
tar xjvf $CWD/lesstif-$VERSION.tar.bz2
cd lesstif-$VERSION
slackhousekeeping

# Configure:
CFLAGS="$ARCH_CFLAGS" \
./configure \
  --enable-shared \
  --enable-static \
  --enable-build-21 \
  --enable-build-Xlt \
  --enable-build-Xbae \
  --enable-xbae-24bit \
  --enable-xbae-row-heights \
  --disable-debug \
  --prefix=/usr/X11R6 \
  $ARCH-slackware-linux || failconfig

# Build:
make || failmake

rm -rf /etc/X11/mwm /usr/X11R6/lib/X11/mwm
# I know this is destructive, but that's the way the cookie crumbles:
rm -f /usr/X11R6/lib/X11/config/host.def

# Install:
make install 
( cd /usr/doc ; rm -rf lesstif-$VERSION ; ln -sf /usr/X11R6/LessTif lesstif-$VERSION )
mkdir -p /usr/X11R6/lib/X11/config
cp -a /usr/X11R6/lib/LessTif/config/* /usr/X11R6/lib/X11/config
( cd /usr/X11R6/lib/X11/config ; mv host.def host.def-lesstif )
( cd /usr/X11R6/lib/X11 ; cp -a mwm /etc/X11 ; rm -rf mwm ; ln -sf ../../../../etc/X11/mwm . )

# Install install-script & package description:
cd /
slackdesc
