# SliTaz package receipt.

PACKAGE="chemtool"
VERSION="1.6.14"
CATEGORY="graphics"
TAGS="chemistry"
SHORT_DESC="Small program for drawing chemical structures."
MAINTAINER="pankso@slitaz.org"
LICENSE="GPL2"
WEB_SITE="http://ruby.chemie.uni-freiburg.de/~martin/chemtool/"

TARBALL="$PACKAGE-$VERSION.tar.gz"
WGET_URL="$WEB_SITE$TARBALL"

DEPENDS="gtk+ xorg-libXdamage"
BUILD_DEPENDS="gtk+-dev xorg-xproto"

# What is the latest version available today?
current_version()
{
	wget -O - ${WGET_URL%/*} 2>/dev/null | \
	sed "/latest/d;/$PACKAGE-/!d;/tar/!d;s|.*$PACKAGE-\\(.*\\),.*|\\1|" | sort -Vr | sed q
}

# Rules to configure and make the package.
compile_rules()
{
	export LDFLAGS="$LDFLAGS -Wl,--copy-dt-needed-entries -lX11"
	./configure \
		--prefix=/usr \
		$CONFIGURE_ARGS &&
	make &&
	make DESTDIR=$DESTDIR install
}

# Rules to gen a SliTaz package suitable for Tazpkg.
genpkg_rules()
{
	# Needed directories.
	mkdir -p $fs/usr/share/locale $fs/usr/share/pixmaps \
	$fs/usr/share/examples/chemtool 
	
	# Binary file.
	cp -a $install/usr/bin $fs/usr
	
	# French locale, pixmap and menu.
	cp -a $install/usr/share/locale/fr $fs/usr/share/locale
	cp -a $src/gnome/chemtool.png $fs/usr/share/pixmaps
	
	# Examples.
	cp -a $src/examples/a*.cht $fs/usr/share/examples/chemtool
	cp -a $src/examples/c*.cht $fs/usr/share/examples/chemtool
	cp -a $src/examples/p*.cht $fs/usr/share/examples/chemtool
	cp -a $src/examples/t*.cht $fs/usr/share/examples/chemtool

	chown -R root:root $fs
}