#!/bin/bash

COMPILEOPTIONS="$COMPILEOPTIONS DEBUG="

ml_check_for_package X

function ml_configure() {
	cd $PACKAGE/$PACKAGE
	
	 ./configure --disable-xpm-background --disable-graphics --disable-memset \
		    --enable-xterm-scroll --with-x --with-term=xterm \
		    --x-includes=$TOOLS/usr/X11R6/include --x-libraries=$TOOLS/usr/X11R6/lib \
		    --prefix=$TOOLS --silent
	# After all that, we still need to patch the config.h.  Ugh.
	sed -e 's@\/\* #undef NO_XSETLOCALE \*\/@#define NO_XSETLOCALE 1@' config.h > $$
	mv $$ config.h
}
	

function ml_compile() {
        ml_compile_default
	strip src/rxvt
}

function ml_installroot() {
        cd $PACKAGE
        [ "$RXVT_MLCONFIG_RXVT" = no ] || ml_mlconfig / mlconfig/rxvt.menu mlconfig/rxvt.cgi

	mkdir -p $ROOT/usr/X11R6/bin
        install --mode=755 $BUILD/$PACKAGE/$PACKAGE/src/rxvt $ROOT/usr/X11R6/bin

        # too many things want xterm
        ln -sf /usr/X11R6/bin/rxvt $ROOT/usr/X11R6/bin/xterm

	if [ "$RXVT_AUTOSTART" = "yes" ] ; then
		ml_transpose init.d/xterm $ROOT/usr/X11R6/init.d/xterm 755
	fi
}
