############################################################################### # IPFire.org - An Open Source Firewall Solution # # Copyright (C) - IPFire Development Team # ############################################################################### name = docbook-dtds version = 1.0 release = 6 arch = noarch groups = Applications/Text url = http://www.oasis-open.org/docbook/ license = Copyright only summary = SGML and XML document type definitions for DocBook. 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. end sources = \ docbk30.zip \ docbk31.zip \ docbk40.zip \ docbk41.zip \ docbkx412.zip \ docbook-4.2.zip \ docbook-xml-4.2.zip \ docbook-4.3.zip \ docbook-xml-4.3.zip \ docbook-4.4.zip \ docbook-xml-4.4.zip \ docbook-4.5.zip \ docbook-xml-4.5.zip # Update directories at the scriptlets if there will be any changes. directories = \ 3.0-sgml \ 3.1-sgml \ 4.0-sgml \ 4.1-sgml \ 4.1.2-xml \ 4.2-sgml \ 4.2-xml \ 4.3-sgml \ 4.3-xml \ 4.4-sgml \ 4.4-xml \ 4.5-sgml \ 4.5-xml build requires dos2unix unzip>=6.0-3 end prepare # Define a bash function to extract the files function macro_extract() { mkdir -pv %{DIR_APP}/$2 cd %{DIR_APP}/$2 && unzip %{DIR_DL}/$1 } # Extract files macro_extract docbk30.zip 3.0-sgml macro_extract docbk31.zip 3.1-sgml macro_extract docbk40.zip 4.0-sgml macro_extract docbk41.zip 4.1-sgml macro_extract docbkx412.zip 4.1.2-xml macro_extract docbook-4.2.zip 4.2-sgml macro_extract docbook-xml-4.2.zip 4.2-xml macro_extract docbook-4.3.zip 4.3-sgml macro_extract docbook-xml-4.3.zip 4.3-xml macro_extract docbook-4.4.zip 4.4-sgml macro_extract docbook-xml-4.4.zip 4.4-xml macro_extract docbook-4.5.zip 4.5-sgml macro_extract docbook-xml-4.5.zip 4.5-xml # Convert all catalog files to unix format cd %{DIR_APP} && dos2unix */docbook.cat %{MACRO_PATCHES} sed -e's,\(NAMELEN\s\+\)44\(\s\*\)\?,\1256,' -i.namelen */docbook.dcl sed -i 's/\r//' */*.txt chown -R root:root . chmod -R a+rX,g-w,o-w . end build = # Nothing to do install # Create Symlinks. mkdir -pv %{BUILDROOT}/etc/sgml for fmt in sgml xml; do ln -svf $fmt-docbook-4.5.cat %{BUILDROOT}/etc/sgml/$fmt-docbook.cat done for dir in %{directories}; do fmt=${dir#*-}; ver=${dir%%-*} cd %{DIR_APP}/$dir DESTDIR=%{BUILDROOT}/usr/share/sgml/docbook/$fmt-dtd-$ver mkdir -pv $DESTDIR case $fmt in sgml) mkdir -pv $DESTDIR; install -v *.dcl $DESTDIR ;; xml) mkdir -pv $DESTDIR/ent; install -v ent/* $DESTDIR/ent ;; esac install -v *.dtd *.mod $DESTDIR install -v docbook.cat $DESTDIR/catalog touch %{BUILDROOT}/etc/sgml/${dir#*-}-docbook-$ver.cat done end end packages package %{name} prerequires coreutils libxml2 sed sgml-common end script postin # Install catalog files. for dir in %{directories}; do fmt=${dir#*-} ver=${dir%%-*} /usr/bin/xmlcatalog --sgml --noout --add /etc/sgml/${fmt}-docbook-${ver}.cat \ /usr/share/sgml/docbook/${fmt}-dtd-${ver}/catalog > /dev/null 2>/dev/null /usr/bin/xmlcatalog --sgml --noout --add /etc/sgml/${fmt}-docbook-${ver}.cat \ /usr/share/sgml/sgml-iso-entities-8879.1986/catalog > /dev/null 2>/dev/null done # Create XML catalog. for dir in %{directories}; do fmt=${dir#*-} ver=${dir%%-*} if [ $fmt = xml -a -w /usr/share/sgml/docbook/xmlcatalog ]; then while read f desc; do case $ver in 4.[45]) f={$f/-/} ;; esac /usr/bin/xmlcatalog --noout --add public "$desc" /usr/share/sgml/docbook/${fmt}-dtd-${ver}/${f} \ /etc/sgml/docbook/xmlcatalog /dev/null 2>/dev/null done < /dev/null 2>/dev/null done fi done sed -ni ' /xml-docbook/ H /xml-docbook/ !p $ { g s/^\n//p } ' /etc/sgml/catalog # Finally, make sure everything in /etc/sgml is readable! chmod a+r /etc/sgml/* end script postun # remove entries only on removal of package if [ "$1" = 0 ]; then 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" for dir in %{directories}; do fmt=${dir#*-} ver=${dir%%-*} ## SGML catalog # Update the centralized catalog corresponding to this version of the DTD /usr/bin/xmlcatalog --noout --sgml --del /etc/sgml/catalog /etc/sgml/$fmt-docbook-$ver.cat rm -f /etc/sgml/$fmt-docbook-$ver.cat ## XML catalog if [ $fmt = xml -a -w /usr/share/sgml/docbook/xmlcatalog ]; then for f in $entities; do case $ver in 4.[45]) f=${f/-/} ;; esac /usr/bin/xmlcatalog --noout --del /usr/share/sgml/docbook/$fmt-dtd-$ver/$f /usr/share/sgml/docbook/xmlcatalog done /usr/bin/xmlcatalog --noout --del /usr/share/sgml/docbook/$fmt-dtd-$ver /usr/share/sgml/docbook/xmlcatalog fi done # See the comment attached to this command in the postin scriptlet. sed -ni ' /xml-docbook/ H /xml-docbook/ !p $ { g s/^\n//p } ' /etc/sgml/catalog fi end end end