%define openjadever 1.3.2 %define version_list "{3,4}.{0,1}-sgml 4.1.2-xml 4.{2,3,4,5}-{sgml,xml}" Name: docbook-dtds Version: 1.0 Release: 48 Group: Applications/Text Summary: SGML and XML document type definitions for DocBook License: Freely redistributable without restriction URL: http://www.oasis-open.org/docbook/ Source0: %{name}-%{version}.tar.bz2 BuildArch: noarch Requires(post): libxml2 >= 2.4.8 Requires(post): /bin/chmod Requires(postun): libxml2 >= 2.4.8 Requires: sgml-common >= 0.6.3 Requires: xml-common >= 0.6.3 Provides: docbook-dtd-xml = %{version}-%{release} Provides: docbook-dtd-sgml = %{version}-%{release} Provides: docbook-dtd30-sgml = %{version}-%{release} Provides: docbook-dtd31-sgml = %{version}-%{release} Provides: docbook-dtd40-sgml = %{version}-%{release} Provides: docbook-dtd41-sgml = %{version}-%{release} Provides: docbook-dtd412-xml = %{version}-%{release} Provides: docbook-dtd42-sgml = %{version}-%{release} Provides: docbook-dtd42-xml = %{version}-%{release} Provides: docbook-dtd43-sgml = %{version}-%{release} Provides: docbook-dtd43-xml = %{version}-%{release} Provides: docbook-dtd44-sgml = %{version}-%{release} Provides: docbook-dtd44-xml = %{version}-%{release} Provides: docbook-dtd45-sgml = %{version}-%{release} Provides: docbook-dtd45-xml = %{version}-%{release} %description The DocBook Document Type Definition (DTD) describes the syntax of technical documentation texts (articles, books and manual pages). This syntax is XML-compliant and is developed by the OASIS consortium. This package contains SGML and XML versions of the DocBook DTD. %prep %setup -q if [ `id -u` -eq 0 ]; then chown -R root:root . chmod -R a+rX,g-w,o-w . fi %build %install # Symlinks mkdir -p %{buildroot}/etc/sgml for fmt in sgml xml; do ln -s $fmt-docbook-4.5-%{version}-%{release}.cat \ %{buildroot}/etc/sgml/$fmt-docbook.cat done eval set %{version_list} for dir do cd $dir fmt=${dir#*-} vvr=${dir%%-*}-%{version}-%{release} DESTDIR=%{buildroot}/usr/share/sgml/docbook/$fmt-dtd-$vvr case $fmt in sgml) mkdir -p $DESTDIR ; install *.dcl $DESTDIR ;; xml) mkdir -p $DESTDIR/ent ; install ent/* $DESTDIR/ent ;; esac install *.dtd *.mod $DESTDIR install docbook.cat $DESTDIR/catalog cd .. # File for %%ghost touch %{buildroot}/etc/sgml/$fmt-docbook-$vvr.cat done %post catcmd='/usr/bin/xmlcatalog --noout' xmlcatalog=/usr/share/sgml/docbook/xmlcatalog ## Clean up pre-docbook-dtds mess caused by broken trigger. for v in 3.0 3.1 4.0 4.1 4.2 do if [ -f /etc/sgml/sgml-docbook-$v.cat ] then $catcmd --sgml --del /etc/sgml/sgml-docbook-$v.cat \ /usr/share/sgml/openjade-1.3.1/catalog 2>/dev/null fi done # The STYLESHEETS/catalog command is for the case in which the style sheets # were installed after another DTD but before this DTD for STYLESHEETS in /usr/share/sgml/docbook/dsssl-stylesheets-*; do : ; done case $STYLESHEETS in *-"*") STYLESHEETS= ;; esac eval set %{version_list} for dir do fmt=${dir#*-} ver=${dir%%-*} vvr=$ver-%{version}-%{release} sgmldir=/usr/share/sgml/docbook/$fmt-dtd-$vvr ## SGML catalog # Update the centralized catalog corresponding to this version of the DTD for cat_dir in /usr/share/sgml/sgml-iso-entities-8879.1986 $sgmldir $STYLESHEETS; do $catcmd --sgml --add /etc/sgml/$fmt-docbook-$vvr.cat $cat_dir/catalog done ## XML catalog if [ $fmt = xml -a -w $xmlcatalog ]; then while read f desc; do case $ver in 4.[45]) f=${f/-/} ;; esac $catcmd --add public "$desc" $sgmldir/$f $xmlcatalog done < # Fix up SGML super catalog so that there isn't an XML DTD before an # SGML one. We need to do this (*sigh*) because xmlcatalog messes up # the order of the lines, and SGML tools don't like to see XML things # they aren't expecting. # # But the code that followed just found the first XML DTD and the first # SGML DTD, swappinmg these two lines if the XML one preceded. # But that only ensures that there is an SGML DTD before all XML ones. # No one complained, so either this was enough, or the buggy SGML tools # are long dead, or their users do not use bugzilla. # Anyway, the following code, introduced in 1.0-46, does better: it ensures # that all XML DTDs are after all SGML ones, by moving them to the end. sed -ni ' /xml-docbook/ H /xml-docbook/ !p $ { g s/^\n//p } ' /etc/sgml/catalog # Finally, make sure everything in /etc/sgml is readable! /bin/chmod a+r /etc/sgml/* %postun catcmd='/usr/bin/xmlcatalog --noout' xmlcatalog=/usr/share/sgml/docbook/xmlcatalog entities=" ent/iso-pub.ent ent/iso-grk1.ent dbpoolx.mod ent/iso-box.ent docbookx.dtd ent/iso-grk3.ent ent/iso-amsn.ent ent/iso-num.ent dbcentx.mod ent/iso-grk4.ent dbnotnx.mod ent/iso-dia.ent ent/iso-grk2.ent dbgenent.mod dbhierx.mod ent/iso-amsa.ent ent/iso-amso.ent ent/iso-cyr1.ent ent/iso-tech.ent ent/iso-amsc.ent soextblx.dtd calstblx.dtd ent/iso-lat1.ent ent/iso-amsb.ent ent/iso-lat2.ent ent/iso-amsr.ent ent/iso-cyr2.ent " eval set %{version_list} for dir do fmt=${dir#*-} ver=${dir%%-*} vvr=$ver-%{version}-%{release} sgmldir=/usr/share/sgml/docbook/$fmt-dtd-$vvr ## SGML catalog # Update the centralized catalog corresponding to this version of the DTD $catcmd --sgml --del /etc/sgml/catalog /etc/sgml/$fmt-docbook-$vvr.cat rm -f /etc/sgml/$fmt-docbook-$vvr.cat ## XML catalog if [ $fmt = xml -a -w $xmlcatalog ]; then for f in $entities; do case $ver in 4.[45]) f=${f/-/} ;; esac $catcmd --del $sgmldir/$f $xmlcatalog done $catcmd --del $sgmldir $xmlcatalog fi done # See the comment attached to this command in the %%post scriptlet. sed -ni ' /xml-docbook/ H /xml-docbook/ !p $ { g s/^\n//p } ' /etc/sgml/catalog %files %defattr (0644,root,root,0755) # in upstream tarballs there are a lot of files with 0755 permissions # but they don't need to be; 0644 is enough for every file in tarball %doc --parents 3.1-sgml/ChangeLog 4.1-sgml/ChangeLog */*.txt %config(noreplace) /etc/sgml/sgml-docbook.cat %config(noreplace) /etc/sgml/xml-docbook.cat %{_datadir}/sgml/docbook/*ml-dtd-*-%{version}-%{release} %ghost %config(noreplace) /etc/sgml/*ml-docbook-*-%{version}-%{release}.cat