kind: manual
depends:
- python2-core.bst
- docutils/xml-catalog.bst
sources:
- kind: git
  url: upstream:docbook-xml
  track: docbook-xml-4.5
  ref: c8f0ce32a8075e9ab21e5cf734fb96195455264d
config:
  install-commands:
  - install -v -d -m755 "%{install-root}%{prefix}/share/xml/docbook/xml-dtd-4.5"
  - install -v -d -m755 "%{install-root}/etc/xml"
  - |
    cp -v -af docbook.cat *.dtd ent/ *.mod \
         "%{install-root}%{prefix}/share/xml/docbook/xml-dtd-4.5"
  - |
    # Create (or update) and populate the "%{install-root}/etc/xml/docbook" catalog file
    if [ ! -e /etc/xml/docbook ]; then
        xmlcatalog --noout --create "%{install-root}/etc/xml/docbook"
    else
        # Copy the existing catalog so we can update it
        cp /etc/xml/docbook "%{install-root}/etc/xml/docbook"
    fi
  - |
    xmlcatalog --noout --add "public" \
     "-//OASIS//DTD DocBook XML V4.5//EN" \
     "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" \
     "%{install-root}/etc/xml/docbook"
  - |
    xmlcatalog --noout --add "public" \
     "-//OASIS//DTD DocBook XML CALS Table Model V4.5//EN" \
     "file:///usr/share/xml/docbook/xml-dtd-4.5/calstblx.dtd" \
     "%{install-root}/etc/xml/docbook"
  - |
    xmlcatalog --noout --add "public" \
     "-//OASIS//DTD XML Exchange Table Model 19990315//EN" \
     "file:///usr/share/xml/docbook/xml-dtd-4.5/soextblx.dtd" \
     "%{install-root}/etc/xml/docbook"
  - |
    xmlcatalog --noout --add "public" \
     "-//OASIS//ELEMENTS DocBook XML Information Pool V4.5//EN" \
     "file:///usr/share/xml/docbook/xml-dtd-4.5/dbpoolx.mod" \
     "%{install-root}/etc/xml/docbook"
  - |
    xmlcatalog --noout --add "public" \
     "-//OASIS//ELEMENTS DocBook XML Document Hierarchy V4.5//EN" \
     "file:///usr/share/xml/docbook/xml-dtd-4.5/dbhierx.mod" \
     "%{install-root}/etc/xml/docbook"
  - |
    xmlcatalog --noout --add "public" \
     "-//OASIS//ELEMENTS DocBook XML HTML Tables V4.5//EN" \
     "file:///usr/share/xml/docbook/xml-dtd-4.5/htmltblx.mod" \
     "%{install-root}/etc/xml/docbook"
  - |
    xmlcatalog --noout --add "public" \
     "-//OASIS//ENTITIES DocBook XML Notations V4.5//EN" \
     "file:///usr/share/xml/docbook/xml-dtd-4.5/dbnotnx.mod" \
     "%{install-root}/etc/xml/docbook"
  - |
    xmlcatalog --noout --add "public" \
     "-//OASIS//ENTITIES DocBook XML Character Entities V4.5//EN" \
     "file:///usr/share/xml/docbook/xml-dtd-4.5/dbcentx.mod" \
     "%{install-root}/etc/xml/docbook"
  - |
    xmlcatalog --noout --add "public" \
     "-//OASIS//ENTITIES DocBook XML Additional General Entities V4.5//EN" \ "file:///usr/share/xml/docbook/xml-dtd-4.5/dbgenent.mod" \
     "%{install-root}/etc/xml/docbook"
  - |
    xmlcatalog --noout --add "rewriteSystem" \
     "http://www.oasis-open.org/docbook/xml/4.5" \
     "file:///usr/share/xml/docbook/xml-dtd-4.5" \
     "%{install-root}/etc/xml/docbook"
  - |
    xmlcatalog --noout --add "rewriteURI" \
     "http://www.oasis-open.org/docbook/xml/4.5" \
     "file:///usr/share/xml/docbook/xml-dtd-4.5" \
     "%{install-root}/etc/xml/docbook"
  - |
    # Create (or update) and populate the "%{install-root}/etc/xml/catalog" catalog file
    if [ ! -e /etc/xml/catalog ]; then
        echo 'Creating new xml catalog'
        xmlcatalog --noout --create "%{install-root}/etc/xml/catalog"
    else
        # Copy the existing catalog so we can update it
        cp /etc/xml/catalog "%{install-root}/etc/xml/catalog"
    fi
  - |
    xmlcatalog --noout --add "delegatePublic" \
     "-//OASIS//ENTITIES DocBook XML" \
     "file:///etc/xml/docbook" \
     "%{install-root}/etc/xml/catalog"
  - |
    xmlcatalog --noout --add "delegatePublic" \
     "-//OASIS//DTD DocBook XML" \
     "file:///etc/xml/docbook" \
     "%{install-root}/etc/xml/catalog"
  - |
    xmlcatalog --noout --add "delegateSystem" \
     "http://www.oasis-open.org/docbook/" \
     "file:///etc/xml/docbook" \
     "%{install-root}/etc/xml/catalog"
  - |
    xmlcatalog --noout --add "delegateURI" \
     "http://www.oasis-open.org/docbook/" \
     "file:///etc/xml/docbook" \
     "%{install-root}/etc/xml/catalog"
