]> git.ipfire.org Git - people/arne_f/ipfire-3.x.git/blame - docbook-dtds/docbook-dtds.nm
docbook-dtds: Also prerequires sed and coreutils for scriptlet.
[people/arne_f/ipfire-3.x.git] / docbook-dtds / docbook-dtds.nm
CommitLineData
ed1ec747
SS
1###############################################################################
2# IPFire.org - An Open Source Firewall Solution #
3# Copyright (C) - IPFire Development Team <info@ipfire.org> #
4###############################################################################
5
6name = docbook-dtds
7version = 1.0
c274af29 8release = 6
29ce5abf 9arch = noarch
ed1ec747
SS
10
11groups = Applications/Text
12url = http://www.oasis-open.org/docbook/
13license = Copyright only
14summary = SGML and XML document type definitions for DocBook.
15
16description
17 The DocBook Document Type Definition (DTD) describes the syntax of
18 technical documentation texts (articles, books and manual pages).
19 This syntax is XML-compliant and is developed by the OASIS consortium.
20 This package contains SGML and XML versions of the DocBook DTD.
21end
22
ed1ec747
SS
23sources = \
24 docbk30.zip \
25 docbk31.zip \
26 docbk40.zip \
27 docbk41.zip \
28 docbkx412.zip \
29 docbook-4.2.zip \
30 docbook-xml-4.2.zip \
31 docbook-4.3.zip \
32 docbook-xml-4.3.zip \
33 docbook-4.4.zip \
34 docbook-xml-4.4.zip \
35 docbook-4.5.zip \
36 docbook-xml-4.5.zip
37
38# Update directories at the scriptlets if there will be any changes.
39directories = \
40 3.0-sgml \
41 3.1-sgml \
42 4.0-sgml \
43 4.1-sgml \
44 4.1.2-xml \
45 4.2-sgml \
46 4.2-xml \
47 4.3-sgml \
48 4.3-xml \
49 4.4-sgml \
50 4.4-xml \
51 4.5-sgml \
52 4.5-xml
53
54build
55 requires
56 dos2unix
29ce5abf 57 unzip>=6.0-3
ed1ec747
SS
58 end
59
60 prepare
61 # Define a bash function to extract the files
62 function macro_extract()
63 {
64 mkdir -pv %{DIR_APP}/$2
65 cd %{DIR_APP}/$2 && unzip %{DIR_DL}/$1
66 }
67
68 # Extract files
69 macro_extract docbk30.zip 3.0-sgml
70 macro_extract docbk31.zip 3.1-sgml
71 macro_extract docbk40.zip 4.0-sgml
72 macro_extract docbk41.zip 4.1-sgml
73 macro_extract docbkx412.zip 4.1.2-xml
74 macro_extract docbook-4.2.zip 4.2-sgml
75 macro_extract docbook-xml-4.2.zip 4.2-xml
76 macro_extract docbook-4.3.zip 4.3-sgml
77 macro_extract docbook-xml-4.3.zip 4.3-xml
78 macro_extract docbook-4.4.zip 4.4-sgml
79 macro_extract docbook-xml-4.4.zip 4.4-xml
80 macro_extract docbook-4.5.zip 4.5-sgml
1f9bc2f0 81 macro_extract docbook-xml-4.5.zip 4.5-xml
ed1ec747
SS
82
83 # Convert all catalog files to unix format
84 cd %{DIR_APP} && dos2unix */docbook.cat
85
86 %{MACRO_PATCHES}
87
88 sed -e's,\(NAMELEN\s\+\)44\(\s\*\)\?,\1256,' -i.namelen */docbook.dcl
89 sed -i 's/\r//' */*.txt
90 chown -R root:root .
91 chmod -R a+rX,g-w,o-w .
92 end
93
94 build = # Nothing to do
95
96 install
29ce5abf 97 # Create Symlinks.
ed1ec747
SS
98 mkdir -pv %{BUILDROOT}/etc/sgml
99 for fmt in sgml xml; do
100 ln -svf $fmt-docbook-4.5.cat %{BUILDROOT}/etc/sgml/$fmt-docbook.cat
101 done
102
103 for dir in %{directories}; do
104 fmt=${dir#*-}; ver=${dir%%-*}
105 cd %{DIR_APP}/$dir
106 DESTDIR=%{BUILDROOT}/usr/share/sgml/docbook/$fmt-dtd-$ver
107 mkdir -pv $DESTDIR
108 case $fmt in
109 sgml) mkdir -pv $DESTDIR; install -v *.dcl $DESTDIR ;;
110 xml) mkdir -pv $DESTDIR/ent; install -v ent/* $DESTDIR/ent ;;
111 esac
112 install -v *.dtd *.mod $DESTDIR
113 install -v docbook.cat $DESTDIR/catalog
114 touch %{BUILDROOT}/etc/sgml/${dir#*-}-docbook-$ver.cat
115 done
116 end
117end
118
119packages
120 package %{name}
d9a3f5c7 121 prerequires
c274af29 122 coreutils
d9a3f5c7 123 libxml2
c274af29 124 sed
29ce5abf 125 sgml-common
d9a3f5c7 126 end
ed1ec747 127
29ce5abf
SS
128 script postin
129 # Install catalog files.
130 for dir in %{directories}; do
131 fmt=${dir#*-}
132 ver=${dir%%-*}
133 /usr/bin/xmlcatalog --sgml --noout --add /etc/sgml/${fmt}-docbook-${ver}.cat \
134 /usr/share/sgml/docbook/${fmt}-dtd-${ver}/catalog > /dev/null 2>/dev/null
135 /usr/bin/xmlcatalog --sgml --noout --add /etc/sgml/${fmt}-docbook-${ver}.cat \
136 /usr/share/sgml/sgml-iso-entities-8879.1986/catalog > /dev/null 2>/dev/null
ed1ec747
SS
137 done
138
72fd38a0
SS
139 # Create XML catalog.
140 for dir in %{directories}; do
141 fmt=${dir#*-}
142 ver=${dir%%-*}
ed1ec747 143
72fd38a0
SS
144 if [ $fmt = xml -a -w /usr/share/sgml/docbook/xmlcatalog ]; then
145 while read f desc; do
146 case $ver in 4.[45]) f={$f/-/} ;; esac
147 /usr/bin/xmlcatalog --noout --add public "$desc" /usr/share/sgml/docbook/${fmt}-dtd-${ver}/${f} \
148 /etc/sgml/docbook/xmlcatalog /dev/null 2>/dev/null
149 done <<ENDENT
150 ent/iso-pub.ent ISO 8879:1986//ENTITIES Publishing//EN
151 ent/iso-grk1.ent ISO 8879:1986//ENTITIES Greek Letters//EN
152 dbpoolx.mod -//OASIS//ELEMENTS DocBook XML Information Pool V${ver}//EN
153 ent/iso-box.ent ISO 8879:1986//ENTITIES Box and Line Drawing//EN
154 docbookx.dtd -//OASIS//DTD DocBook XML V${ver}//EN
155 ent/iso-grk3.ent ISO 8879:1986//ENTITIES Greek Symbols//EN
156 ent/iso-amsn.ent ISO 8879:1986//ENTITIES Added Math Symbols: Negated Relations//EN
157 ent/iso-num.ent ISO 8879:1986//ENTITIES Numeric and Special Graphic//EN
158 dbcentx.mod -//OASIS//ENTITIES DocBook XML Character Entities V${ver}//EN
159 ent/iso-grk4.ent ISO 8879:1986//ENTITIES Alternative Greek Symbols//EN
160 dbnotnx.mod -//OASIS//ENTITIES DocBook XML Notations V${ver}//EN
161 ent/iso-dia.ent ISO 8879:1986//ENTITIES Diacritical Marks//EN
162 ent/iso-grk2.ent ISO 8879:1986//ENTITIES Monotoniko Greek//EN
163 dbgenent.mod -//OASIS//ENTITIES DocBook XML Additional General Entities V${ver}//EN
164 dbhierx.mod -//OASIS//ELEMENTS DocBook XML Document Hierarchy V${vers}//EN
165 ent/iso-amsa.ent ISO 8879:1986//ENTITIES Added Math Symbols: Arrow Relations//EN
166 ent/iso-amso.ent ISO 8879:1986//ENTITIES Added Math Symbols: Ordinary//EN
167 ent/iso-cyr1.ent ISO 8879:1986//ENTITIES Russian Cyrillic//EN
168 ent/iso-tech.ent ISO 8879:1986//ENTITIES General Technical//EN
169 ent/iso-amsc.ent ISO 8879:1986//ENTITIES Added Math Symbols: Delimiters//EN
170 soextblx.dtd -//OASIS//DTD XML Exchange Table Model 19990315//EN
171 calstblx.dtd -//OASIS//DTD DocBook XML CALS Table Model V${ver}//EN
172 ent/iso-lat1.ent ISO 8879:1986//ENTITIES Added Latin 1//EN
173 ent/iso-amsb.ent ISO 8879:1986//ENTITIES Added Math Symbols: Binary Operators//EN
174 ent/iso-lat2.ent ISO 8879:1986//ENTITIES Added Latin 2//EN
175 ent/iso-amsr.ent ISO 8879:1986//ENTITIES Added Math Symbols: Relations//EN
176 ent/iso-cyr2.ent ISO 8879:1986//ENTITIES Non-Russian Cyrillic//EN
29ce5abf 177 ENDENT
ed1ec747 178
72fd38a0
SS
179 for f in System URI; do
180 /usr/bin/xmlcatalog --noout --add rewrite${f} "http://www.oasis-open.org/docbook/xml/${ver}" \
181 /usr/share/sgml/docbook/${fmt}-dtd-${ver} /etc/sgml/docbook/xmlcatalog > /dev/null 2>/dev/null
182 done
183 fi
184 done
185
186 sed -ni '
187 /xml-docbook/ H
188 /xml-docbook/ !p
189 $ {
190 g
191 s/^\n//p
192 }
193 ' /etc/sgml/catalog
ed1ec747
SS
194
195 # Finally, make sure everything in /etc/sgml is readable!
196 chmod a+r /etc/sgml/*
197 end
198
199 script postun
ed1ec747
SS
200 # remove entries only on removal of package
201 if [ "$1" = 0 ]; then
1f9bc2f0 202
ed1ec747
SS
203 entities="
204 ent/iso-pub.ent
205 ent/iso-grk1.ent
206 dbpoolx.mod
207 ent/iso-box.ent
208 docbookx.dtd
209 ent/iso-grk3.ent
210 ent/iso-amsn.ent
211 ent/iso-num.ent
212 dbcentx.mod
213 ent/iso-grk4.ent
214 dbnotnx.mod
215 ent/iso-dia.ent
216 ent/iso-grk2.ent
217 dbgenent.mod
218 dbhierx.mod
219 ent/iso-amsa.ent
220 ent/iso-amso.ent
221 ent/iso-cyr1.ent
222 ent/iso-tech.ent
223 ent/iso-amsc.ent
224 soextblx.dtd
225 calstblx.dtd
226 ent/iso-lat1.ent
227 ent/iso-amsb.ent
228 ent/iso-lat2.ent
229 ent/iso-amsr.ent
230 ent/iso-cyr2.ent"
231
232 for dir in %{directories}; do
233 fmt=${dir#*-} ver=${dir%%-*}
234
235 ## SGML catalog
236 # Update the centralized catalog corresponding to this version of the DTD
237 /usr/bin/xmlcatalog --noout --sgml --del /etc/sgml/catalog /etc/sgml/$fmt-docbook-$ver.cat
238 rm -f /etc/sgml/$fmt-docbook-$ver.cat
239
240 ## XML catalog
241 if [ $fmt = xml -a -w /usr/share/sgml/docbook/xmlcatalog ]; then
242 for f in $entities; do
243 case $ver in 4.[45]) f=${f/-/} ;; esac
244 /usr/bin/xmlcatalog --noout --del /usr/share/sgml/docbook/$fmt-dtd-$ver/$f /usr/share/sgml/docbook/xmlcatalog
245 done
246 /usr/bin/xmlcatalog --noout --del /usr/share/sgml/docbook/$fmt-dtd-$ver /usr/share/sgml/docbook/xmlcatalog
247 fi
248 done
249
250 # See the comment attached to this command in the postin scriptlet.
251 sed -ni '
252 /xml-docbook/ H
253 /xml-docbook/ !p
254 $ {
255 g
256 s/^\n//p
257 }
258 ' /etc/sgml/catalog
259 fi
260 end
261 end
ed1ec747 262end