# SliTaz package receipt.

PACKED_SIZE="164.0K"
UNPACKED_SIZE="612.0K"
PACKAGE="pango"
VERSION="1.36.8"
CATEGORY="x-window"
SHORT_DESC="Layout and rendering of internationalized text"
MAINTAINER="pankso@slitaz.org"
LICENSE="GPL2"
TARBALL="$PACKAGE-$VERSION.tar.xz"
WEB_SITE="https://pango.gnome.org/"
WGET_URL="$GNOME_MIRROR/$PACKAGE/${VERSION%.*}/$TARBALL"
CONFIG_FILES="/etc/pango/pango.modules"
HOST_ARCH="i486 arm"

DEPENDS="cairo xorg-libXft slitaz-base-files gcc-lib-base util-linux-uuid"
BUILD_DEPENDS="cairo-dev libxml2-dev xorg-libXft-dev"

# Handle cross compilation
case "$ARCH" in
	i?86)
		BUILD_DEPENDS="$BUILD_DEPENDS gobject-introspection-dev" ;;
	arm*)
		export LIBTOOL=${HOST_SYSTEM}-libtool
		ARCH_ARGS="--enable-introspection=no" ;;
esac

# What is the latest version available today?
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()
{
	./configure \
		--prefix=/usr \
		--sysconfdir=/etc \
		--with-html-dir=/usr/share/doc \
		$CONFIGURE_ARGS $ARCH_ARGS &&
	make && make install
}

# Rules to gen a SliTaz package suitable for Tazpkg.
genpkg_rules()
{
	mkdir -p $fs/usr/bin $fs/usr/lib $fs/etc/pango
	cp -a $install/usr/bin/* $fs/usr/bin
	cp -a $install/usr/lib/*.so* $fs/usr/lib
	cp -a $install/usr/lib/pango $fs/usr/lib
	rm -rf $fs/usr/lib/pango/1.8.0/modules/*.la
	[ -d "$install/etc" ] && cp -a $install/etc $fs
	touch $fs/etc/pango/pango.modules
}

# Pre and post install commands for Tazpkg.
post_install()
{
	# Rebuilds pango.modules when installed.
	chroot "$1/" /usr/bin/pango-querymodules > "$1/etc/pango/pango.modules"
}
