Initial commit
[profile/ivi/docbook-dtds.git] / packaging / docbook-dtds.spec
1 %define openjadever 1.3.2
2 %define version_list "{3,4}.{0,1}-sgml 4.1.2-xml 4.{2,3,4,5}-{sgml,xml}"
3
4 Name: docbook-dtds
5 Version: 1.0
6 Release: 48
7 Group: Applications/Text
8
9 Summary: SGML and XML document type definitions for DocBook
10
11 License: Freely redistributable without restriction
12 URL: http://www.oasis-open.org/docbook/
13 Source0: %{name}-%{version}.tar.bz2
14 BuildArch: noarch
15 Requires(post): libxml2 >= 2.4.8
16 Requires(post): /bin/chmod
17 Requires(postun): libxml2 >= 2.4.8
18 Requires: sgml-common >= 0.6.3
19 Requires: xml-common >= 0.6.3
20
21 Provides: docbook-dtd-xml = %{version}-%{release}
22 Provides: docbook-dtd-sgml = %{version}-%{release}
23 Provides: docbook-dtd30-sgml = %{version}-%{release}
24 Provides: docbook-dtd31-sgml = %{version}-%{release}
25 Provides: docbook-dtd40-sgml = %{version}-%{release}
26 Provides: docbook-dtd41-sgml = %{version}-%{release}
27 Provides: docbook-dtd412-xml = %{version}-%{release}
28 Provides: docbook-dtd42-sgml = %{version}-%{release}
29 Provides: docbook-dtd42-xml = %{version}-%{release}
30 Provides: docbook-dtd43-sgml = %{version}-%{release}
31 Provides: docbook-dtd43-xml = %{version}-%{release}
32 Provides: docbook-dtd44-sgml = %{version}-%{release}
33 Provides: docbook-dtd44-xml = %{version}-%{release}
34 Provides: docbook-dtd45-sgml = %{version}-%{release}
35 Provides: docbook-dtd45-xml = %{version}-%{release}
36
37
38 %description
39 The DocBook Document Type Definition (DTD) describes the syntax of
40 technical documentation texts (articles, books and manual pages).
41 This syntax is XML-compliant and is developed by the OASIS consortium.
42 This package contains SGML and XML versions of the DocBook DTD.
43
44
45 %prep
46 %setup -q
47
48 if [ `id -u` -eq 0 ]; then
49   chown -R root:root .
50   chmod -R a+rX,g-w,o-w .
51 fi
52
53
54 %build
55
56
57 %install
58
59
60 # Symlinks
61 mkdir -p %{buildroot}/etc/sgml
62 for fmt in sgml xml; do
63   ln -s $fmt-docbook-4.5-%{version}-%{release}.cat \
64      %{buildroot}/etc/sgml/$fmt-docbook.cat
65 done
66
67 eval set %{version_list}
68 for dir
69 do
70   cd $dir
71   fmt=${dir#*-} vvr=${dir%%-*}-%{version}-%{release}
72   DESTDIR=%{buildroot}/usr/share/sgml/docbook/$fmt-dtd-$vvr
73   case $fmt in
74     sgml)   mkdir -p $DESTDIR ; install *.dcl $DESTDIR ;;
75     xml)    mkdir -p $DESTDIR/ent ; install ent/* $DESTDIR/ent ;;
76   esac
77   install *.dtd *.mod $DESTDIR
78   install docbook.cat $DESTDIR/catalog
79   cd ..
80   # File for %%ghost
81   touch %{buildroot}/etc/sgml/$fmt-docbook-$vvr.cat
82 done
83
84
85
86
87 %post
88 catcmd='/usr/bin/xmlcatalog --noout'
89 xmlcatalog=/usr/share/sgml/docbook/xmlcatalog
90
91 ## Clean up pre-docbook-dtds mess caused by broken trigger.
92 for v in 3.0 3.1 4.0 4.1 4.2
93 do
94   if [ -f /etc/sgml/sgml-docbook-$v.cat ]
95   then
96     $catcmd --sgml --del /etc/sgml/sgml-docbook-$v.cat \
97       /usr/share/sgml/openjade-1.3.1/catalog 2>/dev/null
98   fi
99 done
100
101 # The STYLESHEETS/catalog command is for the case in which the style sheets
102 # were installed after another DTD but before this DTD
103 for STYLESHEETS in /usr/share/sgml/docbook/dsssl-stylesheets-*; do : ; done
104 case $STYLESHEETS in
105   *-"*") STYLESHEETS= ;;
106 esac
107 eval set %{version_list}
108 for dir
109 do
110   fmt=${dir#*-} ver=${dir%%-*} vvr=$ver-%{version}-%{release}
111   sgmldir=/usr/share/sgml/docbook/$fmt-dtd-$vvr
112   ## SGML catalog
113   # Update the centralized catalog corresponding to this version of the DTD
114   for cat_dir in /usr/share/sgml/sgml-iso-entities-8879.1986 $sgmldir $STYLESHEETS; do
115     $catcmd --sgml --add /etc/sgml/$fmt-docbook-$vvr.cat $cat_dir/catalog
116   done
117   ## XML catalog
118   if [ $fmt = xml -a -w $xmlcatalog ]; then
119     while read f desc; do
120       case $ver in 4.[45]) f=${f/-/} ;; esac
121       $catcmd --add public "$desc" $sgmldir/$f $xmlcatalog
122     done <<ENDENT
123       ent/iso-pub.ent   ISO 8879:1986//ENTITIES Publishing//EN
124       ent/iso-grk1.ent  ISO 8879:1986//ENTITIES Greek Letters//EN
125       dbpoolx.mod       -//OASIS//ELEMENTS DocBook XML Information Pool V$ver//EN
126       ent/iso-box.ent   ISO 8879:1986//ENTITIES Box and Line Drawing//EN
127       docbookx.dtd      -//OASIS//DTD DocBook XML V$ver//EN
128       ent/iso-grk3.ent  ISO 8879:1986//ENTITIES Greek Symbols//EN
129       ent/iso-amsn.ent  ISO 8879:1986//ENTITIES Added Math Symbols: Negated Relations//EN
130       ent/iso-num.ent   ISO 8879:1986//ENTITIES Numeric and Special Graphic//EN
131       dbcentx.mod       -//OASIS//ENTITIES DocBook XML Character Entities V$ver//EN
132       ent/iso-grk4.ent  ISO 8879:1986//ENTITIES Alternative Greek Symbols//EN
133       dbnotnx.mod       -//OASIS//ENTITIES DocBook XML Notations V$ver//EN
134       ent/iso-dia.ent   ISO 8879:1986//ENTITIES Diacritical Marks//EN
135       ent/iso-grk2.ent  ISO 8879:1986//ENTITIES Monotoniko Greek//EN
136       dbgenent.mod      -//OASIS//ENTITIES DocBook XML Additional General Entities V$ver//EN
137       dbhierx.mod       -//OASIS//ELEMENTS DocBook XML Document Hierarchy V$ver//EN
138       ent/iso-amsa.ent  ISO 8879:1986//ENTITIES Added Math Symbols: Arrow Relations//EN
139       ent/iso-amso.ent  ISO 8879:1986//ENTITIES Added Math Symbols: Ordinary//EN
140       ent/iso-cyr1.ent  ISO 8879:1986//ENTITIES Russian Cyrillic//EN
141       ent/iso-tech.ent  ISO 8879:1986//ENTITIES General Technical//EN
142       ent/iso-amsc.ent  ISO 8879:1986//ENTITIES Added Math Symbols: Delimiters//EN
143       soextblx.dtd      -//OASIS//DTD XML Exchange Table Model 19990315//EN
144       calstblx.dtd      -//OASIS//DTD DocBook XML CALS Table Model V$ver//EN
145       ent/iso-lat1.ent  ISO 8879:1986//ENTITIES Added Latin 1//EN
146       ent/iso-amsb.ent  ISO 8879:1986//ENTITIES Added Math Symbols: Binary Operators//EN
147       ent/iso-lat2.ent  ISO 8879:1986//ENTITIES Added Latin 2//EN
148       ent/iso-amsr.ent  ISO 8879:1986//ENTITIES Added Math Symbols: Relations//EN
149       ent/iso-cyr2.ent  ISO 8879:1986//ENTITIES Non-Russian Cyrillic//EN
150 ENDENT
151     for f in System URI; do
152       $catcmd --add rewrite$f "http://www.oasis-open.org/docbook/xml/$ver" \
153         $sgmldir $xmlcatalog
154     done
155   fi
156 done
157
158 # Historic versions of this scriptlet contained the following comment:
159 # <quote>
160 # Fix up SGML super catalog so that there isn't an XML DTD before an
161 # SGML one.  We need to do this (*sigh*) because xmlcatalog messes up
162 # the order of the lines, and SGML tools don't like to see XML things
163 # they aren't expecting.
164 # </quote>
165 # But the code that followed just found the first XML DTD and the first
166 # SGML DTD, swappinmg these two lines if the XML one preceded.
167 # But that only ensures that there is an SGML DTD before all XML ones.
168 # No one complained, so either this was enough, or the buggy SGML tools
169 # are long dead, or their users do not use bugzilla.
170 # Anyway, the following code, introduced in 1.0-46, does better: it ensures
171 # that all XML DTDs are after all SGML ones, by moving them to the end.
172 sed -ni '
173   /xml-docbook/ H
174   /xml-docbook/ !p
175   $ {
176           g
177           s/^\n//p
178   }
179   ' /etc/sgml/catalog
180
181 # Finally, make sure everything in /etc/sgml is readable!
182 /bin/chmod a+r /etc/sgml/*
183
184 %postun
185 catcmd='/usr/bin/xmlcatalog --noout'
186 xmlcatalog=/usr/share/sgml/docbook/xmlcatalog
187 entities="
188 ent/iso-pub.ent
189 ent/iso-grk1.ent
190 dbpoolx.mod
191 ent/iso-box.ent
192 docbookx.dtd
193 ent/iso-grk3.ent
194 ent/iso-amsn.ent
195 ent/iso-num.ent
196 dbcentx.mod
197 ent/iso-grk4.ent
198 dbnotnx.mod
199 ent/iso-dia.ent
200 ent/iso-grk2.ent
201 dbgenent.mod
202 dbhierx.mod
203 ent/iso-amsa.ent
204 ent/iso-amso.ent
205 ent/iso-cyr1.ent
206 ent/iso-tech.ent
207 ent/iso-amsc.ent
208 soextblx.dtd
209 calstblx.dtd
210 ent/iso-lat1.ent
211 ent/iso-amsb.ent
212 ent/iso-lat2.ent
213 ent/iso-amsr.ent
214 ent/iso-cyr2.ent
215 "
216 eval set %{version_list}
217 for dir
218 do
219   fmt=${dir#*-} ver=${dir%%-*} vvr=$ver-%{version}-%{release}
220   sgmldir=/usr/share/sgml/docbook/$fmt-dtd-$vvr
221   ## SGML catalog
222   # Update the centralized catalog corresponding to this version of the DTD
223   $catcmd --sgml --del /etc/sgml/catalog /etc/sgml/$fmt-docbook-$vvr.cat
224   rm -f /etc/sgml/$fmt-docbook-$vvr.cat
225   ## XML catalog
226   if [ $fmt = xml -a -w $xmlcatalog ]; then
227     for f in $entities; do
228       case $ver in 4.[45]) f=${f/-/} ;; esac
229       $catcmd --del $sgmldir/$f $xmlcatalog
230     done
231     $catcmd --del $sgmldir $xmlcatalog
232   fi
233 done
234
235 # See the comment attached to this command in the %%post scriptlet.
236 sed -ni '
237   /xml-docbook/ H
238   /xml-docbook/ !p
239   $ {
240           g
241           s/^\n//p
242   }
243   ' /etc/sgml/catalog
244
245
246 %files
247 %defattr (0644,root,root,0755)
248 # in upstream tarballs there are a lot of files with 0755 permissions
249 # but they don't need to be; 0644 is enough for every file in tarball
250 %doc --parents 3.1-sgml/ChangeLog 4.1-sgml/ChangeLog */*.txt
251 %config(noreplace) /etc/sgml/sgml-docbook.cat
252 %config(noreplace) /etc/sgml/xml-docbook.cat
253 %{_datadir}/sgml/docbook/*ml-dtd-*-%{version}-%{release}
254 %ghost %config(noreplace) /etc/sgml/*ml-docbook-*-%{version}-%{release}.cat
255