# Template build file for 'xmlcatmgr'.
pkgname=xmlcatmgr
version=2.2
revision=3
build_style=gnu-configure
conf_files="
	/etc/sgml/catalog
	/etc/xml/catalog
	/usr/share/sgml/catalog
	/usr/share/xml/catalog"
short_desc="XML and SGML catalog manager"
maintainer="Juan RP <xtraeme@gmail.com>"
homepage="http://xmlcatmgr.sourceforge.net"
license="BSD"
distfiles="$SOURCEFORGE_SITE/xmlcatmgr/$pkgname-$version.tar.gz"
checksum=ea1142b6aef40fbd624fc3e2130cf10cf081b5fa88e5229c92b8f515779d6fdc

if [ "$CROSS_BUILD" ]; then
	hostmakedepends="xmlcatmgr"
fi

pre_install() {
	if [ -n "$CROSS_BUILD" ]; then
		_xmlcatmgr="xmlcatmgr"
	else
		_xmlcatmgr="./xmlcatmgr"
	fi
	# Create XML and SGML catalogs once built.
	echo "=> Creating SGML catalogs..."
	${_xmlcatmgr} -sc catalog.etc.sgml create
	${_xmlcatmgr} -sc catalog.sgml create
	${_xmlcatmgr} -sc catalog.etc.sgml add CATALOG /usr/share/sgml/catalog
	echo "=> Creating XML catalogs..."
	${_xmlcatmgr} -c catalog.etc.xml create
	${_xmlcatmgr} -c catalog.xml create
	${_xmlcatmgr} -c catalog.etc.xml add nextCatalog /usr/share/xml/catalog
}

post_install() {
	# Install the XML/SGML catalog files.
	echo "=> Installing XML/SGML catalogs."
	chmod 644 $wrksrc/catalog.*
	install -Dm644 catalog.sgml ${DESTDIR}/usr/share/sgml/catalog
	install -Dm644 catalog.etc.sgml ${DESTDIR}/etc/sgml/catalog
	install -Dm644 catalog.xml ${DESTDIR}/usr/share/xml/catalog
	install -Dm644 catalog.etc.xml ${DESTDIR}/etc/xml/catalog
}
