# SliTaz package receipt.

PACKAGE="xine-plugin"
VERSION="1.0.2"
CATEGORY="multimedia"
SHORT_DESC="Xine media player firefox plugin."
MAINTAINER="pankso@slitaz.org"
LICENSE="GPL2"
TARBALL="$PACKAGE-$VERSION.tar.bz2"
WEB_SITE="http://www.xinehq.de/"
WGET_URL="$SF_MIRROR/xine/$TARBALL"

DEPENDS="xine-lib firefox"
BUILD_DEPENDS="xine-lib xine-lib-dev xorg-dev"

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

# Rules to configure and make the package.
compile_rules()
{
	cd $src
	mkdir -p $DESTDIR/root/.mozilla/plugins
	./configure --prefix=/usr \
	--mandir=/usr/share/man $CONFIGURE_ARGS &&
	make &&
	make DESTDIR=$DESTDIR install
}

# Rules to gen a SliTaz package suitable for Tazpkg.
genpkg_rules()
{
	mkdir -p $fs/usr/share/xine
	find $install -name xineplugin.so -exec cp -a {} $fs/usr/share/xine \;
}

# Pre and post install commands for Tazpkg.
post_install()
{
	ln -s /usr/share/xine/xineplugin.so "$1"/usr/lib/firefox-*/plugins/
	ln -s /usr/share/xine/xineplugin.so "$1/usr/lib/mozilla/plugins/"
}