# SliTaz package receipt.

PACKAGE="djvulibre"
VERSION="3.5.28"
CATEGORY="office"
SHORT_DESC="A web-centric format and software platform for distributing documents and images."
MAINTAINER="pascal.bellard@slitaz.org"
LICENSE="GPL2"
WEB_SITE="https://djvu.sourceforge.net/djview4.html"

TARBALL="$PACKAGE-$VERSION.tar.gz"
WGET_URL="$SF_MIRROR/djvu/$TARBALL"

DEPENDS="jpeg tiff"
BUILD_DEPENDS="bash jpeg-dev librsvg-apps tiff-dev xdg-utils"

#HOST_ARCH="i486 arm"

# Handle cross compilation. Build host must have: xdg-utils bash librsvg-apps
case "$ARCH" in
	arm*) BUILD_DEPENDS="tiff-dev jpeg-dev " ;;
esac

# What is the latest version available today?
current_version()
{
	wget -O - https://sourceforge.net/projects/djvu/files/DjVuLibre/ 2>/dev/null | \
	sed '/scope="row/!d;s|.*href="|"https://sourceforge.net|;q' | xargs wget -O - 2>/dev/null | \
	sed '/scope="row/!d;s|.*/DjVuLibre/||;s|/.*||;q'
}

# Rules to configure and make the package.
compile_rules()
{
	./configure			\
		--sysconfdir=/etc	\
		$CONFIGURE_ARGS &&
	make &&
	make install
}

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

	cp -a $install/usr/lib/*.so*	$fs/usr/lib
	cp -a $install/usr/bin		$fs/usr
	cp -a $install/usr/share/djvu	$fs/usr/share
}