# SliTaz package receipt.

PACKAGE="vte"
VERSION="0.50.2" # Also --> python-vte
CATEGORY="utilities"
SHORT_DESC="Terminal capabilities for GTK+ widgets."
MAINTAINER="pankso@slitaz.org"
LICENSE="GPL2"
TARBALL="$PACKAGE-$VERSION.tar.xz"
WEB_SITE="https://www.gnome.org/"
WGET_URL="$GNOME_MIRROR/$PACKAGE/${VERSION%.*}/$TARBALL"
HOST_ARCH="i486 arm"

DEPENDS="gtk+ gtk+3 libgnutls gdk-pixbuf ncurses xorg-libXdamage"
BUILD_DEPENDS="gtk+-dev ncurses-dev"

# Handle cross compilation.
case "$ARCH" in
	i?86) 
		BUILD_DEPENDS="pygtk-dev python-dev gobject-introspection-dev perl
		perl-xml-parser ncurses-dev pcre2-dev gtk+3-dev gnutls-dev gperf vala"
		ARCH_ARGS="--enable-introspection=yes" ;;
	arm) 
		ARCH_ARGS="--enable-introspection=no" ;;
esac

current_version()
{
	wget -O - $GNOME_MIRROR/$PACKAGE/$(wget -O - $GNOME_MIRROR/$PACKAGE 2>/dev/null | \
	sed '/href="[0-9]/!d;s|.*href="||;s|/" .*||' | sort -Vr | sed q) 2>/dev/null | \
	sed "/href=\"$PACKAGE-[0-9]/!d;s|.*$PACKAGE-||;s|.[a-z].*||" | sort -Vr | sed q
}

# Rules to configure and make the package.
compile_rules()
{
	#patch -p1 -i $stuff/AltKey.patch

	# Fix build with vala
	# see https://gitlab.gnome.org/GNOME/vte/issues/76
	patch -p1 < $stuff/vte-vala.patch

	./configure \
		--libexecdir=/usr/lib/vte \
		--with-html-dir=/usr/share/doc \
		--with-pcre \
		--disable-static \
		$CONFIGURE_ARGS &&
	make && make install
	# add 'Home' and 'End' keys
	#sed -i '9i\ \ \ \ :kh=\\E[H:@7=\\E[F:\\' $install/usr/share/vte/termcap-0.0/xterm
}

# Rules to gen a SliTaz package suitable for Tazpkg.
genpkg_rules()
{
	mkdir -p $fs/usr/lib $fs/usr/share
	cp -a $install/usr/lib/*.so* $fs/usr/lib
	#cp -a $install/usr/lib/vte $fs/usr/lib
	#cp -a $install/usr/share/vte $fs/usr/share
}