# SliTaz package receipt.

PACKED_SIZE="188.0K"
UNPACKED_SIZE="564.0K"
PACKAGE="xterm"
VERSION="356"
CATEGORY="utilities"
TAGS="terminal"
SHORT_DESC="X terminal emulator."
MAINTAINER="pankso@slitaz.org"
LICENSE="MIT"
WEB_SITE="https://invisible-island.net/xterm/"

TARBALL="$PACKAGE-$VERSION.tgz"
WGET_URL="http://invisible-mirror.net/archives/$PACKAGE/$TARBALL"

DEPENDS="expat fontconfig freetype ncurses xorg-libXaw3d 
	xorg-libXft xorg-libXpm xorg-libXt"
BUILD_DEPENDS="expat-dev fontconfig-dev freetype-dev ncurses-dev 
	xorg-libXaw3d-dev xorg-libXft-dev xorg-libXt-dev"

GENERIC_PIXMAPS="no"

HOST_ARCH="i486 arm"

current_version()
{
	wget -O - ${WEB_SITE}xterm.log.html 2>/dev/null | \
	sed '/Patch/!d;s|.*xterm_||;s|".*||;q'
}

# Rules to configure and make the package.
compile_rules()
{
	export LDFLAGS="$LDFLAGS -Wl,--copy-dt-needed-entries"

	./configure						\
		--prefix=/usr					\
		--sysconfdir=/etc				\
		--mandir=/usr/share/man				\
		--localstatedir=/var				\
		--with-app-defaults=/usr/share/X11/app-defaults	\
		--with-icon-symlink				\
		--with-Xaw3d					\
		 --enable-256-color				\
		--disable-boxchars				\
		--disable-delete-is-del				\
		--disable-desktop				\
		 --enable-doublechars				\
		 --enable-freetype				\
		--disable-luit					\
		 --enable-meta-sends-esc			\
		--disable-rectangles				\
		--disable-sun-fkeys				\
		--disable-tek4014				\
		--disable-vt52					\
		 --enable-wide-chars				\
		$CONFIGURE_ARGS &&
	make &&
	make DESTDIR=$DESTDIR install
}

# Rules to gen a SliTaz package suitable for Tazpkg.
genpkg_rules()
{
	cp -a $install/*	$fs
	find $fs -regex '.*\(2.\|U\|I\|8r\|ux\|man\).*' -delete
	rm -rf			$fs/usr/share/pixmaps
	ln -s xterm		$fs/usr/bin/uxterm

	cat >> $fs/usr/share/X11/app-defaults/XTerm <<EOT
!
!	libXaw3d  options
xterm*beNiceToColormap: false
xterm*SmeBSB.shadowWidth:  3
xterm*topShadowContrast: 20
xterm*bottomShadowContrast: 50
EOT

	chown -R root:root $fs	
}

# One of the first X apps cross compiled. Be sure all went well
testsuite()
{
	readelf -h $install/usr/bin/xterm
}
