# SliTaz package receipt.

PACKAGE="xournal"
VERSION="0.4.8.2016"
CATEGORY="utilities"
SHORT_DESC="Notetaking application."
MAINTAINER="meshca@clarkson.edu"
LICENSE="GPL2"
WEB_SITE="https://xournal.sourceforge.net/"

TARBALL="$PACKAGE-$VERSION.tar.gz"
WGET_URL="$SF_MIRROR/$PACKAGE/$TARBALL"
TAGS="annotation pdf"

SUGGESTED="ghostscript"
DEPENDS="gcc-lib-base gtk+ libgnomecanvas poppler poppler-apps"
BUILD_DEPENDS="autoconf automake gtk+-dev libart_lgpl-dev 
	libgnomecanvas-dev poppler-dev zlib-dev"

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

# Rules to configure and make the package.
compile_rules()
{
	CFLAGS="$CFLAGS `pkg-config --cflags --libs gtk+-2.0` `pkg-config --libs x11` -lm -lz"
#	wget http://people.slitaz.org/~naitsirhc/xournal.patch && \
#	patch -p1 -i xournal.patch && 

	./configure				\
		--prefix=/usr			\
		--infodir=/usr/share/info	\
		--mandir=/usr/share/man		\
		$CONFIGURE_ARGS &&
	make &&
	make DESTDIR=$DESTDIR install &&
	make DESTDIR=$DESTDIR desktop-install	
}

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

	cp -a $install/usr/bin			$fs/usr
	cp -a $install/usr/share/icons		$fs/usr/share
	cp -a $install/usr/share/xournal	$fs/usr/share
}