7fafbef4e683026e414779f279ce86c8c27d8477
[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
14
15 Provides: docbook-dtd-xml = %{version}-%{release}
16 Provides: docbook-dtd-sgml = %{version}-%{release}
17 Provides: docbook-dtd30-sgml = %{version}-%{release}
18 Provides: docbook-dtd31-sgml = %{version}-%{release}
19 Provides: docbook-dtd40-sgml = %{version}-%{release}
20 Provides: docbook-dtd41-sgml = %{version}-%{release}
21 Provides: docbook-dtd412-xml = %{version}-%{release}
22 Provides: docbook-dtd42-sgml = %{version}-%{release}
23 Provides: docbook-dtd42-xml = %{version}-%{release}
24 Provides: docbook-dtd43-sgml = %{version}-%{release}
25 Provides: docbook-dtd43-xml = %{version}-%{release}
26 Provides: docbook-dtd44-sgml = %{version}-%{release}
27 Provides: docbook-dtd44-xml = %{version}-%{release}
28 Provides: docbook-dtd45-sgml = %{version}-%{release}
29 Provides: docbook-dtd45-xml = %{version}-%{release}
30
31 Requires(post): libxml2 >= 2.4.8
32 Requires(postun): libxml2 >= 2.4.8
33 # If upgrading, the old package's postun scriptlet may use install-catalog
34 # to remove its entries.  xmlcatalog (which this package uses) adds quotes
35 # to the catalog files, and install-catalog only handles this in 0.6.3-4 or
36 # later.
37 Requires(post): /bin/chmod
38 Requires: sgml-common >= 0.6.3-4
39 # We provide the directory layout expected by 0.6.3-5 or later of
40 # xml-common.  Earlier versions won't understand. Additionally
41 # require xml-common >= 0.6.3-24 to workaround issue with F9
42 # install+update and empty xmlcatalog
43 Requires: xml-common >= 0.6.3-24
44
45 BuildRoot: %{_tmppath}/%{name}-%{version}
46
47 BuildArch: noarch
48 Source0: http://www.oasis-open.org/docbook/sgml/3.0/docbk30.zip
49 Source1: http://www.oasis-open.org/docbook/sgml/3.1/docbk31.zip
50 Source2: http://www.oasis-open.org/docbook/sgml/4.0/docbk40.zip
51 Source3: http://www.oasis-open.org/docbook/sgml/4.1/docbk41.zip
52 Source4: http://www.oasis-open.org/docbook/xml/4.1.2/docbkx412.zip
53 Source5: http://www.oasis-open.org/docbook/sgml/4.2/docbook-4.2.zip
54 Source6: http://www.oasis-open.org/docbook/xml/4.2/docbook-xml-4.2.zip
55 Source7: http://www.docbook.org/sgml/4.3/docbook-4.3.zip
56 Source8: http://www.docbook.org/xml/4.3/docbook-xml-4.3.zip
57 Source9: http://www.docbook.org/sgml/4.4/docbook-4.4.zip
58 Source10: http://www.docbook.org/xml/4.4/docbook-xml-4.4.zip
59 Source11: http://www.docbook.org/sgml/4.5/docbook-4.5.zip
60 Source12: http://www.docbook.org/xml/4.5/docbook-xml-4.5.zip
61 Patch0: docbook-dtd30-sgml-1.0.catalog.patch
62 Patch1: docbook-dtd31-sgml-1.0.catalog.patch
63 Patch2: docbook-dtd40-sgml-1.0.catalog.patch
64 Patch3: docbook-dtd41-sgml-1.0.catalog.patch
65 Patch4: docbook-dtd42-sgml-1.0.catalog.patch
66 Patch5: docbook-4.2-euro.patch
67 Patch6: docbook-dtds-ents.patch
68 Patch7: docbook-sgml-systemrewrite.patch
69 Patch8: docbook-dtd412-entities.patch
70 BuildRequires: unzip
71
72 %description
73 The DocBook Document Type Definition (DTD) describes the syntax of
74 technical documentation texts (articles, books and manual pages).
75 This syntax is XML-compliant and is developed by the OASIS consortium.
76 This package contains SGML and XML versions of the DocBook DTD.
77
78
79 %prep
80 %setup -c -T
81 eval mkdir %{version_list}
82 # DocBook V3.0
83 cd 3.0-sgml
84 unzip %{SOURCE0}
85 patch -b docbook.cat %{PATCH0}
86 cd ..
87
88 # DocBook V3.1
89 cd 3.1-sgml
90 unzip %{SOURCE1}
91 patch -b docbook.cat %{PATCH1}
92 cd ..
93
94 # DocBook V4.0
95 cd 4.0-sgml
96 unzip %{SOURCE2}
97 patch -b docbook.cat %{PATCH2}
98 cd ..
99
100 # DocBook V4.1
101 cd 4.1-sgml
102 unzip %{SOURCE3}
103 patch -b docbook.cat %{PATCH3}
104 cd ..
105
106 # DocBook XML V4.1.2
107 cd 4.1.2-xml
108 unzip %{SOURCE4}
109 cd ..
110
111 # DocBook V4.2
112 cd 4.2-sgml
113 unzip %{SOURCE5}
114 patch -b docbook.cat %{PATCH4}
115 cd ..
116
117 # DocBook XML V4.2
118 cd 4.2-xml
119 unzip %{SOURCE6}
120 cd ..
121
122 # DocBook V4.3
123 cd 4.3-sgml
124 unzip %{SOURCE7}
125 cd ..
126
127 # DocBook XML V4.3
128 cd 4.3-xml
129 unzip %{SOURCE8}
130 cd ..
131
132 # DocBook V4.4
133 cd 4.4-sgml
134 unzip %{SOURCE9}
135 cd ..
136
137 # DocBook XML V4.4
138 cd 4.4-xml
139 unzip %{SOURCE10}
140 cd ..
141
142 # DocBook v4.5
143 cd 4.5-sgml
144 unzip %{SOURCE11}
145 cd ..
146
147 # DocBook XML v4.5
148 cd 4.5-xml
149 unzip %{SOURCE12}
150 cd ..
151
152 # Fix € in SGML.
153 %patch5 -p1
154
155 # Fix ISO entities in 4.3/4.4/4.5 SGML
156 %patch6 -p1
157
158 # Rewrite SYSTEM to use local catalog instead web ones (#478680)
159 %patch7 -p1
160
161 # Add XML to the end of public identificators of 4.1.2 XML entities
162 %patch8 -p1
163
164 # Increase NAMELEN (bug #36058, bug #159382).
165 sed -e's,\(NAMELEN\s\+\)44\(\s\*\)\?,\1256,' -i.namelen */docbook.dcl
166
167 # fix of \r\n issue from rpmlint
168 sed -i 's/\r//' */*.txt
169
170
171 if [ `id -u` -eq 0 ]; then
172   chown -R root:root .
173   chmod -R a+rX,g-w,o-w .
174 fi
175
176
177 %build
178
179
180 %install
181 rm -rf $RPM_BUILD_ROOT
182
183 # Symlinks
184 mkdir -p $RPM_BUILD_ROOT/etc/sgml
185 for fmt in sgml xml; do
186   ln -s $fmt-docbook-4.5-%{version}-%{release}.cat \
187      $RPM_BUILD_ROOT/etc/sgml/$fmt-docbook.cat
188 done
189
190 eval set %{version_list}
191 for dir
192 do
193   cd $dir
194   fmt=${dir#*-} vvr=${dir%%-*}-%{version}-%{release}
195   DESTDIR=$RPM_BUILD_ROOT/usr/share/sgml/docbook/$fmt-dtd-$vvr
196   case $fmt in
197     sgml)   mkdir -p $DESTDIR ; install *.dcl $DESTDIR ;;
198     xml)    mkdir -p $DESTDIR/ent ; install ent/* $DESTDIR/ent ;;
199   esac
200   install *.dtd *.mod $DESTDIR
201   install docbook.cat $DESTDIR/catalog
202   cd ..
203   # File for %%ghost
204   touch $RPM_BUILD_ROOT/etc/sgml/$fmt-docbook-$vvr.cat
205 done
206
207
208 %clean
209 rm -rf $RPM_BUILD_ROOT
210
211
212 %files
213 %defattr (0644,root,root,0755)
214 #in upstream tarballs there is a lot of files with 0755 permissions
215 #but they don't need to be, 0644 is enough for every file in tarball
216 %doc --parents 3.1-sgml/ChangeLog 4.1-sgml/ChangeLog */*.txt
217 %config(noreplace) /etc/sgml/sgml-docbook.cat
218 %config(noreplace) /etc/sgml/xml-docbook.cat
219 /usr/share/sgml/docbook/*ml-dtd-*-%{version}-%{release}
220 %ghost %config(noreplace) /etc/sgml/*ml-docbook-*-%{version}-%{release}.cat
221
222
223 %post
224 catcmd='/usr/bin/xmlcatalog --noout'
225 xmlcatalog=/usr/share/sgml/docbook/xmlcatalog
226
227 ## Clean up pre-docbook-dtds mess caused by broken trigger.
228 for v in 3.0 3.1 4.0 4.1 4.2
229 do
230   if [ -f /etc/sgml/sgml-docbook-$v.cat ]
231   then
232     $catcmd --sgml --del /etc/sgml/sgml-docbook-$v.cat \
233       /usr/share/sgml/openjade-1.3.1/catalog 2>/dev/null
234   fi
235 done
236
237 # The STYLESHEETS/catalog command is for the case in which the style sheets
238 # were installed after another DTD but before this DTD
239 for STYLESHEETS in /usr/share/sgml/docbook/dsssl-stylesheets-*; do : ; done
240 case $STYLESHEETS in
241   *-"*") STYLESHEETS= ;;
242 esac
243 eval set %{version_list}
244 for dir
245 do
246   fmt=${dir#*-} ver=${dir%%-*} vvr=$ver-%{version}-%{release}
247   sgmldir=/usr/share/sgml/docbook/$fmt-dtd-$vvr
248   ## SGML catalog
249   # Update the centralized catalog corresponding to this version of the DTD
250   for cat_dir in /usr/share/sgml/sgml-iso-entities-8879.1986 $sgmldir $STYLESHEETS; do
251     $catcmd --sgml --add /etc/sgml/$fmt-docbook-$vvr.cat $cat_dir/catalog
252   done
253   ## XML catalog
254   if [ $fmt = xml -a -w $xmlcatalog ]; then
255     while read f desc; do
256       case $ver in 4.[45]) f=${f/-/} ;; esac
257       $catcmd --add public "$desc" $sgmldir/$f $xmlcatalog
258     done <<ENDENT
259       ent/iso-pub.ent   ISO 8879:1986//ENTITIES Publishing//EN
260       ent/iso-grk1.ent  ISO 8879:1986//ENTITIES Greek Letters//EN
261       dbpoolx.mod       -//OASIS//ELEMENTS DocBook XML Information Pool V$ver//EN
262       ent/iso-box.ent   ISO 8879:1986//ENTITIES Box and Line Drawing//EN
263       docbookx.dtd      -//OASIS//DTD DocBook XML V$ver//EN
264       ent/iso-grk3.ent  ISO 8879:1986//ENTITIES Greek Symbols//EN
265       ent/iso-amsn.ent  ISO 8879:1986//ENTITIES Added Math Symbols: Negated Relations//EN
266       ent/iso-num.ent   ISO 8879:1986//ENTITIES Numeric and Special Graphic//EN
267       dbcentx.mod       -//OASIS//ENTITIES DocBook XML Character Entities V$ver//EN
268       ent/iso-grk4.ent  ISO 8879:1986//ENTITIES Alternative Greek Symbols//EN
269       dbnotnx.mod       -//OASIS//ENTITIES DocBook XML Notations V$ver//EN
270       ent/iso-dia.ent   ISO 8879:1986//ENTITIES Diacritical Marks//EN
271       ent/iso-grk2.ent  ISO 8879:1986//ENTITIES Monotoniko Greek//EN
272       dbgenent.mod      -//OASIS//ENTITIES DocBook XML Additional General Entities V$ver//EN
273       dbhierx.mod       -//OASIS//ELEMENTS DocBook XML Document Hierarchy V$ver//EN
274       ent/iso-amsa.ent  ISO 8879:1986//ENTITIES Added Math Symbols: Arrow Relations//EN
275       ent/iso-amso.ent  ISO 8879:1986//ENTITIES Added Math Symbols: Ordinary//EN
276       ent/iso-cyr1.ent  ISO 8879:1986//ENTITIES Russian Cyrillic//EN
277       ent/iso-tech.ent  ISO 8879:1986//ENTITIES General Technical//EN
278       ent/iso-amsc.ent  ISO 8879:1986//ENTITIES Added Math Symbols: Delimiters//EN
279       soextblx.dtd      -//OASIS//DTD XML Exchange Table Model 19990315//EN
280       calstblx.dtd      -//OASIS//DTD DocBook XML CALS Table Model V$ver//EN
281       ent/iso-lat1.ent  ISO 8879:1986//ENTITIES Added Latin 1//EN
282       ent/iso-amsb.ent  ISO 8879:1986//ENTITIES Added Math Symbols: Binary Operators//EN
283       ent/iso-lat2.ent  ISO 8879:1986//ENTITIES Added Latin 2//EN
284       ent/iso-amsr.ent  ISO 8879:1986//ENTITIES Added Math Symbols: Relations//EN
285       ent/iso-cyr2.ent  ISO 8879:1986//ENTITIES Non-Russian Cyrillic//EN
286 ENDENT
287     for f in System URI; do
288       $catcmd --add rewrite$f "http://www.oasis-open.org/docbook/xml/$ver" \
289         $sgmldir $xmlcatalog
290     done
291   fi
292 done
293
294 # Historic versions of this scriptlet contained the following comment:
295 # <quote>
296 # Fix up SGML super catalog so that there isn't an XML DTD before an
297 # SGML one.  We need to do this (*sigh*) because xmlcatalog messes up
298 # the order of the lines, and SGML tools don't like to see XML things
299 # they aren't expecting.
300 # </quote>
301 # But the code that followed just found the first XML DTD and the first
302 # SGML DTD, swappinmg these two lines if the XML one preceded.
303 # But that only ensures that there is an SGML DTD before all XML ones.
304 # No one complained, so either this was enough, or the buggy SGML tools
305 # are long dead, or their users do not use bugzilla.
306 # Anyway, the following code, introduced in 1.0-46, does better: it ensures
307 # that all XML DTDs are after all SGML ones, by moving them to the end.
308 sed -ni '
309   /xml-docbook/ H
310   /xml-docbook/ !p
311   $ {
312           g
313           s/^\n//p
314   }
315   ' /etc/sgml/catalog
316
317 # Finally, make sure everything in /etc/sgml is readable!
318 /bin/chmod a+r /etc/sgml/*
319
320 %postun
321 catcmd='/usr/bin/xmlcatalog --noout'
322 xmlcatalog=/usr/share/sgml/docbook/xmlcatalog
323 entities="
324 ent/iso-pub.ent
325 ent/iso-grk1.ent
326 dbpoolx.mod
327 ent/iso-box.ent
328 docbookx.dtd
329 ent/iso-grk3.ent
330 ent/iso-amsn.ent
331 ent/iso-num.ent
332 dbcentx.mod
333 ent/iso-grk4.ent
334 dbnotnx.mod
335 ent/iso-dia.ent
336 ent/iso-grk2.ent
337 dbgenent.mod
338 dbhierx.mod
339 ent/iso-amsa.ent
340 ent/iso-amso.ent
341 ent/iso-cyr1.ent
342 ent/iso-tech.ent
343 ent/iso-amsc.ent
344 soextblx.dtd
345 calstblx.dtd
346 ent/iso-lat1.ent
347 ent/iso-amsb.ent
348 ent/iso-lat2.ent
349 ent/iso-amsr.ent
350 ent/iso-cyr2.ent
351 "
352 eval set %{version_list}
353 for dir
354 do
355   fmt=${dir#*-} ver=${dir%%-*} vvr=$ver-%{version}-%{release}
356   sgmldir=/usr/share/sgml/docbook/$fmt-dtd-$vvr
357   ## SGML catalog
358   # Update the centralized catalog corresponding to this version of the DTD
359   $catcmd --sgml --del /etc/sgml/catalog /etc/sgml/$fmt-docbook-$vvr.cat
360   rm -f /etc/sgml/$fmt-docbook-$vvr.cat
361   ## XML catalog
362   if [ $fmt = xml -a -w $xmlcatalog ]; then
363     for f in $entities; do
364       case $ver in 4.[45]) f=${f/-/} ;; esac
365       $catcmd --del $sgmldir/$f $xmlcatalog
366     done
367     $catcmd --del $sgmldir $xmlcatalog
368   fi
369 done
370
371 # See the comment attached to this command in the %%post scriptlet.
372 sed -ni '
373   /xml-docbook/ H
374   /xml-docbook/ !p
375   $ {
376           g
377           s/^\n//p
378   }
379   ' /etc/sgml/catalog
380
381 %triggerin -- openjade >= %{openjadever}
382 eval set %{version_list}
383 for dir
384 do
385   fmt=${dir#*-} ver=${dir%%-*} vvr=$ver-%{version}-%{release}
386   /usr/bin/xmlcatalog --sgml --noout --add /etc/sgml/$fmt-docbook-$vvr.cat \
387     /usr/share/sgml/openjade-%{openjadever}/catalog
388 done
389
390 %triggerun -- openjade >= %{openjadever}
391 [ $2 = 0 ] || exit 0
392 eval set %{version_list}
393 for dir
394 do
395   fmt=${dir#*-} ver=${dir%%-*} vvr=$ver-%{version}-%{release}
396   /usr/bin/xmlcatalog --sgml --noout --del /etc/sgml/$fmt-docbook-$vvr.cat \
397     /usr/share/sgml/openjade-%{openjadever}/catalog
398 done
399