SUMMARY="Docbook DTD for XML"
DESCRIPTION="
DocBook is an XML vocabulary that lets you create documents in a \
presentation-neutral form that captures the logical structure of your content.

DocBook is a schema (available in several languages including RELAX NG, \
W3C XML Schemas, and XML DTDs) maintained by the DocBook Technical Committee \
of OASIS. It is particularly well suited to books and papers about computer \
hardware and software (though it is by no means limited to these applications).
"

HOMEPAGE="http://www.docbook.org/schemas/4x.html"
SOURCE_URI="http://www.docbook.org/xml/$portVersion/docbook-xml-$portVersion.zip"
CHECKSUM_SHA256="4e4e037a2b83c98c6c94818390d4bdd3f6e10f6ec62dd79188594e26190dc7b4"

REVISION="2"
ARCHITECTURES="any"

LICENSE="Docbook"
COPYRIGHT="
	1996-2006 HaL Computer Systems Inc., O'Reilly & Associates Inc,
		ArborText Inc, Fujitsu Software Corporation, Norman Walsh,
		Sun Microsystems Inc. and the Organization for the Advancement of
		Structured Information Standards (OASIS)
	"

PROVIDES="
	docbook_xml_dtd = $portVersion
	"
BUILD_PREREQUIRES="
	cmd:xmlcatalog
	cmd:find
	"

SOURCE_DIR=""
BUILD()
{
	true
}

INSTALL()
{
	mkdir -p $dataDir/xml/docbook/xml-dtd-$portVersion
	cp -v -af docbook.cat *.dtd ent/ *.mod \
		$dataDir/xml/docbook/xml-dtd-$portVersion

	mkdir -p $dataDir/xml/catalog

	CATALOG=$dataDir/xml/docbook-$portVersion
	xmlcatalog --noout --create $CATALOG

	for DTDVERSION in 4.1.2 4.2 4.3 4.4 4.5
	do
		xmlcatalog --noout --add "public" \
    		"-//OASIS//DTD DocBook XML V$DTDVERSION//EN" \
    		"http://www.oasis-open.org/docbook/xml/$DTDVERSION/docbookx.dtd" \
    		$CATALOG
		xmlcatalog --noout --add "rewriteSystem" \
			"http://www.oasis-open.org/docbook/xml/$DTDVERSION" \
			"file://$dataDir/xml/docbook/xml-dtd-$portVersion" \
			$CATALOG
		xmlcatalog --noout --add "rewriteURI" \
			"http://www.oasis-open.org/docbook/xml/$DTDVERSION" \
			"file://$dataDir/xml/docbook/xml-dtd-$portVersion" \
			$CATALOG
	done

	xmlcatalog --noout --add "public" \
    	"-//OASIS//DTD DocBook XML CALS Table Model V$portVersion//EN" \
    	"file://$dataDir/xml/docbook/xml-dtd-$portVersion/calstblx.dtd" \
    	$CATALOG
	xmlcatalog --noout --add "public" \
    	"-//OASIS//DTD XML Exchange Table Model 19990315//EN" \
    	"file://$dataDir/xml/docbook/xml-dtd-$portVersion/soextblx.dtd" \
    	$CATALOG
	xmlcatalog --noout --add "public" \
    	"-//OASIS//ELEMENTS DocBook XML Information Pool V$portVersion//EN" \
    	"file://$dataDir/xml/docbook/xml-dtd-$portVersion/dbpoolx.mod" \
    	$CATALOG
	xmlcatalog --noout --add "public" \
		"-//OASIS//ELEMENTS DocBook XML Document Hierarchy V$portVersion//EN" \
		"file://$dataDir/xml/docbook/xml-dtd-$portVersion/dbhierx.mod" \
		$CATALOG
	xmlcatalog --noout --add "public" \
		"-//OASIS//ELEMENTS DocBook XML HTML Tables V$portVersion//EN" \
		"file://$dataDir/xml/docbook/xml-dtd-$portVersion/htmltblx.mod" \
		$CATALOG
	xmlcatalog --noout --add "public" \
		"-//OASIS//ENTITIES DocBook XML Notations V$portVersion//EN" \
		"file://$dataDir/xml/docbook/xml-dtd-$portVersion/dbnotnx.mod" \
		$CATALOG
	xmlcatalog --noout --add "public" \
		"-//OASIS//ENTITIES DocBook XML Character Entities V$portVersion//EN" \
		"file://$dataDir/xml/docbook/xml-dtd-$portVersion/dbcentx.mod" \
		$CATALOG
	xmlcatalog --noout --add "public" \
		"-//OASIS//ENTITIES DocBook XML Additional General Entities V$portVersion//EN" \
		"file://$dataDir/xml/docbook/xml-dtd-$portVersion/dbgenent.mod" \
		$CATALOG
	CATALOG=$dataDir/xml/catalog/docbook-xml-dtd
	xmlcatalog --noout --create $CATALOG

	xmlcatalog --noout --add "delegatePublic" \
		"-//OASIS//ENTITIES DocBook XML" \
		"file://$dataDir/xml/docbook-$portVersion" \
		$CATALOG
	xmlcatalog --noout --add "delegatePublic" \
		"-//OASIS//DTD DocBook XML" \
		"file://$dataDir/xml/docbook-$portVersion" \
		$CATALOG

	
	for DTDVERSION in 4.1.2 4.2 4.3 4.4 4.5
	do
		xmlcatalog --noout --add "delegateSystem" \
			"http://www.oasis-open.org/docbook/" \
			"file://$dataDir/xml/docbook-$DTDVERSION" \
			$CATALOG
		xmlcatalog --noout --add "delegateURI" \
			"http://www.oasis-open.org/docbook/" \
			"file://$dataDir/xml/docbook-$DTDVERSION" \
			$CATALOG
	done
}

