# Description: GUI toolkit, which is compatible with motif.
# URL: http://www.lesstif.org/
# Maintainer: Simone Rota, sip at crux dot nu
# Packager: Daniel Mueller, daniel at danm dot de
# Depends on: x11

name=lesstif
version=0.95.0
release=2
source=(http://dl.sourceforge.net/sourceforge/$name/$name-$version.tar.bz2 \
	$name-$version-xpm.patch) 

build () {
    cd $name-$version
    patch -p1 < ../$name-$version-xpm.patch
    autoconf

    export CFLAGS="$CFLAGS -L$PKG/usr/lib"
    export CXXFLAGS="$CXXFLAGS -L$PKG/usr/lib"

    ./configure --prefix=/usr \
    		--enable-nonstandard-conversions \
		--enable-editres --with-xdnd \
		--enable-build-21 --disable-debug \
		--enable-production \
		--mandir=/usr/man
    make
    
    mkdir -p $PKG/usr/{lib,X11R6/lib}
    mkdir -p $PKG/etc/X11

    make DESTDIR=$PKG install
    
    mv $PKG/usr/lib/X11/app-defaults $PKG/etc/X11/
    mv $PKG/usr/lib/X11 $PKG/usr/X11R6/lib/
    
    rm $PKG/usr/X11R6/lib/X11/mwm/README 
    rm -rf $PKG/usr/LessTif

    mv $PKG/usr/man/man3/Shell.3 $PKG/usr/man/man3/LesstifShell.3
    mv $PKG/usr/man/man3/Object.3 $PKG/usr/man/man3/LesstifObject.3

    sed -i -e "s|-L${PKG}/usr/lib||g" $PKG/usr/lib/*.la
}
