NAME=lesstif
VERSION=0.95.0
SOURCE=$MIRROR_SF/lesstif/lesstif-$VERSION.tar.bz2
BUILD=1
OPTIMIZE=${OPTIMIZE:-"-Os -pipe"}
PREFIXTYPE=x11

build() {
	_explode 0
	cd lesstif-$VERSION

	# ac_cv_foo=yes are here, because the configure script of 0.94.4
	# is broken (doesn't detect Xrender, and if it is forced,
	# fontconfig is missed...).
	# UPDATE: Seems to affect 0.95.5 too.
	$CONFIGURE \
		--enable-shared \
		--disable-static \
		--enable-build-21 \
		--enable-build-Xlt \
		--enable-build-Xbae \
		--enable-xbae-24bit \
		--enable-xbae-row-heights \
		--disable-debug \
		--enable-production \
		--with-editres \
		--with-xdnd \
		ac_cv_header_X11_extensions_Xrender_h=yes \
		ac_cv_func_XRenderParseColor=yes \
		ac_cv_header_fontconfig_fontconfig_h=yes \
		ac_cv_func_FcInit=yes
	make
	make install DESTDIR=$PKG

	# Do not include mwm. Or does someone really use it?
	rm -rf $PKG$BINDIR/mwm $PKG$LIBDIR/X11/app-defaults

	# Too big:
	rm -rf $PKG$PREFIX/LessTif

	# Tukaani doesn't include Xprint support. Destroy <Xm/Print.h>
	# to allow applications to compile.
	if [ ! -f "$INCLUDEDIR/X11/extensions/Print.h" ]; then
		: > $PKG$INCLUDEDIR/Xm/Print.h
	fi

	# Hardcoded paths...
	sed -i "s|/usr/X11R6|$LIBDIR|g" $PKG$BINDIR/motif-config

	_doc 0 lesstif-$VERSION  AUTHORS BUG-REPORTING COPYING \
			COPYING.LIB CREDITS FAQ README ReleaseNotes.txt

	_chfix
	_chgrp_bin
}
