# SliTaz package receipt.

PACKAGE="docbook-xsl-ns"
VERSION="1.76.1"
CATEGORY="development"
SHORT_DESC="DocBook XSL (namespaced) stylesheets."
MAINTAINER="paul@slitaz.org"
DEPENDS="libxml2-tools libxslt"
TARBALL="$PACKAGE-$VERSION.tar.bz2"
WEB_SITE="http://wiki.docbook.org/topic/DocBookXslStylesheets"
WGET_URL="http://jaist.dl.sourceforge.net/sourceforge/docbook/$TARBALL"

# Rules to gen a SliTaz package suitable for Tazpkg.
genpkg_rules()
{
	cd $src
	pkgroot=$fs/usr/share/xml/docbook/stylesheet/$PACKAGE
	install -dm755 $pkgroot/common
	install -dm755 $pkgroot/params
	
	for fn in xml xsl dtd ent; do
		install -m644 common/*.${fn} $pkgroot/common/
	done
	
	for fn in fo highlighting html roundtrip; do
		install -dm755 ${pkgroot}/${fn}
		install -m644 ${fn}/*.xml ${pkgroot}/${fn}/
		install -m644 ${fn}/*.xsl ${pkgroot}/${fn}/
	done

	for fn in eclipse htmlhelp javahelp lib manpages profiling template website xhtml xhtml-1_1; do
		install -dm755 ${pkgroot}/${fn}
		install -m644 ${fn}/*.xsl ${pkgroot}/${fn}/
	done
}

# Pre and post install commands for Tazpkg.
post_install()
{
	echo -n "Processing post-install commands..."

	# Create a /etc/xml/catalog file
	if [ ! -d $1/etc/xml ]; then install -v -m755 -d $1/etc/xml; fi &&
	if [ ! -f $1/etc/xml/catalog ]; then
    		xmlcatalog --noout --create $1/etc/xml/catalog
	fi &&

	xmlcatalog --noout --add "rewriteSystem" \
		"http://docbook.sourceforge.net/release/xsl-ns/$VERSION" \
		"/usr/share/xml/docbook/stylesheet/$PACKAGE/catalog.xml" \
	$1/etc/xml/catalog &&

	xmlcatalog --noout --add "rewriteURI" \
		"http://docbook.sourceforge.net/release/xsl-ns/$VERSION" \
		"/usr/share/xml/docbook/stylesheet/$PACKAGE/catalog.xml" \
	$1/etc/xml/catalog &&

	xmlcatalog --noout --add "rewriteSystem" \
		"http://docbook.sourceforge.net/release/xsl-ns/current" \
		"/usr/share/xml/docbook/stylesheet/$PACKAGE/catalog.xml" \
	$1/etc/xml/catalog &&

	xmlcatalog --noout --add "rewriteURI" \
		"http://docbook.sourceforge.net/release/xsl-ns/current" \
		"/usr/share/xml/docbook/stylesheet/$PACKAGE/catalog.xml" \
	$1/etc/xml/catalog
	status
}