docbook-dtds/docbook-dtds.spec

417 lines
15 KiB
RPMSpec
Raw Permalink Normal View History

# Heavily based on Fedora package
%global openjadever 1.3.2
%{!?_pkgdocdir: %global _pkgdocdir %{_docdir}/%{name}-%{version}}
Name: docbook-dtds
Epoch: 1
Version: 1.0
Release: 2mamba
Group: Applications/Publishing
Summary: SGML and XML document type definitions for DocBook.
License: Distributable
URL: http://www.oasis-open.org/docbook/
Distribution: openmamba
Vendor: openmamba
Packager: Silvan Calarco <silvan.calarco@mambasoft.it>
Source0: http://www.oasis-open.org/docbook/sgml/3.0/docbk30.zip
Source1: http://www.oasis-open.org/docbook/sgml/3.1/docbk31.zip
Source2: http://www.oasis-open.org/docbook/sgml/4.0/docbk40.zip
Source3: http://www.oasis-open.org/docbook/sgml/4.1/docbk41.zip
Source4: http://www.oasis-open.org/docbook/xml/4.1.2/docbkx412.zip
Source5: http://www.oasis-open.org/docbook/sgml/4.2/docbook-4.2.zip
Source6: http://www.oasis-open.org/docbook/xml/4.2/docbook-xml-4.2.zip
Source7: http://www.oasis-open.org/docbook/sgml/4.3/docbook-4.3.zip
Source8: http://www.oasis-open.org/docbook/xml/4.3/docbook-xml-4.3.zip
Source9: http://www.oasis-open.org/docbook/sgml/4.4/docbook-4.4.zip
Source10: http://www.oasis-open.org/docbook/xml/4.4/docbook-xml-4.4.zip
Source11: http://www.oasis-open.org/docbook/sgml/4.5/docbook-4.5.zip
Source12: http://www.oasis-open.org/docbook/xml/4.5/docbook-xml-4.5.zip
Source13: http://www.docbook.org/rng/4.2/docbook-rng-4.2.zip
Source14: http://www.docbook.org/rng/4.3/docbook-rng-4.3.zip
Source15: http://www.docbook.org/rng/4.4/docbook-rng-4.4.zip
#compressed from http://www.docbook.org/rng/4.5/ upstream archive unavailable
Source16: docbook-rng-4.5.zip
Source17: http://www.docbook.org/xsd/4.2/docbook-xsd-4.2.zip
Source18: http://www.docbook.org/xsd/4.3/docbook-xsd-4.3.zip
Source19: http://www.docbook.org/xsd/4.4/docbook-xsd-4.4.zip
#compressed from http://www.docbook.org/xsd/4.5/ upstream archive unavailable
Source20: docbook-xsd-4.5.zip
Patch0: docbook-dtd30-sgml-1.0.catalog.patch
Patch1: docbook-dtd31-sgml-1.0.catalog.patch
Patch2: docbook-dtd40-sgml-1.0.catalog.patch
Patch3: docbook-dtd41-sgml-1.0.catalog.patch
Patch4: docbook-dtd42-sgml-1.0.catalog.patch
Patch5: docbook-4.2-euro.patch
#Fix ISO entities in 4.3/4.4/4.5 SGML
Patch6: docbook-dtds-ents.patch
#Use system rewrite for web URL's in sgml catalogs to prevent reading from the network(#478680)
Patch7: docbook-sgml-systemrewrite.patch
#use XML at the end of public identificators of XML 4.1.2 ISO entities
Patch8: docbook-dtd412-entities.patch
## AUTOBUILDREQ-BEGIN
## AUTOBUILDREQ-END
BuildRequires: unzip >= 5.50
Obsoletes: docbook < 1:1.0
Provides: docbook
Provides: docbook-dtd-xml docbook-dtd-sgml
Provides: docbook-dtd30-sgml docbook-dtd31-sgml
Provides: docbook-dtd40-sgml docbook-dtd41-sgml
Provides: docbook-dtd412-xml
Provides: docbook-dtd42-sgml docbook-dtd42-xml
Provides: docbook-dtd43-sgml docbook-dtd43-xml
Provides: docbook-dtd44-sgml docbook-dtd44-xml
Provides: docbook-dtd45-sgml docbook-dtd45-xml
Provides: docbook-dtd50-sgml docbook-dtd50-xml
Requires(post): libxml2-utils >= 2.6.17
Requires(post): libxml2 >= 2.6.17
Requires: sgml-common
Requires: xml-common
BuildArch: noarch
%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 -c -T
function prep_docbook() {
install -d $1
( cd $1
unzip $2
[ "$3" ] && patch -b docbook.cat $3 || : )
}
prep_docbook 3.0-sgml %{SOURCE0} %{PATCH0}
prep_docbook 3.1-sgml %{SOURCE1} %{PATCH1}
prep_docbook 4.0-sgml %{SOURCE2} %{PATCH2}
prep_docbook 4.1-sgml %{SOURCE3} %{PATCH3}
prep_docbook 4.1.2-xml %{SOURCE4}
prep_docbook 4.2-sgml %{SOURCE5} %{PATCH4}
prep_docbook 4.2-xml %{SOURCE6}
prep_docbook 4.3-sgml %{SOURCE7}
prep_docbook 4.3-xml %{SOURCE8}
prep_docbook 4.4-sgml %{SOURCE9}
prep_docbook 4.4-xml %{SOURCE10}
prep_docbook 4.5-sgml %{SOURCE11}
prep_docbook 4.5-xml %{SOURCE12}
# Docbook RNG
prep_docbook 4.2-rng %{SOURCE13}
prep_docbook 4.3-rng %{SOURCE14}
prep_docbook 4.4-rng %{SOURCE15}
prep_docbook 4.5-rng %{SOURCE16}
# Docbook XSD
prep_docbook 4.2-xsd %{SOURCE17}
prep_docbook 4.3-xsd %{SOURCE18}
prep_docbook 4.4-xsd %{SOURCE19}
prep_docbook 4.5-xsd %{SOURCE20}
# Fix € in SGML.
%patch5 -p1
# Fix ISO entities in 4.3/4.4/4.5 SGML
%patch6 -p1
# Rewrite SYSTEM to use local catalog instead web ones (#478680)
%patch7 -p1
# Add XML to the end of public identificators of 4.1.2 XML entities
%patch8 -p1
# Increase NAMELEN (bug #36058, bug #159382).
sed -e's,\(NAMELEN\s\+\)44\(\s\*\)\?,\1256,' -i.namelen */docbook.dcl
# fix of \r\n issue from rpmlint
sed -i 's/\r//' */*.txt
%build
%install
[ "%{buildroot}" != / ] && rm -rf "%{buildroot}"
# Symlinks
mkdir -p %{buildroot}/etc/sgml
for fmt in sgml xml; do
ln -s $fmt-docbook-4.5.cat \
%{buildroot}/etc/sgml/$fmt-docbook.cat
done
for dir in {3,4}.{0,1}-sgml 4.1.2-xml 4.{2,3,4,5}-{sgml,xml} 4.{2,3,4,5}-rng 4.{2,3,4,5}-xsd
do
cd $dir
fmt=${dir#*-} ver=${dir%%-*}
case $fmt in
sgml) DESTDIR=%{buildroot}/usr/share/sgml/docbook/$fmt-dtd-$ver ;;
xml) DESTDIR=%{buildroot}/usr/share/sgml/docbook/$fmt-dtd-$ver ;;
rng) DESTDIR=%{buildroot}/usr/share/sgml/docbook/$fmt-$ver ;;
xsd) DESTDIR=%{buildroot}/usr/share/sgml/docbook/$fmt-$ver ;;
esac
case $fmt in
sgml) mkdir -p $DESTDIR ; install *.dcl $DESTDIR ;;
xml) mkdir -p $DESTDIR/ent ; install ent/* $DESTDIR/ent ;;
rng) mkdir -p $DESTDIR ; install *.r* $DESTDIR ;;
xsd) mkdir -p $DESTDIR ; install *.xsd $DESTDIR;;
esac
cd ..
done
for dir in {3,4}.{0,1}-sgml 4.1.2-xml 4.{2,3,4,5}-{sgml,xml}
do
cd $dir
fmt=${dir#*-} ver=${dir%%-*}
DESTDIR=%{buildroot}/usr/share/sgml/docbook/$fmt-dtd-$ver
install *.dtd *.mod $DESTDIR
install docbook.cat $DESTDIR/catalog
cd ..
# File for %%ghost
touch %{buildroot}/etc/sgml/$fmt-docbook-$ver.cat
done
# Compatibility symlinks
install -d -m0755 %{buildroot}%{_datadir}/xml/docbook/schema/dtd
for dir in 4.1.2 4.{2,3,4,5}; do
ln -s ../../../../sgml/docbook/xml-dtd-$dir %{buildroot}%{_datadir}/xml/docbook/schema/dtd/$dir
done
#workaround the missing support for --parents hack in rpm 4.11+
mkdir -p %{buildroot}%{_pkgdocdir}
for i in */*.txt */ChangeLog */README
do
cp -pr --parents $i %{buildroot}%{_pkgdocdir}
done
%clean
[ "%{buildroot}" != / ] && rm -rf "%{buildroot}"
# disable executable requirement script because the script contains a function
%define __scriptlet_requires /bin/true
%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
for dir in {3,4}.{0,1}-sgml 4.1.2-xml 4.{2,3,4,5}-{sgml,xml}
do
fmt=${dir#*-} ver=${dir%%-*}
sgmldir=/usr/share/sgml/docbook/$fmt-dtd-$ver
## 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-$ver.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 <<ENDENT
ent/iso-pub.ent ISO 8879:1986//ENTITIES Publishing//EN
ent/iso-grk1.ent ISO 8879:1986//ENTITIES Greek Letters//EN
dbpoolx.mod -//OASIS//ELEMENTS DocBook XML Information Pool V$ver//EN
ent/iso-box.ent ISO 8879:1986//ENTITIES Box and Line Drawing//EN
docbookx.dtd -//OASIS//DTD DocBook XML V$ver//EN
ent/iso-grk3.ent ISO 8879:1986//ENTITIES Greek Symbols//EN
ent/iso-amsn.ent ISO 8879:1986//ENTITIES Added Math Symbols: Negated Relations//EN
ent/iso-num.ent ISO 8879:1986//ENTITIES Numeric and Special Graphic//EN
dbcentx.mod -//OASIS//ENTITIES DocBook XML Character Entities V$ver//EN
ent/iso-grk4.ent ISO 8879:1986//ENTITIES Alternative Greek Symbols//EN
dbnotnx.mod -//OASIS//ENTITIES DocBook XML Notations V$ver//EN
ent/iso-dia.ent ISO 8879:1986//ENTITIES Diacritical Marks//EN
ent/iso-grk2.ent ISO 8879:1986//ENTITIES Monotoniko Greek//EN
dbgenent.mod -//OASIS//ENTITIES DocBook XML Additional General Entities V$ver//EN
dbhierx.mod -//OASIS//ELEMENTS DocBook XML Document Hierarchy V$ver//EN
ent/iso-amsa.ent ISO 8879:1986//ENTITIES Added Math Symbols: Arrow Relations//EN
ent/iso-amso.ent ISO 8879:1986//ENTITIES Added Math Symbols: Ordinary//EN
ent/iso-cyr1.ent ISO 8879:1986//ENTITIES Russian Cyrillic//EN
ent/iso-tech.ent ISO 8879:1986//ENTITIES General Technical//EN
ent/iso-amsc.ent ISO 8879:1986//ENTITIES Added Math Symbols: Delimiters//EN
soextblx.dtd -//OASIS//DTD XML Exchange Table Model 19990315//EN
calstblx.dtd -//OASIS//DTD DocBook XML CALS Table Model V$ver//EN
ent/iso-lat1.ent ISO 8879:1986//ENTITIES Added Latin 1//EN
ent/iso-amsb.ent ISO 8879:1986//ENTITIES Added Math Symbols: Binary Operators//EN
ent/iso-lat2.ent ISO 8879:1986//ENTITIES Added Latin 2//EN
ent/iso-amsr.ent ISO 8879:1986//ENTITIES Added Math Symbols: Relations//EN
ent/iso-cyr2.ent ISO 8879:1986//ENTITIES Non-Russian Cyrillic//EN
ENDENT
for f in System URI; do
$catcmd --add rewrite$f "http://www.oasis-open.org/docbook/xml/$ver" \
$sgmldir $xmlcatalog
done
fi
done
# Historic versions of this scriptlet contained the following comment:
# <quote>
# 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.
# </quote>
# 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!
%{_bindir}/chmod a+r /etc/sgml/*
%postun
# remove entries only on removal of package
if [ "$1" = 0 ]; then
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
"
for dir in {3,4}.{0,1}-sgml 4.1.2-xml 4.{2,3,4,5}-{sgml,xml}
do
fmt=${dir#*-} ver=${dir%%-*}
sgmldir=/usr/share/sgml/docbook/$fmt-dtd-$ver
## SGML catalog
# Update the centralized catalog corresponding to this version of the DTD
$catcmd --sgml --del /etc/sgml/catalog /etc/sgml/$fmt-docbook-$ver.cat >/dev/null
rm -f /etc/sgml/$fmt-docbook-$ver.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 >/dev/null
done
$catcmd --del $sgmldir $xmlcatalog >/dev/null
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
fi
%triggerin -- openjade >= %{openjadever}
for dir in {3,4}.{0,1}-sgml 4.1.2-xml 4.{2,3,4,5}-{sgml,xml}
do
fmt=${dir#*-} ver=${dir%%-*}
/usr/bin/xmlcatalog --sgml --noout --add /etc/sgml/$fmt-docbook-$ver.cat \
/usr/share/sgml/openjade-%{openjadever}/catalog
done
%triggerun -- openjade >= %{openjadever}
[ $2 = 0 ] || exit 0
for dir in {3,4}.{0,1}-sgml 4.1.2-xml 4.{2,3,4,5}-{sgml,xml}
do
fmt=${dir#*-} ver=${dir%%-*}
/usr/bin/xmlcatalog --sgml --noout --del /etc/sgml/$fmt-docbook-$ver.cat \
/usr/share/sgml/openjade-%{openjadever}/catalog
done
%files
%defattr (-,root,root)
%config(noreplace) /etc/sgml/*ml-docbook.cat
%ghost %config(noreplace) /etc/sgml/*ml-docbook-*.cat
%{_datadir}/sgml/docbook/*ml-dtd-*
%{_datadir}/sgml/docbook/rng-*
%{_datadir}/sgml/docbook/xsd-*
%{_datadir}/xml/docbook/schema/dtd/*
%{_pkgdocdir}
%changelog
* Thu Jun 10 2021 Silvan Calarco <silvan.calarco@mambasoft.it> 1.0-2mamba
- restore compatibility symlinks in %share/xml/docbook/schema/
* Wed Jun 02 2021 Silvan Calarco <silvan.calarco@mambasoft.it> 1.0-1mamba
- update to 1.0
* Thu Dec 03 2020 Silvan Calarco <silvan.calarco@mambasoft.it> 20080923-4mamba
- remove missing .gml files from installed catalogs
* Thu Jul 18 2019 Silvan Calarco <silvan.calarco@mambasoft.it> 20080923-3mamba
- create compatibility symlinks to /usr/share/xml/docbook/schema/dtd
* Tue Aug 27 2013 Automatic Build System <autodist@mambasoft.it> 20080923-2mamba
- automatic rebuild by autodist
* Tue Sep 23 2008 Silvan Calarco <silvan.calarco@mambasoft.it> 20080923-1mamba
- update to 20080923
* Sun Oct 30 2005 Silvan Calarco <silvan.calarco@mambasoft.it> 1.0-6qilnx
- rebuilt as noarch package
* Wed Feb 23 2005 Silvan Calarco <silvan.calarco@mambasoft.it> 1.0-5qilnx
- fixed requirements on libxml2
* Wed Feb 23 2005 Silvan Calarco <silvan.calarco@mambasoft.it> 1.0-4qilnx
- fixed creation of xml catalog
* Tue Feb 22 2005 Silvan Calarco <silvan.calarco@mambasoft.it> 1.0-3qilnx
- added docbook 4.3 and 4.4
- specfile cleanups
* Fri Jan 21 2005 Silvan Calarco <silvan.calarco@mambasoft.it> 1.0-2qilnx
- rebuilt and moved for devel-contrib to devel repository
* Thu Sep 23 2004 Matteo Bernasconi <voyagernm@virgilio.it> 1.0-1qilnx
- first Build